/* ==========================================================================
   Tokens de tema: claro por defecto, oscuro por sistema o elegido a mano.
   ========================================================================== */
@property --angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }

:root {
  color-scheme: light;
  --bg: #f3f5fa; --card: rgba(255,255,255,.82); --card-solid: #ffffff; --surface-2: #f1f4f9;
  --text: #0f172a; --muted: #64748b; --border: #e2e8f0; --border-strong: #cbd5e1;
  --primary: #3b5bfd; --primary-2: #7c3aed; --primary-text: #ffffff;
  --up: #16a34a; --up-bg: #dcfce7; --down: #dc2626; --down-bg: #fee2e2;
  --warn: #d97706; --warn-bg: #fef3c7; --pending: #64748b; --pending-bg: #e8edf4;
  --paused: #7c3aed; --paused-bg: #ede9fe;
  --aurora-1: rgba(59,91,253,.13); --aurora-2: rgba(124,58,237,.10); --aurora-3: rgba(22,163,74,.08);
  --topbar-bg: rgba(255,255,255,.72);
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 6px 20px -8px rgba(15,23,42,.08);
  --shadow-hover: 0 12px 32px -10px rgba(15,23,42,.18);
  --glow-up: 0 0 0 1px rgba(22,163,74,.14), 0 6px 18px -6px rgba(22,163,74,.35);
  --glow-down: 0 0 0 1px rgba(220,38,38,.18), 0 6px 20px -6px rgba(220,38,38,.45);
  --glow-primary: 0 8px 24px -6px rgba(59,91,253,.55);
  --ring: 0 0 0 3px rgba(59,91,253,.22);
  --text-glow: 35%;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #080c18; --card: rgba(19,26,44,.72); --card-solid: #121a2c; --surface-2: #19223a;
    --text: #e5eaf3; --muted: #94a3b8; --border: #232e48; --border-strong: #34425f;
    --primary: #6d8bff; --primary-2: #a78bfa;
    --up: #4ade80; --up-bg: rgba(34,197,94,.14); --down: #f87171; --down-bg: rgba(239,68,68,.16);
    --warn: #fbbf24; --warn-bg: rgba(245,158,11,.15); --pending: #94a3b8; --pending-bg: rgba(148,163,184,.14);
    --paused: #c4b5fd; --paused-bg: rgba(139,92,246,.18);
    --aurora-1: rgba(79,110,255,.20); --aurora-2: rgba(147,51,234,.14); --aurora-3: rgba(34,197,94,.08);
    --topbar-bg: rgba(8,12,24,.62);
    --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 10px 30px -12px rgba(0,0,0,.6);
    --shadow-hover: 0 1px 0 rgba(255,255,255,.05) inset, 0 16px 40px -12px rgba(0,0,0,.75);
    --glow-up: 0 0 0 1px rgba(74,222,128,.22), 0 0 22px -2px rgba(74,222,128,.30);
    --glow-down: 0 0 0 1px rgba(248,113,113,.30), 0 0 26px -2px rgba(248,113,113,.40);
    --glow-primary: 0 0 26px -2px rgba(109,139,255,.60);
    --ring: 0 0 0 3px rgba(109,139,255,.35);
    --text-glow: 60%;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080c18; --card: rgba(19,26,44,.72); --card-solid: #121a2c; --surface-2: #19223a;
  --text: #e5eaf3; --muted: #94a3b8; --border: #232e48; --border-strong: #34425f;
  --primary: #6d8bff; --primary-2: #a78bfa;
  --up: #4ade80; --up-bg: rgba(34,197,94,.14); --down: #f87171; --down-bg: rgba(239,68,68,.16);
  --warn: #fbbf24; --warn-bg: rgba(245,158,11,.15); --pending: #94a3b8; --pending-bg: rgba(148,163,184,.14);
  --paused: #c4b5fd; --paused-bg: rgba(139,92,246,.18);
  --aurora-1: rgba(79,110,255,.20); --aurora-2: rgba(147,51,234,.14); --aurora-3: rgba(34,197,94,.08);
  --topbar-bg: rgba(8,12,24,.62);
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 10px 30px -12px rgba(0,0,0,.6);
  --shadow-hover: 0 1px 0 rgba(255,255,255,.05) inset, 0 16px 40px -12px rgba(0,0,0,.75);
  --glow-up: 0 0 0 1px rgba(74,222,128,.22), 0 0 22px -2px rgba(74,222,128,.30);
  --glow-down: 0 0 0 1px rgba(248,113,113,.30), 0 0 26px -2px rgba(248,113,113,.40);
  --glow-primary: 0 0 26px -2px rgba(109,139,255,.60);
  --ring: 0 0 0 3px rgba(109,139,255,.35);
  --text-glow: 60%;
}

