/* WiseAgent Hub — design system */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/vendor/fonts/inter-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/vendor/fonts/inter-latin-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/vendor/fonts/inter-latin-600.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/vendor/fonts/jetbrains-mono-latin.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/vendor/fonts/jetbrains-mono-latin-500.woff2") format("woff2");
}

:root {
  --bg: #0b1018;
  --sidebar: #101722;
  --surface: #151d29;
  --surface-2: #1d2836;
  --border: #2a3544;
  --border-strong: #3a4758;
  --text: #edf2f7;
  --muted: #94a3b8;
  --accent: #42c6a4;
  --accent-dim: rgba(66, 198, 164, 0.14);
  --success: #34c98a;
  --warning: #eab768;
  --critical: #f07178;
  --info: #77a9ee;
  --radius: 10px;
  --sidebar-w: 232px;
  --sidebar-w-collapsed: 64px;
  --header-h: 60px;
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px rgba(66, 198, 164, 0.45);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { font-size: 14px; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

:focus-visible { outline: none; box-shadow: var(--focus); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ——— Shell ——— */
.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  transition: grid-template-columns 0.18s ease;
}
.shell.sidebar-collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }
.shell.login-mode { grid-template-columns: 1fr; }

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: var(--header-h);
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mark {
  width: 28px; height: 28px; flex-shrink: 0;
  border-radius: 7px;
  background: var(--accent-dim);
  border: 1px solid rgba(66, 198, 164, 0.35);
  display: grid; place-items: center;
}
.mark svg { width: 14px; height: 14px; color: var(--accent); }
.brand-text { min-width: 0; }
.brand-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-text span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3) var(--space-2);
  flex: 1;
  overflow-y: auto;
}
.side-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}
.side-btn .nav-icon {
  width: 18px; height: 18px; flex-shrink: 0;
  display: grid; place-items: center;
  opacity: 0.85;
}
.side-btn .nav-icon svg { width: 16px; height: 16px; }
.side-btn:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.side-btn.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: inset 2px 0 0 var(--accent);
}
.side-btn.ghost { color: var(--muted); }
.sidebar-foot {
  padding: var(--space-3) var(--space-2) var(--space-4);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-collapsed .brand-text,
.sidebar-collapsed .side-btn .nav-label,
.sidebar-collapsed .side-btn .nav-badge { display: none; }
.sidebar-collapsed .side-btn { justify-content: center; padding: 10px; }
.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }

