/* Monitor POS · CLARIVO. Paleta de marca Variante 2 (uso exclusivo en dashboards):
   negro azulado #0B121C, blanco #FFFFFF, turquesa #16A39A, ámbar secundario #C98A46 (solo en el isotipo).
   Los neutros son matices del negro azulado. Los colores de estado quedan reservados y separados de la marca. */
:root {
  color-scheme: light;
  --bg: #F4F6F8;
  --surface: #FFFFFF;
  --surface-2: #EDF0F3;
  --border: #DCE1E7;
  --border-strong: #B4BDC8;
  --text: #0B121C;
  --text-2: #46515E;
  --text-3: #5B6674;
  --accent: #16A39A;
  --accent-ink: #0B121C;
  --on-accent: #0B121C;
  --meter-track: #FFFFFF;
  --meter-fill: #16A39A;
  --tick: #0B121C;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --warning-ink: #9a6700;
  --warning-glyph: #ffffff;
  --serious-ink: #b5491f;
  --good-ink: #0a7d0a;
  --critical-bg: #fbeaea;
  --danger-ink: #a82a2a;
  --focus: #0B121C;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  --radius: 12px;
  --tab-h: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0B121C;
    --surface: #121C28;
    --surface-2: #1A2533;
    --border: #243243;
    --border-strong: #3A4B5E;
    --text: #FFFFFF;
    --text-2: #C3CCD7;
    --text-3: #97A4B3;
    --accent: #16A39A;
    --accent-ink: #16A39A;
    --on-accent: #0B121C;
    --meter-track: #163A3C;
    --meter-fill: #16A39A;
    --tick: #FFFFFF;
    --critical-bg: #3a1d1c;
    --danger-ink: #f08a8a;
    --warning-ink: #fab219;
    --warning-glyph: #1a1a19;
    --serious-ink: #ec835a;
    --good-ink: #5ccf5c;
    --focus: #16A39A;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B121C; --surface: #121C28; --surface-2: #1A2533; --border: #243243; --border-strong: #3A4B5E;
  --text: #FFFFFF; --text-2: #C3CCD7; --text-3: #97A4B3; --accent: #16A39A; --accent-ink: #16A39A;
  --meter-track: #163A3C; --meter-fill: #16A39A; --tick: #FFFFFF; --critical-bg: #3a1d1c; --danger-ink: #f08a8a;
  --warning-ink: #fab219; --warning-glyph: #1a1a19; --serious-ink: #ec835a; --good-ink: #5ccf5c;
  --focus: #16A39A; --shadow: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (pointer: fine) { html { overscroll-behavior: none; } }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
h1, h2, h3 { text-wrap: balance; margin: 0; line-height: 1.2; }
h2 { font-size: 20px; }
h3 { font-size: 15px; }
p { margin: 0; }
a { color: var(--accent-ink); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 8px; top: -48px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { top: 8px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- arranque e inicio de sesión ---------- */
.boot { display: grid; place-items: center; min-height: 100dvh; color: var(--text-2); }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: min(380px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 28px 24px; display: grid; gap: 8px; box-shadow: var(--shadow);
}
.login-logo { display: block; line-height: 0; margin-bottom: 12px; }
.login-logo img { width: 170px; height: auto; }
.login-card h1 { font-size: 24px; }
.login-card p.muted { margin-bottom: 12px; }
.login-card label { font-weight: 600; font-size: 14px; margin-top: 4px; }
.login-card .btn { margin-top: 12px; }
input, select {
  width: 100%; min-height: 44px; padding: 8px 12px; border-radius: 10px;
  font-size: 16px; /* menos de 16 px hace que Safari en iPhone acerque la página al enfocar */
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
}
.form-error { color: var(--danger-ink); font-size: 14px; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary:hover { background: #2a78d6; border-color: #2a78d6; } }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { color: var(--danger-ink); }
.btn-sm { min-height: 44px; padding: 6px 14px; font-size: 14px; } /* 44 pt también con trackpad o ratón */
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-row.end { justify-content: flex-end; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; }

/* ---------- estructura ---------- */
.shell { min-height: 100dvh; padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px); }
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand picture { flex: none; display: block; line-height: 0; }
.brand-logo img { width: auto; height: 44px; }
.brand-iso img { width: 28px; height: 28px; }
.brand .brand-logo { display: none; }
@media (min-width: 768px) { .brand .brand-logo { display: block; } .brand .brand-iso { display: none; } .brand-text { border-left: 1px solid var(--border); padding-left: 12px; } }
.brand > div { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-weight: 700; }
.demo-badge { font-size: 12px; color: var(--text-2); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
#updated { font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (min-width: 560px) { #updated { font-size: 13px; } }
@media (max-width: 559px) { .upd-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }
.demo-badge { white-space: nowrap; }

.tabs {
  position: fixed; inset: auto 0 0 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-2); text-decoration: none; font-size: 12px; font-weight: 600;
}
.tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a[aria-current="page"] { color: var(--accent-ink); }
.tabs a:hover { color: var(--text); }

main { padding: 16px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)); max-width: 1240px; margin: 0 auto; outline: none; }
main > section { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; scroll-margin-top: 72px; }
main > section > * { min-width: 0; } /* una tabla ancha se desplaza dentro de su contenedor en lugar de ensanchar la página */
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.list-title { margin-top: 8px; }

@media (min-width: 768px) {
  .shell { padding-bottom: 24px; }
  .tabs {
    /* Antes: «top: 57px; inset: auto» — inset reponía top en auto y las pestañas dejaban de quedarse fijas. */
    position: sticky; top: var(--topbar-h, 57px); right: auto; bottom: auto; left: auto; height: auto; padding: 8px 16px; display: flex; gap: 4px;
    background: var(--bg); border-top: 0; border-bottom: 1px solid var(--border); justify-content: center;
  }
  .tabs a { flex-direction: row; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 999px; font-size: 14px; }
  .tabs svg { width: 18px; height: 18px; }
  .tabs a[aria-current="page"] { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
  main { padding: 24px; }
}

/* ---------- tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: grid; gap: 12px; min-width: 0; }
.projects { display: grid; gap: 16px; }
@media (min-width: 900px) { .projects { grid-template-columns: 1fr 1fr; } }

.project-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.project-head h3 { font-size: 18px; }
.project-head .muted { font-size: 13px; overflow-wrap: anywhere; }

.status {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 6px; border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.status svg { width: 16px; height: 16px; flex: none; }
.status.lg { font-size: 14px; padding: 4px 12px 4px 8px; }
.s-good { color: var(--good-ink); } .s-warning { color: var(--warning-ink); } .s-serious { color: var(--serious-ink); }
.s-critical { color: var(--critical); } .s-neutral { color: var(--text-3); } .s-info { color: var(--accent); }

.rows { display: grid; gap: 0; border-top: 1px solid var(--border); }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.row-label { font-weight: 600; }
.row-sub { grid-column: 1 / -1; color: var(--text-2); font-size: 13px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.row-sub b { color: var(--text); font-weight: 600; }

/* Medidores (meter list) */
.meters { display: grid; gap: 12px; }
.meter { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; }
.meter-name { font-weight: 600; font-size: 14px; }
.meter-name small { display: block; font-weight: 400; color: var(--text-2); font-size: 12px; }
.meter-fig { font-variant-numeric: tabular-nums; font-size: 14px; text-align: right; display: inline-flex; align-items: center; gap: 4px; }
.meter-fig svg { width: 15px; height: 15px; }
.mbar { grid-column: 1 / -1; position: relative; height: 8px; margin: 4px 0; border-radius: 4px; background: var(--meter-track); }
.mbar.na { background: repeating-linear-gradient(135deg, var(--border-strong) 0 2px, transparent 2px 7px); }
.mfill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 4px; background: var(--meter-fill); }
.mtick { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--tick); box-shadow: 0 0 0 1px var(--surface); }
.meter.unavailable .meter-fig { color: var(--text-2); }
.meter-scale { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 10px; font-size: 11px; color: var(--text-3); }

.kind { display: inline-block; font-size: 12px; font-weight: 600; letter-spacing: 0.02em; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text-2); vertical-align: 1px; white-space: nowrap; }
.kind-sim { border-style: solid; }
.kind-proj { border-style: dashed; border-color: var(--accent); color: var(--accent-ink); }
.kind-na { border-style: dotted; color: var(--text-3); }
.legend-line { line-height: 1.8; }

