/* ============================================================
   ROSARIO – CRM  |  Agencia BSE
   Paleta: tema oscuro ejecutivo — Azul BSE de acento, fondo carbón/slate
   ============================================================ */

:root {
  /* Escala de acento (se mantiene — ya funcionaba bien sobre fondos oscuros:
     sidebar, botones, headers de color) */
  --blue-900: #002060;
  --blue-800: #003087;
  --blue-700: #0047AB;
  --blue-600: #0055B8;
  --blue-500: #1A73E8;
  --blue-400: #4A9EE0;
  --blue-300: #93C5FD;
  --blue-100: #1D3A63;              /* antes #DBEAFE — chip/badge sobre fondo oscuro */
  --blue-50:  rgba(74,158,224,.10); /* antes #EFF6FF — wash sutil, se adapta a lo que tenga debajo */

  --heading:  #7EB4F5; /* NUEVO — texto de énfasis (títulos, KPIs) sobre superficies oscuras */

  --teal:     #0D9488;
  --green:    #16A34A;
  --orange:   #EA580C;
  --red:      #DC2626;
  --red-bg:   rgba(220,38,38,.14);   /* antes #FEF2F2 */
  --yellow:   #D97706;
  --yellow-bg:rgba(217,119,6,.16);   /* antes #FFFBEB */
  --yellow-border: #FCD34D;

  /* Escala neutra — invertida para tema oscuro */
  --gray-900: #EDF1F7; /* texto principal (antes #111827) */
  --gray-700: #C7D0DE; /* texto secundario (antes #374151) */
  --gray-500: #93A2BB; /* texto atenuado (antes #6B7280) */
  --gray-300: #2B3A54; /* bordes/divisores (antes #D1D5DB) */
  --gray-100: #182338; /* fondo sutil / hover (antes #F3F4F6) */
  --gray-50:  #0B1220; /* fondo de página (antes #F9FAFB) */

  --white:    #FFFFFF; /* sin cambios — texto blanco sobre elementos de color, no fondo de tarjeta */
  --surface:  #131C2E; /* NUEVO — fondo de tarjetas/paneles (reemplaza el uso de --white como fondo) */

  --sidebar-w: 260px;
  --sidebar-collapsed: 64px;
  --topbar-h: 56px;
  --radius:   8px;
  --radius-lg:12px;
  --shadow:   0 1px 4px rgba(0,0,0,.4);
  --shadow-md:0 4px 16px rgba(0,0,0,.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  color: var(--gray-900);
  background: var(--gray-50);
  overflow: hidden;
}

a { text-decoration: none; color: inherit; }

/* ── LAYOUT ─────────────────────────────────────────────── */
body { display: flex; }

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--blue-900);
  display: flex;
  flex-direction: column;
  transition: width .25s ease;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .logo-text,
.sidebar.collapsed .user-details,
.sidebar.collapsed .confidential-badge { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left .25s ease;
  overflow: hidden;
}
.main-content.expanded { margin-left: var(--sidebar-collapsed); }

/* ── SIDEBAR HEADER ─────────────────────────────────────── */
.sidebar-header {
  padding: 16px 12px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.1);
  min-height: 64px;
}

.sidebar-logo { display: flex; align-items: center; gap: 10px; overflow: hidden; }

.logo-icon {
  min-width: 36px; height: 36px;
  background: var(--blue-500);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 11px; color: var(--white);
  letter-spacing: .5px;
}

.logo-text { display: flex; flex-direction: column; overflow: hidden; }
.logo-main {
  font-size: 12px; font-weight: 700;
  color: var(--white); white-space: nowrap;
  letter-spacing: .5px;
}
.logo-sub { font-size: 10px; color: var(--blue-300); white-space: nowrap; }

.sidebar-toggle {
  background: none; border: none; color: rgba(255,255,255,.6);
  cursor: pointer; font-size: 18px; padding: 4px;
  border-radius: 4px; transition: color .15s;
  flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--white); }

/* ── SIDEBAR NAV ─────────────────────────────────────────── */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 8px; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.nav-group { margin-bottom: 20px; }

.nav-group-label {
  font-size: 10px; font-weight: 700;
  color: rgba(255,255,255,.4);
  letter-spacing: 1.2px;
  padding: 0 8px 6px;
  display: block;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: rgba(255,255,255,.75);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
  position: relative;
  margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: var(--white); }
.nav-item.active { background: var(--blue-600); color: var(--white); }

.nav-icon { font-size: 16px; min-width: 20px; text-align: center; }
.nav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.nav-badge {
  font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 10px;
  min-width: 20px; text-align: center;
}
.badge-red    { background: var(--red);    color: var(--white); }
.badge-yellow { background: var(--yellow); color: var(--white); }

/* ── SIDEBAR FOOTER ─────────────────────────────────────── */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,.1);
}

.user-info { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }

.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--blue-500);
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}

.user-details { display: flex; flex-direction: column; overflow: hidden; }
.user-name  { font-size: 12px; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { font-size: 10px; color: var(--blue-300); white-space: nowrap; }

.confidential-badge {
  font-size: 10px; font-weight: 700;
  color: var(--yellow-border);
  text-align: center;
  padding: 4px;
  border: 1px solid var(--yellow-border);
  border-radius: 4px;
  letter-spacing: .5px;
}

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--gray-300);
  display: flex; align-items: center;
  padding: 0 20px; gap: 16px;
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}

