:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111821;
  --surface: #1b2531;
  --surface-2: #233040;
  --head: #0c121a;
  --head-text: #ffffff;
  --head-muted: #b9c4d0;
  --text: #eef2f6;
  --muted: #b9c4d0;
  --line: #334355;
  --border: #8a99a9;
  --accent: #a9c6e4;
  --accent-hover: #c8dcf0;
  --accent-text: #10171f;
  --error: #ffb3b3;
  --ok: #8fe3b0;
  --focus: #a9c6e4;
  --warn-line: #e6b34d;
  --warn-bg: #2d2515;
  --shadow: none;
  --nav-bg: #0c121a;
  --nav-text: #dde6ef;
  --nav-current: #334a63;
  --danger: #ffb3b3;
  --danger-text: #10171f;
  --s1: #3987e5;
  --s2: #d95926;
  --map-0: #2c3a4a;
  --map-1: #24507f;
  --map-2: #2c6cb0;
  --map-3: #3987e5;
  --map-4: #8cbcf2;
  --i-azul: #6aa8f0; --i-azul-bg: #1c3250;
  --i-naranja: #f0904f; --i-naranja-bg: #3a2618;
  --i-verde: #5fd08f; --i-verde-bg: #163425;
  --i-morado: #b7a0f7; --i-morado-bg: #2b2347;
  --i-cian: #4fc9d9; --i-cian-bg: #143238;
  --i-ambar: #e8c15a; --i-ambar-bg: #352c14;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f4f6f9;
  --head: #1f2f41;
  --head-text: #ffffff;
  --head-muted: #c9d5e1;
  --text: #1c2733;
  --muted: #4a5868;
  --line: #d3dbe4;
  --border: #6b7a8a;
  --accent: #334a63;
  --accent-hover: #1f2f41;
  --accent-text: #ffffff;
  --error: #a30d0d;
  --ok: #0b6b34;
  --focus: #334a63;
  --warn-line: #a36a00;
  --warn-bg: #fdf4e3;
  --shadow: 0 1px 3px rgba(31, 47, 65, .12);
  --nav-bg: #1f2f41;
  --nav-text: #dde6ef;
  --nav-current: #3f5a78;
  --danger: #a30d0d;
  --danger-text: #ffffff;
  --s1: #2a78d6;
  --s2: #eb6834;
  --map-0: #e3e8ee;
  --map-1: #b5d2f1;
  --map-2: #7cb0ea;
  --map-3: #2a78d6;
  --map-4: #174a8a;
  --i-azul: #1f6fd1; --i-azul-bg: #e3eefb;
  --i-naranja: #c2501d; --i-naranja-bg: #fbe9df;
  --i-verde: #0b7a3e; --i-verde-bg: #ddf2e5;
  --i-morado: #6a4fc9; --i-morado-bg: #ece6fb;
  --i-cian: #0a7887; --i-cian-bg: #dcf2f5;
  --i-ambar: #8f6500; --i-ambar-bg: #f8efd6;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: .875rem/1.5 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
[hidden] { display: none !important; }
a { color: var(--accent); }
.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 2;
  padding: .75rem 1rem;
  background: var(--surface);
  color: var(--text);
  border: 2px solid var(--focus);
}
.skip:focus { top: .5rem; }

/* Cabecera */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .6rem 1.5rem;
  background: var(--head);
  border-bottom: 1px solid var(--line);
  color: var(--head-text);
}
.brand { margin: 0; font-size: 1rem; font-weight: 700; letter-spacing: .01em; }
.brand span { display: inline-block; margin-left: .6rem; padding-left: .7rem; border-left: 1px solid var(--head-muted); font-size: .85rem; font-weight: 400; color: var(--head-muted); }
.top :focus-visible { outline-color: var(--head-text); }
.top button.link { color: var(--head-text); }
.top button.link:hover { color: var(--head-muted); }