/* Línea de pulso de latencia */
.spark-wrap { display: grid; gap: 6px; }
.spark-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-2); }
.spark { width: 100%; height: 64px; display: block; touch-action: pan-y; cursor: crosshair; }
.spark .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark .grid { stroke: var(--border); stroke-width: 1; }
.spark .fail { fill: var(--critical); }
.spark .cursor { stroke: var(--text-3); stroke-width: 1; }
.spark .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.tooltip {
  position: fixed; z-index: 60; pointer-events: none; background: var(--text); color: var(--bg); padding: 6px 10px;
  border-radius: 8px; font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px));
}

.banner { display: flex; gap: 12px; align-items: flex-start; background: var(--critical-bg); border: 1px solid var(--critical); border-radius: var(--radius); padding: 12px 16px; }
.banner svg { width: 22px; height: 22px; color: var(--critical); flex: none; margin-top: 1px; }
.banner + .banner { margin-top: 8px; }

/* ---------- línea de tiempo ---------- */
.filter { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; }
.filter button { border: 0; background: transparent; min-height: 44px; padding: 6px 14px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.filter button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 0 12px; position: relative; padding-bottom: 16px; }
.tl-item::before { content: ""; position: absolute; left: 13px; top: 28px; bottom: 0; width: 2px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-icon { width: 28px; height: 28px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); display: grid; place-items: center; }
.tl-icon svg { width: 16px; height: 16px; }
.tl-body { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 4px; min-width: 0; }
.tl-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tl-title { font-weight: 650; }
.tl-msg { color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }
.empty { padding: 24px; text-align: center; color: var(--text-2); background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); }

