/* === LicitaWatch — panel CICP ========================================
 * Estética macOS: tipografía del sistema, layout aireado, tarjetas con
 * sombras suaves, dorado #B8933F como acento escaso. Modo claro/oscuro
 * automático vía prefers-color-scheme.
 * =================================================================== */

/* ── Tokens (modo claro por defecto) ──────────────────────────────── */
:root {
  /* Lienzo: gradiente multi-capa para profundidad y calidez.
   * - Radial dorado muy diluido arriba-izquierda → pertenencia de marca.
   * - Lineal blanco-cremoso → crema CICP muy tenue → calidez sin saturar.
   * El gradiente se aplica al body con background-attachment: fixed para
   * que persista al hacer scroll. */
  --canvas:
    radial-gradient(ellipse 80% 60% at 18% -8%, rgba(184, 147, 63, 0.07), transparent 55%),
    linear-gradient(180deg, #FCFBF8 0%, #F3F0E9 100%);

  /* Superficies translúcidas para efecto vidrio esmerilado.
   * Combinadas con backdrop-filter: blur, dejan que el lienzo tintado
   * "respire" a través de las tarjetas. */
  --surface:        rgba(255, 255, 255, 0.72);
  --surface-solid:  #FFFFFF;        /* opaco: inputs, segmento activo */
  --surface-alt:    #FCFAF6;        /* opaco cálido: sub-tarjetas dentro de frosted */
  --surface-sunk:   #EDEAE3;        /* opaco cálido: inputs, fondo del switch */

  /* Tinta */
  --ink:           #1D1D1F;   /* texto principal (no negro puro) */
  --ink-2:         #3A3A3D;
  --ink-muted:     #6E6E73;   /* secundario / labels */
  --ink-faint:     #86868B;

  /* Líneas hairline (tintadas hacia cálido para armonizar con la crema) */
  --hairline:      rgba(40, 30, 15, 0.10);
  --hairline-2:    rgba(40, 30, 15, 0.05);

  /* Acento CICP */
  --accent:        #B8933F;
  --accent-hover:  #A37F2E;
  --accent-soft:   rgba(184, 147, 63, 0.10);
  /* Gradiente dorado para el sello (un solo punto de calidez fuerte) */
  --accent-grad:   linear-gradient(135deg, #D4AD58 0%, #B8933F 55%, #9B7C2E 100%);

  /* Estados (tonos serenos, no saturados) */
  --ok:            #2F7A48;
  --ok-soft:       rgba(47, 122, 72, 0.12);
  --warn:          #B5810A;
  --warn-soft:     rgba(181, 129, 10, 0.13);
  --bad:           #C13B2C;
  --bad-soft:      rgba(193, 59, 44, 0.10);

  /* Sombras difusas con tinte cálido (rgba(30,20,10) en vez de negro
   * puro) para no enfriar el ambiente. Un punto más visibles que antes
   * para que las tarjetas se despeguen del lienzo tintado. */
  --shadow-sm:  0 1px 3px rgba(30, 20, 10, 0.07), 0 1px 2px rgba(30, 20, 10, 0.04);
  --shadow-md:  0 12px 30px rgba(30, 20, 10, 0.09), 0 2px 6px rgba(30, 20, 10, 0.05);
  --shadow-lg:  0 24px 60px rgba(30, 20, 10, 0.13), 0 3px 8px rgba(30, 20, 10, 0.06);

  /* Radios */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* Insignia de origen por fuente (chips multi-fuente del panel).
   * Mismos colores en claro y oscuro para identidad consistente. */
  --src-comprasmx: #4f7cff;   /* Compras MX (federal) — azul */
  --src-dof:       #f4c45a;   /* DOF (agregador) — dorado */
  --src-cdmx:      #e0567a;   /* Concurso Digital CDMX — rosa */
  --src-tfja:      #21d4c4;   /* TFJA — teal */
  --src-oaj:       #b98bff;   /* OAJ / CJF — lila */
}

/* ── Modo oscuro ──────────────────────────────────────────────────
 * Se aplica en dos casos:
 *   1) Forzado: <html data-theme="dark">
 *   2) Auto: sin data-theme (o data-theme="auto") y el sistema en oscuro.
 * El usuario puede forzar claro con data-theme="light", y entonces ni
 * el sistema ni nada más conmuta. Las paletas son idénticas en ambos
 * casos; lo único que cambia es quién decide aplicarlas.
 * ──────────────────────────────────────────────────────────────── */
:root[data-theme="dark"] {
  /* Navy profundo con resplandores sutiles (violeta arriba-izq, teal
   * arriba-der). Pertenencia de marca de noche — NO negro puro. */
  --canvas: #0a0a0a;  /* neutro (sin navy/purple/teal); antes gradiente navy */

  /* Superficies translúcidas navy para el frosted; opacas para tarjetas. */
  --surface:        #141414;
  --surface-solid:  #141414;
  --surface-alt:    #1c1c1c;
  --surface-sunk:   #161616;

  --ink:           #e8ecf8;
  --ink-2:         #a1a1aa;
  --ink-muted:     #a1a1aa;
  --ink-faint:     #71717a;

  --hairline:      #262626;
  --hairline-2:    #1f1f1f;

  --accent:        #f5c451;
  --accent-hover:  #ffd56b;
  --accent-soft:   rgba(232, 163, 12, 0.18);
  --accent-grad:   linear-gradient(135deg, #ffd56b 0%, #f5c451 55%, #b8800f 100%);
  /* Acentos de marca secundarios (teal / dorado) para chips y destacados. */
  --accent-2:      #21d4c4;
  --gold:          #f4c45a;

  --ok:            #4fd497;
  --ok-soft:       rgba(79, 212, 151, 0.18);
  --warn:          #f4c45a;
  --warn-soft:     rgba(244, 196, 90, 0.18);
  --bad:           #ff6a7e;
  --bad-soft:      rgba(255, 106, 126, 0.16);

  --shadow-sm: 0 1px 3px rgba(3, 6, 18, 0.50);
  --shadow-md: 0 12px 30px rgba(3, 6, 18, 0.60), 0 2px 6px rgba(3, 6, 18, 0.40);
  --shadow-lg: 0 24px 60px rgba(3, 6, 18, 0.70), 0 3px 8px rgba(3, 6, 18, 0.45);
}

/* AUTO: sin data-theme o data-theme="auto" → seguir al sistema.
 * El :not("light"):not("dark") excluye los modos forzados, así
 * un usuario en "light" no se vuelve oscuro de noche, y viceversa. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --canvas: #0a0a0a;  /* neutro (sin navy/purple/teal); antes gradiente navy */

    --surface:        #141414;
    --surface-solid:  #141414;
    --surface-alt:    #1c1c1c;
    --surface-sunk:   #161616;

    --ink:           #e8ecf8;
    --ink-2:         #a1a1aa;
    --ink-muted:     #a1a1aa;
    --ink-faint:     #71717a;

    --hairline:      #262626;
    --hairline-2:    #1f1f1f;

    --accent:        #f5c451;
    --accent-hover:  #ffd56b;
    --accent-soft:   rgba(232, 163, 12, 0.18);
    --accent-grad:   linear-gradient(135deg, #ffd56b 0%, #f5c451 55%, #b8800f 100%);
    --accent-2:      #21d4c4;
    --gold:          #f4c45a;

    --ok:            #4fd497;
    --ok-soft:       rgba(79, 212, 151, 0.18);
    --warn:          #f4c45a;
    --warn-soft:     rgba(244, 196, 90, 0.18);
    --bad:           #ff6a7e;
    --bad-soft:      rgba(255, 106, 126, 0.16);

    --shadow-sm: 0 1px 3px rgba(3, 6, 18, 0.50);
    --shadow-md: 0 12px 30px rgba(3, 6, 18, 0.60), 0 2px 6px rgba(3, 6, 18, 0.40);
    --shadow-lg: 0 24px 60px rgba(3, 6, 18, 0.70), 0 3px 8px rgba(3, 6, 18, 0.45);
  }
}

/* ── Reset suave ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: light dark; }

body {
  /* Sora (la del sitio de marketing y el mockup) para identidad de producto.
   * Fallback al stack del sistema si la fuente web no carga. */
  font-family: "Sora", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  /* El gradiente del lienzo es fixed: persiste al scrollear y permite
   * que las tarjetas semi-transparentes (frosted) lo dejen ver. */
  background: var(--canvas);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent-hover); }

