/* ============================================================================
   SEHL Mail — Control Center · UI v4.0.0
   Identidad SEHL: "lujo contenido" — marfil cálido, oro sobrio, navy autoridad.
   Tokens según SEHL_BRAND_IDENTITY (capa identidad + capa semántica).
   v0.9.0: tema oscuro, sidebar agrupada/colapsable, paleta de comandos,
           tablas ordenables, medidores de cuota, skeletons y accesibilidad.
   ========================================================================== */

:root {
  /* Identidad · núcleo */
  --gold: #b0894f;
  --gold-deep: #97713a;
  --gold-soft: #f3ebdc;
  --gold-ondark: #d8b676;
  --navy: #1f2a3c;
  --navy-2: #18202e;          /* navy más profundo: cards sobre navy */
  --navy-soft: #e7ebf1;
  --ink: #1b1f2a;
  --ivory: #faf8f4;
  /* Neutros */
  --bg: #faf8f4;
  --bg-2: #f3efe8;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --line: #e8e3da;
  --line-soft: #f0ece4;
  --ink-soft: #555c6b;
  --ink-faint: #8a909c;
  /* Semántica */
  --ok: #2f8f5b;      --ok-soft: #e7f3ec;
  --warn: #c98a25;    --warn-soft: #faf0db;
  --danger: #c0492f;  --danger-soft: #f8e8e3;
  --info: #2f6f9f;    --info-soft: #e6eef5;
  /* Sombra / geometría */
  --sh-1: 0 1px 2px rgba(27,31,42,.05);
  --sh-2: 0 10px 30px rgba(27,31,42,.10);
  --sh-3: 0 18px 50px rgba(27,31,42,.18);
  --focus: 0 0 0 3px rgba(176,137,79,.28);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar: 256px;
  --row-pad: 12px;            /* densidad de tabla */
  /* Sidebar (se invierte en oscuro para que no sea un bloque negro) */
  --side-bg: var(--navy);
  --side-fg: #c3c9d4;
  --side-fg-strong: #f4f1ec;
  --side-muted: #8d97a8;
  --side-hover: rgba(255,255,255,.06);
  --side-line: rgba(255,255,255,.09);
  --side-active-bg: rgba(216,182,118,.13);
  /* Tipografía */
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  color-scheme: light;
}

/* ---------------------------------------------------------------- TEMA OSCURO
   Mismos tokens de identidad; el oro se aclara a --gold-ondark para contraste.
   Alineado con el tema oscuro del webmail para que ambos se vean como uno. */
[data-theme="dark"] {
  --gold: #d8b676;
  --gold-deep: #c8a25f;
  --gold-soft: #33301f;
  --gold-ondark: #d8b676;
  --navy: #1f2a3c;
  --navy-2: #151c28;
  --navy-soft: #26304a;
  --ink: #f0ede6;
  --ivory: #151a24;
  --bg: #141922;
  --bg-2: #181e2a;
  --surface: #1e2634;
  --surface-2: #222b3a;
  --line: #2c3648;
  --line-soft: #273041;
  --ink-soft: #b7bec9;
  --ink-faint: #828a99;
  --ok: #4fae79;      --ok-soft: #1e3229;
  --warn: #d9a54a;    --warn-soft: #39301d;
  --danger: #d76a52;  --danger-soft: #3a241f;
  --info: #5f9cc7;    --info-soft: #1f2d3a;
  --sh-1: 0 1px 2px rgba(0,0,0,.3);
  --sh-2: 0 10px 30px rgba(0,0,0,.45);
  --sh-3: 0 18px 50px rgba(0,0,0,.6);
  --focus: 0 0 0 3px rgba(216,182,118,.30);
  --side-bg: #111721;
  --side-fg: #aab2be;
  --side-fg-strong: #f0ede6;
  --side-muted: #767e8c;
  --side-hover: rgba(255,255,255,.05);
  --side-line: rgba(255,255,255,.07);
  --side-active-bg: rgba(216,182,118,.11);
  color-scheme: dark;
}

/* Densidad compacta de tablas */
[data-density="compact"] { --row-pad: 7px; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 14px; line-height: 1.55; }
body { transition: background .25s ease, color .25s ease; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, a { transition: .16s ease; }
.hidden { display: none !important; }
code { font-family: var(--mono); font-size: .86em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }
::selection { background: rgba(176,137,79,.24); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }
.skip-link { position: fixed; z-index: 1000; inset-block-start: 10px; inset-inline-start: 10px; padding: 9px 13px;
  border-radius: 9px; background: var(--navy); color: #fff; text-decoration: none; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); box-shadow: var(--focus); }
[hidden] { display: none !important; }
[data-capability-disabled] { opacity: .48 !important; cursor: not-allowed !important; }

/* Voz editorial: serif en titulares y marca */
.brand-lockup strong, .login-copy h1, .hero-panel h2, .hero-orbit b,
.topbar h1, .panel-heading h3, .secret-dialog h2, .palette-empty strong { font-family: var(--serif); }

.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-deep); margin: 0; }
[data-theme="dark"] .eyebrow { color: var(--gold); }

kbd { font-family: var(--mono); font-size: 10.5px; background: var(--bg-2); border: 1px solid var(--line);
  border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; color: var(--ink-soft); }

/* ============================================================ LOGIN */
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 32px; position: relative; overflow: hidden;
  background: var(--bg); }
.ambient { position: absolute; border-radius: 50%; opacity: .8; pointer-events: none; }
.ambient-a { width: 640px; height: 640px; background: radial-gradient(circle, rgba(176,137,79,.10), transparent 66%); top: -220px; right: -120px; }
.ambient-b { width: 520px; height: 520px; background: radial-gradient(circle, rgba(31,42,60,.06), transparent 66%); bottom: -200px; left: -140px; }
[data-theme="dark"] .ambient-a { background: radial-gradient(circle, rgba(216,182,118,.09), transparent 66%); }
[data-theme="dark"] .ambient-b { background: radial-gradient(circle, rgba(95,156,199,.07), transparent 66%); }
.login-card { position: relative; width: min(440px, 100%); padding: 40px 38px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--sh-2); }
.login-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand-lockup { display: flex; align-items: center; gap: 13px; }
.brand-lockup strong { display: block; font-size: 19px; font-weight: 600; letter-spacing: .01em; }
.brand-lockup small { display: block; color: var(--ink-faint); margin-top: 1px; font-size: 12px; }
.brand-mark { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--gold), var(--gold-deep)); box-shadow: 0 6px 18px rgba(151,113,58,.35); }
.brand-mark span { font-family: var(--serif); font-weight: 600; font-size: 21px; color: #fff; }
.login-copy { margin: 36px 0 26px; }
.login-copy h1 { font-size: clamp(26px, 4.5vw, 33px); font-weight: 500; line-height: 1.14; margin: 10px 0 12px; letter-spacing: -.01em; }
.login-copy p:last-child { color: var(--ink-soft); line-height: 1.6; margin: 0; }
.login-foot { display: flex; align-items: center; gap: 9px; color: var(--ink-faint); font-size: 12px; margin-top: 26px; }
.pulse-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.password-field { position: relative; }
.password-field input { padding-inline-end: 42px; }
.password-field .reveal { position: absolute; inset-inline-end: 6px; bottom: 4px; width: 32px; height: 32px;
  border: 0; background: none; display: grid; place-items: center; cursor: pointer; border-radius: 8px; color: var(--ink-faint); }
.password-field .reveal:hover { background: var(--bg-2); color: var(--ink); }
.password-field .reveal img { width: 16px; height: 16px; }

/* ============================================================ FORMULARIOS */
.stack { display: grid; gap: 15px; }
label { display: grid; gap: 6px; color: var(--ink-soft); font-size: 12px; font-weight: 600; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); padding: 10px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: var(--focus); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check-label { display: flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 500; font-size: 13px; }
.check-label input { width: 16px; height: 16px; accent-color: var(--gold); }
.form-error { min-height: 18px; color: var(--danger); font-size: 13px; margin: 0; }
.field-hint { color: var(--ink-faint); font-size: 11px; font-weight: 500; margin: -2px 0 0; }

/* Interruptor (auto-refresco, preferencias) */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 12px;
  font-weight: 600; color: var(--ink-soft); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 36px; height: 20px; border-radius: 999px; background: var(--line); position: relative;
  transition: background .18s; flex: none; }
.switch .track:after { content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--surface); box-shadow: var(--sh-1); transition: transform .18s; }
.switch input:checked + .track { background: linear-gradient(145deg, var(--gold), var(--gold-deep)); }
.switch input:checked + .track:after { transform: translateX(16px); }
[dir="rtl"] .switch input:checked + .track:after { transform: translateX(-16px); }
.switch input:focus-visible + .track { box-shadow: var(--focus); }