/* ==========================================================================
   Animaciones
   ========================================================================== */
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); }
  70%  { box-shadow: 0 0 0 .55em transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes blink { 50% { opacity: .3; } }
@keyframes spin-angle { to { --angle: 360deg; } }
@keyframes drift { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(0,-3%,0) scale(1.06); } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes halo { 0% { r: 3; opacity: .7; } 100% { r: 12; opacity: 0; } }
@keyframes changed { from { background-color: color-mix(in srgb, var(--primary) 22%, transparent); } to { background-color: transparent; } }
@keyframes countdown { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes pop { from { opacity: 0; transform: rotate(-90deg) scale(.5); } to { opacity: 1; transform: none; } }
@keyframes shine { from { transform: translateX(-120%) skewX(-20deg); } to { transform: translateX(220%) skewX(-20deg); } }

/* ==========================================================================
   Base
   ========================================================================== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background-color .3s ease, color .3s ease;
}
/* Fondo "aurora" sutil */
body::before {
  content: ""; position: fixed; inset: -10%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40rem 28rem at 8% -4%, var(--aurora-1), transparent 70%),
    radial-gradient(36rem 26rem at 96% 2%, var(--aurora-2), transparent 70%),
    radial-gradient(40rem 30rem at 50% 110%, var(--aurora-3), transparent 70%);
  animation: drift 18s ease-in-out infinite alternate;
}
::selection { background: color-mix(in srgb, var(--primary) 30%, transparent); }
a { color: var(--primary); text-decoration: none; transition: color .15s ease; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1 { font-size: 1.55rem; margin: 0 0 .25rem; letter-spacing: -.02em; font-weight: 700; }
h2 { font-size: 1.05rem; margin: 1.75rem 0 .65rem; letter-spacing: -.01em; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
code { background: var(--surface-2); padding: .05em .35em; border-radius: 5px; font-size: .88em; }
pre.pre { white-space: pre-wrap; background: var(--surface-2); padding: 1rem; border-radius: var(--radius); font-size: .85em; overflow: auto; border: 1px solid var(--border); }

.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* ==========================================================================
   Topbar
   ========================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--topbar-bg); border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px) saturate(1.5); -webkit-backdrop-filter: blur(14px) saturate(1.5);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 700; color: var(--text); font-size: 1.05rem; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%; flex: none;
  background: var(--up); color: var(--up);
  box-shadow: 0 0 10px var(--up);
  animation: pulse 2.4s ease-out infinite;
}
.brand-title { display: flex; align-items: center; justify-content: center; gap: .6rem; margin-bottom: 1.25rem; }
.nav { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.nav-link { position: relative; color: var(--muted); padding: .4rem .65rem; border-radius: 8px; font-weight: 500; transition: color .2s ease, background-color .2s ease; }
.nav-link:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.nav-link::after {
  content: ""; position: absolute; left: .65rem; right: .65rem; bottom: -11px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  box-shadow: 0 0 10px var(--primary);
  transform: scaleX(0); transition: transform .25s ease;
}
.nav-link.active { color: var(--text); }
.nav-link.active::after { transform: scaleX(1); }

/* Botón de tema */
.theme-toggle {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border-radius: 50%; border: 1px solid var(--border); background: var(--card); color: var(--muted);
  cursor: pointer; transition: color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .15s ease;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); box-shadow: var(--glow-primary); }
.theme-toggle:active { transform: scale(.92); }
.theme-toggle:focus-visible { outline: none; box-shadow: var(--ring); }
.theme-toggle svg { width: 17px; height: 17px; display: none; animation: pop .35s ease; }
.theme-toggle[data-mode="auto"] .ico-auto,
.theme-toggle[data-mode="light"] .ico-light,
.theme-toggle[data-mode="dark"] .ico-dark { display: block; }
.theme-corner { position: fixed; top: 16px; right: 16px; z-index: 5; }

.footer { color: var(--muted); font-size: .8rem; padding: 2.5rem 16px 2rem; text-align: center; }
main.container { padding-top: 1.5rem; padding-bottom: 1rem; }

/* Entrada escalonada del contenido */
main > * { animation: fade-up .45s cubic-bezier(.2,.7,.2,1) backwards; }
main > :nth-child(2) { animation-delay: .04s; }
main > :nth-child(3) { animation-delay: .08s; }
main > :nth-child(4) { animation-delay: .12s; }
main > :nth-child(5) { animation-delay: .16s; }
main > :nth-child(6) { animation-delay: .20s; }
main > :nth-child(n+7) { animation-delay: .24s; }