.topbar-left { flex: 1; }

.breadcrumb {
  font-size: 15px; font-weight: 600;
  color: var(--heading);
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--gray-50);
  border: 1px solid var(--gray-300);
  border-radius: 20px;
  padding: 6px 14px;
  transition: border-color .15s;
}
.search-box:focus-within { border-color: var(--blue-500); background: var(--surface); }

.search-icon { color: var(--gray-500); font-size: 14px; }

.search-box input {
  border: none; background: none; outline: none;
  font-size: 13px; width: 220px; color: var(--gray-900);
}

.topbar-date { font-size: 12px; color: var(--gray-500); white-space: nowrap; }

.topbar-cotiz { font-size: 12.5px; color: var(--gray-700); white-space: nowrap; }
.topbar-cotiz strong { color: var(--heading); font-weight: 700; }

.btn-icon {
  background: none; border: none; cursor: pointer;
  font-size: 18px; padding: 6px; border-radius: 6px;
  color: var(--gray-700); position: relative;
  transition: background .15s;
}
.btn-icon:hover { background: var(--gray-100); }

.notif-dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red);
}

/* ── CONTENT AREA ───────────────────────────────────────── */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}
.content-area::-webkit-scrollbar { width: 6px; }
.content-area::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }

/* ── MODULE ─────────────────────────────────────────────── */
.module { display: none; }
.module.active { display: block; }

/* Dashboard Ejecutivo: ancho tipo hoja A4 (210mm ≈ 794px a 96dpi), centrado — en vez de
   estirarse de punta a punta en monitores anchos, queda con proporción de página. Además
   compactado (menos padding/gaps, KPIs en una sola fila, gráficos más bajos) para que entre
   en menos scroll — antes, al angostar el ancho, los 6 KPI se envolvían a 2 filas y alargaban
   la vista de más. */
#mod-dashboard { max-width: 820px; margin: 0 auto; }
#mod-dashboard .module-header { margin-bottom: 14px; }
#mod-dashboard .kpi-grid { gap: 10px; margin-bottom: 14px; }
#mod-dashboard .kpi-card { padding: 12px 10px; gap: 8px; }
#mod-dashboard .kpi-icon { font-size: 20px; }
#mod-dashboard .kpi-value { font-size: 18px; }
#mod-dashboard .kpi-label { font-size: 10px; margin-top: 2px; }
#mod-dashboard .charts-grid { gap: 10px; margin-bottom: 14px; }
#mod-dashboard .chart-card { padding: 12px; }
/* Chart.js con maintainAspectRatio:false necesita que el padre INMEDIATO del canvas tenga una
   altura fija en px — si no, al no tener de dónde tomar referencia, el canvas (sobre todo las
   donas) crecía sin límite y era la causa real de que el dashboard se viera "muy largo". */
.chart-canvas-wrap { position: relative; width: 100%; height: 160px; }
.chart-canvas-wrap-wide { height: 120px; }
#mod-dashboard .section-card { margin-bottom: 14px; }
@media (min-width: 700px) {
  #mod-dashboard .kpi-grid { grid-template-columns: repeat(6, 1fr); }
}

.module-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}

.module-title {
  font-size: 22px; font-weight: 700;
  color: var(--heading);
}

.module-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
  transition: filter .15s, opacity .15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { filter: brightness(.95); }

.btn-primary   { background: var(--blue-600);  color: var(--white); }
.btn-secondary { background: var(--gray-100);  color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-danger    { background: var(--red);        color: var(--white); }
.btn-success   { background: var(--green);      color: var(--white); }
.btn-warning   { background: var(--yellow);     color: var(--white); }
.btn-outline   { background: transparent; color: var(--blue-600); border: 1px solid var(--blue-400); }
.btn-full      { width: 100%; justify-content: center; margin-top: 12px; }

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── KPI CARDS ───────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow);
  border-left: 4px solid transparent;
  transition: transform .15s, box-shadow .15s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.kpi-blue   { border-left-color: var(--blue-600); }
.kpi-teal   { border-left-color: var(--teal); }
.kpi-orange { border-left-color: var(--orange); }
.kpi-red    { border-left-color: var(--red); }
.kpi-green  { border-left-color: var(--green); }
.kpi-yellow { border-left-color: var(--yellow); }

.kpi-icon { font-size: 28px; opacity: .85; }

.kpi-value {
  font-size: 26px; font-weight: 800;
  color: var(--heading);
  line-height: 1;
}
.kpi-label {
  font-size: 12px; color: var(--gray-500);
  margin-top: 4px; font-weight: 500;
}

/* ── INICIO (pantalla de entrada) ───────────────────────── */
.inicio-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.inicio-tile {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center;
  cursor: pointer;
  border-top: 4px solid var(--blue-600);
  transition: transform .15s, box-shadow .15s;
}
.inicio-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.inicio-tile-icon { font-size: 34px; }
.inicio-tile-label { font-size: 15px; font-weight: 700; color: var(--heading); }

.inicio-widgets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) {
  .inicio-widgets-grid { grid-template-columns: 1fr; }
}

/* ── CALCULADORA ─────────────────────────────────────────── */
.calc-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.calc-grid button { padding: 14px 0; font-size: 16px; }

