/* CRM ACCapital — estilos basados en el ACCapital Design System
   Navy #172433 + teal #17DCBC · Gira Sans 300/500 · radios 12/16/24 · sombras card/hover */
@font-face { font-family: 'Gira Sans'; src: url('../fonts/GiraSans-Light.otf') format('opentype'); font-weight: 300; font-display: swap; }
@font-face { font-family: 'Gira Sans'; src: url('../fonts/GiraSans-Book.otf') format('opentype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Gira Sans'; src: url('../fonts/GiraSans-Medium.otf') format('opentype'); font-weight: 500; font-display: swap; }

:root {
  --navy: #172433;
  --navy-2: #22354b;
  --teal: #17DCBC;
  --teal-ink: #087866;          /* teal legible sobre blanco (texto) */
  --yellow: #FDD130;            /* solo en blobs difuminados */
  --bg: hsl(216 20% 96%);
  --surface: #ffffff;
  --surface-2: hsl(216 20% 97.5%);
  --line: hsl(216 20% 88%);
  --line-soft: hsl(216 20% 92%);
  --text: #172433;
  --text-2: hsl(216 20% 36%);
  --muted: hsl(216 20% 46%);
  --series-cap: #0f9e86;        /* Captación · validado CVD con --series-cre */
  --series-cre: #2f6fc4;        /* Crédito */
  --good: #087866; --good-bg: hsl(168 60% 93%);
  --warn: #8a5300; --warn-bg: hsl(38 95% 92%);
  --crit: #c0262d; --crit-bg: hsl(0 84% 95%);
  --info: var(--navy); --info-bg: hsl(216 30% 93%);
  --radius: 12px; --radius-xl: 16px; --radius-2xl: 24px;
  --shadow-card: 0 4px 20px -4px hsl(216 39% 15% / 0.10);
  --shadow-hover: 0 8px 30px -6px hsl(216 39% 15% / 0.15);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --nav-h: 68px;
  --font: 'Gira Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: hsl(216 39% 12%); --surface: hsl(216 39% 17%); --surface-2: hsl(216 35% 21%); --line: hsl(216 35% 26%); --line-soft: hsl(216 35% 23%);
    --text: hsl(0 0% 97%); --text-2: hsl(216 20% 80%); --muted: hsl(216 20% 66%); --teal-ink: #17DCBC;
    --series-cap: #12a88e; --series-cre: #5a92e0;
    --good: #3fe3c7; --good-bg: hsl(168 60% 16%); --warn: #f3c56b; --warn-bg: hsl(38 60% 17%); --crit: #ff8f8a; --crit-bg: hsl(0 50% 20%);
    --info: hsl(0 0% 95%); --info-bg: hsl(216 35% 24%);
    --shadow-card: 0 1px 2px rgba(0,0,0,.35); --shadow-hover: 0 6px 20px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-weight: 300; font-size: 15px; line-height: 1.45; }
body { padding-bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
b, strong { font-weight: 500; }
a { color: var(--teal-ink); }
h1, h2, h3 { margin: 0; line-height: 1.2; font-weight: 500; color: var(--text); }
h1 { font-size: 1.75rem; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.num { font-variant-numeric: lining-nums tabular-nums; }
.hidden { display: none !important; }
.ic { width: 20px; height: 20px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 16px; height: 16px; }
.ic.lg { width: 24px; height: 24px; }
.eyebrow { font-weight: 500; font-size: .72rem; text-transform: uppercase; letter-spacing: .16em; color: var(--muted); }

/* ── Barra superior ── */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; display: flex; align-items: center; gap: 10px; }
.topbar .logo { width: 26px; height: auto; display: block; }
.topbar .title { font-weight: 500; font-size: 1.05rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .back { background: none; border: 0; color: #fff; padding: 4px; margin-left: -4px; cursor: pointer; display: flex; }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 500; padding: 5px 10px; border-radius: 99px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); color: rgba(255,255,255,.85); white-space: nowrap; cursor: pointer; }
.sync::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.sync.pending::before { background: #f3c56b; }
.sync.err::before { background: #ff8f8a; }
.icon-btn { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); color: #fff; width: 36px; height: 36px; border-radius: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

main { padding: 16px 16px 24px; max-width: 920px; margin: 0 auto; }
.section { margin: 24px 0 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.section .count { color: var(--muted); font-size: .85rem; }

/* ── Hero navy con mesh (firma de marca) ── */
.hero { position: relative; isolation: isolate; overflow: hidden; background: var(--navy); color: #fff; border-radius: var(--radius-2xl); padding: 20px; margin-bottom: 6px; }
.hero::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; filter: blur(36px);
  background: radial-gradient(55% 70% at 10% 10%, hsl(168 83% 48% / .42), transparent 60%),
              radial-gradient(50% 60% at 95% 90%, hsl(168 83% 48% / .26), transparent 60%),
              radial-gradient(40% 50% at 60% 50%, hsl(47 98% 59% / .14), transparent 60%); }
.hero .eyebrow { color: rgba(255,255,255,.6); }
.hero .greet { font-size: 1.35rem; font-weight: 500; margin: 4px 0 14px; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hero-kpi { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius-xl); padding: 12px; backdrop-filter: blur(6px); }
.hero-kpi .lbl { font-size: .74rem; color: rgba(255,255,255,.7); }
.hero-kpi .val { font-size: 1.45rem; font-weight: 500; letter-spacing: -0.02em; margin-top: 2px; }
.hero-kpi .foot { font-size: .72rem; color: rgba(255,255,255,.6); margin-top: 2px; }
.hero-kpi .progress { background: hsl(168 83% 48% / .18); }
.hero-kpi .progress > span { background: var(--teal); }
.hero .filters select { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #fff; }
.hero .filters select option { color: #172433; }

/* ── Tarjetas ── */
.card { background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); padding: 16px; margin-bottom: 10px; border: 1px solid var(--line-soft); transition: box-shadow .3s var(--ease), border-color .3s var(--ease); }
.card.tight { padding: 12px 14px; }
.card.click:hover { box-shadow: var(--shadow-hover); border-color: hsl(168 83% 48% / .35); }
.item { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.item .body { flex: 1; min-width: 0; }
.item .name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { color: var(--text-2); font-size: .85rem; }
.item .next { font-size: .85rem; margin-top: 6px; color: var(--text-2); }
.item .amt { font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tile { width: 40px; height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; background: hsl(168 83% 48% / .12); color: var(--teal-ink); }
.tile.cre { background: hsl(214 61% 48% / .12); color: var(--series-cre); }
.tile.cap { background: hsl(168 83% 48% / .12); color: var(--series-cap); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.quick { display: flex; gap: 6px; margin-top: 10px; }
.quick a, .quick button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; padding: 8px 4px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: .82rem; font-weight: 500; cursor: pointer; transition: all .3s var(--ease); }
.quick a:hover, .quick button:hover { border-color: var(--teal); color: var(--teal-ink); }
.quick .ic { width: 16px; height: 16px; }

/* ── Chips ── */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: .72rem; font-weight: 500; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line-soft); white-space: nowrap; }
.chip .ic { width: 12px; height: 12px; }
.chip.vencida, .chip.Perdida { background: var(--crit-bg); color: var(--crit); border-color: transparent; }
.chip.hoy, .chip.pronto { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.ok, .chip.Ganada { background: var(--good-bg); color: var(--good); border-color: transparent; }
.chip.sin { background: var(--info-bg); color: var(--info); border-color: transparent; }
.chip.cap::before, .chip.cre::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--series-cap); }
.chip.cre::before { background: var(--series-cre); }
.chip.meta { background: hsl(216 30% 93%); color: var(--navy); border-color: transparent; }
@media (prefers-color-scheme: dark) { .chip.meta { background: var(--surface-2); color: var(--text); } }

/* ── KPIs ── */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 680px) { .kpis { grid-template-columns: repeat(4, 1fr); } .hero-grid { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-xl); padding: 14px; box-shadow: var(--shadow-card); }
.kpi .lbl { font-size: .76rem; color: var(--muted); }
.kpi .val { font-size: 1.4rem; font-weight: 500; margin-top: 2px; font-variant-numeric: lining-nums proportional-nums; letter-spacing: -0.02em; }
.kpi .foot { font-size: .74rem; color: var(--muted); margin-top: 2px; }
.progress { height: 6px; background: hsl(216 39% 15% / .09); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress.done { background: hsl(168 83% 48% / .18); }
.progress > span { display: block; height: 100%; background: var(--navy); border-radius: 99px; }
.progress.done > span { background: var(--teal); }
@media (prefers-color-scheme: dark) { .progress { background: hsl(213 45% 70% / .16); } .progress > span { background: #8fb0d6; } .progress.done > span { background: var(--teal); } }

/* ── Segmentado / filtros ── */
.seg { display: flex; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-xl); padding: 4px; gap: 4px; overflow-x: auto; box-shadow: var(--shadow-card); }
.seg button { flex: 1; border: 0; background: none; padding: 8px 12px; border-radius: var(--radius); font-size: .85rem; font-weight: 500; color: var(--muted); white-space: nowrap; cursor: pointer; transition: all .3s var(--ease); }
.seg button.on { background: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { .seg button.on { background: var(--teal); color: var(--navy); } }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters select, .filters input { flex: 1; min-width: 140px; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-weight: 300; outline: none; }
.filters select:focus, .filters input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px hsl(168 83% 48% / .2); }

/* ── Kanban ── */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; scroll-snap-type: x mandatory; }
.col { min-width: 268px; max-width: 288px; flex: 0 0 auto; background: var(--surface-2); border-radius: var(--radius-xl); padding: 10px; border: 1px solid var(--line-soft); scroll-snap-align: start; }
.col h3 { font-size: .85rem; display: flex; justify-content: space-between; margin: 2px 2px 10px; }
.col .card { margin-bottom: 8px; }

/* ── Avance por etapa ── */
.stepper { display: flex; gap: 4px; margin: 12px 0 6px; }
.stepper span { flex: 1; height: 6px; border-radius: 99px; background: var(--line); }
.stepper span.done { background: var(--series-cap); }
.stepper.cre span.done { background: var(--series-cre); }
.stepper.won span { background: var(--teal); }
.stepper.lost span.done { background: var(--crit); opacity: .45; }

/* ── Línea de tiempo ── */
.timeline { border-left: 2px solid var(--line); margin-left: 6px; padding-left: 16px; }
.tl { position: relative; margin-bottom: 16px; }
.tl::before { content: ''; position: absolute; left: -22px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--muted); }
.tl.adv::before { border-color: var(--teal); background: var(--teal); }
.tl .when { font-size: .75rem; color: var(--muted); }
.tl .what { font-size: .9rem; }

.info { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; font-size: .88rem; }
.info dt { color: var(--muted); font-size: .74rem; }
.info dd { margin: 0; font-weight: 400; word-break: break-word; }

/* ── Botones (hover = intercambio navy ↔ teal) ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); font-weight: 500; cursor: pointer; text-decoration: none; color: var(--text); transition: all .3s var(--ease); }
.btn:hover { border-color: var(--teal); color: var(--teal-ink); }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.primary:hover { background: var(--teal); border-color: var(--teal); color: var(--navy); }
.btn.accent { background: var(--teal); color: var(--navy); border-color: var(--teal); }
.btn.accent:hover { background: var(--navy); color: var(--teal); border-color: var(--navy); box-shadow: 0 0 25px rgba(23,220,188,.35); }
@media (prefers-color-scheme: dark) { .btn.primary { background: var(--teal); color: var(--navy); border-color: var(--teal); } .btn.primary:hover { background: #fff; border-color: #fff; } }
.btn.good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.btn.bad { background: var(--crit-bg); color: var(--crit); border-color: transparent; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 12px 0; }
.actions .btn.primary { grid-column: 1 / -1; }

/* ── Navegación inferior flotante ── */
.nav { position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 30; height: var(--nav-h); max-width: 560px; margin: 0 auto; background: var(--navy); border-radius: 22px; display: flex; align-items: center; padding: 0 6px; box-shadow: 0 12px 30px -8px hsl(216 39% 15% / .45); }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: rgba(255,255,255,.6); font-size: .68rem; font-weight: 500; height: 100%; }
.nav a .ic { width: 22px; height: 22px; }
.nav a.on { color: var(--teal); }
.nav .fab { flex: 0 0 62px; }
.nav .fab span { width: 50px; height: 50px; border-radius: 16px; background: var(--teal); color: var(--navy); display: flex; align-items: center; justify-content: center; box-shadow: 0 0 24px rgba(23,220,188,.45); transition: transform .3s var(--ease); }
.nav .fab:hover span { transform: scale(1.05); }
.nav .fab .ic { width: 26px; height: 26px; stroke-width: 2; }

/* ── Hojas modales ── */
.backdrop { position: fixed; inset: 0; background: hsl(216 39% 8% / .55); backdrop-filter: blur(2px); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: var(--radius-2xl) var(--radius-2xl) 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); animation: up .3s var(--ease); }
@media (min-width: 700px) { .backdrop { align-items: center; } .sheet { border-radius: var(--radius-2xl); } }
@keyframes up { from { transform: translateY(24px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet h2 { margin-bottom: 14px; font-size: 1.2rem; }
.sheet .close { float: right; background: var(--surface-2); border: 0; width: 34px; height: 34px; border-radius: 10px; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: .8rem; color: var(--text); margin-bottom: 6px; font-weight: 500; }
.field input, .field select, .field textarea { width: 100%; height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-weight: 300; outline: none; transition: border-color .2s, box-shadow .2s; }
.field textarea { height: auto; min-height: 76px; padding: 12px 14px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px hsl(168 83% 48% / .2); }
.field .hint { font-size: .75rem; color: var(--muted); margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.check { display: flex; gap: 10px; align-items: center; font-size: .9rem; padding: 12px; background: var(--good-bg); color: var(--text); border-radius: var(--radius); margin-bottom: 12px; }
.check input { accent-color: var(--teal-ink); width: 18px; height: 18px; }
.chips-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-pick button { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 7px 12px; font-size: .82rem; font-weight: 400; cursor: pointer; transition: all .2s var(--ease); }
.chips-pick button:hover { border-color: var(--teal); }
.chips-pick button.on { background: var(--navy); color: #fff; border-color: var(--navy); font-weight: 500; }
@media (prefers-color-scheme: dark) { .chips-pick button.on { background: var(--teal); color: var(--navy); border-color: var(--teal); } }
.err-msg { color: var(--crit); font-size: .85rem; margin: 6px 0; }

/* ── Gráficos ── */
/* Colores de serie (marcas, nunca texto). Captación/Crédito validados para daltonismo en claro y oscuro. */
.c-cap { --c: var(--series-cap); } .c-cre { --c: var(--series-cre); } .c-navy { --c: var(--navy); }
.c-muted { --c: hsl(216 20% 82%); } .c-accent { --c: var(--teal); }
/* Comparación entre vendedores: tres primeros tonos de la paleta categórica validada (todos los pares, claro y oscuro) */
.c-v1 { --c: #2a78d6; } .c-v2 { --c: #eb6834; } .c-v3 { --c: #1baf7a; }
@media (prefers-color-scheme: dark) { .c-navy { --c: #8fb0d6; } .c-muted { --c: hsl(216 25% 34%); } .c-v1 { --c: #3987e5; } .c-v2 { --c: #d95926; } .c-v3 { --c: #199e70; } }
figure.viz { margin: 0 0 12px; padding: 16px 16px 14px; }
.viz figcaption { margin-bottom: 12px; }
.viz figcaption h3 { font-size: .98rem; }
.viz-sub { margin: 4px 0 0; font-size: .8rem; color: var(--muted); line-height: 1.4; }
.viz-sub b { color: var(--text); }
.viz-foot { margin: 10px 0 0; font-size: .75rem; color: var(--muted); }
.viz-toggle { border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: .72rem; font-weight: 500; padding: 4px 10px; border-radius: 99px; cursor: pointer; white-space: nowrap; }
.viz-toggle[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
@media (prefers-color-scheme: dark) { .viz-toggle[aria-pressed="true"] { background: var(--teal); color: var(--navy); border-color: var(--teal); } }
.viz-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: .78rem; color: var(--text-2); }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; flex: 0 0 auto; background: var(--c); }
.key.rect { width: 10px; height: 10px; border-radius: 3px; }
.key.line { width: 14px; height: 2px; border-radius: 2px; }

/* Barras horizontales: una línea base, ≤14px de grosor, extremo redondeado de 4px, valor en la punta */
.hb { display: flex; flex-direction: column; }
.hb-row { display: grid; grid-template-columns: minmax(112px, 40%) 1fr; gap: 12px; align-items: center; min-height: 30px; padding: 0 4px; margin: 0 -4px; border-radius: 8px; outline: none; cursor: default; }
.hb-row.is-hover, .hb-row:focus-visible { background: var(--surface-2); }
.hb-lbl { font-size: .82rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-row.is-emph .hb-lbl { color: var(--text); font-weight: 500; }
.hb-flag { display: inline-block; font-size: .66rem; font-weight: 500; letter-spacing: .02em; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 0 6px; margin-left: 4px; vertical-align: 1px; }
.hb-plot { display: flex; align-items: center; gap: 8px; min-width: 0; border-left: 1px solid var(--line); height: 26px; }
.hb-bar { height: 12px; width: calc(var(--w) * 0.72); background: var(--c); border-radius: 0 4px 4px 0; transition: filter .2s; }
.hb-row.is-hover .hb-bar { filter: brightness(1.12); }
.hb-val { font-size: .8rem; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.hb-val .muted { font-size: .74rem; }

/* Medidores: proporción contra su propio 100 %; pista = paso claro de la misma rampa */
.mt { display: flex; flex-direction: column; gap: 2px; }
.mt-row { display: grid; grid-template-columns: minmax(112px, 40%) 1fr 52px; gap: 12px; align-items: center; min-height: 32px; padding: 0 4px; margin: 0 -4px; border-radius: 8px; outline: none; }
.mt-row.is-hover, .mt-row:focus-visible { background: var(--surface-2); }
.mt-lbl { font-size: .82rem; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-lbl .muted { font-size: .74rem; }
.mt-track { height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--c) 16%, transparent); overflow: hidden; }
.mt-track > span { display: block; height: 100%; background: var(--c); border-radius: 99px; }
.mt-val { font-size: .82rem; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }

/* SVG: grilla y ejes hairline sólidos, líneas 2px, puntos r4 con anillo de superficie */
.viz-svg { width: 100%; position: relative; }
.viz-svg svg { display: block; overflow: visible; }
.viz-svg .grid { stroke: var(--line-soft); stroke-width: 1; }
.viz-svg .base { stroke: var(--line); stroke-width: 1; }
.viz-svg .target { stroke: var(--muted); stroke-width: 1; opacity: .6; }
.viz-svg .tick { fill: var(--muted); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.viz-svg .val { fill: var(--text); font-size: 11px; font-weight: 500; font-family: var(--font); font-variant-numeric: tabular-nums; }
.viz-svg .mark { fill: var(--c); transition: filter .2s; }
.viz-svg .line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-svg .dot { fill: var(--c); stroke: var(--surface); stroke-width: 2; }
.viz-svg .xh { stroke: var(--muted); stroke-width: 1; pointer-events: none; transition: opacity .15s; }
.viz-svg .hit { fill: transparent; outline: none; }
.viz-svg .hit.is-hover, .viz-svg .hit:focus-visible { fill: hsl(216 20% 50% / .06); }

/* Tooltip: el valor manda, la etiqueta acompaña; series con clave de línea */
.viz-tip { position: fixed; z-index: 80; display: none; pointer-events: none; background: var(--navy); color: #fff; border-radius: 10px; padding: 8px 10px; font-size: .78rem; box-shadow: var(--shadow-hover); max-width: 240px; line-height: 1.35; }
@media (prefers-color-scheme: dark) { .viz-tip { background: #fff; color: var(--navy); } }
.viz-tip .tt-v { display: block; font-size: .95rem; font-weight: 500; }
.viz-tip .tt-l { opacity: .75; }
.viz-tip .tt-x { opacity: .75; margin-top: 4px; font-size: .72rem; }
.viz-tip .tt-row { display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.viz-tip .tt-row b { font-weight: 500; min-width: 44px; }
.viz-tip .tt-row span { opacity: .75; }
.viz-tip .c-navy { --c: #8fb0d6; }

.stat-row { display: flex; gap: 18px; flex-wrap: wrap; margin: 4px 0 2px; }
.stat-row div { font-size: .74rem; color: var(--muted); }
.stat-row b { display: block; font-size: 1.2rem; font-weight: 500; color: var(--text); letter-spacing: -0.01em; }
table.t { width: 100%; border-collapse: collapse; font-size: .82rem; }
table.t th { text-align: left; color: var(--muted); font-weight: 500; font-size: .72rem; padding: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 8px 6px; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
table.t td.r, table.t th.r { text-align: right; }
.scroll-x { overflow-x: auto; }
.insight { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-xl); margin-bottom: 8px; font-size: .88rem; align-items: flex-start; }
.insight .ic { margin-top: 1px; }
.insight.critical { background: var(--crit-bg); color: var(--crit); }
.insight.warning { background: var(--warn-bg); color: var(--warn); }
.insight.good { background: var(--good-bg); color: var(--good); }
.insight.info { background: var(--info-bg); color: var(--info); }
.insight span.t { color: var(--text); }

/* ── Login ── */
.login-wrap { min-height: 100vh; background: var(--navy); position: relative; overflow: hidden; isolation: isolate; color: #fff; margin-bottom: calc(-1 * (var(--nav-h) + 18px)); }
.login-wrap::before { content: ''; position: absolute; inset: 0; z-index: -1; filter: blur(60px);
  background: radial-gradient(60% 45% at 0% 0%, hsl(168 83% 48% / .45), transparent 60%), radial-gradient(55% 40% at 100% 90%, hsl(47 98% 59% / .18), transparent 60%), radial-gradient(40% 35% at 90% 30%, hsl(168 83% 48% / .2), transparent 60%); }
.login { max-width: 400px; margin: 0 auto; padding: calc(48px + env(safe-area-inset-top)) 24px 40px; }
.login .logo { width: 52px; height: auto; margin-bottom: 18px; }
.login h1 { color: #fff; font-size: 2rem; line-height: 1.1; }
.login p.lead { color: rgba(255,255,255,.72); margin: 8px 0 26px; }
.login .field label { color: rgba(255,255,255,.85); }
.login .field input { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.18); color: #fff; }
.login .glass { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius-xl); padding: 16px; margin-bottom: 14px; }
.login .demo-users button { display: flex; width: 100%; justify-content: space-between; margin-bottom: 8px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); color: #fff; height: 50px; padding: 0 14px; border-radius: var(--radius); cursor: pointer; font-weight: 500; align-items: center; transition: all .3s var(--ease); }
.login .demo-users button:hover { border-color: var(--teal); color: var(--teal); }
.login .demo-users span { font-weight: 300; color: rgba(255,255,255,.6); font-size: .82rem; }
.login .err-msg { color: #ff9f9a; }
.empty { text-align: center; color: var(--muted); padding: 22px 10px; font-size: .9rem; }
.banner { display: flex; gap: 8px; align-items: flex-start; background: var(--warn-bg); color: var(--warn); padding: 10px 12px; border-radius: var(--radius); font-size: .82rem; margin-bottom: 12px; }
.banner.info { background: var(--info-bg); color: var(--info); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 26px + env(safe-area-inset-bottom)); background: var(--navy); color: #fff; padding: 11px 16px; border-radius: var(--radius); z-index: 60; font-size: .88rem; font-weight: 500; box-shadow: var(--shadow-hover); max-width: 90vw; display: flex; gap: 8px; align-items: center; border: 1px solid hsl(168 83% 48% / .35); }
.toast .ic { color: var(--teal); }
.vend { padding: 12px 0 6px; border-top: 1px solid var(--line-soft); }
.vend:first-child { border-top: 0; padding-top: 0; }
.vend .spread { margin-bottom: 4px; flex-wrap: wrap; }

/* En pantallas angostas la etiqueta va arriba y la barra debajo, a todo el ancho: nada se trunca */
@media (max-width: 560px) {
  .hb-row { grid-template-columns: 1fr; gap: 2px; padding: 4px 4px; }
  .hb-lbl { white-space: normal; }
  .hb-plot { border-left: 0; height: 18px; }
  .hb-bar { width: calc(var(--w) * 0.80); border-radius: 4px; }
  .hb-row + .hb-row { margin-top: 2px; }
  .mt-row { grid-template-columns: 1fr 52px; grid-template-areas: "lbl val" "bar bar"; gap: 4px 10px; padding: 5px 4px; }
  .mt-lbl { grid-area: lbl; white-space: normal; }
  .mt-val { grid-area: val; }
  .mt-track { grid-area: bar; }
}

/* Resumen plegable del pipeline */
.pipe-sum { padding: 0; overflow: hidden; }
.pipe-sum summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; }
.pipe-sum summary::-webkit-details-marker { display: none; }
.pipe-sum summary b { font-weight: 500; }
.pipe-sum .pipe-more { margin-left: auto; font-size: .76rem; font-weight: 500; color: var(--teal-ink); }
.pipe-sum figure.viz { box-shadow: none; border: 0; border-top: 1px solid var(--line-soft); border-radius: 0; margin: 0; }

/* Próxima acción + Google Calendar */
.nx { display: inline-flex; align-items: center; gap: 5px; }
.nx .ic { color: var(--muted); }
.nx b { font-weight: 500; color: var(--text); }
.next-card { display: flex; gap: 12px; align-items: flex-start; margin: 12px 0 0; padding: 12px; background: var(--surface-2); border-radius: var(--radius); border: 1px solid var(--line-soft); }
.cal-st { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: .76rem; color: var(--muted); }
.cal-st.ok { color: var(--teal-ink); }
.cal-st.link { color: var(--teal-ink); font-weight: 500; text-decoration: none; border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px; background: var(--surface); }
.hint-cal { display: flex; gap: 6px; align-items: flex-start; font-size: .75rem; color: var(--muted); margin: 8px 0 12px; }
.hint-cal .ic { color: var(--teal-ink); margin-top: 1px; }
.cal-menu { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: var(--radius); background: var(--good-bg); margin-bottom: 12px; }
.cal-menu .ic { color: var(--teal-ink); margin-top: 2px; }
.cal-menu b { display: block; font-weight: 500; }
input[type="time"] { min-width: 0; }

/* Deltas vs periodo anterior (estado = dirección × si subir es bueno; siempre con flecha + texto) */
.delta { display: block; font-size: .72rem; font-weight: 500; margin-top: 4px; line-height: 1.3; }
.delta .ic { vertical-align: -2px; margin-right: 2px; }
.delta.up { color: var(--good); } .delta.down { color: var(--crit); } .delta.flat { color: var(--muted); }
.delta .ic { width: 12px; height: 12px; stroke-width: 2; }
.delta span { font-weight: 300; color: var(--muted); }
.hist-ctl { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.hist-ctl .seg { flex: 1 1 100%; }
.hist-ctl label.check { margin: 0; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line-soft); }
.hl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 2px 0 12px; }
.hl div { background: var(--surface-2); border-radius: var(--radius); padding: 8px 10px; font-size: .72rem; color: var(--muted); }
.hl b { display: block; font-size: 1rem; font-weight: 500; color: var(--text); }

/* Guía de objeciones */
.hero-sm { padding: 18px; }
.hero-sm .greet { margin: 4px 0 6px; font-size: 1.2rem; }
.hero-p { color: rgba(255,255,255,.72); font-size: .85rem; margin: 0; }
.ctx-card b { display: block; font-weight: 500; font-size: 1.05rem; }
.obj, .metodo { padding: 0; overflow: hidden; }
.obj summary, .metodo summary { list-style: none; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; cursor: pointer; }
.obj summary::-webkit-details-marker, .metodo summary::-webkit-details-marker { display: none; }
.metodo summary { align-items: center; }
.metodo summary b { font-weight: 500; }
.obj-h { flex: 1; min-width: 0; }
.obj-h b { display: block; font-weight: 500; }
.obj-d { display: block; font-size: .85rem; color: var(--text-2); margin-top: 2px; font-style: italic; font-weight: 300; }
.obj[open] summary { border-bottom: 1px solid var(--line-soft); }
.obj-b { padding: 4px 16px 16px; }
.obj-s { margin-top: 14px; }
.obj-s p, .obj-s ol, .obj-s ul { margin: 6px 0 0; font-size: .9rem; color: var(--text); line-height: 1.5; }
.obj-s ol, .obj-s ul, .pasos { padding-left: 20px; }
.obj-s li, .pasos li { margin-bottom: 6px; }
.obj-s blockquote { margin: 8px 0 0; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius); font-size: .92rem; line-height: 1.55; color: var(--text); }
.obj-q { font-weight: 400; }
.obj-s.warn { background: var(--warn-bg); border-radius: var(--radius); padding: 10px 12px; }
.obj-s.warn .eyebrow { color: var(--warn); }
.obj-s.warn p, .obj-s.warn li { color: var(--text); font-size: .85rem; }
.obj-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.obj-actions .btn { flex: 1 1 auto; height: 42px; font-size: .85rem; }
.pasos { margin: 0; padding: 0 16px 6px 36px; font-size: .9rem; line-height: 1.5; }
.metodo .obj-s.warn { margin: 6px 16px 16px; }
mark.ph { background: var(--warn-bg); color: var(--warn); border-radius: 4px; padding: 0 4px; font-weight: 500; font-size: .85em; }
.metodo .tog::before { content: 'Ver'; }
.metodo[open] .tog::before { content: 'Ocultar'; }

/* Mapa de calor: separación de 2px en color de superficie, valores dentro de la celda */
.hm { overflow-x: auto; margin: 0 -4px; padding: 0 4px; -webkit-overflow-scrolling: touch; }
.hm table { border-collapse: separate; border-spacing: 2px; font-size: .8rem; min-width: 100%; }
.hm th { font-weight: 500; font-size: .7rem; color: var(--muted); padding: 2px 4px 6px; text-align: center; white-space: nowrap; }
.hm th.hm-rl { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; font-size: .78rem; color: var(--text-2); padding: 0 8px 0 0; max-width: 128px; white-space: normal; line-height: 1.2; }
.hm thead th.hm-rl, .hm tr:first-child th.hm-rl { background: var(--surface); }
.hm .hm-th-tot { color: var(--text); }
.hm-c { min-width: 52px; height: 38px; text-align: center; border-radius: 4px; font-variant-numeric: tabular-nums; font-weight: 500; outline: none; cursor: default; transition: box-shadow .15s; }
.hm-c.is-hover, .hm-c:focus-visible { box-shadow: 0 0 0 2px var(--text); }
.hm-low { background: var(--surface-2); color: var(--muted); font-weight: 300; }
.hm-empty { background: transparent; color: var(--line); font-weight: 300; }
.hm-tot { background: transparent; color: var(--text); font-weight: 500; border: 1px solid var(--line); }
.hm-sum th.hm-rl { color: var(--text); font-weight: 500; }
.hm-sum .hm-c { outline: 1px solid var(--line); outline-offset: -1px; }
.hm-legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: .72rem; color: var(--muted); }
.hm-ramp { display: inline-flex; gap: 2px; }
.hm-ramp i { width: 16px; height: 10px; border-radius: 2px; display: inline-block; }
.hm-note { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; }
.hm-sw-low { width: 12px; height: 10px; border-radius: 2px; background: var(--surface-2); border: 1px solid var(--line); display: inline-block; }

/* Coach IA */
.coach-cta { display: flex; align-items: center; gap: 12px; width: 100%; margin: 0 0 12px; padding: 12px 14px; border-radius: var(--radius-xl); border: 0; cursor: pointer; text-align: left;
  background: var(--navy); color: #fff; position: relative; overflow: hidden; isolation: isolate; box-shadow: var(--shadow-card); transition: transform .3s var(--ease); }
.coach-cta::before { content: ''; position: absolute; inset: 0; z-index: -1; filter: blur(24px); background: radial-gradient(60% 120% at 0% 50%, hsl(168 83% 48% / .45), transparent 60%), radial-gradient(40% 100% at 100% 50%, hsl(47 98% 59% / .15), transparent 60%); }
.coach-cta:hover { transform: translateY(-1px); }
.coach-cta .tile { background: hsl(168 83% 48% / .18); color: var(--teal); }
.coach-cta b { display: block; font-weight: 500; }
.coach-cta .small { color: rgba(255,255,255,.7); }
.coach-loading { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: var(--radius); background: var(--surface-2); }
.coach-loading b { display: block; font-weight: 500; }
.coach-loading .tile { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.coach-card { padding: 14px; border-radius: var(--radius); background: var(--surface-2); }
.coach-card p { margin: 0 0 4px; font-size: .92rem; line-height: 1.5; }
.coach-sig { list-style: none; padding: 0; margin: 10px 0 0; }
.coach-sig li { display: flex; gap: 8px; align-items: flex-start; font-size: .86rem; margin-bottom: 6px; }
.coach-sig li.pos .ic { color: var(--good); } .coach-sig li.neg .ic { color: var(--warn); }
.coach-next { margin-top: 14px; padding: 14px; border-radius: var(--radius); border: 1px solid hsl(168 83% 48% / .45); background: var(--good-bg); }
.coach-next b { font-weight: 500; }
.coach-foot { display: flex; align-items: center; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.coach-foot .btn { height: 38px; padding: 0 12px; font-size: .82rem; }
.coach-data { margin-top: 16px; }
.coach-data summary { cursor: pointer; }
.coach-data pre { white-space: pre-wrap; word-break: break-word; font-size: .7rem; background: var(--surface-2); padding: 10px; border-radius: var(--radius); max-height: 260px; overflow: auto; }
