/* ============================================================
   NasPing — tema "NOC / holograma"
   Paleta: cian #00e5ff · púrpura #a78bfa · verde #34d399
            rojo #fb7185 · ámbar #fbbf24
   ============================================================ */

/* ---------- fuentes autoalojadas (woff2, sin CDN) ---------- */
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/static/fonts/SpaceGrotesk-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Space Grotesk';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/static/fonts/SpaceGrotesk-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/static/fonts/JetBrainsMono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
    U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
    U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/static/fonts/JetBrainsMono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7,
    U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}

/* ---------- tokens ---------- */
:root {
  --bg: #05070d;
  --bg-2: #0a0f1a;
  --cyan: #00e5ff;
  --purple: #a78bfa;
  --green: #34d399;
  --red: #fb7185;
  --amber: #fbbf24;
  --slate: #64748b;
  --text: #c9d6e3;
  --title: #eef4fb;
  --muted: rgba(201, 214, 227, .55);
  --faint: rgba(201, 214, 227, .3);
  --card-bg: rgba(13, 20, 33, .58);
  --card-bg-hi: rgba(17, 27, 44, .72);
  --card-border: rgba(0, 229, 255, .16);
  --card-glow: 0 0 24px rgba(0, 229, 255, .07);
  --radius: 14px;
  --sans: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.green { color: var(--green); }
.red { color: var(--red); }
.amber { color: var(--amber); }

h1, h2, h3 { color: var(--title); margin: 0; font-weight: 600; }
a { color: inherit; text-decoration: none; }

.ic {
  width: 16px; height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -3px;
}

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* ---------- fondo: rejilla en perspectiva + viñeta ---------- */
#bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(167, 139, 250, .10), transparent 60%),
    radial-gradient(ellipse 90% 60% at 50% 115%, rgba(0, 229, 255, .10), transparent 55%),
    var(--bg);
}
#bg::after {
  content: "";
  position: absolute;
  left: -60%; right: -60%; bottom: -18%;
  height: 65%;
  background:
    repeating-linear-gradient(90deg, rgba(0, 229, 255, .13) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(0deg, rgba(0, 229, 255, .13) 0 1px, transparent 1px 64px);
  transform: perspective(620px) rotateX(62deg);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,.9), transparent 85%);
  mask-image: linear-gradient(to top, rgba(0,0,0,.9), transparent 85%);
  animation: floor 18s linear infinite;
}
@keyframes floor { to { background-position: 0 64px, 0 64px; } }
#bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .55) 100%),
    repeating-linear-gradient(0deg, rgba(0, 229, 255, .03) 0 1px, transparent 1px 56px),
    repeating-linear-gradient(90deg, rgba(0, 229, 255, .03) 0 1px, transparent 1px 56px);
}

/* ---------- botones ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: .03em;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--card-border);
  border-radius: 9px;
  padding: 8px 16px;
  cursor: pointer;
  transition: box-shadow .15s ease, border-color .15s ease, background .15s ease, transform .1s ease, color .15s ease;
}
.btn:hover {
  border-color: rgba(0, 229, 255, .55);
  box-shadow: 0 0 14px rgba(0, 229, 255, .22);
}
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(135deg, #00e5ff, #00a8ff);
  border-color: transparent;
  color: #04121a;
  font-weight: 600;
  padding: 11px 16px;
}
.btn.primary:hover { box-shadow: 0 0 24px rgba(0, 229, 255, .5); }
.btn.ghost { padding: 7px 12px; font-size: 12.5px; background: rgba(13, 20, 33, .4); }
.btn.danger:hover { color: var(--red); border-color: rgba(251, 113, 133, .6); box-shadow: 0 0 14px rgba(251, 113, 133, .25); }
.btn.danger-solid {
  background: rgba(251, 113, 133, .16);
  border-color: rgba(251, 113, 133, .6);
  color: #ffd5dc;
  font-weight: 600;
}
.btn.danger-solid:hover { background: rgba(251, 113, 133, .28); box-shadow: 0 0 18px rgba(251, 113, 133, .35); }
.btn[disabled] { opacity: .4; cursor: default; box-shadow: none; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px; height: 34px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover { color: var(--cyan); border-color: var(--card-border); background: rgba(0, 229, 255, .06); }
.icon-btn.spin .ic { animation: spin .8s linear; }
@keyframes spin { to { transform: rotate(360deg); } }

/* control segmentado */
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: rgba(5, 7, 13, .55);
  border: 1px solid var(--card-border);
  border-radius: 10px;
}
.seg button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 500 12.5px var(--sans);
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg button:hover { color: var(--title); }
.seg button.active {
  color: var(--title);
  background: rgba(0, 229, 255, .14);
  box-shadow: inset 0 0 0 1px rgba(0, 229, 255, .45), 0 0 12px rgba(0, 229, 255, .18);
}
.seg button b {
  font: 500 11px var(--mono);
  color: var(--faint);
  min-width: 14px;
}
.seg button.active b { color: var(--cyan); }

