/* ══════════════════════════════════════════════════════════════════════════
   Ocean Panel · hoja de estilos unica
   Marca Ocean Partners (oceanpartnersconsulting.com): negro #0A0A0A, crema
   #F5F3EE, azul acero #8FB4D9 y su version oscura para texto, Inter.
   Herramienta de trabajo en tema claro. Denso y ordenado, como Google Ads o
   HubSpot: sin heroes, sin gradientes, sin sombras grandes. Todo el color que
   hay significa algo (canal, signo de una variacion o estado).
   ══════════════════════════════════════════════════════════════════════════ */

/* ── tipografia autoalojada ─────────────────────────────────────────────── */
@font-face {
  font-family: 'Inter var';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fuentes/InterVariable.woff2') format('woff2');
}

/* ── tokens ─────────────────────────────────────────────────────────────── */
:root {
  --bg: #F5F4F0;
  --surface: #FFFFFF;
  --ink: #0E1420;
  --muted: #5F6672;
  --line: #E4E1D9;
  /* Azul acero de Ocean. El de la web (#8FB4D9) no llega a AA como texto
     sobre blanco: aqui se usa su version oscura y el claro solo como fondo. */
  --accent: #2F5E8C;
  --accent-hover: #244A70;
  --marca-claro: #8FB4D9;
  --marca-negro: #0A0A0A;
  --marca-crema: #F5F3EE;
  --pos: #12805C;
  --neg: #C4320A;

  /* Fondos derivados, siempre planos. */
  --hover: #F1EFEA;
  /* Teal al 6 %. Se escogio ese tono y no uno mas saturado porque el verde de
     --pos y el gris de --muted tienen que seguir cumpliendo AA encima. */
  --activo: #EDF3F9;
  --aviso-bg: #FFF8F0;

  --r-tarjeta: 8px;
  --r-control: 6px;

  --s1: 4px;  --s2: 8px;  --s3: 12px;  --s4: 16px;  --s5: 24px;  --s6: 32px;

  --lateral: 220px;
  --barra: 52px;

  --fuente: 'Inter var', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* ── base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--fuente);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

button, input, select, textarea { font: inherit; color: inherit; }

a { color: var(--accent); }

/* Todas las cifras con ancho de digito fijo: las columnas no bailan. */
.num, table, input[type="number"] { font-variant-numeric: tabular-nums; }

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

/* Enlace de salto: oculto con recorte (no con left:-9999px, que Chromium se
   salta al tabular) y visible en cuanto recibe el foco. */
.saltar {
  position: absolute; left: var(--s2); top: var(--s2); z-index: 100;
  width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  background: var(--surface); padding: var(--s2) var(--s3);
  border: 1px solid var(--line); border-radius: var(--r-control);
  color: var(--accent);
}
.saltar:focus { width: auto; height: auto; clip-path: none; }

.cargando { padding: var(--s6); color: var(--muted); }

.vis-oculto {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* Movimiento reducido: sin reset global (un 0.01ms en una animación infinita la vuelve un parpadeo);
   cada animación lo resuelve en su regla. */

/* ══════════════════════════════════════════════════════════════════════════
   ACCESO
   ══════════════════════════════════════════════════════════════════════════ */
.acceso {
  min-height: 100vh;
  display: grid; place-items: center; align-content: center; gap: var(--s4);
  padding: var(--s5);
  background: var(--marca-negro);
}
.barra__marca { display: none; width: 22px; height: 22px; flex: none; object-fit: contain; }
.acceso__pie { font-size: 11px; color: rgba(245, 243, 238, 0.55); letter-spacing: 0.01em; }

.acceso__caja {
  width: 100%; max-width: 360px;
  background: var(--marca-crema);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--r-tarjeta);
  padding: var(--s6);
}

.acceso__marca { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s5); }
.acceso__titulo { font-size: 16px; font-weight: 600; margin-bottom: var(--s5); }

.campo { display: block; margin-bottom: var(--s4); }
.campo > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: var(--s1); }
.campo input {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
}
.campo input:focus { border-color: var(--accent); }

.captcha {
  display: flex; align-items: center; gap: var(--s2);
  padding: 10px 12px; margin-bottom: var(--s4);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-control);
}
.captcha input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.captcha label { font-size: 13px; flex: 1; }
.captcha__estado { font-size: 12px; color: var(--muted); }
.captcha[data-estado="trabajando"] .captcha__estado::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px;
  border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: girar 0.8s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .captcha[data-estado="trabajando"] .captcha__estado::before { animation-duration: 2.4s; }
}
.captcha[data-estado="ok"] .captcha__estado { color: var(--pos); font-weight: 500; }
.captcha[data-estado="error"] .captcha__estado { color: var(--neg); }
@keyframes girar { to { transform: rotate(360deg); } }
.acceso__nota { font-size: 12px; color: var(--muted); margin-top: var(--s3); }
.acceso__nota[data-error="1"] { color: var(--neg); }