/* Control segmentado (densidad, rango de gráfica) */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 10px; }
.segmented button { border: 0; background: none; padding: 4px 11px; border-radius: 7px; font-size: 11.5px;
  font-weight: 600; color: var(--ink-faint); cursor: pointer; }
.segmented button:hover { color: var(--ink); }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }

/* ============================================================ BOTONES */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px;
  padding: 8px 16px; border: 1px solid transparent; border-radius: var(--radius-sm); font-weight: 600; font-size: 13.5px;
  cursor: pointer; text-decoration: none; }
.button img { width: 17px; height: 17px; }
.button.primary { background: linear-gradient(145deg, var(--gold), var(--gold-deep)); color: #fff;
  box-shadow: 0 6px 16px rgba(151,113,58,.28); }
.button.primary img { filter: brightness(0) invert(1); }
.button.primary:hover { filter: brightness(1.05); }
.button.secondary { background: var(--navy); color: #f4f1ec; border-color: var(--navy); }
.button.secondary img { filter: brightness(0) invert(1); }
.button.secondary:hover { background: #2a3850; border-color: #2a3850; }
.button.ghost { background: var(--surface); border-color: var(--line); color: var(--ink-soft); }
.button.ghost:hover { color: var(--ink); border-color: var(--ink-faint); }
.button.ghost img { filter: none; opacity: .7; }
[data-theme="dark"] .button.ghost img,
[data-theme="dark"] .workspace img { filter: brightness(0) invert(1) opacity(.72); }
.button.danger { color: var(--danger); border-color: rgba(192,73,47,.32); background: var(--danger-soft); }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.button.full { width: 100%; }
.button.small { min-height: 32px; padding: 5px 11px; font-size: 12px; }

/* ============================================================ SHELL */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) 1fr; }
.app-shell.collapsed { --sidebar: 74px; }

/* --- Sidebar: navy de autoridad --- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); display: flex; flex-direction: column;
  padding: 22px 16px; background: var(--side-bg); z-index: 10; transition: width .18s ease; overflow: hidden auto; }
.sidebar img { filter: brightness(0) invert(1); opacity: .62; }
.brand-lockup.compact { padding: 0 6px 20px; }
.brand-lockup.compact .brand-mark { width: 40px; height: 40px; border-radius: 11px; }
.brand-lockup.compact strong { color: var(--side-fg-strong); font-size: 16px; }
.brand-lockup.compact small { color: var(--side-muted); font-size: 11px; }
.navigation { display: grid; gap: 3px; margin-top: 6px; }
.nav-group { margin-top: 14px; padding: 0 12px 5px; font-size: 9.5px; font-weight: 700; letter-spacing: .18em;
  text-transform: uppercase; color: var(--side-muted); }
.nav-group:first-child { margin-top: 0; }
.nav-item, .launch-link { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 9px;
  padding: 9px 12px; background: transparent; color: var(--side-fg); cursor: pointer; text-decoration: none; text-align: start;
  font-size: 13.5px; font-weight: 500; position: relative; }
.nav-item img, .launch-link img { width: 18px; height: 18px; flex: none; }
.nav-item span, .launch-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover, .launch-link:hover { background: var(--side-hover); color: #fff; }
.nav-item:hover img, .launch-link:hover img { opacity: .92; }
.nav-item.active { background: var(--side-active-bg); color: #fff; box-shadow: inset 3px 0 var(--gold-ondark); }
.nav-item.active img { opacity: 1; }
.nav-count { margin-inline-start: auto; font-family: var(--mono); font-size: 10px; font-weight: 600;
  color: var(--side-muted); background: rgba(255,255,255,.06); border-radius: 999px; padding: 1px 7px; }
.nav-count.alert { color: #fff; background: var(--danger); }
.nav-count.warn { color: #241a06; background: var(--gold-ondark); }
.nav-count:empty { display: none; }
.sidebar-links { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--side-line); }
.operator-card { display: grid; grid-template-columns: 34px 1fr 30px; align-items: center; gap: 9px; margin-top: 14px;
  padding: 10px 9px; border: 1px solid var(--side-line); border-radius: 12px; background: rgba(0,0,0,.18); }
.operator-card strong, .operator-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.operator-card strong { font-size: 12px; color: var(--side-fg-strong); }
.operator-card small { font-size: 10px; color: var(--side-muted); margin-top: 2px; }
.avatar { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--gold), var(--gold-deep)); color: #fff; font-weight: 600; font-family: var(--serif); }
.sidebar .icon-button { border-color: rgba(255,255,255,.14); background: transparent; }
.sidebar .icon-button:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.26); }
.sidebar-collapse { margin-top: 10px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--side-line); border-radius: 9px; background: transparent; color: var(--side-muted);
  padding: 7px; cursor: pointer; font-size: 11px; font-weight: 600; }
.sidebar-collapse:hover { background: var(--side-hover); color: var(--side-fg-strong); }
.sidebar-collapse img { width: 15px; height: 15px; }

/* Estado colapsado: sólo iconos, con tooltip nativo */
.collapsed .sidebar { padding: 22px 12px; }
.collapsed .brand-lockup.compact > div, .collapsed .nav-item span, .collapsed .launch-link span,
.collapsed .nav-group, .collapsed .operator-card > div, .collapsed .nav-count,
.collapsed .sidebar-collapse span { display: none; }
.collapsed .brand-lockup.compact { justify-content: center; padding-inline: 0; }
.collapsed .nav-item, .collapsed .launch-link { justify-content: center; padding-inline: 8px; }
.collapsed .operator-card { grid-template-columns: 1fr; justify-items: center; }
.collapsed .operator-card .icon-button { display: none; }

.icon-button { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--surface); cursor: pointer; }
.icon-button img { width: 17px; height: 17px; }
.icon-button:hover { border-color: var(--ink-faint); }
.icon-button.on { border-color: var(--gold); background: var(--gold-soft); }

/* --- Workspace --- */
.workspace { grid-column: 2; padding: 0 32px 48px; min-width: 0; }
.workspace img { filter: brightness(0) opacity(.7); }
.topbar { min-height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(14px); }
@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .topbar { background: var(--bg); }
}
.topbar h1 { font-size: 23px; font-weight: 600; margin: 3px 0 0; letter-spacing: -.01em; }
.topbar-actions { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.compact-select { min-width: 150px; }
.compact-select span { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-faint); }
.compact-select select { padding: 7px 10px; min-height: 34px; background: var(--surface); }
.topbar-tools { display: flex; align-items: center; gap: 7px; }
.session-context { min-height: 34px; display: flex; align-items: center; gap: 8px; padding: 5px 10px;
  border: 1px solid rgba(47,143,91,.28); border-radius: 9px; background: var(--ok-soft); color: var(--ok); }
.session-context > span:last-child { display: grid; line-height: 1.15; }
.session-context strong { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.session-context small { max-width: 165px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); font-size: 9.5px; }
.session-shield { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 7px;
  background: var(--ok); color: #fff; font-size: 11px; font-weight: 800; }
.profile-security small { max-width: 60%; text-align: end; overflow-wrap: anywhere; }
.palette-trigger { display: flex; align-items: center; gap: 9px; min-height: 34px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink-faint);
  cursor: pointer; font-size: 12.5px; }
.palette-trigger:hover { border-color: var(--ink-faint); color: var(--ink); }
.palette-trigger img { width: 15px; height: 15px; }
.view { display: none; padding-top: 26px; }
.view.active { display: block; animation: view-in .18s ease; }
.form-table-grid.single-column, .two-column.single-column { grid-template-columns: minmax(0, 1fr); }
@keyframes view-in { from { opacity: 0; transform: translateY(4px); } }

/* ============================================================ DASHBOARD */
/* Hero sobre navy: bloque de identidad "ondark" */
.hero-panel { min-height: 240px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(210px, .6fr);
  align-items: center; gap: 30px; padding: 40px 44px; border-radius: 20px; overflow: hidden; position: relative;
  background: linear-gradient(130deg, var(--navy) 0%, var(--navy-2) 100%); color: #f4f1ec; box-shadow: var(--sh-2); }
.hero-panel:before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 86% 18%, rgba(216,182,118,.15), transparent 38%); }
.hero-panel .eyebrow { color: var(--gold-ondark); position: relative; }
.hero-panel h2 { font-size: clamp(27px, 3.6vw, 40px); font-weight: 500; line-height: 1.1; letter-spacing: -.015em;
  margin: 12px 0 14px; max-width: 720px; position: relative; }
