/* Site Monitor · panel v2 — diseño B «Pantalla» (elegido por el propietario el 2026-10-02).
   Blanco y añil, tarjetas con sombra suave, estados en etiquetas de color con texto.
   Tema: sigue al sistema; el interruptor guarda la preferencia en la cookie smtheme (data-theme). */

@font-face {
  font-family: "Figtree";
  src: url("fonts/figtree-latin.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --font: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius: 14px;
  --radius-sm: 10px;

  --bg: #F6F7FB;
  --surface: #FFFFFF;
  --surface-2: #F1F2F8;
  --side: #FFFFFF;
  --side-ink: #3F4659;
  --side-active: #EEF0FF;
  --ink: #161A2B;
  --muted: #646B82;
  --line: #E4E6F0;
  --brand: #4F46E5;
  --brand-hover: #4338CA;
  --brand-ink: #FFFFFF;
  --brand-soft: #EEF0FF;
  --ok: #12A150;
  --warn: #B86E00;
  --down: #D93036;
  --maint: #2F6FE0;
  --nodata: #757B8E;
  --shadow: 0 1px 2px rgba(20, 24, 60, 0.06), 0 4px 16px rgba(20, 24, 60, 0.05);
}

/* Modo oscuro: por el sistema (si no hay preferencia guardada) o por el interruptor. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E1020; --surface: #171A2E; --surface-2: #1E2238; --side: #121427; --side-ink: #B8BDD6;
    --side-active: #24275A; --ink: #ECEEF8; --muted: #9AA0BC; --line: #262A45;
    --brand: #8B85FF; --brand-hover: #A29DFF; --brand-ink: #0E1020; --brand-soft: #24275A;
    --ok: #3DD68C; --warn: #F5B544; --down: #FF6B6F; --maint: #79A7FF; --nodata: #9AA0B4;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E1020; --surface: #171A2E; --surface-2: #1E2238; --side: #121427; --side-ink: #B8BDD6;
  --side-active: #24275A; --ink: #ECEEF8; --muted: #9AA0BC; --line: #262A45;
  --brand: #8B85FF; --brand-hover: #A29DFF; --brand-ink: #0E1020; --brand-soft: #24275A;
  --ok: #3DD68C; --warn: #F5B544; --down: #FF6B6F; --maint: #79A7FF; --nodata: #9AA0B4;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); }
h1, h2, h3 { margin: 0 0 0.75rem; line-height: 1.2; font-weight: 800; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1rem; max-width: 70ch; }
code { font-family: var(--mono); font-size: 0.9em; overflow-wrap: anywhere; }
a { color: var(--brand); font-weight: 600; text-underline-offset: 0.18em; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Marca ── */
.brand { display: inline-flex; align-items: center; gap: 0.65rem; font-weight: 800; font-size: 1.2rem; color: var(--ink); }
.logo-mark { width: 38px; height: 38px; flex: none; }
.logo-bg { fill: #4F46E5; }
.brand-link { text-decoration: none; color: inherit; border-radius: 12px; }

/* ── Estados ── */
.pill { display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 700; font-size: 0.85rem; padding: 0.2rem 0.65rem; border-radius: 999px; white-space: nowrap; }
.pill::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.pill.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.pill.down { color: var(--down); background: color-mix(in srgb, var(--down) 13%, transparent); }
.pill.maint { color: var(--maint); background: color-mix(in srgb, var(--maint) 14%, transparent); }
.pill.nodata, .pill.paused, .pill.off { color: var(--nodata); background: color-mix(in srgb, var(--nodata) 14%, transparent); }
.state { font-weight: 700; }
.state-ok { color: var(--ok); }
.state-nodata { color: var(--nodata); }

.notice { display: flex; gap: 0.65rem; align-items: baseline; max-width: 44rem; margin: 0 0 1.25rem; padding: 0.75rem 1rem;
  border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 500; }
.notice-icon { font-weight: 800; flex: none; }
.notice-error { background: color-mix(in srgb, var(--down) 10%, var(--surface)); border-color: color-mix(in srgb, var(--down) 35%, transparent); }
.notice-error .notice-icon { color: var(--down); }
.notice-ok { background: color-mix(in srgb, var(--ok) 10%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.notice-ok .notice-icon { color: var(--ok); }
.notice-info { background: var(--brand-soft); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.notice-info .notice-icon { color: var(--brand); }

/* ── Formularios y botones ── */
.form { display: grid; gap: 0.35rem; max-width: 26rem; margin: 0 0 1rem; }
.form label, .form legend { font-weight: 700; margin-top: 0.85rem; }
.form fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.choice { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.85rem 1rem; border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); cursor: pointer; font-weight: 400 !important; margin: 0 !important; }
.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.choice input { width: 1.15rem; height: 1.15rem; margin-top: 0.2rem; accent-color: var(--brand); flex: none; }
input[type="email"], input[type="password"], input[type="text"] {
  font: inherit; color: var(--ink); background: var(--surface-2); border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); padding: 0.75rem 0.9rem; min-height: 48px; width: 100%;
}
input:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 40%, transparent); border-color: var(--brand); outline-offset: 0; }
.code-input { font-family: var(--mono) !important; font-size: 1.6rem !important; letter-spacing: 0.35em; max-width: 13ch; text-align: center; }

.button, .button-quiet { font: inherit; font-weight: 700; min-height: 46px; padding: 0.6rem 1.15rem; border-radius: var(--radius-sm); cursor: pointer; }
.button { background: var(--brand); color: var(--brand-ink); border: 1px solid var(--brand); justify-self: start; margin-top: 1rem; }
.button:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.button-wide { justify-self: stretch; width: 100%; }
.button-quiet { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.button-quiet:hover { border-color: var(--muted); }
.button-small { min-height: 38px; padding: 0.35rem 0.85rem; font-size: 0.92rem; }
.form-inline { margin: 0 0 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.icon-button:hover { border-color: var(--muted); }
.icon-button svg { width: 20px; height: 20px; }

/* Interruptor de tema: se ve el botón del tema contrario al que se muestra. */
.theme-form { margin: 0; display: inline-flex; }
.theme-to-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-to-dark { display: none; }
  :root:not([data-theme="light"]) .theme-to-light { display: inline-flex; }
}
:root[data-theme="dark"] .theme-to-dark { display: none; }
:root[data-theme="dark"] .theme-to-light { display: inline-flex; }

/* ── Acceso: tarjeta centrada ── */
.public { min-height: 100vh; background:
  radial-gradient(1100px 560px at 15% -5%, color-mix(in srgb, var(--brand) 20%, transparent), transparent),
  radial-gradient(900px 500px at 100% 100%, color-mix(in srgb, var(--maint) 12%, transparent), transparent), var(--bg); }
.public-top { display: flex; justify-content: flex-end; padding: 1rem; }
.door { display: grid; place-items: center; padding: 0 1rem 4rem; }
.door-card { width: min(440px, 100%); background: var(--surface); border-radius: 20px; box-shadow: 0 10px 40px rgba(20, 24, 60, 0.12); padding: 2.25rem 2rem; }
.door-card .brand { margin-bottom: 1.75rem; }
.door-card h1 { font-size: 1.9rem; margin-bottom: 0.35rem; }
.door-card .form { max-width: none; }
.lead { color: var(--muted); }

/* ── Estructura con sesión ── */
.app-grid { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.side { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; padding: 0.85rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 1.4rem; margin: 0; }
.spacer { flex: 1; }
.brand-mobile .logo-mark { width: 34px; height: 34px; }
.user { display: inline-flex; align-items: center; gap: 0.6rem; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 800; flex: none; }
.who { display: none; line-height: 1.2; }
.who-name { display: block; font-weight: 700; }
.who-role { display: block; color: var(--muted); font-size: 0.82rem; }
.logout { margin: 0; }

.sidebar ul, .sidebar-account ul, .nav-mobile ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.2rem; }
.sidebar a, .sidebar-account a, .nav-mobile a { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem; min-height: 44px;
  border-radius: var(--radius-sm); color: var(--side-ink); text-decoration: none; font-weight: 600; }
.sidebar a:hover, .sidebar-account a:hover, .nav-mobile a:hover { background: var(--surface-2); }
.sidebar a[aria-current="page"], .sidebar-account a[aria-current="page"], .nav-mobile a[aria-current="page"] { background: var(--side-active); color: var(--brand); }
.nav-icon { width: 20px; height: 20px; flex: none; }

.nav-mobile { background: var(--surface); border-bottom: 1px solid var(--line); padding: 0 1rem; }
.nav-mobile summary { padding: 0.75rem 0; min-height: 44px; cursor: pointer; font-weight: 700; }
.nav-mobile ul { padding-bottom: 0.75rem; }

.content { padding: 1.25rem 1rem 3rem; display: grid; gap: 1.5rem; align-content: start; min-width: 0; }
.content > *, .stack > * { min-width: 0; }

@media (min-width: 48rem) {
  .app-grid { grid-template-columns: 260px minmax(0, 1fr); }
  .side { display: flex; flex-direction: column; gap: 1.75rem; padding: 1.25rem 0.9rem; background: var(--side); border-right: 1px solid var(--line);
    position: sticky; top: 0; height: 100vh; }
  .side .brand-link { padding: 0 0.5rem; }
  .sidebar-account { margin-top: auto; border-top: 1px solid var(--line); padding-top: 0.75rem; }
  .nav-mobile, .brand-mobile { display: none; }
  .topbar { padding: 1rem 2rem; }
  .who { display: block; }
  .content { padding: 1.75rem 2rem 3rem; }
}

/* ── Bloques ── */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; }
.block { max-width: 46rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.5rem; margin: 0 0 1.5rem; }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; }
.step { border-top: 1px solid var(--line); padding-top: 1.25rem; margin-top: 0.5rem; max-width: 40rem; }
.steps { padding-left: 1.25rem; max-width: 40rem; }
.steps li { margin-bottom: 0.75rem; }
.secret code { display: inline-block; font-size: 1.15rem; letter-spacing: 0.08em; padding: 0.6rem 0.85rem; margin-top: 0.4rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.aside { color: var(--muted); font-size: 0.88rem; }
.welcome h2 { font-size: 1.5rem; }
.coming { list-style: none; padding: 0; margin: 0.5rem 0 0; display: grid; gap: 0.85rem; }
.coming li { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.coming .pill { min-width: 8.5rem; }
.empty { display: flex; gap: 1rem; align-items: center; max-width: 46rem; }
.empty .lead { margin: 0; }
.empty-icon { width: 40px; height: 40px; color: var(--brand); flex: none; }

/* ── Spec 012: resumen, ficha de sitio e incidentes (de las maquetas aprobadas) ── */

.updated { color: var(--muted); font-size: .9rem; }

/* Cifras clave */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 1rem; }
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.15rem; display: grid; gap: .2rem; }
.kpi-label { color: var(--muted); font-size: .88rem; font-weight: 600; }
.kpi-value { font-size: 1.85rem; font-weight: 800; line-height: 1.15; }
.kpi-note { font-size: .85rem; font-weight: 600; color: var(--muted); }
.kpi-note.bad { color: var(--down); } .kpi-note.good { color: var(--ok); } .kpi-note.mid { color: var(--warn); }
.kpi.alert { box-shadow: var(--shadow), inset 4px 0 0 var(--down); }

