/* Conductor dashboard — one stylesheet, no build step, no external fonts.
   Tokens first; dark mode overrides only the tokens. */

:root {
  --bg: #f7f7f5;
  --bg-elev: #ffffff;
  --bg-sunken: #efeeea;
  --bg-hover: #f0efec;
  --border: #e3e1dc;
  --border-strong: #cfcdc6;
  --text: #1b1a18;
  --text-2: #5f5c56;
  --text-3: #6b6862;
  --on-accent: #ffffff;
  --accent: #2f6f4e;
  --accent-soft: #e3f0e8;
  --accent-text: #24593f;
  --warn: #855a12;
  --warn-soft: #f7efdd;
  --danger: #a33a2a;
  --danger-soft: #f8e5e1;
  --info: #2d5f9a;
  --info-soft: #e2ecf7;
  --chip: #f0efec;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 0 0 1px rgba(0,0,0,.02);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.14);
  --radius: 8px;
  --radius-sm: 5px;
  --sidebar-w: 224px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Inter, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  --c1: #2f6f4e; --c2: #2d5f9a; --c3: #b8641e; --c4: #7c4dab; --c5: #a83a5a; --c6: #3d8a8a; --c7: #8a7a2a; --c8: #6b6862;
}
:root:not([data-theme="light"]) { color-scheme: light dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131416; --bg-elev: #1b1d21; --bg-sunken: #0f1012; --bg-hover: #23262b;
    --border: #2b2f35; --border-strong: #3b4049; --text: #e8e6e2; --text-2: #a5a29a; --text-3: #918e86;
    --accent: #6cbd8f; --accent-soft: #1d2f26; --accent-text: #8fd3ad; --on-accent: #111111;
    --warn: #dba645; --warn-soft: #302818; --danger: #e5715d; --danger-soft: #331d19;
    --info: #6ea3e6; --info-soft: #1b2738; --chip: #262a30;
    --shadow: none; --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
    --c1: #6cbd8f; --c2: #6ea3e6; --c3: #e59a55; --c4: #b48ae0; --c5: #e07a97; --c6: #62bdbd; --c7: #c9b64f; --c8: #8d8a83;
  }
}
:root[data-theme="dark"] {
  --bg: #131416; --bg-elev: #1b1d21; --bg-sunken: #0f1012; --bg-hover: #23262b;
  --border: #2b2f35; --border-strong: #3b4049; --text: #e8e6e2; --text-2: #a5a29a; --text-3: #918e86;
  --accent: #6cbd8f; --accent-soft: #1d2f26; --accent-text: #8fd3ad; --on-accent: #111111;
  --warn: #dba645; --warn-soft: #302818; --danger: #e5715d; --danger-soft: #331d19;
  --info: #6ea3e6; --info-soft: #1b2738; --chip: #262a30;
  --shadow: none; --shadow-lg: 0 16px 48px rgba(0,0,0,.5);
  --c1: #6cbd8f; --c2: #6ea3e6; --c3: #e59a55; --c4: #b48ae0; --c5: #e07a97; --c6: #62bdbd; --c7: #c9b64f; --c8: #8d8a83;
}
:root[data-density="compact"] { --s3: 8px; --s4: 12px; --s5: 14px; --s6: 16px; }

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 13.5px/1.5 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12px; }
pre { font-family: var(--mono); font-size: 12px; line-height: 1.5; margin: 0; white-space: pre-wrap; word-break: break-word; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 17px; } h2 { font-size: 14px; } h3 { font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--accent-soft); }
.boot { padding: 40px; color: var(--text-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-elev); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.brand .logo { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; color: var(--on-accent); flex: none; overflow: hidden; }
.brand .logo.image { background: transparent; }
.brand .logo img { width: 100%; height: 100%; object-fit: contain; }
.brand .name { font-weight: 650; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand .demo-badge { margin-left: auto; }
.project-switch { padding: 4px 12px 10px; }
.project-switch select { width: 100%; }
.nav { padding: 4px 8px; display: flex; flex-direction: column; gap: 1px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
}
.nav a svg { width: 16px; height: 16px; flex: none; opacity: .85; }
.nav a:hover { background: var(--bg-hover); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.nav a .badge { margin-left: auto; }
.nav .group { padding: 12px 10px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 600; }
.sidebar-foot { margin-top: auto; padding: 10px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-2); display: flex; flex-direction: column; gap: 6px; }
.conn { display: flex; align-items: center; gap: 7px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot.live { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dot.warn { background: var(--warn); }
.dot.off { background: var(--danger); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--border);
  background: var(--bg-elev); position: sticky; top: 0; z-index: 20; min-height: 52px;
}
.topbar h1 { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { color: var(--text-3); font-weight: 400; font-size: 12.5px; margin-left: 8px; }
.content { padding: 20px 24px 60px; display: flex; flex-direction: column; gap: 20px; max-width: 1600px; width: 100%; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--text); cursor: pointer;
  font-weight: 500; font-size: 13px; line-height: 1.4; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--bg-hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn.icon { padding: 5px; width: 30px; height: 30px; justify-content: center; }
.btn svg { width: 15px; height: 15px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=date], select, textarea {
  padding: 6px 9px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-elev); color: var(--text); min-width: 0; font-size: 13px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 64px; font-family: inherit; }
select { appearance: none; padding-right: 26px; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 13px) 55%, calc(100% - 9px) 55%; background-size: 4px 4px; background-repeat: no-repeat; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); font-weight: 500; }
label.field > input, label.field > select, label.field > textarea { font-weight: 400; color: var(--text); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.hint { font-size: 12px; color: var(--text-3); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 4px 10px; cursor: pointer; color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--accent-soft); color: var(--accent-text); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.search { position: relative; }
.search input { padding-left: 28px; width: 220px; }
.search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-3); pointer-events: none; }

