:root {
  --bg: #07090c;
  --bg-1: #0d1218;
  --bg-2: #121a22;
  --bg-3: #18222c;
  --line: #243140;
  --text: #e8eef4;
  --muted: #8b9aab;
  --faint: #5c6b7a;
  --accent: #3ee0b2;
  --accent-2: #5b8cff;
  --danger: #ff5d6c;
  --warn: #f5c542;
  --ok: #3ee0b2;
  --orange: #ff8a4c;
  --purple: #b07cff;
  --shadow: 0 12px 40px rgba(0,0,0,.35);
  --radius: 12px;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
}
[data-theme="light"] {
  --bg: #f3f5f8;
  --bg-1: #ffffff;
  --bg-2: #eef2f6;
  --bg-3: #e4eaf0;
  --line: #d5deE8;
  --text: #12202c;
  --muted: #5b6b7a;
  --faint: #8795a3;
  --shadow: 0 10px 30px rgba(16,30,45,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); }
a { color: var(--accent-2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side {
  background: var(--bg-1);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; }
.logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, #163, #1a3a55);
  color: var(--accent); display: grid; place-items: center;
  font-weight: 700; letter-spacing: .04em;
}
.brand b { display: block; font-size: 13px; }
.brand span { color: var(--muted); font-size: 11px; }
.nav-label { color: var(--faint); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 14px 10px 6px; }
.nav a, .nav button.linkish {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 8px; color: var(--muted);
  background: none; border: 0; width: 100%; text-align: left;
}
.nav a:hover, .nav button.linkish:hover { background: var(--bg-2); color: var(--text); }
.nav a.active { background: var(--bg-3); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--bg-1);
  position: sticky; top: 0; z-index: 5;
}
.searchbox {
  flex: 1; display: flex; gap: 8px; align-items: center;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px;
}
.searchbox input { flex: 1; background: none; border: 0; outline: none; }
.icon-btn, .btn {
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
  border-radius: 10px; padding: 8px 12px;
}
.btn.primary { background: var(--accent); color: #06261c; border-color: transparent; font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.content { padding: 20px 22px 40px; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
.sub { color: var(--muted); margin-bottom: 18px; }
.cards { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 12px; }
.stat {
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 26px; font-weight: 600; margin-top: 4px; font-family: var(--mono); }
.grid-2 { display: grid; grid-template-columns: 1.4fr .9fr; gap: 12px; }
.panel {
  background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-top: 12px;
}
.panel h3 { margin: 0 0 12px; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--faint); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; white-space: nowrap; }
tr:hover td { background: var(--bg-2); }
.row-click { cursor: pointer; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--muted); white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; }
.dot.online, .dot.fresh, .dot.ok { background: var(--ok); }
.dot.degraded, .dot.recent { background: var(--warn); }
.dot.rate_limited, .dot.aging { background: var(--orange); }
.dot.error, .dot.auth_required { background: var(--danger); }
.dot.disabled, .dot.stale, .dot.unknown { background: var(--faint); }
.dot.running { background: var(--accent-2); }
.score {
  font-family: var(--mono); font-weight: 600;
}
.score.hi { color: var(--ok); }
.score.mid { color: var(--warn); }
.score.lo { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--bg-3); border-radius: 6px; padding: 2px 7px; font-size: 11px; color: var(--text); }
.avatar {
  width: 32px; height: 32px; border-radius: 8px; background: var(--bg-3);
  display: grid; place-items: center; overflow: hidden; font-size: 12px; color: var(--muted);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters input, .filters select, .field input, .field select, .field textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none;
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.wizard { max-width: 760px; }
.steps { display: flex; gap: 8px; margin-bottom: 16px; }
.steps span { flex: 1; height: 4px; background: var(--bg-3); border-radius: 4px; }
.steps span.on { background: var(--accent); }
.choice { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.choice button {
  background: var(--bg-1); border: 1px solid var(--line); border-radius: 12px; padding: 18px 12px; text-align: left;
}
.choice button.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice b { display: block; margin-bottom: 4px; }
.choice small { color: var(--muted); }
.drawer-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20;
  display: flex; justify-content: flex-end;
}
.drawer {
  width: min(1080px, 100%); height: 100%; background: var(--bg-1);
  border-left: 1px solid var(--line); display: grid;
  grid-template-columns: 240px 1fr 260px; overflow: auto;
}
.col { padding: 20px; border-right: 1px solid var(--line); }
.col:last-child { border-right: 0; }
.frag { color: var(--muted); font-size: 12px; margin: 0 0 10px 18px; }
.frag mark { background: rgba(62,224,178,.25); color: var(--text); padding: 0 2px; border-radius: 3px; }
.login {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(1200px 500px at 20% -10%, #123, transparent);
}
.login-card {
  width: 360px; background: var(--bg-1); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px; box-shadow: var(--shadow);
}
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 12px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 14px; }
.toast {
  position: fixed; right: 16px; bottom: 16px; background: var(--bg-2);
  border: 1px solid var(--line); padding: 10px 14px; border-radius: 10px; z-index: 50;
}
.empty { padding: 40px; text-align: center; color: var(--muted); }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.chart i { flex: 1; background: linear-gradient(180deg, var(--accent), #1a4); border-radius: 3px 3px 0 0; min-height: 2px; }
.side .grow { flex: 1; }
.bell { position: relative; }
.bell .n {
  position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff;
  border-radius: 99px; font-size: 10px; min-width: 16px; height: 16px; display: grid; place-items: center; padding: 0 4px;
}
.drop {
  position: absolute; right: 20px; top: 58px; width: 360px; max-height: 420px; overflow: auto;
  background: var(--bg-1); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 15;
}
.drop .item { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.src-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 10px; }
.src-card { background: var(--bg-1); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.check { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.mono { font-family: var(--mono); font-size: 12px; }
pre.log { background: var(--bg); padding: 12px; border-radius: 8px; overflow: auto; font-size: 12px; white-space: pre-wrap; }
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: relative; height: auto; flex-direction: row; flex-wrap: wrap; }
  .cards { grid-template-columns: 1fr 1fr; }
  .grid-2, .form-grid, .drawer { grid-template-columns: 1fr; }
  .choice { grid-template-columns: 1fr; }
}