.select {
  font: 500 12.5px var(--sans);
  color: var(--text);
  background: rgba(5, 7, 13, .55);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  outline: none;
}
.select option { background: var(--bg-2); }

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 22px;
  background: rgba(5, 7, 13, .72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(0, 229, 255, .12);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  position: relative;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 229, 255, .6);
  box-shadow: 0 0 12px rgba(0, 229, 255, .35), inset 0 0 8px rgba(0, 229, 255, .25);
  overflow: hidden;
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
}
.brand-mark i {
  position: absolute;
  inset: 0;
  background: conic-gradient(from 0deg, rgba(0, 229, 255, .55), transparent 28%);
  animation: sweep 2.8s linear infinite;
}
@keyframes sweep { to { transform: rotate(360deg); } }
.logo {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: .22em;
  color: var(--title);
  text-shadow: 0 0 18px rgba(0, 229, 255, .45);
}
.logo span { color: var(--cyan); }
.logo.small { font-size: 16px; letter-spacing: .2em; }

.health-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--card-border);
  background: rgba(13, 20, 33, .5);
  color: var(--muted);
}
.health-pill.ok { color: var(--green); border-color: rgba(52, 211, 153, .35); }
.health-pill.bad { color: var(--red); border-color: rgba(251, 113, 133, .45); background: rgba(251, 113, 133, .07); }
.health-pill .dot { width: 8px; height: 8px; }
.health-pill.ok .dot { background: var(--green); animation: pulse 2.2s ease-out infinite; }
.health-pill.bad .dot { background: var(--red); animation: blink 1.5s ease-in-out infinite; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex-wrap: wrap;
}
.clock {
  color: var(--cyan);
  font-size: 13px;
  padding: 0 4px;
  text-shadow: 0 0 10px rgba(0, 229, 255, .5);
}
.updated { font-size: 12px; color: var(--muted); }
.conn-error {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--amber);
  padding: 4px 10px; border-radius: 999px;
  background: rgba(251, 191, 36, .08); border: 1px solid rgba(251, 191, 36, .35);
}
.who-wrap { display: inline-flex; align-items: center; gap: 8px; padding-left: 8px; border-left: 1px solid rgba(0, 229, 255, .12); }
.avatar {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  font: 600 12px var(--sans);
  color: #04121a;
  background: linear-gradient(135deg, var(--cyan), var(--purple));
  text-transform: uppercase;
}
.who { font-size: 13px; color: var(--text); }

/* ---------- main ---------- */
main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px;
}
.card {
  background: var(--card-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--card-glow);
}

/* ---------- overview: anillo de salud + KPIs ---------- */
.overview {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
.health-card {
  position: relative;
  display: grid;
  place-items: center;
  padding: 16px;
  min-height: 170px;
}
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring.big { width: 150px; height: 150px; }
.ring-track { fill: none; stroke: rgba(148, 163, 184, .12); stroke-width: 9; }
.ring-val {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset .9s cubic-bezier(.2, .8, .2, 1), stroke .3s;
  filter: drop-shadow(0 0 6px currentColor);
}
.ring-val.good { stroke: var(--green); color: var(--green); }
.ring-val.warn { stroke: var(--amber); color: var(--amber); }
.ring-val.bad  { stroke: var(--red); color: var(--red); }
.health-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.health-pct { font-size: 30px; color: var(--title); line-height: 1; }
.health-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); margin-top: 6px; }

.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.kpi {
  position: relative;
  overflow: hidden;
  background: var(--card-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--card-glow);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}