.wrap { width: min(96vw, 2200px); margin: 0 auto; }

/* ── Topbar ──────────────────────────────────────────────────────── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  padding: 18px 0 0;
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}
.topbar .wrap {
  display: flex; flex-direction: column; gap: 14px; padding-bottom: 0;
}
.topbar-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; }

/* Sello CICP: única huella tipográfica de marca permitida.
 * Gradiente dorado + halo cálido + reflejo interno sutil = punto de
 * calidez fuerte concentrado en un solo lugar. */
.seal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: var(--accent-grad);
  color: #fff;
  font-weight: 700; font-size: 13px;
  letter-spacing: 1.4px;
  border-radius: 10px;
  box-shadow:
    0 3px 10px rgba(184, 147, 63, 0.30),
    0 1px 2px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.brand-text h1 {
  margin: 0;
  font-size: 19px; font-weight: 600;
  color: var(--ink); letter-spacing: -0.02em;
}
.brand-text p {
  margin: 1px 0 0;
  font-size: 12px; color: var(--ink-muted);
  letter-spacing: 0;
}

.main-nav {
  display: flex; gap: 4px;
  border-top: 1px solid var(--hairline-2);
  padding-top: 6px;
  margin-top: 4px;
}
.main-nav a {
  color: var(--ink-muted);
  padding: 10px 14px;
  font-size: 14px; font-weight: 500;
  border-radius: var(--r-sm);
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, background 0.15s ease;
}
.main-nav a:hover {
  color: var(--ink);
  background: var(--surface-sunk);
}
.main-nav a.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}

/* ── Contenido ───────────────────────────────────────────────────── */
.content {
  padding: 36px 0 80px;
  display: flex; flex-direction: column; gap: 24px;
}

h2 {
  margin: 0;
  font-size: 22px; font-weight: 600;
  color: var(--ink); letter-spacing: -0.02em;
}
h3 {
  margin: 0 0 12px;
  font-size: 16px; font-weight: 600;
  color: var(--ink); letter-spacing: -0.01em;
}

/* ── Tarjeta de salud ────────────────────────────────────────────── */
.health {
  position: relative;
  overflow: hidden;            /* recorta el ::before al border-radius */
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 28px 32px;
  box-shadow: var(--shadow-md);
}
/* Hairline dorada en el borde superior — único punto de calidez fuerte
 * dentro de las tarjetas. Va con opacidad baja, gradiente que se difumina
 * a los lados, casi imperceptible salvo al fijarse. */
.health::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--accent) 25%,
    var(--accent) 75%,
    transparent 100%
  );
  opacity: 0.55;
  pointer-events: none;
}
/* Fallback elegante donde no haya backdrop-filter: superficie opaca. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .health { background: var(--surface-solid); }
}

/* Banner: estados serenos. Línea de color discreta a la izquierda. */
.health-banner {
  display: flex; align-items: flex-start; gap: 14px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 22px;
}
.health-text { display: flex; flex-direction: column; gap: 4px; }
.health-motivo {
  margin: 0; font-size: 15px; color: var(--ink); font-weight: 500;
}
.health-consecuencia {
  margin: 0; font-size: 13px; color: var(--ink-muted);
}

.health--verde { border-left: 3px solid var(--ok); }
.health--ambar { border-left: 3px solid var(--warn); }
.health--rojo  { border-left: 3px solid var(--bad); }

