/* ===== Atlas — formal corporate dashboard (light + dark) ===== */
*,*::before,*::after{box-sizing:border-box}
:root{
  --r:8px;--r-lg:10px;--r-sm:6px;
  --fs:14px;
  --sidebar-w:244px;
  --ease:cubic-bezier(.4,0,.2,1);
}
html[data-theme="light"]{
  --bg:#f6f7f9;--surface:#ffffff;--surface-2:#fafbfc;--surface-3:#f3f4f6;
  --border:#e7e9ee;--border-2:#dde0e6;
  --text:#1a1c22;--muted:#646b78;--faint:#9097a5;
  --accent:#4f46e5;--accent-hover:#4338ca;--accent-weak:#eef0fe;--accent-text:#4338ca;
  --ok:#0a7a4b;--ok-bg:#e7f6ef;--err:#c02434;--err-bg:#fdecec;--warn:#9a6300;--warn-bg:#fdf3e1;
  --shadow:0 1px 2px rgba(20,22,40,.04);--shadow-pop:0 8px 28px -8px rgba(20,22,50,.18);
  --track:#eceef2;
}
html[data-theme="dark"]{
  --bg:#0b0d11;--surface:#14161b;--surface-2:#171a20;--surface-3:#1d2128;
  --border:#23262e;--border-2:#2c3039;
  --text:#e7e9ee;--muted:#98a0ae;--faint:#6b7280;
  --accent:#6366f1;--accent-hover:#7c7ff5;--accent-weak:#1c1e2e;--accent-text:#a5acff;
  --ok:#34d39a;--ok-bg:#10241d;--err:#f4787f;--err-bg:#2a161a;--warn:#e0a93a;--warn-bg:#241d10;
  --shadow:0 1px 2px rgba(0,0,0,.3);--shadow-pop:0 12px 32px -8px rgba(0,0,0,.6);
  --track:#23262e;
}
html,body{margin:0;padding:0}
body{font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;font-size:var(--fs);
  color:var(--text);background:var(--bg);line-height:1.55;-webkit-font-smoothing:antialiased}
a{color:inherit;text-decoration:none}
h1,h2,h3,h4{margin:0;font-weight:600;letter-spacing:-.01em;color:var(--text)}
.muted{color:var(--muted)}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}

/* ---------- App shell ---------- */
.app{display:grid;grid-template-columns:var(--sidebar-w) 1fr;min-height:100vh}
.aside-overlay{display:none}
.sidebar{position:sticky;top:0;height:100vh;display:flex;flex-direction:column;
  background:var(--surface);border-right:1px solid var(--border);padding:14px 12px}
.brand{display:flex;align-items:center;gap:10px;padding:8px 10px 16px;font-weight:600;font-size:15.5px}
.brand .mark{width:30px;height:30px;border-radius:8px;background:var(--accent);color:#fff;display:grid;place-items:center;flex:0 0 auto}
.brand .mark svg{width:17px;height:17px}
.nav{display:flex;flex-direction:column;gap:2px}
.nav-cap{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.07em;color:var(--faint);padding:14px 10px 6px}
.nav-item{display:flex;align-items:center;gap:11px;padding:8px 10px;border-radius:var(--r);color:var(--muted);
  font-weight:500;font-size:14px;transition:.13s var(--ease);position:relative}
.nav-item svg{width:18px;height:18px;flex:0 0 auto}
.nav-item:hover{background:var(--surface-3);color:var(--text)}
.nav-item.active{background:var(--accent-weak);color:var(--accent-text)}
.nav-item.active svg{color:var(--accent)}
.aside-foot{margin-top:auto;padding-top:12px;border-top:1px solid var(--border);display:flex;flex-direction:column;gap:2px}
.who{display:flex;align-items:center;gap:10px;padding:8px 10px}
.who .av{width:30px;height:30px;border-radius:50%;background:var(--accent-weak);color:var(--accent-text);
  display:grid;place-items:center;font-weight:600;font-size:12.5px;flex:0 0 auto}
.who .em{font-size:12.5px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ---------- Topbar + content ---------- */
.main{min-width:0;display:flex;flex-direction:column}
.topbar{display:flex;align-items:center;justify-content:space-between;gap:16px;
  padding:16px clamp(16px,3vw,30px);border-bottom:1px solid var(--border);background:var(--surface)}
.topbar .tt h1{font-size:19px}
.topbar .tt p{margin:2px 0 0;font-size:13px;color:var(--muted)}
.top-actions{display:flex;align-items:center;gap:10px}
.content{padding:clamp(18px,3vw,30px);max-width:1180px;width:100%}
.hamburger{display:none}

/* ---------- Cards / layout ---------- */
.grid{display:grid;gap:16px}
.kpis{grid-template-columns:repeat(4,1fr)}
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--r-lg);box-shadow:var(--shadow)}
.card-pad{padding:18px 20px}
.card-h{display:flex;align-items:center;justify-content:space-between;padding:14px 20px;border-bottom:1px solid var(--border)}
.card-h h3{font-size:14.5px}
.card-h .sub{font-size:12.5px;color:var(--faint)}