/* Tarjetas con cabecera */
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 1.12rem; margin: 0; }
.card-body { padding: 1rem 1.25rem 1.25rem; }

/* Incidentes abiertos */
.incident-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1rem; padding: 1rem 1.25rem 1.25rem; }
.incident { border: 1px solid var(--line); border-left: 5px solid var(--down); border-radius: var(--radius-sm); padding: .85rem 1rem; display: grid; gap: .3rem; }
.incident.sev-warning { border-left-color: var(--warn); }
.incident-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.incident b a { color: var(--ink); text-decoration: none; }
.meta { color: var(--muted); font-size: .9rem; }
.ack { color: var(--ok); font-weight: 700; font-size: .88rem; }

/* Filtros */
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; }
.filters label { display: grid; gap: .25rem; font-weight: 700; font-size: .85rem; }
.filters select, .filters input { font: inherit; font-weight: 400; color: var(--ink); background: var(--surface-2); border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); padding: .5rem .7rem; min-height: 42px; }
.filters input[type="search"] { min-width: 14rem; }
.filters .button { margin-top: 0; min-height: 42px; }

/* Tablas */
.table-wrap { overflow-x: auto; position: relative; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; color: var(--muted); font-size: .78rem; font-weight: 700; padding: .6rem .7rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .7rem .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.site-cell a { color: var(--ink); text-decoration: none; font-weight: 700; }
.site-cell a:hover { color: var(--brand); }
.site-cell { min-width: 12rem; }
.site-cell small { display: block; color: var(--muted); font-size: .8rem; }
.site-cell code { color: var(--muted); font-size: .76rem; white-space: nowrap; }
.spark { width: 90px; height: 28px; display: block; }
.spark path { fill: none; stroke: var(--brand); stroke-width: 2; }
.lights { display: flex; gap: .3rem; }
.light { min-width: 1.35rem; padding: 0 .2rem; height: 1.35rem; border-radius: 6px; display: grid; place-items: center; font-size: .66rem; font-weight: 800; color: #fff; }
.light.ok { background: var(--ok); } .light.warn { background: var(--warn); } .light.down { background: var(--down); } .light.none { background: var(--nodata); }
.expiry { font-weight: 700; color: var(--warn); white-space: nowrap; font-size: .88rem; }

/* Ficha de sitio */
.site-head { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: center; }
.site-head h2 { margin: 0; font-size: 1.5rem; }
.site-head .meta code { font-size: .85rem; }
.banner { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 1rem; padding: .75rem 1rem;
  border-radius: var(--radius-sm); background: color-mix(in srgb, var(--down) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--down) 35%, transparent); }
.uptimes { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 1rem; }
.days { position: relative; display: grid; grid-template-columns: repeat(90, minmax(0, 1fr)); gap: 2px; height: 44px; }
.days i { border-radius: 2px; background: var(--ok); }
.days i.mid { background: var(--warn); } .days i.bad { background: var(--down); } .days i.none { background: var(--line); }
.days-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; margin-top: .4rem; }
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .85rem; color: var(--muted); margin-top: .75rem; }
.legend span { display: inline-flex; align-items: center; gap: .35rem; }
.legend i { width: .8rem; height: .8rem; border-radius: 3px; display: inline-block; }
.tabs { display: inline-flex; background: var(--surface-2); border-radius: var(--radius-sm); padding: .2rem; gap: .2rem; }
.tabs a { padding: .35rem .8rem; border-radius: 8px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: .9rem; }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line); }
.chart text { fill: var(--muted); font: 12px var(--font); }
.ph-dns { fill: #A5B4FC; } .ph-connect { fill: #818CF8; } .ph-tls { fill: #6366F1; } .ph-wait { fill: #4F46E5; } .ph-transfer { fill: #312E81; }
:root[data-theme="dark"] .ph-transfer { fill: #C7D2FE; }
.band-incident { fill: var(--down); fill-opacity: .14; }
.band-maint { fill: var(--maint); fill-opacity: .14; }
.line-p95 { fill: none; stroke: var(--down); stroke-width: 2; stroke-dasharray: 5 4; }
.cat-title { font-size: .95rem; margin: 1rem 0 .4rem; display: flex; gap: .5rem; align-items: center; }

/* Detalle de incidente */
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 60rem) { .detail-grid { grid-template-columns: 1fr; } }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: .9rem; }
.timeline li { display: grid; grid-template-columns: 7.5rem 1fr; gap: .75rem; }
.timeline time { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }
.note { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .7rem .9rem; margin-bottom: .6rem; }
.note small { color: var(--muted); display: block; margin-bottom: .2rem; }
textarea { font: inherit; color: var(--ink); background: var(--surface-2); border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  padding: .65rem .8rem; width: 100%; min-height: 5.5rem; resize: vertical; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: .85rem 1.25rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }

