/* Vigía — estilos de la web. Tokens = variables «Vigía · Tema» de Figma y ui/theme/Tema.kt de la app Android. */
:root {
  color-scheme: light;
  --fondo: #f7faf9;
  --surface: #ffffff;
  --surface-2: #eef3f2;
  --texto: #18312f;
  --texto-2: #526562;
  --texto-3: #5d6f6c;
  --borde: #d8e2e0;
  --acento: #006b64;
  --acento-fuerte: #00574f;
  --acento-suave: #e6f4f2;
  --sobre-acento: #ffffff;
  --serie-1: #006b64;
  --serie-2: #e09a1a;
  --serie-3: #6d28d9;
  --serie-4: #2a78d6;
  --serie-5: #c2410c;
  --neutro: #b9c6c3;
  --bien: #137a3a;
  --bien-fondo: #e7f6ec;
  --mal: #b42318;
  --mal-fondo: #fdecea;
  --aviso: #8a5a00;
  --aviso-fondo: #fff4d6;
  --critico: #b42318;
  --ia: #6d28d9;
  --ia-fondo: #f1eafe;
  --ambar: #f5b83d;
  --hero-1: #17302d;
  --hero-2: #0f1f1d;
  --sombra: 0 1px 2px rgba(16, 40, 36, .05), 0 4px 16px rgba(16, 40, 36, .06);
  --radio: 16px;
  --radio-s: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --fondo: #0f1413; --surface: #1a2120; --surface-2: #252e2c; --texto: #f1f7f5; --texto-2: #c4d3cf; --texto-3: #a9bab6;
    --borde: #34403d; --acento: #4fd1c5; --acento-fuerte: #8ce8df; --acento-suave: #183b37; --sobre-acento: #00201d;
    --serie-1: #4fd1c5; --serie-2: #f5c451; --serie-3: #c4b5fd; --serie-4: #7ab4ff; --serie-5: #fb923c; --neutro: #56635f;
    --bien: #6ee7a8; --bien-fondo: #173a2a; --mal: #ff8a80; --mal-fondo: #3d1f1d; --aviso: #f5c451; --aviso-fondo: #3a2f12;
    --critico: #93261d; --ia: #c4b5fd; --ia-fondo: #2a2342; --hero-1: #1c2826; --hero-2: #141c1b; --sombra: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --fondo: #0f1413; --surface: #1a2120; --surface-2: #252e2c; --texto: #f1f7f5; --texto-2: #c4d3cf; --texto-3: #a9bab6;
  --borde: #34403d; --acento: #4fd1c5; --acento-fuerte: #8ce8df; --acento-suave: #183b37; --sobre-acento: #00201d;
  --serie-1: #4fd1c5; --serie-2: #f5c451; --serie-3: #c4b5fd; --serie-4: #7ab4ff; --serie-5: #fb923c; --neutro: #56635f;
  --bien: #6ee7a8; --bien-fondo: #173a2a; --mal: #ff8a80; --mal-fondo: #3d1f1d; --aviso: #f5c451; --aviso-fondo: #3a2f12;
  --critico: #93261d; --ia: #c4b5fd; --ia-fondo: #2a2342; --hero-1: #1c2826; --hero-2: #141c1b; --sombra: none;
}

/* Base */
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fondo); color: var(--texto);
  font: 15px/1.5 Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--acento); }
:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--texto-2); }
.bien { color: var(--bien); }
.mal { color: var(--mal); }
svg.ico { width: 18px; height: 18px; flex: none; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.saltar { position: absolute; left: -999px; top: 8px; z-index: 2000; background: var(--acento); color: var(--sobre-acento); padding: 8px 12px; border-radius: 8px; }
.saltar:focus { left: 8px; }

/* Estructura */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.menu {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px;
  background: var(--surface); border-right: 1px solid var(--borde); padding: 18px 14px;
}
.menu-marca { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.logo { width: 38px; height: 38px; border-radius: 11px; background: #006b64; display: grid; place-items: center; flex: none; }
.logo svg { width: 30px; height: 30px; }
.menu-nombre { font-weight: 800; font-size: 17px; line-height: 1.15; letter-spacing: -.2px; }
.menu-nombre small { display: block; font-weight: 500; color: var(--texto-3); font-size: 12px; letter-spacing: 0; }
.menu-nav { display: grid; gap: 4px; }
.menu-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radio-s);
  color: var(--texto-2); text-decoration: none; font-weight: 600;
}
.menu-nav a:hover { background: var(--surface-2); color: var(--texto); }
.menu-nav a.activo { background: var(--acento-suave); color: var(--acento); }
.menu-pie { margin-top: auto; font-size: 12px; color: var(--texto-3); background: var(--surface-2); border-radius: var(--radio-s); padding: 12px; display: grid; gap: 6px; }
.menu-pie p { margin: 0; }
.estado-datos { font-weight: 600; color: var(--texto-2); }
.estado-datos:empty { display: none; }

.contenido { min-width: 0; width: 100%; padding: 0 28px 28px; max-width: 1480px; margin-inline: auto; }
.barra { position: sticky; top: 0; z-index: 500; display: flex; align-items: center; gap: 12px; padding: 14px 0; background: var(--fondo); }
.marca-movil { display: none; align-items: center; gap: 8px; font-size: 17px; }
.marca-movil .logo { width: 30px; height: 30px; border-radius: 9px; }
.marca-movil .logo svg { width: 24px; height: 24px; }
.buscador { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--borde); border-radius: 12px; cursor: text; }
.buscador:focus-within { border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-suave); }
.buscador input { flex: 1; border: 0; background: transparent; outline: none; min-width: 0; }
.buscador > [data-ico] { color: var(--texto-3); display: inline-flex; }
.barra-der { display: flex; align-items: center; gap: 8px; }
.btn-sec, .btn-ico, .btn-pri {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 42px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--borde); border-radius: 12px;
  color: var(--texto); text-decoration: none; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn-sec:hover, .btn-ico:hover { border-color: var(--acento); color: var(--acento); }
.btn-ico { width: 42px; padding: 0; }
.btn-pri { background: var(--acento); border-color: var(--acento); color: var(--sobre-acento); }
.btn-pri:hover { background: var(--acento-fuerte); }
body.cargando #btnActualizar svg { animation: girar 1s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

.aviso-global { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px; margin-bottom: 4px; font-size: 14px; }
.aviso-global.demo { background: var(--aviso-fondo); color: var(--texto); border: 1px solid color-mix(in srgb, var(--aviso) 30%, transparent); }
.aviso-global.demo svg { color: var(--aviso); }
.aviso-global.atencion { background: var(--mal-fondo); color: var(--texto); }
.aviso-global.atencion svg { color: var(--mal); }
.aviso-global.info { background: var(--acento-suave); }
.aviso-global a { font-weight: 700; }

/* Páginas */
.titulo-pag { margin: 6px 0 2px; }
.titulo-pag h1 { margin: 0; font-size: 28px; letter-spacing: -.4px; }
.titulo-pag p { margin: 2px 0 0; color: var(--texto-2); }
.pagina { display: grid; gap: 16px; }
.rejilla { display: grid; gap: 16px; }
.r-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.r-2-1 { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
.columna { display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); padding: 16px 18px 18px; min-width: 0; }
.card > header { margin-bottom: 12px; }
.cab-fila { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.card h2 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 17px; letter-spacing: -.1px; }
.card h2 [data-ico] { color: var(--acento); display: inline-flex; }
.card header p { margin: 3px 0 0; color: var(--texto-2); font-size: 13.5px; }
.ver-mas { font-weight: 700; font-size: 13.5px; text-decoration: none; white-space: nowrap; }
.nota { margin: 4px 0 0; font-size: 13px; color: var(--texto-3); }
.nota.mal { color: var(--mal); font-weight: 600; }
.pill { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--texto-2); }
.pill.acento { background: var(--acento-suave); color: var(--acento); }
.delta { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--texto-2); white-space: nowrap; }
.delta.bien { background: var(--bien-fondo); color: var(--bien); }
.delta.mal { background: var(--mal-fondo); color: var(--mal); }

