/* Skynex Panel — estilos. Sin fuentes ni librerías externas. */

:root {
  color-scheme: light;
  --bg: #f3f5f9;
  --glow-1: rgba(56, 189, 248, 0.16);
  --glow-2: rgba(124, 92, 255, 0.12);
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --surface-3: #eef1f6;
  --sidebar: rgba(255, 255, 255, 0.72);
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.15);
  --text: #0d1321;
  --text-2: #4a5468;
  --muted: #737d90;
  --brand: #3f5efb;
  --brand-grad: linear-gradient(135deg, #2f6ff0 0%, #7a4ff0 100%);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #e8ebf1;
  --axis: #c9d0db;
  --good: #0ca30c;
  --good-text: #067a06;
  --good-bg: rgba(12, 163, 12, 0.10);
  --warn: #fab219;
  --warn-text: #845400;
  --warn-bg: rgba(250, 178, 25, 0.16);
  --crit: #d03b3b;
  --crit-text: #b42323;
  --crit-bg: rgba(208, 59, 59, 0.10);
  --neutral-bg: rgba(115, 125, 144, 0.13);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px -6px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 30px 80px -20px rgba(15, 23, 42, 0.35);
  --focus: 0 0 0 3px rgba(63, 94, 251, 0.30);
  --code-bg: #0e131d;
  --code-text: #d5dceb;
  --radius: 16px;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #080b11;
    --glow-1: rgba(56, 189, 248, 0.09);
    --glow-2: rgba(124, 92, 255, 0.12);
    --surface: #111622;
    --surface-2: #151b28;
    --surface-3: #1b2232;
    --sidebar: rgba(13, 17, 26, 0.72);
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.13);
    --text: #eef1f7;
    --text-2: #b3bccc;
    --muted: #808a9c;
    --brand: #6b7fff;
    --series-1: #3987e5;
    --series-2: #d95926;
    --grid: #1e2534;
    --axis: #2e3648;
    --good-text: #45c845;
    --good-bg: rgba(12, 163, 12, 0.16);
    --warn-text: #fab219;
    --warn-bg: rgba(250, 178, 25, 0.13);
    --crit-text: #f07474;
    --crit-bg: rgba(208, 59, 59, 0.16);
    --neutral-bg: rgba(128, 138, 156, 0.16);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 30px -10px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
    --focus: 0 0 0 3px rgba(107, 127, 255, 0.35);
    --code-bg: #0a0d14;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080b11;
  --glow-1: rgba(56, 189, 248, 0.09);
  --glow-2: rgba(124, 92, 255, 0.12);
  --surface: #111622;
  --surface-2: #151b28;
  --surface-3: #1b2232;
  --sidebar: rgba(13, 17, 26, 0.72);
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text: #eef1f7;
  --text-2: #b3bccc;
  --muted: #808a9c;
  --brand: #6b7fff;
  --series-1: #3987e5;
  --series-2: #d95926;
  --grid: #1e2534;
  --axis: #2e3648;
  --good-text: #45c845;
  --good-bg: rgba(12, 163, 12, 0.16);
  --warn-text: #fab219;
  --warn-bg: rgba(250, 178, 25, 0.13);
  --crit-text: #f07474;
  --crit-bg: rgba(208, 59, 59, 0.16);
  --neutral-bg: rgba(128, 138, 156, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 30px -10px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
  --focus: 0 0 0 3px rgba(107, 127, 255, 0.35);
  --code-bg: #0a0d14;
}

/* ------------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 560px at -5% -12%, var(--glow-1), transparent 60%),
    radial-gradient(900px 520px at 105% -8%, var(--glow-2), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 6px; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }

.i { width: 18px; height: 18px; flex: none; display: block; }

.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }

/* ------------------------------------------------------------------ estructura */

.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px 14px 16px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 20px; text-decoration: none; color: inherit; }
.brand-mark { width: 36px; height: 36px; flex: none; filter: drop-shadow(0 6px 14px rgba(99, 102, 241, 0.35)); }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 11px;
  color: var(--text-2); text-decoration: none; font-weight: 550;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: var(--shadow); }
