:root {
  --ink: #0E1116; --ink-2: #2B323C; --muted: #545D69; --line: #E1E4E8; --line-2: #EEF0F3;
  --bg: #F4F5F7; --surface: #FFFFFF; --accent: #2447E0; --accent-ink: #1A35AD; --accent-soft: #EAEFFE;
  --ok-bg: #E7F6EC; --ok: #0F5B2C; --warn-bg: #FFF1E0; --warn: #8A4200; --bad-bg: #FDECEC; --bad: #A11A1A;
  --idle-bg: #EEF0F3; --idle: #454D58;
  --side: #0E1116; --side-2: #161B22; --side-line: #2A313B; --side-text: #C9CED6; --side-muted: #9AA3AE;
  --radius: 10px;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; }
a { color: var(--accent); } a:hover { color: var(--accent-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.boot { padding: 40px; color: var(--muted); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
h1 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
h2 { margin: 0; font-size: 17px; }
h3 { margin: 0; font-size: 15px; }
p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* buttons & fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: 8px; border: 1px solid #D5D9DF; background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px;
  cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #F7F8FA; color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.danger { color: var(--bad); border-color: #EBC4C4; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.field .hint { font-weight: 400; color: var(--muted); }
.input, select.input, textarea.input { min-height: 42px; padding: 8px 12px; border: 1px solid #C9CED6; border-radius: 8px;
  background: var(--surface); font-weight: 400; font-size: 15px; width: 100%; }
textarea.input { min-height: 96px; font-family: var(--mono); font-size: 13px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 400; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 8px; }
.stack.loose { gap: 24px; }
.error { color: var(--bad); font-size: 14px; }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 32px; }
.wordmark { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; display: inline-flex; flex-direction: column; gap: 5px; }
.wordmark::after { content: ""; width: 44px; height: 3px; background: var(--accent); }
.auth .wordmark::after { background: var(--accent); }

/* shell */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 232px; max-width: 100%; background: var(--side); color: var(--side-text); padding: 22px 14px; display: flex; flex-direction: column; gap: 22px; }
.side .wordmark { color: #fff; padding: 0 8px; font-size: 22px; }
.side .wordmark::after { background: #5B7BFF; }
.org-pick { display: flex; flex-direction: column; gap: 6px; padding: 0 4px; }
.org-pick label { font-size: 12px; color: var(--side-muted); }
.org-pick select { min-height: 40px; border-radius: 8px; border: 1px solid var(--side-line); background: var(--side-2); color: #fff; padding: 0 10px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--side-text); text-decoration: none; font-weight: 600; }
.nav a:hover { background: var(--side-2); color: #fff; }
.nav a[aria-current="page"] { background: #1F2630; color: #fff; }
.nav .soon { padding: 10px 12px; color: var(--side-muted); font-size: 13px; display: flex; justify-content: space-between; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--side-2); border-radius: 8px; font-size: 13px; }
.side-foot .who { color: #fff; font-weight: 600; overflow-wrap: anywhere; }
.side-foot .link { color: #A9B8FF; text-align: left; }
.side-foot .muted { color: var(--side-muted); }
form.row { align-items: flex-end; }
.main { flex: 999 1 560px; min-width: 0; padding: 26px clamp(16px, 3vw, 40px) 56px; display: flex; flex-direction: column; gap: 22px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-end; }
.crumb { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.crumb a { color: var(--muted); }

/* surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 22px; }
.card.accent { border-color: #C9D3F8; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stat .label { font-size: 13px; color: var(--muted); }
.stat .value { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.fact { background: var(--bg); border-radius: 8px; padding: 12px; font-size: 13px; overflow-wrap: anywhere; }
.fact .k { color: var(--muted); }
.fact .v { font-weight: 600; }

/* tables */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 12px 16px; }
td { padding: 12px 16px; border-top: 1px solid var(--line-2); vertical-align: middle; }
td.actions { text-align: right; white-space: nowrap; }
td a.name { white-space: nowrap; font-family: var(--mono); font-weight: 500; color: var(--ink); text-decoration: none; }
td a.name:hover { text-decoration: underline; }
.empty { padding: 36px 22px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* status chips */
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--idle-bg); color: var(--idle); white-space: nowrap; }
.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.info { background: var(--accent-soft); color: var(--accent-ink); }

/* meters */
.meter { display: flex; flex-direction: column; gap: 4px; min-width: 120px; font-size: 12px; color: var(--muted); }
progress { appearance: none; -webkit-appearance: none; width: 100%; height: 6px; border: 0; border-radius: 3px; background: var(--line-2); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line-2); border-radius: 3px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 3px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 3px; }
progress.hot::-webkit-progress-value { background: #C2410C; }
progress.hot::-moz-progress-bar { background: #C2410C; }

/* templates */
.tpl { text-align: left; background: var(--surface); border: 2px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; }
.tpl:hover { border-color: #B8C4F5; }
.tpl[aria-pressed="true"] { border-color: var(--accent); }
.tpl:disabled { cursor: not-allowed; background: #FAFAFB; }
.tpl .cat { font-size: 12px; color: var(--muted); font-weight: 600; }
.tpl .nm { font-size: 16px; font-weight: 600; }
.tpl .ds { font-size: 13px; color: var(--muted); }

/* code */
.code { position: relative; background: var(--ink); color: #E3E7ED; border-radius: 10px; padding: 14px 16px; font-family: var(--mono); font-size: 13px; overflow-x: auto; white-space: pre; }
.code-row { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.code-row .code { flex: 1 1 320px; }
.secret { font-family: var(--mono); background: var(--bg); padding: 2px 6px; border-radius: 4px; overflow-wrap: anywhere; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 14px; max-width: calc(100vw - 32px); z-index: 10; }
.toast.err { background: var(--bad); }
.notice { padding: 12px 14px; border-radius: 8px; font-size: 14px; background: var(--warn-bg); color: var(--warn); }
.notice.info { background: var(--accent-soft); color: var(--accent-ink); }
.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
@media (max-width: 720px) {
  .side { flex-basis: 100%; padding: 16px; gap: 14px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav .soon { display: none; }
  .side-foot { margin-top: 0; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 10px 12px; }
}
.code.logs { white-space: pre-wrap; word-break: break-all; max-height: 420px; overflow-y: auto; font-size: 12px; line-height: 1.55; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
legend { font-size: 13px; font-weight: 600; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.theme-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 10px; border: 2px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface); }
.theme-card:has(input:checked) { border-color: var(--accent); }
.theme-card input { position: absolute; opacity: 0; }
.theme-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-card .nm { font-weight: 600; }
.swatch { display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; height: 72px; border-radius: 8px; padding: 10px; border: 1px solid var(--line); }
.sw-bar { width: 48px; height: 12px; border-radius: 3px; }
.sw-line { width: 70%; height: 6px; border-radius: 3px; opacity: .8; }
.tier { padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
textarea.prose-in { font-family: var(--sans); font-size: 14px; min-height: 110px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.checklist li.done { background: var(--bg); color: var(--muted); }
.checklist .tick { width: 22px; height: 22px; flex: 0 0 22px; border-radius: 50%; border: 2px solid #C9CED6; display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.checklist li.done .tick { background: var(--accent); border-color: var(--accent); color: #fff; }
input[type=color] { width: 48px; height: 40px; border: 1px solid #C9CED6; border-radius: 8px; padding: 2px; background: var(--surface); }