/* ── marca ──────────────────────────────────────────────────────────────── */
.marca { display: flex; align-items: center; gap: 10px; }
.marca__glifo { width: 24px; height: 24px; flex: none; display: block; object-fit: contain; }
.marca__txt { display: flex; flex-direction: column; line-height: 1.15; }
.marca__nombre { font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; }
.marca__producto { font-size: 11px; font-weight: 500; letter-spacing: 0.02em; color: var(--muted); }

/* ── botones ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn--primario { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
.btn--primario:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--ancho { width: 100%; }
.btn--mini { padding: 4px 8px; font-size: 12px; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.btn svg, .btn-plano svg { width: 13px; height: 13px; flex: none; }

.btn-plano {
  background: none; border: 0; padding: 4px 6px; border-radius: var(--r-control);
  color: var(--muted); cursor: pointer;
}
.btn-plano:hover { background: var(--hover); color: var(--ink); }

/* ══════════════════════════════════════════════════════════════════════════
   ARMAZON
   ══════════════════════════════════════════════════════════════════════════ */
.app { display: flex; min-height: 100vh; }

/* ── lateral ────────────────────────────────────────────────────────────── */
.lateral {
  width: var(--lateral); flex: none;
  position: sticky; top: 0; align-self: flex-start;
  height: 100vh;
  display: flex; flex-direction: column;
  /* Lateral en el negro de la marca Ocean; el area de trabajo sigue clara. */
  --lat-ink: var(--marca-crema);
  --lat-muted: rgba(245, 243, 238, 0.62);
  --lat-line: rgba(255, 255, 255, 0.08);
  --lat-hover: rgba(255, 255, 255, 0.06);
  background: var(--marca-negro);
  color: var(--lat-ink);
  border-right: 1px solid var(--marca-negro);
}

.lateral__cab { padding: 18px var(--s4); border-bottom: 1px solid var(--lat-line); }
.lateral .marca__producto { color: var(--lat-muted); }

.lateral__cliente { padding: var(--s3) var(--s4); border-bottom: 1px solid var(--lat-line); }
.lateral__cliente > span { display: block; font-size: 12px; color: var(--lat-muted); margin-bottom: var(--s1); }
.lateral .sel { background: #161616; border-color: rgba(255, 255, 255, 0.14); color: var(--lat-ink); }
.lateral :focus-visible { outline-color: var(--marca-claro); }

.sel {
  width: 100%;
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  cursor: pointer;
}

.nav { padding: var(--s3) var(--s2); flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: var(--s2);
  padding: 7px 10px; margin-bottom: 2px;
  border-radius: var(--r-control);
  color: var(--lat-ink); text-decoration: none;
}
.nav a:hover { background: var(--lat-hover); }
.nav a[aria-current="page"] {
  background: rgba(143, 180, 217, 0.16); color: #FFFFFF; font-weight: 500;
  box-shadow: inset 2px 0 0 var(--marca-claro);
}
.nav a[aria-current="page"] svg { color: var(--marca-claro); }
.nav svg { width: 15px; height: 15px; flex: none; }

.lateral__pie { padding: var(--s3) var(--s4); border-top: 1px solid var(--lat-line); }
.lateral__usuario { font-weight: 500; }
.lateral .lateral__rol { font-size: 12px; color: var(--lat-muted); }
.lateral .btn-plano { color: var(--lat-muted); }
.lateral .btn-plano:hover { background: var(--lat-hover); color: var(--lat-ink); }
.lateral__firma { margin-top: var(--s3); font-size: 11px; color: var(--lat-muted); letter-spacing: 0.01em; }
.lateral__pie .btn-plano { margin-top: var(--s2); margin-left: -6px; }

/* ── contenido ──────────────────────────────────────────────────────────── */
.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.barra {
  position: sticky; top: 0; z-index: 20;
  min-height: var(--barra);
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2) var(--s5);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.barra__cliente { font-size: 14px; font-weight: 600; }
.barra__sector { font-size: 12px; color: var(--muted); }
.barra__hueco { flex: 1; }

.menu-movil { display: none; }

/* Selector de periodo */
.periodo { position: relative; }
.periodo__pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-tarjeta);
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.09);
  padding: var(--s2);
}
.periodo__pop button {
  display: block; width: 100%; text-align: left;
  padding: 6px 10px; border: 0; background: none; border-radius: var(--r-control); cursor: pointer;
}
.periodo__pop button:hover { background: var(--hover); }
.periodo__pop button[aria-pressed="true"] { background: var(--activo); color: var(--accent); font-weight: 600; }
/* Ademas del fondo teal, una marca: el fondo solo no se distingue en una
   pantalla con poco contraste ni en una captura. */