.hero-panel p.hero-copy { max-width: 680px; line-height: 1.65; color: #c3c9d4; margin: 0; position: relative; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; position: relative; }
.hero-fact { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid rgba(216,182,118,.28); background: rgba(216,182,118,.08); color: #e6dcc8;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .04em; }
.hero-fact i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold-ondark); flex: none; }
.hero-fact.ok i { background: #58c98b; }
.hero-fact.bad i { background: #e2765c; }
.hero-orbit { width: 190px; height: 190px; position: relative; display: grid; place-items: center; margin: auto;
  border: 1px solid rgba(216,182,118,.32); border-radius: 50%; box-shadow: inset 0 0 46px rgba(216,182,118,.08); }
.hero-orbit:before, .hero-orbit:after { content: ""; position: absolute; border: 1px solid rgba(216,182,118,.2);
  border-radius: 50%; inset: 22px; transform: rotate(60deg); }
.hero-orbit:after { inset: 43px; border-color: rgba(216,182,118,.34); transform: rotate(-30deg); }
.hero-orbit span { position: absolute; width: 6px; height: 6px; border-radius: 50%; background: var(--gold-ondark);
  box-shadow: 0 0 14px var(--gold-ondark); }
.hero-orbit span:nth-child(1) { top: 16px; }
.hero-orbit span:nth-child(2) { bottom: 34px; right: 20px; }
.hero-orbit span:nth-child(3) { left: 14px; bottom: 66px; }
.hero-orbit b { font-family: var(--serif); font-weight: 600; font-size: 25px; letter-spacing: .14em; color: #f4f1ec; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 18px 0; }
.metric-card { display: flex; align-items: center; gap: 14px; padding: 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--sh-1); text-align: start;
  cursor: pointer; width: 100%; }
.metric-card:hover { border-color: var(--gold); transform: translateY(-1px); box-shadow: var(--sh-2); }
.metric-icon { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border-radius: 11px; background: var(--gold-soft); }
.metric-icon img { width: 20px; height: 20px; }
[data-theme="dark"] .metric-icon img { filter: brightness(0) invert(1) opacity(.8); }
.metric-card > div { min-width: 0; }
.metric-card span { display: block; color: var(--ink-faint); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.metric-card strong { display: block; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 25px; font-weight: 600; margin-top: 3px; }
.metric-delta { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 10.5px;
  font-weight: 600; color: var(--ink-faint); margin-top: 2px; }
.metric-delta.up { color: var(--ok); }
.metric-delta.down { color: var(--danger); }

.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--sh-1); padding: 22px; min-width: 0; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.panel-heading h3 { margin: 5px 0 0; font-size: 17px; font-weight: 600; }

.status-list { display: grid; gap: 9px; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px;
  border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line-soft); }
.status-row div { display: flex; align-items: center; gap: 10px; min-width: 0; }
.status-row strong { overflow: hidden; text-overflow: ellipsis; }
.status-indicator { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.status-row.ok .status-indicator { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-soft); }
.status-row.bad .status-indicator { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.status-row small { color: var(--ink-faint); white-space: nowrap; }
.status-row.ok small { color: var(--ok); font-weight: 600; }
.status-row.bad small { color: var(--danger); font-weight: 600; }
.status-meta { font-family: var(--mono); font-size: 10.5px; color: var(--ink-faint); font-weight: 500; }

.activation-list { display: grid; gap: 11px; margin: 0; padding: 0; list-style: none; counter-reset: activation; }
.activation-list li { display: grid; grid-template-columns: 27px 1fr auto; align-items: center; gap: 11px; color: var(--ink-soft); }
.activation-list li:before { counter-increment: activation; content: counter(activation); width: 25px; height: 25px;
  border-radius: 8px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-deep);
  font-family: var(--mono); font-size: 11px; font-weight: 600; }
[data-theme="dark"] .activation-list li:before { color: var(--gold); }
.activation-list li.done { color: var(--ink-faint); }
.activation-list li.done:before { content: "✓"; background: var(--ok-soft); color: var(--ok); }
.activation-list li .step-state { font-family: var(--mono); font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-faint); }
.activation-list li.done .step-state { color: var(--ok); }

/* Panel de atención: lo que un operador debe resolver hoy */
.attention-list { display: grid; gap: 8px; }
.attention-item { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-soft); background: var(--surface-2);
  text-align: start; width: 100%; cursor: pointer; }
.attention-item:hover { border-color: var(--gold); background: var(--gold-soft); }
.attention-item .sev { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
  font-family: var(--mono); font-size: 12px; font-weight: 700; }
.attention-item .sev.danger { background: var(--danger-soft); color: var(--danger); }
.attention-item .sev.warn { background: var(--warn-soft); color: var(--warn); }
.attention-item .sev.info { background: var(--info-soft); color: var(--info); }
.attention-item strong { display: block; font-size: 13px; font-weight: 600; }
.attention-item small { display: block; color: var(--ink-faint); font-size: 11.5px; overflow-wrap: anywhere; }
.attention-item .go { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .08em; }
.all-clear { display: grid; place-items: center; gap: 8px; padding: 30px 12px; text-align: center; color: var(--ink-faint); }
.all-clear .ring { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ok-soft); color: var(--ok); font-size: 20px; font-weight: 700; }

/* ============================================================ SECCIONES CRUD */
.section-grid { display: grid; gap: 16px; }
.form-table-grid { grid-template-columns: minmax(280px, 350px) minmax(0, 1fr); }
.form-panel { align-self: start; position: sticky; top: 112px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; min-width: 620px; background: var(--surface); }
th, td { padding: var(--row-pad) 14px; text-align: start; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
th { position: sticky; top: 0; background: var(--surface-2); color: var(--ink-faint); font-size: 10.5px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .08em; z-index: 1; white-space: nowrap; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--ink); }
th[data-sort]:after { content: "↕"; opacity: .3; margin-inline-start: 6px; font-size: 10px; }
th[data-sort].asc:after { content: "↑"; opacity: 1; color: var(--gold-deep); }
th[data-sort].desc:after { content: "↓"; opacity: 1; color: var(--gold-deep); }
[data-theme="dark"] th[data-sort].asc:after, [data-theme="dark"] th[data-sort].desc:after { color: var(--gold); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.selected { background: var(--gold-soft); }
td small { display: block; color: var(--ink-faint); margin-top: 3px; font-size: 12px; }
td code { color: var(--gold-deep); background: var(--line-soft); padding: 1px 6px; border-radius: 6px; font-size: 11.5px; }
[data-theme="dark"] td code { color: var(--gold); }
td.tight { width: 1%; white-space: nowrap; }
.row-check { width: 15px; height: 15px; accent-color: var(--gold); cursor: pointer; }

/* Barra de acciones masivas */
.bulk-bar { display: none; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; padding: 10px 14px;
  border: 1px solid var(--gold); border-radius: var(--radius-sm); background: var(--gold-soft); }
.bulk-bar.visible { display: flex; }
.bulk-bar strong { font-family: var(--mono); font-size: 12px; color: var(--gold-deep); }
[data-theme="dark"] .bulk-bar strong { color: var(--gold); }
.bulk-bar .spacer { margin-inline-start: auto; }

/* Medidor de cuota en fila */
.meter { width: 116px; }
.meter .meter-track { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; margin-top: 5px; }
.meter .meter-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--gold-deep)); }
.meter .meter-fill.hot { background: linear-gradient(90deg, var(--warn), var(--danger)); }
.meter small { margin-top: 4px; font-family: var(--mono); font-size: 10.5px; }

.status-pill, .badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-family: var(--mono); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  border: 1px solid var(--line); color: var(--ink-soft); background: var(--surface-2); }
.status-pill.active { color: var(--ok); background: var(--ok-soft); border-color: rgba(47,143,91,.28); }
.status-pill.pending, .status-pill.provisioning { color: var(--warn); background: var(--warn-soft); border-color: rgba(201,138,37,.3); }
.status-pill.failed { color: var(--danger); background: var(--danger-soft); border-color: rgba(192,73,47,.3); }
.status-pill.suspended { color: var(--info); background: var(--info-soft); border-color: rgba(47,111,159,.3); }
.status-pill.archived { color: var(--ink-faint); background: var(--bg-2); border-color: var(--line); }
.badge.native { color: var(--gold-deep); background: var(--gold-soft); border-color: rgba(151,113,58,.3); }
[data-theme="dark"] .badge.native { color: var(--gold); }

