/* ===========================================================================
   Informes Omeigo — sistema visual
   Editorial, sobrio, cálido. Un informe vivo, no un panel de control.
   ======================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-latin-opsz-normal.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('fonts/newsreader-latin-opsz-normal.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Newsreader';
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url('fonts/newsreader-latin-opsz-italic.woff2') format('woff2-variations');
}

:root {
  /* superficies */
  --bg: #f7f6f3;
  --surface: #fcfcfb;
  --surface-2: #f1f0ec;
  --ink: #131311;
  --ink-2: #52514e;
  --muted: #898781;
  --line: #e5e3dc;
  --line-soft: #edece7;

  /* acentos funcionales */
  --accent: #2a78d6;          /* enlaces, foco, selección */
  --accent-ink: #1c5cab;
  --ai: #4a3aa7;              /* rasgos de IA, con moderación */
  --ai-soft: #efedfa;

  /* semántica (nunca solo color: siempre flecha/ icono / texto) */
  --pos: #006300;
  --pos-soft: #e7f3e7;
  --neg: #b3362b;
  --neg-soft: #faeae8;
  --warn: #9a6a00;
  --warn-soft: #fdf3dd;
  --crit: #d03b3b;

  /* series de gráficos (paleta validada) */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4;
  --grid: #e1e0d9;

  /* tipografía */
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Newsreader', Georgia, serif;

  /* geometría */
  --r: 12px;
  --r-sm: 8px;
  --shadow: 0 1px 2px rgba(24, 22, 16, .05);
  --shadow-pop: 0 4px 24px rgba(24, 22, 16, .10), 0 1px 3px rgba(24,22,16,.06);
  --pad: clamp(16px, 4vw, 28px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  font-feature-settings: 'cv11';
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
strong { font-weight: 600; }
::selection { background: #d7e6f9; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- utilidades ---------- */
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.overline {
  font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted);
}
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* deltas: color + flecha, nunca solo color */
.delta { display: inline-flex; align-items: baseline; gap: 3px; font-weight: 600; font-size: .92em; white-space: nowrap; }
.delta.pos { color: var(--pos); }
.delta.neg { color: var(--neg); }
.delta.flat { color: var(--muted); font-weight: 500; }

/* ---------- estructura ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 var(--pad); }
.wrap.wide { max-width: 1280px; }

/* ---------- cabecera ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-in { display: flex; align-items: center; gap: 14px; height: 58px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: -.02em; font-size: 15px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand .star { font-family: var(--serif); font-size: 21px; line-height: 0; transform: translateY(3px); }
.brand .sub { font-weight: 400; color: var(--muted); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* selector de cliente */
.client-switch {
  display: inline-flex; align-items: center; gap: 8px; max-width: 320px;
  border: 0; background: none; padding: 6px 10px; border-radius: var(--r-sm);
  font-weight: 600; font-size: 14px; cursor: pointer; letter-spacing: -.01em;
}
.client-switch:hover { background: var(--surface-2); }
.client-switch .chev { color: var(--muted); flex: none; }
.client-switch span.name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* navegación de secciones */
.sectnav { border-bottom: 1px solid var(--line-soft); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); position: sticky; top: 58px; z-index: 39; }
.sectnav-in { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.sectnav-in::-webkit-scrollbar { display: none; }
.snav {
  position: relative; padding: 11px 12px 12px; color: var(--ink-2); font-weight: 500; font-size: 14px;
  white-space: nowrap; border-radius: 0; display: inline-flex; align-items: center; gap: 7px;
}
.snav svg { width: 16px; height: 16px; opacity: .68; }
.snav:hover { color: var(--ink); text-decoration: none; }
.snav.active { color: var(--ink); font-weight: 600; }
.snav.active::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--ink); border-radius: 2px;
}

/* ---------- avatar y menús ---------- */
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
  border: 0; cursor: pointer; flex: none;
}
.avatar:hover { opacity: .85; }

.menu {
  position: absolute; min-width: 220px; background: var(--surface); border-radius: var(--r);
  box-shadow: var(--shadow-pop); border: 1px solid var(--line-soft); padding: 6px; z-index: 90;
  animation: pop .12s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.99); } }
.menu-item {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  border: 0; background: none; cursor: pointer; text-align: left; font-size: 14px; color: var(--ink);
}
.menu-item:hover { background: var(--surface-2); text-decoration: none; }
.menu-item .tick { margin-left: auto; color: var(--ink); font-weight: 700; }
.menu-sep { height: 1px; background: var(--line-soft); margin: 6px 4px; }
.menu-label { padding: 8px 10px 4px; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: var(--r-sm); padding: 8px 14px; font-weight: 550; font-size: 13.5px;
  cursor: pointer; transition: background .12s ease, border-color .12s ease, transform .05s ease;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(0.5px); }
