/* ============================================================
   Centro de Cámaras — panel local de estado
   ============================================================ */
:root {
  --bg: #05080f;
  --bg-2: #070d18;
  --surface: rgba(14, 22, 37, 0.82);
  --surface-solid: #0e1625;
  --surface-2: rgba(20, 31, 50, 0.72);
  --line: rgba(148, 174, 214, 0.13);
  --line-strong: rgba(148, 174, 214, 0.24);
  --text: #e9f0fb;
  --muted: #8b9cb5;
  --muted-2: #64748b;
  --online: #2ee6a8;
  --online-rgb: 46, 230, 168;
  --warn: #f7b955;
  --warn-rgb: 247, 185, 85;
  --off: #ff6172;
  --off-rgb: 255, 97, 114;
  --idle: #7b8ca6;
  --idle-rgb: 123, 140, 166;
  --auth: #ff9448;
  --auth-rgb: 255, 148, 72;
  --accent: #61a1ff;
  --accent-rgb: 97, 161, 255;
  --radius: 16px;
  --shadow: 0 18px 44px -22px rgba(0, 0, 0, 0.9);
  --mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 620px at 82% -8%, rgba(46, 111, 208, 0.16), transparent 62%),
    radial-gradient(900px 520px at 6% 4%, rgba(46, 230, 168, 0.07), transparent 58%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 38%);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(640px 340px at 50% 118%, rgba(97, 161, 255, 0.09), transparent 70%);
  pointer-events: none;
}

::selection { background: rgba(var(--accent-rgb), 0.32); }

/* ---------------- topbar ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 28px;
  background: linear-gradient(180deg, rgba(5, 9, 16, 0.94), rgba(5, 9, 16, 0.72));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: #eaf5ff;
  background:
    linear-gradient(145deg, rgba(97, 161, 255, 0.28), rgba(46, 230, 168, 0.12)),
    rgba(16, 26, 43, 0.9);
  border: 1px solid rgba(148, 190, 255, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 22px -12px rgba(97, 161, 255, 0.7);
}
.brand-mark svg { width: 22px; height: 22px; }

.brand-text { min-width: 0; }
.brand-text h1 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-text p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions { display: flex; align-items: center; gap: 10px; }

.clock-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(12, 20, 34, 0.7);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--online);
  box-shadow: 0 0 0 0 rgba(var(--online-rgb), 0.55);
  animation: pulse 2.2s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(var(--online-rgb), 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(var(--online-rgb), 0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--online-rgb), 0); }
}

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
  background: linear-gradient(180deg, #3d7ef0, #2c64cc);
  border-color: rgba(150, 190, 255, 0.4);
  box-shadow: 0 10px 24px -12px rgba(61, 126, 240, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover { background: linear-gradient(180deg, #4b8bf7, #3570d8); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
  color: var(--muted);
}
.btn-ghost:hover { color: var(--text); border-color: var(--line-strong); background: rgba(255, 255, 255, 0.07); }

.btn.is-busy { pointer-events: none; opacity: 0.75; }
.btn.is-busy svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- layout ---------------- */
.wrap {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 26px 28px 40px;
}

