:root {
  --bg: #f6f1e7; --surface: #fffdf8; --surface-2: #f0e9da; --ink: #1f1b16; --muted: #6b6256;
  --line: #e0d6c2; --accent: #2f5d50; --accent-ink: #ffffff;
  --ok: #2d6a4f; --ok-bg: #e3f0e8; --warn: #8a5a00; --warn-bg: #fbefd2;
  --bad: #9b2c2c; --bad-bg: #f8e1df; --idle: #5b5750; --idle-bg: #ebe7df; --focus: #1d4ed8;
  --radius: 10px;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1814; --surface: #25211b; --surface-2: #2e2922; --ink: #f1ebdf; --muted: #b3a995;
    --line: #3b352b; --accent: #7fc4ad; --accent-ink: #11201b;
    --ok: #8fd3aa; --ok-bg: #1f3a2c; --warn: #f0c36a; --warn-bg: #3d2f12;
    --bad: #f1a5a0; --bad-bg: #432321; --idle: #cbc4b6; --idle-bg: #36312a; --focus: #7aa2ff;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); min-height: 100vh; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }
.noscript { padding: 24px; }
.mono { font-family: var(--mono); font-size: 0.95em; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.over { color: var(--bad); }
.break { word-break: break-all; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
h1 { font-size: clamp(1.5rem, 3.5vw, 2rem); line-height: 1.2; margin: 0 0 12px; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
h3 { font-size: 1rem; margin: 18px 0 8px; }
.lead { color: var(--muted); font-size: 1.05rem; margin: 0 0 20px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; margin: 0 0 4px; opacity: 0.8; }

/* shell */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 600; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-family: var(--mono); }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ws-name { color: var(--muted); font-size: 0.9rem; }
.ws-select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); max-width: 200px; }
.lang { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang-btn { background: transparent; border: 0; padding: 6px 12px; cursor: pointer; }
.lang-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); max-width: 1180px; margin: 0 auto; gap: 24px; padding: 24px 16px 56px; align-items: start; }
.layout:has(.narrow) { display: block; max-width: 520px; }
.sidenav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 16px; }
.sidenav a { padding: 9px 12px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.sidenav a:hover { background: var(--surface-2); }
.sidenav a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); font-weight: 500; }
.content { min-width: 0; outline: none; }
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; gap: 12px; padding-top: 12px; }
  .sidenav { flex-direction: row; overflow-x: auto; position: static; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
  .sidenav a { white-space: nowrap; }
}

/* controls */
.btn { display: inline-block; cursor: pointer; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 16px; text-decoration: none; color: var(--ink); line-height: 1.3; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 0.875rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.field { margin: 0 0 14px; }
.field label { display: block; font-weight: 500; margin-bottom: 4px; }
.field input, .field select, .field textarea, .inline-form input, .inline-form select, .row-actions select, td select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
td select { width: auto; padding: 6px 8px; }
.hint { color: var(--muted); font-size: 0.85rem; margin: 4px 0 0; }
.check { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; }
.check input { width: 18px; height: 18px; }
.inline-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { flex: 1 1 220px; margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .wide { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.links { margin-top: 18px; color: var(--muted); }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin: 0 0 16px; }
.auth-card { margin-top: 32px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid .card { margin: 0; }
.big { font-size: 1.3rem; margin: 0 0 8px; }
.big strong { font-size: 2rem; font-family: var(--mono); font-weight: 500; }
.banner { border-radius: 14px; padding: 22px 24px; margin: 0 0 16px; border: 1px solid transparent; }
.banner h1 { margin-bottom: 6px; }
.banner p:last-child { margin: 0; }
.banner.ok { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }
.banner.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.banner.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.notice { padding: 10px 14px; border-radius: var(--radius); margin: 0 0 12px; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.chip { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 0.8rem; font-weight: 500; vertical-align: middle; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.idle { background: var(--idle-bg); color: var(--idle); }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 8px 0; border-top: 1px solid var(--line); }
ul.plain li:first-child { border-top: 0; }
.meter { height: 12px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 8px 0; }
.meter-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.4s ease; }
.meter-fill.hot { background: var(--warn); }
.facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 20px; }
.fact dt { color: var(--muted); font-size: 0.85rem; }
.fact dd { margin: 2px 0 0; font-weight: 500; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 0.8rem; color: var(--muted); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.row-actions { white-space: nowrap; display: flex; gap: 6px; }
.crumbs { margin: 0 0 6px; font-size: 0.9rem; }
.site-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.site-head h1 { margin: 0; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 12px 0 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }
.steps { padding-left: 22px; margin: 0 0 14px; }
.steps li { margin: 6px 0; }
.codeblock { position: relative; margin: 10px 0 14px; }
.codeblock pre { margin: 0; padding: 14px 90px 14px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; font: 0.88rem/1.5 var(--mono); }
.codeblock .btn { position: absolute; top: 8px; right: 8px; }
pre { font: 0.85rem/1.5 var(--mono); background: var(--surface-2); padding: 12px; border-radius: var(--radius); overflow-x: auto; }
.choice-row, .choice-col { display: grid; gap: 10px; margin: 0 0 16px; }
.choice-row { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.choice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.choice:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice input { margin-top: 4px; }
.choice small { display: block; color: var(--muted); font-size: 0.85rem; }
.stepper { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 20px; flex-wrap: wrap; }
.stepper li { padding: 6px 12px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: 0.9rem; }
.stepper li.current { background: var(--accent); color: var(--accent-ink); font-weight: 500; }
.stepper li.done { color: var(--ok); background: var(--ok-bg); }
.stepper .num { font-family: var(--mono); margin-right: 4px; }
.tpl { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 10px; }
.tpl.locked { opacity: 0.7; }
.tpl-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; cursor: pointer; }
.tpl p { margin: 6px 0; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-top: 12px; }
.plan { border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; background: var(--surface); }
.plan.current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.plan h3 { margin-top: 0; }
.plan .price strong { font-size: 1.4rem; font-family: var(--mono); font-weight: 500; }
.plan .feat { flex: 1; margin: 8px 0 14px; font-size: 0.9rem; }
.toggles { display: flex; gap: 20px; flex-wrap: wrap; }
.seg { border: 0; padding: 0; margin: 0 0 8px; }
.seg legend { font-size: 0.85rem; color: var(--muted); padding: 0; margin-bottom: 4px; }
.seg label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); margin-right: -1px; cursor: pointer; background: var(--surface); }
.seg label:has(input:checked) { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg label:has(input:focus-visible) { outline: 3px solid var(--focus); }
.codes li { display: inline-block; margin: 4px 14px 4px 0; padding: 0; border: 0; }
.alert-row { line-height: 1.9; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: var(--radius); opacity: 0; pointer-events: none; transition: all 0.25s; z-index: 20; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.bad { background: var(--bad); color: #fff; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.verify-banner { margin: 0; border-radius: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