.line-p50 { fill: none; stroke: var(--brand); stroke-width: 2; }
.chart-empty { color: var(--muted); padding: 2rem 0; }
.legend .sw { width: .8rem; height: .8rem; border-radius: 3px; display: inline-block; }
.sw-dns { background: #A5B4FC; } .sw-connect { background: #818CF8; } .sw-tls { background: #6366F1; } .sw-wait { background: #4F46E5; } .sw-transfer { background: #312E81; }
.sw-p95 { background: var(--down); } .sw-p50 { background: var(--brand); } .sw-incident { background: color-mix(in srgb, var(--down) 25%, transparent); } .sw-maint { background: color-mix(in srgb, var(--maint) 25%, transparent); }
.sw-ok { background: var(--ok); } .sw-mid { background: var(--warn); } .sw-bad { background: var(--down); } .sw-none { background: var(--line); }
.stack { display: grid; gap: 1.25rem; align-content: start; }
.facts-top { margin-top: 1rem; }

/* ── Gestión (spec 013) ── */
/* Cabecera de página con acciones a la derecha */
.page-head { display: flex; flex-wrap: wrap; gap: .75rem 1rem; align-items: center; justify-content: space-between; }
.page-head h2 { margin: 0; font-size: 1.45rem; }
.page-head .meta { margin-top: .2rem; }
.page-head .actions { gap: .5rem; }
.page-head .button { margin-top: 0; }
a.button, a.button-quiet { display: inline-flex; align-items: center; text-decoration: none; }
.button-danger { font: inherit; font-weight: 700; min-height: 46px; padding: .6rem 1.15rem; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--down); color: #fff; border: 1px solid var(--down); }
.button-danger:hover { filter: brightness(.92); }
.button-danger.button-small { min-height: 38px; padding: .35rem .85rem; font-size: .92rem; }
.slug { font-family: var(--mono); font-size: .85rem; color: var(--muted); }

/* Formularios de gestión: dos columnas en pantallas anchas */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 1.5rem; max-width: 52rem; }
@media (min-width: 48rem) { .form-grid { grid-template-columns: 1fr 1fr; } }
.field { display: grid; gap: .35rem; align-content: start; margin-top: .85rem; }
.field > label, .field > .label { font-weight: 700; }
.field .hint { color: var(--muted); font-size: .88rem; margin: 0; }
.field-wide { grid-column: 1 / -1; }
.field select { font: inherit; color: var(--ink); background: var(--surface-2); border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); padding: .7rem .9rem; min-height: 48px; width: 100%; }
.field input[type="number"] { font: inherit; color: var(--ink); background: var(--surface-2); border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); padding: .75rem .9rem; min-height: 48px; width: 100%; }
.field.has-error input, .field.has-error select { border-color: var(--down); }
.field-error { color: var(--down); font-weight: 600; font-size: .9rem; margin: 0; display: flex; gap: .4rem; }
.field-error::before { content: "✕"; font-weight: 800; }
.check { display: flex; gap: .6rem; align-items: center; font-weight: 600; min-height: 48px; }
.check input { width: 1.2rem; height: 1.2rem; accent-color: var(--brand); }
.form-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-top: 1.5rem; }
.form-actions .button { margin-top: 0; }