/* ==========================================================================
   Cards y layout
   ========================================================================== */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem; box-shadow: var(--shadow); margin-bottom: 1rem;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: background-color .3s ease, border-color .3s ease, box-shadow .3s ease;
}
.card-narrow { max-width: 420px; margin: 3rem auto; animation: fade-up .5s cubic-bezier(.2,.7,.2,1) backwards; }
/* Borde luminoso que gira (login / instalación) */
.card-glow {
  padding: 1.75rem 1.5rem;
  border: 1px solid transparent;
  background:
    linear-gradient(var(--card-solid), var(--card-solid)) padding-box,
    conic-gradient(from var(--angle), var(--border) 0 55%, var(--primary) 70%, var(--primary-2) 80%, var(--border) 95%) border-box;
  box-shadow: var(--shadow), 0 0 60px -20px color-mix(in srgb, var(--primary) 60%, transparent);
  animation: fade-up .5s cubic-bezier(.2,.7,.2,1) backwards, spin-angle 7s linear infinite;
}
body.centered { padding: 16px; display: grid; place-items: center; }
body.centered > .card-narrow { width: 100%; margin: 2rem auto; }
.empty { text-align: center; padding: 3rem 1rem; }
.empty::before {
  content: ""; display: block; width: 14px; height: 14px; margin: 0 auto 1rem; border-radius: 50%;
  background: var(--primary); color: var(--primary); box-shadow: 0 0 18px var(--primary);
  animation: pulse 2.4s ease-out infinite;
}
.table-wrap { padding: 0; overflow-x: auto; }
.table-wrap.scroll { max-height: 520px; overflow-y: auto; }
.table-wrap > p { margin: 0; padding: 1rem; }

/* Barra de cuenta regresiva hasta el próximo auto-refresh */
.refresh-bar { height: 2px; overflow: hidden; }
.refresh-bar::before {
  content: ""; display: block; height: 100%; transform-origin: left;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  box-shadow: 0 0 8px var(--primary); opacity: .75;
  animation: countdown 60s linear infinite;
}
.refresh-bar.restart::before { animation: none; }

/* ==========================================================================
   Tablas
   ========================================================================== */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: .7rem .85rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.table tbody tr { transition: background-color .2s ease; }
