/* CRM CIMEJAL — sistema visual.
   Base: docs/mocks/mocks.css (aprobado con el cliente). Aquí se vuelve responsivo y se agregan
   los componentes que una app real necesita (formularios, diálogos, avisos, calendario). */

/* Inter (OFL, fonts/Inter-LICENSE.txt) empaquetada: sin dependencia de Google Fonts. */
@font-face { font-family: 'Inter'; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/Inter-Regular.4145168e5230.ttf") format('truetype'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/Inter-Medium.a6f54808ec0a.ttf") format('truetype'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/Inter-SemiBold.a757947dee36.ttf") format('truetype'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/Inter-Bold.c7b5fabc34e7.ttf") format('truetype'); }

:root {
  --teal: #4a9ea6;
  --teal-dark: #2f7a81;
  --teal-deep: #1f5c62;
  --teal-light: #e6f3f4;
  --teal-soft: #cfe6e8;
  --teal-ink: #296e75; /* texto teal sobre --teal-light / --teal-soft (AA); --teal-dark no llega */
  --ink: #1f2a2c;
  /* Contraste AA (4.5:1) para texto chico: --muted y --faint-text sobre blanco, #fafbfb, --bg y --gray-bg.
     --faint (3:1) queda para íconos, separadores y el guion «—»; el texto «tenue» usa --faint-text. */
  --muted: #5f6e71;
  --faint: #7f8d90;
  --faint-text: var(--muted);
  --line: #e3e8e9;
  --line-strong: #c9d2d4;
  --bg: #f4f6f7;
  --card: #ffffff;
  --warn: #d98c2b;
  --warn-bg: #fbf1e3;
  --warn-ink: #8a5516; /* texto ámbar (AA sobre blanco y --warn-bg) */
  --danger: #c94b3a;
  --danger-bg: #f9e7e4;
  --ok: #3a9a5e;
  --ok-bg: #e5f3ea;
  --ok-ink: #2c7a4a; /* texto verde (AA sobre blanco y --ok-bg) */
  --violet: #6f5fd6;
  --violet-bg: #ebe8fa;
  --blue: #2f5fb3;
  --blue-bg: #e4edfb;
  --gray-bg: #eceff0;
  /* Gris medio de barras, puntos y leyendas (estatus «baja», etapa «no interesado»): el mismo hex de
     colores.GRIS en crm/reportes/colores.py. No es para texto (no llega a 4.5:1): para eso, --muted. */
  --gray: #9aa7a9;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 42, 44, 0.06), 0 4px 12px rgba(31, 42, 44, 0.04);
  --shadow-pop: 0 10px 30px rgba(31, 42, 44, 0.16), 0 2px 6px rgba(31, 42, 44, 0.08);
  --sidebar: 232px;
  --pad-x: 18px; /* margen lateral de tarjetas: encabezado, cuerpo, pie y primera/última celda de tabla */
  --focus-ring: 0 0 0 3px rgba(74, 158, 166, .35);
}

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

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
body { min-width: 1024px; }
a { color: inherit; text-decoration: none; }
a.link, .link { color: var(--teal-dark); font-weight: 600; }
a.link:hover { text-decoration: underline; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 13.5px; font-weight: 600; }
svg { flex: none; }

/* Foco visible y uniforme con teclado. Los campos de texto llevan halo (abajo) en lugar del contorno. */
:focus-visible { outline: 2px solid var(--teal-dark); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
/* Solo en papel (Ctrl+P), lo contrario de .no-print: p. ej. lo que dice un vacío cuyo control de pantalla no se imprime. */
.print-only { display: none; }
/* «Saltar al contenido»: primer elemento de la página, visible solo con foco. */
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 300; background: #fff; color: var(--teal-ink); font-weight: 600; padding: 9px 14px; border-radius: 8px; box-shadow: var(--shadow-pop); }
.skip-link:focus { top: 12px; }
main:focus { outline: none; }

.app {
  display: flex; min-height: 100vh;
  /* Columna blanca del menú a todo lo alto aunque la página sea más alta que la ventana. */
  background: linear-gradient(to right, #fff calc(var(--sidebar) - 1px), var(--line) calc(var(--sidebar) - 1px), var(--line) var(--sidebar), transparent var(--sidebar));
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar); flex: none;
  background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 20px 14px 0; /* el de abajo lo lleva el bloque de la cuenta, fijo al fondo (M17) */
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px var(--menu-pie-marca, 22px); }
.brand img { width: 38px; height: 44px; object-fit: contain; }
.brand .name { font-weight: 700; font-size: 15px; color: var(--teal-dark); letter-spacing: -0.01em; }
.brand .sub { font-size: 11px; color: var(--muted); }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: var(--menu-enlace-y, 9px) 10px; border-radius: 8px;
  color: var(--muted); font-weight: 500; font-size: 13.5px;
  margin-bottom: 2px;
}
.nav a:hover { background: var(--bg); color: var(--ink); }
.nav a svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a.active { background: var(--teal-light); color: var(--teal-ink); font-weight: 600; }
.nav .section { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint-text); padding: var(--menu-seccion-arriba, 16px) 10px 6px; font-weight: 600; }
.nav .badge-n { margin-left: auto; background: var(--teal-dark); color: #fff; font-size: 10.5px; padding: 1px 7px; border-radius: 10px; font-weight: 600; }
.nav .badge-n.alert { background: var(--danger); }
.sidebar .user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--line); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--teal); color: #fff; font-weight: 600; display: flex; align-items: center; justify-content: center; font-size: 12px; flex: none; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.user .who { font-size: 12.5px; font-weight: 600; }
.user .role { font-size: 11px; color: var(--muted); }

/* ---------- Main / topbar ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 60px; flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 28px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar .crumb { color: var(--faint-text); font-weight: 400; }
.topbar .crumb a:hover { color: var(--teal-dark); }
/* Con espacio, el texto de ejemplo completo (141 px de «Buscar en todo el CRM» + lupa, «/», huecos y padding = 216 px).
   Con cuatro acciones en la barra (ficha de afiliado), la caja se encoge primero (flex-shrink 10 contra el 1 del título;
   un factor menor que 1 en el título dejaría la barra desbordada) hasta 120 px, solo con la lupa (abajo, @container);
   lo que aún falte lo cede el título, con «…». */