.kpi{padding:16px 18px;display:flex;flex-direction:column;gap:9px}
.kpi .lab{display:flex;align-items:center;gap:8px;font-size:12.5px;color:var(--muted);font-weight:500}
.kpi .lab .ic{width:28px;height:28px;border-radius:7px;background:var(--accent-weak);color:var(--accent);display:grid;place-items:center}
.kpi .lab .ic svg{width:16px;height:16px}
.kpi .val{font-size:26px;font-weight:600;letter-spacing:-.02em;line-height:1}
.kpi .meta{font-size:12px;color:var(--faint)}

.section-title{font-size:13px;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;margin:26px 0 12px}
.row-2{display:grid;grid-template-columns:1.5fr 1fr;gap:16px}

/* ---------- Tables ---------- */
.tbl-wrap{overflow-x:auto}
.tbl{width:100%;border-collapse:collapse;font-size:13.5px}
.tbl th{text-align:left;font-weight:500;color:var(--faint);font-size:11.5px;text-transform:uppercase;letter-spacing:.05em;
  padding:10px 16px;border-bottom:1px solid var(--border);background:var(--surface-2)}
.tbl td{padding:13px 16px;border-bottom:1px solid var(--border);vertical-align:middle}
.tbl tr:last-child td{border-bottom:none}
.tbl tbody tr:hover{background:var(--surface-2)}
.tbl .num{font-variant-numeric:tabular-nums}

/* ---------- Bits ---------- */
.badge{display:inline-flex;align-items:center;gap:5px;font-size:11.5px;font-weight:500;padding:3px 9px;border-radius:999px;border:1px solid var(--border-2)}
.badge.ok{color:var(--ok);background:var(--ok-bg);border-color:transparent}
.badge.off{color:var(--err);background:var(--err-bg);border-color:transparent}
.badge.neutral{color:var(--muted);background:var(--surface-3)}
.dot{width:6px;height:6px;border-radius:50%;background:currentColor;display:inline-block}
.chips{display:flex;flex-wrap:wrap;gap:6px}
.chip{font-size:11.5px;color:var(--muted);background:var(--surface-3);border:1px solid var(--border);border-radius:6px;padding:3px 8px}

.tokenbox{display:inline-flex;align-items:center;gap:8px;background:var(--surface-3);border:1px solid var(--border);
  border-radius:7px;padding:5px 6px 5px 11px;font-family:ui-monospace,monospace;font-size:12.5px;max-width:100%}
