:root {
  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #f1f3f9; --border: #e3e6ef;
  --text: #171a26; --muted: #5d6478; --faint: #8b91a3;
  --accent: #4f46e5; --accent-2: #eef0ff; --accent-text: #ffffff;
  --ok: #0f8a5f; --ok-bg: #e5f6ef; --warn: #a15c00; --warn-bg: #fff3dd; --err: #c0303a; --err-bg: #fde8ea;
  --code-bg: #0f1220; --code-text: #e6e8f2;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,20,40,.06), 0 4px 16px rgba(16,20,40,.05);
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f17; --surface: #151824; --surface-2: #1c2030; --border: #2a2f42;
    --text: #e8eaf3; --muted: #a0a6ba; --faint: #737a90;
    --accent: #7c74ff; --accent-2: #232447; --accent-text: #ffffff;
    --ok: #3fcf95; --ok-bg: #12301f; --warn: #f0b95a; --warn-bg: #33270f; --err: #ff7a84; --err-bg: #3a1519;
    --code-bg: #090b12; --code-text: #e6e8f2; --shadow: none;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
p { margin: 0 0 10px; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
pre { background: var(--code-bg); color: var(--code-text); padding: 14px; border-radius: var(--radius); overflow: auto; margin: 0; max-height: 520px; }
pre code { background: none; padding: 0; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12.5px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 16px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* layout */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--border); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 4px 8px 16px; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; font: 700 13px var(--mono); }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 14px 10px 4px; }
.nav a { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 7px; color: var(--text); }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-2); color: var(--accent); font-weight: 600; }
.nav .count { font-size: 11.5px; color: var(--faint); }
.side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--border); font-size: 12.5px; }
.main { padding: 28px 32px 60px; max-width: 1180px; width: 100%; min-width: 0; }
.topbar { display: none; }

/* cards & tables */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card.link { cursor: pointer; transition: border-color .15s; }
.card.link:hover { border-color: var(--accent); }
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface-2); }
td.cell { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat { font-size: 24px; font-weight: 700; }
.steps { counter-reset: s; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.step { counter-increment: s; position: relative; padding-left: 38px; }
.step::before { content: counter(s); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-2); color: var(--accent); font-weight: 700; display: grid; place-items: center; }

/* forms */
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input, select, textarea { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
textarea { font-family: var(--mono); font-size: 12.5px; min-height: 160px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input[type=checkbox], input[type=radio] { width: auto; }
.field { margin-bottom: 14px; }
.fields { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.check { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; color: var(--text); margin: 0 14px 6px 0; font-size: 13.5px; }
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--err); }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: default; }
.tpl { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tpl label { border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; cursor: pointer; color: var(--text); font-weight: 500; margin: 0; }
.tpl input { display: none; }
.tpl label:has(input:checked) { border-color: var(--accent); background: var(--accent-2); }
.tpl b { display: block; margin-bottom: 2px; }

/* bits */
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.err { background: var(--err-bg); color: var(--err); } .badge.warn { background: var(--warn-bg); color: var(--warn); } .badge.accent { background: var(--accent-2); color: var(--accent); }
.copy { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 6px 6px 10px; font-family: var(--mono); font-size: 12.5px; }
.copy span { flex: 1; overflow: auto; white-space: nowrap; }
.notice { border-radius: 9px; padding: 10px 12px; background: var(--warn-bg); color: var(--warn); font-size: 13px; }
.notice.info { background: var(--accent-2); color: var(--accent); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.tabs button { background: none; border: 0; padding: 8px 12px; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--accent); border-color: var(--accent); font-weight: 600; }

/* URL anatomy */
.anatomy { font-family: var(--mono); font-size: 13px; line-height: 2; word-break: break-all; background: var(--surface-2); border-radius: 9px; padding: 10px 12px; }
.anatomy span { border-radius: 4px; padding: 2px 3px; }
.a-base { background: rgba(120,130,160,.18); } .a-ver { background: rgba(79,70,229,.18); } .a-api { background: rgba(15,138,95,.2); }
.a-res { background: rgba(214,137,16,.22); } .a-id { background: rgba(192,48,58,.18); } .a-q { background: rgba(0,140,200,.18); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.params .prow { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 6px; }
.status { font-weight: 700; font-family: var(--mono); }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }

/* modal & toast */
.overlay { position: fixed; inset: 0; background: rgba(8,10,20,.5); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; width: 100%; max-width: 640px; max-height: calc(100vh - 32px); overflow: auto; padding: 22px; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.x { background: none; border: 0; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; }
#toasts { position: fixed; bottom: 16px; right: 16px; display: grid; gap: 8px; z-index: 60; }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 9px; font-size: 13px; max-width: 360px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.err { background: var(--err); color: #fff; }
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; gap: 2px; }
  .side .nav-label, .side .api-links, .side-foot .who { display: none; }
  .brand { padding: 0 10px 0 0; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .nav { display: flex; flex-wrap: wrap; }
  .main { padding: 20px 16px 48px; }
  .params .prow { grid-template-columns: 1fr 1fr auto; }
}