.nav a.active .i { color: var(--brand); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.host-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.host-name { font-weight: 600; font-size: 13px; }
.host-user { font-size: 12px; color: var(--muted); }
.foot-actions { display: flex; gap: 6px; }

.main { padding: 30px 34px 56px; width: 100%; max-width: 1320px; min-width: 0; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0; line-height: 1.2; }
.page-sub { color: var(--text-2); margin: 6px 0 0; }
.page-actions { display: flex; gap: 8px; align-items: center; }

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr); }
.split2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  min-width: 0;
  transition: opacity 0.2s;
}
.card.stale { opacity: 0.6; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-title { font-size: 14.5px; font-weight: 650; margin: 0; }
.card-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.card-foot { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }
.link { font-size: 13px; font-weight: 550; text-decoration: none; }
.link:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ cifras */

.stat { padding: 18px 20px 20px; }
.stat-head { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-weight: 550; font-size: 13px; }
.stat-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.stat-label { flex: 1; }
.stat-flag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; }
.stat-flag .i { width: 14px; height: 14px; }
.stat-flag.warn { color: var(--warn-text); }
.stat-flag.crit { color: var(--crit-text); }
.stat-value { font-size: 30px; font-weight: 650; letter-spacing: -0.02em; margin: 14px 0 2px; line-height: 1.1; white-space: nowrap; }
.stat-value small { font-size: 15px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.stat-sub { color: var(--muted); font-size: 12.5px; min-height: 19px; }

.meter {
  --meter: var(--series-1);
  height: 6px; margin-top: 14px; border-radius: 99px; overflow: hidden;
  background: color-mix(in srgb, var(--meter) 18%, transparent);
}
.meter > i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--meter); transition: width 0.6s ease, background 0.3s; }

/* ------------------------------------------------------------------ gráficas */

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--text-2); margin: -2px 0 8px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend .key { width: 16px; height: 2px; border-radius: 2px; display: inline-block; }