.workspace { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar-title h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.page-sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.freshness {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  opacity: 0.55;
}
.pulse.flash { animation: pulse 0.65s ease; }

main {
  flex: 1;
  padding: var(--space-6);
  max-width: 1400px;
  width: 100%;
}
.login-mode main { max-width: none; }

/* ——— Controls ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary {
  background: var(--accent);
  border-color: transparent;
  color: #0b1018;
  font-weight: 600;
}
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); }
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  padding-left: 8px;
  padding-right: 8px;
}
.btn.ghost:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.btn.sm { padding: 4px 8px; font-size: 12px; border-radius: 6px; }
.btn.danger { color: var(--critical); border-color: rgba(240, 113, 120, 0.35); }

.field { display: grid; gap: 6px; margin-bottom: var(--space-3); }
.field > span { font-size: 12px; color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.field input::placeholder { color: #64748b; }
.toggle {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); cursor: pointer; font-size: 13px;
  margin-bottom: var(--space-3);
}
.toggle input { width: 15px; height: 15px; accent-color: var(--accent); }
.linkish {
  justify-self: start;
  background: none; border: none; color: var(--accent);
  cursor: pointer; padding: 0; font-size: 12px; font-weight: 500;
}
.linkish:hover { text-decoration: underline; }
.form-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-2); }
.form-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}
.form-grid { display: grid; gap: var(--space-1); }
.status-line { min-height: 1.1rem; font-size: 12px; margin: 4px 0 0; }
.status-line.ok { color: var(--success); }
.status-line.err { color: var(--critical); }
.error { color: var(--critical); margin: 0 0 var(--space-3); font-size: 13px; }
.hint { font-size: 12px; margin: 0; color: var(--muted); }

/* ——— Login ——— */
.login-panel {
  max-width: 400px;
  margin: 12vh auto 0;
  padding: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.login-panel .eyebrow {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.login-panel h2 { margin: 0 0 6px; font-size: 20px; font-weight: 650; }
.lede { color: var(--muted); margin: 0 0 var(--space-5); font-size: 13px; }

/* ——— Panels / cards ——— */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.panel-head h3, .section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.section-label {
  margin: 0 0 var(--space-2);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.kpi .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.kpi .value {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 600;
  margin-top: 4px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.kpi .value.ok { color: var(--success); }
.kpi .value.warn { color: var(--warning); }
.kpi .value.crit { color: var(--critical); }
.kpi .sub,
.kpi .value .sub {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 400;
  font-family: var(--font);
  color: var(--muted);
  letter-spacing: 0;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.chart-panel canvas { width: 100% !important; max-height: 220px; }

/* ——— Tables ——— */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 0 14px;
  height: 46px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(0,0,0,0.18);
  white-space: nowrap;
  user-select: none;
}
.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { color: var(--text); }
.data-table th .sort-ind { opacity: 0.45; margin-left: 4px; font-size: 10px; }
.data-table th.sorted .sort-ind { opacity: 1; color: var(--accent); }
.data-table tbody tr { transition: background 0.1s ease; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:hover,
.data-table tbody tr.clickable:focus-within { background: var(--surface-2); }
.data-table td.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.data-table .cell-stack { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.data-table .cell-stack strong {
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.data-table .cell-stack span {
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.toolbar.tight { margin-bottom: var(--space-4); }
.toolbar-left, .toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 7px 12px;
  font-size: 13px;
  min-width: 200px;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.filter-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 7px 10px;
  font-size: 12px;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  margin: 0 0 var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.filter-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-right: 6px;
}
.chip-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 12px;
  cursor: pointer;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.chip-btn:hover { color: var(--text); border-color: var(--border-strong); }
.chip-btn.active {
  color: #0b1018;
  background: var(--accent);
  border-color: transparent;
  font-weight: 600;
}
.chip-btn:focus-visible { box-shadow: var(--focus); }

/* ——— Status chips ——— */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  line-height: 1.2;
}
.chip::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.chip.ok { color: var(--success); background: rgba(52, 201, 138, 0.1); border-color: rgba(52, 201, 138, 0.25); }
.chip.stale, .chip.warn { color: var(--warning); background: rgba(234, 183, 104, 0.1); border-color: rgba(234, 183, 104, 0.28); }
.chip.crit, .chip.revoked, .chip.critical { color: var(--critical); background: rgba(240, 113, 120, 0.1); border-color: rgba(240, 113, 120, 0.28); }
.chip.unknown, .chip.info { color: var(--info); background: rgba(119, 169, 238, 0.1); border-color: rgba(119, 169, 238, 0.25); }

.meter-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}
.meter-inline .bar {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: #0d1520;
  overflow: hidden;
  min-width: 48px;
}
.meter-inline .bar > span {
  display: block; height: 100%;
  background: var(--accent);
}
.meter-inline .bar.warn > span { background: var(--warning); }
.meter-inline .bar.crit > span { background: var(--critical); }
.meter-inline strong {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  min-width: 2.6em;
  text-align: right;
}

.bar { height: 5px; border-radius: 99px; background: #0d1520; overflow: hidden; min-width: 0; }
.bar > span {
  display: block; height: 100%; border-radius: inherit;
  background: var(--accent);
  transition: width 0.25s ease;
}
.bar.warn > span { background: var(--warning); }
.bar.crit > span { background: var(--critical); }

.meters { display: grid; gap: 6px; width: 100%; }
.meter-row {
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) 2.8rem;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.meter-row strong {
  font-family: var(--mono);
  color: var(--text);
  text-align: right;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ——— Lists / incidents ——— */
.stack { display: grid; gap: var(--space-2); }
.item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: default;
}
.item.clickable { cursor: pointer; }
.item.clickable:hover { background: var(--surface-2); }
.item.sev-critical { border-left-color: var(--critical); }
.item.sev-warning { border-left-color: var(--warning); }
.item.sev-info, .item.sev-ok { border-left-color: var(--info); }
.item-top {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: 4px;
  flex-wrap: wrap;
  align-items: center;
}
.item .kind { font-family: var(--mono); font-size: 12px; font-weight: 500; }
.item .msg { margin: 0; font-size: 13px; }
.item .msg.mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.item .when { color: var(--muted); font-size: 12px; margin-top: 4px; }
.hot { color: var(--critical); font-weight: 600; }
.compact-list { display: grid; gap: var(--space-2); }
.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  font-size: 13px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(21, 29, 41, 0.4);
}
.empty-inline { padding: 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* ——— Skeletons ——— */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease infinite;
  border-radius: 6px;
}
.skeleton-row { height: 46px; margin-bottom: 1px; }
.skeleton-kpi { height: 76px; }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ——— Node detail ——— */
.detail-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  margin-bottom: var(--space-4);
}
.detail-head h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.detail-head .meta { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.panels > .panel {
  min-width: 0; /* prevent grid blowout / overlap from wide tables */
  overflow: hidden;
}
.panels > .panel.span-all { grid-column: 1 / -1; }
.detail-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.detail-split > .panel {
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.detail-split .compact-list {
  max-height: 280px;
  overflow: auto;
}
.detail-split .data-table {
  width: 100%;
  table-layout: fixed;
}
.detail-split .data-table td,
.detail-split .data-table th {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-split .item {
  /* nested cards: lighter so they don't look like overlapping panels */
  background: rgba(0, 0, 0, 0.18);
  margin: 0;
}
@media (max-width: 720px) {
  .detail-split { grid-template-columns: 1fr; }
}
.stat {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 400;
  font-family: var(--font);
  color: var(--muted);
  letter-spacing: 0;
}
.spike-list { display: grid; gap: 4px; margin-top: var(--space-3); }
.spike-item {
  display: grid;
  grid-template-columns: 3.2rem 4.5rem 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(240, 113, 120, 0.06);
  border: 1px solid rgba(240, 113, 120, 0.18);
}
.spike-metric {
  font-family: var(--mono);
  text-transform: uppercase;
  color: #f3a0a0;
  font-weight: 600;
}
.spike-reason {
  color: var(--warning);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.spike-empty { margin: 8px 0 0; font-size: 12px; }

/* ——— Uptime ——— */
.uptime-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}
.check-form-panel { margin-bottom: var(--space-3); }
.check-form-panel.collapsed .check-form { display: none; }
.uptime-card {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(160px, 0.9fr) auto;
  gap: 12px 16px;
  align-items: center;
}
.uptime-card .meta-line {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  align-items: center; margin-top: 4px;
  font-size: 12px; color: var(--muted);
}
.uptime-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  text-align: center;
}
.uptime-stat .n {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.uptime-stat .l {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.spark {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 28px;
  width: 100%;
  min-width: 100px;
  margin-top: 8px;
}
.spark i {
  flex: 1;
  min-width: 2px;
  border-radius: 1px 1px 0 0;
  background: var(--success);
  opacity: 0.85;
}
.spark i.down { background: var(--critical); opacity: 0.9; }
.spark i.empty { background: var(--border); opacity: 0.5; height: 15% !important; }
.check-actions { display: flex; gap: 6px; }

/* ——— Settings ——— */
.settings-layout {
  display: grid;
  gap: var(--space-4);
  max-width: 720px;
}
.settings-panel .panel-head { margin-bottom: var(--space-4); }
.settings-panel .panel-head .muted { font-size: 12px; font-weight: 400; }

/* ——— Incident drawer ——— */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 100vw);
  background: var(--sidebar);
  border-left: 1px solid var(--border);
  z-index: 90;
  transform: translateX(100%);
  transition: transform 0.2s ease, width 0.2s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,0.35);
}
.drawer.wide { width: min(640px, 100vw); }
.drawer.open { transform: translateX(0); }
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5);
  border-bottom: 1px solid var(--border);
}
.drawer-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.drawer-body {
  padding: var(--space-5);
  overflow-y: auto;
  flex: 1;
}
.drawer-meta {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.drawer-meta dt {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0;
}
.drawer-meta dd {
  margin: 2px 0 0;
  font-size: 13px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

/* Incident summary / remedy */
.inc-summary { min-width: 0; max-width: 42rem; }
.inc-headline {
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.inc-headline-lg {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}
.inc-meta-bits {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}
.inc-meta-bits .chip { font-size: 10px; }
.inc-msg-cell { max-width: 36rem; vertical-align: top; }
.data-table td.inc-msg-cell {
  white-space: normal;
  word-break: break-word;
}
.inc-findings { margin: 0 0 16px; }
.inc-findings ul {
  margin: 0;
  padding-left: 1.1rem;
  max-height: 200px;
  overflow: auto;
}
.inc-findings li {
  margin: 4px 0;
  font-size: 12px;
  word-break: break-all;
}
.remedy-block {
  margin: 0 0 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.remedy-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.remedy-head strong { font-size: 13px; }
.remedy-script {
  margin: 0;
  max-height: 360px;
  overflow: auto;
  border: none;
  border-radius: 0;
  font-size: 11px;
  line-height: 1.45;
  white-space: pre;
  tab-size: 2;
}
.item .msg {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.health-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: var(--space-4);
  font-size: 13px;
}
.health-banner.ok { border-color: rgba(52, 201, 138, 0.3); }
.health-banner.warn { border-color: rgba(234, 183, 104, 0.35); }
.health-banner.crit { border-color: rgba(240, 113, 120, 0.35); }
.health-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
.health-banner.warn .health-dot { background: var(--warning); }
.health-banner.crit .health-dot { background: var(--critical); }

@keyframes pulse {
  0% { opacity: 0.55; transform: scale(1); }
  40% { opacity: 1; transform: scale(1.2); box-shadow: 0 0 0 4px rgba(66, 198, 164, 0.2); }
  100% { opacity: 0.55; transform: scale(1); }
}

/* ——— Web Stack diagnostics ——— */
.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-top: var(--space-4);
}
.timeline-list { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow: auto; }
.timeline-item {
  display: grid;
  grid-template-columns: 140px 90px 1fr;
  gap: 8px;
  text-align: left;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: inherit;
  padding: 8px 10px;
  cursor: pointer;
  font: inherit;
}
.timeline-item:hover { border-color: var(--accent, #38bdf8); }
.timeline-item .t { color: var(--muted); font-size: 12px; }
.timeline-item .c { font-weight: 600; font-size: 12px; text-transform: uppercase; }
.finding { border-top: 1px solid var(--border); padding: 10px 0; }
.finding-head { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }

/* ——— Intelligence ——— */
.intel-pane { margin-top: var(--space-3); }
.intel-toolbar { gap: var(--space-3); flex-wrap: wrap; align-items: flex-end; }
.field.inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  min-width: 120px;
}
.field.inline span { font-size: 11px; color: var(--muted); }
.intel-toolbar .field.inline { margin: 0; min-width: 120px; }
.intel-toolbar .field.inline span { font-size: 11px; }
.intel-toolbar select, .field.inline select {
  background: var(--bg, #0a1017);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  padding: 0.4rem 0.55rem;
  font: inherit;
  min-width: 140px;
}
.intel-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-3);
  max-width: 960px;
}
.intel-settings .panel { margin: 0; }
.intel-settings .form-row-2 { grid-template-columns: 1fr 1fr; }
.intel-report-panel { margin-top: var(--space-3); }
.intel-report-body { font-size: 13px; line-height: 1.45; }
.intel-report-body .report-title { margin: 0 0 4px; font-size: 15px; font-weight: 650; }
.intel-report-body .report-meta { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.intel-report-body .report-summary { margin: 0 0 12px; white-space: pre-wrap; }
.intel-report-body .report-section { margin: 14px 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.intel-report-body ul { margin: 0; padding-left: 1.1rem; }
.intel-report-body li { margin: 0.25rem 0; }
.intel-report-body .finding {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 8px;
  border-top: 1px solid var(--border);
  border-left: 3px solid var(--accent);
}
.intel-report-body .finding.sev-critical { border-left-color: var(--critical, var(--crit)); }
.intel-report-body .finding.sev-warning { border-left-color: var(--warning, var(--warn)); }
.intel-report-body .finding p { margin: 4px 0; }
.intel-chat-panel { max-width: 820px; display: flex; flex-direction: column; min-height: 420px; }
.intel-chat-log {
  flex: 1;
  min-height: 280px;
  max-height: 480px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.intel-chat-msg {
  max-width: 92%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  white-space: pre-wrap;
  line-height: 1.45;
}
.intel-chat-msg.user {
  align-self: flex-end;
  background: rgba(47, 159, 184, 0.16);
  border: 1px solid rgba(47, 159, 184, 0.3);
}
.intel-chat-msg.assistant {
  align-self: flex-start;
  background: var(--panel-2, rgba(255,255,255,0.03));
  border: 1px solid var(--border);
}
.intel-chat-msg .role {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}
.intel-chat-form { display: flex; gap: 8px; align-items: center; }
.intel-chat-form input {
  flex: 1;
  background: var(--bg, #0a1017);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.55rem 0.75rem;
  font: inherit;
}
.intel-empty { color: var(--muted); margin: 0; font-size: 13px; }
.code-block {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}
@media (max-width: 960px) {
  .split-2 { grid-template-columns: 1fr; }
  .timeline-item { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .shell:not(.login-mode) { grid-template-columns: 1fr; }
  .shell.sidebar-collapsed:not(.login-mode) { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .side-nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding: var(--space-2);
  }
  .side-btn { width: auto; flex: 1 1 auto; min-width: 100px; justify-content: center; }
  .sidebar-foot { flex-direction: row; border-top: none; padding-top: 0; }
  .sidebar-collapsed .brand-text,
  .sidebar-collapsed .side-btn .nav-label { display: block; }
  .dash-grid { grid-template-columns: 1fr; }
  .uptime-card { grid-template-columns: 1fr; }
  .topbar { padding: 0 var(--space-4); height: auto; min-height: var(--header-h); padding-top: 10px; padding-bottom: 10px; }
  .topbar-title h1 { font-size: 20px; }
  main { padding: var(--space-4); }
  .form-row { grid-template-columns: 1fr; }
  .kpi .value { font-size: 24px; }
}
@media (max-width: 640px) {
  .search-input { min-width: 0; width: 100%; }
  .toolbar { flex-direction: column; align-items: stretch; }
}