.topbar .search {
  margin-left: auto; width: auto; flex: 0 10 300px; min-width: 120px; height: 34px; container-type: inline-size; border: 1px solid var(--line); border-radius: 8px;
  display: flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--faint); background: var(--bg);
}
.topbar .search:focus-within { border-color: var(--teal); background: #fff; box-shadow: var(--focus-ring); }
.topbar .search input { border: 0; background: transparent; outline: none; flex: 1; min-width: 0; font: inherit; color: var(--ink); height: 100%; padding: 0; box-shadow: none; }
.topbar .search input::placeholder { color: var(--faint); }
.topbar .search svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
.topbar .actions { display: flex; gap: 8px; align-items: center; }
.iconbtn { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--muted); position: relative; background: #fff; flex: none; }
.iconbtn:hover { color: var(--ink); border-color: var(--line-strong); }
.iconbtn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn .dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); border: 1.5px solid #fff; }
.iconbtn .num { position: absolute; top: -7px; right: -7px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; border: 2px solid #fff; background: var(--teal-dark); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 15px; text-align: center; font-variant-numeric: tabular-nums; }
.iconbtn .num.alert { background: var(--danger); }

.content { flex: 1; padding: 24px 28px 28px; min-width: 0; }

/* Un ancla del contenido («Saltar al contenido» a #contenido, #doc-… del checklist, #tareas-pendientes…) deja libre
   la barra superior pegajosa (60 px) con aire; las de Analítica, también bajo la barra de periodo, llevan las suyas
   (areas/analitica.css). El foco con Tab y Mayús+Tab lo cuida app.js («El foco no queda bajo las barras
   pegajosas»): un scroll-padding en el documento movía la página al enfocar algo de esas mismas barras. */
.content, :where(.content [id]) { scroll-margin-top: 72px; }

/* ---------- Dropdown (details/summary) ---------- */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
/* El clic en un summary cae siempre en el summary, no en su ícono, texto o avatar. En Safari, si el mousedown cae en
   un hijo, Tab y Opción+Tab se quedan en el summary y no entran al menú (ni salen) hasta pulsar en otra parte. Vale
   para todo details: menús, «Más datos» del alta y «Hechas esta semana». Ningún summary tiene hijos interactivos. */
summary * { pointer-events: none; }
.dropdown .menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop);
  min-width: 240px; padding: 6px;
}
.dropdown .menu.wide { width: 360px; padding: 0; }
.dropdown .menu a.item, .dropdown .menu button.item { display: flex; width: 100%; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 6px; font-size: 12.5px; text-align: left; white-space: nowrap; }
.dropdown .menu a.item:hover, .dropdown .menu button.item:hover { background: var(--bg); }
.dropdown .menu form { display: block; }
.dropdown .menu .sep { border-top: 1px solid var(--line); margin: 5px 2px; }
.dropdown .menu .item.text-danger { color: var(--danger); }
.notif-h { padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 600; display: flex; align-items: center; }
.notif-h .right { margin-left: auto; font-weight: 500; font-size: 12px; }
.notif { display: flex; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.notif:last-child { border-bottom: 0; }
.notif:hover { background: var(--bg); }
.notif .ico { color: var(--teal-dark); margin-top: 1px; }
.notif .t { font-weight: 600; }
.notif .s { font-size: 11.5px; color: var(--muted); }
.notif-empty { padding: 18px 14px; color: var(--muted); font-size: 12.5px; text-align: center; }
.notif-f { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: 11.5px; }
.notif-f .link { margin-left: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px; border-radius: 8px; font-weight: 600; font-size: 13px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); white-space: nowrap; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover { border-color: var(--line-strong); background: #fbfcfc; }
.btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--teal-dark); }
.btn.ghost:hover { background: var(--teal-light); color: var(--teal-ink); }
.btn.link-btn { border: 0; background: none; padding: 0; height: auto; color: var(--teal-dark); }
.btn.block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-group { display: inline-flex; gap: 8px; align-items: center; }