/* ---------- cards / sections ---------- */
.card { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > header {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.card > header h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); flex: 1; }
.card > .body { padding: 12px 14px; }
.card > .body.flush { padding: 0; }
.card > footer { padding: 8px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); background: var(--bg-sunken); border-radius: 0 0 var(--radius) var(--radius); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.row .who { min-width: 150px; font-weight: 600; }
.row .who small { display: block; font-weight: 400; color: var(--text-2); font-size: 12px; }
.row .what { flex: 1; min-width: 0; }
.row .meta { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); cursor: pointer; transition: border-color .12s; }
.kpi:hover { border-color: var(--border-strong); }
.kpi .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; }
.kpi .value { font-size: 24px; font-weight: 650; letter-spacing: -.02em; margin-top: 2px; line-height: 1.2; }
.kpi .value small { font-size: 12px; color: var(--text-3); font-weight: 500; margin-left: 4px; letter-spacing: 0; }
.kpi .sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.kpi.danger .value { color: var(--danger); }
.kpi.warn .value { color: var(--warn); }
.kpi.accent .value { color: var(--accent-text); }

/* ---------- chips / pills ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; background: var(--chip); border: 1px solid var(--border);
  border-radius: 4px; padding: 1px 7px; font-size: 11.5px; font-family: var(--mono); color: var(--text-2); white-space: nowrap; max-width: 100%;
}
.chip.sans { font-family: var(--font); }
.chip.accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.chip.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.chip .x { cursor: pointer; opacity: .6; padding: 0 2px; }
.chip .x:hover { opacity: 1; }
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; font-size: 11px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .05em; background: var(--chip); color: var(--text-2); white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.ok, .pill.working, .pill.running, .pill.done, .pill.succeeded, .pill.granted, .pill.online, .pill.online_idle, .pill.accepted, .pill.fulfilled, .pill.resolved { background: var(--accent-soft); color: var(--accent-text); }
.pill.warn, .pill.stale, .pill.offline_grace, .pill.waiting_for_input, .pill.waiting_for_approval, .pill.review_required, .pill.verifying, .pill.merging, .pill.queued, .pill.proposed, .pill.acknowledged, .pill.draining, .pill.planning { background: var(--warn-soft); color: var(--warn); }
.pill.danger, .pill.blocked, .pill.blocked_conflict, .pill.blocked_dependency, .pill.blocked_input, .pill.failed, .pill.failed_terminal, .pill.failed_retryable, .pill.cancelled, .pill.expired, .pill.offline, .pill.paused_conflict, .pill.high, .pill.critical, .pill.declined { background: var(--danger-soft); color: var(--danger); }
.pill.info, .pill.ready, .pill.claimed, .pill.offered, .pill.reviewing, .pill.medium { background: var(--info-soft); color: var(--info); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--chip); color: var(--text-2); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.ref { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
a.ref:hover { color: var(--accent-text); }
.private { color: var(--text-3); font-style: italic; font-weight: 400; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; white-space: nowrap; background: var(--bg-sunken); position: sticky; top: 0; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th .arrow { opacity: .5; margin-left: 3px; }
.tbl tbody tr:hover { background: var(--bg-hover); }
.tbl tr.clickable { cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.mono { font-family: var(--mono); font-size: 12px; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--border-strong); background: var(--bg-sunken); }

/* ---------- board ---------- */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; align-items: start; }
.col { background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; min-height: 120px; }
.col > h2 { display: flex; align-items: center; gap: 6px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); padding: 4px 6px 8px; }
.col > h2 .badge { margin-left: auto; }
.tcard { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 10px; margin-bottom: 8px; cursor: pointer; box-shadow: var(--shadow); transition: border-color .12s, transform .12s; display: block; color: inherit; }
.tcard:hover { border-color: var(--border-strong); text-decoration: none; transform: translateY(-1px); }
.tcard:last-child { margin-bottom: 0; }
.tcard .head { display: flex; gap: 6px; align-items: center; font-size: 11.5px; color: var(--text-3); }
.tcard .head .owner { margin-left: auto; font-weight: 500; }
.tcard .title { font-weight: 550; margin: 3px 0 5px; line-height: 1.35; }
.tcard .chips { margin-top: 5px; }
.tcard .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tcard .foot { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 11px; color: var(--text-3); }
.prio { font-family: var(--mono); font-size: 11px; }
.risk-high, .risk-critical { color: var(--danger); }