.btn.primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn.primary:hover { background: #2a2a26; }
.btn.ai { border-color: color-mix(in srgb, var(--ai) 30%, var(--line)); color: var(--ai); background: var(--surface); }
.btn.ai:hover { background: var(--ai-soft); }
.btn.ghost { border-color: transparent; background: none; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.danger { color: var(--neg); border-color: color-mix(in srgb, var(--neg) 35%, var(--line)); }
.btn.danger:hover:not([disabled]) { background: var(--neg-soft); }
.btn.danger[disabled] { opacity: .45; cursor: not-allowed; }
.danger-zone { border-color: color-mix(in srgb, var(--neg) 22%, var(--line)); }
.danger-zone h2 { color: var(--neg); }
.btn:disabled { opacity: .55; cursor: default; pointer-events: none; }
.btn svg { width: 15px; height: 15px; }

/* ---------- tarjetas y secciones ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r);
  box-shadow: var(--shadow);
}
.card.pad { padding: 20px 22px; }
.section { margin-top: 34px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 15.5px; }
.section-head .more { margin-left: auto; font-size: 13px; font-weight: 500; white-space: nowrap; }

/* ---------- inicio: cabecera del periodo ---------- */
.period-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 26px 0 4px; }
.period-title { font-family: var(--serif); font-size: clamp(26px, 4.5vw, 34px); font-weight: 500; letter-spacing: -.01em; }
.period-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* selector de periodo */
.seg {
  display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px;
}
.seg button {
  border: 0; background: none; padding: 5px 11px; border-radius: 7px; font-size: 12.5px; font-weight: 550;
  color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.seg button:hover { color: var(--ink); }
.seg button.active { background: var(--ink); color: var(--surface); }

/* ---------- héroe ---------- */
.hero { padding: 26px 0 6px; }
.hero .lead { font-family: var(--serif); font-size: clamp(20px, 3.2vw, 26px); font-weight: 400; color: var(--ink-2); }
.hero .figure {
  font-size: clamp(56px, 11vw, 92px); font-weight: 650; letter-spacing: -.045em; line-height: 1.02;
  margin: 6px 0 2px; display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap;
}
.hero .figure .unit { font-size: clamp(18px, 3vw, 24px); font-weight: 500; color: var(--ink-2); letter-spacing: -.02em; }
.hero .compare { font-size: 15px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hero .compare .delta { font-size: 15px; }

.hero-breakdown { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.chip {
  display: inline-flex; align-items: baseline; gap: 7px; background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: 999px; padding: 7px 14px; font-size: 13.5px;
}
.chip b { font-size: 15px; font-weight: 650; letter-spacing: -.02em; }
.chip .muted { font-weight: 450; }

/* ayuda contextual */
.hint {
  border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 50%;
  display: inline-flex; vertical-align: -3px;
}
.hint:hover { color: var(--ink-2); }
.hint svg { width: 15px; height: 15px; }

/* ---------- grids ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .grid3, .grid4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .grid2, .grid3, .grid4 { grid-template-columns: 1fr; } }

/* ---------- fichas de métrica ---------- */
.stat { padding: 16px 18px; }
.stat .label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; display: flex; align-items: center; gap: 5px; }
.stat .value { font-size: 26px; font-weight: 650; letter-spacing: -.03em; margin-top: 4px; line-height: 1.1; display: flex; align-items: baseline; gap: 8px; }
.stat .value .delta { font-size: 12.5px; }
.stat .foot { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* ---------- listas con barras ---------- */
.bars { display: flex; flex-direction: column; gap: 4px; }
.bar-row {
  display: grid; grid-template-columns: minmax(150px, 235px) 1fr auto auto; gap: 12px; align-items: center;
  padding: 7px 10px; border-radius: 8px; font-size: 13.5px;
}
.bar-row:hover { background: var(--surface-2); }
.bar-row .name { min-width: 0; display: flex; align-items: center; gap: 8px; }
.bar-row .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-row .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.bar-track { height: 8px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 5px 4px 4px 5px; min-width: 2px; }
.bar-row .val { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; min-width: 40px; }
.bar-row .delta { min-width: 56px; justify-content: flex-end; display: inline-flex; }
@media (max-width: 620px) {
  .bar-row { grid-template-columns: 1fr auto auto; }
  .bar-row .bar-track { display: none; }
}

/* ---------- desglose de canales (visitas → conversiones → coste) ---------- */
.chans { display: flex; flex-direction: column; }
.chan {
  display: grid; grid-template-columns: minmax(150px, 240px) 1fr auto; gap: 16px; align-items: center;
  padding: 13px 12px; border-radius: 10px;
}
.chan + .chan { border-top: 1px solid var(--line-soft); }
.chan:hover { background: var(--surface-2); }
.chan .cname { display: flex; align-items: center; gap: 9px; min-width: 0; }
.chan .cname .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.chan .cname .dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.chan .track { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.chan .fill { display: block; height: 100%; border-radius: 6px; min-width: 2px; }
.chan .met { text-align: right; white-space: nowrap; }
.chan .met .v1 { font-weight: 650; font-size: 15px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.chan .met .v1 small { font-weight: 450; color: var(--muted); font-size: 12px; letter-spacing: 0; }
.chan .met .v2 { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; margin-top: 2px; }
.chan .met .v2 .rate { color: var(--muted); }
.chan .met .v3 { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: 1px; }
@media (max-width: 640px) {
  .chan { grid-template-columns: 1fr auto; gap: 10px; }
  .chan .track { display: none; }
}

/* ---------- recorrido del usuario ---------- */
.flows { display: flex; flex-direction: column; }
.flow {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
  padding: 11px 2px; border-bottom: 1px solid var(--line-soft);
}
.flow:last-child { border-bottom: 0; }
.fstep {
  background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 8px;
  padding: 4px 10px; font-size: 12.5px; font-weight: 500; white-space: nowrap;
}
.farr { color: var(--muted); flex: none; }
.fout { font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 3px 9px; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.fout.ok { background: var(--pos-soft); color: var(--pos); }
.fout.exit { background: var(--surface-2); color: var(--muted); }
.fvol { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 8px; }
.lands { display: flex; flex-direction: column; }
.landrow { display: grid; grid-template-columns: minmax(90px, 1fr) 84px auto 52px; gap: 12px; align-items: center; padding: 8px 4px; border-radius: 8px; }
.lands.ec .landrow { grid-template-columns: minmax(90px, 1fr) 84px auto; }
.landrow:hover { background: var(--surface-2); }
.landrow .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.landrow .track { height: 8px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.landrow .val { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.land-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
@media (max-width: 620px) {
  .landrow, .lands.ec .landrow { grid-template-columns: 1fr auto auto; }
  .landrow .track { display: none; }
}

/* ---------- tablas ---------- */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--r); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap;
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .1s ease; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .r, .tbl td.num { text-align: right; }
.tbl th.r { text-align: right; }
.tbl td .q { font-weight: 500; }
.tbl .sub { font-size: 11.5px; color: var(--muted); }

/* ---------- pastillas de estado ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px;
  font-size: 12px; font-weight: 550; white-space: nowrap;
}
.pill.ok { background: var(--pos-soft); color: var(--pos); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.down { background: var(--neg-soft); color: var(--neg); }
.pill.na { background: var(--surface-2); color: var(--muted); }
.pill.tag { background: var(--surface-2); color: var(--ink-2); font-weight: 500; }
.pill .st-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* señales / insights */
.signals { display: flex; flex-direction: column; }
.signal { display: flex; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--line-soft); align-items: flex-start; }
.signal:last-child { border-bottom: 0; }
.sig-icon { flex: none; width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.sig-icon svg { width: 14px; height: 14px; }
.sig-icon.info { background: var(--pos-soft); color: var(--pos); }
.sig-icon.opportunity { background: #e8f0fb; color: var(--accent-ink); }
.sig-icon.warning { background: var(--warn-soft); color: var(--warn); }
.sig-icon.critical { background: var(--neg-soft); color: var(--crit); }
.signal .t { font-weight: 600; font-size: 14px; letter-spacing: -.01em; }
.signal .b { color: var(--ink-2); font-size: 13px; margin-top: 1px; }

/* ---------- actividad (línea de tiempo) ---------- */
.timeline { position: relative; }
.tl-month { margin: 26px 0 8px; }
.tl-item { display: grid; grid-template-columns: 74px 1fr; gap: 16px; padding: 12px 0; position: relative; }
.tl-item + .tl-item { border-top: 1px solid var(--line-soft); }
.tl-date { color: var(--muted); font-size: 12.5px; padding-top: 2px; font-variant-numeric: tabular-nums; }
.tl-body .t { font-weight: 600; font-size: 14.5px; letter-spacing: -.01em; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tl-body .b { color: var(--ink-2); font-size: 13.5px; margin-top: 3px; max-width: 640px; }
.tl-body .b p { margin: 0 0 8px; line-height: 1.55; }
.tl-body .b p:last-child { margin-bottom: 0; }
.tl-type { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.tl-agent { color: var(--ai); }

/* ---------- IA ---------- */
.ai-card { border: 1px solid color-mix(in srgb, var(--ai) 16%, var(--line-soft)); background: linear-gradient(180deg, #fdfdff 0%, var(--surface) 60px); }
.ai-head { display: flex; align-items: center; gap: 8px; }
.ai-mark { color: var(--ai); font-size: 15px; }
.prose { font-family: var(--serif); font-size: 17px; line-height: 1.68; color: #26251f; max-width: 640px; }
.prose p + p { margin-top: 14px; }
.sources { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.source-chip { font-size: 11.5px; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: 3px 9px; }

/* chat */
.chat-box { display: flex; flex-direction: column; gap: 14px; }
.chat-q { align-self: flex-end; background: var(--ink); color: var(--surface); border-radius: 14px 14px 4px 14px; padding: 9px 14px; max-width: 85%; font-size: 14px; }
.chat-a { align-self: flex-start; max-width: 92%; font-size: 14.5px; line-height: 1.6; }
.chat-a .sources { margin-top: 8px; }
.chat-sug { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-sug button {
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 6px 12px;
  font-size: 12.5px; cursor: pointer; color: var(--ink-2);
}
.chat-sug button:hover { border-color: var(--ink-2); color: var(--ink); }
.chat-input { display: flex; gap: 8px; margin-top: 4px; }
.chat-input input { flex: 1; }

/* ---------- formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.input, select.input, textarea.input {
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface);
  padding: 9px 12px; font: inherit; font-size: 14px; color: var(--ink); width: 100%;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.input:hover { border-color: #d4d2c9; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(42,120,214,.13); }
.input::placeholder { color: #b3b1a9; }
textarea.input { resize: vertical; min-height: 70px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check-pill { position: relative; }
.check-pill input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.check-pill span {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; font-size: 13px; font-weight: 500; cursor: pointer; background: var(--surface); transition: all .1s ease;
}
.check-pill input:checked + span { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.check-pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- login ---------- */
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 384px; }
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand .star { font-family: var(--serif); font-size: 40px; line-height: 1; display: block; }
.login-brand h1 { font-size: 21px; letter-spacing: -.02em; margin-top: 10px; }
.login-brand p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.login-foot { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 22px; }

/* ---------- estados vacíos ---------- */
.empty { text-align: center; padding: 44px 24px; }
.empty .e-icon { width: 40px; height: 40px; margin: 0 auto 12px; border-radius: 12px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--muted); }
.empty h3 { font-size: 15px; }
.empty p { color: var(--ink-2); font-size: 13.5px; max-width: 380px; margin: 6px auto 0; }
.empty .btn { margin-top: 16px; }

/* ---------- esqueletos de carga ---------- */
.sk { position: relative; overflow: hidden; background: var(--surface-2); border-radius: 6px; min-height: 12px; }
.sk::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%);} to { transform: translateX(100%);} }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.toast {
  background: var(--ink); color: var(--surface); border-radius: 10px; padding: 11px 16px; font-size: 13.5px;
  box-shadow: var(--shadow-pop); display: flex; gap: 10px; align-items: center; animation: rise .18s ease;
}
.toast.err { background: #7c231b; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* ---------- modales / paneles ---------- */
.overlay { position: fixed; inset: 0; background: rgba(23, 22, 18, .38); z-index: 100; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; z-index: 101; background: var(--surface); box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column;
  top: 0; right: 0; bottom: 0; width: min(520px, 100vw);
  animation: slidein .22s cubic-bezier(.3,.9,.3,1);
}
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 14px; border-bottom: 1px solid var(--line-soft); }
.sheet-head h2 { font-size: 16px; }
.sheet-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.sheet-close { margin-left: auto; }
.modal {
  position: fixed; z-index: 101; inset: 0; display: grid; place-items: center; padding: 20px; pointer-events: none;
}
.modal .card { pointer-events: auto; width: 100%; max-width: 480px; animation: rise .18s ease; max-height: 88dvh; overflow: auto; }
@media (max-width: 640px) {
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 92dvh; border-radius: 16px 16px 0 0; animation: sheetup .25s cubic-bezier(.3,.9,.3,1); }
  @keyframes sheetup { from { transform: translateY(30px); opacity: 0; } }
}

/* ---------- gráficos ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .axis-t { font-size: 10.5px; fill: var(--muted); font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--ink); color: var(--surface);
  border-radius: 8px; padding: 7px 11px; font-size: 12px; line-height: 1.5; z-index: 30;
  box-shadow: var(--shadow-pop); white-space: nowrap; opacity: 0; transition: opacity .1s ease;
}
.chart-tip .tip-t { color: #b9b7ae; font-size: 11px; }
.chart-tip .row { display: flex; align-items: center; gap: 7px; }
.chart-tip .k { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.chart-tip b { font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--ink-2); }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend .k { width: 12px; height: 3px; border-radius: 2px; }
.legend .k.dashed { background: repeating-linear-gradient(90deg, currentColor 0 3px, transparent 3px 6px); height: 2px; }

/* embudo */
.funnel { display: flex; flex-direction: column; gap: 3px; }
.fn-row { display: grid; grid-template-columns: 150px 1fr auto; align-items: center; gap: 12px; padding: 6px 0; font-size: 13px; }
.fn-row > span:nth-child(2) { display: block; }
.fn-bar { display: block; height: 26px; border-radius: 4px; background: var(--s1); opacity: .95; min-width: 3px; }
.fn-val { font-weight: 600; font-variant-numeric: tabular-nums; }
.fn-drop { grid-column: 2 / 4; color: var(--muted); font-size: 11.5px; padding: 0 0 4px 2px; }
@media (max-width: 620px) { .fn-row { grid-template-columns: 108px 1fr auto; } }

/* ---------- salud (agencia) ---------- */
.health-grid { display: flex; flex-direction: column; gap: 10px; }
.health-row { display: flex; align-items: center; gap: 14px; padding: 13px 16px; flex-wrap: wrap; }
.health-row .name { font-weight: 600; min-width: 180px; }
.health-dots { display: flex; gap: 10px; flex-wrap: wrap; }
.hdot { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-2); }
.hdot i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.hdot.ok i { background: #0ca30c; }
.hdot.warn i { background: #fab219; }
.hdot.down i { background: #d03b3b; }
.hdot.na i { background: #d6d4cc; }

/* ---------- login / vistas de agencia ---------- */
.page-head { padding: 30px 0 18px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(24px, 4vw, 30px); letter-spacing: -.01em; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; }

.client-row { display: flex; align-items: center; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.client-row:last-child { border-bottom: 0; }
.client-row:hover { background: var(--surface-2); }
.client-row .cname { font-weight: 600; letter-spacing: -.01em; }
.client-row .cdom { font-size: 12.5px; color: var(--muted); }
.client-row .svcs { display: flex; gap: 5px; flex-wrap: wrap; }
.client-row .main { margin-left: auto; text-align: right; }
.client-row .main .v { font-weight: 650; font-variant-numeric: tabular-nums; }

.svc-dot { font-size: 11px; font-weight: 600; letter-spacing: .03em; color: var(--ink-2); background: var(--surface-2); padding: 2px 8px; border-radius: 999px; }

/* barra "viendo como" */
.impersonate {
  background: var(--ink); color: var(--surface); font-size: 13px; padding: 8px var(--pad);
  display: flex; align-items: center; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.impersonate a { color: var(--surface); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.impersonate svg { width: 15px; height: 15px; flex: none; }

/* tamaño por defecto de iconos sueltos */
h1 svg, h2 svg, h3 svg, .label svg, p svg { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.menu-item svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.client-switch svg { width: 16px; height: 16px; }
.empty .e-icon svg { width: 20px; height: 20px; }
.section-head .more svg { width: 14px; height: 14px; }

/* ---------- onboarding (nuevo cliente) ---------- */
.steps { display: flex; gap: 8px; margin-bottom: 26px; }
.step-dot { height: 3px; border-radius: 2px; background: var(--line); flex: 1; transition: background .2s ease; }
.step-dot.on { background: var(--ink); }
.detect-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line-soft); }
.detect-row:last-child { border-bottom: 0; }
.detect-row .ic { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-weight: 650; font-size: 12px; color: var(--ink-2); flex: none; }
.detect-row .t { font-weight: 600; font-size: 14px; }
.detect-row .s { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.detect-row .st { margin-left: auto; }
.found-tick { color: var(--pos); font-weight: 700; }

/* ---------- navegación móvil ---------- */
.tabbar { display: none; }
@media (max-width: 760px) {
  body.has-tabbar { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    display: flex; justify-content: space-around; align-items: stretch;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line-soft); padding-bottom: env(safe-area-inset-bottom);
  }
  .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 9px 4px 7px; font-size: 10.5px; font-weight: 550; color: var(--muted); text-decoration: none;
  }
  .tab svg { width: 21px; height: 21px; }
  .tab.active { color: var(--ink); }
  .tab:hover { text-decoration: none; }
  .sectnav { display: none; }
  .topbar-in { height: 52px; }
  .sectnav + * .period-row, .period-row { padding-top: 18px; }
  .hero { padding-top: 16px; }
  .card.pad { padding: 16px; }
  .tl-item { grid-template-columns: 56px 1fr; gap: 10px; }
}

/* visibilidad responsive */
.show-sm { display: none; }
@media (max-width: 760px) {
  .hide-sm { display: none; }
  .show-sm { display: inline; }
}

/* impresión */
@media print {
  .topbar, .sectnav, .tabbar, .period-actions, .btn { display: none !important; }
  body { background: #fff; }
  .card { border: 1px solid #ddd; box-shadow: none; }
}

/* ===========================================================================
   v2 · Omeigo Intelligence — capa de inteligencia
   ======================================================================== */

/* --- una frase (qué significa) --- */
.one-liner { font-family: var(--serif); font-size: clamp(17px, 2.6vw, 20px); font-style: italic;
  color: var(--ink-2); margin: -14px 0 6px; max-width: 640px; line-height: 1.45; }

/* --- Lo importante (cliente) --- */
.imp-list { display: flex; flex-direction: column; gap: 10px; }
.imp-item { display: flex; gap: 14px; align-items: center; padding: 14px 18px; }
.imp-item.sev-critical { border-left: 3px solid var(--crit); }
.imp-item.sev-warning { border-left: 3px solid var(--warn); }
.imp-item.sev-opportunity { border-left: 3px solid var(--accent); }
.imp-item.sev-info { border-left: 3px solid var(--pos); }
.imp-ico { font-size: 17px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; background: var(--surface-2); flex: none; }
.imp-kind { margin-bottom: 1px; }
.imp-title { font-weight: 600; font-size: 14.5px; line-height: 1.35; }
.imp-working { display: inline-flex; gap: 6px; align-items: center; margin-top: 4px; font-size: 12.5px;
  color: var(--ai); font-weight: 500; }
.imp-working svg { width: 13px; height: 13px; }
.value-chip { background: var(--ai-soft); }

/* --- resultado de acción en el timeline (cliente) --- */
.act-result { margin-top: 10px; border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  padding: 10px 14px; background: var(--surface); }
.act-result.good { border-color: #cfe6cf; background: #f7fbf7; }
.act-result.bad { border-color: #ecd3d0; }
.act-result.pending { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12.5px; border-style: dashed; }
.act-result.pending svg { width: 14px; height: 14px; }
.act-result .chip { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px;
  background: var(--surface-2); border-radius: 999px; padding: 4px 10px; }

/* --- Hoy (cockpit) --- */
.today-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 22px; }
.tc { display: flex; flex-direction: column; gap: 2px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px 16px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow);
  transition: border-color .15s; }
.tc:hover { border-color: var(--accent); }
.tc .n { font-size: 26px; font-weight: 650; letter-spacing: -0.5px; line-height: 1; }
.tc .l { font-size: 12px; color: var(--muted); line-height: 1.3; }
.tc.bad .n { color: var(--neg); }
.tc.warn .n { color: var(--warn); }
.tc.good .n { color: var(--pos); }
.tc.accent .n { color: var(--accent-ink); }
.today-h { font-family: var(--serif); font-size: 19px; font-weight: 560; margin: 26px 0 10px; display: flex; gap: 10px; align-items: baseline; }

/* --- tarjetas del radar --- */
.radar-card { padding: 14px 18px; margin-bottom: 10px; }
.radar-top { display: flex; gap: 12px; align-items: flex-start; }
.radar-top .t { font-weight: 600; font-size: 14.5px; line-height: 1.35; }
.radar-top .b { font-size: 13px; color: var(--ink-2); margin-top: 2px; line-height: 1.5; }
.radar-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 10px 0 0 38px; font-size: 12px; color: var(--muted); }
.radar-meta strong { color: var(--ink-2); font-weight: 600; }
.radar-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 0 38px; }
.evo { margin-left: 8px; font-size: 12.5px; color: var(--neg); font-weight: 600; letter-spacing: 0; }
.score-badge { flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--ink); color: var(--paper, #fff);
  display: flex; align-items: center; justify-content: center; font-weight: 650; font-size: 15px; }
.score-badge .num { color: #fcfcfb; }

/* --- pestañas del radar --- */
.rtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.rtab { appearance: none; background: none; border: none; border-bottom: 2px solid transparent; cursor: pointer;
  font: 600 13.5px var(--font); color: var(--muted); padding: 8px 14px 10px; display: flex; gap: 8px; align-items: center; }
.rtab.active { color: var(--ink); border-bottom-color: var(--ink); }
.rtab:hover { color: var(--ink); }

/* --- evidencia --- */
.evd { margin: 12px 0 0 38px; border: 1px solid var(--line-soft); border-radius: var(--r-sm); background: var(--surface); }
.evd summary { cursor: pointer; padding: 8px 12px; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
  display: flex; gap: 8px; align-items: center; list-style: none; }
.evd summary::-webkit-details-marker { display: none; }
.evd summary svg { width: 13px; height: 13px; }
.evd-body { padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 10px; max-height: 380px; overflow: auto; }
.ev-item .overline { margin-bottom: 4px; }
.ev-kv { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.ev-kv > div { display: flex; gap: 12px; justify-content: space-between; padding: 2px 0; border-bottom: 1px dashed var(--line-soft); }
.ev-kv .k { color: var(--muted); }
.tbl.small th, .tbl.small td { padding: 5px 8px; font-size: 12px; }

/* --- expediente de investigación --- */
.dossier-sect { margin-top: 16px; }
.dossier-sect .overline { margin-bottom: 5px; }
.dossier-lead { font-family: var(--serif); font-size: 17px; line-height: 1.5; }
.dossier-list { margin: 4px 0 0 18px; display: flex; flex-direction: column; gap: 5px; font-size: 13.5px; line-height: 1.5; }
.dossier-list .pill { margin-left: 4px; }
.inv-progress { text-align: center; padding: 40px 10px; }
.inv-progress .small { max-width: 380px; margin: 6px auto 0; }
.spinner { width: 26px; height: 26px; border: 2.5px solid var(--line); border-top-color: var(--ai);
  border-radius: 50%; margin: 0 auto 16px; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- sistema --- */
.sys-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; }
.sys-grid > div { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--line-soft); font-size: 12.5px; }
.sys-grid .k { color: var(--muted); }
.sys-grid .v { text-align: right; font-weight: 550; }

/* --- próxima mejor acción (ficha) --- */
.nba { margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.nba-row { display: flex; gap: 12px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.nba .t { font-weight: 600; font-size: 14px; }

/* --- explícame por secciones --- */
.ex-lead { font-family: var(--serif); font-size: 18px; line-height: 1.5; margin-bottom: 6px; }
.ex-sect { margin-top: 14px; }
.ex-sect .overline { margin-bottom: 3px; }
.ex-sect p { font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }

@media (max-width: 640px) {
  .radar-meta, .radar-actions, .evd { margin-left: 0; }
  .sys-grid { grid-template-columns: 1fr; }
}
.sheet-head > svg { width: 18px; height: 18px; flex: none; color: var(--ai); }

/* ===========================================================================
   Centro de Trabajo (Agency Execution System)
   ======================================================================== */
.wtc { cursor: pointer; font-family: var(--font); text-align: left; }
.wtc.active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.wtc.aiT .n { color: var(--ai); }
.pill.aiT { background: var(--ai-soft); color: var(--ai); }
.pill.accent { background: #e8f1fb; color: var(--accent-ink); }
.pill.wost { font-weight: 600; }
.pill.wor.r0 { background: var(--surface-2); color: var(--ink-2); }
.pill.wor.r1 { background: #eef4ee; color: #3c6b3c; }
.pill.wor.r2 { background: #fdf3dd; color: var(--warn); }
.pill.wor.r3 { background: #fbe9d9; color: #a05516; }
.pill.wor.r4 { background: var(--neg-soft); color: var(--neg); }

/* fila de trabajo */
.wo-row { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 10px 14px 10px 8px; margin-bottom: 8px; box-shadow: var(--shadow); }
.wo-row:hover { border-color: var(--accent); }
.wo-check { width: 26px; flex: none; display: flex; justify-content: center; }
.wo-check input { width: 15px; height: 15px; accent-color: var(--ink); cursor: pointer; }
.wo-main { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; background: none; border: 0;
  padding: 4px 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.wo-id { flex: none; font-size: 12.5px; font-weight: 650; letter-spacing: .06em; color: var(--ink-2);
  background: var(--surface-2); border-radius: 6px; padding: 4px 8px; }
.wo-t { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.wo-t .t { font-weight: 560; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wo-t .m { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wo-t .worr { color: var(--neg); }
.wo-chips { display: flex; gap: 6px; flex: none; align-items: center; }
.wo-cta { flex: none; }
.batchbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 60;
  display: flex; gap: 14px; align-items: center; background: var(--ink); color: var(--surface);
  border-radius: 999px; padding: 10px 12px 10px 20px; box-shadow: var(--shadow-pop); }
.batchbar[hidden] { display: none; }
.batchbar .btn { border-radius: 999px; }

/* expediente */
.wo-head { align-items: flex-start; }
.wo-title { font-family: var(--serif); font-size: clamp(22px, 3.4vw, 30px); font-weight: 560; line-height: 1.15; margin: 2px 0 8px; }
.wo-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.wo-reasonbar { border-color: var(--warn); background: var(--warn-soft); margin-bottom: 14px; font-size: 13.5px; }
.wo-cta-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 4px 0 22px; }
.btn.big { padding: 10px 22px; font-size: 14.5px; }
.btn.block { width: 100%; justify-content: center; }
.wo-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr); gap: 26px; align-items: start; }
.wo-colside { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 14px; }
.wo-sect { margin-bottom: 22px; }
.wo-sect .overline { margin-bottom: 6px; }
.wo-lead { font-family: var(--serif); font-size: 17px; line-height: 1.5; }
.wo-list { margin: 4px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.wo-scope { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 18px 0 22px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.ok-t { color: var(--pos); }
.neg-t { color: var(--neg); }
.wo-exec { border-top: 1px solid var(--line); padding-top: 16px; }
.wo-finding { display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-sm); margin-bottom: 6px; }
.wo-finding-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.wo-ev { font-size: 12.5px; padding: 3px 0; border-bottom: 1px solid var(--line-soft); }
.wo-prompt { white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border-radius: var(--r-sm);
  padding: 14px; font-size: 12px; line-height: 1.5; font-family: ui-monospace, 'SF Mono', Menlo, monospace; max-height: 420px; overflow: auto; }
.wo-paste { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12px; width: 100%; }
.copy-hero { text-align: center; padding: 8px 0 16px; }
.copy-hero h3 { font-family: var(--serif); font-size: 20px; font-weight: 560; margin: 6px 0 0; }
.copy-hero .wo-meta { justify-content: center; }
.wo-pb { margin-bottom: 10px; }
@media (max-width: 860px) {
  .wo-grid { grid-template-columns: 1fr; }
  .wo-colside { position: static; }
  .wo-scope { grid-template-columns: 1fr; gap: 12px; }
  .wo-finding { flex-wrap: wrap; }
  .wo-finding > div:first-child { flex: 1 1 100%; }
  .wo-row { flex-wrap: wrap; padding: 10px 12px; }
  .wo-main { flex: 1 1 100%; order: 1; }
  .wo-check { order: 0; }
  .wo-chips { order: 2; }
  .wo-cta { order: 3; margin-left: auto; }
  .wo-t .t, .wo-t .m { white-space: normal; }
}

/* avisos de la auditoría: alcance y desfase de versión */
.wo-scopewarn { border-color: var(--neg); background: var(--neg-soft); margin-bottom: 12px; }
.wo-scopewarn strong { color: var(--neg); }
.wo-stalewarn { border-color: var(--warn); background: var(--warn-soft); margin-bottom: 12px; }
.wo-stalewarn strong { color: var(--warn); }
@media (max-width: 860px) {
  /* objetivos táctiles cómodos en móvil */
  .btn, .btn.small { min-height: 38px; }
  .wo-finding-btns .btn { min-height: 36px; }
}

/* ===========================================================================
   TABLERO DE TRABAJO — el estado de la agencia, de un vistazo
   Columnas en horizontal, tarjetas arrastrables. En móvil el tablero se
   convierte en carrusel: se desliza el dedo y cada columna ocupa la pantalla.
   ======================================================================== */
.vseg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--bg); }
.vseg-b { border: 0; background: none; padding: 7px 13px; font-size: 13px; font-weight: 550; color: var(--muted); cursor: pointer; }
.vseg-b + .vseg-b { border-left: 1px solid var(--line); }
.vseg-b.active { background: var(--surface-2); color: var(--ink); }
.vseg-b:hover { background: var(--surface); }

.board-lead { margin: 0 0 14px; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(186px, 1fr);
  gap: 10px; align-items: start; overflow-x: auto; overscroll-behavior-x: contain;
  width: 100vw; margin-left: calc(50% - 50vw); padding: 0 var(--pad) 10px;
  scroll-snap-type: x proximity; }
.board-col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  display: flex; flex-direction: column; min-height: 130px; scroll-snap-align: start; }
.board-h { padding: 10px 11px 8px; border-bottom: 1px solid var(--line); display: grid;
  grid-template-columns: 1fr auto; gap: 2px 6px; }
.board-t { font-weight: 600; font-size: 13px; letter-spacing: -.005em; }
.board-n { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.board-hint { grid-column: 1 / -1; line-height: 1.35; }
.board-drop { padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 64px; transition: background .12s; }
.board-drop.over { background: #eaf2fc; outline: 2px dashed var(--accent); outline-offset: -4px; border-radius: var(--r-sm); }
.board-empty { margin: 6px 4px; }

.wo-card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 8px 9px; cursor: grab; display: flex; flex-direction: column; gap: 4px; }
.wo-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wo-card.dragging { opacity: .45; }
.wo-card.warn { border-left: 3px solid var(--neg); }
.wo-card-top { display: flex; align-items: center; gap: 6px; }
.wo-card-id { font-size: 11px; letter-spacing: .06em; color: var(--muted); white-space: nowrap; }
.wo-card-move { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px;
  line-height: 1; padding: 4px 6px; border-radius: 6px; }
.wo-card-move:hover { background: var(--surface-2); color: var(--ink); }
.wo-card-t { border: 0; background: none; padding: 0; text-align: left; font: inherit; font-weight: 560;
  font-size: 13px; line-height: 1.32; cursor: pointer; color: var(--ink); }
.wo-card-t:hover { text-decoration: underline; }
.wo-card-next { color: var(--muted); line-height: 1.35; }
.wo-card-c { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wo-card.warn .wo-card-next { color: var(--neg); }
.wo-card-foot { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.wo-card-foot .btn { padding: 4px 9px; font-size: 12px; min-height: 26px; }
.wo-card .pill.wor { font-size: 10px; padding: 1px 5px; letter-spacing: .02em; }
.wo-card-next, .wo-card-c { font-size: 11.5px; }

.movelist { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.movebtn { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg); cursor: pointer; font: inherit; }
.movebtn:hover { background: var(--surface-2); }
.movebtn.current, .movebtn[disabled] { opacity: .55; cursor: default; background: var(--surface); }

/* Explicar fácil */
.easy-btn { white-space: nowrap; }
.easy-btn svg { width: 15px; height: 15px; }
.btn.easy-main { background: var(--surface-2); border-color: var(--line); font-weight: 560; }
.sect-h { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; margin-bottom: 4px; }
.sect-h .overline { flex: 1; min-width: 0; }
.easy-text p { font-size: 15.5px; line-height: 1.62; margin: 0 0 14px; }
.easy-text p:last-child { margin-bottom: 0; }
.easy-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line); }
.wo-head-acts { display: flex; gap: 6px; align-items: flex-start; flex-shrink: 0; }

/* Qué hemos hecho — portal del cliente */
.done-item { padding: 16px 0; border-bottom: 1px solid var(--line); }
.done-item:last-child { border-bottom: 0; }
.done-h { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.done-h h3 { font-family: var(--serif); font-size: 17px; font-weight: 560; margin: 0; }
.done-item p { font-size: 15px; line-height: 1.6; margin: 8px 0 0; }
.done-m { margin-top: 10px; font-size: 13px; }

@media (max-width: 860px) {
  .board { grid-auto-columns: 84%; gap: 10px; scroll-snap-type: x mandatory; }
  .wo-card { cursor: default; padding: 10px; gap: 6px; }
  .wo-card-move { min-width: 40px; min-height: 38px; font-size: 17px; }
  .wo-card-foot .btn, .board .btn { min-height: 38px; padding: 8px 12px; font-size: 13px; }
  .wo-card-t { font-size: 14.5px; }
  .wo-head-acts { width: 100%; }
  .page-head .actions { flex-wrap: wrap; margin-left: 0; width: 100%; gap: 6px; }
  .page-head .actions > * { flex: 1 1 auto; }
  .page-head .vseg { order: -1; }
}

/* ===========================================================================
   DIRECTOR MODE — complejidad por debajo, decisiones por encima
   ======================================================================== */
.dhero { padding: 34px 0 10px; }
.dhero h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(26px, 4.5vw, 34px); letter-spacing: -.015em; margin: 0; }
.dlead { font-size: 16.5px; line-height: 1.55; color: var(--ink-2); margin: 10px 0 0; max-width: 62ch; }
.dlead strong { color: var(--ink); font-weight: 600; }

.dtiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 10px; margin: 22px 0 30px; }
.dtile { display: flex; flex-direction: column; gap: 2px; padding: 14px 15px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: inherit; transition: border-color .12s; }
.dtile:hover { text-decoration: none; border-color: var(--ink-2); }
.dtile .n { font-size: 27px; font-weight: 600; line-height: 1.05; font-variant-numeric: tabular-nums; }
.dtile .l { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.dtile.warn .n { color: var(--warn); }
.dtile.down .n { color: var(--neg); }
.dtile.ok .n { color: var(--pos); }
.dtile.accent .n { color: var(--accent-ink); }
.dtile.zero { opacity: .5; }
.dtile.zero .n { color: var(--muted); }

.dsect { margin: 0 0 30px; }
.dsect h2 { font-family: var(--serif); font-weight: 500; font-size: 21px; margin: 0 0 12px; letter-spacing: -.01em; }
.dcalm { border-style: dashed; }
.drow { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); }
.drow:last-child { border-bottom: 0; }
.drow .t { font-weight: 550; font-size: 14.5px; }
.drow .s { margin-top: 2px; }
.drow > div:first-child { flex: 1; min-width: 0; }
.dfoot { margin: 26px 0 40px; }

/* Tarjeta de decisión */
#dcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.dcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px 16px; }
.dcard.done { background: var(--pos-soft); border-color: color-mix(in srgb, var(--pos) 25%, var(--line)); }
.dcard-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dcard-client { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.dcard h3 { font-family: var(--serif); font-weight: 560; font-size: 19px; line-height: 1.25; margin: 0 0 8px; letter-spacing: -.01em; }
.dcard-plain { font-size: 15px; line-height: 1.58; margin: 0; color: var(--ink-2); }
.dcard-reopen { font-size: 13.5px; line-height: 1.5; margin: 10px 0 0; padding: 8px 11px;
  background: var(--warn-soft); border-radius: var(--r-sm); color: var(--ink); }
.dcard-ev { margin: 12px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.dcard-meta { display: flex; gap: 16px; flex-wrap: wrap; margin: 14px 0 0; font-size: 13px; color: var(--ink-2); }
.dcard-meta b { font-weight: 550; color: var(--muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: .07em; display: block; }
.dcard-ask { font-family: var(--serif); font-size: 17px; margin: 16px 0 10px; }
.dcard-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.dcard-btns .btn { min-width: 72px; justify-content: center; }
.dcard-note { color: var(--warn); margin: 10px 0 0; }
.dcard-done { text-align: left; }
.dcard-done p { margin: 6px 0 10px; }
.noreasons { display: flex; flex-direction: column; gap: 6px; }
.noreasons .btn { justify-content: flex-start; }

/* Ficha de cliente */
.cgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 4px 0 30px; }
.cstate-t { font-family: var(--serif); font-size: 22px; font-weight: 500; margin-top: 4px; letter-spacing: -.01em; }
.cstate.ok .cstate-t { color: var(--pos); }
.cstate.down .cstate-t { color: var(--neg); }
.cstate.warn .cstate-t { color: var(--warn); }
.cstate.accent .cstate-t { color: var(--accent-ink); }
.ccta { display: flex; flex-direction: column; justify-content: center; }

/* P12 · las cuatro dimensiones del cliente. Van juntas y en el mismo peso
   visual a propósito: ninguna manda sobre las otras. */
.cdims { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; margin: 4px 0 14px; }
.cdim { background: var(--card); padding: 14px 16px; }
.cdim-v { font-family: var(--serif); font-size: 19px; font-weight: 500; margin: 2px 0 4px; letter-spacing: -.01em; }
.cdim p { margin: 0; line-height: 1.35; }
.cdim.ok .cdim-v { color: var(--pos); }
.cdim.warn .cdim-v { color: var(--warn); }
.cdim.down .cdim-v { color: var(--neg); }
.cphase-prop { display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin: 0 0 22px; border-left: 3px solid var(--accent); }
.cphase-prop > div:first-child { flex: 1; min-width: 240px; }
.btn.big { padding: 12px 18px; font-size: 15px; }

/* Pasos de la auditoría */
.astep { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 12px; }
.astep-n { flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--surface);
  display: grid; place-items: center; font-weight: 600; font-size: 14px; }
.astep h3 { font-size: 16px; margin: 2px 0 4px; }
.asum-lead { font-size: 16.5px; line-height: 1.6; margin: 0 0 16px; }
.asum-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.asum-tiles > div { display: flex; flex-direction: column; }
.asum-tiles .n { font-size: 24px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.asum-tiles .l { font-size: 12.5px; color: var(--muted); line-height: 1.3; }
.easy-hidden { display: none; }
.snav-adv { border: 0; background: none; font: inherit; cursor: pointer; }

@media (max-width: 860px) {
  #dcards { grid-template-columns: 1fr; }
  .dtiles { grid-template-columns: repeat(2, 1fr); }
  .dcard-btns .btn { flex: 1; min-height: 42px; }
  .astep { gap: 12px; }
}


/* ---------- economía de la IA ---------- */
.aibar { position: relative; height: 12px; border-radius: 999px; background: var(--surface-2); overflow: visible; margin-top: 6px; }
.aibar-fill { height: 100%; border-radius: 999px; background: var(--pos); transition: width .35s ease; }
.aibar-fill.warn { background: var(--warn); }
.aibar-fill.down { background: var(--neg); }
.aibar-mark { position: absolute; top: -3px; width: 2px; height: 18px; background: var(--ink-2); opacity: .55; border-radius: 2px; }
.aibar-mark.soft { background: var(--warn); opacity: .8; }
.aibar-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.sw { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.sw input { width: 16px; height: 16px; accent-color: var(--ai, var(--ink)); }
.note { padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: 13px; line-height: 1.5; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.weekly-body { white-space: pre-wrap; line-height: 1.65; font-size: 14px; }
.weekly-body b, .weekly-body strong { font-weight: 600; }
@media (max-width: 720px) {
  .aibar-legend { gap: 10px; font-size: 11px; }
}

/* ---------------------------------------------------------------------------
 * §76 · Cuándo llegó cada contacto
 *
 * Lo que se busca aquí es que un contacto se lea de un golpe de vista: hora,
 * qué fue y de dónde vino, en una línea. Nada de tablas: en el móvil una tabla
 * de cuatro columnas obliga a hacer scroll lateral, y entonces no se lee.
 * ------------------------------------------------------------------------- */
.hero-drill {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 16px;
  font-size: 14px; font-weight: 600; text-decoration: none;
}
.hero-drill svg { width: 16px; height: 16px; }
.hero-drill:hover { text-decoration: underline; }

.ct-franja {
  font-size: 15px; font-weight: 600; margin-bottom: 14px;
}
.ct-reloj {
  display: flex; align-items: flex-end; gap: 2px; height: 84px;
}
.ct-bar-wrap { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.ct-bar {
  width: 100%; border-radius: 3px 3px 0 0;
  background: var(--accent, #1f6feb); min-height: 2px;
}
.ct-bar.cero { background: var(--line, #e6e3dd); }
.ct-reloj-eje {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--muted); margin-top: 6px;
}

.ct-dia { margin-bottom: 14px; overflow: hidden; }
.ct-dia-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line, #e6e3dd);
}
.ct-dia-nombre { font-weight: 600; font-size: 15px; }
.ct-dia-canales { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ct-dia-total { font-size: 22px; font-weight: 600; line-height: 1; }

.ct-lista { list-style: none; margin: 0; padding: 0; }
.ct-item {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 11px 16px; border-bottom: 1px solid var(--line-soft, #f0eee9);
}
.ct-item:last-child { border-bottom: 0; }
.ct-hora {
  font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px;
  min-width: 46px;
}
/* La hora aproximada se distingue sin necesidad de leyenda: si es más pálida,
   ya se ve que es menos precisa. La leyenda está igualmente, al pie. */
.ct-hora.aprox { font-weight: 500; color: var(--muted); }
.ct-tipo { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; min-width: 128px; }
.ct-tipo svg { width: 17px; height: 17px; opacity: .75; }
.ct-canal { font-size: 12px; color: var(--ink-2, #5b5750); }
.ct-pagina {
  font-size: 12px; color: var(--muted); margin-left: auto;
  max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ct-descuadre { border-left: 3px solid var(--warn, #b8860b); }

@media (max-width: 620px) {
  .ct-tipo { min-width: 0; }
  .ct-pagina { display: none; }   /* en móvil sobra: la línea tiene que caber */
  .ct-item { gap: 10px; }
}