/* Uso de los límites */
.usage { display: grid; gap: .45rem; max-width: 28rem; }
.usage-figure { font-size: 1.6rem; font-weight: 800; line-height: 1.1; }
.usage-figure small { font-size: .95rem; font-weight: 600; color: var(--muted); }
.meter { height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.meter.over i { background: var(--warn); }

/* Fichas en rejilla */
.two-col { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 64rem) { .two-col { grid-template-columns: 1fr 1fr; } }
.card-body .facts { margin-bottom: 1rem; }
.card-body > :last-child { margin-bottom: 0; }
.card-body .form-inline { margin: 0; }

/* Zona de peligro */
.danger { border: 1.5px solid color-mix(in srgb, var(--down) 40%, var(--line)); }
.danger .card-head { border-bottom-color: color-mix(in srgb, var(--down) 25%, var(--line)); }
.danger .card-head h2 { color: var(--down); }

/* Confirmación */
.confirm { max-width: 44rem; }
.confirm ul { padding-left: 1.2rem; }
.confirm li { margin: .3rem 0; }

/* Auditoría */
.audit-action { font-family: var(--mono); font-size: .85rem; white-space: nowrap; }
.audit-detail { color: var(--muted); font-size: .9rem; }
.audit-detail b { color: var(--ink); font-weight: 600; }
.nowrap { white-space: nowrap; }

/* Acceso: enlace secundario bajo el botón */
.door-link { margin: 1rem 0 0; text-align: center; }
.door-back { margin: 1.25rem 0 0; }

.muted { color: var(--muted); }
.facts dd { min-width: 0; overflow-wrap: anywhere; }

/* Secciones dentro de un formulario */
.form-section { font-size: 1.05rem; margin: .5rem 0 0; }
.fieldset { border: 0; border-top: 1px solid var(--line); padding: 1.25rem 0 0; margin: 1.5rem 0 0; min-width: 0; }
.fieldset legend { font-size: 1.05rem; font-weight: 800; padding: 0 .5rem 0 0; }
.fieldset > .hint { color: var(--muted); font-size: .88rem; margin: .25rem 0 0; }
.fieldset .form-grid { max-width: none; }
.meter i.w0 { width: 0; } .meter i.w10 { width: 10%; } .meter i.w20 { width: 20%; } .meter i.w30 { width: 30%; } .meter i.w40 { width: 40%; }
.meter i.w50 { width: 50%; } .meter i.w60 { width: 60%; } .meter i.w70 { width: 70%; } .meter i.w80 { width: 80%; } .meter i.w90 { width: 90%; } .meter i.w100 { width: 100%; }

/* Tablas de checks de la ficha: mismos anchos en todas las categorías */
.checks-table { table-layout: fixed; min-width: 58rem; }
.checks-table .c-state { width: 9.5rem; }
.checks-table .c-check { width: 13rem; }
.checks-table .c-date { width: 10rem; }
.checks-table td { overflow-wrap: anywhere; }

/* Opciones avanzadas plegadas y campo con prefijo (formulario de cliente) */
.advanced { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1rem; }
.advanced summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.advanced[open] summary { color: var(--ink); }
.prefixed { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); overflow: hidden; }
.prefixed span { display: flex; align-items: center; padding: 0 .6rem 0 .9rem; color: var(--muted); font-family: var(--mono); font-size: .85rem; white-space: nowrap; }
.prefixed input { border: 0 !important; border-radius: 0 !important; min-width: 0; font-family: var(--mono); }
.has-error .prefixed { border-color: var(--down); }
@media (max-width: 30rem) { .prefixed { flex-direction: column; } .prefixed span { padding-top: .5rem; } }