.row-actions { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: nowrap; }
tbody td:last-child { white-space: nowrap; width: 1%; }
@media (max-width: 560px) { .row-actions { flex-wrap: wrap; justify-content: flex-start; } }
.row-action { border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 5px 9px;
  color: var(--ink-soft); cursor: pointer; font-size: 11.5px; font-weight: 600; }
.row-action:hover { color: var(--ink); border-color: var(--ink-faint); background: var(--surface-2); }
.row-action.danger:hover { color: var(--danger); border-color: rgba(192,73,47,.4); background: var(--danger-soft); }

.tenant-required { display: none; padding: 16px 20px; margin-bottom: 16px; border: 1px dashed rgba(201,138,37,.45);
  border-radius: var(--radius-sm); color: #8a5f14; background: var(--warn-soft); font-weight: 500; }
[data-theme="dark"] .tenant-required { color: var(--warn); }
.tenant-required.visible { display: block; }
.tenant-required.visible + .tenant-content { display: none; }
.empty-row td { text-align: center; color: var(--ink-faint); padding: 38px; }

/* Skeletons de carga */
.skeleton { position: relative; overflow: hidden; background: var(--bg-2); border-radius: 7px; height: 12px; }
.skeleton:after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); animation: shimmer 1.25s infinite; }
[data-theme="dark"] .skeleton:after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.07), transparent); }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ============================================================ SEMÁNTICA */
.semantic-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .6fr); gap: 16px; }
.search-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.semantic-results { display: grid; gap: 10px; margin-top: 16px; }
.semantic-result { padding: 15px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.semantic-result header { display: flex; align-items: start; justify-content: space-between; gap: 15px; }
.semantic-result h4 { margin: 0; font-size: 14px; font-weight: 600; }
.semantic-result p { color: var(--ink-soft); line-height: 1.55; margin: 9px 0 0; font-size: 13px; }
.semantic-score { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--gold-deep); font-size: 12px; font-weight: 600; }
[data-theme="dark"] .semantic-score { color: var(--gold); }
.empty-state { min-height: 210px; display: grid; place-items: center; align-content: center; text-align: center; color: var(--ink-faint); }
.empty-state img { width: 42px; height: 42px; opacity: .35; margin-bottom: 12px; }

/* ============================================================ ANALÍTICA */
.chart-svg { width: 100%; height: 190px; display: block; overflow: visible; }
.chart-svg .grid-line { stroke: var(--line-soft); stroke-width: 1; }
.chart-svg .area { fill: url(#sehlArea); }
.chart-svg .stroke { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .pt { fill: var(--surface); stroke: var(--gold-deep); stroke-width: 2; }
.chart-svg .hit { fill: transparent; cursor: crosshair; }
.chart-svg .hit:hover + .pt, .chart-svg .pt.on { fill: var(--gold); }
.chart-axis { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--mono);
  font-size: 9.5px; color: var(--ink-faint); }
.chart-legend { display: flex; align-items: center; gap: 14px; margin-top: 12px; font-size: 11.5px; color: var(--ink-faint); }
.chart-legend b { font-family: var(--mono); color: var(--ink); font-size: 12px; }

/* Barras verticales (se mantienen para compatibilidad) */
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 8px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 5px; }
.bar-col .bar { width: 100%; min-height: 3px; border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--gold), var(--gold-deep)); opacity: .85; transition: .2s; }
.bar-col:hover .bar { opacity: 1; }
.bar-col span { font-family: var(--mono); font-size: 9.5px; color: var(--ink-faint); }
.hbar-list { display: grid; gap: 13px; }
.hbar-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.hbar-head strong { font-size: 13px; }
.hbar-head small { color: var(--ink-faint); font-family: var(--mono); font-size: 11px; }
.hbar-track { height: 9px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold), var(--gold-deep)); }
.hbar-fill.hot { background: linear-gradient(90deg, var(--warn), var(--danger)); }

/* ============================================================ FILTROS / TAGS */
.heading-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.table-filter { width: 170px; min-height: 34px; padding: 6px 11px; font-size: 12.5px; }
.tag-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--navy-soft);
  color: var(--navy); font-size: 10px; font-weight: 600; margin-top: 3px; }
[data-theme="dark"] .tag-chip { color: #dbe2ee; }
.result-count { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }

/* ============================================================ ENTREGA / CUARENTENA / DNS */
.delivery-grid { grid-template-columns: 1.15fr .85fr; }
#view-delivery table, #view-quarantine table { min-width: 680px; }
#view-delivery td:nth-child(2), #view-quarantine td:nth-child(2) { white-space: nowrap; }
.dns-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.dns-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 8px; margin-top: 14px; }
.dns-chip { padding: 9px 11px; border-radius: var(--radius-sm); border: 1px solid var(--line-soft); background: var(--surface-2); }
.dns-chip span { display: block; font-size: 9.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }
.dns-chip strong { display: block; margin-top: 3px; font-family: var(--mono); font-size: 12px; }
.dns-chip.present { border-color: rgba(47,143,91,.3); background: var(--ok-soft); }
.dns-chip.present strong { color: var(--ok); }
.dns-chip.absent { border-color: rgba(201,138,37,.3); background: var(--warn-soft); }
.dns-chip.absent strong { color: var(--warn); }
@media (max-width: 1100px) { .delivery-grid { grid-template-columns: 1fr; } }

/* ============================================================ SISTEMA */
.code-panel { min-height: 330px; max-height: 540px; overflow: auto; margin: 0; padding: 16px;
  border-radius: var(--radius-sm); background: var(--navy-2); border: 1px solid var(--navy);
  color: #cdd6e4; font-family: var(--mono); font-size: 12px; line-height: 1.6; white-space: pre-wrap; }

/* ============================================================ PALETA DE COMANDOS */
.palette { width: min(620px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); color: var(--ink); box-shadow: var(--sh-3); margin-top: 12vh; }
.palette::backdrop { background: rgba(27,31,42,.5); backdrop-filter: blur(5px); }
.palette-search { display: flex; align-items: center; gap: 11px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.palette-search img { width: 18px; height: 18px; opacity: .5; }
.palette-search input { border: 0; padding: 0; font-size: 15px; background: none; }
.palette-search input:focus { box-shadow: none; }
.palette-list { max-height: 46vh; overflow: auto; padding: 8px; display: grid; gap: 2px; }
.palette-item { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 11px;
  width: 100%; border: 0; background: none; padding: 9px 11px; border-radius: 10px; text-align: start; cursor: pointer; }
.palette-item img { width: 17px; height: 17px; opacity: .6; }
.palette-item strong { font-size: 13.5px; font-weight: 600; display: block; }
.palette-item small { display: block; color: var(--ink-faint); font-size: 11.5px; }
.palette-item .hint { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .08em; }
.palette-item:hover, .palette-item.on { background: var(--gold-soft); }
.palette-item:hover img, .palette-item.on img { opacity: .95; }
.palette-empty { padding: 34px; text-align: center; color: var(--ink-faint); }
.palette-foot { display: flex; align-items: center; gap: 14px; padding: 10px 18px; border-top: 1px solid var(--line);
  color: var(--ink-faint); font-size: 11px; }

/* Diálogo de atajos */
.shortcut-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 9px; }
.shortcut-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px;
  border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line-soft); font-size: 12.5px; }

/* ============================================================ TOASTS / DIALOG */
.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 50; display: grid; gap: 10px; width: min(380px, calc(100vw - 44px)); }
.toast { padding: 13px 16px; border-radius: 12px; border: 1px solid var(--line); border-inline-start: 3px solid var(--ink-faint);
  background: var(--surface); box-shadow: var(--sh-2); animation: toast-in .18s ease; }
.toast.success { border-inline-start-color: var(--ok); }
.toast.error { border-inline-start-color: var(--danger); }
.toast.warn { border-inline-start-color: var(--warn); }
.toast strong { display: block; font-size: 13px; }
.toast p { margin: 4px 0 0; color: var(--ink-soft); font-size: 12.5px; line-height: 1.45; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.secret-dialog { width: min(500px, calc(100vw - 36px)); border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); color: var(--ink); box-shadow: var(--sh-2); padding: 0; }
.secret-dialog::backdrop { background: rgba(27,31,42,.5); backdrop-filter: blur(5px); }
.secret-dialog form { padding: 30px; text-align: center; }
.dialog-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; margin: auto; background: var(--gold-soft); }
.dialog-icon img { width: 25px; height: 25px; filter: brightness(0) opacity(.7); }
[data-theme="dark"] .dialog-icon img { filter: brightness(0) invert(1) opacity(.8); }
.secret-dialog h2 { margin: 18px 0 8px; font-weight: 600; }
.secret-dialog p { color: var(--ink-soft); line-height: 1.55; }
.secret-value { display: grid; grid-template-columns: 1fr 38px; gap: 9px; align-items: center; text-align: start;
  margin: 20px 0; padding: 10px 10px 10px 14px; border-radius: var(--radius-sm); background: var(--navy-2); }