.kpi::before {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 2px;
  border-radius: 2px;
  background: var(--cyan);
  opacity: .55;
}
.kpi-green::before { background: var(--green); }
.kpi-red::before { background: var(--red); }
.kpi-green .kpi-value { color: var(--green); }
.kpi-red .kpi-value { color: var(--red); }
.kpi-red.zero .kpi-value { color: var(--title); }
.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--muted);
}
.kpi-value { font-family: var(--mono); font-size: 26px; line-height: 1; color: var(--title); }
.kpi-value.small { font-size: 16px; }

/* ---------- toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.search {
  flex: 1 1 240px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--muted);
  background: rgba(5, 7, 13, .55);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--cyan); box-shadow: 0 0 14px rgba(0, 229, 255, .2); }
.search input {
  flex: 1;
  min-width: 0;
  font: 14px var(--sans);
  color: var(--title);
  background: transparent;
  border: 0;
  outline: none;
  padding: 9px 0;
}

/* ---------- grid de tarjetas ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}
.source-card {
  position: relative;
  padding: 16px 16px 14px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s;
  animation: card-in .45s ease both;
  overflow: hidden;
}
.source-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  opacity: .5;
}
.source-card.down::after { background: linear-gradient(90deg, transparent, var(--red), transparent); opacity: .8; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.source-card:hover {
  transform: translateY(-3px);
  background: var(--card-bg-hi);
  border-color: rgba(0, 229, 255, .45);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .35), 0 0 28px rgba(0, 229, 255, .16);
}
.source-card.down {
  border-color: rgba(251, 113, 133, .45);
  box-shadow: 0 0 24px rgba(251, 113, 133, .1);
}
.source-card.flash { animation: card-in .45s ease both, flash 1.4s ease 2; }
@keyframes flash { 50% { box-shadow: 0 0 0 2px rgba(0, 229, 255, .6), 0 0 30px rgba(0, 229, 255, .35); } }
.sc-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 12px;
}
.sc-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--title);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sc-body {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}
.sc-stats { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sc-last { font-size: 13px; color: var(--text); }
.sc-sub { font-size: 11.5px; color: var(--muted); font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-ring { position: relative; width: 54px; height: 54px; }
.mini-ring .ring-track, .mini-ring .ring-val { stroke-width: 11; }
.mini-ring b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 500 11.5px var(--mono);
  color: var(--title);
}
.spark { display: block; width: 100%; height: 34px; margin-top: 12px; }
.sc-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--faint);
  font-family: var(--mono);
}

/* barra "latido": tiempo desde el último ping frente al umbral */
.heartbeat { display: flex; align-items: center; gap: 10px; }
.hb-track {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: rgba(148, 163, 184, .12);
  overflow: hidden;
}
.hb-fill {
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: var(--green);
  box-shadow: 0 0 8px currentColor;
  transition: width 1s linear, background .3s;
}
.hb-fill.warn { background: var(--amber); }
.hb-fill.bad { background: var(--red); }
.hb-text { font-size: 11px; color: var(--muted); white-space: nowrap; }
.source-card .heartbeat { margin-top: 10px; }

/* vista lista */
.grid.list { grid-template-columns: 1fr; gap: 6px; }
.grid.list .source-card {
  display: grid;
  grid-template-columns: minmax(180px, 1.4fr) 1fr 120px 1.2fr 60px;
  align-items: center;
  gap: 18px;
  padding: 10px 16px;
  border-radius: 10px;
}
.grid.list .source-card:hover { transform: none; }
.grid.list .sc-head { margin: 0; min-width: 0; }
.grid.list .sc-head .badge { display: none; }
.grid.list .sc-body { display: contents; }
.grid.list .mini-ring { width: 40px; height: 40px; justify-self: end; grid-column: 5; grid-row: 1; }
.grid.list .mini-ring b { font-size: 9.5px; }
.grid.list .spark { margin: 0; height: 26px; grid-column: 4; grid-row: 1; }
.grid.list .heartbeat { margin: 0; grid-column: 3; grid-row: 1; }
.grid.list .hb-text { display: none; }
.grid.list .sc-foot { display: none; }
.grid.list .sc-stats { grid-column: 2; grid-row: 1; }

/* ---------- puntos de estado ---------- */
.dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--slate);
}
.dot.active {
  background: var(--green);
  animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); }
  70%  { box-shadow: 0 0 0 11px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}
.dot.down {
  background: var(--red);
  box-shadow: 0 0 10px rgba(251, 113, 133, .7);
  animation: blink 1.5s ease-in-out infinite;
}
@keyframes blink { 50% { opacity: .3; } }