/* ── Menú lateral plegable (spec 013, CU-30) ── */
.side-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.fold-form { margin: 0; }
.fold-button { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.fold-button:hover { background: var(--surface-2); color: var(--ink); }
.sidebar a, .sidebar-account a, .fold-button, .side-head .brand-link { position: relative; }

@media (min-width: 48rem) {
  .app-grid.nav-folded { grid-template-columns: 76px minmax(0, 1fr); }
  .nav-folded .side { padding-left: .6rem; padding-right: .6rem; align-items: center; }
  .nav-folded .side-head { flex-direction: column; }
  .nav-folded .brand-name, .nav-folded .side .nav-label {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .nav-folded .sidebar a, .nav-folded .sidebar-account a { justify-content: center; padding-left: 0; padding-right: 0; width: 48px; }
  .nav-folded .fold-button svg { transform: scaleX(-1); }

  /* Etiqueta emergente: solo con el menú plegado, al pasar el ratón o al llegar con el teclado */
  .nav-folded .side [data-tip]:hover::after, .nav-folded .side [data-tip]:focus-visible::after {
    content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
    background: var(--ink); color: var(--bg); font-size: .85rem; font-weight: 700; padding: .35rem .6rem; border-radius: 8px;
    white-space: nowrap; z-index: 60; pointer-events: none; box-shadow: var(--shadow); }
  .nav-folded .side [data-tip]:hover::before, .nav-folded .side [data-tip]:focus-visible::before {
    content: ""; position: absolute; left: calc(100% + 4px); top: 50%; transform: translateY(-50%);
    border: 6px solid transparent; border-right-color: var(--ink); z-index: 60; }
}

/* ── Selector de idioma (spec 014) ── */
.public-top { gap: .5rem; align-items: center; }
.lang-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.lang-switch form { margin: 0; }
.lang-button { font: inherit; font-size: .88rem; font-weight: 700; border: 0; background: transparent; color: var(--muted); padding: .35rem .8rem; border-radius: 999px; cursor: pointer; min-height: 32px; }
.lang-button:hover { color: var(--ink); }
.lang-button[aria-current="true"] { background: var(--brand-soft); color: var(--brand); }
.lang-choices { border: 0; padding: 0; margin: 0; display: grid; gap: .5rem; max-width: 26rem; }

/* ── Sitios y checks (spec 015) ── */
/* Fecha en formularios */
.field input[type="date"], .inline-date input[type="date"] { font: inherit; color: var(--ink); background: var(--surface-2); border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); padding: .65rem .9rem; min-height: 48px; }

/* Acciones de la cabecera de un sitio */
.site-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-left: auto; align-items: center; }
.site-actions form { margin: 0; }