.secret-value code { overflow-wrap: anywhere; color: var(--gold-ondark); font-size: 13px; }
.secret-value .icon-button { background: transparent; border-color: rgba(255,255,255,.16); }
.secret-value .icon-button img { filter: brightness(0) invert(1); opacity: .8; }

.edit-dialog { width: min(480px, calc(100vw - 36px)); border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); color: var(--ink); box-shadow: var(--sh-2); padding: 0; }
.edit-dialog.wide { width: min(660px, calc(100vw - 36px)); }
.edit-dialog::backdrop { background: rgba(27,31,42,.5); backdrop-filter: blur(5px); }
.edit-dialog form, .edit-dialog .dialog-body { padding: 26px 28px; }
.edit-dialog table { min-width: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ============================================================ RESPONSIVE */
@media (max-width: 1100px) {
  :root { --sidebar: 216px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-panel { grid-template-columns: 1fr; }
  .hero-orbit { display: none; }
  .semantic-layout, .two-column { grid-template-columns: 1fr; }
  .form-table-grid { grid-template-columns: 310px minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .app-shell, .app-shell.collapsed { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 10px 12px; flex-direction: row; align-items: center; overflow: visible; }
  .sidebar .brand-lockup, .sidebar-links, .operator-card, .nav-group, .sidebar-collapse { display: none; }
  .navigation { display: flex; overflow: auto; margin: 0; width: 100%; }
  .nav-item { width: auto; white-space: nowrap; }
  .nav-item.active { box-shadow: inset 0 -2px var(--gold-ondark); }
  .nav-count { display: none; }
  .workspace { padding: 0 16px 35px; }
  .topbar { min-height: 84px; position: static; align-items: flex-start; padding: 16px 0; }
  .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .compact-select { min-width: 122px; }
  .form-table-grid { grid-template-columns: 1fr; }
  .form-panel { position: static; }
  .hero-panel { padding: 28px; }
  .hero-panel h2 { font-size: 29px; }
  .palette-trigger span { display: none; }
  .session-context small { display: none; }
}
@media (max-width: 560px) {
  .login-view { padding: 14px; }
  .login-card { padding: 26px 22px; }
  .topbar { display: block; }
  .topbar-actions { justify-content: flex-start; margin-top: 12px; }
  .metric-grid { grid-template-columns: 1fr; }
  .split, .search-form { grid-template-columns: 1fr; }
  .panel { padding: 16px; }
  .hero-panel { min-height: 0; }
  .navigation span { display: none; }
  .nav-item { padding: 10px; }
  .workspace { padding-inline: 11px; }
  .session-context { order: -1; }
}

/* ============================================================ RTL */
[dir="rtl"] .sidebar { inset: 0 0 0 auto; }
[dir="rtl"] .workspace { grid-column: 1; }
[dir="rtl"] .nav-item.active { box-shadow: inset -3px 0 var(--gold-ondark); }
[dir="rtl"] .toast-region { right: auto; left: 22px; }

/* ============================================================ MOVIMIENTO / IMPRESIÓN */
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; }
  .button:hover, .metric-card:hover { transform: none; }
}
@media print {
  .sidebar, .topbar-actions, .row-actions, .toast-region, .bulk-bar, .heading-tools { display: none !important; }
  .app-shell { display: block; }
  .workspace { padding: 0; }
  .panel { box-shadow: none; border-color: #ddd; break-inside: avoid; }
}

/* ============================================================================
   v1.0 — casillas del motor, alta masiva, uso real, estado en vivo
   ========================================================================== */

/* Indicador de conexión en vivo (SSE) */
.live-dot { display: inline-flex; align-items: center; gap: 7px; padding: 0 10px; min-height: 34px;
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
  font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-faint); }
.live-dot i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.live-dot.on { color: var(--ok); border-color: rgba(47,143,91,.3); background: var(--ok-soft); }
.live-dot.on i { background: var(--ok); animation: live-pulse 2s ease-in-out infinite; }
.live-dot.off { color: var(--warn); border-color: rgba(201,138,37,.3); background: var(--warn-soft); }
.live-dot.off i { background: var(--warn); }
@keyframes live-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(47,143,91,.5); } 50% { box-shadow: 0 0 0 5px rgba(47,143,91,0); } }

/* Casillas reales del motor, agrupadas por dominio */
.engine-groups { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.engine-group { min-width: 0; }
.engine-group > .group-head { display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin: 0 0 9px; min-width: 0; }
.engine-group .group-head h4 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.engine-group .group-head h4 { font-family: var(--serif); font-size: 16px; font-weight: 600; margin: 0; }
.engine-group .group-head small { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }
.orphan-flag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px;
  font-family: var(--mono); font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--warn); background: var(--warn-soft); border: 1px solid rgba(201,138,37,.3); }

/* Alta masiva */
.bulk-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.bulk-help { font-size: 12px; color: var(--ink-faint); line-height: 1.55; margin: 0; }
.bulk-help code { color: var(--gold-deep); background: var(--line-soft); padding: 1px 5px; border-radius: 5px; }
[data-theme="dark"] .bulk-help code { color: var(--gold); }
#bulkInput { min-height: 170px; font-family: var(--mono); font-size: 12px; line-height: 1.6; }
.bulk-summary { display: flex; gap: 8px; flex-wrap: wrap; }
.bulk-stat { padding: 7px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-soft);
  background: var(--surface-2); font-family: var(--mono); font-size: 11.5px; }
.bulk-stat.good { border-color: rgba(47,143,91,.3); background: var(--ok-soft); color: var(--ok); }
.bulk-stat.bad { border-color: rgba(192,73,47,.3); background: var(--danger-soft); color: var(--danger); }
.bulk-results { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.bulk-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.bulk-row:last-child { border-bottom: 0; }
.bulk-row .mark { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; }
.bulk-row.ok .mark { background: var(--ok-soft); color: var(--ok); }
.bulk-row.bad .mark { background: var(--danger-soft); color: var(--danger); }
.bulk-row small { color: var(--ink-faint); }
.bulk-row code { font-size: 11px; }

/* Errores recientes */
.error-list { display: grid; gap: 7px; max-height: 340px; overflow: auto; }
.error-item { display: grid; grid-template-columns: 46px 1fr; gap: 11px; padding: 9px 11px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-soft); background: var(--surface-2); }
.error-item .code { font-family: var(--mono); font-size: 11px; font-weight: 700; text-align: center;
  padding: 2px 0; border-radius: 6px; height: fit-content; }
.error-item .code.c4 { background: var(--warn-soft); color: var(--warn); }
.error-item .code.c5 { background: var(--danger-soft); color: var(--danger); }
.error-item strong { font-size: 12.5px; font-weight: 600; display: block; overflow-wrap: anywhere; }
.error-item small { display: block; color: var(--ink-faint); font-size: 11px; overflow-wrap: anywhere; }

/* Historial de salud */
.spark-row { display: grid; grid-template-columns: 120px 1fr auto; align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.spark-row:last-child { border-bottom: 0; }
.spark-row strong { font-size: 12.5px; }
.spark { height: 26px; width: 100%; display: block; }
.spark rect { fill: var(--ok); }
.spark rect.bad { fill: var(--danger); }
.spark-pct { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }

/* Aviso con acción (deshacer) */
.toast .toast-action { margin-top: 8px; display: flex; gap: 8px; }
.toast .toast-action button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 7px;
  padding: 4px 11px; font-size: 11.5px; font-weight: 600; cursor: pointer; color: var(--gold-deep); }
.toast .toast-action button:hover { border-color: var(--gold); background: var(--gold-soft); }
[data-theme="dark"] .toast .toast-action button { color: var(--gold); }