.tokenbox code{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* progress */
.meter{height:6px;border-radius:999px;background:var(--track);overflow:hidden;min-width:120px}
.meter>i{display:block;height:100%;background:var(--accent);border-radius:999px;width:0;transition:width .8s var(--ease)}
.meter>i.warn{background:var(--warn)}
.meter>i.hot{background:var(--err)}
.usage-cell{display:flex;flex-direction:column;gap:5px;min-width:160px}
.usage-cell .u-top{display:flex;justify-content:space-between;font-size:12px;color:var(--muted)}

/* ---------- Buttons / forms ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;padding:9px 15px;border-radius:var(--r);
  font-weight:500;font-size:13.5px;cursor:pointer;border:1px solid transparent;font-family:inherit;transition:.14s var(--ease);white-space:nowrap}
.btn svg{width:15px;height:15px}
.btn-primary{background:var(--accent);color:#fff}
.btn-primary:hover{background:var(--accent-hover)}
.btn-ghost{background:var(--surface);border-color:var(--border-2);color:var(--text)}
.btn-ghost:hover{background:var(--surface-3)}
.btn-sm{padding:6px 11px;font-size:12.5px}
.btn-block{width:100%}
.icon-btn{width:36px;height:36px;border-radius:var(--r);border:1px solid var(--border-2);background:var(--surface);
  color:var(--text);display:grid;place-items:center;cursor:pointer;transition:.14s var(--ease)}
.icon-btn:hover{background:var(--surface-3)}

.field{margin-bottom:14px}
.field label{display:block;font-size:13px;font-weight:500;margin-bottom:6px}
.field input,.field textarea,.input{width:100%;padding:10px 12px;border-radius:var(--r);border:1px solid var(--border-2);
  background:var(--surface);color:var(--text);font-size:14px;font-family:inherit;transition:.14s var(--ease)}
.field textarea{font-family:ui-monospace,monospace;font-size:12.5px;min-height:64px;resize:vertical}
.field input:focus,.field textarea:focus,.input:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-weak)}
.help{font-size:12px;color:var(--faint);margin-top:5px}

/* ---------- Alerts / empty ---------- */
.alert{padding:12px 14px;border-radius:var(--r);font-size:13.5px;margin-bottom:16px;border:1px solid var(--border);display:flex;gap:10px;align-items:flex-start}
.alert svg{width:17px;height:17px;flex:0 0 auto;margin-top:1px}
.alert.ok{background:var(--ok-bg);border-color:transparent;color:var(--ok)}
.alert.err{background:var(--err-bg);border-color:transparent;color:var(--err)}
.alert.token{flex-direction:column;background:var(--accent-weak);border-color:transparent;color:var(--text)}
.alert.token .tline{display:flex;gap:8px;align-items:center;width:100%;margin-top:8px;background:var(--surface);border:1px solid var(--border);border-radius:7px;padding:7px 7px 7px 11px}
.alert.token code{flex:1;font-family:ui-monospace,monospace;font-size:12.5px;overflow:hidden;text-overflow:ellipsis;color:var(--text)}
.empty{padding:48px 20px;text-align:center;color:var(--muted)}
.empty .ec{width:46px;height:46px;border-radius:11px;background:var(--surface-3);display:grid;place-items:center;margin:0 auto 14px;color:var(--faint)}
.empty .ec svg{width:22px;height:22px}
.empty h4{font-size:15px;margin-bottom:5px}
.copy-btn{display:inline-flex;align-items:center;gap:5px;padding:6px 10px;border-radius:6px;border:1px solid var(--border-2);
  background:var(--surface);color:var(--muted);cursor:pointer;font-size:12px;font-weight:500;transition:.13s var(--ease)}
.copy-btn:hover{color:var(--accent);border-color:var(--accent)}
.copy-btn.done{color:var(--ok);border-color:var(--ok)}
.toast{position:fixed;bottom:22px;left:50%;transform:translate(-50%,70px);background:var(--surface);border:1px solid var(--border-2);
  color:var(--text);padding:11px 18px;border-radius:9px;box-shadow:var(--shadow-pop);font-size:13.5px;font-weight:500;z-index:99;opacity:0;transition:.25s var(--ease);display:flex;align-items:center;gap:8px}
.toast.show{transform:translate(-50%,0);opacity:1}
.toast svg{width:16px;height:16px;color:var(--ok)}

/* chart */
.chart-box{position:relative;height:260px}
.chart-box.sm{height:220px}
.legend{display:flex;gap:14px;flex-wrap:wrap;margin-top:14px;font-size:12.5px;color:var(--muted)}
.legend span{display:inline-flex;align-items:center;gap:6px}
.legend i{width:9px;height:9px;border-radius:2px}

/* ---------- Plans ---------- */
.plan-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(248px,1fr));gap:16px}
.plan{display:flex;flex-direction:column;gap:12px;padding:22px}
.plan .pn{font-size:15px;font-weight:600}
.plan .pd{font-size:13px;color:var(--muted);min-height:34px}
.plan .pp{font-size:24px;font-weight:600;letter-spacing:-.02em}
.plan .pp small{font-size:13px;font-weight:500;color:var(--muted)}
.plan ul{list-style:none;margin:2px 0;padding:0;display:flex;flex-direction:column;gap:7px}
.plan li{font-size:13px;color:var(--muted);display:flex;align-items:center;gap:8px}
.plan li svg{width:15px;height:15px;color:var(--accent);flex:0 0 auto}