.table tbody tr:hover { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.table tr:last-child td { border-bottom: 0; }
.table.small th, .table.small td { padding: .45rem .65rem; font-size: .85rem; }
.table-wrap.scroll th { position: sticky; top: 0; z-index: 1; background: var(--card-solid); }
.table tr.is-down { background: color-mix(in srgb, var(--down) 6%, transparent); }
.table tr.is-down > td:first-child { box-shadow: inset 3px 0 0 var(--down), inset 14px 0 18px -14px var(--down); }
.table tr.is-down:hover { background: color-mix(in srgb, var(--down) 9%, transparent); }
td.changed, .changed { animation: changed 1.2s ease-out; }
#monitors tbody tr { animation: fade-up .4s cubic-bezier(.2,.7,.2,1) backwards; }
#monitors tbody tr:nth-child(2) { animation-delay: .03s; }
#monitors tbody tr:nth-child(3) { animation-delay: .06s; }
#monitors tbody tr:nth-child(4) { animation-delay: .09s; }
#monitors tbody tr:nth-child(5) { animation-delay: .12s; }
#monitors tbody tr:nth-child(n+6) { animation-delay: .15s; }

.num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.strong { font-weight: 600; color: var(--text); }
a.strong:hover { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.ellipsis { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ok { color: var(--up); } .err { color: var(--down); } .warn { color: var(--warn); }
.inline { display: inline; }

/* ==========================================================================
   Encabezados, pills, badges, tags
   ========================================================================== */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.stats { display: flex; gap: .5rem; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .4rem .85rem; border-radius: 999px; font-size: .85rem;
  background: var(--pending-bg); color: var(--pending);
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  transition: box-shadow .3s ease, opacity .3s ease, transform .2s ease;
}
.pill:hover { transform: translateY(-1px); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill b { font-variant-numeric: tabular-nums; color: var(--text); font-size: .95rem; }
.pill-up { background: var(--up-bg); color: var(--up); box-shadow: var(--glow-up); }
.pill-up::before { animation: pulse 2.4s ease-out infinite; }
.pill-down { background: var(--down-bg); color: var(--down); box-shadow: var(--glow-down); }
.pill-down::before { animation: pulse 1.2s ease-out infinite; }
.pill-pending { background: var(--pending-bg); color: var(--pending); }
.pill-pending::before { animation: blink 1.6s ease-in-out infinite; }
.pill-paused { background: var(--paused-bg); color: var(--paused); }
.pill.is-zero { box-shadow: none; opacity: .6; }
.pill.is-zero::before { animation: none; }

.badge {
  display: inline-flex; align-items: center; gap: .4em;
  padding: .2rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; line-height: 1.4;
  transition: background-color .3s ease, color .3s ease, box-shadow .3s ease;
}
.badge::before { content: ""; width: .55em; height: .55em; border-radius: 50%; background: currentColor; flex: none; }
.badge-up { background: var(--up-bg); color: var(--up); }
.badge-up::before { box-shadow: 0 0 6px currentColor; animation: pulse 2.4s ease-out infinite; }
.badge-down { background: var(--down-bg); color: var(--down); box-shadow: var(--glow-down); }
.badge-down::before { box-shadow: 0 0 8px currentColor; animation: pulse 1.1s ease-out infinite; }
.badge-pending { background: var(--pending-bg); color: var(--pending); }
.badge-pending::before { animation: blink 1.6s ease-in-out infinite; }
.badge-paused { background: var(--paused-bg); color: var(--paused); }
h1 .badge { font-size: .7rem; vertical-align: middle; }
.tag {
  display: inline-block; padding: .08rem .5rem; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: .72rem; font-weight: 600; letter-spacing: .03em; color: var(--muted);
}

/* ==========================================================================
   Botones
   ========================================================================== */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .55rem .95rem; border-radius: 9px; border: 1px solid var(--border);
  background: var(--card-solid); color: var(--text); font: inherit; font-weight: 500;
  cursor: pointer; line-height: 1.2; white-space: nowrap;
  transition: transform .15s ease, box-shadow .2s ease, background-color .2s ease, border-color .2s ease, color .2s ease, filter .2s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); border-color: var(--border-strong); box-shadow: var(--shadow-hover); }
.btn:active { transform: translateY(0) scale(.97); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; border-radius: 8px; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  border-color: transparent; color: var(--primary-text);
  box-shadow: 0 4px 14px -6px var(--primary);
}
.btn-primary:hover { border-color: transparent; box-shadow: var(--glow-primary); filter: brightness(1.08); }
.btn-primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  transform: translateX(-120%) skewX(-20deg); pointer-events: none;
}
.btn-primary:hover::after { animation: shine .7s ease; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--down); border-color: color-mix(in srgb, var(--down) 55%, transparent); background: transparent; }
.btn-danger:hover { background: var(--down-bg); border-color: var(--down); box-shadow: var(--glow-down); }
.btn-block { width: 100%; }

/* ==========================================================================
   Mensajes flash
   ========================================================================== */
.flash {
  padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem;
  border: 1px solid transparent;
  animation: slide-in .4s cubic-bezier(.2,.7,.2,1) backwards;
  transition: opacity .4s ease, transform .4s ease, margin .4s ease, padding .4s ease, max-height .4s ease;
  max-height: 12rem; overflow: hidden;
}
.flash-success { background: var(--up-bg); color: var(--up); border-color: color-mix(in srgb, var(--up) 30%, transparent); box-shadow: var(--glow-up); }
.flash-error { background: var(--down-bg); color: var(--down); border-color: color-mix(in srgb, var(--down) 30%, transparent); box-shadow: var(--glow-down); }
.flash.is-hiding { opacity: 0; transform: translateY(-6px); max-height: 0; margin-bottom: 0; padding-top: 0; padding-bottom: 0; }

/* ==========================================================================
   Formularios
   ========================================================================== */
