:root {
  --bg: #080A1A;
  --bg2: #0F1228;
  --bg3: #161B3A;
  --border: #1E2548;
  --text: #E2E8F0;
  --muted: #8892A4;
  --accent: #EC4899;
  --accent2: #F9A8D4;
  --ok: #34D399;
  --warn: #FBBF24;
  --fail: #F87171;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Auth pages ---- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px 32px;
  width: 380px;
}
.auth-card h1 { font-size: 1.3rem; margin: 0 0 4px; }
.auth-card .sub { color: var(--muted); font-size: 0.85rem; margin: 0 0 22px; }
.auth-card label { display: block; font-size: 0.78rem; color: var(--muted); margin: 14px 0 5px; }
.auth-card input {
  width: 100%; padding: 10px 12px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 7px; color: var(--text); font-size: 0.9rem;
}
.auth-card input:focus { outline: none; border-color: var(--accent); }
.auth-card button {
  width: 100%; margin-top: 20px; padding: 11px; background: var(--accent); color: #fff; border: none;
  border-radius: 7px; font-weight: 600; font-size: 0.9rem; cursor: pointer;
}
.auth-card button:hover { background: #db2777; }
.auth-card .switch { margin-top: 16px; font-size: 0.82rem; color: var(--muted); text-align: center; }
.auth-error {
  background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.35); color: var(--fail);
  padding: 9px 12px; border-radius: 7px; font-size: 0.82rem; margin-top: 14px;
}

/* ---- Chakra SSO banner ---- */
.chakra-banner {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  background: #0A0F1E; color: #fff; font-size: 0.75rem; padding: 6px 14px; text-decoration: none;
}
.chakra-banner .flash { color: var(--accent); font-weight: 600; }
.chakra-banner .lbl { color: #cbd5e1; }

/* ---- App shell ---- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 230px; flex: none; background: var(--bg2); border-right: 1px solid var(--border);
  padding: 18px 0; display: flex; flex-direction: column;
}
.sidebar .brand { display: flex; align-items: center; gap: 8px; padding: 0 18px 18px; font-weight: 700; font-size: 1.05rem; }
.sidebar .brand .dot { color: var(--accent); }
.nav-group { margin-bottom: 18px; }
.nav-group .nav-label {
  font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  padding: 0 18px; margin-bottom: 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 8px 18px; color: var(--text); font-size: 0.86rem;
  cursor: pointer; border-left: 2px solid transparent;
}
.nav-item:hover { background: var(--bg3); text-decoration: none; }
.nav-item.active { background: var(--bg3); border-left-color: var(--accent); color: var(--accent2); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; padding: 14px 26px;
  border-bottom: 1px solid var(--border); background: var(--bg2);
}
.topbar .who { font-size: 0.85rem; color: var(--muted); }
.topbar .who b { color: var(--text); }
.topbar .plan-badge {
  display: inline-flex; align-items: center; gap: 5px; background: var(--bg3); border: 1px solid var(--border);
  color: var(--accent2); padding: 3px 10px; border-radius: 100px; font-size: 0.74rem; margin-left: 8px;
}
.topbar button {
  background: transparent; border: 1px solid var(--border); color: var(--text); padding: 6px 14px;
  border-radius: 7px; cursor: pointer; font-size: 0.82rem;
}
.topbar button:hover { border-color: var(--accent); color: var(--accent2); }

.content { padding: 26px; overflow-x: auto; }

.section { display: none; }
.section.active { display: block; }

h2.section-title { font-size: 1.15rem; margin: 0 0 4px; }
.section-desc { color: var(--muted); font-size: 0.85rem; margin: 0 0 20px; }

.card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 18px;
}
.card h3 { margin: 0 0 14px; font-size: 0.95rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 900px) { .grid-2, .grid-4 { grid-template-columns: 1fr; } }

.stat { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.stat .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 6px; }
.stat .value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
th { color: var(--muted); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; }
tr:hover td { background: var(--bg3); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 100px; font-size: 0.74rem; font-weight: 600; }
.badge.ok { background: rgba(52,211,153,0.14); color: var(--ok); }
.badge.warn { background: rgba(251,191,36,0.14); color: var(--warn); }
.badge.fail { background: rgba(248,113,113,0.14); color: var(--fail); }

.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 5px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 8px 10px; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-size: 0.85rem; font-family: inherit;
}
.form-row textarea { font-family: ui-monospace, "SF Mono", Consolas, monospace; min-height: 70px; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: none; border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; border: none;
  padding: 9px 18px; border-radius: 7px; font-weight: 600; font-size: 0.85rem; cursor: pointer;
}
.btn:hover { background: #db2777; }
.btn.secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.secondary:hover { border-color: var(--accent); color: var(--accent2); }
.btn.small { padding: 5px 11px; font-size: 0.76rem; }
.btn.danger { background: transparent; border: 1px solid var(--fail); color: var(--fail); }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 0.85rem; }
.checkbox-row input { width: auto; }

.empty { color: var(--muted); font-size: 0.85rem; padding: 20px 0; text-align: center; }

.score-hero { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; }
.score-hero .score { font-size: 2.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.type-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.type-row:last-child { border-bottom: none; }
.type-row .name { width: 130px; font-weight: 600; }
.type-row .bar-wrap { flex: 1; height: 6px; background: var(--bg3); border-radius: 100px; overflow: hidden; }
.type-row .bar { height: 100%; background: var(--ok); }
.type-row .count { width: 90px; text-align: right; color: var(--muted); font-size: 0.8rem; }

.endpoint-block { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin-bottom: 12px; }
.endpoint-block .ep-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 600; }
.method-tag { font-size: 0.7rem; padding: 2px 7px; border-radius: 4px; background: var(--bg3); color: var(--accent2); font-weight: 700; }
.ep-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.ep-result { font-size: 0.82rem; padding: 8px 10px; background: var(--bg3); border-radius: 6px; }
.ep-result .rt { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; }

code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.85em; background: var(--bg3); padding: 1px 5px; border-radius: 4px; }