/* --------------------------------------------------------- responsive v1.0 */
@media (max-width: 1100px) {
  .spark-row { grid-template-columns: 96px 1fr auto; }
}
@media (max-width: 820px) {
  .live-dot span { display: none; }          /* en móvil basta el punto */
  .live-dot { padding: 0 9px; }
  .error-item { grid-template-columns: 40px 1fr; }
  .bulk-row { grid-template-columns: 22px 1fr; }
  .bulk-row code { grid-column: 2; }
}
@media (max-width: 560px) {
  .spark-row { grid-template-columns: 1fr auto; row-gap: 4px; }
  .spark-row .spark { grid-column: 1 / -1; }
  .engine-group .group-head { flex-wrap: wrap; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions .button { flex: 1 1 auto; }
  #bulkInput { min-height: 140px; }
}

/* ==========================================================================
   Entregabilidad — comprobación en vivo del DNS público (v2.0.0)
   ========================================================================== */
.deliv-top{display:grid;grid-template-columns:auto minmax(0,1fr);gap:20px;align-items:center;margin-top:14px}
.deliv-score{position:relative;width:132px;height:132px;flex:none}
.deliv-score svg{transform:rotate(-90deg)}
.deliv-score .ring-bg{fill:none;stroke:var(--line);stroke-width:10}
.deliv-score .ring-fg{fill:none;stroke:var(--gold);stroke-width:10;stroke-linecap:round;
  stroke-dasharray:327;stroke-dashoffset:327;transition:stroke-dashoffset .6s ease,stroke .3s}
.deliv-score.good .ring-fg{stroke:var(--ok)}
.deliv-score.warn .ring-fg{stroke:var(--warn)}
.deliv-score.bad .ring-fg{stroke:var(--danger)}
.deliv-score-mid{position:absolute;inset:0;display:grid;place-content:center;text-align:center;gap:2px}
.deliv-score-mid strong{font-family:var(--mono,monospace);font-size:30px;line-height:1}
.deliv-score-mid small{font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:var(--ink-faint)}
.deliv-verdict h4{margin:0 0 6px;font-size:17px}
.deliv-verdict ul{margin:8px 0 0;padding-left:18px;display:grid;gap:5px}
.deliv-verdict li{font-size:13px;color:var(--ink-soft)}
.deliv-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:10px;margin-top:18px}
.deliv-card{border:1px solid var(--line);border-radius:12px;padding:12px 14px;background:var(--surface-2,transparent)}
.deliv-card header{display:flex;align-items:center;gap:8px;margin-bottom:5px}
.deliv-card .dot{width:9px;height:9px;border-radius:50%;flex:none}
.deliv-card.pass .dot{background:var(--ok)}
.deliv-card.warn .dot{background:var(--warn)}
.deliv-card.fail .dot{background:var(--danger)}
.deliv-card.skip .dot{background:var(--ink-faint)}
.deliv-card strong{font-size:13px}
.deliv-card p{margin:0;font-size:12px;color:var(--ink-soft);overflow-wrap:anywhere}
.deliv-card code{font-size:11px;overflow-wrap:anywhere}
@media (max-width:720px){ .deliv-top{grid-template-columns:1fr;justify-items:center;text-align:center} .deliv-verdict ul{text-align:left} }

/* ---- informes DMARC: se leen en el navegador, no se suben a ninguna parte */
.dropzone{margin-top:12px;border:2px dashed var(--line);border-radius:14px;padding:26px 18px;text-align:center;cursor:pointer;
  display:grid;gap:4px;transition:border-color .15s,background .15s}
.dropzone:hover,.dropzone:focus-visible,.dropzone.over{border-color:var(--gold);background:var(--gold-soft,rgba(176,137,79,.08))}
.dropzone strong{font-size:14px}
.dropzone small{color:var(--ink-faint);font-size:12px}
.dmarc-summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;margin-top:14px}
.dmarc-stat{border:1px solid var(--line);border-radius:12px;padding:12px 14px}
.dmarc-stat b{display:block;font-family:var(--mono,monospace);font-size:22px;line-height:1.2}
.dmarc-stat small{color:var(--ink-faint);font-size:11px}
.dmarc-stat.bad b{color:var(--danger)}
.dmarc-stat.good b{color:var(--ok)}
.verdict-pill{display:inline-flex;align-items:center;gap:5px;padding:1px 8px;border-radius:99px;font-size:10.5px;font-weight:600;
  text-transform:uppercase;letter-spacing:.05em;border:1px solid var(--line)}
.verdict-pill.pass{color:var(--ok);border-color:rgba(47,143,91,.4)}
.verdict-pill.fail{color:var(--danger);border-color:rgba(192,73,47,.4)}


/* ============================================================================
   SEHL-MAIL-OPERATIONAL-DASHBOARD-V1
   ========================================================================== */

.op-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, .55fr);
  gap: 28px;
  align-items: stretch;
  padding: 34px 38px;
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(circle at 85% 5%, rgba(216,182,118,.14), transparent 34%),
    linear-gradient(130deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #f4f1ec;
  box-shadow: var(--sh-2);
}

.op-hero-copy {
  align-self: center;
  min-width: 0;
}

.op-hero .eyebrow {
  color: var(--gold-ondark);
}

.op-hero h2 {
  margin: 10px 0 12px;
  max-width: 800px;
  font-size: clamp(27px, 3.2vw, 39px);
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -.018em;
}

.op-hero .hero-copy {
  max-width: 760px;
  margin: 0;
  color: #c3c9d4;
  line-height: 1.65;
}

.op-overall-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-height: 190px;
  padding: 24px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 16px;
  background: rgba(255,255,255,.055);
  backdrop-filter: blur(8px);
}

.op-overall-caption {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  font-weight: 700;
  color: #b8beca;
}

.op-overall-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 8px;
}

.op-overall-status i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.op-overall-status strong {
  font-family: var(--mono);
  font-size: 26px;
  letter-spacing: .025em;
  text-transform: uppercase;
}

.op-overall-card[data-status="healthy"] .op-overall-status i {
  background: var(--ok);
  box-shadow: 0 0 18px rgba(47,143,91,.55);
}

.op-overall-card[data-status="degraded"] .op-overall-status i {
  background: var(--warn);
}

.op-overall-card[data-status="critical"] .op-overall-status i {
  background: var(--danger);
}

.op-overall-card small {
  display: block;
  color: #c3c9d4;
  line-height: 1.5;
}

.op-overall-card .button {
  margin-top: 18px;
  color: #f4f1ec;
  border-color: rgba(255,255,255,.2);
}

.op-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.op-kpi-card {
  min-width: 0;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--sh-1);
}

.op-kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.op-kpi-top span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  color: var(--ink-faint);
}

.op-kpi-top img {
  width: 17px;
  height: 17px;
  opacity: .62;
}

[data-theme="dark"] .op-kpi-top img {
  filter: brightness(0) invert(1);
}

.op-kpi-card > strong {
  display: block;
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 23px;
  font-weight: 600;
  line-height: 1.05;
}

.op-kpi-card > small {
  display: block;
  margin-top: 6px;
  color: var(--ink-faint);
  line-height: 1.35;
}

.op-command-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.op-command-grid > .op-panel {
  grid-column: span 4;
}

.op-command-grid > .op-health-panel {
  grid-column: span 8;
}

.op-live-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border: 1px solid rgba(47,143,91,.28);
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
}

.op-health-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.op-health-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft, var(--surface));
}

.op-health-item > i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.op-health-item.healthy > i {
  background: var(--ok);
}

.op-health-item.degraded > i {
  background: var(--warn);
}

.op-health-item.critical > i {
  background: var(--danger);
}

.op-health-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
}

.op-health-item span {
  font-family: var(--mono);
  font-size: 9.5px;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.op-kv-list {
  display: grid;
  gap: 0;
}

.op-kv {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.op-kv:last-child {
  border-bottom: 0;
}

.op-kv span {
  color: var(--ink-faint);
  font-size: 12px;
}

.op-kv strong {
  max-width: 240px;
  text-align: right;
  font-family: var(--mono);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.op-value-ok {
  color: var(--ok);
}

.op-value-warn {
  color: var(--warn);
}

.op-value-bad {
  color: var(--danger);
}

.op-alert-list {
  display: grid;
  gap: 9px;
}

.op-alert {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.op-alert > i {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  flex: none;
  background: var(--warn);
}

.op-alert.critical > i {
  background: var(--danger);
}

.op-alert strong,
.op-alert small {
  display: block;
}

.op-alert small {
  margin-top: 3px;
  color: var(--ink-faint);
}

.op-alert-empty {
  min-height: 115px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--ink-faint);
}

.op-alert-empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ok);
}

.op-estate-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 0 0 16px;
}

.op-analytics {
  margin-top: 16px;
}


@media (max-width: 1320px) {

  .op-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .op-command-grid > .op-panel,
  .op-command-grid > .op-health-panel {
    grid-column: span 6;
  }
}


@media (max-width: 900px) {

  .op-hero {
    grid-template-columns: 1fr;
    padding: 28px;
  }

  .op-overall-card {
    min-height: 0;
  }

  .op-command-grid {
    grid-template-columns: 1fr;
  }

  .op-command-grid > .op-panel,
  .op-command-grid > .op-health-panel {
    grid-column: 1;
  }

  .op-health-grid {
    grid-template-columns: 1fr;
  }

  .op-estate-grid {
    grid-template-columns: 1fr;
  }
}