/* Estructura */
main { margin: 0; padding: 1.25rem 1.5rem 4rem; }
main:focus, h1:focus, h2:focus, h3:focus { outline: none; }
#volver::before { content: "\2190\00a0"; }
#v-carga, #v-entrar, #v-enviado, #v-enlace {
  max-width: 30rem;
  margin: 2.5rem auto 0;
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
}
#v-entrar form { margin-bottom: 0; }
#v-entrar button[type="submit"] { width: 100%; margin-top: .25rem; }
.bloque {
  margin: 0 0 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
}
.bloque > :last-child { margin-bottom: 0; }
.bloque > h2:first-child { margin: -1rem -1.25rem 1rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--line); font-size: .95rem; font-weight: 600; }
.web-grid { display: block; }
.web-cuerpo { min-width: 0; }
.lado .index {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  list-style: none;
  margin: 0 0 1.25rem;
  padding: .5rem;
  background: var(--nav-bg);
  border-radius: 4px;
  box-shadow: var(--shadow);
}
.index a {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-height: 2.5rem;
  padding: .35rem .6rem;
  border-radius: 4px;
  color: var(--nav-text);
  font-weight: 500;
  line-height: 1.25;
  text-decoration: none;
}
.index a svg { flex: none; box-sizing: content-box; width: 16px; height: 16px; padding: 5px; border-radius: 3px; color: var(--ic, var(--nav-text)); background: var(--ic-bg, transparent); }
.index a[data-ir="resumen"] { --ic: var(--i-azul); --ic-bg: var(--i-azul-bg); }
.index a[data-ir="informe"] { --ic: var(--i-verde); --ic-bg: var(--i-verde-bg); }
.index a[data-ir="imagenes"] { --ic: var(--i-naranja); --ic-bg: var(--i-naranja-bg); }
.index a[data-ir="ia"] { --ic: var(--i-morado); --ic-bg: var(--i-morado-bg); }
.index a[data-ir="instalar"] { --ic: var(--i-cian); --ic-bg: var(--i-cian-bg); }
.index a[data-ir="ajustes"] { --ic: var(--i-ambar); --ic-bg: var(--i-ambar-bg); }
.index a:hover { background: var(--nav-current); color: #ffffff; }
.index a[aria-current] { background: var(--nav-current); color: #ffffff; box-shadow: inset 4px 0 0 #ffffff; }
.index a:focus-visible { outline: 3px solid #ffffff; outline-offset: -3px; }
@media (min-width: 62rem) {
  .web-grid { display: grid; grid-template-columns: 14rem minmax(0, 1fr); gap: 1.25rem; align-items: start; }
  .lado { position: sticky; top: 1rem; }
  .lado .index { display: block; margin: 0; }
  .lado .index li + li { margin-top: .2rem; }
}

/* Texto */
h1 { font-size: 1.3rem; line-height: 1.3; font-weight: 600; margin: .25rem 0 1rem; overflow-wrap: anywhere; }
h2 { font-size: 1.05rem; line-height: 1.35; font-weight: 600; margin: 1.75rem 0 .6rem; scroll-margin-top: 1rem; }
h3 { font-size: .9rem; font-weight: 600; margin: 0 0 .5rem; overflow-wrap: anywhere; }
h4 { font-size: .875rem; margin: 1.25rem 0 .35rem; }
h5 { font-size: .875rem; margin: 0 0 .25rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.error { color: var(--error); font-weight: 600; }
.error::before { content: "Error: "; }
.state-ok { color: var(--ok); font-weight: 600; }
.state-no { color: var(--error); font-weight: 600; }
#web-licencia p { margin: 0 0 1.25rem; padding: .7rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
#web-licencia p.state-ok { border-left: 5px solid var(--ok); }
#web-licencia p.warn { border-left: 5px solid var(--warn-line); background: var(--warn-bg); }
.warn { padding: .6rem .85rem; border-left: 4px solid var(--warn-line); background: var(--warn-bg); border-radius: 0 3px 3px 0; }
.status:not(:empty) {
  padding: .75rem 1rem;
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 0 4px 4px 0;
}

/* Formularios */
label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: .25rem; }
input, select, textarea {
  display: block;
  width: 100%;
  padding: .4rem .65rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-bottom: .5rem;
}
input, select { min-height: 2.25rem; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border: 2px solid var(--error); }
input[type="color"] { width: 5rem; padding: .2rem; }
textarea[disabled] { opacity: .6; }
form { margin: 0 0 1.5rem; }
.bloque > form:last-child { margin-bottom: 0; }
fieldset { border: 1px solid var(--line); border-radius: 4px; padding: 1rem; margin: 0 0 1.25rem; min-width: 0; }
legend { font-weight: 700; padding: 0 .4rem; }
fieldset label { margin-top: .75rem; }
.check { display: flex; align-items: center; gap: .6rem; margin: .5rem 0; }
.check input { width: 1.4rem; height: 1.4rem; min-height: 0; flex: none; margin: 0; accent-color: var(--accent); }
.check label { margin: 0; font-weight: 400; }
.colors { display: flex; flex-wrap: wrap; gap: 1rem; }

/* Botones */
button {
  min-height: 2.25rem;
  padding: .35rem .95rem;
  font: inherit;
  font-weight: 600;
  color: var(--accent-text);
  background: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 3px;
  cursor: pointer;
}
button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.danger { color: var(--danger); background: transparent; border-color: var(--danger); }
button.danger:hover { color: var(--danger-text); background: var(--danger); border-color: var(--danger); }
button[disabled] { opacity: .6; cursor: progress; }
button.secondary { color: var(--accent); background: transparent; border-color: var(--accent); }
button.secondary:hover { color: var(--accent-text); background: var(--accent); }
button.link { min-height: 2.25rem; padding-left: 0; padding-right: 0; color: var(--accent); background: none; border-color: transparent; text-decoration: underline; }
button.link:hover { color: var(--accent-hover); background: none; border-color: transparent; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
button[aria-busy="true"]::before, .progreso::before {
  content: "";
  display: inline-block;
  width: .9em;
  height: .9em;
  margin-right: .5em;
  vertical-align: -.1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: girar .9s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  button[aria-busy="true"]::before, .progreso::before { animation: none; }
}
.progreso { font-weight: 600; margin: .75em 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }

/* Tarjetas y datos */
.cards { list-style: none; margin: 0 0 1rem; padding: 0; }
.cards > li {
  padding: 1rem;
  margin-bottom: .75rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.cards > li:last-child { margin-bottom: 0; }
dl { margin: 0; }
dt { font-weight: 600; margin-top: .5rem; }
dd { margin: 0; overflow-wrap: anywhere; }
code {
  display: block;
  padding: .5rem .75rem;
  margin: .25rem 0 .5rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: .82rem;
  overflow-wrap: anywhere;
}
.result { margin-top: .75rem; }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .75rem; margin: 0 0 1rem; }
.figures > div { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 4rem; padding: .7rem .9rem .7rem 4rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; }
.figures .ico { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); display: flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border-radius: 4px; color: var(--ic); background: var(--ic-bg); }
.figures > div:nth-child(1) { --ic: var(--i-azul); --ic-bg: var(--i-azul-bg); }
.figures > div:nth-child(2) { --ic: var(--i-naranja); --ic-bg: var(--i-naranja-bg); }
.figures > div:nth-child(3) { --ic: var(--i-verde); --ic-bg: var(--i-verde-bg); }
.figures > div:nth-child(4) { --ic: var(--i-morado); --ic-bg: var(--i-morado-bg); }
.figures dt { margin: 0; font-weight: 400; font-size: .8rem; color: var(--muted); }
.figures dd { font-size: 1.35rem; line-height: 1.25; font-weight: 700; font-variant-numeric: tabular-nums; }
table { width: 100%; border-collapse: collapse; margin: 0 0 1rem; }
caption { text-align: left; font-weight: 600; margin-bottom: .5rem; }
th, td { text-align: left; padding: .4rem .6rem; border-bottom: 1px solid var(--line); }
thead th { background: var(--surface-2); font-size: .8rem; font-weight: 600; color: var(--muted); }
#informe:focus { outline: none; }
#informe { margin-top: 1.25rem; }
#informe:empty { margin-top: 0; }
.nota { margin: 0 0 1rem; padding: 1rem 1.25rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; }
.score { margin: 0 0 .6rem; font-size: 1.6rem; line-height: 1.2; font-weight: 700; }
.nota-barra { display: block; height: .6rem; background: var(--line); border-radius: 99px; overflow: hidden; }
.nota-barra span { display: block; height: 100%; background: var(--warn-line); border-radius: 99px; }
.nota-bien .nota-barra span { background: var(--ok); }
.nota-mal .nota-barra span { background: var(--error); }
.fallos-mal > li { border-left: 5px solid var(--error); }
.fallos-regular > li { border-left: 5px solid var(--warn-line); }
details { margin: .6rem 0; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); }
summary { min-height: 2.25rem; padding: .5rem .85rem; font-weight: 600; cursor: pointer; }
details > :not(summary) { margin-left: 1rem; margin-right: 1rem; }
details > ul { padding-left: 1.25rem; margin-bottom: .75rem; }
.datos { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .25rem 1rem; }
.datos dt { font-size: .8rem; font-weight: 400; color: var(--muted); }
.datos dd { font-weight: 600; }
.opciones { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: .75rem; margin-bottom: .75rem; }
.opcion { min-width: 0; padding: .85rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; }
.opcion h4 { margin-top: 0; }
.thumb { display: block; max-width: 100%; max-height: 180px; width: auto; height: auto; margin: 0 0 .5rem; border: 1px solid var(--line); background: var(--surface); }
/* Sin JavaScript de por medio: tiene que aparecer aunque el código no haya llegado a arrancar. */
.carga-lenta { visibility: hidden; animation: aparecer 0s linear 8s forwards; }
@keyframes aparecer { to { visibility: visible; } }
.cards .figures { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
.cards .figures > div { min-height: 3.4rem; padding: .5rem .6rem .5rem 3.2rem; }
.cards .figures .ico { left: .6rem; }
.cards .figures .ico { width: 2rem; height: 2rem; }
.cards .figures dd { font-size: 1.1rem; }

/* Panel */
.top-acciones { display: flex; gap: 1.25rem; align-items: center; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.kpis { display: grid; gap: .75rem; margin-bottom: 1.25rem; }
.kpis .figures { margin: 0; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.nota-tile { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; }
.nota-tit { margin: 0; font-size: .8rem; color: var(--muted); }
.nota-val { margin: 0; font-size: 1.15rem; font-weight: 700; }
@media (min-width: 48rem) { .kpis { grid-template-columns: minmax(0, 1fr) 16rem; } }
.tarjetas-grid { display: grid; gap: 0 1rem; }
@media (min-width: 48rem) { .tarjetas-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.dos-col { display: grid; gap: 1.25rem; }
@media (min-width: 60rem) { .dos-col.ancha { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); align-items: center; } }
.nota-datos { font-size: .8rem; margin-top: 1rem; }
.lienzo { position: relative; }
.grafico { display: block; max-width: 100%; height: auto; }
.rejilla { stroke: var(--line); stroke-width: 1; }
.eje { fill: var(--muted); font-size: 11px; }
.linea { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.linea.s1 { stroke: var(--s1); }
.linea.s2 { stroke: var(--s2); }
.punto { stroke: var(--surface); stroke-width: 2; }
.punto.s1 { fill: var(--s1); }
.punto.s2 { fill: var(--s2); }
.cruz { stroke: var(--muted); stroke-width: 1; }
.globo { position: absolute; padding: .25rem .5rem; font-size: .85rem; background: var(--head); color: var(--head-text); border-radius: 3px; pointer-events: none; white-space: nowrap; }
.leyenda { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; list-style: none; margin: 0 0 .5rem; padding: 0; font-size: .8rem; color: var(--muted); }
.leyenda li { display: flex; align-items: center; gap: .4rem; }
.muestra { width: 1rem; height: 3px; border-radius: 2px; }
.muestra.s1 { background: var(--s1); }
.muestra.s2 { background: var(--s2); }
.columna { fill: var(--s1); }
.barras { margin: 0; }
.barras th, .barras td { border: 0; padding: .3rem 0; vertical-align: middle; }
.barras tbody th { width: 42%; padding-right: .75rem; font-weight: 400; overflow-wrap: anywhere; }
.barras td { display: flex; align-items: center; gap: .6rem; }
.pista { flex: 1 1 auto; min-width: 2rem; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.pista span { display: block; height: 100%; background: var(--s1); border-radius: 4px; }
.valor { flex: none; font-size: .85rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.mapa { display: block; width: 100%; height: auto; max-height: 24rem; }
.pais { stroke: var(--surface); stroke-width: .5; }
.pais.t0 { fill: var(--map-0); }
.pais.t1 { fill: var(--map-1); }
.pais.t2 { fill: var(--map-2); }
.pais.t3 { fill: var(--map-3); }
.pais.t4 { fill: var(--map-4); }
.anillo { flex: none; }
.anillo-fondo { fill: none; stroke: var(--line); stroke-width: 8; }
.anillo-valor { fill: none; stroke-width: 8; stroke-linecap: round; stroke: var(--warn-line); }
.anillo-valor.bien { stroke: var(--ok); }
.anillo-valor.mal { stroke: var(--error); }
.anillo-texto { fill: var(--text); font-size: 22px; font-weight: 700; }

/* Pantalla entera: las tarjetas se reparten; el texto largo no pasa de un ancho cómodo de leer. */
.bloque > p, .bloque > form > p, .nota-datos { max-width: 75ch; }
#webs { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(24rem, 100%), 1fr)); }
#webs > li { margin: 0; }
#licencias { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(24rem, 100%), 1fr)); }
#licencias > li { margin: 0; }
#mejorar .cards { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(22rem, 100%), 1fr)); margin-bottom: 0; }
#mejorar .cards > li { margin: 0; }
#informe .cards { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(26rem, 100%), 1fr)); }
#informe .cards > li { margin: 0; }
#imagenes .cards { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(min(24rem, 100%), 1fr)); }
#imagenes .cards > li { margin: 0; }
#f-ajustes { display: grid; gap: 0 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(24rem, 100%), 1fr)); align-items: start; }
#f-ajustes > button { justify-self: start; }
#f-ia, #f-web { max-width: 48rem; }
@media (min-width: 100rem) {
  .tarjetas-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpis { grid-template-columns: minmax(0, 1fr) 20rem; }
  .dos-col.ancha { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