.badge {
  display: inline-flex; align-items: center;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.02em;
  background: var(--surface-sunk); color: var(--ink-2);
}
.badge--verde { background: var(--ok-soft);   color: var(--ok); }
.badge--ambar { background: var(--warn-soft); color: var(--warn); }
.badge--rojo  { background: var(--bad-soft);  color: var(--bad); }

/* ── Insignia de origen por fuente (chips multi-fuente) ───────────
 * Texto del color de la fuente sobre fondo tenue del mismo color.
 * Mismos --src-* en claro y navy → identidad consistente en ambos temas. */
.src-chip {
  display: inline-block;
  padding: 1px 8px;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.55;
  border-radius: var(--r-pill);
  white-space: nowrap;
  vertical-align: middle;
}
.src-chip--comprasmx { color: var(--src-comprasmx); background: color-mix(in srgb, var(--src-comprasmx) 15%, transparent); }
.src-chip--cdmx      { color: var(--src-cdmx);      background: color-mix(in srgb, var(--src-cdmx) 15%, transparent); }
.src-chip--tfja      { color: var(--src-tfja);      background: color-mix(in srgb, var(--src-tfja) 16%, transparent); }
.src-chip--dof       { color: var(--src-dof);       background: color-mix(in srgb, var(--src-dof) 18%, transparent); }
.src-chip--oaj       { color: var(--src-oaj);       background: color-mix(in srgb, var(--src-oaj) 16%, transparent); }
.src-chip--otra      { color: var(--ink-muted);     background: var(--surface-sunk); }

/* KPIs */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}
.kpi {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface-alt);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-md);
  padding: 16px 18px;
}
.kpi-label {
  font-size: 12px; font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-muted);
  text-transform: none;
}
.kpi-value {
  font-size: 28px; font-weight: 600;
  color: var(--ink); letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.kpi-sub { font-size: 12px; color: var(--ink-faint); }

/* Tendencia 401 */
.trend { margin-top: 24px; }
.trend-bars {
  display: flex; align-items: flex-end; gap: 6px;
  height: 64px; padding: 8px;
  background: var(--surface-alt);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-md);
}
.trend-bar {
  flex: 1; min-height: 14px;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 4px;
  font-size: 11px; font-weight: 500;
  color: #fff;
  border-radius: 4px;
  transition: transform 0.15s ease;
}
.trend-bar:hover { transform: translateY(-2px); }
.bar--ok   { background: var(--ok); }
.bar--warn { background: var(--warn); }
.bar--bad  { background: var(--bad); }
.hint { margin: 10px 2px 0; font-size: 12px; color: var(--ink-muted); }

/* ── Paneles + tablas ────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 24px 28px 26px;
  box-shadow: var(--shadow-md);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .panel { background: var(--surface-solid); }
}
.panel-h {
  display: flex; align-items: baseline; justify-content: space-between;
  padding-bottom: 14px; margin-bottom: 14px;
  border-bottom: 1px solid var(--hairline-2);
}
.more {
  font-size: 13px; font-weight: 500;
}
.counter {
  font-size: 12px; color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td {
  text-align: left; padding: 12px 10px;
  border-bottom: 1px solid var(--hairline-2);
  vertical-align: top;
}
table.data th {
  font-weight: 500; color: var(--ink-muted);
  font-size: 12px; letter-spacing: 0.02em;
  text-transform: none;
  padding-top: 6px; padding-bottom: 10px;
  border-bottom: 1px solid var(--hairline);
}
table.data tbody tr {
  transition: background 0.12s ease;
}
table.data tbody tr:hover { background: var(--surface-alt); }
table.data td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
}
table.data td.nota {
  color: var(--ink-muted); font-size: 13px; max-width: 320px;
}
.row--bad td { background: var(--bad-soft); }
.empty {
  text-align: center; color: var(--ink-muted);
  padding: 32px 12px; font-size: 14px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo,
               Consolas, monospace;
  font-size: 13px;
  color: var(--ink-2);
}

/* Pills (estado, canal) */
.pill {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.02em;
  background: var(--surface-sunk); color: var(--ink-2);
}
.pill--ok    { background: var(--ok-soft);   color: var(--ok); }
.pill--error { background: var(--bad-soft);  color: var(--bad); }
.pill--canal { background: var(--accent-soft); color: var(--accent); }
.pill--accent {
  background: var(--warn-soft); color: var(--warn);
  font-weight: 600;
}
.row--pendiente td:first-child {
  border-left: 3px solid var(--warn);
  padding-left: 7px;
}

/* ── M-Excel UI: badges de estatus + urgencia ───────────────────── */

.badge-estatus {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  white-space: nowrap;
  background: var(--surface-sunk); color: var(--ink-2);
  border: 1px solid var(--hairline-2);
}
.badge--vigente {
  background: var(--ok-soft); color: var(--ok);
  border-color: transparent;
}
.badge--seguimiento {
  background: var(--warn-soft); color: var(--warn);
  border-color: transparent;
}
.badge--concluido {
  background: var(--surface-sunk); color: var(--ink-muted);
  font-weight: 400;
  border-color: var(--hairline-2);
}

/* Filas atenuadas para procs concluidos: opacidad y nombre en tono apagado.
   Sin tinte de color para no competir con el dorado y el verde. */
.row--concluido { opacity: 0.65; }
.row--concluido td { color: var(--ink-muted); }
.row--concluido .mono { color: var(--ink-faint); }

/* Urgencia: borde izquierdo en filas con apertura inminente (≤ 3 días). */
.row--urgente td:first-child {
  border-left: 3px solid var(--bad);
  padding-left: 7px;
}

.urgencia-inminente { color: var(--bad); font-weight: 600; }
.urgencia-proximo { color: var(--warn); font-weight: 500; }

/* Sub-línea bajo nombre/dependencia/etc. — gris pequeño */
.cell-sub {
  font-size: 12px; color: var(--ink-muted); margin-top: 2px;
}
.cell-sub-inline {
  font-size: 12px; color: var(--ink-muted);
  display: block; margin-bottom: 2px;
}

