:root {
  color-scheme: dark;
  --bg: #0d1018;
  --surface: #151a24;
  --surface-2: #1b2230;
  --line: #293245;
  --text: #eef2f8;
  --muted: #95a0b3;
  --accent: #4dd0a7;
  --accent-soft: rgba(77, 208, 167, .12);
  --danger: #ff6b7d;
  --warning: #f4c36a;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 240px 1fr; }
.sidebar { border-right: 1px solid var(--line); padding: 24px 16px; display: flex; flex-direction: column; background: #10151e; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 12px; align-items: center; margin: 0 8px 28px; }
.brand div:last-child { display: grid; }
.brand span { color: var(--muted); font-size: 13px; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: #06140f; font-weight: 800; }
nav { display: grid; gap: 4px; }
nav button { border: 0; background: transparent; color: var(--muted); text-align: left; padding: 11px 12px; border-radius: 10px; }
nav button:hover, nav button.active { color: var(--text); background: var(--accent-soft); }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--line); padding: 16px 8px 0; display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 13px; }
.text-button { color: var(--accent); border: 0; background: none; padding: 0; }
.content { padding: 30px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 24px; }
.topbar h1 { margin: 3px 0 0; font-size: clamp(24px, 4vw, 34px); }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: 12px; margin: 0; font-weight: 700; }
.muted { color: var(--muted); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; overflow: hidden; }
.panel h2 { margin: 0 0 16px; font-size: 18px; }
.panel-title { display: flex; justify-content: space-between; align-items: center; }
.panel-title > span { color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 8px; }
.metric span, .metric small { color: var(--muted); }
.metric strong { font-size: 28px; overflow-wrap: anywhere; }
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
th, td { border-bottom: 1px solid var(--line); padding: 12px 10px; text-align: left; font-size: 13px; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
td { overflow-wrap: anywhere; max-width: 360px; }
.status-pill { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; font-size: 12px; background: var(--surface-2); color: var(--muted); }
.status-pill.good { background: rgba(77, 208, 167, .12); color: var(--accent); }
.status-pill.bad { background: rgba(255, 107, 125, .12); color: var(--danger); }
.status-pill.warn { background: rgba(244, 195, 106, .12); color: var(--warning); }
.details { display: grid; gap: 12px; margin: 0; }
.details div { display: grid; gap: 3px; }
.details dt { color: var(--muted); font-size: 12px; }
.details dd { margin: 0; overflow-wrap: anywhere; }
.secondary, .primary { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; color: var(--text); background: var(--surface-2); }
.primary { width: 100%; color: #06140f; background: var(--accent); border-color: var(--accent); font-weight: 700; }
button:disabled { opacity: .6; cursor: wait; }
.empty { padding: 30px 0; color: var(--muted); text-align: center; }
.error-panel { border-color: rgba(255, 107, 125, .35); }
.error-message { color: var(--danger); margin: 0; }
.auth-page { display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(100%, 420px); background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 30px; }
.auth-card h1 { margin: 8px 0; }
.auth-card .brand-mark { margin-bottom: 22px; }
form { display: grid; gap: 16px; margin-top: 24px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 13px; }
input { width: 100%; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 10px; padding: 12px; outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sidebar-footer { margin-top: 16px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .content { padding: 18px; }
  .sidebar { padding: 18px 12px; }
  .sidebar nav { display: flex; overflow-x: auto; }
  nav button { white-space: nowrap; }
  .topbar { align-items: flex-start; }
  .topbar-actions { flex-direction: column; align-items: flex-end; }
  .metrics { grid-template-columns: 1fr; }
}