/* ---------- resumen ---------- */
.summary-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .summary-grid { grid-template-columns: 1fr 1fr; } }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 12px; }
.kv > div { display: contents; }
.kv dt, .kv dd { padding: 8px 0; border-bottom: 1px solid var(--border); margin: 0; }
.kv dt { color: var(--text-2); font-size: 14px; }
.kv dd { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.kv dd .kind { margin-left: 6px; }
.kv .note { grid-column: 1 / -1; font-size: 12.5px; color: var(--text-2); padding: 4px 0 8px; border-bottom: 1px solid var(--border); }

/* ---------- avisos ---------- */
.device-status { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hint { background: var(--surface-2); border-radius: 10px; padding: 12px; font-size: 14px; color: var(--text-2); }
.hint b { color: var(--text); }
.stages-explain { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--text-2); font-size: 14px; }
.stages-explain b { color: var(--text); }
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12.5px; color: var(--text-2); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.steps { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; }
.step { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); white-space: nowrap; }
.step svg { width: 14px; height: 14px; }
.step.done { color: var(--text); }
.step.fail { color: var(--danger-ink); }
.delivery { display: grid; gap: 4px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.delivery:last-child { border-bottom: 0; }
.delivery-head { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.delivery-head b { overflow-wrap: anywhere; }

/* ---------- escenarios ---------- */
.scenarios { display: grid; gap: 16px; }
@media (min-width: 768px) { .scenarios { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1180px) { .scenarios { grid-template-columns: 1fr 1fr 1fr; } }
.scenario { align-content: start; }
.scenario label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.scenario-state { font-size: 14px; font-variant-numeric: tabular-nums; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field-row > div { display: grid; gap: 4px; min-width: 0; }

dialog { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); padding: 20px; width: min(420px, calc(100% - 32px)); overscroll-behavior: contain; }
dialog::backdrop { background: rgb(0 0 0 / 0.45); }
dialog form { display: grid; gap: 12px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 12px); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 70;
  max-width: calc(100% - 32px); opacity: 0; transition: opacity 160ms ease; pointer-events: none;
}
.toast.show { opacity: 1; }
@media (min-width: 768px) { .toast { bottom: 24px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- teclado en pantalla (iPhone y tablet en vertical) ---------- */
/* Con el teclado abierto, la barra inferior fija tapa el campo y el botón: se oculta mientras se escribe. */
@media (max-width: 767px) {
  body:has(:is(input:not([type="checkbox"]), select, textarea):focus) .tabs { display: none; }
  body:has(:is(input:not([type="checkbox"]), select, textarea):focus) .shell { padding-bottom: 16px; }
}

/* ---------- dispositivos inscritos en pantallas estrechas: lista en lugar de tabla ---------- */
@media (max-width: 559px) {
  .devices-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .devices-table, .devices-table tbody, .devices-table tr, .devices-table td { display: block; }
  .devices-table tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .devices-table tr:last-child { border-bottom: 0; }
  .devices-table td { padding: 0; border: 0; text-align: left; }
  .devices-table td[data-label] { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
  .devices-table td[data-label]::before { content: attr(data-label); color: var(--text-2); }
  .devices-table .dev-name { overflow-wrap: anywhere; }
  .devices-table .dev-actions { grid-column: 2; grid-row: 1; align-self: start; }
}

/* ---------- requiere atención ---------- */
.attention { display: grid; gap: 10px; }
.attention-count { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.block-title { margin: 4px 0 10px; font-size: 16px; }
.alerts { display: grid; gap: 10px; }
.alert { display: grid; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.alert.sev-critical { border-color: var(--critical); border-left-color: var(--critical); background: var(--critical-bg); }
.alert.sev-serious { border-left-color: var(--serious-ink); }
.alert.sev-warning { border-left-color: var(--warning-ink); }
.alert.sev-good { border-left-color: var(--good); }
.alert-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; }
.alert-icon svg { width: 22px; height: 22px; display: block; margin-top: 2px; }
.alert-meta { margin: 0; font-size: 13px; font-weight: 600; color: var(--text-2); }
.alert-title { margin: 2px 0 0; font-size: 17px; line-height: 1.25; text-wrap: balance; }
.alert-detail { margin: 4px 0 0; color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }
.alert-since { margin: 4px 0 0; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.all-ok { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-2); }

.diag { border-top: 1px solid var(--border); padding-top: 4px; }
.diag summary { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; font-weight: 600; color: var(--accent-ink); list-style: none; border-radius: 8px; }
.diag summary::-webkit-details-marker { display: none; }
.diag summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.15s ease; margin: 0 4px; }
.diag[open] summary::before { transform: rotate(45deg); }
@media (prefers-reduced-motion: reduce) { .diag summary::before { transition: none; } }
.diag dl { display: grid; gap: 10px; margin: 4px 0 10px; }
.diag dt { font-size: 13px; font-weight: 600; color: var(--text-2); }
.diag dd { margin: 2px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.where { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.where li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.where a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; color: var(--accent-ink); }
.where-path { flex-basis: 100%; font-size: 13px; color: var(--text-2); }
.kind-sug { border-style: dashed; }
.kind-stale { border-color: var(--warning-ink); color: var(--warning-ink); }

/* ---------- proyectos ---------- */
.project-head h4 { margin: 0; font-size: 18px; }
.project-avail { margin: 2px 0 0; font-size: 13px; color: var(--text-2); }
.svcs { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.svc { display: grid; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.svc:last-child { border-bottom: 0; padding-bottom: 0; }
.svc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.svc-label { font-weight: 600; }
.svc-ev { margin: 0; font-size: 14px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.svc-meta { margin: 0; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.recovered { color: var(--good-ink); font-weight: 600; }
.spark { height: 44px; }
.spark .thr { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.spark .gap { fill: var(--critical); opacity: 0.12; }
.spark-cap { font-size: 12px; color: var(--text-2); }

/* ---------- capacidad ---------- */
.capacity { display: grid; gap: 16px; }
@media (min-width: 768px) { .capacity { grid-template-columns: 1fr 1fr; } }
.cap .project-head h4 { font-size: 16px; }
.cmeter { display: grid; gap: 4px; }
.cmeter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; }
.cmeter-name { font-weight: 600; font-size: 14px; }
.cmeter-name small { display: block; font-weight: 400; color: var(--text-2); font-size: 12px; }
.cmeter-fig { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-variant-numeric: tabular-nums; }
.cmeter-fig svg { width: 16px; height: 16px; }
.cmeter-scale { font-size: 12px; color: var(--text-2); text-align: right; }
.mbar.stale .mfill { opacity: 0.55; }
.mbar.stale::after { content: ""; position: absolute; inset: 0; border-radius: 4px; background: repeating-linear-gradient(135deg, var(--surface) 0 2px, transparent 2px 7px); opacity: 0.6; }
.stale-note { margin: 0; font-size: 13px; color: var(--text-2); }
.estimate, .cap-extra { margin: 0; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.estimate .kind, .cap-extra .kind { margin-right: 4px; }

/* ---------- tablet: atención a la izquierda, proyectos a la derecha ---------- */
@media (min-width: 900px) {
  #tab-estado { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: start; }
  /* Sin «position: sticky» en la columna de alertas: si era más alta que la ventana, se quedaba
     inmóvil mientras el resto avanzaba y sus últimas alertas no se podían ver (fallo de scroll). */
  #tab-estado > .conn-banner, #tab-estado > .synth { grid-column: 1 / -1; }
  #tab-estado > .attention { grid-column: 1; }
  #tab-estado > section:nth-of-type(3) { grid-column: 2; }
  #tab-estado > section:nth-of-type(4), #tab-estado > .legend-line { grid-column: 1 / -1; }
  #tab-estado .projects { grid-template-columns: minmax(0, 1fr); }
}

/* Signo de exclamación del icono de aviso: contrasta con el ámbar de cada tema. */
.glyph-s { stroke: var(--warning-glyph); } .glyph-f { fill: var(--warning-glyph); }

/* ---------- desplazamiento ---------- */
/* El cliente conserva el punto de lectura por su cuenta (Safari no tiene anclaje de scroll);
   se desactiva el anclaje automático para que no se compense dos veces. */
html { overflow-anchor: none; scroll-padding-top: calc(var(--topbar-h, 57px) + var(--tabs-h, 0px) + 8px); }
[data-anchor] { scroll-margin-top: calc(var(--topbar-h, 57px) + var(--tabs-h, 0px) + 8px); }

/* ---------- conexión con el monitor ---------- */
.conn-banner[hidden] { display: none; }
.conn-banner { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; align-items: start; padding: 12px 14px; border: 1px solid var(--serious-ink); border-left-width: 4px; border-radius: var(--radius); background: var(--surface); }
.conn-banner svg { width: 22px; height: 22px; display: block; }
.conn-banner p { margin: 2px 0 0; font-size: 14px; color: var(--text-2); }
.conn-banner .btn { grid-column: 2; justify-self: start; }
.conn-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good-ink); margin-right: 6px; vertical-align: 1px; }
.conn-dot.off { background: transparent; border: 2px solid var(--serious-ink); width: 9px; height: 9px; }

/* ---------- síntesis de los POS ---------- */
.synth-grid { display: grid; gap: 10px; }
@media (min-width: 600px) { .synth-grid { grid-template-columns: 1fr 1fr; } }
.synth-item { display: grid; gap: 6px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--good-ink); border-radius: var(--radius); box-shadow: var(--shadow); }
.synth-item.sev-critical { border-left-color: var(--critical); }
.synth-item.sev-serious { border-left-color: var(--serious-ink); }
.synth-item.sev-warning, .synth-item.sev-neutral { border-left-color: var(--warning-ink); }
.synth-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.synth-top h4 { margin: 0; font-size: 17px; }
.synth-problem { margin: 0; font-weight: 600; font-size: 15px; }
.synth-fresh, .synth-recent { margin: 0; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.synth-recent svg { width: 14px; height: 14px; vertical-align: -2px; }
.synth-recent a { color: var(--accent-ink); font-weight: 600; display: inline-flex; align-items: center; min-height: 44px; }
.synth-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- alertas compactas ---------- */
.alert-when, .alert-scope, .alert-cause { margin: 0; font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.alert-when { margin-top: 2px; font-size: 13px; }
.alert-scope .lbl { font-weight: 600; color: var(--text); }
.alert-cause { font-weight: 600; }
.alert-detail { margin: 0; }
.diag summary { color: var(--accent-ink); }

/* ---------- detalle bajo demanda en proyectos ---------- */
.more { border-top: 1px solid var(--border); padding-top: 4px; }
.more summary { display: flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; font-weight: 600; color: var(--accent-ink); list-style: none; }
.more summary::-webkit-details-marker { display: none; }
.more summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); margin: 0 4px; }
.more[open] summary::before { transform: rotate(45deg); }
.more .spark-wrap { margin-top: 8px; }
.spark-title { font-size: 13px; font-weight: 600; }
.hosts { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
.hosts li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.project:focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.version { margin-top: 8px; }

/* ---------- CLARIVO: enlaces y botones con turquesa ---------- */
/* En claro, el turquesa no alcanza 4,5:1 como texto: los enlaces van en tinta con subrayado turquesa;
   los botones principales usan turquesa de fondo con texto negro azulado (5,9:1). */
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: #128C84; border-color: #128C84; color: var(--on-accent); }
.diag summary, .more summary, .where a, .synth-recent a { color: var(--accent-ink); text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.tabs a[aria-current="page"] { color: var(--text); box-shadow: inset 0 -3px 0 var(--accent); }
@media (min-width: 768px) { .tabs a[aria-current="page"] { box-shadow: inset 0 0 0 1px var(--border), inset 0 -3px 0 var(--accent); } }
.spark .line { stroke: var(--accent); }

/* Medidores: pista con borde para que el relleno turquesa contraste ≥ 3:1 (blanco en claro, verde azulado oscuro en oscuro). */
.mbar { box-shadow: inset 0 0 0 1px var(--border-strong); }