/* Menú desplegable sin JavaScript (<details>) */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: "▾"; margin-left: .45rem; font-size: .8em; }
.menu-pop { position: absolute; right: 0; top: calc(100% + .35rem); z-index: 20; min-width: 13rem; display: grid; gap: .15rem;
  padding: .4rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.menu-pop form { margin: 0; }
.menu-pop button { width: 100%; text-align: left; font: inherit; font-weight: 600; background: none; border: 0; color: var(--ink);
  padding: .55rem .7rem; border-radius: 8px; cursor: pointer; }
.menu-pop button:hover, .menu-pop button:focus-visible { background: var(--surface-2); }
.menu-pop .menu-note { color: var(--muted); font-size: .82rem; padding: .3rem .7rem .1rem; margin: 0; }

/* Estado del sitio en una franja (pausado o desactivado) */
.banner-quiet { background: color-mix(in srgb, var(--nodata) 10%, var(--surface)); border-color: color-mix(in srgb, var(--nodata) 35%, transparent); }
.banner form { margin: 0; }

/* Ficha: tarjeta del dominio */
.inline-date { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; }
.inline-date .field { margin-top: 0; }
.inline-date .button, .inline-date .button-quiet { margin-top: 0; }
.auto-date { font-size: 1.35rem; font-weight: 800; }

/* Configuración de checks */
.check-list { display: grid; gap: .6rem; }
.check-item { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.check-item > summary { display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center;
  padding: .75rem 1rem; cursor: pointer; list-style: none; }
.check-item > summary > .pill, .check-item .sev { flex: none; }
.check-item .params { flex: 1 1 14rem; }
.check-item > summary::-webkit-details-marker { display: none; }
.check-item > summary::after { content: "▾"; color: var(--brand); font-weight: 700; font-size: 1rem; margin-left: auto; }
.check-item[open] > summary::after { content: "▴"; }
.check-item[open] > summary { border-bottom: 1px solid var(--line); }
.check-item .sev { font-size: .88rem; font-weight: 700; color: var(--muted); }
.check-item .params { color: var(--muted); font-size: .9rem; min-width: 0; overflow-wrap: anywhere; }
.check-item .check-body { padding: .25rem 1rem 1.1rem; }
.check-item .check-body .form-grid { max-width: 46rem; }
.check-item.off > summary code { text-decoration: line-through; color: var(--muted); }
.check-foot { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: end; justify-content: space-between; border-top: 1px dashed var(--line);
  margin-top: 1.25rem; padding-top: 1rem; }
.check-foot form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; margin: 0; }
.check-foot .field { margin-top: 0; min-width: 16rem; }
.badge-base { font-size: .78rem; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: .05rem .5rem; margin-left: .4rem; }

/* Añadir un check: opciones como fichas */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chips a { display: inline-flex; flex-direction: column; gap: .1rem; text-decoration: none; color: var(--ink); border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); padding: .55rem .85rem; background: var(--surface-2); min-width: 11rem; }
.chips a:hover, .chips a:focus-visible { border-color: var(--brand); }
.chips a b { font-size: .95rem; }
.chips a small { color: var(--muted); font-size: .82rem; }
.chips a[aria-disabled="true"] { opacity: .55; pointer-events: none; }