/* ── Chips de filtro por grupo de estatus ────────────────────────── */

.estatus-chips {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 14px;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: var(--surface-solid);
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.chip:hover {
  border-color: var(--accent-soft);
  background: var(--accent-soft);
  color: var(--accent);
}
.chip.is-active {
  background: var(--accent); color: #fff;
  border-color: var(--accent);
}
.chip-n {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  opacity: 0.85;
}
.chip--vigente.is-active { background: var(--ok); border-color: var(--ok); }
.chip--seguimiento.is-active { background: var(--warn); border-color: var(--warn); }
.chip--concluido.is-active { background: var(--ink-muted); border-color: var(--ink-muted); }
.chip--sin-dato {
  color: var(--ink-faint);
  background: var(--surface-sunk);
  cursor: default;
}
.chip--sin-dato:hover { background: var(--surface-sunk); color: var(--ink-faint); }

.link-out {
  font-size: 12px;
  color: var(--accent);
}
.link-out:hover { color: var(--accent-hover); }

/* ── Búsqueda / barra de filtros ──────────────────────────────────── */
.searchbar,
.filterbar {
  display: flex; gap: 8px; align-items: center; margin-bottom: 16px;
  flex-wrap: wrap;
}
.searchbar input[type="text"],
.filterbar input[type="text"] {
  flex: 1; min-width: 220px;
  padding: 10px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  font: inherit;
  background: var(--surface-sunk);
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease,
              box-shadow 0.15s ease;
}
.searchbar input[type="text"]::placeholder,
.filterbar input[type="text"]::placeholder { color: var(--ink-faint); }
.searchbar input[type="text"]:focus,
.filterbar input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-solid);   /* opaco: evita doble transparencia */
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.searchbar button,
.filterbar button {
  padding: 10px 18px;
  background: var(--accent); color: #fff;
  border: none; border-radius: var(--r-pill);
  font: inherit; font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
}
.searchbar button:hover,
.filterbar button:hover { background: var(--accent-hover); }
.searchbar button:active,
.filterbar button:active { transform: scale(0.98); }
.searchbar .clear,
.filterbar .clear {
  font-size: 13px; color: var(--ink-muted);
}
.searchbar .clear:hover,
.filterbar .clear:hover { color: var(--ink); }