@media (max-width: 640px) {

  .op-hero {
    padding: 22px;
    border-radius: 15px;
  }

  .op-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .op-kpi-card {
    padding: 14px;
  }

  .op-kpi-card > strong {
    font-size: 20px;
  }

  .op-kv {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .op-kv strong {
    max-width: none;
    text-align: left;
  }
}


@media (max-width: 430px) {

  .op-kpi-grid {
    grid-template-columns: 1fr;
  }
}


/* ============================================================================
   SEHL-MAIL-OPERATIONAL-DASHBOARD-V2
   PREMIUM COMMAND CENTER
   ========================================================================== */

#view-dashboard {
  padding-bottom: 44px;
}


/* ---------------------------------------------------------------- HERO */

.cmd-hero {
  position: relative;
  display: grid;
  grid-template-columns:
    minmax(0, 1.55fr)
    minmax(340px, .62fr);
  gap: 26px;
  overflow: hidden;
  padding: 38px 40px;
  border-radius: 20px;
  background:
    radial-gradient(
      circle at 82% 8%,
      rgba(216,182,118,.17),
      transparent 33%
    ),
    radial-gradient(
      circle at 5% 105%,
      rgba(255,255,255,.045),
      transparent 40%
    ),
    linear-gradient(
      128deg,
      var(--navy) 0%,
      var(--navy-2) 100%
    );
  color: #f5f2ec;
  box-shadow: var(--sh-2);
}

.cmd-hero:after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(255,255,255,.05);
  border-radius: inherit;
}

.cmd-hero-main {
  position: relative;
  align-self: center;
  min-width: 0;
}

.cmd-hero-kicker {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--gold-ondark);
}

.cmd-live-pulse {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: #58c98b;
  box-shadow:
    0 0 0 5px rgba(88,201,139,.08),
    0 0 16px rgba(88,201,139,.45);
}

.cmd-hero h2 {
  max-width: 850px;
  margin: 12px 0 13px;
  font-size: clamp(29px, 3vw, 42px);
  line-height: 1.08;
  font-weight: 500;
  letter-spacing: -.022em;
}

.cmd-hero-description {
  max-width: 780px;
  margin: 0;
  color: #c5cad4;
  font-size: 13.5px;
  line-height: 1.65;
}

.cmd-hero .hero-facts {
  margin-top: 20px;
}


/* ---------------------------------------------------------------- HEALTH CARD */

.cmd-health-card {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  position: relative;
  padding: 24px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 17px;
  background: rgba(255,255,255,.055);
  backdrop-filter: blur(9px);
}

.cmd-health-ring {
  --health-pct: 0%;
  --ring-tone: #7d8490;

  width: 120px;
  height: 120px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    conic-gradient(
      var(--ring-tone) var(--health-pct),
      rgba(255,255,255,.1) 0
    );
  position: relative;
}

.cmd-health-ring:before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--navy-2);
  box-shadow:
    inset 0 0 28px rgba(255,255,255,.025);
}

.cmd-health-ring[data-status="healthy"] {
  --ring-tone: #58c98b;
}

.cmd-health-ring[data-status="degraded"] {
  --ring-tone: #d8b676;
}

.cmd-health-ring[data-status="critical"] {
  --ring-tone: #e2765c;
}

.cmd-health-ring-core {
  position: relative;
  z-index: 1;
  text-align: center;
}

.cmd-health-ring-core strong {
  display: block;
  font-family: var(--mono);
  font-size: 23px;
  font-weight: 600;
  color: #fff;
}

.cmd-health-ring-core small {
  display: block;
  width: 76px;
  margin-top: 3px;
  color: #aeb5c0;
  font-size: 8.5px;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.cmd-health-copy {
  min-width: 0;
}

.cmd-health-label {
  display: block;
  color: #aeb5c0;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
}

.cmd-overall-line {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 9px 0 7px;
}

.cmd-overall-line i {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: #858b96;
}

.cmd-health-card[data-status="healthy"]
.cmd-overall-line i {
  background: #58c98b;
  box-shadow: 0 0 15px rgba(88,201,139,.5);
}

.cmd-health-card[data-status="degraded"]
.cmd-overall-line i {
  background: #d8b676;
  box-shadow: 0 0 14px rgba(216,182,118,.35);
}

.cmd-health-card[data-status="critical"]
.cmd-overall-line i {
  background: #e2765c;
  box-shadow: 0 0 14px rgba(226,118,92,.4);
}

.cmd-overall-line strong {
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.cmd-primary-issue {
  margin: 0 0 10px;
  min-height: 18px;
  color: #e1e4e9;
  font-size: 11px;
  line-height: 1.45;
}

.cmd-health-copy > small {
  display: block;
  margin-top: 2px;
  color: #aeb5c0;
  font-size: 9.5px;
}

.cmd-refresh {
  margin-top: 15px;
  color: #fff;
  border-color: rgba(255,255,255,.18);
}


/* ---------------------------------------------------------------- INCIDENT STRIP */

.cmd-incident-strip {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  gap: 15px;
  align-items: center;
  margin: 14px 0;
  padding: 13px 16px;
  border: 1px solid rgba(201,138,37,.28);
  border-radius: 12px;
  background:
    linear-gradient(
      90deg,
      rgba(201,138,37,.10),
      rgba(201,138,37,.035)
    );
}

.cmd-incident-strip[data-level="critical"] {
  border-color: rgba(194,70,51,.3);
  background:
    linear-gradient(
      90deg,
      rgba(194,70,51,.11),
      rgba(194,70,51,.035)
    );
}

.cmd-incident-icon {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--warn-soft);
  color: var(--warn);
  font-family: var(--mono);
  font-weight: 800;
}

.cmd-incident-strip[data-level="critical"]
.cmd-incident-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.cmd-incident-copy {
  min-width: 0;
}

.cmd-incident-copy span {
  display: block;
  color: var(--warn);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .11em;
}

.cmd-incident-copy strong {
  display: block;
  margin-top: 2px;
  font-size: 13px;
}

.cmd-incident-copy small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--ink-faint);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmd-incident-badge {
  display: inline-flex;
  justify-content: center;
  min-width: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
}


/* ---------------------------------------------------------------- KPI */

.cmd-kpi-grid {
  display: grid;
  grid-template-columns:
    repeat(6, minmax(0,1fr));
  gap: 12px;
  margin: 14px 0 16px;
}

.cmd-kpi {
  display: grid;
  grid-template-columns: auto minmax(0,1fr);
  gap: 13px;
  align-items: center;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--sh-1);
}

.cmd-kpi-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--gold-soft);
}

.cmd-kpi-icon img {
  width: 18px;
  height: 18px;
}

[data-theme="dark"] .cmd-kpi-icon img {
  filter: brightness(0) invert(1) opacity(.8);
}

.cmd-kpi-copy {
  min-width: 0;
}

.cmd-kpi-copy > span {
  display: block;
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmd-kpi-copy > strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmd-kpi-copy > small {
  display: block;
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 10px;
}


/* ---------------------------------------------------------------- MAIN LAYOUT */

.cmd-main-grid {
  display: grid;
  grid-template-columns:
    minmax(0, 1.72fr)
    minmax(300px, .68fr);
  gap: 16px;
  margin-bottom: 16px;
}

.cmd-panel-heading {
  margin-bottom: 16px;
}

.cmd-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid rgba(47,143,91,.25);
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
}

.cmd-live-badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}

.cmd-panel-status {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--surface-2, var(--surface));
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}


/* ---------------------------------------------------------------- GUARDIAN */

.cmd-health-groups {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0,1fr));
  gap: 13px;
}

.cmd-health-group {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    color-mix(
      in srgb,
      var(--surface) 96%,
      var(--gold) 4%
    );
}

.cmd-health-group-title {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.cmd-health-row {
  display: grid;
  grid-template-columns:
    auto
    minmax(0,1fr)
    auto;
  gap: 9px;
  align-items: center;
  min-height: 39px;
  padding: 7px 3px;
  border-top: 1px solid var(--line);
}

.cmd-health-row:first-of-type {
  border-top: 0;
}

.cmd-health-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-faint);
}

.cmd-health-row.healthy .cmd-health-dot {
  background: var(--ok);
}

.cmd-health-row.degraded .cmd-health-dot {
  background: var(--warn);
}

.cmd-health-row.critical .cmd-health-dot {
  background: var(--danger);
}

.cmd-health-name {
  min-width: 0;
}