.chart { position: relative; border-radius: 10px; }
.chart-svg { display: block; overflow: visible; touch-action: pan-y; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .base-line { stroke: var(--axis); stroke-width: 1; }
.chart .axis-label { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .end-dot { stroke: var(--surface); stroke-width: 2; }
.chart .end-label { fill: var(--text-2); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; }
.chart-table { max-height: 200px; overflow: auto; }

.chart-tip {
  position: fixed; z-index: 70; pointer-events: none;
  min-width: 150px; padding: 9px 11px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 11px;
  box-shadow: var(--shadow);
  font-size: 12.5px;
}
.tip-time { color: var(--muted); font-size: 11.5px; margin-bottom: 5px; font-variant-numeric: tabular-nums; }
.tip-row { display: flex; align-items: center; gap: 8px; line-height: 1.7; }
.tip-row .key { width: 12px; height: 2px; border-radius: 2px; }
.tip-row b { font-weight: 650; font-variant-numeric: tabular-nums; }
.tip-row span { color: var(--text-2); }

/* ------------------------------------------------------------------ listas y tablas */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 550; color: var(--muted); font-size: 12px; padding: 6px 10px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: 0; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table.compact td { padding-top: 6px; padding-bottom: 6px; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ellipsis { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }

.svc-mini { display: flex; flex-direction: column; }
.svc-mini-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.svc-mini-row:last-child { border-bottom: 0; }
.svc-mini-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.svc-mini-state { color: var(--muted); font-size: 12.5px; }

.list-card { padding: 6px 20px; }
.row {
  display: grid; align-items: center; gap: 12px 18px;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.row:last-child { border-bottom: 0; }
.row-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-2); }
.row-text { min-width: 0; }
.row-title { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
a.row-title:hover { color: var(--brand); }
a.row-title .i { width: 14px; height: 14px; color: var(--muted); }
.row-meta { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.row-state { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; min-width: 112px; }
.muted-row { opacity: 0.6; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 7px; font-size: 12px; font-weight: 550; background: var(--surface-3); color: var(--text-2); }
.badge .i { width: 13px; height: 13px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--neutral-bg); color: var(--text-2); white-space: nowrap; }
.pill .i { width: 14px; height: 14px; }
.pill.good { background: var(--good-bg); color: var(--good-text); }
.pill.warn { background: var(--warn-bg); color: var(--warn-text); }
.pill.crit { background: var(--crit-bg); color: var(--crit-text); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.good { background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.dot.crit { background: var(--crit); box-shadow: 0 0 0 3px var(--crit-bg); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 8px; background: var(--surface-3); font-family: var(--mono); font-size: 12.5px; }
.chip.plain { padding-right: 10px; }
.chip-x { border: 0; background: transparent; color: var(--muted); width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; cursor: pointer; padding: 0; }
.chip-x:hover { background: var(--crit-bg); color: var(--crit-text); }
.chip-x .i { width: 14px; height: 14px; }
.chip-x.busy { opacity: 0.5; pointer-events: none; }

/* ------------------------------------------------------------------ botones y formularios */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: 13.5px; white-space: nowrap;
  cursor: pointer; position: relative;
  transition: background 0.15s, border-color 0.15s, filter 0.15s, opacity 0.15s;
}
.btn .i { width: 16px; height: 16px; }
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn.primary { background: var(--brand-grad); color: #fff; border-color: transparent; box-shadow: 0 8px 20px -8px rgba(79, 70, 229, 0.65); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { color: var(--crit-text); background: transparent; border-color: color-mix(in srgb, var(--crit) 35%, transparent); }
.btn.danger:hover { background: var(--crit-bg); }
.btn.danger.solid { background: var(--crit); color: #fff; border-color: transparent; }
.btn.danger.solid:hover { filter: brightness(1.08); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.block { width: 100%; height: 42px; }
.icon-btn { width: 34px; height: 34px; padding: 0; }
.icon-btn.sm { width: 32px; height: 32px; }

.btn.busy { color: transparent !important; pointer-events: none; }
.btn.busy::after {
  content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--text-2); border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
.btn.primary.busy::after, .btn.danger.solid.busy::after { border-color: #fff; border-right-color: transparent; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 12.5px; color: var(--muted); margin: 0; }
.input {
  height: 40px; width: 100%; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.input.code { letter-spacing: 0.3em; font-family: var(--mono); font-size: 18px; text-align: center; }

.toggles { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.toggle { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; background: var(--surface-2); }
.toggle:hover { border-color: var(--border-strong); }
.toggle input {
  appearance: none; -webkit-appearance: none; flex: none; margin: 1px 0 0;
  width: 38px; height: 22px; border-radius: 99px; position: relative; cursor: pointer;
  background: var(--surface-3); border: 1px solid var(--border-strong);
  transition: background 0.15s;
}
.toggle input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.15s;
}
.toggle input:checked { background: var(--brand); border-color: transparent; }
.toggle input:checked::after { transform: translateX(16px); }
.toggle-title { font-weight: 600; font-size: 13.5px; }
.toggle-hint { font-size: 12.5px; color: var(--muted); }

.form-error { padding: 10px 12px; border-radius: 10px; background: var(--crit-bg); color: var(--crit-text); font-size: 13px; font-weight: 550; margin-bottom: 14px; }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border-radius: 13px; font-size: 13.5px; margin-bottom: 16px; border: 1px solid var(--border); background: var(--surface-2); }
.notice .i { margin-top: 1px; }
.notice.warn { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.notice.warn > .i { color: var(--warn-text); }
.notice.crit { background: var(--crit-bg); border-color: color-mix(in srgb, var(--crit) 35%, transparent); }
.notice.crit > .i { color: var(--crit-text); }

/* ------------------------------------------------------------------ modales y avisos */

.modal-back {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 16px;
  background: rgba(4, 7, 13, 0.55);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  animation: fade 0.15s ease;
}
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px;
  box-shadow: var(--shadow-lg);
  animation: pop 0.18s ease;
}
.modal.wide { width: min(1000px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 4px; }
.modal-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; margin: 0; overflow-wrap: anywhere; }
.modal-sub { color: var(--text-2); margin: 4px 0 0; font-size: 13.5px; }
.modal-body { padding: 14px 22px 4px; }
.modal-text { color: var(--text-2); margin: 0 0 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 6px 22px 20px; }
.modal-foot.inline { padding: 4px 0 16px; }

.section-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 650; margin: 16px 0 8px; color: var(--text-2); }
.creds { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin: 0; }
.cred { display: grid; grid-template-columns: 104px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; border-top: 1px solid var(--border); background: var(--surface-2); }
.cred:first-child { border-top: 0; }
.cred dt { color: var(--muted); font-size: 12.5px; }
.cred dd { margin: 0; font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; }
.steps { margin: 16px 0 6px; padding-left: 20px; color: var(--text-2); font-size: 13.5px; }
.steps li { margin-bottom: 4px; }

.logs {
  margin: 0; padding: 14px 16px; border-radius: 12px; max-height: 62vh; overflow: auto;
  background: var(--code-bg); color: var(--code-text);
  font: 12px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
}

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 260px; max-width: 400px; padding: 12px 14px; border-radius: 13px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  font-size: 13.5px; animation: slide 0.2s ease;
}
.toast.good > .i { color: var(--good-text); }
.toast.crit > .i { color: var(--crit-text); }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity 0.25s, transform 0.25s; }

/* ------------------------------------------------------------------ estados */

.empty { text-align: center; padding: 44px 20px; color: var(--text-2); }
.empty-icon { width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.empty-icon .i { width: 24px; height: 24px; }
.empty h3 { margin: 0 0 6px; color: var(--text); font-size: 16px; }
.empty p { margin: 0 auto 18px; max-width: 420px; }
.loading-row { padding: 26px 0; color: var(--muted); text-align: center; }

/* ------------------------------------------------------------------ seguridad */

.score-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.score { font-size: 40px; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.score small { font-size: 16px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.check-icon { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.check-icon .i { width: 15px; height: 15px; }
.check.ok .check-icon { background: var(--good-bg); color: var(--good-text); }
.check.bad .check-icon { background: var(--crit-bg); color: var(--crit-text); }
.check-title { font-weight: 600; font-size: 13.5px; }
.check-hint { color: var(--muted); font-size: 12.5px; }
.jail { padding: 12px 0; border-top: 1px solid var(--border); }
.jail:first-of-type { border-top: 0; padding-top: 0; }
.jail-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 8px; }
.jail-name { font-weight: 650; }
.jail-stats { color: var(--muted); font-size: 12.5px; }
.fw-block + .fw-block { margin-top: 14px; }
.fw-label { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }

/* ------------------------------------------------------------------ login */

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(400px, 100%); padding: 32px 30px 28px; box-shadow: var(--shadow-lg); }
.login-card .brand { flex-direction: column; text-align: center; gap: 12px; padding: 0 0 22px; }
.login-card .brand-mark { width: 52px; height: 52px; }
.login-card .brand-name { font-size: 20px; }
.login-note { margin-top: 16px; text-align: center; color: var(--muted); font-size: 12.5px; }

/* ------------------------------------------------------------------ animaciones */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes slide { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------------ pantallas pequeñas */

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts, .split3, .split2 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    height: auto; flex-direction: row; align-items: center; gap: 8px;
    padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--border);
  }
  .brand { padding: 0; }
  .brand-text, .host-pill { display: none; }
  .nav { flex-direction: row; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
  .nav a { padding: 8px 10px; white-space: nowrap; }
  .nav a span { display: none; }
  .nav a.active span { display: inline; }
  .sidebar-foot { margin: 0; flex-direction: row; }
  .main { padding: 20px 16px 48px; }
  .row { grid-template-columns: minmax(0, 1fr) auto; }
  .row-state, .badges { grid-column: 1 / -1; grid-row: 2; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .row-actions { grid-column: 2; grid-row: 1; }
}

@media (max-width: 420px) {
  .nav a.active span { display: none; }
}

@media (max-width: 560px) {
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .page-title { font-size: 22px; }
  .row { grid-template-columns: minmax(0, 1fr); }
  .row-actions { grid-column: 1; grid-row: auto; justify-content: flex-start; min-width: 0; }
  .row-state, .badges { grid-row: auto; }
  .cred { grid-template-columns: minmax(0, 1fr) auto; }
  .cred dt { grid-column: 1 / -1; }
  .toasts { left: 16px; right: 16px; align-items: stretch; }
  .toast { max-width: none; }
}