/* Selects estilo macOS (capsular, sutil) */
.filterbar .select-md {
  padding: 9px 30px 9px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: var(--surface-sunk);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>');
  background-repeat: no-repeat;
  background-position: right 10px center;
  max-width: 280px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.filterbar .select-md:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* Header de panel con acciones a la derecha */
.panel-h-right {
  display: flex; align-items: center; gap: 12px;
}
.counter-filtrado { color: var(--ink-faint); font-weight: 400; }

/* Botón de exportar CSV */
.btn-export {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: var(--surface-solid);
  color: var(--ink-2);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.btn-export:hover {
  color: var(--accent);
  border-color: var(--accent-soft);
  background: var(--accent-soft);
}

/* Encabezados de columna ordenables */
.data--sortable th.sortable a {
  color: inherit;
  display: inline-flex; align-items: center; gap: 4px;
  border: none;
}
.data--sortable th.sortable a:hover { color: var(--ink); }
.data--sortable th.sortable.is-active a { color: var(--ink); font-weight: 600; }
.data--sortable .sort-arrow {
  display: inline-block; font-size: 11px; color: var(--accent);
  min-width: 8px;
}

/* Paginación */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; margin-top: 22px;
  font-size: 13px;
}
.pagination a {
  padding: 6px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: var(--surface-solid);
  color: var(--ink-2);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.pagination a:hover {
  color: var(--accent);
  border-color: var(--accent-soft);
  background: var(--accent-soft);
}
.pagination .disabled {
  padding: 6px 12px;
  color: var(--ink-faint);
}
.pagination .page-info {
  padding: 6px 12px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* KPIs con tinte dorado para los "de hoy" */
.kpi--accent {
  border-color: var(--accent-soft);
  background: linear-gradient(180deg, var(--accent-soft), transparent 80%), var(--surface-alt);
}
.kpi--accent .kpi-value { color: var(--accent); }

/* ── Gráficas ─────────────────────────────────────────────────────── */
.charts { display: flex; flex-direction: column; gap: 24px; }
.chart-panel { padding: 22px 24px 24px; }
.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

/* Bar chart de volumen diario */
.chart { width: 100%; height: auto; display: block; }
.chart-label-x { fill: var(--ink-faint); font-size: 10px; }
.chart-label-val { fill: var(--ink-muted); font-size: 10px; font-weight: 500; }

/* Lista de barras horizontales (top dependencias) */
.hbar-list { display: flex; flex-direction: column; gap: 8px; }
.hbar {
  display: grid;
  grid-template-columns: 130px 1fr 50px;
  align-items: center; gap: 12px;
  padding: 4px 6px;
  border-radius: var(--r-sm);
  border: none; color: var(--ink-2);
  transition: background 0.12s ease, color 0.12s ease;
}
.hbar:hover {
  background: var(--accent-soft);
  color: var(--ink);
}
.hbar-name {
  font-size: 13px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hbar-track {
  position: relative; height: 8px;
  background: var(--surface-sunk);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.hbar-fill {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
  border-radius: var(--r-pill);
  transition: width 0.3s ease;
}
.hbar-val {
  font-size: 13px; font-variant-numeric: tabular-nums;
  text-align: right; color: var(--ink-muted);
}

/* Stacked bar + leyenda */
.stack-bar {
  display: flex; height: 14px;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: var(--surface-sunk);
  margin-bottom: 16px;
}
.stack-seg {
  height: 100%; transition: opacity 0.15s ease;
}
.stack-seg:hover { opacity: 0.85; }
/* Esquema cálido: dorado → bronce → terracota (neutral, sin azules) */
.stack-seg--1, .swatch--1 { background: var(--accent); }
.stack-seg--2, .swatch--2 { background: #C97A4A; }
.stack-seg--3, .swatch--3 { background: #7A6B52; }
.stack-seg--4, .swatch--4 { background: #B8933F; opacity: 0.6; }

.stack-legend {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.stack-legend li {
  display: grid; grid-template-columns: 12px 1fr auto;
  align-items: center; gap: 10px;
  font-size: 13px;
}
.legend-swatch {
  width: 10px; height: 10px; border-radius: 3px;
}
.legend-text a { color: var(--ink-2); border: none; }
.legend-text a:hover { color: var(--accent); }
.legend-val {
  font-variant-numeric: tabular-nums;
  color: var(--ink-muted); font-size: 12px;
}

/* ── Selector de tema (segmented control estilo macOS) ────────────── */
.theme-switch {
  display: inline-flex; align-items: center;
  gap: 2px; padding: 3px;
  background: var(--surface-sunk);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-pill);
}
.theme-opt {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 26px;
  background: transparent;
  color: var(--ink-muted);
  border: none; border-radius: var(--r-pill);
  cursor: pointer;
  font: inherit;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
}
.theme-opt:hover { color: var(--ink); }
.theme-opt:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.theme-opt.is-active {
  background: var(--surface-solid);   /* opaco: el segmento elevado debe leerse claro */
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.theme-opt svg { display: block; }
.theme-auto-label {
  font-size: 12px; font-weight: 600;
  letter-spacing: 0;
}

/* ── Login (Fase B M1) ────────────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--canvas);
  background-attachment: fixed;
}
.login-card {
  width: min(420px, 92vw);
  background: var(--surface);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 36px 40px;
  box-shadow: var(--shadow-lg);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .login-card { background: var(--surface-solid); }
}
.login-brand {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--hairline-2);
}
.login-brand h1 {
  margin: 0;
  font-size: 22px; font-weight: 600; color: var(--ink);
  letter-spacing: -0.02em;
}
.login-brand p {
  margin: 2px 0 0; color: var(--ink-muted); font-size: 13px;
}
.login-form {
  display: flex; flex-direction: column; gap: 16px;
}
.login-form label {
  display: flex; flex-direction: column; gap: 6px;
}
.login-form label span {
  font-size: 12px; font-weight: 500;
  color: var(--ink-muted); letter-spacing: 0.02em;
}
.login-form input {
  padding: 11px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface-sunk);
  color: var(--ink);
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.login-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-solid);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.login-form button {
  margin-top: 4px;
  padding: 12px 18px;
  border: none; border-radius: var(--r-pill);
  background: var(--accent-grad); color: #fff;
  font: inherit; font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.login-form button:hover { filter: brightness(1.05); }
.login-form button:active { transform: scale(0.98); }
.login-error {
  margin: 0 0 18px;
  padding: 10px 14px;
  background: var(--bad-soft); color: var(--bad);
  border-radius: var(--r-md);
  font-size: 13px;
}
.login-foot {
  margin-top: 24px; padding-top: 18px;
  border-top: 1px solid var(--hairline-2);
  font-size: 12px; color: var(--ink-muted);
  text-align: center;
}

/* ── Topbar M1: acciones a la derecha ────────────────────────────── */
.topbar-actions {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

/* User chip + logout */
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 8px 5px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-pill);
  background: var(--surface-solid);
  font-size: 13px;
}
.user-email {
  color: var(--ink-2);
  max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-logout {
  color: var(--ink-muted);
  border: none;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--surface-sunk);
  font-size: 12px;
  transition: color 0.15s ease, background 0.15s ease;
}
.user-logout:hover {
  color: var(--bad);
  background: var(--bad-soft);
}

/* Impersonation dropdown (admin) */
.impersonate {
  position: relative;
}
.impersonate summary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft);
  border-radius: var(--r-pill);
  color: var(--accent);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  list-style: none;
  transition: filter 0.15s ease;
}
.impersonate summary::-webkit-details-marker { display: none; }
.impersonate summary::after {
  content: "▾";
  margin-left: 4px;
  font-size: 10px;
}
.impersonate summary:hover { filter: brightness(0.95); }
.impersonate[open] summary { background: var(--accent); color: #fff; }
.impersonate ul {
  position: absolute; top: calc(100% + 6px); right: 0;
  margin: 0; padding: 6px;
  list-style: none;
  min-width: 240px;
  background: var(--surface-solid);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  z-index: 50;
}
.impersonate ul a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 13px;
  border: none;
}
.impersonate ul a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.impersonate-slug { color: var(--ink-faint); font-size: 11px; }

/* ── Forms M2 (búsquedas + preferencias) ─────────────────────────── */
.form-panel { max-width: 720px; }
.form-stack {
  display: flex; flex-direction: column; gap: 18px;
}
.form-field {
  display: flex; flex-direction: column; gap: 6px;
}
.form-field > span {
  font-size: 13px; font-weight: 500; color: var(--ink-2);
  letter-spacing: 0.01em;
}
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="date"],
.form-field textarea,
.form-field select {
  padding: 10px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--surface-sunk);
  color: var(--ink);
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  resize: vertical;
}
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-solid);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.form-field.has-error input,
.form-field.has-error textarea,
.form-field.has-error select {
  border-color: var(--bad);
}
.field-hint {
  font-size: 12px; color: var(--ink-muted); font-style: normal;
}
.field-error {
  font-size: 12px; color: var(--bad); font-style: normal;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

.checkbox-line, .radio-line {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--ink-2);
  cursor: pointer;
}
.checkbox-line input, .radio-line input {
  width: 16px; height: 16px;
  accent-color: var(--accent);
}

.radio-group {
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 14px 16px;
  background: var(--surface-alt);
  display: flex; flex-direction: column; gap: 8px;
}
.radio-group legend {
  font-size: 13px; font-weight: 500; color: var(--ink-2);
  padding: 0 6px;
}

.form-actions {
  display: flex; align-items: center; gap: 14px;
  padding-top: 4px;
}
.btn-primary {
  padding: 11px 22px;
  background: var(--accent-grad); color: #fff;
  border: none; border-radius: var(--r-pill);
  font: inherit; font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.05s ease;
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:active { transform: scale(0.98); }

/* Tabla con acciones inline */
.row--inactive {
  background: var(--surface-alt);
  color: var(--ink-muted);
}
.row--inactive strong { color: var(--ink-2); }
.empty-cell { color: var(--ink-faint); font-style: italic; font-size: 12px; }
.hint-cell { font-size: 12px; color: var(--ink-muted); }
.actions {
  display: flex; align-items: center; gap: 12px;
  white-space: nowrap;
}
.inline-form {
  display: inline; margin: 0; padding: 0;
}
.inline-form button {
  background: none; border: none; padding: 0;
  color: var(--ink-muted); font: inherit; font-size: 12px;
  cursor: pointer;
}
.link-danger:hover { color: var(--bad) !important; }

/* ── Footer ───────────────────────────────────────────────────────── */
.footer {
  padding: 28px 0 48px;
  color: var(--ink-faint);
  font-size: 12px;
  text-align: center;
  letter-spacing: 0;
}

/* ═══════════════════════════════════════════════════════════════════
 * TEMA CLARO "CREMA LANDING" — estética de la landing en versión crema.
 * Todo aislado por variables --lz-* definidas SOLO en contextos claros;
 * en navy quedan sin definir y cada regla cae a su fallback inerte, así
 * que el tema oscuro NO cambia. No se toca ningún bloque [data-theme="dark"].
 * El chip "Vigilando" se muestra SOLO en claro (display via --lz-chip-display);
 * el anillo de salud va en ambos temas (señal funcional, color de estado).
 * ═══════════════════════════════════════════════════════════════════ */

:root[data-theme="light"] {
  --blue:       #2f6df0;
  --gold-deep:  #9a7a2c;
  --canvas:
    radial-gradient(ellipse 90% 60% at 15% -10%, rgba(184, 147, 63, 0.10), transparent 55%),
    linear-gradient(180deg, #FCFAF4 0%, #F0EADD 100%);
  --lz-grid:
    repeating-linear-gradient(0deg,  rgba(184,147,63,0.055) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(90deg, rgba(184,147,63,0.055) 0 1px, transparent 1px 32px);
  --lz-grid-mask:   radial-gradient(ellipse 100% 72% at 50% 0%, #000 0%, transparent 78%);
  --lz-card-radius:    20px;
  --lz-card-radius-sm: 16px;
  --lz-card-border:    rgba(184, 147, 63, 0.26);
  --lz-shadow-rest:  0 1px 2px rgba(40, 30, 12, 0.05), 0 10px 28px -10px rgba(40, 30, 12, 0.16);
  --lz-shadow-hover: 0 6px 14px rgba(40, 30, 12, 0.07), 0 18px 40px -12px rgba(184, 147, 63, 0.34);
  --lz-hover-lift:   translateY(-3px);
  --lz-nav-pill:        var(--accent-soft);
  --lz-nav-active-border: transparent;
  --lz-nav-pill-radius:   var(--r-pill);
  --lz-num-gold:     var(--gold-deep);
  --lz-chip-display: inline-flex;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --blue:       #2f6df0;
    --gold-deep:  #9a7a2c;
    --canvas:
      radial-gradient(ellipse 90% 60% at 15% -10%, rgba(184, 147, 63, 0.10), transparent 55%),
      linear-gradient(180deg, #FCFAF4 0%, #F0EADD 100%);
    --lz-grid:
      repeating-linear-gradient(0deg,  rgba(184,147,63,0.055) 0 1px, transparent 1px 32px),
      repeating-linear-gradient(90deg, rgba(184,147,63,0.055) 0 1px, transparent 1px 32px);
    --lz-grid-mask:   radial-gradient(ellipse 100% 72% at 50% 0%, #000 0%, transparent 78%);
    --lz-card-radius:    20px;
    --lz-card-radius-sm: 16px;
    --lz-card-border:    rgba(184, 147, 63, 0.26);
    --lz-shadow-rest:  0 1px 2px rgba(40, 30, 12, 0.05), 0 10px 28px -10px rgba(40, 30, 12, 0.16);
    --lz-shadow-hover: 0 6px 14px rgba(40, 30, 12, 0.07), 0 18px 40px -12px rgba(184, 147, 63, 0.34);
    --lz-hover-lift:   translateY(-3px);
    --lz-nav-pill:        var(--accent-soft);
    --lz-nav-active-border: transparent;
    --lz-nav-pill-radius:   var(--r-pill);
    --lz-num-gold:     var(--gold-deep);
    --lz-chip-display: inline-flex;
  }
}

/* Cuadrícula cálida de fondo, desvanecida hacia abajo por máscara radial */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--lz-grid, none);
  -webkit-mask-image: var(--lz-grid-mask, none);
          mask-image: var(--lz-grid-mask, none);
}

/* Tarjetas: esquinas muy redondeadas + sombra de 2 capas (reposo) */
.panel, .health {
  border-radius: var(--lz-card-radius, var(--r-lg));
  box-shadow: var(--lz-shadow-rest, var(--shadow-md));
}
.kpi, .trend-bars {
  border-radius: var(--lz-card-radius-sm, var(--r-md));
  box-shadow: var(--lz-shadow-rest, none);
}

/* KPIs: elevación sutil al hover (translateY -3px + sombra dorada) */
.kpi {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.kpi:hover {
  transform: var(--lz-hover-lift, none);
  box-shadow: var(--lz-shadow-hover, none);
  border-color: var(--lz-card-border, var(--hairline-2));
}

/* Números importantes en dorado profundo (solo claro; navy = su acento) */
.kpi--accent .kpi-value { color: var(--lz-num-gold, var(--accent)); }

/* Menú activo: píldora dorada en claro; en navy conserva su subrayado */
.main-nav a.active {
  background: var(--lz-nav-pill, transparent);
  border-bottom-color: var(--lz-nav-active-border, var(--accent));
  border-radius: var(--lz-nav-pill-radius, var(--r-sm) var(--r-sm) 0 0);
}

/* Chip "Vigilando" (solo claro): punto verde + texto */
.status-chip {
  display: var(--lz-chip-display, none);
  align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: var(--r-pill);
  background: var(--ok-soft); color: var(--ok);
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent);
  white-space: nowrap;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok);
  animation: lz-pulse 2.2s ease-out infinite;
}
@keyframes lz-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); }
  70%  { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* Anillo de salud (ambos temas; color = estado verde/ámbar/rojo) */
.health-ring {
  flex: none; width: 20px; height: 20px; border-radius: 50%;
  border: 3px solid currentColor;
  align-self: center;
}
.health-ring--verde { color: var(--ok);   box-shadow: 0 0 0 4px var(--ok-soft); }
.health-ring--ambar { color: var(--warn);  box-shadow: 0 0 0 4px var(--warn-soft); }
.health-ring--rojo  { color: var(--bad);   box-shadow: 0 0 0 4px var(--bad-soft); }

/* Accesibilidad: sin movimiento si el usuario lo pide */
@media (prefers-reduced-motion: reduce) {
  .kpi { transition: none; }
  .kpi:hover { transform: none; }
  .status-dot { animation: none; }
}

/* ═══════════════════════════════════════════════════════════════════
 * FASE 1 — RESKIN STRIPE/VERCEL (tokens + tipografía).
 * Capa de override al final (gana por orden/especificidad). Reemplaza el
 * tema crema-landing/navy por la paleta del handoff (recreada en CSS, NO
 * se copia el .dc.html). Respeta prefers-reduced-motion (heredado).
 * Paletas exactas del README: claro #f6f6f7 / oscuro #0a0a0a, acento oro.
 * ═══════════════════════════════════════════════════════════════════ */

/* —— Tokens CLARO (base + forzado + auto-claro) —— */
:root, :root[data-theme="light"] {
  --canvas: #f6f6f7;
  --surface: #ffffff; --surface-solid: #ffffff; --surface-alt: #fafafa; --surface-sunk: #fafafa;
  --ink: #0a0a0b; --ink-2: #52525b; --ink-muted: #71717a; --ink-faint: #9b9ba4;
  --hairline: #ececee; --hairline-2: #f3f3f4; --border-2: #e0e0e3;
  --accent: #a06f08; --accent-hover: #845b06; --accent-soft: #fbf2da;
  --accent-bg: #e8a30c; --accent-ink: #2a1d04;
  --accent-grad: linear-gradient(150deg, #f0b429, #b8800f);
  --ok: #15803d; --ok-soft: #e7f5ec; --warn: #b45309; --warn-soft: #fbeedb;
  --bad: #b42318; --bad-soft: #fbeae9; --blue: #3a5bd9; --blue-soft: #eaeefc; --track: #eeeef0;
  --lz-grid: none; --lz-grid-mask: none;  /* crema-landing retirada: sin cuadrícula */
  --shadow-sm: 0 1px 2px rgba(10,10,11,.06);
  --shadow-md: 0 16px 40px -28px rgba(10,10,11,.22);
  --shadow-lg: 0 24px 56px -26px rgba(10,10,11,.30);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --canvas: #f6f6f7;
    --surface: #ffffff; --surface-solid: #ffffff; --surface-alt: #fafafa; --surface-sunk: #fafafa;
    --ink: #0a0a0b; --ink-2: #52525b; --ink-muted: #71717a; --ink-faint: #9b9ba4;
    --hairline: #ececee; --hairline-2: #f3f3f4; --border-2: #e0e0e3;
    --accent: #a06f08; --accent-hover: #845b06; --accent-soft: #fbf2da;
    --accent-bg: #e8a30c; --accent-ink: #2a1d04;
    --ok: #15803d; --ok-soft: #e7f5ec; --warn: #b45309; --warn-soft: #fbeedb;
    --bad: #b42318; --bad-soft: #fbeae9; --blue: #3a5bd9; --blue-soft: #eaeefc; --track: #eeeef0;
    --lz-grid: none; --lz-grid-mask: none;  /* crema-landing retirada: sin cuadrícula */
  }
}

/* —— Tokens OSCURO (forzado + auto-oscuro) —— */
:root[data-theme="dark"] {
  --canvas: #0a0a0a;
  --surface: #141414; --surface-solid: #141414; --surface-alt: #1c1c1c; --surface-sunk: #161616;
  --ink: #fafafa; --ink-2: #a1a1aa; --ink-muted: #a1a1aa; --ink-faint: #71717a;
  --hairline: #262626; --hairline-2: #1f1f1f; --border-2: #34343b;
  --accent: #f5c451; --accent-hover: #ffd56b; --accent-soft: rgba(232,163,12,.15);
  --accent-bg: #e8a30c; --accent-ink: #2a1d04;
  --accent-grad: linear-gradient(150deg, #f0b429, #b8800f);
  --ok: #34d399; --ok-soft: rgba(52,211,153,.14); --warn: #fbbf24; --warn-soft: rgba(251,191,36,.14);
  --bad: #ff6a7e; --bad-soft: rgba(255,106,126,.16); --blue: #7d9bff; --blue-soft: rgba(125,155,255,.15);
  --track: #262626;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.5);
  --shadow-md: 0 18px 44px -28px rgba(0,0,0,.8);
  --shadow-lg: 0 28px 60px -26px rgba(0,0,0,.85);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --canvas: #0a0a0a;
    --surface: #141414; --surface-solid: #141414; --surface-alt: #1c1c1c; --surface-sunk: #161616;
    --ink: #fafafa; --ink-2: #a1a1aa; --ink-muted: #a1a1aa; --ink-faint: #71717a;
    --hairline: #262626; --hairline-2: #1f1f1f; --border-2: #34343b;
    --accent: #f5c451; --accent-hover: #ffd56b; --accent-soft: rgba(232,163,12,.15);
    --accent-bg: #e8a30c; --accent-ink: #2a1d04;
    --ok: #34d399; --ok-soft: rgba(52,211,153,.14); --warn: #fbbf24; --warn-soft: rgba(251,191,36,.14);
    --bad: #ff6a7e; --bad-soft: rgba(255,106,126,.16); --blue: #7d9bff; --blue-soft: rgba(125,155,255,.15);
    --track: #262626; --shadow-md: 0 18px 44px -28px rgba(0,0,0,.8); --shadow-lg: 0 28px 60px -26px rgba(0,0,0,.85);
  }
}

/* —— Tipografía Bricolage (display/números) / Hanken (cuerpo) —— */
body { font-family: 'Hanken Grotesk', system-ui, -apple-system, sans-serif; background: var(--canvas); }
h1, h2, h3, .brand-text h1, .kpi-value, .seal, .health-motivo, .counter { font-family: 'Bricolage Grotesque', system-ui, sans-serif; letter-spacing: -0.015em; }
.kpi-value, .mono, table.data td.mono, .counter { font-variant-numeric: tabular-nums; }

/* —— Ajustes de componentes para la nueva semántica de tokens —— */
/* botones gold: relleno --accent-bg + texto --accent-ink (legible en claro Y oscuro;
   antes usaban --accent como fondo → ilegible con el oro nuevo) */
.searchbar button, .filterbar button, .login-form button, .impersonate[open] summary {
  background: var(--accent-bg); color: var(--accent-ink);
}
.searchbar button:hover, .filterbar button:hover { background: var(--accent); color: var(--accent-ink); }
/* retirar crema-landing al-source: el pseudo del grid NO se genera (content:none, más fuerte
   que display:none) + variable anulada en los bloques claros; pestaña activa = subrayado oro */
body::before { content: none; display: none; background: none; }
.main-nav a.active { background: transparent; border-bottom-color: var(--accent); border-radius: var(--r-sm) var(--r-sm) 0 0; }
/* chip "Vigilando": visible en AMBOS temas (el handoff lo muestra también en oscuro) */
.status-chip { display: inline-flex; background: var(--ok-soft); color: var(--ok); }
/* tarjetas: radio + sombra del handoff en ambos temas */
.panel, .health, .kpi { border-radius: 16px; box-shadow: var(--shadow-md); }

/* —— Pulido de tipografía (estilo prototipo): negritas en títulos de sección y franja de salud —— */
.panel-h h2 { font-weight: 700; }
.health-motivo { font-weight: 700; }

/* ════════════════════════════════════════════════════════════════════
   AJUSTES ESTÉTICOS GLOBALES (acercar a prototipo) — base, todas las pestañas
   ════════════════════════════════════════════════════════════════════ */

/* #1 Encabezados de tabla: MAYÚSCULAS + negrita */
table.data thead th { text-transform: uppercase; font-weight: 700; letter-spacing: .05em; font-size: 11.5px; }

/* #2 Títulos de sección: sentence-case con NEGRITA Bricolage (como el prototipo;
   NO mayúsculas — solo los encabezados de tabla #1 van en mayúsculas) */
.panel-h h2 { font-weight: 700; letter-spacing: -.01em; }

/* #3 Escala tipográfica más grande (cuerpo, celdas, chips, ayuda) — como el handoff */
body { font-size: 17px; }
table.data td { font-size: 14.5px; }
.pill, .badge, .src-chip { font-size: 13px; }
.hint, .field-hint { font-size: 14px; }

/* #4 Botones de acción en ORO SÓLIDO (relleno + texto oscuro legible) */
.btn-primary { background: var(--accent-bg); color: var(--accent-ink); }
.btn-primary:hover { filter: none; background: var(--accent); }
.btn-export--oro { background: var(--accent-bg); color: var(--accent-ink); border-color: transparent; }
.btn-export--oro:hover { background: var(--accent); color: var(--accent-ink); }
/* "Ficha ↗" = enlaces externos (no 'editar'/'borrar', que comparten .link-out sin target) */
.link-out[target="_blank"] {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 8px; white-space: nowrap;  /* rectangular, en una línea (no círculo) */
  background: var(--accent-bg); color: var(--accent-ink); font-weight: 600;
}
.link-out[target="_blank"]:hover { background: var(--accent); color: var(--accent-ink); }

/* #5 Franja de salud: círculo RELLENO + glow; chip de nivel ('SANO') en mayúsculas */
.health-ring { background: currentColor; }
.health-ring--verde { box-shadow: 0 0 0 4px var(--ok-soft), 0 0 14px 2px var(--ok-soft); }
.badge { text-transform: uppercase; letter-spacing: .05em; }

/* #6 Punto de frescura en 'Detectada' (coincidencias recientes) */
.fresh-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; }
.fresh-dot--verde { background: var(--ok); }
.fresh-dot--ambar { background: var(--warn); }
.fresh-dot--gris  { background: var(--ink-faint); }

/* ── Responsive móvil (≤640px): que nada desborde a lo ancho ───────────────── */
@media (max-width: 640px) {
  /* Barra superior: la marca en su línea; las acciones bajan debajo (no se corta el nombre) */
  .topbar-row { flex-wrap: wrap; gap: 10px; }
  .topbar-actions { width: 100%; justify-content: flex-start; }
  /* Menú: scroll horizontal propio en vez de empujar la página */
  .main-nav { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav a { white-space: nowrap; flex: 0 0 auto; }
  /* Tablas anchas: scroll horizontal interno (no desbordan la pantalla) */
  table.data { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