/* ---------------- summary ---------------- */
.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.sum-card {
  position: relative;
  padding: 16px 18px 15px;
  border-radius: var(--radius);
  background: linear-gradient(160deg, rgba(20, 31, 50, 0.86), rgba(10, 17, 29, 0.92));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.sum-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--tone);
  opacity: 0.9;
}
.sum-card::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -60px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--tone-rgb), 0.16), transparent 68%);
  pointer-events: none;
}
.sum-top {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 550;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.sum-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tone);
  box-shadow: 0 0 10px rgba(var(--tone-rgb), 0.8);
}
.sum-card strong {
  display: block;
  margin: 8px 0 2px;
  font-size: 30px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.sum-card small { color: var(--muted-2); font-size: 11.5px; }

.tone-online { --tone: var(--online); --tone-rgb: var(--online-rgb); }
.tone-warn { --tone: var(--warn); --tone-rgb: var(--warn-rgb); }
.tone-off { --tone: var(--off); --tone-rgb: var(--off-rgb); }
.tone-idle { --tone: var(--idle); --tone-rgb: var(--idle-rgb); }
.tone-auth { --tone: var(--auth); --tone-rgb: var(--auth-rgb); }
.tone-accent { --tone: var(--accent); --tone-rgb: var(--accent-rgb); }

/* ---------------- toolbar ---------------- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filters { display: flex; gap: 6px; flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(13, 21, 35, 0.7);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip b {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 999px;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.is-active {
  color: #f2f8ff;
  background: rgba(97, 161, 255, 0.14);
  border-color: rgba(97, 161, 255, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.chip.is-active b { color: #dbeaff; background: rgba(97, 161, 255, 0.25); }

.toolbar-right { display: flex; align-items: center; gap: 14px; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(10, 17, 29, 0.75);
  color: var(--muted-2);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search:focus-within { border-color: rgba(97, 161, 255, 0.5); box-shadow: 0 0 0 3px rgba(97, 161, 255, 0.12); }
.search svg { width: 15px; height: 15px; flex: none; }
.search input {
  width: 210px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.search input::placeholder { color: var(--muted-2); }

.data-warning {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(var(--warn-rgb), 0.4);
  background: rgba(var(--warn-rgb), 0.1);
  color: var(--warn);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}
.data-warning[hidden] { display: none; }

.updated {
  color: var(--muted-2);
  font-size: 12px;
  font-family: var(--mono);
  white-space: nowrap;
}

/* ---------------- rango de fechas ---------------- */
.range-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.range-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.range-chip { height: 32px; font-size: 12px; }
.range-custom { display: flex; align-items: center; gap: 8px; }
.range-custom[hidden] { display: none; }
.range-custom input[type="date"] {
  height: 34px;
  padding: 0 9px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(10, 17, 29, 0.8);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  color-scheme: dark;
}
.range-custom input[type="date"]:focus {
  outline: none;
  border-color: rgba(97, 161, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(97, 161, 255, 0.12);
}
.range-sep { color: var(--muted-2); font-size: 12px; }
.btn-small { height: 32px; padding: 0 11px; font-size: 12px; }
.range-label {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  white-space: nowrap;
}

/* ---------------- uptime por día ---------------- */
.daily-panel {
  margin: 0 0 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 24, 39, 0.8), rgba(9, 15, 26, 0.9));
  box-shadow: var(--shadow);
  overflow: hidden;
}
.daily-wrap { max-height: 310px; overflow: auto; }
.daily-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.daily-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px 18px;
  background: #0d1625;
  border-bottom: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.daily-table th.num, .daily-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.daily-table td {
  padding: 9px 18px;
  border-bottom: 1px solid rgba(148, 174, 214, 0.06);
  color: #c9d8ec;
  white-space: nowrap;
}
.daily-table tr:last-child td { border-bottom: 0; }
.daily-table tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.daily-table td.num { font-family: var(--mono); font-size: 10.5px; }
.daily-table .up-high { color: var(--online); }
.daily-table .up-mid { color: var(--warn); }
.daily-table .up-low { color: var(--off); }
.daily-table .daily-empty { color: var(--muted-2); font-style: italic; }

/* ---------------- grid + cards ---------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(292px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(17, 27, 44, 0.88), rgba(9, 15, 26, 0.96));
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  animation: rise 0.32s ease both;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--tone), transparent 78%);
  opacity: 0.85;
  z-index: 3;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(var(--tone-rgb), 0.4);
  box-shadow: 0 26px 50px -26px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(var(--tone-rgb), 0.08);
}
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* thumbnail */
.shot-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 2px, transparent 2px 9px),
    radial-gradient(120% 120% at 30% 0%, #16233a, #080d17 72%);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.shot-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(4, 8, 14, 0.62), transparent 34%, transparent 52%, rgba(4, 8, 14, 0.78));
  pointer-events: none;
  z-index: 1;
}
.shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.card.has-shot .shot { opacity: 1; }