/* ---------- Cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px var(--pad-x); border-bottom: 1px solid var(--line); min-height: 50px; }
.card-h h3 { font-size: 13.5px; font-weight: 600; }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }
/* Un botón chico en el encabezado no lo hace más alto que los demás (50 px). */
.card-h .btn.sm, .card-h .iconbtn.sm { margin-block: -4px; }
.card-h .badge { margin-block: -2px; }
.card-b { padding: 16px var(--pad-x); }
.card-f { padding: 10px var(--pad-x); border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.card.flush { overflow: hidden; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpis.five { grid-template-columns: repeat(5, 1fr); }
.kpi { padding: 16px 18px; display: block; }
a.kpi:hover { border-color: var(--teal-soft); }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi .value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .value .of { color: var(--muted); font-size: 14px; font-weight: 500; }
.kpi .delta { font-size: 11.5px; margin-top: 4px; color: var(--muted); }
.kpi .delta b { color: var(--ok-ink); font-weight: 600; }
.kpi .delta b.down { color: var(--danger); }
.kpi .delta b.ink { color: var(--ink); }
.kpi .delta b.warn { color: var(--warn-ink); }
.kpi .value.danger { color: var(--danger); }
.kpi .value.teal { color: var(--teal-dark); }
.kpi .value.violet { color: var(--violet); }
.kpi .value.warn { color: #a8651a; } /* cifra grande: 3:1 basta */
.kpi .value.ok { color: var(--ok); }

/* ---------- Badges / chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.gray { background: var(--gray-bg); color: #5c6a6d; }
.badge.teal { background: var(--teal-light); color: var(--teal-ink); }
.badge.dark { background: #dcebed; color: var(--teal-deep); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge.ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge.danger { background: var(--danger-bg); color: #a63a2b; }
.badge.violet { background: var(--violet-bg); color: #5647b8; }
.badge.plain::before { display: none; }
.badge.sm { height: 20px; padding: 0 7px; font-size: 11px; }
.chip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 500; background: var(--gray-bg); color: var(--muted); white-space: nowrap; }
.chip.teal { background: var(--teal-light); color: var(--teal-ink); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { white-space: nowrap; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint-text); font-weight: 600; padding: 10px 10px; border-bottom: 1px solid var(--line); background: #fafbfb; }
th:first-child, td:first-child { padding-left: var(--pad-x); }
th:last-child, td:last-child { padding-right: var(--pad-x); }
th a { display: inline-flex; align-items: center; gap: 4px; }
th a:hover, th a.on { color: var(--teal-dark); }
th a svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2.4; }
td { white-space: nowrap; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 12.5px; }
td.wrap { white-space: normal; }
td.nowrap, .nowrap { white-space: nowrap; }
td.when { font-size: 12px; color: var(--muted); text-align: right; }
td.when .badge { vertical-align: middle; }
td .acts { justify-content: flex-end; }
tr:last-child td { border-bottom: none; }
td .co { font-weight: 600; }
td .sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.center, th.center { text-align: center; }
tr.sel td { background: var(--teal-light); }
tr.alerta td { background: var(--danger-bg); }
tr.alerta td .sub, tr.alerta td.muted, tr.alerta td .muted { color: #58666a; } /* --muted no llega a 4.5:1 sobre --danger-bg */
tr.apagada td { color: var(--muted); }
tr.row-link { cursor: pointer; }
tr.row-link:hover td { background: #f8fafa; }
tr.alerta.row-link:hover td { background: #f6dfdb; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar form { display: contents; }
.filter { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 12.5px; color: var(--ink); position: relative; }
.filter .k { color: var(--muted); }
.filter svg { width: 13px; height: 13px; stroke: var(--muted); fill: none; stroke-width: 2; }
.filter select, .filter input {
  border: 0; background: transparent; font: inherit; color: var(--ink); outline: none; height: 30px;
  -webkit-appearance: none; appearance: none; padding-right: 16px; cursor: pointer;
}
.filter input[type="date"], .filter input[type="month"] { padding-right: 0; cursor: text; }
.filter select + svg { position: absolute; right: 10px; pointer-events: none; }
.filter:focus-within { border-color: var(--teal); box-shadow: var(--focus-ring); }
.filter.search-filter input { width: 200px; cursor: text; padding-right: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; height: 32px; background: #fff; }
.seg > a, .seg > span, .seg > button { white-space: nowrap; padding: 0 11px; display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; border-right: 1px solid var(--line); }
.seg > :last-child { border-right: 0; }
.seg a:hover { color: var(--ink); background: var(--bg); }
.seg .on, .seg a.on:hover { background: var(--teal-light); color: var(--teal-ink); font-weight: 600; }
.seg .n { color: var(--muted); font-weight: 500; margin-left: 4px; padding: 0; border: 0; display: inline; }
.seg svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.seg > a:focus-visible, .seg > button:focus-visible { outline-offset: -2px; } /* .seg recorta lo que sale (overflow) */

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 18px; }
.tabs a, .tabs span { padding: 12px 12px; font-size: 13px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs .on { color: var(--teal-dark); border-color: var(--teal); font-weight: 600; }
.tabs .n { margin-left: 5px; background: var(--gray-bg); border-radius: 8px; padding: 0 6px; font-size: 11px; }
.card > .tabs { border-bottom: 0; }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 11.5px; }
.xs { font-size: 11px; }
.mono { font-variant-numeric: tabular-nums; }
.bold { font-weight: 600; }
.ink { color: var(--ink); }
.text-danger { color: var(--danger); }
.text-ok { color: var(--ok-ink); }
.text-warn { color: var(--warn-ink); }
.text-teal { color: var(--teal-dark); }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.cols-ficha { display: grid; grid-template-columns: minmax(300px, .8fr) minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.cols-main-side { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; }
.mb16 { margin-bottom: 16px; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
/* Utilidades para reemplazar style="" repetidos en plantillas. */
.fw400 { font-weight: 400; }
.fw500 { font-weight: 500; }
.min0 { min-width: 0; }
.grow { flex: 1; min-width: 0; }
.items-start { align-items: flex-start; }
.gap6 { gap: 6px; }
.gap8 { gap: 8px; }
.gap12 { gap: 12px; }
.gap14 { gap: 14px; }
.dl { display: grid; grid-template-columns: 112px minmax(0, 1fr); row-gap: 9px; column-gap: 12px; font-size: 12.5px; }
.dl dt { color: var(--muted); }
.dl dd { font-weight: 500; overflow-wrap: anywhere; }
.dl dd .muted { font-weight: 400; }
.progress { height: 6px; background: var(--gray-bg); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--teal); border-radius: 3px; }
.check { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--line-strong); display: inline-flex; align-items: center; justify-content: center; flex: none; background: #fff; }
.check.on { background: var(--teal); border-color: var(--teal); }
.check.on::after { content: ''; width: 8px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
button.check:hover { border-color: var(--teal); }
.ico { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { width: 13px; height: 13px; }
.hairline { border-top: 1px solid var(--line); }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); font-size: 12.5px; }
.empty > svg { width: 28px; height: 28px; stroke: var(--faint); fill: none; stroke-width: 1.5; display: block; margin: 0 auto 8px; }
.empty .btn { margin-top: 12px; }
.empty .lead { color: var(--ink); font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.empty .hint { max-width: 460px; margin: 0 auto; }
.acts { display: flex; gap: 4px; align-items: center; flex: none; }
.note { background: var(--bg); border-radius: 8px; padding: 10px 12px; font-size: 12px; color: var(--muted); }
.note.warn { background: var(--warn-bg); color: var(--warn-ink); }
.note.danger { background: var(--danger-bg); color: #8f3326; }
.note.ok { background: var(--ok-bg); color: #25603c; }
.pre { white-space: pre-line; }
.progress i.warn { background: var(--warn); }
.progress i.ok { background: var(--ok); }
.iconbtn.sm { width: 26px; height: 26px; border-radius: 6px; }
.iconbtn.sm svg { width: 14px; height: 14px; }
.iconbtn.danger:hover { color: var(--danger); border-color: var(--danger-bg); }

/* Bloque de fecha (eventos) */
.datebox { width: 48px; text-align: center; background: var(--gray-bg); border-radius: 6px; padding: 4px 0; flex: none; }
.datebox .d { font-size: 16px; font-weight: 700; line-height: 1; }
.datebox .m { font-size: 11px; color: var(--muted); }
.datebox.on { background: var(--teal-light); }
.datebox.on .d, .datebox.on .m { color: var(--teal-ink); }

/* Paginación */
.pager { display: flex; align-items: center; gap: 4px; }
.pager a, .pager span { min-width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border-radius: 6px; font-size: 12px; padding: 0 6px; }
.pager a:hover { background: var(--bg); color: var(--ink); }
.pager .on { background: var(--teal-light); color: var(--teal-ink); font-weight: 600; }
.pager svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .field .lbl { font-size: 12px; font-weight: 600; color: var(--ink); }
.field .req { color: var(--danger); margin-left: 2px; }
.field .help { font-size: 11.5px; color: var(--muted); }
.field .errorlist, .errorlist { list-style: none; color: var(--danger); font-size: 11.5px; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
input[type="text"], input[type="email"], input[type="number"], input[type="date"], input[type="time"], input[type="month"],
input[type="password"], input[type="tel"], input[type="url"], input[type="search"], input[type="datetime-local"], select, textarea {
  width: 100%; height: 36px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 11px;
  font: inherit; font-size: 13px; color: var(--ink); background: #fff; outline: none;
  transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; min-height: 76px; padding: 8px 11px; resize: vertical; line-height: 1.45; }
select { -webkit-appearance: none; appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7a7d' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; }
select[multiple] { height: auto; min-height: 120px; padding: 6px; background-image: none; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: var(--focus-ring); }
select:focus-visible, textarea:focus-visible { outline: none; } /* ya llevan halo */
input[type="file"] { font-size: 12.5px; }
/* Contraseña con el ojo (crm/widgets/contrasena.html y contrasena.js): el botón va dentro del campo, a la derecha;
   el ícono dice lo que hará (ojo: mostrar; ojo tachado: ocultar). El navegador no pone su propio ojo (Edge). */
.campo-clave { position: relative; display: block; }
.campo-clave > input { padding-right: 40px; }
.campo-clave > input::-ms-reveal { display: none; }
.ver-clave { position: absolute; top: 2px; right: 2px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; }
.ver-clave:hover { color: var(--ink); background: var(--bg); }
.ver-clave:focus-visible { outline: 2px solid var(--teal-dark); outline-offset: -2px; }
.ver-clave svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ver-clave .ico-ocultar, .ver-clave[aria-pressed="true"] .ico-ver { display: none; }
.ver-clave[aria-pressed="true"] .ico-ocultar { display: block; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.checkline input { width: 16px; height: 16px; accent-color: var(--teal); }
.form-section { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint-text); font-weight: 600; margin: 6px 0 -4px; grid-column: 1 / -1; }
.form-card { max-width: 920px; }

/* Pie de formulario de página: un solo componente para Nuevo prospecto, Nuevo evento y Configuración.
   Barra pegajosa al fondo de la ventana mientras el formulario sigue abajo; leyenda a la izquierda,
   Cancelar y el primario a la derecha. Suelta bajo las tarjetas lleva borde y radio de tarjeta; como
   último hijo de una .card (en lugar de .card-f) solo lleva el borde de arriba. No va dentro de una
   .card.flush: su overflow:hidden anula el sticky.
   <div class="form-actions">
     <span class="muted"><span class="req">*</span> Obligatorio</span>
     <div class="acts"><a class="btn" href="…">Cancelar</a><button class="btn primary" type="submit">…</button></div>
   </div> */
.form-actions {
  position: sticky; bottom: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  margin-top: 16px; padding: 10px var(--pad-x); min-height: 54px;
  background: #fafbfb; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 -4px 14px rgba(31, 42, 44, .07);
  font-size: 12px;
}
.form-actions .req { color: var(--danger); }
.form-actions > .acts { margin-left: auto; gap: 8px; }
.form-actions > .btn:first-child, .form-actions > .acts:first-child { margin-left: auto; }
.card > .form-actions { margin-top: 0; border-width: 1px 0 0; border-radius: 0 0 var(--radius) var(--radius); box-shadow: none; }
/* Los avisos (abajo a la derecha) no tapan el botón primario de la barra. */
body:has(.form-actions) .toasts { bottom: 78px; }

/* Resumen de errores de un formulario de página (Nuevo prospecto, Nuevo evento): app.js le da el foco al
   cargar; cada enlace lleva a su campo.
   <div class="note danger row items-start gap8 resumen-errores" id="errores" role="alert" tabindex="-1">
     {% icon "alert" "ico" %}<div class="grow"><b>Revisa los 2 campos marcados.</b>
     <ul class="errorlist"><li><a href="#id_nombre">Nombre</a>: …</li></ul></div>
   </div> */
.resumen-errores:focus { outline: 2px solid var(--danger); outline-offset: 2px; }
.resumen-errores .errorlist { margin-top: 4px; color: inherit; font-size: 12px; }
.resumen-errores .errorlist a { color: inherit; font-weight: 600; text-decoration: underline; }

/* Controles dentro de .filter (barras de filtros): sin caja propia; ganan a los estilos base de arriba.
   Única definición para todas las áreas: buscador de 200 px, año de 64 px, el select del ancho de su valor
   (field-sizing en Chrome/Edge 123+; en otros navegadores mide su opción más larga, como antes). */
.filter select, .filter input[type] { width: auto; height: 30px; border: 0; border-radius: 0; padding: 0 16px 0 0; background-color: transparent; box-shadow: none; font: inherit; }
.filter select { background-image: none; field-sizing: content; }
.filter input[type="search"], .filter input[type="text"], .filter input[type="date"], .filter input[type="month"], .filter input[type="number"] { padding-right: 0; cursor: text; }
.filter input[type="number"] { width: 64px; }
.filter select:focus, .filter input[type]:focus { box-shadow: none; }
.filter.search-filter input[type="search"], .filter.search-filter input[type="text"] { width: 200px; }

/* ---------- Diálogos (dialog nativo) ---------- */
dialog.modal {
  border: 0; border-radius: 12px; padding: 0; width: min(560px, calc(100vw - 32px));
  box-shadow: var(--shadow-pop); color: var(--ink); margin: auto;
}
dialog.modal.wide { width: min(760px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(31, 42, 44, .38); }
dialog.modal .modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
dialog.modal .modal-h h3 { font-size: 15px; }
dialog.modal .modal-h .sub { font-size: 12px; color: var(--muted); }
dialog.modal .modal-h .close { margin-left: auto; color: var(--muted); display: flex; }
dialog.modal .modal-h .close svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }
dialog.modal .modal-b { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; max-height: calc(100vh - 200px); overflow-y: auto; }
dialog.modal .modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--line); background: #fafbfb; border-radius: 0 0 12px 12px; }

/* ---------- Avisos (messages) ---------- */
.toasts { position: fixed; right: 24px; bottom: 24px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--ink); color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow-pop); font-size: 12.5px; max-width: 420px; animation: toast-in .2s ease-out; }
.toast svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.toast.success svg { color: #8fd6a9; }
.toast.error { background: #8f3326; }
.toast.warning { background: #8a5516; }
.toast .x { margin-left: 6px; opacity: .7; display: flex; }
.toast .x:hover { opacity: 1; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Tablero de prospectos (mock 02) ---------- */
/* El desborde queda dentro del tablero (no en la página) y cada columna llega al fondo: toda sirve para soltar. */
.board { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 12px; align-items: stretch; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; }
.board > .col { scroll-snap-align: start; }
.col { background: var(--gray-bg); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; min-width: 0; min-height: 120px; transition: background .12s, box-shadow .12s; }
.col.drop { background: var(--teal-light); box-shadow: inset 0 0 0 2px var(--teal); }
.col-h { display: flex; align-items: center; gap: 8px; padding: 2px 6px 10px; font-weight: 600; font-size: 12.5px; }
.col-h .n { margin-left: auto; color: var(--muted); font-weight: 500; }
.col-h i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
/* Columna angosta (1280 o zoom 125 %): el encabezado sigue en una línea y las tarjetas arrancan parejas. */
.board > .col { container-type: inline-size; }
@container (max-width: 140px) { .col-h { gap: 6px; padding-inline: 3px; font-size: 12px; white-space: nowrap; } }
.pc { display: block; background: #fff; border-radius: 8px; padding: 10px 11px; margin-bottom: 8px; border: 1px solid var(--line); box-shadow: 0 1px 2px rgba(0,0,0,.04); cursor: grab; }
.pc:hover { border-color: var(--teal-soft); }
.pc.dragging { opacity: .45; }
.pc.muted-card { opacity: .75; }
.pc .co { font-weight: 600; font-size: 12.5px; line-height: 1.3; }
.pc .who { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.pc .meta { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.pc .next { margin-top: 8px; padding-top: 7px; border-top: 1px dashed var(--line); font-size: 11px; display: flex; align-items: center; gap: 5px; color: var(--ink); }
.pc .next svg { width: 12px; height: 12px; stroke: var(--teal-dark); fill: none; stroke-width: 2; }
.pc .next.late { color: var(--danger); }
.pc .next.late svg { stroke: var(--danger); }
.pc .next.done { color: var(--ok-ink); }
.pc .next.done svg { stroke: var(--ok); }
.col .more { text-align: center; color: var(--muted); font-size: 11.5px; padding: 4px; }
.col .more:hover { color: var(--teal-dark); }

/* ---------- Ficha (mocks 03 y 05) ---------- */
.head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 16px; }
.head .big { width: 54px; height: 54px; border-radius: 12px; background: var(--teal-light); color: var(--teal-ink); font-weight: 700; font-size: 18px; display: flex; align-items: center; justify-content: center; flex: none; }
.head .big.violet { background: var(--violet-bg); color: #5647b8; }
.head .big.gray { background: var(--gray-bg); color: var(--muted); }
.head h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.head .row { flex-wrap: wrap; }
.stages { display: flex; gap: 4px; margin-top: 10px; }
.stages > * { flex: 1; height: 26px; display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 600; color: var(--faint-text); background: var(--gray-bg); clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); border: 0; }
.stages > :first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }
.stages .done { background: var(--teal-soft); color: var(--teal-ink); }
.stages .cur { background: var(--teal); color: #fff; }
.stages button { cursor: pointer; }
.stages button:not(.cur):hover { background: var(--teal-light); color: var(--teal-ink); }
.stages button:focus-visible { outline: 2px solid var(--teal-dark); outline-offset: -2px; } /* el clip-path recorta el contorno exterior */
.tl { position: relative; padding-left: 26px; }
.tl::before { content: ''; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl .it { position: relative; padding: 0 0 14px; }
.tl .it:last-child { padding-bottom: 0; }
/* Círculo de 16 px (12 + 2×2 de borde; ::before no hereda el box-sizing de *): centro en x=9, igual que la línea. */
.tl .it::before { content: ''; position: absolute; left: -25px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--teal); }
.tl .it.correo::before { border-color: var(--blue); }
.tl .it.whatsapp::before { border-color: var(--ok); }
.tl .it.visita::before { border-color: var(--warn); }
.tl .it.etapa::before { border-color: var(--violet); background: var(--violet-bg); }
.tl .it.tarea::before { border-color: var(--faint); }
.tl .it .t { font-weight: 600; font-size: 12.5px; }
.tl .it .d { color: var(--muted); font-size: 12px; margin-top: 1px; white-space: pre-line; }
.tl .it .w { font-size: 11px; color: var(--faint-text); margin-top: 2px; }
.doc { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.doc:last-child { border-bottom: none; }
.doc .f { flex: 1; min-width: 0; }
/* Nombre del documento: hasta 2 líneas. Un nombre de archivo (enlace con title) sigue en una línea con «…». */
.doc .f .nm { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.doc .f .nm:has(> a[title]) { display: block; white-space: nowrap; text-overflow: ellipsis; }
.doc .f .s { font-size: 11px; color: var(--muted); }
.doc form { display: flex; }
.cnt { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cnt.two { grid-template-columns: 1fr 1fr; }
.cnt > div { background: var(--bg); border-radius: 8px; padding: 10px 12px; }
.cnt .v, .stat .v { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cnt .l, .stat .l { font-size: 11px; color: var(--muted); }
.stat { background: var(--bg); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.stat .l { overflow-wrap: anywhere; }
.stats4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
/* Cuatro cifras en una columna angosta (ficha a 1366-1440): pasan a 2×2 en lugar de partir palabras. */
.card-b:has(> .stats4) { container-type: inline-size; }
@container (max-width: 400px) { .stats4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ev { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.ev:last-child { border-bottom: none; }
.ev .dt { width: 70px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.ev .nm { flex: 1; font-weight: 500; min-width: 0; }
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; margin-top: 8px; }
.months div { height: 34px; border-radius: 5px; background: var(--gray-bg); display: flex; align-items: flex-end; justify-content: center; font-size: 10px; color: var(--faint-text); padding-bottom: 3px; position: relative; }
.months div i { position: absolute; left: 4px; right: 4px; bottom: 16px; border-radius: 2px; background: var(--teal); }
.tr { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tr:last-child { border-bottom: none; }
.tr .f { flex: 1; min-width: 0; }
.dropzone { margin-top: 10px; border: 1.5px dashed var(--line-strong); border-radius: 8px; padding: 14px; text-align: center; color: var(--faint-text); font-size: 12px; cursor: pointer; transition: border-color .12s, background .12s; display: block; }
.dropzone:hover, .dropzone.over { border-color: var(--teal); background: var(--teal-light); color: var(--teal-ink); }
/* El foco está en el input (.sr-only) dentro del <label>: el contorno va en la zona. */
.dropzone:has(:focus-visible) { outline: 2px solid var(--teal-dark); outline-offset: 2px; }
.task-box { border-radius: 0 0 10px 10px; }
.task-box.late { background: var(--danger-bg); }
.task-box.today { background: var(--teal-light); }
.task-box.today .btn.ghost { color: var(--teal-ink); }

/* ---------- Tareas ---------- */
.task { display: flex; gap: 12px; padding: 10px var(--pad-x); border-bottom: 1px solid var(--line); align-items: center; }
.task:last-child { border-bottom: 0; }
.task .body { flex: 1; min-width: 0; }
.task .ttl { font-weight: 600; }
.task .ttl a:hover { color: var(--teal-dark); }
.task.done .body { opacity: .55; }
.task.done .ttl { text-decoration: line-through; }
.task .aside { display: flex; align-items: center; gap: 8px; flex: none; }
.task .acts { gap: 2px; }
/* Fecha de la tarea (insignia) con ancho fijo: las acciones no se corren con «Hace 12 días · 10:00». */
.task .when { width: 128px; min-width: 128px; justify-content: center; }

/* Calendario mensual */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal .dow { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint-text); font-weight: 600; padding: 8px 10px; background: #fafbfb; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal .day { min-height: 108px; padding: 6px 7px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; min-width: 0; }
.cal .day.out { background: #fafbfb; }
.cal .day.out .num { color: var(--faint-text); }
.cal .day .num { font-size: 12px; font-weight: 600; margin-bottom: 4px; display: inline-flex; width: 22px; height: 22px; align-items: center; justify-content: center; border-radius: 50%; }
.cal .day.today .num { background: var(--teal); color: #fff; }
.cal .ev-pill, .legend .ev-pill { display: block; font-size: 11px; padding: 2px 6px; border-radius: 4px; margin-bottom: 3px; background: var(--teal-light); color: var(--teal-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal .ev-pill.late, .legend .ev-pill.late { background: var(--danger-bg); color: #a63a2b; }
.cal .ev-pill.done, .legend .ev-pill.done { background: var(--gray-bg); color: var(--muted); text-decoration: line-through; }
.cal .ev-pill.evento, .legend .ev-pill.evento { background: var(--violet-bg); color: #5647b8; }
.legend .ev-pill { display: inline-block; margin: 0; }

/* ---------- Semáforo de meta mensual ---------- */
.semaforo { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
.semaforo .m { border-radius: 8px; padding: 8px 4px 7px; text-align: center; background: var(--gray-bg); color: var(--muted); }
.semaforo .m .v { font-size: 17px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.semaforo .m .l { font-size: 10.5px; font-weight: 600; } /* etiqueta en tipo oración: «sep», sin mayúsculas espaciadas */
.semaforo .m.cumplida { background: var(--ok-bg); color: var(--ok-ink); }
.semaforo .m.no_cumplida { background: var(--danger-bg); color: #a63a2b; }
.semaforo .m.en_curso { background: var(--warn-bg); color: var(--warn-ink); box-shadow: inset 0 0 0 1.5px var(--warn); }
.semaforo .m.cumplida.actual { box-shadow: inset 0 0 0 1.5px var(--ok); }
.semaforo .m.futuro { background: #f7f9f9; color: var(--faint-text); }
.semaforo .m.sin_meta { background: repeating-linear-gradient(135deg, #f1f3f4, #f1f3f4 5px, #e9edee 5px, #e9edee 10px); color: var(--faint-text); }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ---------- Embudo / barras ---------- */
.funnel { display: grid; grid-template-columns: 150px 1fr 40px; row-gap: 11px; column-gap: 14px; align-items: center; font-size: 12.5px; }
.funnel .progress { height: 14px; border-radius: 4px; }
.funnel .progress i { border-radius: 4px; }
.bars { display: flex; align-items: flex-end; gap: 14px; height: 120px; padding: 0 6px; }
.bars > div { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .b { width: 100%; border-radius: 4px 4px 0 0; background: var(--teal); position: relative; min-height: 2px; }
.bars .b span { position: absolute; top: -18px; left: 0; right: 0; text-align: center; font-size: 11px; font-weight: 600; }
.bars .l { font-size: 11px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Gráfica con eje (escala modular) */
.chart { position: relative; }
.chart .grid-line { position: absolute; left: 34px; right: 0; border-top: 1px dashed var(--line); }
.chart .grid-line span { position: absolute; left: -34px; top: -7px; width: 28px; text-align: right; font-size: 10.5px; color: var(--faint-text); font-variant-numeric: tabular-nums; }
.chart .plot { position: absolute; left: 34px; right: 0; top: 0; bottom: 0; display: flex; align-items: flex-end; gap: 8px; }
.chart .plot .col-bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart .plot .col-bar i { width: 70%; max-width: 34px; border-radius: 4px 4px 0 0; background: var(--teal); display: block; min-height: 2px; }
.chart .meta-line { position: absolute; left: 34px; right: 0; border-top: 2px solid var(--warn); }
.chart .meta-line span { position: absolute; right: 0; top: -17px; font-size: 10.5px; color: #a8651a; font-weight: 600; }
.chart-x { display: flex; gap: 8px; margin-left: 34px; margin-top: 6px; }
.chart-x span { flex: 1; text-align: center; font-size: 10.5px; color: var(--muted); }

/* ---------- Reportes (mock 06) ---------- */
.rep-layout { display: grid; grid-template-columns: 228px minmax(0, 1fr); gap: 16px; align-items: start; }
.rep-list a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--ink); font-weight: 500; font-size: 12.5px; }
.rep-list a:hover { background: var(--bg); }
.rep-list a.on { background: var(--teal-light); color: var(--teal-ink); font-weight: 600; }
.rep-list a svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.rep-list .s { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint-text); padding: 14px 12px 6px; font-weight: 600; }
.rep-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }

/* ---------- Periodo (filtro de reportes y eventos: includes/periodo.html) ---------- */
/* Tipo de periodo | valor. Cada select con su flecha en línea; el año es uno solo para mes, trimestre y año. */
.periodo { display: inline-flex; align-items: center; gap: 6px; }
.periodo select + svg { position: static; margin-left: -14px; pointer-events: none; }
.periodo [data-modo] { display: none; align-items: center; gap: 6px; }
.periodo [data-modo]::before { content: ''; width: 1px; height: 16px; background: var(--line-strong); margin-right: 2px; }
.periodo[data-actual="mes"] [data-modo~="mes"],
.periodo[data-actual="trimestre"] [data-modo~="trimestre"],
.periodo[data-actual="anio"] [data-modo~="anio"],
.periodo[data-actual="rango"] [data-modo~="rango"] { display: inline-flex; }
/* Mes y año (o trimestre y año) se leen juntos: sin separador entre ellos. */
.periodo[data-actual="mes"] .periodo-anio::before, .periodo[data-actual="trimestre"] .periodo-anio::before { display: none; }
.periodo-aviso { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--warn-ink); }
.periodo-aviso svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; flex: none; }

/* ---------- Barra de periodo (analitica/_barra_periodo.html) ---------- */
/* Pegajosa bajo la barra superior (60 px). Va como primer elemento de .content: los márgenes negativos
   (= padding de .content, 24px 28px) la llevan de orilla a orilla, como en la maqueta aprobada. */
.barra-periodo {
  position: sticky; top: 60px; z-index: 15;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: -24px -28px 20px; padding: 10px 28px; min-height: 56px;
  background: rgba(244, 246, 247, .94); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
/* Bajo las dos barras, un ancla del contenido deja libres las dos (60 + 56 px), como las de areas/analitica.css. */
:where(.content:has(> .barra-periodo) [id]) { scroll-margin-top: 130px; }
.periodo-nav { display: flex; align-items: center; gap: 4px; }
.periodo-nav .iconbtn.off { color: var(--faint); background: transparent; cursor: default; }
.periodo-actual {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-width: 196px; height: 34px; padding: 0 10px; border-radius: 8px;
  font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.periodo-actual .muted { font-size: 13.5px; }
.periodo-actual svg { width: 14px; height: 14px; stroke: var(--muted); fill: none; stroke-width: 2; }
summary.periodo-actual:hover, .periodo-menu[open] > summary { background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.periodo-menu > .menu { left: 0; right: auto; min-width: 0; width: max-content; padding: 10px 12px 12px; }
.periodo-menu-h { font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 2px 8px; }
/* 11 años (el actual y 10 atrás) caben sin scroll; si la vista da más, el menú se desplaza. */
.periodo-grid { display: grid; gap: 2px 4px; align-items: center; max-height: 334px; overflow-y: auto; }
.periodo-grid.mes { grid-template-columns: 40px repeat(12, 36px); }
.periodo-grid.trimestre { grid-template-columns: 40px repeat(4, 46px); }
.periodo-grid.anio { grid-template-columns: repeat(4, 58px); }
.periodo-grid .a { font-size: 11.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.periodo-grid a, .periodo-grid .off { height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 6px; font-size: 12px; font-variant-numeric: tabular-nums; }
.periodo-grid a:hover { background: var(--bg); }
.periodo-grid a.on { background: var(--teal-light); color: var(--teal-ink); font-weight: 600; }
.periodo-grid .off { color: var(--muted); background: repeating-linear-gradient(135deg, transparent, transparent 4px, #f1f3f4 4px, #f1f3f4 8px); cursor: default; }
.periodo-grid a:focus-visible { outline-offset: -2px; }
.periodo-rango { display: flex; align-items: center; gap: 6px; }
/* Las fechas a lo justo (9 px por lado): con «En curso, al 30 sep 2026» la barra de Rango cabe en un renglón a 1366. */
.periodo-rango .filter { height: 34px; padding: 0 9px; }
/* El estado es lo único que cede: nunca baja las acciones a otro renglón. Base 0 (no cuenta al partir
   renglones), crece hasta su texto y, si no cabe, se corta con elipsis; el title lleva el texto completo. */
.periodo-estado { flex: 1 1 0; min-width: 0; max-width: max-content; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.barra-acciones { margin-left: auto; display: flex; align-items: center; gap: 8px; }
/* El aviso (rango acotado) va en su propio renglón: las acciones no se mueven. */
.barra-periodo > .periodo-aviso { order: 10; flex-basis: 100%; }

/* ---------- Login ---------- */
body:has(> .login-wrap) { min-width: 0; } /* error sin sesión: tarjeta suelta, como el login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--teal-light), var(--bg) 55%); }
.login-card { width: 380px; padding: 30px 30px 26px; }
.login-card .brand { padding: 0 0 20px; }
.login-card h2 { font-size: 18px; margin-bottom: 4px; }

/* ---------- Páginas de error (404, 403, 403_csrf) ---------- */
.error-page { max-width: 560px; margin: 40px auto; }
.error-page .empty { padding: 36px 24px; }
.error-page .btn-group { margin-top: 12px; }
.error-page .btn-group .btn { margin-top: 0; }
.error-buscar { display: flex; gap: 8px; max-width: 420px; margin: 16px auto 0; }
.error-buscar .btn { margin-top: 0; height: 36px; }
.error-card .muted { margin-bottom: 18px; }
.error-card .form-actions { position: static; justify-content: flex-end; margin: 0; padding: 4px 0 0; min-height: 0; background: none; border: 0; box-shadow: none; }

/* Atributo para ocultar sin JS */
[hidden] { display: none !important; }

@media (max-width: 1280px) {
  /* Dos columnas: la primera ocupa las dos filas y la tercera pila queda pegada bajo la segunda
     (la fila 2 es flexible, así el alto sobrante no abre un hueco entre ellas). */
  .cols-ficha { grid-template-columns: 300px minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .cols-ficha > :first-child { grid-row: 1 / span 2; }
  .cols-ficha > :last-child { grid-column: 2; }
  .kpis.five { grid-template-columns: repeat(3, 1fr); }
}

@media print {
  .sidebar, .topbar, .toasts, .no-print, .skip-link { display: none !important; }
  .print-only { display: block !important; }
  html, body { min-width: 0; background: #fff; }
  .app { background: none; }
  .content { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  /* Controles que no sirven en papel. */
  .tabs, .btn, .iconbtn, .link-btn, details.dropdown, .dropzone, .acts, .more-link, .form-actions { display: none !important; }
  /* Barra de periodo en papel: solo la etiqueta del periodo y su estado. */
  .barra-periodo { position: static; margin: 0 0 12px; padding: 0 0 8px; min-height: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .barra-periodo .seg, .barra-periodo .periodo-rango .btn { display: none !important; }
  .barra-periodo details.dropdown.periodo-menu { display: block !important; }
  .periodo-actual { min-width: 0; padding: 0; }
  .periodo-actual svg { display: none; }
  .card:has(> .tabs:only-child) { display: none !important; }
  .cols-ficha { grid-template-columns: 1fr 1fr; grid-template-rows: none; }
  .cols-ficha > :first-child { grid-row: auto; }
  .cols-ficha > :last-child { grid-column: auto; }
}

/* ---------- M1, M16 y M17: meta con vigencia, reasignar al desactivar y la cuenta propia ---------- */
/* M1. Tramos de meta bajo el semáforo: solo cuando el año tiene más de una meta (services.franja_de_metas). */
.semaforo-metas { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; margin-top: 6px; }
.semaforo-metas span { border-top: 2px solid var(--line-strong); padding-top: 3px; font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; line-height: 1.25; }
.semaforo-metas span.nueva { border-color: var(--teal-dark); color: var(--teal-ink); }
.semaforo-metas span.sin { border-top-style: dashed; font-weight: 500; font-size: 10.5px; }
/* M16. Conteos de trabajo abierto en el diálogo de la usuaria: tantas columnas como cifras. */
.cnt.three { grid-template-columns: repeat(3, 1fr); }
/* M17. El bloque de la usuaria es el menú de su cuenta y abre hacia arriba. Va fijo al fondo del menú lateral: si el
   menú no cabe en la ventana, solo los enlaces se desplazan y la cuenta (Cambiar mi contraseña, Cerrar sesión) siempre
   se ve. Lleva el margen inferior del menú (si no, el sticky se queda arriba de él y por debajo asoman enlaces). */
.sidebar .user { padding: 8px 0 var(--menu-pie, 20px); position: sticky; bottom: 0; background: #fff; }
/* En una ventana baja (1366 x 768 con la barra del navegador y del sistema: 600-680 px) el menú completo de Dirección
   (670 px) no cabe: enlaces, secciones y marca más juntos para que quepa sin desplazarse; más todavía por debajo de
   580 px (el menú expandido sobre el plegado a 1093 x 526). Solo cambia variables; el plegado (M13) tiene las suyas. */
@media screen and (max-height: 680px) {
  :root { --menu-enlace-y: 6px; --menu-seccion-arriba: 10px; --menu-pie-marca: 12px; }
}
@media screen and (max-height: 580px) {
  :root { --menu-enlace-y: 4px; --menu-seccion-arriba: 6px; --menu-pie-marca: 8px; --menu-pie: 12px; }
}
.cuenta { flex: 1; min-width: 0; }
/* Avatar y nombre a 10 px; la flecha va pegada a la orilla (margin-left: auto) y solo pide 4 px: así «Ejecutiva de
   afiliaciones» (125 px) cabe sin cortarse en el menú de 232 px. */
.cuenta > summary { display: flex; align-items: center; gap: 4px; padding: 6px 8px; border-radius: 8px; }
.cuenta > summary > .avatar { margin-right: 6px; }
.cuenta > summary:hover, .cuenta[open] > summary { background: var(--bg); }
.cuenta .quien { display: flex; flex-direction: column; min-width: 0; }
.cuenta .who, .cuenta .role { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cuenta > summary > .ico { margin-left: auto; color: var(--muted); }
.cuenta .menu { top: auto; bottom: calc(100% + 6px); left: 0; right: 0; min-width: 0; }
.login-ayuda { margin-top: 16px; text-align: center; font-size: 12px; color: var(--muted); text-wrap: balance; }
.form-card.cuenta-clave { max-width: 520px; }
.cuenta-clave > .card-b.stack { gap: 14px; }
.cuenta-clave > .card-b > .acceso { padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- Cifras (KPI) en una franja: tarjetas de la opción B, con la fuente y los colores de siempre ---------- */
/* Una franja blanca con las cifras juntas, separadas por filetes de 1 px, y la cifra más grande. Aplica a
   toda fila .kpis (Inicio, Afiliados, Tareas, Eventos, Trámites; también .kpis.five) y a las cifras sueltas
   de un reporte (.rep-kpis). La fuente sigue siendo Inter y cada cifra conserva su color (.value.danger,
   .text-teal, …). El filete es una línea de 1 px a la izquierda y abajo de cada cifra (no es la sombra de
   tarjeta): si la fila se parte en dos renglones (.kpis.five hasta 1280 px) también los separa, incluso bajo
   una cifra que no tiene vecina abajo, y la franja recorta las de la orilla. */
.kpis, .rep-kpis { gap: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.kpis > .kpi.card, .rep-kpis > .kpi.card {
  min-width: 0; padding: 18px 22px 16px;
  background: transparent; border: 0; border-radius: 0;
  box-shadow: -1px 0 0 var(--line), 0 1px 0 var(--line);
}
.kpis > a.kpi:hover { background: #f7f9f9; }
/* La franja recorta lo que sale (overflow): el contorno de foco va por dentro. */
.kpis > a.kpi:focus-visible { outline-offset: -2px; }
.kpi .value { font-size: 36px; line-height: 1.05; margin-top: 6px; }

/* ---------- M13. Menú lateral plegable por debajo de 1200 px ---------- */
/* De 1200 px en adelante no cambia nada y el botón no se ve. Debajo, el menú mide 64 px con solo íconos: cada
   enlace dice su nombre en title y aria-label (base.html), las secciones se vuelven separadores y el número de
   Prospectos queda sobre su ícono. «Expandir menú» (.nav-toggle) pone html.nav-abierto: el menú se abre encima
   del contenido sin moverlo; Esc, un clic fuera, salir con Tab o «Plegar menú» lo cierran (app.js, M13).
   El nombre de la usuaria y el texto de la marca se ocultan con la técnica de .sr-only (se siguen leyendo). */
.nav-toggle { display: none; }
/* Solo pantalla: en papel el menú no sale y el hueco de 64 px no debe quedar. */
@media screen and (max-width: 1199px) {
  .app { --sidebar: 64px; }
  .nav-toggle { display: flex; margin: 0 auto 6px; }
  /* z-index: el menú de la cuenta sale del menú lateral y tiene que quedar encima del contenido (la barra de
     acciones pegada abajo lleva z-index 10). overflow-x: los enlaces de 44 px en la columna de 43 no lo desplazan. */
  html:not(.nav-abierto) .sidebar { padding: 16px 10px 0; align-items: center; overflow-x: hidden; z-index: 25; }
  html:not(.nav-abierto) .brand { padding: 2px 0 var(--plegado-pie-marca, 10px); }
  html:not(.nav-abierto) .brand img { width: 32px; height: 38px; }
  html:not(.nav-abierto) .nav { display: flex; flex-direction: column; align-items: center; }
  /* El texto del enlace no se ve (tamaño 0); su nombre sigue en title y aria-label. Las alturas salen de variables
     que una ventana baja reduce (abajo). */
  html:not(.nav-abierto) .nav a { position: relative; width: 44px; height: var(--plegado-alto-enlace, 40px); padding: 0; gap: 0; justify-content: center; font-size: 0; }
  html:not(.nav-abierto) .nav .section { width: 28px; height: 0; padding: 0; margin: var(--plegado-hueco-seccion, 9px) 0; border-top: 1px solid var(--line); font-size: 0; }
  html:not(.nav-abierto) .nav .badge-n { position: absolute; top: 1px; right: -3px; padding: 0 5px; border: 2px solid #fff; font-size: 10px; line-height: 14px; }
  html:not(.nav-abierto) .brand > div,
  html:not(.nav-abierto) .sidebar .cuenta .quien { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  html:not(.nav-abierto) .sidebar .user { flex-direction: column; width: 100%; gap: 8px; padding: 10px 0 var(--plegado-pie, 16px); }
  /* El avatar abre el menú de la cuenta (M17): solo el avatar, sin la flecha, para caber en la columna. El menú
     no cabe en 64 px y el menú lateral lo recortaría (overflow): sale fijo a la derecha, alineado abajo con el
     avatar (--plegado-pie es el margen inferior del bloque de la cuenta, fijo al fondo del menú). */
  html:not(.nav-abierto) .sidebar .cuenta { flex: none; }
  html:not(.nav-abierto) .sidebar .cuenta > summary { gap: 0; padding: 4px; }
  html:not(.nav-abierto) .sidebar .cuenta > summary > .avatar { margin-right: 0; }
  html:not(.nav-abierto) .sidebar .cuenta > summary > .ico { display: none; }
  html:not(.nav-abierto) .sidebar .cuenta .menu { position: fixed; top: auto; bottom: var(--plegado-pie, 16px); left: 72px; right: auto; min-width: 220px; }
  /* Expandido: encima del contenido y fijo a la ventana (se abre igual con la página desplazada); el hueco de
     64 px se queda, así el contenido no se mueve. */
  .nav-abierto .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 30; width: 232px; height: auto; box-shadow: var(--shadow-pop); }
  .nav-abierto .main { margin-left: 64px; }
  .nav-abierto .nav-toggle { position: absolute; top: 33px; right: 14px; margin: 0; }
  .nav-abierto .nav-toggle svg { transform: rotate(180deg); }
}
/* Plegado en una ventana baja (1366 x 768 con zoom de 125 %: unos 1093 x 526): enlaces, separadores y márgenes más
   cortos para que quepa todo, Configuración y la cuenta incluidas (Dirección pide 619 px con los de arriba). Solo
   cambia variables: el menú expandido no las usa. */
@media screen and (max-width: 1199px) and (max-height: 640px) {
  :root { --plegado-alto-enlace: 32px; --plegado-hueco-seccion: 4px; --plegado-pie-marca: 6px; --plegado-pie: 12px; }
}

/* ---------- M19. «Más filtros»: los filtros secundarios de una barra en un menú (includes/mas_filtros.html) ---------- */
/* El botón es un .filter con el número de filtros de adentro que están activos; el menú los aplica juntos
   con «Aplicar filtros» (envío GET normal del form de la barra). */
.mas-filtros > summary .n-activos { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--teal-dark); color: #fff; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mas-filtros[open] > summary { border-color: var(--teal); box-shadow: var(--focus-ring); }
.mas-filtros .menu { left: 0; right: auto; width: 300px; padding: 0; }
.mas-filtros .mf-b { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.mas-filtros .mf-f { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; background: #fafbfb; }
.mas-filtros .mf-f > button { margin-left: auto; }
/* En una barra con «Más filtros», el buscador va siempre a la derecha, también si baja a otro renglón (1093 px). */
.toolbar:has(.mas-filtros) .search-filter { margin-left: auto; }
/* Texto de conteo de la barra (tablero de prospectos): ocupa el espacio libre a la derecha y es lo único que cede.
   Base 0: no cuenta al partir renglones; si no cabe, se corta con «…» y el title lleva el texto completo. */
.toolbar .resumen-barra { flex: 1 1 0; min-width: 0; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- M10. Búsqueda global: tecla «/» y panel de sugerencias bajo la caja de la barra superior ----------
   Marcado: base.html (la caja) y app.js, sección M10 (el panel). */
.topbar .search { position: relative; }
.topbar .search > kbd, .sugerencias kbd { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 18px; height: 18px; padding: 0 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; background: #fff; color: var(--muted); font: 600 10.5px/1 'Inter', system-ui, sans-serif; }
/* La tecla se anuncia solo en reposo: con el cursor en la caja o con texto escrito, sobra. */
.topbar .search:focus-within > kbd, .topbar .search input:not(:placeholder-shown) ~ kbd { display: none; }
/* Vacía, la caja no le guarda lugar al botón de borrar de type=search (Chrome y Safari lo reservan aunque no se vea):
   así cabe completo el texto de ejemplo. Con algo escrito, el botón sale como siempre. */
.topbar .search input:placeholder-shown::-webkit-search-cancel-button { display: none; }
/* Encogida en la barra con muchas acciones (ver .topbar .search arriba): solo la lupa, sin texto cortado ni «/». */
@container (max-width: 215px) {
  .topbar .search input::placeholder { color: transparent; }
  .topbar .search > kbd { display: none; }
}
.sugerencias { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; width: 520px; max-height: min(680px, calc(100vh - 80px)); overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop); color: var(--ink); font-size: 12.5px; text-align: left; cursor: default; }
.sugerencias .grupo { padding: 4px 0; }
.sugerencias .grupo + .grupo { border-top: 1px solid var(--line); }
.sugerencias .grupo-h { display: flex; align-items: center; gap: 6px; padding: 8px 14px 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.sugerencias .grupo-h .link { margin-left: auto; }
.sug { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 5px 14px; cursor: pointer; }
.sug:hover { background: var(--bg); }
.sug[aria-selected="true"] { background: var(--teal-light); box-shadow: inset 3px 0 0 var(--teal-dark); }
.sug .t { flex: 0 1 auto; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sug .s { flex: 1 1 0; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sug .fin { display: flex; align-items: center; gap: 6px; flex: none; margin-left: auto; }
.sugerencias mark { background: var(--teal-soft); color: inherit; border-radius: 2px; padding: 0 1px; }
/* El pie queda a la vista aunque el panel se desplace (cuatro grupos llenos pasan del alto máximo). */
.sugerencias .pie { position: sticky; bottom: 0; display: flex; align-items: center; gap: 6px; padding: 9px 14px; border-top: 1px solid var(--line); border-radius: 0 0 10px 10px; background: #fafbfb; color: var(--muted); font-size: 11.5px; }
.sugerencias .pie .link { margin-left: auto; font-size: 12px; }
.sugerencias .empty { padding: 22px 18px; }
/* Los íconos del panel no toman el tamaño de la lupa de la caja (.topbar .search svg). */
.topbar .search .sugerencias .empty > svg { width: 28px; height: 28px; stroke: var(--faint); stroke-width: 1.5; }
.topbar .search .sugerencias .btn svg { width: 15px; height: 15px; stroke-width: 2; }

/* ---------- Tanda de prospección: selector de empresa con búsqueda (M7) y aviso con «Deshacer» (M6) ---------- */
/* Combobox de includes/combo_empresa.html: campo con lupa y lista filtrada (role="combobox" + listbox). */
.combo { position: relative; }
.combo > svg { position: absolute; left: 11px; top: 11px; width: 14px; height: 14px; stroke: var(--muted); fill: none; stroke-width: 2; pointer-events: none; }
.combo > input[role="combobox"] { padding-left: 32px; }
.combo-pop { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 6px; }
.combo-lista { list-style: none; max-height: 232px; overflow-y: auto; }
.combo-lista:empty { display: none; }
.combo-lista [role="option"] { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; font-size: 12.5px; cursor: pointer; }
.combo-lista [role="option"]:hover { background: var(--bg); }
.combo-lista [role="option"][aria-selected="true"] { background: var(--teal-light); box-shadow: inset 3px 0 0 var(--teal-dark); }
.combo-lista .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combo-lista mark { background: none; color: inherit; font-weight: 700; }
.combo-lista .mun { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.combo-pie { margin-top: 4px; padding: 8px 10px 4px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.combo-lista:empty + .combo-pie { margin-top: 0; border-top: 0; padding-top: 4px; }

/* Aviso con acción (toast con «Deshacer»). */
.toast .toast-accion { margin-left: 4px; padding: 3px 6px; border-radius: 6px; color: #fff; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.toast .toast-accion:hover { background: rgba(255, 255, 255, .14); }
.toast .toast-accion:disabled { opacity: .6; cursor: progress; }
/* Su atajo de teclado (Ctrl+Z o ⌘Z), pegado al botón. */
.toast .toast-atajo { margin-left: -8px; padding: 1px 5px; border-radius: 4px; background: rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .85); font: 600 10.5px/1.4 'Inter', system-ui, sans-serif; white-space: nowrap; }

/* ===== M9 y M4: diálogo «Registrar contacto» compartido (ficha y listado de afiliados) y atajos de fecha ===== */
/* Canal: segmentado con radios (antes en areas/empresas.css; el diálogo ya no es solo de la ficha). */
.seg.choice { height: 34px; align-self: flex-start; }
.seg.choice label {
  display: flex; align-items: center; gap: 6px; padding: 0 12px; position: relative; cursor: pointer;
  font-size: 12.5px; color: var(--muted); font-weight: 500; border-right: 1px solid var(--line);
}
.seg.choice label:last-child { border-right: 0; }
.seg.choice label:hover { color: var(--ink); background: var(--bg); }
.seg.choice input { position: absolute; opacity: 0; pointer-events: none; }
.seg.choice label:has(input:checked) { background: var(--teal-light); color: var(--teal-ink); font-weight: 600; }
.seg.choice label:has(input:focus-visible) { box-shadow: inset 0 0 0 2px var(--teal); }
/* Encabezado del diálogo: el contacto de la fila (listado) y, bajo la casilla, la tarea que ya tiene pendiente. */
dialog.modal .modal-h .sub:empty, .aviso-pendiente:empty { display: none; }
.aviso-pendiente { margin-top: -8px; }
/* El siguiente paso: qué y cuándo a todo lo ancho; tipo, hora y responsable en una fila. */
.siguiente-paso { display: flex; flex-direction: column; gap: 14px; }
/* Fecha compromiso con atajos (includes/fecha_atajos.html): el campo y tres botones en una línea; el elegido
   queda marcado y la ayuda dice qué día quedó. */
.fecha-atajos { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fecha-atajos input[type="date"] { width: 156px; flex: none; }
.fecha-atajos .btn svg { display: none; }
.fecha-atajos .btn[aria-pressed="true"] { background: var(--teal-light); border-color: var(--teal-soft); color: var(--teal-ink); }
.fecha-atajos .btn[aria-pressed="true"] svg { display: inline-block; }
.atajo-ayuda:empty { display: none; }

/* ---------- M11 · Un solo componente de tarea (crm/templates/crm/agenda/_tarea.html) ----------
   Inicio, Tareas y las fichas usan el mismo parcial con el mismo orden: casilla, ícono del tipo, título
   con su contexto, fecha y menú. Estas reglas venían de agenda.css; ahora las comparten las tres pantallas. */
.task .t-ico { width: 30px; height: 30px; border-radius: 8px; background: var(--teal-light); color: var(--teal-dark); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.task .t-ico svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.task.late .t-ico { background: var(--danger-bg); color: var(--danger); }
.task.done .t-ico { background: var(--gray-bg); color: var(--muted); }
.task .meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; font-size: 12px; }
.task .meta .badge { height: 20px; font-size: 11px; padding: 0 7px; }
.task .desc { font-size: 11.5px; color: var(--muted); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 720px; }
.task .aside { gap: 10px; }
.task .acts .btn { padding: 0 8px; color: var(--muted); font-weight: 500; }
.task .acts .btn:hover { color: var(--teal-dark); }
.task .avatar.sin { background: var(--gray-bg); color: var(--muted); }
.task .dropdown .menu { min-width: 180px; }
/* Variante compacta (Inicio y fichas): todo en una línea más baja; la fecha sin el ancho fijo de la completa. */
.task.compacta { gap: 10px; padding-top: 9px; padding-bottom: 9px; }
.task.compacta .t-ico { width: 24px; height: 24px; border-radius: 6px; }
.task.compacta .t-ico svg { width: 13px; height: 13px; }
.task.compacta .meta { margin-top: 1px; }
.task.compacta .desc { max-width: none; }
.task.compacta .aside { gap: 6px; }
.task.compacta .when { width: auto; min-width: 0; }
/* «Siguiente tarea» de la ficha: destacada (fondo de task-box), con la descripción completa y dos botones debajo. */
.task-box > .task { padding: 0; border: 0; background: none; }
.task-box.late .t-ico, .task-box.today .t-ico, .task-box.late .when, .task-box.today .when { background: #fff; } /* no se pierden en el fondo */
.desc-siguiente { margin: 8px 0 0 60px; font-size: 12px; color: var(--muted); white-space: pre-line; overflow-wrap: anywhere; }
.acts-fila { display: flex; gap: 8px; margin: 12px 0 0 60px; } /* bajo el título: casilla 16 + 10 + ícono 24 + 10 */
.task-box ~ .card-sub { text-transform: none; letter-spacing: 0; font-size: 12px; } /* «También pendiente», en tipo oración */

/* ---------- M2 · Contador de trámites solicitados en el menú (Atención a afiliados) ----------
   «Trámites y servicios» con su contador no cabía en un renglón: los elementos con contador ceden 4 px de su
   margen derecho y no se parten (todos los contadores quedan alineados al mismo borde). */
.nav a:has(.badge-n) { padding-right: 6px; white-space: nowrap; }