/* ── CHARTS ─────────────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.chart-wide { grid-column: 1 / -1; }

@media (max-width: 1100px) {
  .charts-grid { grid-template-columns: 1fr 1fr; }
}

/* selector de tipo de gráfico en cada tarjeta */
.chart-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chart-type-sel {
  font-size: 11px; font-weight: 400;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  padding: 2px 4px;
  background: var(--surface);
  cursor: pointer;
  text-transform: none; letter-spacing: 0;
}

.chart-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.chart-title {
  font-size: 13px; font-weight: 700;
  color: var(--heading);
  margin-bottom: 14px;
  text-transform: uppercase; letter-spacing: .5px;
}

/* ── SECTION CARD ────────────────────────────────────────── */
.section-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}

.section-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  font-size: 13px; font-weight: 700;
  border-bottom: 1px solid var(--gray-100);
  text-transform: uppercase; letter-spacing: .5px;
}

.alert-header { background: var(--red-bg);    color: var(--red); }
.note-header  { background: var(--yellow-bg); color: var(--yellow); }

/* ── TABLES ─────────────────────────────────────────────── */
.table-container { overflow-x: auto; }

.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}

.data-table thead tr {
  background: var(--blue-50);
  border-bottom: 2px solid var(--blue-100);
}

.data-table th {
  padding: 11px 14px;
  text-align: left; font-weight: 700;
  color: var(--heading);
  font-size: 12px; text-transform: uppercase; letter-spacing: .4px;
  cursor: pointer; white-space: nowrap;
  user-select: none;
}
.data-table th:hover { color: var(--blue-600); }

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}