/* Aviso crítico */
.critico { display: grid; gap: 12px; padding: 0 0 14px; border-radius: var(--radio); background: var(--surface); color: var(--texto); border: 1px solid color-mix(in srgb, var(--mal) 35%, transparent); border-left: 6px solid var(--mal); overflow: hidden; box-shadow: var(--sombra); }
.critico > .que-pasa, .critico > .mi-plan { margin: 0 14px; }
.critico-cab { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; background: var(--critico); color: #fff; padding: 16px 18px; }
.critico-ico { width: 48px; height: 48px; border-radius: 14px; background: rgba(255, 255, 255, .16); display: grid; place-items: center; }
.critico-ico svg { width: 26px; height: 26px; }
.critico-etq { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
.critico strong { display: block; font-size: 22px; line-height: 1.25; }
.critico p { margin: 2px 0 0; font-size: 14.5px; }
.critico-acc { display: grid; gap: 8px; }
.btn-claro, .btn-borde { display: inline-flex; align-items: center; justify-content: center; height: 42px; padding: 0 16px; border-radius: 12px; font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn-claro { background: #fff; color: #8a1c13; border: 0; }
.btn-borde { background: transparent; color: #fff; border: 1.5px solid rgba(255, 255, 255, .8); }
.btn-borde:hover { background: rgba(255, 255, 255, .12); }
.critico :focus-visible { outline-color: #fff; }
.que-pasa { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; color: var(--texto); }
.qp-col { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.que-pasa h3 { color: var(--texto-2); }
.que-pasa h3 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.que-pasa p, .que-pasa li { font-size: 14px; }
.que-pasa ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.que-pasa a { color: var(--texto); font-weight: 600; }
.que-pasa small { color: var(--texto-3); }
.qp-cifras { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.qp-pie { grid-column: 1 / -1; margin: 0; font-size: 13.5px; color: var(--texto-2); }
.qp-col { border: 1px solid var(--borde); }
.mi-plan { background: var(--surface-2); color: var(--texto); border-radius: 12px; padding: 10px 14px; border-left: 4px solid var(--ambar); }
.mi-plan p { margin: 2px 0 0; font-size: 15px; }
.mi-plan a { color: var(--acento); }
.plan-etq { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--texto-2); }
.plan-etq svg { width: 15px; height: 15px; color: var(--aviso); }

/* Hero de cartera (fondo neutro: el color de la cifra dice si sube o baja) */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; align-items: center; padding: 22px 24px;
  border-radius: 20px; color: #fff; background: linear-gradient(135deg, var(--hero-1), var(--hero-2)); box-shadow: var(--sombra); overflow: hidden;
  border-top: 3px solid var(--acento); }
.hero-etq { font-size: 13.5px; font-weight: 600; color: rgba(255, 255, 255, .85); }
.hero-valor { font-size: 46px; font-weight: 800; letter-spacing: -1px; line-height: 1.1; margin: 4px 0 4px; }
.hero-dato { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: rgba(255, 255, 255, .9); margin-bottom: 12px; }
.hero-dato svg { width: 14px; height: 14px; }
.hero-hoy { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; }
.hero-delta { display: inline-block; font-size: 17px; font-weight: 800; background: #fff; color: var(--texto); border-radius: 999px; padding: 3px 12px; }
.hero-delta.mal { color: #b42318; }
.hero-delta.bien { color: #15803d; }
.hero-ref { font-size: 13.5px; color: rgba(255, 255, 255, .85); margin-top: 8px; }
.hero-der { display: grid; gap: 8px; }
.hero-graf { display: grid; gap: 4px; }
.hero-eje { display: flex; justify-content: space-between; font-size: 12px; color: rgba(255, 255, 255, .8); }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: flex-end; font-size: 12.5px; color: rgba(255, 255, 255, .85); }
.hero-meta:empty { display: none; }
.spark.hero-spark { width: 100%; height: 90px; }
.spark.hero-spark polyline { stroke: #fff; stroke-width: 2.2; }
.spark.hero-spark .spark-area { fill: rgba(255, 255, 255, .1); }
.spark.hero-spark.mal polyline { stroke: #ffb4ab; }
.spark.hero-spark.mal .spark-area { fill: rgba(255, 180, 171, .12); }
.spark.hero-spark.bien polyline { stroke: #86efac; }
.spark.hero-spark.bien .spark-area { fill: rgba(134, 239, 172, .12); }
.spark.hero-spark .spark-ref { stroke: rgba(255, 255, 255, .7); }

/* Recuadros por periodo */
.periodos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.periodo { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 10px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--borde); }
.per-tit { flex-basis: 100%; font-size: 13px; font-weight: 600; color: var(--texto-2); }
.periodo b { font-size: 18px; }
.per-pct { font-size: 13.5px; font-weight: 700; color: var(--texto-3); }
.periodo.bien b, .periodo.bien .per-pct { color: var(--bien); }
.periodo.mal b, .periodo.mal .per-pct { color: var(--mal); }


/* Minigráficas */
.spark { width: 100%; height: 36px; overflow: visible; }
.spark polyline { fill: none; stroke: var(--texto-3); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark.bien polyline { stroke: var(--bien); }
.spark.mal polyline { stroke: var(--mal); }
.spark-ref { stroke: var(--texto-3); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; opacity: .7; }
.spark.vacia { display: block; height: 36px; }

/* Mis acciones */
.acciones { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.accion { display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(80px, .8fr) auto; grid-template-areas: "id spark precio" "falta falta falta" "links links links";
  gap: 8px 16px; align-items: center; padding: 14px; border-radius: 14px; background: var(--surface-2); }
.ac-id { grid-area: id; display: grid; }
.ac-id b { font-size: 17px; }
.ac-id small { color: var(--texto-2); font-size: 12.5px; }
.accion .spark { grid-area: spark; }
.ac-precio { grid-area: precio; display: grid; justify-items: end; gap: 2px; }
.ac-precio b { font-size: 17px; }
.ac-precio small { font-size: 12.5px; font-weight: 600; }
.falta { grid-area: falta; display: grid; gap: 2px; }
.medidor { position: relative; height: 18px; }
.med-pista { position: absolute; left: 0; right: 0; top: 7px; height: 4px; border-radius: 2px; background: var(--borde); }
.medidor .marca { position: absolute; top: 3px; width: 2px; height: 12px; margin-left: -1px; background: var(--texto-3); border-radius: 1px; }
.med-cero { position: absolute; top: 1px; width: 2px; height: 16px; margin-left: -1px; background: var(--texto-2); }
.med-punto { position: absolute; top: 2px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--texto-2); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--texto-3); }
.med-punto.bien { background: var(--bien); }
.med-punto.mal { background: var(--mal); }
.med-escala { position: relative; height: 19px; font-size: 13px; font-weight: 600; color: var(--texto-2); }
.med-escala span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.med-escala span:first-child { transform: none; }
.med-escala span:last-child { transform: translateX(-100%); }
.falta small { font-size: 13.5px; color: var(--texto-2); }
.falta.superado b { color: var(--mal); }
.ac-links { grid-area: links; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--texto-3); }
.ac-links span { margin-right: auto; }
.ac-links a, .enlace { font-weight: 600; text-decoration: none; }
.enlace { background: none; border: 0; padding: 0; color: var(--acento); cursor: pointer; font-size: inherit; }
.enlace:hover, .ac-links a:hover { text-decoration: underline; }

/* Alertas */
.alertas { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alerta-item { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: start; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.alerta-item .ai { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); }
.alerta-item.mal .ai { background: var(--mal-fondo); color: var(--mal); }
.alerta-item.bien .ai { background: var(--bien-fondo); color: var(--bien); }
.alerta-item.critica { background: var(--mal-fondo); }
.alerta-item.critica .ai { background: var(--mal); color: #fff; }
.alerta-item strong { display: block; font-size: 14px; }
.alerta-item small { display: block; font-size: 12.5px; color: var(--texto-2); }
.alerta-item time { font-size: 12px; color: var(--texto-3); white-space: nowrap; }

/* Mercado */
.mercado { list-style: none; margin: 0; padding: 0; display: grid; }
.mercado li { display: grid; grid-template-columns: minmax(80px, 1fr) minmax(50px, 80px) auto; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--borde); }
.mercado li:last-child { border-bottom: 0; }
.mercado small { display: block; font-size: 11.5px; color: var(--texto-3); }
.mercado .spark { height: 26px; }
.mk-val { display: grid; justify-items: end; gap: 2px; }

/* Noticias */
.noticias { list-style: none; margin: 0; padding: 0; display: grid; }
.noticia { display: grid; gap: 6px; padding: 14px 0; border-bottom: 1px solid var(--borde); }
.noticia:first-child { padding-top: 2px; }
.noticia:last-child { border-bottom: 0; padding-bottom: 0; }
.n-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--texto-3); }
.n-motivo { font-weight: 600; color: var(--texto-2); }
.n-tit { font-size: 16px; font-weight: 700; color: var(--texto); text-decoration: none; line-height: 1.35; }
.n-tit:hover { color: var(--acento); text-decoration: underline; }
.n-res { margin: 0; color: var(--texto-2); font-size: 14px; }
.n-acc { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-mini { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 10px; font-size: 13px; font-weight: 700;
  border: 1px solid var(--borde); background: var(--surface); color: var(--acento); text-decoration: none; cursor: pointer; }
.btn-mini svg { width: 15px; height: 15px; }
.btn-mini:hover { border-color: var(--acento); }
.btn-mini.ia { color: var(--ia); background: var(--ia-fondo); border-color: transparent; }
.btn-mini.ia:hover { border-color: var(--ia); }
.vacia { color: var(--texto-2); padding: 12px; border-radius: 12px; background: var(--surface-2); text-align: center; list-style: none; }

/* Pestañas y chips */
.pestanas { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; width: fit-content; max-width: 100%; overflow-x: auto; }
.pestanas button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 600; color: var(--texto-2); cursor: pointer; white-space: nowrap; }
.pestanas button.activo { background: var(--surface); color: var(--acento); box-shadow: var(--sombra); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chip { border: 1px solid var(--acento); background: var(--acento-suave); color: var(--acento); border-radius: 999px; padding: 5px 14px; font-size: 13px; font-weight: 700; cursor: pointer; }
.chip.limpiar { border-color: var(--borde); background: var(--surface); color: var(--texto-2); }

/* Gráficos */
.refs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ref-caja { display: grid; gap: 2px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--borde); border-radius: 14px; justify-items: start; }
.ref-caja span { font-size: 13px; font-weight: 600; color: var(--texto-2); }
.ref-caja b { font-size: 18px; }
.ref-caja small { color: var(--texto-3); font-size: 12px; }
.graf-tv { height: 520px; border-radius: 12px; overflow: hidden; }

/* KPIs */
.kpis { display: grid; gap: 16px; }
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi { display: flex; gap: 12px; align-items: flex-start; }
.kpi-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--acento-suave); color: var(--acento); flex: none; }
.kpi-tit { font-size: 14px; font-weight: 600; color: var(--texto-2); }
.kpi-val { font-size: 28px; font-weight: 800; line-height: 1.2; margin: 2px 0 4px; letter-spacing: -.5px; }
.kpi-ayuda { font-size: 12.5px; color: var(--texto-3); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* Reparto */
.reparto:empty { display: none; }
.reparto { display: grid; gap: 8px; margin-bottom: 14px; }
.reparto-barra { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--surface-2); }
.reparto-barra i { display: block; height: 100%; }
.reparto-ley { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--texto-2); }
.reparto-ley li { display: flex; align-items: center; gap: 6px; }
.punto { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* Tablas */
.tabla-caja { overflow: auto; }
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th, .tabla td { padding: 10px; text-align: left; white-space: nowrap; vertical-align: middle; }
.tabla td:first-child { white-space: normal; min-width: 140px; }
.tabla .num { text-align: right; }
.tabla thead th { position: sticky; top: 0; background: var(--surface); color: var(--texto-3); font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--borde); }
.tabla tbody tr { border-bottom: 1px solid var(--borde); }
.tabla tbody tr:last-child { border-bottom: 0; }
.tabla tbody tr:hover { background: var(--surface-2); }
.tabla small { color: var(--texto-3); }
.inp-corto { width: 120px; height: 36px; border: 1px solid var(--borde); border-radius: 8px; padding: 0 10px; background: var(--surface); }

/* Interruptor */
.interruptor { position: relative; display: inline-block; width: 42px; height: 24px; }
.interruptor input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.interruptor span { position: absolute; inset: 0; border-radius: 999px; background: var(--neutro); transition: background .15s; }
.interruptor span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.interruptor input:checked + span { background: var(--acento); }
.interruptor input:checked + span::after { transform: translateX(18px); }
.interruptor input:focus-visible + span { outline: 3px solid var(--acento); outline-offset: 2px; }

/* Formularios */
.formulario { display: grid; gap: 12px; }
.formulario label { display: grid; gap: 4px; font-size: 13.5px; font-weight: 600; color: var(--texto-2); }
.formulario input:not([type="checkbox"]), .formulario select, .plan {
  height: 42px; border: 1px solid var(--borde); border-radius: 10px; padding: 0 12px; background: var(--surface); color: var(--texto); font-weight: 500; }
.formulario input:focus, .formulario select:focus, .plan:focus, .inp-corto:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-suave); }
.formulario .check { display: flex; align-items: center; gap: 8px; }
.formulario .check input { accent-color: var(--acento); width: 18px; height: 18px; }
.botones { display: flex; flex-wrap: wrap; gap: 8px; }
.plan { width: 100%; height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.zona-carga { display: grid; place-items: center; gap: 6px; text-align: center; padding: 28px 16px; border: 2px dashed var(--borde);
  border-radius: var(--radio); cursor: pointer; color: var(--texto-2); }
.zona-carga:hover, .zona-carga:focus-within { border-color: var(--acento); background: var(--acento-suave); }
.zona-carga [data-ico] { color: var(--acento); }
.zona-carga [data-ico] svg { width: 30px; height: 30px; }
.zona-carga strong { color: var(--texto); }
.ayuda p { margin: 0 0 10px; color: var(--texto-2); }
.ayuda p:last-child { margin: 0; }
.segmentado { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; }
.segmentado button { border: 0; background: transparent; padding: 8px 16px; border-radius: 9px; font-weight: 600; color: var(--texto-2); cursor: pointer; }
.segmentado button.activo { background: var(--surface); color: var(--acento); box-shadow: var(--sombra); }

.pie { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--borde); font-size: 12.5px; color: var(--texto-3); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 3000; max-width: min(560px, calc(100vw - 32px));
  background: var(--texto); color: var(--fondo); padding: 12px 16px; border-radius: 12px; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }

/* Pantallas medianas y móviles */
@media (max-width: 1180px) {
  .r-2-1 { grid-template-columns: minmax(0, 1fr); }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-meta { justify-content: flex-start; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .menu { position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 900; height: auto; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--borde); }
  .menu-marca, .menu-pie { display: none; }
  .menu-nav { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; width: 100%; }
  .menu-nav a { flex-direction: column; gap: 2px; padding: 6px 2px; font-size: 11px; justify-content: center; text-align: center; }
  .menu-nav a svg { width: 22px; height: 22px; }
  .contenido { padding: 0 16px 96px; }
  .marca-movil { display: flex; }
  .barra { flex-wrap: wrap; }
  .buscador { order: 3; flex-basis: 100%; }
  .barra-der { margin-left: auto; }
  .r-2, .kpis-3 { grid-template-columns: minmax(0, 1fr); }
  .periodos, .refs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .critico-cab { grid-template-columns: auto 1fr; }
  .critico-acc { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .que-pasa { grid-template-columns: minmax(0, 1fr); }
  .toast { bottom: 88px; }
}
@media (max-width: 560px) {
  .barra-der .txt { display: none; }
  .barra-der .btn-sec { width: 42px; padding: 0; }
  .titulo-pag h1 { font-size: 24px; }
  .hero { padding: 18px; }
  .hero-valor { font-size: 36px; }
  .accion { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "id precio" "spark spark" "falta falta" "links links"; }
  .critico-ico { width: 40px; height: 40px; }
  .critico strong { font-size: 18px; }
  .graf-tv { height: 420px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Barra superior: frescura del dato */
.frescura { flex: 1; margin: 0; font-size: 13.5px; min-width: 0; color: var(--texto-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pill.aviso { background: var(--aviso-fondo); color: var(--aviso); }
.aviso-global .ag-txt { flex: 1 1 260px; }
.aviso-global .ag-acc { display: flex; gap: 8px; flex-wrap: wrap; }
.aviso-global .btn-mini { background: var(--surface); }
.seguir { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: -4px 0 12px; }
.seguir input { flex: 1; min-width: 160px; height: 42px; border: 1px solid var(--borde); border-radius: 10px; padding: 0 12px; background: var(--surface); }
.seguir input:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-suave); }
.seguir .nota { flex-basis: 100%; margin: 0; }
.comparar { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--borde); font-size: 13.5px; color: var(--texto-2); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.comparar:empty { display: none; }
.menu-pie .btn-instalar { width: 100%; height: 38px; }
.ac-id small b { color: var(--texto); }
@media (max-width: 900px) { .frescura { order: 2; flex-basis: 100%; } }
@media (max-width: 560px) {
  .critico-cab { grid-template-columns: minmax(0, 1fr); }
  .critico-ico, .fr-act { display: none; }
  .aviso-global > svg { display: none; }
}

/* Modo claro: la tarjeta de la cartera también es clara (borde turquesa de marca) */
:root:not([data-theme="dark"]) .hero { --hc: var(--texto); --hc2: var(--texto-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero { --hc: #fff; --hc2: rgba(255, 255, 255, .85); } }
:root[data-theme="dark"] .hero { --hc: #fff; --hc2: rgba(255, 255, 255, .85); }
.hero { color: var(--hc); }
.hero-etq, .hero-ref, .hero-dato, .hero-eje, .hero-meta { color: var(--hc2); }
:root:not([data-theme="dark"]) .hero { background: linear-gradient(135deg, #ffffff, #eef6f4); border: 1px solid var(--borde); border-top: 3px solid var(--acento); }
:root:not([data-theme="dark"]) .hero-delta { background: var(--surface-2); }
:root:not([data-theme="dark"]) .hero-delta.mal { background: var(--mal-fondo); color: var(--mal); }
:root:not([data-theme="dark"]) .hero-delta.bien { background: var(--bien-fondo); color: var(--bien); }
:root:not([data-theme="dark"]) .spark.hero-spark polyline { stroke: var(--texto-2); }
:root:not([data-theme="dark"]) .spark.hero-spark.mal polyline { stroke: var(--mal); }
:root:not([data-theme="dark"]) .spark.hero-spark.mal .spark-area { fill: rgba(180, 35, 24, .08); }
:root:not([data-theme="dark"]) .spark.hero-spark.bien polyline { stroke: var(--bien); }
:root:not([data-theme="dark"]) .spark.hero-spark.bien .spark-area { fill: rgba(21, 128, 61, .08); }
:root:not([data-theme="dark"]) .spark.hero-spark .spark-ref { stroke: var(--texto-3); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero { background: linear-gradient(135deg, var(--hero-1), var(--hero-2)); border: 0; border-top: 3px solid var(--acento); }
  :root:not([data-theme="light"]) .hero-delta { background: #fff; }
  :root:not([data-theme="light"]) .hero-delta.mal { background: #fff; color: #b42318; }
  :root:not([data-theme="light"]) .hero-delta.bien { background: #fff; color: #15803d; }
  :root:not([data-theme="light"]) .spark.hero-spark polyline { stroke: #fff; }
  :root:not([data-theme="light"]) .spark.hero-spark.mal polyline { stroke: #ffb4ab; }
  :root:not([data-theme="light"]) .spark.hero-spark.mal .spark-area { fill: rgba(255, 180, 171, .12); }
  :root:not([data-theme="light"]) .spark.hero-spark.bien polyline { stroke: #86efac; }
  :root:not([data-theme="light"]) .spark.hero-spark .spark-ref { stroke: rgba(255, 255, 255, .7); }
}
.pill.bien { background: var(--bien-fondo); color: var(--bien); }
.falta small a { font-weight: 700; text-decoration: none; }
/* Móvil: áreas táctiles de 40 px y medidor simplificado */
@media (max-width: 560px) {
  .btn-mini { height: 40px; }
  .med-escala span:not(:first-child):not(:last-child) { display: none; }
}
@media (max-width: 560px) {
  .critico { gap: 10px; }
  .critico-cab { padding: 12px 14px; }
  .critico > .que-pasa, .critico > .mi-plan { margin: 0 10px; }
  .critico strong { font-size: 18px; }
  .critico p { font-size: 13.5px; }
  .critico-acc .btn-claro, .critico-acc .btn-borde { height: 40px; padding: 0 10px; }
  .mi-plan { padding: 8px 12px; }
  .mi-plan p { font-size: 14px; }
  .accion .spark { display: none; }
  .accion { grid-template-areas: "id precio" "falta falta" "links links"; }
  .ac-links span { flex-basis: 100%; }
}

/* Modo oscuro: la cifra del día en píldora roja translúcida (sin parche blanco) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero-delta.mal, :root:not([data-theme="light"]) .hero-delta { background: rgba(239, 68, 68, .18); color: #fca5a5; }
  :root:not([data-theme="light"]) .hero-delta.bien { background: rgba(74, 222, 128, .16); color: #86efac; }
}
:root[data-theme="dark"] .hero-delta, :root[data-theme="dark"] .hero-delta.mal { background: rgba(239, 68, 68, .18); color: #fca5a5; }
:root[data-theme="dark"] .hero-delta.bien { background: rgba(74, 222, 128, .16); color: #86efac; }
.critico-cab p { color: #fff; }
.ac-valor { display: block; white-space: nowrap; }
.solo-movil { display: none !important; }
@media (max-width: 900px) {
  .solo-movil { display: inline-flex !important; }
  .menu-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .nav-ajustes { display: none !important; }
}
@media (max-width: 560px) {
  .med-escala span:not(:first-child):not(:last-child) { display: inline; }
  .hero-dato { white-space: nowrap; }
}

/* Ronda 5: medidor en tres niveles, umbral fuera de escala, móvil más cómodo */
.falta-txt { display: grid; gap: 1px; }
.falta-txt b { font-size: 14px; }
.falta-txt b.mal-si { color: var(--mal); }
.falta-txt small { font-size: 13.5px; color: var(--texto-2); }
.falta-txt small b { font-size: inherit; color: var(--texto); }
.medidor { margin-top: 4px; }
.med-fuera { position: absolute; top: -1px; font-size: 11.5px; font-weight: 800; color: var(--mal); background: var(--surface-2); padding: 0 4px; border-radius: 4px; line-height: 18px; }
.med-fuera.izq { left: 0; }
.med-fuera.der { right: 0; }
.ac-links a { font-weight: 700; }
.spark.hero-spark .spark-ref { stroke-width: 1.5; opacity: 1; }
.frescura .pill { white-space: nowrap; }
@media (max-width: 900px) {
  .barra-der { gap: 6px; }
  .barra-der .btn-ico, .barra-der .btn-sec { width: 44px; height: 44px; }
  .frescura { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; font-size: 13px; }
  .frescura .fr-l { display: none; }
}

/* Ronda 6 */
.per-ayuda { flex-basis: 100%; font-size: 12px; color: var(--texto-3); }
.qp-ia { margin-top: 6px; height: 32px; }
.qp-noticias li { display: grid; gap: 2px; justify-items: start; }
@media (max-width: 560px) {
  .ac-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .ac-links span { grid-column: 1 / -1; }
  .ac-links a, .ac-links .enlace { display: grid; place-items: center; height: 40px; border: 1px solid var(--borde); border-radius: 10px; background: var(--surface); font-size: 13px; text-align: center; }
}

/* Ronda 7 */
.n-tit { text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
@media (max-width: 560px) { .frescura { font-size: 12.5px; gap: 4px; } .frescura .pill { padding: 1px 6px; } }
@media (max-width: 900px) { .ver-mas { display: inline-flex; align-items: center; min-height: 40px; padding: 0 4px; } }