.cmd-health-name strong {
  display: block;
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmd-health-name small {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: var(--ink-faint);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmd-health-state {
  font-family: var(--mono);
  font-size: 8.7px;
  font-weight: 650;
  text-transform: uppercase;
}

.cmd-health-row.healthy .cmd-health-state {
  color: var(--ok);
}

.cmd-health-row.degraded .cmd-health-state {
  color: var(--warn);
}

.cmd-health-row.critical .cmd-health-state {
  color: var(--danger);
}


/* ---------------------------------------------------------------- STAT LIST */

.cmd-stat-list {
  display: grid;
}

.cmd-stat {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 37px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.cmd-stat:last-child {
  border-bottom: 0;
}

.cmd-stat span {
  color: var(--ink-faint);
  font-size: 10.5px;
}

.cmd-stat strong {
  max-width: 230px;
  overflow-wrap: anywhere;
  text-align: right;
  font-family: var(--mono);
  font-size: 10.5px;
}

.cmd-stat-roomy .cmd-stat {
  min-height: 41px;
}


/* ---------------------------------------------------------------- SECURITY / HOST */

.cmd-security-grid {
  display: grid;
  grid-template-columns:
    minmax(0, 1.18fr)
    minmax(0, 1fr)
    minmax(0, .9fr);
  gap: 16px;
  margin-bottom: 16px;
}

.cmd-resource-stack {
  display: grid;
  gap: 15px;
}

.cmd-resource {
  display: grid;
  gap: 6px;
}

.cmd-resource-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.cmd-resource-head span {
  color: var(--ink-faint);
  font-size: 10.5px;
}

.cmd-resource-head strong {
  font-family: var(--mono);
  font-size: 11px;
}

.cmd-resource-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.cmd-resource-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--gold-deep);
}

.cmd-resource-fill.good {
  background: var(--ok);
}

.cmd-resource-fill.warn {
  background: var(--warn);
}

.cmd-resource-fill.bad {
  background: var(--danger);
}

.cmd-resource-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink-faint);
  font-size: 9px;
}


/* ---------------------------------------------------------------- LOWER */

.cmd-lower-grid {
  display: grid;
  grid-template-columns:
    minmax(0,1fr)
    minmax(0,1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.cmd-alert-list {
  display: grid;
  gap: 9px;
}

.cmd-alert-item {
  display: grid;
  grid-template-columns:
    auto
    minmax(0,1fr)
    auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.cmd-alert-item > i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
}

.cmd-alert-item.critical > i {
  background: var(--danger);
}

.cmd-alert-item strong {
  display: block;
  font-size: 11.5px;
}

.cmd-alert-item small {
  display: block;
  margin-top: 2px;
  color: var(--ink-faint);
  font-size: 9.5px;
}

.cmd-alert-level {
  font-family: var(--mono);
  font-size: 8.5px;
  color: var(--warn);
  text-transform: uppercase;
}

.cmd-alert-empty {
  min-height: 122px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 11px;
  text-align: center;
}

.cmd-alert-empty strong {
  display: block;
  color: var(--ok);
  font-size: 12px;
}

.cmd-alert-empty small {
  display: block;
  margin-top: 4px;
  color: var(--ink-faint);
}

.cmd-foundation {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.cmd-subheading h4 {
  margin: 4px 0 10px;
  font-size: 13px;
}

.cmd-context-copy {
  min-height: 90px;
  display: flex;
  align-items: center;
}

.cmd-context-copy p {
  margin: 0;
  max-width: 550px;
  color: var(--ink-faint);
  line-height: 1.7;
}


/* ---------------------------------------------------------------- ESTATE */

.cmd-estate-strip {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.cmd-estate-item {
  display: grid;
  grid-template-columns:
    minmax(0,1fr)
    auto
    auto;
  gap: 10px;
  align-items: center;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.cmd-estate-item:hover {
  border-color: var(--gold);
}

.cmd-estate-item span {
  color: var(--ink-faint);
  font-size: 10.5px;
  font-weight: 600;
}

.cmd-estate-item strong {
  font-family: var(--mono);
  font-size: 14px;
}


/* ---------------------------------------------------------------- CONSOLE / ANALYTICS */

.cmd-console-grid,
.cmd-analytics-grid {
  display: grid;
  grid-template-columns:
    repeat(2,minmax(0,1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.cmd-chart-panel {
  min-height: 290px;
}

.cmd-chart-body {
  min-height: 190px;
}

.cmd-chart-panel #activityChart svg {
  overflow: visible;
}


/* ---------------------------------------------------------------- VALUE COLORS */

.op-value-ok {
  color: var(--ok) !important;
}

.op-value-warn {
  color: var(--warn) !important;
}

.op-value-bad {
  color: var(--danger) !important;
}


/* ---------------------------------------------------------------- RESPONSIVE */

@media (max-width: 1420px) {

  .cmd-kpi-grid {
    grid-template-columns:
      repeat(3,minmax(0,1fr));
  }

  .cmd-security-grid {
    grid-template-columns:
      repeat(2,minmax(0,1fr));
  }

  .cmd-host-panel {
    grid-column: 1 / -1;
  }

  .cmd-host-panel .cmd-resource-stack {
    grid-template-columns:
      repeat(3,minmax(0,1fr));
  }
}


@media (max-width: 1100px) {

  .cmd-hero {
    grid-template-columns: 1fr;
  }

  .cmd-health-card {
    max-width: 620px;
  }

  .cmd-main-grid {
    grid-template-columns: 1fr;
  }

  .cmd-health-groups {
    grid-template-columns:
      repeat(2,minmax(0,1fr));
  }
}


@media (max-width: 820px) {

  .cmd-hero {
    padding: 27px;
  }

  .cmd-health-card {
    grid-template-columns:
      110px minmax(0,1fr);
  }

  .cmd-health-ring {
    width: 104px;
    height: 104px;
  }

  .cmd-kpi-grid,
  .cmd-security-grid,
  .cmd-lower-grid,
  .cmd-console-grid,
  .cmd-analytics-grid {
    grid-template-columns: 1fr;
  }

  .cmd-health-groups {
    grid-template-columns: 1fr;
  }

  .cmd-host-panel {
    grid-column: auto;
  }

  .cmd-host-panel .cmd-resource-stack {
    grid-template-columns: 1fr;
  }

  .cmd-estate-strip {
    grid-template-columns: 1fr;
  }
}


@media (max-width: 560px) {

  .cmd-hero {
    padding: 21px;
    border-radius: 15px;
  }

  .cmd-health-card {
    grid-template-columns: 1fr;
  }

  .cmd-health-ring {
    margin: auto;
  }

  .cmd-kpi-grid {
    grid-template-columns: 1fr;
  }

  .cmd-incident-strip {
    grid-template-columns: auto minmax(0,1fr);
  }

  .cmd-incident-badge {
    display: none;
  }

  .cmd-stat {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .cmd-stat strong {
    max-width: none;
    text-align: left;
  }
}

/* ============================================================================
   SEHL-ADVANCED-OPS-V1
   ========================================================================== */

.ops-command {
  margin-bottom: 14px;
}

.ops-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.ops-tabs button {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink-faint);
  cursor: pointer;
}

.ops-tabs button.active {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold-deep);
  font-weight: 700;
}

.ops-capabilities {
  margin-bottom: 14px;
}

.ops-pane {
  display: none;
}

.ops-pane.active {
  display: block;
}

.ops-results {
  margin-top: 14px;
}

.ops-two,
.ops-three {
  display: grid;
  gap: 14px;
}

.ops-two {
  grid-template-columns: repeat(2,minmax(0,1fr));
}

.ops-three {
  grid-template-columns: repeat(3,minmax(0,1fr));
}

.ops-json-list {
  display: grid;
  gap: 7px;
}

.ops-record {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.ops-record summary {
  padding: 9px 10px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
}

.ops-record pre {
  max-height: 300px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border-top: 1px solid var(--line);
  white-space: pre-wrap;
  font-size: 9px;
}

.ops-kpis {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 9px;
  margin-bottom: 14px;
}

.ops-kpis > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}

.ops-kpis span {
  display: block;
  color: var(--ink-faint);
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.ops-kpis strong {
  display: block;
  margin-top: 5px;
  font-family: var(--mono);
  font-size: 15px;
}

@media(max-width:1000px) {

  .ops-three {
    grid-template-columns: 1fr;
  }

  .ops-kpis {
    grid-template-columns: repeat(2,minmax(0,1fr));
  }
}

@media(max-width:720px) {

  .ops-two {
    grid-template-columns: 1fr;
  }

  .ops-kpis {
    grid-template-columns: 1fr;
  }
}