.periodo__pop button[aria-pressed="true"]::after { content: "\2713"; float: right; }
.periodo__sep { height: 1px; background: var(--line); margin: var(--s2) 0; }
.periodo__custom { display: flex; gap: var(--s2); align-items: flex-end; padding: var(--s2) var(--s2) 0; }
.periodo__custom label { font-size: 12px; color: var(--muted); }
.periodo__custom input {
  display: block; width: 130px; padding: 5px 7px;
  border: 1px solid var(--line); border-radius: var(--r-control); background: var(--surface);
}

/* Interruptor de comparacion */
.comparar { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.comparar input { accent-color: var(--accent); margin: 0; }

/* Estado de sincronizacion */
.sync-estado { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.punto { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.punto--ok { background: var(--pos); }
.punto--error { background: var(--neg); }
.punto--tibio { background: #B7791F; }

.vista { padding: var(--s5); flex: 1; }

.vista__cab { margin-bottom: var(--s3); }
.vista__tit { font-size: 16px; font-weight: 600; }

/* ── tarjetas ───────────────────────────────────────────────────────────── */
.caja {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-tarjeta);
}
.caja__cab {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
}
.caja__tit { font-size: 13px; font-weight: 600; }
.caja__hueco { flex: 1; }
.caja__cuerpo { padding: var(--s4); }
.caja__pie { padding: var(--s3) var(--s4); border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* ══════════════════════════════════════════════════════════════════════════
   SCORECARDS (la firma del panel: el embudo del cliente)
   ══════════════════════════════════════════════════════════════════════════ */
.scorecards {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-tarjeta);
  overflow: hidden;
  margin-bottom: var(--s4);
}

.tarjeta {
  position: relative;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
  padding: var(--s3);
  background: none;
  border: 0;
  border-left: 1px solid var(--line);
  text-align: left;
  cursor: pointer;
}
.tarjeta:first-child { border-left: 0; }
.tarjeta:hover { background: var(--hover); }
.tarjeta[aria-pressed="true"] { background: var(--activo); }
/* La franja superior marca la serie activa con SU color en el grafico. */
.tarjeta::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--serie, transparent);
  opacity: 0;
}
.tarjeta[aria-pressed="true"]::before { opacity: 1; }

.tarjeta__et {
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tarjeta__n { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
/* Un importe de seis cifras no cabe a 28 px en una tarjeta de 165 px: baja al
   siguiente escalon de la escala en vez de cortarse. */
.tarjeta__n--largo { font-size: 20px; }
.tarjeta__d { font-size: 12px; font-weight: 500; }
.tarjeta__d[data-signo="pos"] { color: var(--pos); }
.tarjeta__d[data-signo="neg"] { color: var(--neg); }
.tarjeta__d[data-signo="neutro"] { color: var(--muted); }
.tarjeta__sub {
  font-size: 12px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════════════════
   GRAFICO
   ══════════════════════════════════════════════════════════════════════════ */
.grafico { position: relative; }
.grafico svg { display: block; width: 100%; height: auto; }
.grafico__rejilla { stroke: var(--line); stroke-width: 1; }
.grafico__eje { fill: var(--muted); font-size: 12px; }
.grafico__linea { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.grafico__guia { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }

.grafico__tip {
  position: absolute; z-index: 10; pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.12);
  padding: var(--s2) var(--s3);
  font-size: 12px;
  min-width: 132px;
}
.grafico__tip[hidden] { display: none; }
.grafico__tip b { display: block; margin-bottom: 4px; }
.grafico__tip div { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.grafico__tip span.pt { width: 7px; height: 7px; border-radius: 50%; flex: none; }

.leyenda { display: flex; gap: var(--s4); flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.leyenda > span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda i { width: 10px; height: 2px; border-radius: 1px; display: inline-block; }
.leyenda { align-items: center; gap: var(--s2); }
.leyenda__item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 6px 3px 8px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); font-size: 12px; cursor: pointer;
}
.leyenda__item i { width: 10px; height: 3px; }
.leyenda__item:hover { background: var(--hover); }
.leyenda__x { color: var(--muted); font-size: 13px; line-height: 1; }
.leyenda__ayuda { font-size: 12px; color: var(--muted); }

/* Control segmentado (Auto / Dia / Semana / Mes) */
.segmentado { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-control); overflow: hidden; }
.segmentado button {
  padding: 4px 9px; font-size: 12px; background: var(--surface); border: 0; cursor: pointer; color: var(--muted);
}
.segmentado button + button { border-left: 1px solid var(--line); }
.segmentado button:hover { background: var(--hover); color: var(--ink); }
.segmentado button[aria-pressed="true"] { background: var(--activo); color: var(--accent); font-weight: 600; }

/* Tarjeta no elegida: un punto con el color que tendra su linea. */
.tarjeta[aria-pressed="false"] .tarjeta__et::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--serie); opacity: 0.35; margin-right: 6px; vertical-align: 1px;
}

/* ══════════════════════════════════════════════════════════════════════════
   TABLAS
   ══════════════════════════════════════════════════════════════════════════ */
.tabla-scroll { overflow-x: auto; }

table.t { width: 100%; border-collapse: collapse; }

table.t th, table.t td {
  padding: 7px 9px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.t th {
  font-size: 12px; font-weight: 500; color: var(--muted);
  background: var(--surface);
  position: sticky; top: 0; z-index: 2;
  /* Las cabeceras si pueden partirse en dos lineas ("Conv. plataforma"): asi
     el ancho de la columna lo marcan las cifras y no el titulo. */
  white-space: normal;
  vertical-align: bottom;
}
table.t th.der, table.t td.der { text-align: right; }
table.t tbody tr:hover { background: var(--hover); }
table.t tbody tr[aria-selected="true"] { background: var(--activo); }
/* Un dato que no se sabe se pinta con la raya, pero sigue siendo texto: va en
   --muted (4,97:1 sobre blanco) y no en un gris mas claro que no cumpliria AA. */
table.t td.nulo { color: var(--muted); }

/* Los nombres largos de campaña o de negocio no pueden empujar al resto de
   columnas fuera de la pantalla: se recortan con puntos suspensivos y el
   nombre entero queda en el `title`. */
table.t td.texto-largo > span, table.t td.texto-largo {
  max-width: 190px; overflow: hidden; text-overflow: ellipsis;
}
table.t td.texto-largo > span { display: block; }

/* Cabecera ordenable */
th.ord { cursor: pointer; user-select: none; }
th.ord:hover { color: var(--ink); }
/* La flecha solo aparece en la columna por la que se esta ordenando, y ese
   titulo no se parte en dos lineas: si no, la flecha cae sola debajo. */
th.ord[aria-sort="ascending"], th.ord[aria-sort="descending"] { white-space: nowrap; color: var(--ink); }
th.ord[aria-sort="ascending"]::after { content: "\00a0\2191"; }
th.ord[aria-sort="descending"]::after { content: "\00a0\2193"; }

/* Fila de totales pegada bajo la cabecera, como en Google Ads. */
tr.totales td {
  /* Pegada justo debajo de la cabecera, que puede tener una o dos lineas. */
  position: sticky; top: var(--alto-cab, 29px); z-index: 1;
  background: #FAFBFC;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}

/* Barra fina de proporcion bajo una celda numerica. Ocupa el ancho de la
   celda: si solo ocupara el del texto, la proporcion no compararia nada. */
.proporcion { position: relative; display: block; }
.proporcion i {
  position: absolute; left: auto; right: 0; bottom: -5px; height: 2px;
  width: var(--p, 0%); min-width: 2px;
  background: var(--c, var(--accent)); border-radius: 1px; opacity: 0.55;
}

/* Punto de color de canal / estado */
.pt { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

.chip {
  display: inline-flex; align-items: center;
  padding: 1px 7px; border-radius: 10px;
  background: var(--hover); color: var(--muted);
  font-size: 12px; white-space: nowrap;
}
/* El color del canal va en el fondo y el borde, y el texto en --ink. Teñir el
   texto con el color del canal dejaba los grises (Organico, Sin atribuir) muy
   por debajo del contraste AA. */
.chip--canal {
  background: color-mix(in srgb, var(--c) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--c) 32%, #fff);
  color: var(--ink);
}

.etiqueta-etapa { font-size: 12px; color: var(--muted); }

/* Prioridad del lead (Dom In House): alta / media / baja */
.chip--prio { border: 1px solid var(--line); color: var(--ink); text-transform: capitalize; }
.chip--prio-alta { background: #E7F6EC; border-color: #A6DDB8; }
.chip--prio-media { background: #FFF6E0; border-color: #F3D48A; }
.chip--prio-baja { background: #F2F4F7; border-color: #D0D5DD; color: var(--muted); }

/* ── controles de filtro ────────────────────────────────────────────────── */
.controles { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.busca {
  padding: 6px 10px; min-width: 220px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-control);
}
.sel--mini { width: auto; }
/* Filtro de canal activo: que se vea que las cifras estan filtradas. */
.sel--activo { border-color: var(--accent); color: var(--accent); font-weight: 600; }

.desplegable { position: relative; }
.desplegable__pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  min-width: 210px; max-height: 320px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-tarjeta); box-shadow: 0 4px 16px rgba(16, 24, 40, 0.09);
  padding: var(--s2);
}
.desplegable__pop label {
  display: flex; align-items: center; gap: var(--s2);
  padding: 5px 8px; border-radius: var(--r-control); cursor: pointer;
}
.desplegable__pop label:hover { background: var(--hover); }
.desplegable__pop input { accent-color: var(--accent); margin: 0; }

/* ══════════════════════════════════════════════════════════════════════════
   RESUMEN: rejilla inferior
   ══════════════════════════════════════════════════════════════════════════ */
/* ── informes ───────────────────────────────────────────────────────────── */
.informes { margin-top: var(--s6); }
.informes__tit { font-size: 15px; font-weight: 600; margin-bottom: var(--s3); }
.rejilla-informes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); align-items: start; }
.rejilla-informes > .caja--ancha { grid-column: 1 / -1; }
.perdidas-grupo + .perdidas-grupo { margin-top: var(--s3); }
.resumen-notas { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; color: var(--texto-2, #475467); font-size: 12.5px; }
.apagado { color: var(--muted); }
.subtit { font-size: 12px; font-weight: 600; color: var(--muted); margin: var(--s1) 0 var(--s2); }
.subtit:not(:first-child) { margin-top: var(--s4); }
.delta { font-size: 12px; }
.delta[data-signo="pos"] { color: var(--pos); }
.delta[data-signo="neg"] { color: var(--neg); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.kpi { display: flex; flex-direction: column; gap: 2px; padding: var(--s3); background: var(--bg); border-radius: var(--r-control); }
.kpi--alerta { background: #FEF3F2; }
.kpi__et { font-size: 12px; color: var(--muted); }
.kpi__n { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.kpi--alerta .kpi__n { color: var(--neg); }
.kpi__sub { font-size: 11.5px; color: var(--muted); }

.lista-mini { display: flex; flex-direction: column; }
.lista-mini li {
  display: flex; align-items: center; gap: var(--s2);
  padding: 7px 0; border-top: 1px solid var(--line); font-size: 12.5px;
}
.lista-mini li:first-child { border-top: 0; }
.lista-mini li[role="button"] { cursor: pointer; }
.lista-mini li[role="button"]:hover { background: var(--hover); }
.lista-mini__n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-mini b { white-space: nowrap; }

.barras { display: flex; flex-direction: column; gap: 6px; }
.barras li { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; align-items: center; gap: var(--s2); font-size: 12.5px; }
.barras__et { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra-h { display: block; height: 8px; background: var(--hover); border-radius: 4px; overflow: hidden; }
.barra-h i { display: block; height: 100%; border-radius: 4px; }

.lista-calidad { display: flex; flex-direction: column; gap: var(--s4); }
.calidad__cab { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.calidad__barra { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--hover); }
.calidad__vacio { font-size: 12px; margin: 0; }
.calidad__ley { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: 6px; font-size: 12px; }

.tramos { display: flex; flex-direction: column; }
.tramos li { display: grid; grid-template-columns: 1fr auto auto; gap: var(--s3); align-items: baseline; padding: 9px 0; border-top: 1px solid var(--line); font-size: 12.5px; }
.tramos li:first-child { border-top: 0; }
.tramos b { font-size: 15px; }

.rejilla-resumen {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--s4);
  margin-top: var(--s4);
  align-items: start;
}

.avisos li {
  display: flex; gap: var(--s2);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
}
.avisos li:last-child { border-bottom: 0; }
.avisos b { display: block; color: var(--ink); font-weight: 500; font-size: 13px; margin-bottom: 2px; }
.avisos .marca-aviso { width: 3px; border-radius: 2px; background: #B7791F; flex: none; }
.avisos li[data-tipo="sync_error"] .marca-aviso { background: var(--neg); }
.avisos li[data-tipo="pii"] .marca-aviso { background: var(--muted); }

/* ══════════════════════════════════════════════════════════════════════════
   PIPELINE (tablero)
   ══════════════════════════════════════════════════════════════════════════ */
.tablero { display: flex; gap: var(--s3); overflow-x: auto; padding-bottom: var(--s3); align-items: start; }

.columna {
  width: 236px; flex: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-tarjeta);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 210px);
}
.columna__cab { padding: var(--s3); border-bottom: 1px solid var(--line); }
.columna__tit { display: flex; align-items: baseline; gap: 6px; }
.columna__tit b { font-size: 13px; font-weight: 600; }
.columna__n { font-size: 12px; color: var(--muted); }
.columna__importe { font-size: 12px; color: var(--muted); margin-top: 2px; }
.columna__lista { padding: var(--s2); overflow-y: auto; display: flex; flex-direction: column; gap: var(--s2); }
.columna__vacia { padding: var(--s4) var(--s3); color: var(--muted); font-size: 12px; }

.negocio {
  width: 100%; text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  padding: var(--s2) var(--s3);
  cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
}
.negocio:hover { border-color: #CFD4DC; background: var(--hover); }
.negocio__nombre {
  font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.negocio__fila { display: flex; align-items: center; gap: var(--s2); justify-content: space-between; }
.negocio__importe { font-size: 12px; color: var(--muted); }
.negocio__dias { font-size: 12px; color: var(--muted); }
.negocio__dias[data-alerta="1"] { color: var(--neg); font-weight: 500; }

/* ══════════════════════════════════════════════════════════════════════════
   PANEL LATERAL DE NEGOCIO
   ══════════════════════════════════════════════════════════════════════════ */
.velo {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(16, 24, 40, 0.28);
}

/* .ficha es un <dialog> abierto con showModal(): se anulan los estilos del UA (centrado,
   tope de tamaño, borde, relleno) para que siga siendo el panel lateral derecho. */
.ficha {
  position: fixed; top: 0; right: 0; bottom: 0; left: auto; z-index: 41;
  width: min(420px, 100%); height: auto; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; color: inherit;
  background: var(--surface);
  border-left: 1px solid var(--line);
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.ficha[open] { display: flex; }
/* El fondo oscurecido (antes .velo) es ahora el ::backdrop del dialogo. */
.ficha::backdrop { background: rgba(16, 24, 40, 0.28); overflow: hidden; overscroll-behavior: contain; }
.ficha__cab {
  position: sticky; top: 0;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: var(--s4); display: flex; gap: var(--s3); align-items: flex-start;
}
.ficha__nombre { font-size: 16px; font-weight: 600; }
.ficha__importe { font-size: 20px; font-weight: 600; margin-top: var(--s1); }
.ficha__bloque { padding: var(--s4); border-bottom: 1px solid var(--line); }
.ficha__bloque:last-child { border-bottom: 0; }
.ficha__lab { font-size: 12px; color: var(--muted); margin-bottom: var(--s2); font-weight: 500; }

dl.props { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 6px var(--s3); font-size: 13px; }
dl.props dt { color: var(--muted); }
dl.props dd { margin: 0; overflow-wrap: anywhere; }

/* Linea de tiempo de etapas */
.linea-tiempo { display: flex; flex-direction: column; }
.hito { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: var(--s3); }
.hito__marca { display: flex; flex-direction: column; align-items: center; }
.hito__punto { width: 8px; height: 8px; border-radius: 50%; background: var(--line); margin-top: 5px; flex: none; }
.hito--actual .hito__punto { background: var(--accent); }
.hito__raya { flex: 1; width: 1px; background: var(--line); margin: 3px 0; min-height: 10px; }
.hito__cuerpo { padding-bottom: var(--s3); }
.hito__etapa { font-weight: 500; }
.hito__fechas { font-size: 12px; color: var(--muted); }

/* ══════════════════════════════════════════════════════════════════════════
   DATOS
   ══════════════════════════════════════════════════════════════════════════ */
.fuentes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--s3); }
.fuente { padding: var(--s3) var(--s4); }
.fuente__nombre { display: flex; align-items: center; gap: var(--s2); font-weight: 500; }
.fuente__dato { font-size: 12px; color: var(--muted); margin-top: var(--s1); }
.fuente__error { font-size: 12px; color: var(--neg); margin-top: var(--s2); overflow-wrap: anywhere; }

.bitacora li {
  display: flex; gap: var(--s3); align-items: baseline;
  padding: 6px var(--s4); border-bottom: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
}
.bitacora li:last-child { border-bottom: 0; }
.bitacora b { color: var(--ink); font-weight: 500; min-width: 66px; }
.bitacora time { min-width: 116px; }

.propuesta__resumen { font-weight: 500; }
.propuesta__just { font-size: 12px; color: var(--muted); white-space: normal; max-width: 420px; }

/* ── estados vacios y de error ──────────────────────────────────────────── */
.vacio {
  padding: var(--s6) var(--s5);
  text-align: center; color: var(--muted);
}
.vacio b { display: block; color: var(--ink); font-weight: 500; margin-bottom: var(--s1); }
.vacio .btn { margin-top: var(--s3); }

.error-caja {
  border: 1px solid #F3C6B4; background: var(--aviso-bg);
  border-radius: var(--r-tarjeta); padding: var(--s3) var(--s4); color: var(--neg);
  margin-bottom: var(--s4);
}

/* ══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1180px) {
  .rejilla-resumen { grid-template-columns: minmax(0, 1fr); }
  .rejilla-informes { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  /* La lateral pasa a cajon: fuera del flujo hasta que se abre. */
  .lateral {
    position: fixed; z-index: 50; left: 0; top: 0;
    transform: translateX(-100%);
    box-shadow: 0 0 24px rgba(16, 24, 40, 0.12);
  }
  .app[data-cajon="1"] .lateral { transform: none; }
  /* Cerrada, shell.js le pone `inert` (fuera del orden de tabulación y del árbol accesible). */
  @media (prefers-reduced-motion: no-preference) {
    .lateral { transition: transform 0.16s ease; }
  }

  .menu-movil { display: inline-flex; }
  .barra__marca { display: block; }

  .vista { padding: var(--s3); }
  .barra { padding: var(--s2) var(--s3); gap: var(--s2); }
  .barra__hueco { flex: 1 0 0; }
  .barra__sector { display: none; }

  /* Scorecards en carrusel horizontal: se mantiene la lectura de embudo. */
  .scorecards {
    grid-auto-columns: 168px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }
  .tarjeta { scroll-snap-align: start; }
  .tarjeta__n { font-size: 20px; }

  dl.props { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  dl.props dd { margin-bottom: var(--s2); }

  /* La columna del tablero sigue teniendo scroll propio: sin tope, una etapa
     con treinta negocios convierte la pagina en un rollo de 3.000 px. */
  .columna { width: 84vw; max-height: 70vh; }

  /* Cabecera de caja: el titulo arriba y los controles debajo, a lo ancho. */
  .caja__cab { flex-wrap: wrap; align-items: flex-start; }
  .caja__tit { flex: 1 0 100%; }
  .caja__hueco { display: none; }
  .caja__cab .controles { width: 100%; }
  .busca { min-width: 0; flex: 1 1 140px; }
  .caja__cab .desplegable__pop, .periodo__pop { max-width: 86vw; }

  /* En una pantalla estrecha no hay forma de encajar doce columnas: la tabla
     toma su ancho natural y se desplaza en horizontal. Comprimirla dejaria
     titulos partidos en tres lineas y columnas de 30 px. */
  table.t { min-width: max-content; }
  table.t th { white-space: nowrap; }
}

/* ── Evolución e informes ─────────────────────────────────────────────── */
.evolucion { display: flex; flex-direction: column; gap: var(--s4); }
.evo-nota { margin: 0; color: var(--texto-2, #5b6472); font-size: 13px; max-width: 980px; }
.evo-graf-caja { padding: 12px 16px 14px; }
.evo-graf { width: 100%; height: auto; display: block; }
.evo-graf__rejilla { stroke: #E7E5E0; stroke-width: 1; }
.evo-graf__eje { font-size: 10px; fill: #8A919C; font-variant-numeric: tabular-nums; }
.evo-graf__val { font-size: 9.5px; fill: #3d4552; font-variant-numeric: tabular-nums; }
.evo-graf__abierto { fill: #F5F4F0; opacity: .8; }
.evo-leyenda { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 6px; font-size: 12px; color: #3d4552; }
.evo-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.evo-leyenda i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.evo-tabla { overflow-x: auto; }
.evo-abierto { color: #8A919C; font-weight: 400; }
.evo-actual { font-weight: 600; color: #2F5E8C; }
.evo-fichas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 14px 16px; }
.evo-ficha { display: flex; flex-direction: column; gap: 4px; border: 1px solid #E7E5E0; border-radius: 8px; padding: 10px 12px; background: #fff; }
.evo-ficha__tit { font-size: 11.5px; color: #8A919C; text-transform: uppercase; letter-spacing: .02em; }
.evo-ficha b { font-size: 15px; font-variant-numeric: tabular-nums; }
.evo-ficha small { font-size: 12px; color: #5b6472; line-height: 1.35; }
.evo-estado { align-self: flex-start; margin-top: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.evo-estado--ok { background: #E3F2EA; color: #12805C; }
.evo-estado--mal { background: #FBE7E4; color: #B42318; }
.evo-estado--gris { background: #EEF0F3; color: #5b6472; }
.gris { color: #8A919C; }
.plan { display: flex; flex-direction: column; gap: var(--s4); }
.plan-detalle { display: block; font-size: 12px; color: #5b6472; line-height: 1.35; margin-top: 2px; max-width: 520px; white-space: normal; }
/* Rampa: requisitos de activación por escalón */
.esc-rejilla { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 0 16px 16px; align-items: start; }
.esc-solo .req-lista { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 8px; }
.esc-solo .req + .req { border-top: 0; }
.esc-solo .req { border-bottom: 1px solid #F3F1EC; }
.esc-solo { padding: 0 16px 16px; }
.esc { border: 1px solid #E7E5E0; border-radius: 8px; background: #fff; overflow: hidden; }
.esc--siguiente { border-color: #8FB4D9; box-shadow: inset 3px 0 0 #2F5E8C; }
.esc--activo { background: #FAFAF8; }
.esc__cab { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid #EFEDE8; }
.esc--activo .esc__cab { border-bottom: 0; }
.esc__nombre { display: block; font-size: 14px; }
.esc__importe { display: block; font-size: 13px; color: #1f2733; font-variant-numeric: tabular-nums; margin-top: 2px; }
.esc__reparto { display: block; font-size: 12px; color: #5b6472; margin-top: 2px; }
.esc__lado { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.esc__chip { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #EEF0F3; color: #5b6472; }
.esc__chip--ok { background: #E3F2EA; color: #12805C; }
.esc__chip--azul { background: #E8F0F8; color: #2F5E8C; }
.esc__cuenta { font-size: 12px; color: #1f2733; font-weight: 600; font-variant-numeric: tabular-nums; }
.esc__aviso { margin: 0; padding: 8px 14px 0; font-size: 11.5px; color: #8A919C; line-height: 1.35; }
.esc__vacio { margin: 0; padding: 0 14px 12px; font-size: 12px; color: #5b6472; }
.esc__pie { margin: 0; padding: 9px 14px; font-size: 12px; color: #5b6472; background: #FAFAF8; border-top: 1px solid #EFEDE8; }
.esc__pie--ok { color: #12805C; background: #F1F8F4; }
.req-lista { list-style: none; margin: 0; padding: 4px 0; }
.req { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 7px 14px; }
.req + .req { border-top: 1px solid #F3F1EC; }
.req-marca { width: 16px; height: 16px; margin-top: 1px; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.req-marca--ok circle { fill: #12805C; stroke: #12805C; } .req-marca--ok path { stroke: #fff; }
.req-marca--mal circle { fill: #B42318; stroke: #B42318; } .req-marca--mal path { stroke: #fff; }
.req-marca--pend circle { fill: #fff; stroke: #B54708; } .req-marca--pend path { stroke: #B54708; }
.req-marca--gris circle { fill: #fff; stroke: #C3C7CE; stroke-dasharray: 2.5 2; }
.req__texto { display: block; font-size: 13px; color: #1f2733; line-height: 1.35; }
.req--gris .req__texto { color: #5b6472; }
.req__valor { display: block; font-size: 12px; color: #5b6472; margin-top: 2px; font-variant-numeric: tabular-nums; }
.req__quien { display: inline-block; font-size: 11px; font-weight: 600; color: #B54708; background: #FEF3E7; border-radius: 4px; padding: 0 5px; margin-right: 6px; }
.req__nota { color: #8A919C; }
.req__estado { font-size: 11.5px; font-weight: 600; white-space: nowrap; margin-top: 1px; }
.req__estado--ok { color: #12805C; } .req__estado--mal { color: #B42318; } .req__estado--pend { color: #B54708; } .req__estado--gris { color: #8A919C; font-weight: 500; }
@media (max-width: 1100px) { .esc-rejilla { grid-template-columns: minmax(0, 1fr); } .esc-solo .req-lista { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .req { grid-template-columns: 16px minmax(0, 1fr); } .req__estado { grid-column: 2; } .esc__cab { flex-direction: column; } .esc__lado { align-items: flex-start; flex-direction: row; } }
@media (max-width: 900px) { .evo-fichas { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .evo-fichas { grid-template-columns: minmax(0, 1fr); } .plan-detalle { max-width: 240px; } }