/* Lista de checks que se crearán */
.base-checks { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0 0; padding: 0; list-style: none; }
.base-checks li code { font-size: .82rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: .1rem .4rem; }

textarea { font: inherit; color: var(--ink); background: var(--surface-2); border: 1.5px solid var(--line); border-radius: var(--radius-sm); padding: .65rem .9rem; width: 100%; min-height: 5.5rem; font-family: var(--mono); font-size: .9rem; }

/* ── Avisos y mantenimiento (spec 016) ── */
.field input[type="datetime-local"] { font: inherit; color: var(--ink); background: var(--surface-2); border: 1.5px solid var(--line);
  border-radius: var(--radius-sm); padding: .65rem .9rem; min-height: 48px; }
.kind { display: inline-flex; align-items: center; gap: .4rem; font-weight: 700; white-space: nowrap; }
.kind svg { width: 1.1rem; height: 1.1rem; }
.dest { font-family: var(--mono); font-size: .88rem; overflow-wrap: anywhere; }
.table .dest { white-space: nowrap; }
.test-state { font-size: .85rem; color: var(--muted); }
.test-state.ok { color: var(--ok); } .test-state.bad { color: var(--down); }
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.row-actions form { margin: 0; }
.card-head .actions { gap: .5rem; }
.config-note { font-size: .82rem; color: var(--muted); font-style: italic; }
.choice-list { display: grid; gap: .35rem; margin-top: .35rem; }
.choice-list label { display: flex; gap: .55rem; align-items: center; font-weight: 600; }
.choice-list input { width: 1.1rem; height: 1.1rem; accent-color: var(--brand); }
.sites-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .25rem 1rem; margin: .4rem 0 0 1.7rem; }
.banner-maint { background: color-mix(in srgb, var(--maint) 10%, var(--surface)); border-color: color-mix(in srgb, var(--maint) 35%, transparent); }
.steps { margin: .5rem 0 1rem 1.2rem; display: grid; gap: .3rem; font-weight: 600; }