.shot-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: rgba(148, 174, 214, 0.42);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 0;
}
.shot-empty svg { width: 30px; height: 30px; }
.card.has-shot .shot-empty { display: none; }

.shot-top {
  position: absolute;
  z-index: 2;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px 4px 7px;
  border-radius: 999px;
  background: rgba(4, 8, 14, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f0f6ff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
}
.badge i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tone);
  box-shadow: 0 0 8px rgba(var(--tone-rgb), 0.9);
  flex: none;
}
.badge.is-live i { animation: pulse 2.2s ease-out infinite; }

.warn-tag {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: var(--warn);
  background: rgba(var(--warn-rgb), 0.18);
  border: 1px solid rgba(var(--warn-rgb), 0.6);
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex: none;
}
.warn-tag[hidden] { display: none; }

.lat {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(4, 8, 14, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #cfe0f7;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
}
.lat.is-empty { display: none; }

.shot-bottom {
  position: absolute;
  z-index: 2;
  left: 10px;
  right: 10px;
  bottom: 9px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}
.ip-chip {
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(4, 8, 14, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #d9e6f8;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ip-chip.is-empty { color: var(--muted-2); font-style: italic; font-family: inherit; }

/* body */
.card-body { padding: 13px 15px 14px; display: flex; flex-direction: column; gap: 10px; flex: 1; }

.card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-title h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 620;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.card-model {
  color: var(--muted);
  font-size: 11px;
  font-family: var(--mono);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 52%;
  padding-top: 2px;
}

.kv { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-height: 16px; }
.kv .k { color: var(--muted-2); font-size: 11px; flex: none; }
.kv .v {
  color: #c4d3e8;
  font-family: var(--mono);
  font-size: 10.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}
.kv .v.is-missing { color: var(--muted-2); font-family: inherit; font-style: italic; }

.spark { position: relative; height: 34px; margin-top: 1px; }
.spark svg { width: 100%; height: 100%; display: block; overflow: visible; }
.spark .area { fill: rgba(var(--tone-rgb), 0.09); }
.spark .line {
  fill: none;
  stroke: rgba(var(--tone-rgb), 0.8);
  stroke-width: 1.4;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.spark-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted-2);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.uptime { display: flex; align-items: center; gap: 8px; min-width: 0; }
.uptime .bar {
  width: 74px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  flex: none;
}
.uptime .bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--tone);
  transition: width 0.5s ease;
}
.uptime .pct { color: var(--muted); font-family: var(--mono); font-size: 10.5px; }
.card-foot .last { color: var(--muted-2); font-size: 10.5px; white-space: nowrap; }

/* no-ip card */
.card.tone-idle { cursor: default; }
.card.tone-idle:hover { transform: none; }
.card.tone-idle .shot { display: none; }

/* imagen antigua cuando el equipo está caído */
.card.tone-off .shot { filter: grayscale(1) brightness(0.55); }
.card.tone-auth .shot { filter: grayscale(0.85) brightness(0.7); }

.grid-empty {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  justify-content: center;
  padding: 46px 20px;
  margin-top: 14px;
  border-radius: var(--radius);
  border: 1px dashed var(--line-strong);
  background: rgba(12, 20, 34, 0.45);
  color: var(--muted-2);
  text-align: center;
}
.grid-empty strong { color: var(--muted); font-size: 14px; font-weight: 600; }
.grid-empty span { font-size: 12px; }
.grid-empty[hidden] { display: none; }

/* ---------------- events ---------------- */
.panels {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

.events-panel {
  margin-top: 0;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 24, 39, 0.8), rgba(9, 15, 26, 0.9));
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 13px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2 { margin: 0; font-size: 14px; font-weight: 620; }
.panel-head p { margin: 2px 0 0; color: var(--muted-2); font-size: 11.5px; }
.badge-soft {
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  white-space: nowrap;
}

.events { list-style: none; margin: 0; padding: 4px 0; max-height: 240px; overflow: auto; }
.events li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 18px;
  font-size: 12.5px;
  color: var(--muted);
  border-bottom: 1px solid rgba(148, 174, 214, 0.06);
}
.events li:last-child { border-bottom: 0; }
.events .ev-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--tone); margin-top: 5px; flex: none; }
.events b { color: #d9e6f8; font-weight: 600; }
.events .ev-arrow { color: var(--muted-2); }
.events time { margin-left: auto; color: var(--muted-2); font-family: var(--mono); font-size: 10.5px; flex: none; }
.event-empty { color: var(--muted-2); font-style: italic; }

/* historial de bajas (global) */
.outage-history li { flex-wrap: wrap; }
.outage-history .ev-name { color: #d9e6f8; font-weight: 600; }
.outage-history .ev-range {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  white-space: nowrap;
}
.outage-history .ev-dur {
  margin-left: auto;
  color: #c4d3e8;
  font-family: var(--mono);
  font-size: 10.5px;
  white-space: nowrap;
}
.outage-history li.is-open { background: rgba(var(--auth-rgb), 0.055); }
.outage-history .ev-live {
  color: var(--auth);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* historial dentro del modal */
.modal-history {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.modal-history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.modal-history-head h3 {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.modal-history-head span {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10.5px;
}
.outage-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 168px;
  overflow: auto;
}
.outage-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.outage-list .when {
  color: #c9d8ec;
  font-family: var(--mono);
  font-size: 10.5px;
  white-space: nowrap;
}
.outage-list .arrow { color: var(--muted-2); }
.outage-list .dur {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  white-space: nowrap;
}
.outage-list .ongoing { color: var(--auth); font-weight: 650; }
.outage-list .outage-empty { color: var(--muted-2); font-style: italic; }

/* ---------------- footer ---------------- */
.foot-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px 0;
  color: var(--muted-2);
  font-size: 10.5px;
  flex-wrap: wrap;
}
#foot-config { font-family: var(--mono); }
.storage-info {
  color: var(--online);
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(var(--online-rgb), 0.25);
  background: rgba(var(--online-rgb), 0.07);
}
.storage-info.is-json {
  color: var(--warn);
  border-color: rgba(var(--warn-rgb), 0.3);
  background: rgba(var(--warn-rgb), 0.07);
}

/* ---------------- modal ---------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 12, 0.76);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  animation: fade 0.18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(330px, 0.88fr);
  width: min(940px, 100%);
  max-height: min(92vh, 860px);
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(170deg, #111b2c, #0a111d 65%);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.95);
  overflow: hidden;
  animation: pop 0.2s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(4, 8, 14, 0.62);
  color: #dbe7f7;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.modal-close:hover { background: rgba(255, 255, 255, 0.14); }
.modal-close svg { width: 16px; height: 16px; }

.modal-shot {
  position: relative;
  min-height: 300px;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.02) 0 2px, transparent 2px 9px),
    radial-gradient(120% 120% at 30% 0%, #16233a, #060a12 74%);
  overflow: hidden;
}
.modal-shot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.modal-shot.has-shot img { opacity: 1; }
.modal-shot-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: rgba(148, 174, 214, 0.4);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.modal-shot-empty svg { width: 34px; height: 34px; }
.modal-shot.has-shot .modal-shot-empty { display: none; }
.modal-shot-top {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  right: 52px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-shot-bottom {
  position: absolute;
  z-index: 2;
  left: 12px;
  bottom: 11px;
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(4, 8, 14, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #d9e6f8;
  font-family: var(--mono);
  font-size: 11px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-body {
  padding: 22px 22px 18px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-head h2 { margin: 0; font-size: 20px; font-weight: 640; letter-spacing: -0.02em; }
.modal-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.modal-grid .cell {
  background: rgba(10, 17, 29, 0.92);
  padding: 9px 11px;
  min-width: 0;
}
.modal-grid .cell.wide { grid-column: 1 / -1; }
.modal-grid dt {
  color: var(--muted-2);
  font-size: 9.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin: 0 0 3px;
}
.modal-grid dd {
  margin: 0;
  color: #d7e4f6;
  font-size: 12px;
  font-family: var(--mono);
  overflow-wrap: anywhere;
}
.modal-grid dd.plain { font-family: inherit; font-size: 12.5px; }

.modal-alert {
  border-radius: 11px;
  padding: 10px 12px;
  border: 1px solid rgba(var(--warn-rgb), 0.34);
  background: rgba(var(--warn-rgb), 0.09);
  color: #f3d9a8;
  font-size: 12px;
  line-height: 1.5;
}
.modal-alert.is-error { border-color: rgba(var(--off-rgb), 0.4); background: rgba(var(--off-rgb), 0.09); color: #ffc0c7; }
.modal-alert b { display: block; margin-bottom: 2px; font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; opacity: 0.85; }
.modal-alert span { display: block; overflow-wrap: anywhere; }

.modal-actions { display: flex; gap: 9px; margin-top: auto; }
.modal-hint { margin: 0; color: var(--muted-2); font-size: 10.5px; line-height: 1.5; }

/* ---------------- scrollbars ---------------- */
* { scrollbar-width: thin; scrollbar-color: rgba(148, 174, 214, 0.24) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: rgba(148, 174, 214, 0.22); border-radius: 999px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------------- responsive ---------------- */
@media (max-width: 1100px) {
  .modal-card { grid-template-columns: 1fr; max-height: 90vh; }
  .modal-shot { min-height: 240px; max-height: 40vh; }
  .panels { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .topbar { padding: 12px 18px; }
  .wrap { padding: 20px 18px 34px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search input { width: 150px; }
  .brand-text p { display: none; }
}

@media (max-width: 620px) {
  .topbar { flex-wrap: wrap; }
  .top-actions { width: 100%; justify-content: space-between; }
  .summary { grid-template-columns: 1fr 1fr; gap: 10px; }
  .sum-card strong { font-size: 26px; }
  .grid { grid-template-columns: 1fr; }
  .toolbar-right { width: 100%; justify-content: space-between; }
  .search { flex: 1; }
  .search input { width: 100%; }
  .modal { padding: 10px; }
  .modal-grid { grid-template-columns: 1fr; }
  .modal-shot { min-height: 190px; }
}

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


/* ---------------- login ---------------- */
.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}
.login-card {
  position: relative;
  width: min(390px, 100%);
  padding: 30px 28px 22px;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: linear-gradient(170deg, rgba(18, 29, 48, 0.96), rgba(9, 15, 26, 0.98));
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, 0.95);
}
.login-brand {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  color: #eaf5ff;
  background: linear-gradient(145deg, rgba(97, 161, 255, 0.3), rgba(46, 230, 168, 0.12)), rgba(16, 26, 43, 0.9);
  border: 1px solid rgba(148, 190, 255, 0.28);
  box-shadow: 0 10px 26px -14px rgba(97, 161, 255, 0.8);
  margin-bottom: 16px;
}
.login-brand svg { width: 24px; height: 24px; }
.login-card h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.02em;
}
.login-sub {
  margin: 4px 0 22px;
  color: var(--muted);
  font-size: 12.5px;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.login-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 550;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.login-field input {
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(7, 12, 21, 0.75);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.login-field input:focus {
  border-color: rgba(97, 161, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(97, 161, 255, 0.12);
}
.login-submit { width: 100%; margin-top: 4px; height: 40px; }
.login-error {
  margin: 14px 0 0;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid rgba(var(--off-rgb), 0.4);
  background: rgba(var(--off-rgb), 0.1);
  color: #ffc0c7;
  font-size: 12px;
  line-height: 1.45;
}
.login-foot {
  margin: 22px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 10.5px;
  text-align: center;
}

/* ---------------- usuario / logout ---------------- */
.user-chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(12, 20, 34, 0.7);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}
.user-chip[hidden] { display: none; }
.btn-logout { height: 38px; }