.badge {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge.active { color: var(--green); border-color: rgba(52, 211, 153, .4); background: rgba(52, 211, 153, .1); }
.badge.down { color: var(--red); border-color: rgba(251, 113, 133, .45); background: rgba(251, 113, 133, .1); }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
}
.empty h3 { margin: 22px 0 6px; font-size: 18px; }
.empty p { margin: 0; }
.empty.small { padding: 40px 20px; }

/* ---------- radar (login / vacío) ---------- */
.radar {
  position: relative;
  width: 86px; height: 86px;
  margin: 0 auto;
  border-radius: 50%;
  border: 1px solid rgba(0, 229, 255, .35);
  background: radial-gradient(circle, rgba(0, 229, 255, .08), transparent 70%);
  overflow: hidden;
}
.radar span {
  position: absolute;
  inset: 50%;
  border: 1px solid rgba(0, 229, 255, .6);
  border-radius: 50%;
  animation: ripple 3s ease-out infinite;
}
.radar span:nth-child(2) { animation-delay: 1s; }
.radar span:nth-child(3) { animation-delay: 2s; }
@keyframes ripple {
  from { inset: 50%; opacity: 1; }
  to   { inset: 0; opacity: 0; }
}
.radar i {
  position: absolute;
  inset: 0;
  background: conic-gradient(from 0deg, rgba(0, 229, 255, .45), transparent 25%);
  animation: sweep 3s linear infinite;
}
.radar::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 8px; height: 8px;
  margin: -4px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: min(380px, 92vw);
  padding: 36px 34px 34px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: center;
  animation: card-in .5s ease both;
}
.login-card .logo { font-size: 30px; margin: 4px 0 6px; }
.float { position: relative; text-align: left; }
.float input {
  width: 100%;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--title);
  background: rgba(5, 7, 13, .5);
  border: 1px solid rgba(0, 229, 255, .25);
  border-radius: 10px;
  padding: 14px 14px 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.float input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 16px rgba(0, 229, 255, .25);
}
.float span {
  position: absolute;
  left: 13px;
  top: 13px;
  font-size: 14px;
  color: var(--muted);
  pointer-events: none;
  transition: all .15s ease;
}
.float input:focus + span,
.float input:not(:placeholder-shown) + span {
  top: -7px;
  left: 11px;
  font-size: 11px;
  color: var(--cyan);
  background: #0b1220;
  padding: 0 5px;
  border-radius: 4px;
}
.error { color: var(--red); font-size: 13px; margin: 0; }
.login-card.shake { animation: shake .4s ease; }
@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* ---------- detalle ---------- */
#view-detail { display: flex; flex-direction: column; gap: 16px; animation: card-in .35s ease both; }
.detail-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.detail-actions { display: flex; gap: 8px; }
.detail-head {
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.detail-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.detail-title h2 {
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: .02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-title .badge { margin-left: 4px; }
.detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: center;
}
.uptimes { display: flex; gap: 16px; }
.up-ring {
  position: relative;
  width: 92px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.up-ring svg { width: 92px; height: 92px; }
.up-ring b {
  position: absolute;
  top: 0; left: 0;
  width: 92px; height: 92px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--title);
}
.up-ring span { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.detail-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px 20px;
  margin: 0;
}
.detail-meta dt {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin-bottom: 4px;
}
.detail-meta dd { margin: 0; font-size: 13.5px; color: var(--title); }
.detail-meta dd small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }

.range-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.section-title, .card-title, .chart-card h3 {
  font-size: 12.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.card-title { padding: 16px 18px 12px; }

.charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.chart-card { padding: 16px 18px; }
.chart-card h3 { margin-bottom: 12px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.chart-head h3 { margin: 0; }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.lg-active { background: rgba(52, 211, 153, .9); }
.lg-down { background: rgba(251, 113, 133, .7); }
.lg-nodata { background: rgba(148, 163, 184, .2); }
.chart-box { position: relative; height: 250px; }
.status-wrap { position: relative; }
.status-line { display: block; width: 100%; height: 64px; cursor: crosshair; }
.status-tip {
  position: absolute;
  top: -8px;
  transform: translate(-50%, -100%);
  pointer-events: none;
  font: 11.5px var(--mono);
  color: var(--title);
  white-space: nowrap;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(13, 20, 33, .96);
  border: 1px solid rgba(0, 229, 255, .35);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .5);
  z-index: 2;
}
.status-tip b { font-weight: 600; }

.split { display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; gap: 14px; align-items: start; }

/* incidencias */
.outages { list-style: none; margin: 0; padding: 0 10px 12px; max-height: 470px; overflow-y: auto; }
.outages li {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-bottom: 1px solid rgba(0, 229, 255, .06);
  font-size: 12.5px;
}
.outages li:last-child { border-bottom: 0; }
.outages li > i { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 8px rgba(251, 113, 133, .6); }
.outages li.ongoing > i { animation: blink 1.5s ease-in-out infinite; }
.outages .o-when { font-family: var(--mono); color: var(--text); }
.outages .o-when small { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.outages .o-dur { font-family: var(--mono); color: var(--red); font-size: 12px; }
.outages .ok-msg { display: flex; align-items: center; gap: 8px; color: var(--green); grid-template-columns: none; border: 0; padding: 18px 8px; }

/* ---------- tabla histórico ---------- */
.table-wrap { overflow-x: auto; padding: 0 6px 6px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th {
  text-align: left;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(0, 229, 255, .18);
}
td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(0, 229, 255, .06);
  font-family: var(--mono);
  white-space: nowrap;
}
td.payload {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
}
td.skew-warn { color: var(--amber); }
tbody tr:hover td { background: rgba(0, 229, 255, .045); }
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 18px 16px;
}
#h-page { font-size: 12px; color: var(--muted); }

.foot {
  text-align: center;
  font-size: 11px;
  color: var(--faint);
  padding: 8px 20px 26px;
}

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(2, 4, 8, .7);
  backdrop-filter: blur(4px);
  animation: fade .2s ease both;
}
@keyframes fade { from { opacity: 0; } }
.modal-card { width: min(420px, 100%); padding: 22px 22px 18px; animation: card-in .25s ease both; }
.modal-card h3 { font-size: 17px; margin-bottom: 8px; }
.modal-card p { margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.modal-card p code { font-family: var(--mono); color: var(--title); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- toasts ---------- */
.toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(340px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(13, 20, 33, .95);
  border: 1px solid var(--card-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  font-size: 13px;
  cursor: pointer;
  animation: toast-in .3s cubic-bezier(.2, .8, .2, 1) both;
}
.toast.out { animation: toast-out .25s ease both; }
.toast .ic { margin-top: 1px; }
.toast b { color: var(--title); font-family: var(--mono); font-weight: 600; }
.toast.down { border-color: rgba(251, 113, 133, .55); }
.toast.down .ic { color: var(--red); }
.toast.up { border-color: rgba(52, 211, 153, .5); }
.toast.up .ic { color: var(--green); }
.toast.info .ic { color: var(--cyan); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .split { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .grid.list .source-card { grid-template-columns: minmax(150px, 1.3fr) 1fr 1fr 44px; }
  .grid.list .heartbeat { display: none; }
  .grid.list .spark { grid-column: 3; }
  .grid.list .mini-ring { grid-column: 4; }
}
@media (max-width: 900px) {
  .overview { grid-template-columns: 1fr; }
  .health-card { min-height: 0; grid-template-columns: auto 1fr; justify-items: start; gap: 18px; }
  .health-card .ring.big { width: 96px; height: 96px; }
  .health-center { position: static; align-items: flex-start; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .charts { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  main { padding: 12px; }
  .topbar { padding: 10px 12px; gap: 10px; }
  .updated, .clock, .who { display: none; }
  .who-wrap { border: 0; padding: 0; }
  .kpi-value { font-size: 21px; }
  .chart-box { height: 210px; }
  .uptimes { justify-content: space-between; }
  .up-ring, .up-ring svg, .up-ring b { width: 78px; }
  .up-ring svg, .up-ring b { height: 78px; }
  .detail-meta { grid-template-columns: repeat(2, 1fr); }
  .detail-title h2 { font-size: 18px; }
  .toolbar .select { flex: 1; }
  .grid.list .source-card { grid-template-columns: 1fr 44px; gap: 10px; }
  .grid.list .sc-stats, .grid.list .spark { display: none; }
  .grid.list .mini-ring { grid-column: 2; }
}

/* ---------- accesibilidad: movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