/* Spec 017: «Mi empresa» */
.you { color: var(--muted); font-weight: 600; }
.counter { color: var(--muted); font-size: .9rem; }

/* Spec 018: orden de los servicios de la página de estado */
.order { width: 4.5rem; }

/* Spec 019: informe completo en el panel y su hoja de impresión (A4). */
.report-head { margin: 0 0 1.25rem; }
.report-head h2 { margin: .15rem 0 0; font-size: 2rem; line-height: 1.15; font-weight: 800; letter-spacing: -0.015em; }
.report-period { margin: .2rem 0 .35rem; font-size: 1.15rem; font-weight: 600; }
.report-summary h2, .report-site h2 { margin: 0; font-size: 1.25rem; }
.report-site h3 { margin: 1.4rem 0 .5rem; font-size: 1rem; }
.verdict { --c: var(--ok); margin: .9rem 0 1rem; padding: .8rem 1rem; border-left: 5px solid var(--c); border-radius: 8px;
  background: color-mix(in srgb, var(--c) 10%, var(--surface)); font-size: 1.1rem; font-weight: 700; }
.verdict.warn { --c: var(--warn); }
.verdict.down { --c: var(--down); }
.report-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-top: 1rem; }
.report-kpis > div { padding: .7rem .9rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.report-kpis .kpi-label { display: block; color: var(--muted); font-size: .85rem; }
.report-kpis .kpi-value { display: block; font-size: 1.35rem; font-weight: 800; }
.report-site .ribbon { position: relative; height: 1.9rem; border-radius: 5px; overflow: hidden; }
.report-site .ribbon svg { display: block; width: 100%; height: 100%; }
.ribbon-n7::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(100% / 7 - 2px), var(--surface) calc(100% / 7 - 2px), var(--surface) calc(100% / 7)); }
.ribbon-n28::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(100% / 28 - 2px), var(--surface) calc(100% / 28 - 2px), var(--surface) calc(100% / 28)); }
.ribbon-n29::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(100% / 29 - 2px), var(--surface) calc(100% / 29 - 2px), var(--surface) calc(100% / 29)); }
.ribbon-n30::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(100% / 30 - 2px), var(--surface) calc(100% / 30 - 2px), var(--surface) calc(100% / 30)); }
.ribbon-n31::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(90deg, transparent 0, transparent calc(100% / 31 - 2px), var(--surface) calc(100% / 31 - 2px), var(--surface) calc(100% / 31)); }
.report-site .d-ok { fill: var(--ok); } .report-site .d-warn { fill: var(--warn); }
.report-site .d-down { fill: var(--down); } .report-site .d-none { fill: var(--line); }
.report-site .ribbon-foot { display: flex; justify-content: space-between; margin-top: .3rem; color: var(--muted); font-size: .85rem; }
.perf { display: block; width: 100%; max-width: 36rem; height: auto; }
.perf text { fill: var(--muted); font-size: 12px; font-family: var(--font); }
.perf .axis { stroke: var(--line); }
.bar-p95 { fill: var(--brand); }
.bar-p50 { fill: color-mix(in srgb, var(--brand) 40%, var(--surface)); }
.legend-inline { display: flex; gap: 1.2rem; margin: .4rem 0 0; color: var(--muted); font-size: .85rem; }
.legend-inline span { display: inline-flex; align-items: center; gap: .4rem; }
.legend-inline i { width: .8rem; height: .8rem; border-radius: 3px; }
.sw-p95 { background: var(--brand); }
.sw-p50 { background: color-mix(in srgb, var(--brand) 40%, var(--surface)); }
.report-foot { margin-top: 1.5rem; }
@media (max-width: 30rem) { .report-kpis { grid-template-columns: 1fr; } }

@media print {
  @page { size: A4; margin: 14mm 12mm; }
  :root { --bg: #FFFFFF; --surface: #FFFFFF; }
  body { background: #FFFFFF; font-size: 11pt; }
  .sidebar, .topbar, .no-print, .notice { display: none !important; }
  .app-grid { display: block; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #DDE0EA; break-inside: avoid; }
  .report-site { break-before: page; }
  .table-wrap { overflow: visible; }
  tr { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