/* ---------- Auth ---------- */
.auth{min-height:100vh;display:grid;place-items:center;padding:28px 18px}
.auth-card{width:100%;max-width:404px;background:var(--surface);border:1px solid var(--border);border-radius:14px;box-shadow:var(--shadow-pop);padding:32px 30px}
.auth-brand{display:flex;align-items:center;gap:10px;font-weight:600;font-size:16px;margin-bottom:22px}
.auth-brand .mark{width:32px;height:32px;border-radius:8px;background:var(--accent);color:#fff;display:grid;place-items:center}
.auth-brand .mark svg{width:18px;height:18px}
.auth-card h1{font-size:21px;margin-bottom:5px}
.auth-card .sub{color:var(--muted);font-size:14px;margin-bottom:22px}
.auth-alt{text-align:center;margin-top:18px;font-size:13.5px;color:var(--muted)}
.auth-alt a{color:var(--accent);font-weight:500}
.auth-top{position:absolute;top:18px;right:18px}

/* ---------- Responsive ---------- */
@media(max-width:1000px){.kpis{grid-template-columns:repeat(2,1fr)}.row-2{grid-template-columns:1fr}}
@media(max-width:820px){
  .app{grid-template-columns:1fr}
  .sidebar{position:fixed;left:0;top:0;z-index:50;width:260px;transform:translateX(-103%);transition:.25s var(--ease);box-shadow:var(--shadow-pop)}
  .sidebar.open{transform:none}
  .hamburger{display:grid}
  .aside-overlay{display:block;position:fixed;inset:0;background:rgba(0,0,0,.4);z-index:49;opacity:0;pointer-events:none;transition:.25s}
  .aside-overlay.show{opacity:1;pointer-events:auto}
}
@media(max-width:520px){.kpis{grid-template-columns:1fr}.content{padding:16px}}
@media(prefers-reduced-motion:reduce){*{transition:none!important}}
html[data-theme="dark"] [data-mode-ico="light"]{display:none}
html[data-theme="light"] [data-mode-ico="dark"]{display:none}

/* docs prose */
.prose{font-size:14px;line-height:1.7;color:var(--text)}
.prose h2{font-size:16px;margin:24px 0 8px}
.prose p{margin:0 0 12px;color:var(--muted)}
.prose a{color:var(--accent);font-weight:500}
.prose code{font-family:ui-monospace,monospace;font-size:12.5px;background:var(--surface-3);border:1px solid var(--border);border-radius:5px;padding:1px 6px;color:var(--text)}
.prose pre{background:var(--surface-3);border:1px solid var(--border);border-radius:8px;padding:14px 16px;overflow-x:auto;font-family:ui-monospace,monospace;font-size:12.5px;line-height:1.6;margin:0 0 16px;color:var(--text)}
.prose pre code{background:none;border:none;padding:0}
.prose table{margin:0}
.prose td code{font-size:12px}

/* API tester + docs */
.try-out{margin-top:16px;border-top:1px solid var(--border);padding-top:14px}
.try-status{display:flex;align-items:center;gap:10px;margin-bottom:8px}
.try-pill{font-size:11.5px;font-weight:600;padding:3px 10px;border-radius:999px;background:var(--surface-3);color:var(--muted)}
.try-pill.ok{color:var(--ok);background:var(--ok-bg)}
.try-pill.err{color:var(--err);background:var(--err-bg)}
.try-out pre{background:var(--surface-3);border:1px solid var(--border);border-radius:8px;padding:14px 16px;overflow-x:auto;font-size:12.5px;line-height:1.55;margin:0;max-height:380px;color:var(--text)}
.tabs-bar{display:flex;gap:4px;margin-bottom:12px;border-bottom:1px solid var(--border);padding-bottom:0}
.tab-btn{padding:8px 13px;border:none;border-bottom:2px solid transparent;background:none;color:var(--muted);font-size:13px;font-weight:500;cursor:pointer;font-family:inherit;margin-bottom:-1px}
.tab-btn:hover{color:var(--text)}
.tab-btn.on{color:var(--accent-text);border-bottom-color:var(--accent)}
.tabs pre{background:var(--surface-3);border:1px solid var(--border);border-radius:8px;padding:14px 16px;overflow-x:auto;font-size:12.5px;line-height:1.6;margin:0 0 4px;color:var(--text)}
.param-name{font-family:ui-monospace,monospace;font-weight:500;color:var(--text);font-size:12.5px}
.req{font-size:10px;color:var(--err);font-weight:600;text-transform:uppercase;letter-spacing:.04em;margin-left:7px}
.prose h2{scroll-margin-top:80px}