.data-table tbody tr:hover { background: var(--blue-50); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* Estado badges en tabla */
.badge {
  display: inline-block;
  padding: 2px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 700;
  white-space: nowrap;
}
.badge-vigente    { background: #DCFCE7; color: #166534; }
.badge-vencida    { background: #FEF9C3; color: #854D0E; }
.badge-cancelada  { background: var(--red); color: var(--white); }
.badge-por-vencer { background: #FEF9C3; color: #854D0E; }
.badge-renovada   { background: #E0E7FF; color: #3730A3; }
.badge-accidentes { background: #DCFCE7; color: #166534; }
/* Provisoria: alta hecha desde el listado del BSE, todavía sin bienes cargados.
   Naranja fuerte a propósito — es un pendiente de trabajo, no un estado de reposo. */
.badge-provisoria { background: #F97316; color: #fff; }

/* La fila entera se tiñe de naranja suave para que el pendiente se vea de lejos
   sin tener que leer el badge. Al cargar los bienes la póliza pasa a Vigente y
   la clase desaparece sola en el próximo repintado. */
tr.fila-provisoria { background: #FFF7ED; }
tr.fila-provisoria:hover { background: #FFEDD5; }
tr.fila-provisoria td:first-child { box-shadow: inset 3px 0 0 #F97316; }
.badge-pendiente  { background: #FEF9C3; color: #854D0E; }
.badge-pagado     { background: #DCFCE7; color: #166534; }
.badge-vencido    { background: #FEE2E2; color: #991B1B; }
.badge-abierto    { background: #DBEAFE; color: #1E40AF; }
.badge-cerrado    { background: #F3F4F6; color: #374151; }

/* ── FORMS ───────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--gray-700); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: .3px;
}
.form-control {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 13px; color: var(--gray-900);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(26,115,232,.15);
}
textarea.form-control { resize: vertical; }

.search-inline {
  padding: 7px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 20px;
  font-size: 13px; outline: none;
  background: var(--gray-50);
  color: var(--gray-900);
  min-width: 200px;
  transition: border-color .15s;
}
.search-inline:focus { border-color: var(--blue-500); background: var(--surface); }

.select-filter {
  padding: 7px 10px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 13px; outline: none;
  background: var(--surface); cursor: pointer;
  color: var(--gray-700);
}
.select-filter:focus { border-color: var(--blue-500); }

/* ── NOTAS ───────────────────────────────────────────────── */
.notas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.nota-card {
  background: var(--yellow-bg);
  border: 1px solid var(--yellow-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  position: relative;
  box-shadow: 0 2px 8px rgba(217,119,6,.12);
  transition: transform .15s;
}
.nota-card:hover { transform: translateY(-2px); }

.nota-header-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 8px;
}

.nota-titulo { font-weight: 700; font-size: 14px; color: var(--gray-900); }
.nota-prioridad {
  font-size: 10px; font-weight: 800;
  padding: 2px 7px; border-radius: 10px;
  text-transform: uppercase;
}
.prioridad-alta   { background: var(--red);    color: var(--white); }
.prioridad-media  { background: var(--yellow);  color: var(--white); }
.prioridad-baja   { background: var(--teal);    color: var(--white); }

.nota-contenido { font-size: 13px; color: var(--gray-700); margin-bottom: 10px; line-height: 1.5; }
.nota-meta { font-size: 11px; color: var(--gray-500); }
.nota-actions { display: flex; gap: 6px; margin-top: 10px; }

.notas-mini-list { padding: 12px 20px; }
.nota-mini {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 8px 0; border-bottom: 1px solid var(--yellow-border);
}
.nota-mini:last-child { border-bottom: none; }
.nota-mini-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--yellow); flex-shrink: 0; margin-top: 4px;
}
.nota-mini-text { font-size: 12px; color: var(--gray-700); }

/* ── ALERTAS ─────────────────────────────────────────────── */
.alertas-container { display: flex; flex-direction: column; gap: 10px; }

.alertas-grupo { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }
.alertas-grupo-titulo {
  font-size: 12px; font-weight: 700; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: .04em;
  margin: 6px 2px 2px;
}

.alerta-item {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  border-left: 4px solid var(--red);
  box-shadow: var(--shadow);
}
.alerta-item.warning { border-left-color: var(--yellow); }
.alerta-item.peligro { border-left-color: var(--orange); }
.alerta-item.info    { border-left-color: var(--blue-500); }

.alerta-icon { font-size: 20px; flex-shrink: 0; }
.alerta-content { flex: 1; }
.alerta-title { font-weight: 700; font-size: 14px; color: var(--gray-900); }
.alerta-desc  { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.alerta-date  { font-size: 11px; color: var(--gray-400); margin-top: 4px; }

/* ── AVISOS (una sola pantalla: categorías a la izquierda, detalle a la derecha) ───────── */
.avisos-hint { font-size: 13px; color: var(--gray-500); margin: -6px 0 14px; }
.avisos-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 20px; align-items: start; }
.avisos-rail { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 12px; }
.avisos-cat {
  display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 2px 10px;
  text-align: left; width: 100%;
  background: var(--surface); color: var(--gray-900);
  border: 1px solid var(--gray-300); border-radius: var(--radius);
  padding: 10px 12px; cursor: pointer; font: inherit;
}
.avisos-cat:hover { background: var(--gray-100); }
.avisos-cat.activa { border-color: var(--blue-400); background: var(--blue-50); }
.avisos-cat.destacada { border-color: var(--red); background: var(--red-bg); }
.avisos-cat.destacada.activa { box-shadow: 0 0 0 1px var(--red) inset; }
.avisos-cat:focus-visible { outline: 2px solid var(--blue-400); outline-offset: 2px; }
.avisos-cat-icono { grid-row: 1 / span 2; font-size: 18px; }
.avisos-cat-titulo { font-weight: 600; font-size: 14px; }
.avisos-cat-detalle { grid-column: 2 / span 2; font-size: 12px; color: var(--gray-500); }
.avisos-pill {
  min-width: 26px; text-align: center; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--gray-300); color: var(--gray-900);
}
.avisos-pill.urgente { background: var(--red); color: #fff; }
.avisos-panel { min-width: 0; }
.dash-avisos { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; padding: 14px; }
.avisos-toolbar { margin-bottom: 12px; }
.avisos-nota {
  font-size: 13px; color: var(--gray-700); background: var(--surface);
  border: 1px dashed var(--gray-300); border-radius: var(--radius); padding: 10px 14px; margin-top: 10px;
}
.avisos-nota a { color: var(--blue-300); cursor: pointer; text-decoration: underline; }
@media (max-width: 900px) {
  .avisos-layout { grid-template-columns: 1fr; }
  .avisos-rail { flex-direction: row; overflow-x: auto; position: static; padding-bottom: 4px; }
  .avisos-cat { width: auto; min-width: 190px; flex: 0 0 auto; }
}

/* ── COMUNICACIONES ─────────────────────────────────────── */
.comm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) { .comm-grid { grid-template-columns: 1fr; } }

.comm-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.comm-card-header {
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; font-size: 14px;
}
.whatsapp-header { background: #25D366; color: var(--white); }
.outlook-header  { background: var(--blue-700); color: var(--white); }

.comm-card-body { padding: 20px; }

.conn-status { font-size: 11px; font-weight: 600; opacity: .9; }

.comm-templates {
  margin-bottom: 8px;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.template-label { font-size: 11px; color: var(--gray-500); font-weight: 600; }

/* ── DOCUMENTOS ─────────────────────────────────────────── */
.doc-workspace {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.doc-toolbar-meta {
  display: flex; gap: 12px; align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
  flex-wrap: wrap;
}

.doc-title-input {
  flex: 1; min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 15px; font-weight: 600;
  outline: none;
}
.doc-title-input:focus { border-color: var(--blue-500); }

.quill-editor { min-height: 400px; font-size: 14px; }
.ql-toolbar { border: none !important; border-bottom: 1px solid var(--gray-200) !important; }
.ql-container { border: none !important; }
.ql-editor { min-height: 360px; font-family: 'Segoe UI', sans-serif; font-size: 14px; }

.doc-list { padding: 12px 20px; display: flex; flex-direction: column; gap: 8px; }
.doc-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  background: var(--gray-50);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}
.doc-item-name { font-weight: 600; font-size: 13px; }
.doc-item-meta { font-size: 11px; color: var(--gray-500); margin-top: 2px; }
.doc-item-actions { display: flex; gap: 6px; }

/* ── IMPORTAR ────────────────────────────────────────────── */
.import-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.import-card {
  background: var(--surface);
  border: 2px dashed var(--blue-300);
  border-radius: var(--radius-lg);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.import-card:hover {
  border-color: var(--blue-600);
  background: var(--blue-50);
  transform: translateY(-2px);
}

.import-icon { font-size: 40px; margin-bottom: 10px; }
.import-label { font-weight: 700; font-size: 14px; color: var(--heading); margin-bottom: 8px; }
.import-hint  { font-size: 11px; color: var(--gray-500); line-height: 1.5; }

.import-log {
  padding: 12px 20px;
  max-height: 300px;
  overflow-y: auto;
  font-family: 'Consolas', monospace;
  font-size: 12px;
}

.log-entry {
  padding: 4px 0;
  border-bottom: 1px solid var(--gray-100);
  display: flex; gap: 10px;
}
.log-time   { color: var(--gray-400); white-space: nowrap; }
.log-ok     { color: var(--green); }
.log-warn   { color: var(--yellow); }
.log-error  { color: var(--red); }
.log-empty  { color: var(--gray-400); font-style: italic; }

/* ── CONFIGURACIÓN ───────────────────────────────────────── */
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.config-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.config-section-title {
  font-size: 15px; font-weight: 700;
  color: var(--heading);
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--blue-100);
}

.config-danger { border: 1px solid #FECACA; }

.config-note {
  font-size: 12px; color: var(--gray-600);
  line-height: 1.6; margin-bottom: 8px;
  padding: 10px;
  background: var(--red-bg);
  border-radius: var(--radius);
  border-left: 3px solid var(--red);
}

/* ── PLANILLAS ───────────────────────────────────────────── */
.planilla-preview {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

/* ── MODAL ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 580px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-md);
  animation: slideIn .2s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--blue-900);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-header h2 { font-size: 16px; font-weight: 700; color: var(--white); }

.modal-close {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.7); font-size: 18px;
  padding: 4px; border-radius: 4px;
  transition: color .15s;
}
.modal-close:hover { color: var(--white); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

/* Form 2 columns inside modal */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── TABLA ACTIVA (edición de cliente / póliza / siniestro) ── */
.modal--tabla { max-width: 760px; }

.tabla-activa {
  width: 100%;
  border-collapse: collapse;
}
.tabla-activa tr { border-bottom: 1px solid var(--gray-100); }
.tabla-activa tr:last-child { border-bottom: none; }
.tabla-activa tr:hover { background: var(--gray-50); }

.tabla-activa th {
  width: 215px;
  text-align: left;
  padding: 8px 14px 8px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .04em;
  vertical-align: middle;
  white-space: nowrap;
}
.tabla-activa td { padding: 3px 4px; }

.ta-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  color: var(--gray-900);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.ta-input:hover { border-color: var(--gray-300); }
.ta-input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(26,115,232,.14);
}
.ta-input[readonly] { color: var(--gray-500); }
select.ta-input { cursor: pointer; }
textarea.ta-input { resize: vertical; min-height: 38px; }

@media (max-width: 640px) {
  .tabla-activa th { width: 110px; white-space: normal; }
}

/* ── TOAST ───────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 2000;
}

.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  color: var(--white);
  box-shadow: var(--shadow-md);
  animation: toastIn .25s ease;
  max-width: 340px;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}
.toast.fadeOut { animation: toastOut .3s ease forwards; }
@keyframes toastOut {
  to { opacity: 0; transform: translateX(40px); }
}

.toast-success { background: var(--green); }
.toast-error   { background: var(--red); }
.toast-warning { background: var(--yellow); }
.toast-info    { background: var(--blue-600); }

/* ── UTILITIES ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 30px;
  color: var(--gray-400);
  font-style: italic;
  font-size: 13px;
}

.action-btn {
  background: none; border: none; cursor: pointer;
  padding: 4px 8px; border-radius: 4px;
  font-size: 14px; transition: background .15s;
}
.action-btn:hover { background: var(--gray-100); }
.action-edit   { color: var(--blue-600); }
.action-delete { color: var(--red); }
.action-wa     { color: #25D366; }
.action-email  { color: var(--blue-600); }

.hidden { display: none !important; }

/* ── PDF DROPZONE (Siniestros) ───────────────────────────── */
.pdf-dropzone {
  border: 2px dashed var(--red);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  cursor: pointer;
  background: var(--red-bg);
  transition: background .15s, border-color .15s, transform .15s;
  user-select: none;
}
.pdf-dropzone:hover,
.pdf-dropzone.drag-over {
  background: #FEE2E2;
  border-color: #B91C1C;
  transform: scale(1.01);
}
.pdf-drop-icon  { font-size: 48px; margin-bottom: 10px; }
.pdf-drop-title { font-size: 16px; font-weight: 700; color: var(--red); margin-bottom: 6px; }
.pdf-drop-sub   { font-size: 12px; color: var(--gray-500); margin-bottom: 10px; }
.pdf-drop-folder {
  display: inline-block;
  font-size: 11px; color: var(--heading);
  background: var(--blue-50);
  border: 1px solid var(--blue-300);
  padding: 3px 10px; border-radius: 10px;
}

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .main-content { margin-left: var(--sidebar-collapsed); }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .module-title { font-size: 18px; }
  .search-box input { width: 140px; }
}

/* ── FICHA CLIENTE ───────────────────────────────────────── */
.ficha-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1100;
  align-items: flex-start;
  justify-content: flex-end;
}
.ficha-overlay.open { display: flex; }

.ficha-panel {
  width: min(680px, 95vw);
  height: 100vh;
  background: var(--surface);
  overflow-y: auto;
  box-shadow: -4px 0 32px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
}

.ficha-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--blue-900);
  color: #fff;
  position: sticky; top: 0; z-index: 10;
}
.ficha-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--blue-700);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 700;
  flex-shrink: 0;
}
.ficha-header-info h2 { font-size: 1.15rem; font-weight: 700; color:#fff; }
.ficha-header-sub { display:flex; align-items:center; gap:.5rem; margin-top:.2rem; flex-wrap:wrap; }
.ficha-header .modal-close { color:#fff; background:transparent; border:none; font-size:1.3rem; cursor:pointer; padding:.25rem; }

.ficha-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1.25rem; }

.ficha-section {
  background: var(--gray-50);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  overflow: hidden;
}
.ficha-section-title {
  background: var(--blue-50);
  border-bottom: 1px solid var(--blue-300);
  padding: .6rem 1rem;
  font-weight: 600;
  font-size: .85rem;
  color: var(--heading);
  display: flex; align-items: center; gap: .4rem;
}
.ficha-section-body { padding: .75rem 1rem; }

.ficha-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem .75rem;
}
.ficha-info-item label {
  font-size: .75rem; color: var(--gray-500); display:block; margin-bottom:1px;
}
.ficha-info-item span { font-size: .9rem; font-weight: 500; }

.ficha-rol-box {
  border-radius: var(--radius);
  padding: .75rem 1rem;
  font-size: .9rem;
  display: flex; align-items: center; gap: .6rem;
}
.ficha-rol-box.solo-contratante { background:#EEF2FF; border:1.5px solid #818CF8; color:#3730A3; }
.ficha-rol-box.solo-asegurado   { background:#F0FDF4; border:1.5px solid #4ADE80; color:#15803D; }

/* Sección que se queda fija en pantalla mientras se scrollea el resto de la ficha (ej. la
   Bitácora del siniestro, pedido explícito del usuario) — se pega justo debajo del encabezado
   (.ficha-header, sticky top:0, alto real ~92px: avatar 52px + padding 20px arriba/abajo) y se
   distingue con borde/sombra propios para que se lea como "recuadro aparte". */
.ficha-section-fija {
  position: sticky;
  top: 92px;
  z-index: 5;
  border: 1.5px solid var(--blue-400, #60a5fa);
  box-shadow: 0 4px 14px rgba(0,0,0,.16);
}

.ficha-poliza-item, .ficha-siniestro-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background .15s;
}
.ficha-poliza-item:last-child, .ficha-siniestro-item:last-child { border-bottom: none; }
.ficha-poliza-item:hover, .ficha-siniestro-item:hover { background: var(--blue-50); }

.ficha-poliza-num { font-weight: 700; color: var(--heading); min-width: 80px; }
.ficha-poliza-ramo { flex: 1; }
.ficha-poliza-venc { font-size: .8rem; color: var(--gray-500); }

.ficha-empty { color: var(--gray-500); font-size: .85rem; padding: .5rem 0; font-style: italic; }

.badge-tipo { background: var(--blue-100); color: var(--heading); font-size:.75rem; padding:2px 7px; border-radius:4px; font-weight:600; }
.badge-rol-ca { background:#D1FAE5; color:#065F46; }
.badge-rol-c  { background:#DBEAFE; color:#1E40AF; }
.badge-rol-a  { background:#FEF3C7; color:#92400E; }

.badge-vip {
  background: linear-gradient(135deg, #FDE68A, #F59E0B);
  color: #78350F; font-weight: 800; padding: 2px 8px; border-radius: 4px;
  font-size: .75rem; letter-spacing: .03em; white-space: nowrap;
}

.badge-prospecto {
  background: var(--teal); color: #fff; font-weight: 700; padding: 2px 8px; border-radius: 4px;
  font-size: .75rem; letter-spacing: .03em; white-space: nowrap;
}

/* Desplegable de sugerencias propio (reemplaza <input list><datalist> nativo — ver
   armarBuscadorConSugerencias en app.js). Se posiciona relativo al contenedor con
   position:relative que lo envuelve, así que viaja bien con paneles arrastrables. */
.sugerencias-lista {
  display: none;
  position: absolute; top: 100%; left: 0; right: 0; margin-top: 2px;
  background: var(--surface); border: 1px solid var(--gray-300); border-radius: 6px;
  box-shadow: var(--shadow-md); max-height: 220px; overflow-y: auto; z-index: 60;
}
.sugerencias-lista.open { display: block; }
.sugerencia-item { padding: 6px 12px; font-size: .85rem; cursor: pointer; color: var(--gray-900); }
.sugerencia-item:hover { background: var(--blue-50); }

tr.fila-cliente { cursor: pointer; }
tr.fila-cliente:hover td { background: var(--blue-50) !important; }

/* ── FICHA PÓLIZA (formato Aviso de Vencimiento BSE) ─────── */
.ficha-pol-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1200;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 2rem 1rem;
}
.ficha-pol-overlay.open { display: flex; }

.ficha-pol-panel {
  width: min(820px, 100%);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
  overflow: hidden;
  margin-bottom: 2rem;
}

.fpol-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-bottom: 3px solid var(--blue-800);
}
.fpol-logo {
  width: 54px; height: 38px;
  background: var(--blue-800);
  border-radius: 50% / 42%;
  color: var(--white);
  font-weight: 800; font-size: 15px; letter-spacing: 1px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.fpol-header-titles { flex: 1; min-width: 0; }
.fpol-header-titles h2 { font-size: 1rem; font-weight: 700; color: var(--gray-900); letter-spacing: .3px; }
.fpol-header-sub { font-size: .75rem; color: var(--gray-500); }
.fpol-header-fecha { font-size: .8rem; color: var(--gray-700); white-space: nowrap; }
.fpol-print-btn { font-size: .8rem; padding: .35rem .7rem; }

.fpol-body {
  padding: 1.25rem 1.5rem;
  display: flex; flex-direction: column; gap: 1rem;
  font-size: .875rem;
}

/* Caja enmarcada estilo formulario BSE */
.fpol-box {
  border: 1.5px solid var(--gray-700);
  border-radius: 3px;
  padding: .75rem 1rem;
  position: relative;
}
.fpol-box-title {
  position: absolute;
  top: -0.7em; left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  padding: 0 .75rem;
  font-weight: 700; font-size: .8rem;
  letter-spacing: .5px;
  color: var(--gray-900);
  white-space: nowrap;
}
.fpol-box:has(.fpol-box-title) { margin-top: .6rem; padding-top: 1rem; }

.fpol-row-top {
  display: flex; flex-wrap: wrap; gap: .5rem 2rem;
  font-size: .82rem;
  padding-bottom: .5rem;
  border-bottom: 1px dashed var(--gray-300);
  margin-bottom: .5rem;
}
.fpol-asegurado { font-size: .95rem; margin-bottom: .5rem; }
.fpol-ci { margin-left: 1rem; color: var(--gray-700); }

.fpol-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem 2rem;
}
.fpol-grid > div { display: flex; gap: .5rem; align-items: baseline; }
.fpol-grid label { font-weight: 700; font-size: .8rem; color: var(--gray-900); white-space: nowrap; }
.fpol-grid label::after { content: ':'; }
.fpol-grid span { color: var(--gray-700); }
.fpol-full { grid-column: 1 / -1; }

.fpol-cuotas { width: 100%; border-collapse: collapse; font-size: .82rem; }
.fpol-cuotas th {
  background: var(--blue-100);
  border: 1px solid var(--gray-700);
  padding: .3rem .5rem;
  font-weight: 700; text-align: left;
}
.fpol-cuotas td { border: 1px solid var(--gray-300); padding: .3rem .5rem; }

.fpol-empty { color: var(--gray-500); font-size: .83rem; font-style: italic; }

.fpol-footer-note {
  font-size: .72rem;
  color: var(--gray-500);
  font-style: italic;
  border-top: 1px solid var(--gray-300);
  padding-top: .5rem;
}

/* Impresión: solo la ficha de póliza */
@media print {
  body.print-fpol > *:not(.ficha-pol-overlay) { display: none !important; }
  body.print-fpol { overflow: visible; display: block; }
  body.print-fpol .ficha-pol-overlay {
    position: static;
    display: block;
    background: none;
    padding: 0;
    overflow: visible;
  }
  body.print-fpol .ficha-pol-panel { width: 100%; box-shadow: none; border-radius: 0; margin: 0; }
  body.print-fpol .fpol-print-btn,
  body.print-fpol .modal-close,
  body.print-fpol .no-print { display: none !important; }
}

/* El editor de observaciones del bien debe quedar por encima de la ficha de póliza (z 1200) */
#obs-overlay { z-index: 1300; }

/* Impresión: solo el listado de vencimientos */
@media print {
  body.print-venc .sidebar,
  body.print-venc .topbar,
  body.print-venc .module-actions,
  body.print-venc .no-print { display: none !important; }
  body.print-venc { overflow: visible; display: block; background: #fff; }
  body.print-venc .main-content { margin: 0 !important; padding: 0 !important; width: 100% !important; }
  body.print-venc .module { display: none !important; }
  body.print-venc #mod-avisos { display: block !important; }
  body.print-venc #mod-avisos .module-header,
  body.print-venc #mod-avisos .avisos-hint,
  body.print-venc #mod-avisos .avisos-rail,
  body.print-venc #mod-avisos #aviso-panel-lista { display: none !important; }
  body.print-venc #mod-avisos .avisos-layout { display: block; }
  body.print-venc .table-container { box-shadow: none; border: none; overflow: visible; }
  body.print-venc .data-table { font-size: 11px; }
  body.print-venc .data-table th, body.print-venc .data-table td { padding: 4px 6px; }
  body.print-venc .badge { border: none; padding: 0; background: none !important; color: #000 !important; }
  body.print-venc tr { break-inside: avoid; }
}

/* Impresión: solo el listado de planillas (Bienes/Vehículos, Cartera, etc.) */
@media print {
  body.print-planilla .sidebar,
  body.print-planilla .topbar,
  body.print-planilla .module-actions,
  body.print-planilla .section-card,
  body.print-planilla #planilla-actions,
  body.print-planilla .no-print { display: none !important; }
  body.print-planilla { overflow: visible; display: block; background: #fff; }
  body.print-planilla .main-content { margin: 0 !important; padding: 0 !important; width: 100% !important; }
  body.print-planilla .module { display: none !important; }
  body.print-planilla #mod-planillas { display: block !important; }
  body.print-planilla .planilla-preview { box-shadow: none; padding: 0; overflow: visible; }
  body.print-planilla .data-table { font-size: 10.5px; }
  body.print-planilla .data-table th, body.print-planilla .data-table td { padding: 3px 5px; }
  body.print-planilla .badge { border: none; padding: 0; background: none !important; color: #000 !important; }
  body.print-planilla tr { break-inside: avoid; }
}

/* ── ALERTAS SEMÁFORO ─────────────────────────────────────── */
.alerta-dot {
  cursor: pointer;
  font-size: .8rem;
  margin-left: 4px;
  opacity: .55;
  filter: grayscale(1);
  transition: opacity .15s, filter .15s, transform .1s;
  display: inline-block;
}
.alerta-dot.activa { opacity: 1; filter: none; }
.alerta-dot:hover { transform: scale(1.25); }

.alerta-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1400;
}
.alerta-overlay.open { display: flex; }
.alerta-modal { width: 100%; max-width: 440px; }

/* Ítem del panel de alertas semáforo (distinto de .alerta-item del módulo "Alertas del Sistema") */
.semaforo-item {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .6rem .75rem;
  border: 1px solid var(--gray-300);
  border-left: 4px solid var(--gray-300);
  border-radius: 6px;
  margin-bottom: .5rem;
  background: var(--gray-50);
}
.semaforo-item.rojo     { border-left-color: var(--red); }
.semaforo-item.amarillo { border-left-color: var(--yellow); }
.semaforo-item.verde    { border-left-color: var(--green); }
.semaforo-item-body { flex: 1; min-width: 0; }
.semaforo-item-msg  { font-size: .85rem; color: var(--gray-900); white-space: pre-wrap; }
.semaforo-item-meta { font-size: .72rem; color: var(--gray-500); margin-top: 2px; }
.semaforo-item-actions { display: flex; flex-direction: column; gap: .3rem; }

.alerta-color-picker { display: flex; gap: .6rem; margin: .5rem 0 .75rem; }
.alerta-color-opt {
  width: 30px; height: 30px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem;
}
.alerta-color-opt.rojo     { background: var(--red); }
.alerta-color-opt.amarillo { background: var(--yellow); }
.alerta-color-opt.verde    { background: var(--green); }
.alerta-color-opt.selected { border-color: var(--gray-900); box-shadow: 0 0 0 2px var(--white) inset; }

/* ── VÍNCULOS Y COMENTARIOS (ficha cliente) ──────────────── */
.vinculo-item, .comentario-item {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--gray-100);
}
.vinculo-item:last-child, .comentario-item:last-child { border-bottom: none; }
.vinculo-item-body { flex: 1; cursor: pointer; }
.vinculo-item-nombre { font-weight: 600; color: var(--heading); }
.vinculo-item-tipo { font-size: .75rem; color: var(--gray-500); margin-left: .4rem; }
.comentario-item-texto { font-size: .85rem; color: var(--gray-900); white-space: pre-wrap; flex: 1; }
.comentario-item-fecha { font-size: .72rem; color: var(--gray-500); white-space: nowrap; }

.form-inline-add {
  display: flex; flex-wrap: wrap; gap: .5rem;
  padding: .75rem;
  background: var(--blue-50);
  border-radius: 6px;
  margin-top: .5rem;
}
.form-inline-add input, .form-inline-add select, .form-inline-add textarea {
  flex: 1; min-width: 140px;
  padding: .4rem .6rem;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  font-size: .85rem;
  font-family: inherit;
}
.form-inline-add textarea { flex-basis: 100%; resize: vertical; min-height: 50px; }

/* ── ACCESO RÁPIDO GLOBAL (FAB WhatsApp / Email) ─────────── */
.fab-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 1500;
  display: flex; flex-direction: column; align-items: flex-end; gap: .5rem;
}
.fab-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--blue-700);
  color: var(--white);
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.28);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, background .15s;
}
.fab-btn:hover { background: var(--blue-800); transform: scale(1.06); }

.fab-menu {
  display: none;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: .25rem;
}
.fab-menu.open { display: flex; }
.fab-menu-item {
  background: var(--surface);
  border: 1px solid var(--gray-300);
  border-radius: 999px;
  padding: .55rem 1.1rem;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  white-space: nowrap;
}
.fab-menu-item:hover { background: var(--blue-50); }

/* WhatsApp (Chatwoot) embebido — Plataforma Wapp, 2026-10-05: globito + panel lateral */
.wa-fuera { max-width: 640px; display: grid; gap: 10px; padding: 18px 20px; border: 1px solid var(--gray-200, #d9e1e6); border-radius: 8px; background: var(--gray-50, #f6f8f9); }
.wa-fuera p { margin: 0; }
.wa-fuera .btn { justify-self: start; }
.wa-fuera[hidden], .wa-panel[hidden] { display: none; }
.wa-globo { position: fixed; right: 92px; bottom: 22px;   /* a la izquierda del globito de Hibot hasta el corte; después volver a 22px */ z-index: 1610; width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: #1e7a4c; color: #fff; font-size: 26px; line-height: 1; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.wa-globo:hover { filter: brightness(1.08); }
.wa-globo:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.wa-globo.abierto { background: #4b5b67; }
.wa-panel { position: fixed; top: 0; right: 0; bottom: 0; z-index: 1600; width: min(480px, 100vw); display: flex; flex-direction: column;
  background: #fff; border-left: 1px solid #d9e1e6; box-shadow: -8px 0 24px rgba(0,0,0,.18); }
.wa-panel.grande { width: min(1400px, 100vw); }
.wa-panel-barra { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border-bottom: 1px solid #d9e1e6; background: #f6f8f9; color: #17232c; }
.wa-panel-acciones { display: flex; gap: 6px; }
.wa-iframe { flex: 1; width: 100%; border: 0; background: #fff; }
@media (max-width: 600px) { .wa-panel, .wa-panel.grande { width: 100vw; } .wa-globo { right: 14px; bottom: 14px; } }