.form label { display: block; margin-bottom: 1rem; font-weight: 500; }
.form label small { display: block; font-weight: 400; margin-bottom: .2rem; }
.form input[type=text], .form input[type=url], .form input[type=email], .form input[type=password], .form input[type=number],
.form select, .form textarea,
.card input[type=text], .card input[type=email], .card input[type=password] {
  width: 100%; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 400; margin-top: .3rem;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.form input:hover, .form select:hover, .form textarea:hover, .card input:hover { border-color: var(--border-strong); }
.form input:focus, .form select:focus, .form textarea:focus, .card input:focus {
  outline: none; border-color: var(--primary); background: var(--card-solid); box-shadow: var(--ring);
}
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 1rem; height: 1rem; }
.form textarea { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.form fieldset {
  border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem .35rem; margin: 0 0 1.1rem;
  background: color-mix(in srgb, var(--surface-2) 40%, transparent);
}
.form legend { padding: 0 .45rem; font-weight: 600; font-size: .85rem; color: var(--muted); letter-spacing: .01em; }
.form .check, .card .check { display: flex; align-items: center; gap: .55rem; font-weight: 400; cursor: pointer; }
.form .check input { margin: 0; }
.card label { display: block; margin-bottom: 1rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
.align-top { align-items: start; }
[data-types] { display: none; }
[data-types].show { display: block; animation: fade-up .3s ease backwards; }
.grid-2[data-types].show, .grid-3[data-types].show { display: grid; }

/* ==========================================================================
   Tiles de métricas
   ========================================================================== */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem; margin-bottom: 1rem; }
.tile {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .9rem 1rem; box-shadow: var(--shadow);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  animation: fade-up .45s cubic-bezier(.2,.7,.2,1) backwards;
}
.tile:nth-child(2) { animation-delay: .04s; }
.tile:nth-child(3) { animation-delay: .08s; }
.tile:nth-child(4) { animation-delay: .12s; }
.tile:nth-child(5) { animation-delay: .16s; }
.tile:nth-child(n+6) { animation-delay: .20s; }
.tile::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--primary-2));
  box-shadow: 0 0 10px var(--primary);
  opacity: 0; transition: opacity .25s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: var(--border-strong); }
.tile:hover::before { opacity: 1; }
.tile-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.tile-value { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; margin-top: .15rem; }
.tile-value small { font-size: .8rem; font-weight: 400; color: var(--muted); }
.tile-value.small-value { font-size: 1rem; }
.tile-value.ok  { text-shadow: 0 0 18px color-mix(in srgb, var(--up) var(--text-glow), transparent); }
.tile-value.warn { text-shadow: 0 0 18px color-mix(in srgb, var(--warn) var(--text-glow), transparent); }
.tile-value.err { text-shadow: 0 0 18px color-mix(in srgb, var(--down) var(--text-glow), transparent); }

/* ==========================================================================
   Gráfico
   ========================================================================== */
.chart-wrap { padding: .9rem; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .line {
  fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--primary) 70%, transparent));
  stroke-dasharray: 1; stroke-dashoffset: 0;
  animation: draw 1.6s cubic-bezier(.4,0,.2,1) both;
}
.chart .area { animation: fade 1s ease .6s both; }
.chart .area-stop-top { stop-color: var(--primary); stop-opacity: .32; }
.chart .area-stop-bottom { stop-color: var(--primary); stop-opacity: 0; }
.chart .dot { fill: var(--primary); filter: drop-shadow(0 0 4px var(--primary)); }
.chart .halo { fill: var(--primary); animation: halo 2s ease-out 1.6s infinite; opacity: 0; }
.chart .fail-line { stroke: var(--down); stroke-width: 2; opacity: .7; filter: drop-shadow(0 0 3px var(--down)); animation: fade .6s ease .3s both; }
.legend { display: flex; gap: 1rem; font-size: .8rem; color: var(--muted); margin-top: .4rem; flex-wrap: wrap; }
.lg::before { content: ""; display: inline-block; width: 14px; height: 3px; margin-right: .4rem; vertical-align: middle; border-radius: 2px; }
.lg-line::before { background: linear-gradient(90deg, var(--primary), var(--primary-2)); box-shadow: 0 0 6px var(--primary); }
.lg-fail::before { background: var(--down); box-shadow: 0 0 6px var(--down); }

/* ==========================================================================
   Instalación
   ========================================================================== */
.checklist { list-style: none; padding: 0; margin: 0 0 1rem; }
.checklist li { padding: .2rem 0; animation: fade-up .35s ease backwards; }
.checklist li:nth-child(2) { animation-delay: .05s; }
.checklist li:nth-child(3) { animation-delay: .10s; }
.checklist li:nth-child(4) { animation-delay: .15s; }
.checklist li:nth-child(n+5) { animation-delay: .20s; }
.checklist li.ok { color: var(--up); }
.checklist li.fail { color: var(--down); }

/* ==========================================================================
   Responsive y accesibilidad
   ========================================================================== */
@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .ellipsis { max-width: 200px; }
  .topbar { position: static; }
  .topbar-inner { height: auto; padding: .6rem 0; flex-direction: column; align-items: flex-start; gap: .5rem; }
  .nav-link::after { bottom: -2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-delay: 0s !important;
    animation-iteration-count: 1 !important; transition-duration: .001ms !important;
  }
  .refresh-bar { display: none; }
}