/* ---------- conflicts ---------- */
.conflict { border-left: 3px solid var(--warn); padding: 8px 12px; margin-bottom: 10px; background: var(--bg-sunken); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.conflict.high, .conflict.critical { border-left-color: var(--danger); }
.conflict.info, .conflict.low { border-left-color: var(--info); }
.conflict .headline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.conflict .advice { color: var(--text-2); font-size: 12.5px; margin-top: 3px; }
.conflict .chips { margin-top: 6px; }
.conflict .actions { margin-top: 8px; }

/* ---------- log / events ---------- */
.log { font-family: var(--mono); font-size: 12px; max-height: 420px; overflow-y: auto; }
.log .ev { display: grid; grid-template-columns: 76px 190px 1fr; gap: 10px; padding: 4px 0; border-bottom: 1px dashed var(--border); align-items: baseline; }
.log .ev:last-child { border-bottom: 0; }
.log .ev .t { color: var(--text-3); }
.log .ev .type { color: var(--text); font-weight: 600; }
.log .ev .type.danger { color: var(--danger); }
.log .ev .type.warn { color: var(--warn); }
.log .ev .type.accent { color: var(--accent-text); }
.log .ev .payload { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.log .ev.open .payload { white-space: pre-wrap; }
.log .ev.new { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }

/* ---------- detail ---------- */
.detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.detail-head h2 { font-size: 16px; }
.detail-head .ref { font-size: 13px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 5px 12px; font-size: 13px; }
.kv dt { color: var(--text-3); font-size: 12px; font-weight: 500; }
.kv dd { margin: 0; min-width: 0; word-break: break-word; }
.criteria { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.criteria li { display: flex; gap: 8px; align-items: flex-start; }
.criteria .mark { width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--border-strong); flex: none; margin-top: 2px; display: grid; place-items: center; font-size: 10px; }
.criteria .mark.pass { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.criteria .mark.fail { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.md h1, .md h2, .md h3 { margin: 12px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.md ul { margin: 4px 0; padding-left: 18px; }
.md p { margin: 4px 0; }
.md pre { background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; overflow-x: auto; }
.rationale { padding-left: 18px; margin: 4px 0; font-size: 12.5px; color: var(--text-2); }
.rationale li { margin: 2px 0; }

/* ---------- drawer / modal ---------- */
.drawer-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 40; animation: fade .12s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(880px, 92vw); background: var(--bg); border-left: 1px solid var(--border); z-index: 41; overflow-y: auto; box-shadow: var(--shadow-lg); animation: slide .16s ease-out; }
.drawer .drawer-bar { position: sticky; top: 0; display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--bg-elev); border-bottom: 1px solid var(--border); z-index: 2; }
.drawer .drawer-body { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 60; display: grid; place-items: center; padding: 20px; animation: fade .12s; }
.modal { background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; width: min(560px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal.wide { width: min(760px, 100%); }
.modal > header { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal > header h2 { flex: 1; font-size: 14px; }
.modal > .body { padding: 16px; }
.modal > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--bg-sunken); border-radius: 0 0 10px 10px; }
.token-reveal { background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-family: var(--mono); font-size: 12px; word-break: break-all; }

/* ---------- palette ---------- */
.palette-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 70; display: flex; justify-content: center; align-items: flex-start; padding-top: 12vh; animation: fade .1s; }
.palette { width: min(600px, 94vw); background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); overflow: hidden; }
.palette input { width: 100%; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 12px 14px; font-size: 14px; background: transparent; }
.palette input:focus { box-shadow: none; }
.palette ul { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); cursor: pointer; }
.palette li.active, .palette li:hover { background: var(--accent-soft); color: var(--accent-text); }
.palette li .k { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text-3); }
.palette li .grp { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
kbd { font-family: var(--mono); font-size: 11px; background: var(--bg-sunken); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 90; max-width: min(380px, 90vw); }
.toast { background: var(--bg-elev); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 9px 12px; box-shadow: var(--shadow-lg); font-size: 13px; animation: rise .16s ease-out; display: flex; gap: 10px; align-items: flex-start; }
.toast.warn { border-left-color: var(--warn); } .toast.danger { border-left-color: var(--danger); } .toast.info { border-left-color: var(--info); }
.toast .t-body { flex: 1; } .toast small { display: block; color: var(--text-3); margin-top: 2px; }
.toast .x { cursor: pointer; color: var(--text-3); }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- states ---------- */
.empty { padding: 18px; text-align: center; color: var(--text-2); font-size: 13px; }
.empty .cmd { display: inline-block; margin-top: 8px; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; font-family: var(--mono); font-size: 12px; color: var(--text); }
.error-box { padding: 12px 14px; border: 1px solid var(--danger); background: var(--danger-soft); color: var(--danger); border-radius: var(--radius-sm); display: flex; gap: 10px; align-items: center; }
.error-box .btn { margin-left: auto; }
.skeleton { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.skeleton .bar { height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--bg-sunken) 25%, var(--bg-hover) 50%, var(--bg-sunken) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.muted { color: var(--text-3); }
.notice { padding: 9px 12px; background: var(--info-soft); color: var(--info); border-radius: var(--radius-sm); font-size: 12.5px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.demo-badge { background: var(--warn-soft); color: var(--warn); font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 4px; letter-spacing: .05em; }

/* ---------- connect screen ---------- */
.connect { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.connect .card { width: min(440px, 100%); }
.connect .brand { padding: 0 0 12px; }
.connect .form { padding: 4px 0; }
.connect pre { background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }

/* ---------- charts ---------- */
.chart { width: 100%; position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis text { font-size: 10.5px; fill: var(--text-3); font-family: var(--font); }
.chart .axis line, .chart .grid line { stroke: var(--border); }
.chart .bar { transition: opacity .1s; }
.chart .bar:hover { opacity: .8; }
.chart .line { fill: none; stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart-tip { position: absolute; pointer-events: none; background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 6px 9px; font-size: 12px; box-shadow: var(--shadow-lg); z-index: 5; white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--text-2); }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.bar-meter { height: 6px; background: var(--bg-sunken); border-radius: 3px; overflow: hidden; border: 1px solid var(--border); }
.bar-meter > div { height: 100%; background: var(--accent); }
.bar-meter > div.warn { background: var(--warn); } .bar-meter > div.danger { background: var(--danger); }
.sparkline { height: 4px; background: var(--accent); opacity: .7; border-radius: 2px; margin-top: 4px; }

/* ---------- integrations ---------- */
.tool-card { display: flex; flex-direction: column; gap: 10px; }
.tool-card .cmd { display: flex; align-items: center; gap: 8px; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; font-family: var(--mono); font-size: 12px; }
.tool-card .cmd code { flex: 1; word-break: break-all; }
.snippet { position: relative; }
.snippet pre { background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; padding-right: 60px; max-height: 300px; overflow: auto; }
.snippet .copy { position: absolute; top: 6px; right: 6px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.tabs button { border: 0; background: transparent; padding: 6px 10px; cursor: pointer; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 12.5px; }
.tabs button.active { color: var(--accent-text); border-bottom-color: var(--accent); }

/* ---------- shortcuts overlay ---------- */
.shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px; font-size: 13px; }
.shortcuts div { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }

/* ---------- simplified shell (Home, People, More, Admin) ---------- */
.skip-link { position: absolute; left: 8px; top: -40px; z-index: 100; background: var(--bg-elev); border: 1px solid var(--border-strong); padding: 6px 10px; border-radius: var(--radius-sm); }
.skip-link:focus { top: 8px; }
.content:focus { outline: none; }
.nav-sep { height: 1px; background: var(--border); margin: 8px 6px; }
.nav-toggle { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: transparent; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; cursor: pointer; text-align: left; }
.nav-toggle:hover { background: var(--bg-hover); color: var(--text); }
.nav-toggle svg { width: 16px; height: 16px; flex: none; opacity: .85; }
.nav-toggle svg:last-child { margin-left: auto; width: 14px; height: 14px; transition: transform .12s; }
.nav-toggle[aria-expanded="true"] svg:last-child { transform: rotate(180deg); }
.nav-more { display: flex; flex-direction: column; gap: 1px; padding-left: 12px; }
.nav-more a.all { color: var(--text-3); font-size: 12.5px; }
.lede { margin: 0; font-size: 15px; color: var(--text-2); }
.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.item { display: flex; gap: 10px; align-items: center; padding: 8px 0 8px 10px; border-bottom: 1px solid var(--border); border-left: 3px solid transparent; }
.item:last-child { border-bottom: 0; }
.item.danger { border-left-color: var(--danger); } .item.warn { border-left-color: var(--warn); } .item.info { border-left-color: var(--info); }
.item .what { flex: 1; min-width: 0; }
.item .meta { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.check-form { display: flex; flex-direction: column; gap: 12px; }
.check-result:empty { display: none; }
.notice.ok { background: var(--accent-soft); color: var(--accent-text); }
.notice a { color: inherit; text-decoration: underline; }
.settings, .admin { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; align-items: start; }
.toc { position: sticky; top: 72px; }
.toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.toc a { display: block; padding: 6px 10px; border-radius: var(--radius-sm); color: var(--text-2); }
.toc a:hover { background: var(--bg-hover); text-decoration: none; color: var(--text); }
.toc a.active, .toc a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
.section-title { font-size: 15px; margin-bottom: 10px; }
.admin-body { min-width: 0; }
.areas { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.area { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.area a { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.area a svg { width: 16px; height: 16px; }
.area p { margin: 6px 0 0; color: var(--text-2); }
.area.off { opacity: .85; border-style: dashed; }
.locked { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-2); font-weight: 500; }
.locked svg { width: 12px; height: 12px; }
.toggle-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.toggle-row .hint { flex-basis: 100%; margin: 0 0 0 26px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.toggle input { width: 16px; height: 16px; accent-color: var(--accent); }
.features { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.logo-preview { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--border); display: grid; place-items: center; overflow: hidden; background: var(--accent); color: var(--on-accent); }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; background: var(--bg-elev); }
label.btn input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
label.btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.login-banner { white-space: pre-wrap; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 12px; font-size: 12.5px; }
.connect h1.brand { font-size: 14px; }
.kv-label { font-size: 12px; color: var(--text-2); font-weight: 600; }
.small { font-size: 12px; }
.stack.tight { gap: 4px; }
pre.json { background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; max-height: 420px; overflow: auto; }
.is-locked input, .is-locked select, .is-locked textarea { background: var(--bg-sunken); }
.th-sort { border: 0; background: transparent; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.th-sort:hover { color: var(--text); }
input[type=color] { width: 36px; height: 30px; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--bg-elev); }
.chip .x { border: 0; background: transparent; color: inherit; display: inline-flex; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .detail-grid { grid-template-columns: 1fr; } .settings, .admin { grid-template-columns: 1fr; } .toc { position: static; } .toc ul { flex-direction: row; flex-wrap: wrap; } }
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: auto; border-right: 0; border-top: 1px solid var(--border); flex-direction: row; overflow-x: auto; z-index: 30; }
  .brand, .project-switch, .sidebar-foot, .nav .group, .nav-sep, .nav-more { display: none; }
  .nav-toggle { flex-direction: column; gap: 2px; padding: 6px 8px; font-size: 10px; width: auto; }
  .nav-toggle svg:last-child { display: none; }
  .nav-group { display: contents; }
  .nav { flex-direction: row; padding: 4px; flex: 1; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; padding: 6px 8px; font-size: 10px; }
  .nav a .badge { margin-left: 0; position: absolute; transform: translate(12px, -6px); }
  .nav a span.label { white-space: nowrap; }
  .content { padding: 14px 12px 90px; }
  .topbar { padding: 10px 12px; }
  .search input { width: 140px; }
  .kv { grid-template-columns: 1fr; }
  .drawer { width: 100vw; }
  .log .ev { grid-template-columns: 60px 1fr; }
  .log .ev .payload { grid-column: 1 / -1; }
  .shortcuts { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
