@import url("/static/chat.css");
/* Everything below is the kit layer: page and component stylesheets (chat.css, the settings and admin pages) are unlayered, so they override it. */
@layer kit {
/* Nova: the design system (tokens, base, app shell, kit components). No inline styles anywhere (CSP): all variation is
   classes; the few dynamic values (grid cell, accent colour, bar fraction) arrive as custom properties set through the CSSOM.
   Visual language follows the family (Portal, Stash, SkyNet): deep-space dark theme with blue/orange glows, a light variant,
   a faint star field. Contrast of every pair below is checked by tests/contrast.py (it reads the tokens from this file). */

:root {
  color-scheme: dark;
  --bg: #070b16; --bg-glow-a: rgba(58, 160, 255, .20); --bg-glow-b: rgba(255, 160, 40, .15);
  --surface: #0f1730; --surface-2: #151f3d; --surface-3: #1c2a52; --field: #0a1226;
  --text: #e8eefc; --muted: #9db0cf; --line: #28365f; --line-strong: #5d729f;
  --accent: #6cc0ff; --accent-text: #04101f; --accent-bg: #4db2ff; --focus: #6cc0ff;
  --gold: #ffc247; --gold-bg: #ffb020; --gold-text: #1f1300;
  --ok: #6fe39a; --ok-bg: #12301f; --warn: #ffc65c; --warn-bg: #3a2a0c; --bad: #ff9a9a; --bad-bg: #3b1620; --info: #6cc0ff; --info-bg: #14264a;
  --danger-bg: #ff9a9a; --danger-text: #2a0608;
  --c1: #4db2ff; --c2: #ffb020; --c3: #35d6c0; --c4: #b49bff; --c5: #ff8fb5; --c6: #7fe08a; --c7: #ffd75e; --c8: #7fd3ff;
  --side-bg: #0a1020; --side-text: #e8eefc; --side-muted: #9db0cf; --side-line: #1d2a4c; --side-active: #14264a;
  --bar: rgba(7, 11, 22, .78);
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, .7); --shadow-sm: 0 6px 20px -10px rgba(0, 0, 0, .6);
  --glow-blue: rgba(77, 178, 255, .55); --glow-orange: rgba(255, 167, 51, .5); --star: rgba(255, 255, 255, .55);
  --grad: linear-gradient(135deg, #4db2ff 0%, #1e9bff 45%, #ffb020 100%);
  --scrim: rgba(3, 6, 14, .72);
  --code-bg: #0a1226; --code-head: #121c38; --code-line: #25335c;
  --tok-k: #c4a8ff; --tok-s: #8fe3a3; --tok-n: #ffc66b; --tok-c: #8a9bbd; --tok-f: #7cc4ff; --tok-t: #5fe3d0; --tok-v: #ff9fc0; --tok-p: #8fd0ff; --tok-a: #ffd27a; --tok-g: #ff9a9a; --tok-m: #9db0cf;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f1f5fc; --bg-glow-a: rgba(58, 160, 255, .22); --bg-glow-b: rgba(255, 167, 51, .20);
    --surface: #ffffff; --surface-2: #f4f7fd; --surface-3: #e7eefb; --field: #ffffff;
    --text: #12203a; --muted: #4e5f7e; --line: #cfd9ee; --line-strong: #6f84a8;
    --accent: #0a5bb5; --accent-text: #ffffff; --accent-bg: #0a5bb5; --focus: #0a5bb5;
    --gold: #8a5300; --gold-bg: #ffb020; --gold-text: #1f1300;
    --ok: #0b6b34; --ok-bg: #dff5e8; --warn: #8a5300; --warn-bg: #fdf0d5; --bad: #9d1c1c; --bad-bg: #fbe3e3; --info: #0a5bb5; --info-bg: #e3eefb;
    --danger-bg: #b3261e; --danger-text: #ffffff;
    --c1: #0a5bb5; --c2: #b35c00; --c3: #0a7f6f; --c4: #6d4bd8; --c5: #c23a73; --c6: #2b8a3e; --c7: #8a6a00; --c8: #1c7ab5;
    --bar: rgba(255, 255, 255, .84);
    --shadow: 0 14px 40px -20px rgba(18, 32, 58, .35); --shadow-sm: 0 6px 18px -10px rgba(18, 32, 58, .35);
    --glow-blue: rgba(10, 116, 214, .35); --glow-orange: rgba(214, 110, 0, .32); --star: rgba(18, 32, 58, 0);
    --scrim: rgba(12, 20, 40, .55);
    --code-bg: #f1f5fc; --code-head: #e4ecf9; --code-line: #cfd9ee;
    --tok-k: #6a3fd0; --tok-s: #0b6b34; --tok-n: #9a4b00; --tok-c: #55668a; --tok-f: #0a5bb5; --tok-t: #0a6657; --tok-v: #b02a62; --tok-p: #14589c; --tok-a: #8a5300; --tok-g: #a11d1d; --tok-m: #4e5f7e;
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f5fc; --bg-glow-a: rgba(58, 160, 255, .22); --bg-glow-b: rgba(255, 167, 51, .20);
  --surface: #ffffff; --surface-2: #f4f7fd; --surface-3: #e7eefb; --field: #ffffff;
  --text: #12203a; --muted: #4e5f7e; --line: #cfd9ee; --line-strong: #6f84a8;
  --accent: #0a5bb5; --accent-text: #ffffff; --accent-bg: #0a5bb5; --focus: #0a5bb5;
  --gold: #8a5300; --gold-bg: #ffb020; --gold-text: #1f1300;
  --ok: #0b6b34; --ok-bg: #dff5e8; --warn: #8a5300; --warn-bg: #fdf0d5; --bad: #9d1c1c; --bad-bg: #fbe3e3; --info: #0a5bb5; --info-bg: #e3eefb;
  --danger-bg: #b3261e; --danger-text: #ffffff;
  --c1: #0a5bb5; --c2: #b35c00; --c3: #0a7f6f; --c4: #6d4bd8; --c5: #c23a73; --c6: #2b8a3e; --c7: #8a6a00; --c8: #1c7ab5;
  --bar: rgba(255, 255, 255, .84);
  --shadow: 0 14px 40px -20px rgba(18, 32, 58, .35); --shadow-sm: 0 6px 18px -10px rgba(18, 32, 58, .35);
  --glow-blue: rgba(10, 116, 214, .35); --glow-orange: rgba(214, 110, 0, .32); --star: rgba(18, 32, 58, 0);
  --scrim: rgba(12, 20, 40, .55);
  --code-bg: #f1f5fc; --code-head: #e4ecf9; --code-line: #cfd9ee;
  --tok-k: #6a3fd0; --tok-s: #0b6b34; --tok-n: #9a4b00; --tok-c: #55668a; --tok-f: #0a5bb5; --tok-t: #0a6657; --tok-v: #b02a62; --tok-p: #14589c; --tok-a: #8a5300; --tok-g: #a11d1d; --tok-m: #4e5f7e;
}

* { box-sizing: border-box; }
html { min-height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background:
    radial-gradient(60rem 38rem at 12% -8%, var(--bg-glow-a), transparent 70%),
    radial-gradient(54rem 36rem at 100% 108%, var(--bg-glow-b), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .7;
  background-image:
    radial-gradient(1px 1px at 8% 22%, var(--star), transparent 60%), radial-gradient(1px 1px at 21% 64%, var(--star), transparent 60%),
    radial-gradient(1.5px 1.5px at 33% 12%, var(--star), transparent 60%), radial-gradient(1px 1px at 47% 80%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 58% 36%, var(--star), transparent 60%), radial-gradient(1.5px 1.5px at 71% 70%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 83% 18%, var(--star), transparent 60%), radial-gradient(1px 1px at 92% 52%, var(--star), transparent 60%),
    radial-gradient(1px 1px at 14% 90%, var(--star), transparent 60%), radial-gradient(1px 1px at 64% 8%, var(--star), transparent 60%);
  animation: drift 90s linear infinite alternate;
}
@keyframes drift { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-18px, 14px, 0); } }

h1 { font-size: 1.7rem; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h1:focus { outline: none; }
h2 { font-size: 1.15rem; line-height: 1.3; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 0; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); }
code, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em; }
code { background: var(--surface-3); padding: .1em .4em; border-radius: 6px; }
kbd { border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; padding: 0 .35em; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.wrapany { overflow-wrap: anywhere; }
.sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: .5rem; left: .5rem; z-index: 100; background: var(--surface); color: var(--text); padding: .6rem 1rem; border-radius: 10px; box-shadow: var(--shadow); }

.icon { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ app shell: see shell.css rules below (kept in chat.css) */

/* ------------------------------------------------------------------ page chrome */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 1.5rem; margin-bottom: 1.25rem; }
.page-head-text { min-width: 0; }
.page-head-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.page-sub { margin: .25rem 0 0; }
.eyebrow { margin: 0 0 .15rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 650; }
.back { display: inline-flex; align-items: center; gap: .15rem; margin-bottom: .35rem; text-decoration: none; font-size: .9rem; }
.back:hover { text-decoration: underline; }
.section-title { margin: 2rem 0 .75rem; font-size: 1.05rem; display: flex; align-items: center; gap: .5rem; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.row-end { justify-content: flex-end; }
.spacer { flex: 1; }
.narrow { max-width: 46rem; }

.card { background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: 18px; padding: 1.25rem; box-shadow: var(--shadow); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card + .card { margin-top: 1rem; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem; font: inherit; font-weight: 600; line-height: 1.2; padding: .55rem 1.05rem; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text); cursor: pointer; text-decoration: none; text-align: center; transition: box-shadow .15s, border-color .15s, background .15s;
}
.btn:hover { border-color: var(--accent); background: var(--surface-3); }
.btn .icon { width: 1.1rem; height: 1.1rem; }
.btn-primary { background: var(--accent-bg); color: var(--accent-text); border-color: var(--accent-bg); }
.btn-primary:hover { background: var(--accent-bg); box-shadow: 0 0 0 3px var(--glow-blue); border-color: var(--accent-bg); }
.btn-danger { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger-bg); }
.btn-danger:hover { background: var(--danger-bg); box-shadow: 0 0 0 3px rgba(255, 120, 120, .35); border-color: var(--danger-bg); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-3); border-color: var(--line); }
.btn-sm { padding: .3rem .75rem; font-size: .9rem; }
.btn[disabled], .icon-btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn[aria-busy="true"]::after { content: ""; width: .9rem; height: .9rem; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
.icon-btn {
  display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; padding: 0; border-radius: 50%; border: 1px solid transparent; background: transparent; color: inherit; cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--surface-3); border-color: var(--line); }
.icon-btn[aria-pressed="true"] { background: var(--info-bg); border-color: var(--accent); color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ forms */
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: .3rem; }
.label { font-weight: 650; font-size: .9rem; }
.hint { margin: 0; font-size: .85rem; color: var(--muted); }
.input {
  width: 100%; font: inherit; padding: .55rem .75rem; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--field); color: var(--text); min-height: 2.5rem;
}
.input::placeholder { color: var(--muted); opacity: 1; }
.input:focus-visible { outline-offset: 0; border-color: var(--accent); }
.input[aria-invalid="true"] { border-color: var(--bad); }
.select { appearance: none; padding-right: 2.2rem; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 1.1rem) 50%, calc(100% - .8rem) 50%; background-size: .3rem .3rem; background-repeat: no-repeat; }
.select-sm { width: auto; min-height: 2rem; padding-top: .25rem; padding-bottom: .25rem; font-size: .9rem; }
.check { display: flex; align-items: center; gap: .55rem; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent-bg); flex: none; margin: 0; }
.field-error, .form-error { margin: .25rem 0 0; font-size: .88rem; color: var(--bad); }
.form-error { background: var(--bad-bg); padding: .5rem .75rem; border-radius: 10px; border: 1px solid var(--bad); }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.segmented { display: inline-flex; padding: .2rem; gap: .15rem; border-radius: 999px; background: var(--field); border: 1px solid var(--line-strong); }
.seg { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .8rem; border-radius: 999px; font-weight: 600; font-size: .9rem; }
.seg input:checked + span { background: var(--accent-bg); color: var(--accent-text); }
.seg input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ------------------------------------------------------------------ display bits */
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .05rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 650; border: 1px solid transparent; white-space: nowrap; }
.pill .icon { width: .9rem; height: .9rem; }
.pill-muted { background: var(--surface-3); color: var(--muted); border-color: var(--line); }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-warn { background: var(--warn-bg); color: var(--warn); }
.pill-bad { background: var(--bad-bg); color: var(--bad); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-gold { background: var(--gold-bg); color: var(--gold-text); }
.avatar { flex: none; display: inline-grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; font-weight: 750; font-size: .85rem; color: #04101f; background: linear-gradient(145deg, var(--g1), var(--g2)); }
.avatar.lg { width: 3rem; height: 3rem; font-size: 1.05rem; }
.av-0 { --g1: #7fd3ff; --g2: #3aa0ff; } .av-1 { --g1: #ffd27a; --g2: #f4871a; } .av-2 { --g1: #7ee8d8; --g2: #12a58f; } .av-3 { --g1: #cdbcff; --g2: #8a6cf5; }
.av-4 { --g1: #ffb3cd; --g2: #e8508a; } .av-5 { --g1: #a6efae; --g2: #3fb85a; } .av-6 { --g1: #ffe58f; --g2: #f0b429; } .av-7 { --g1: #a8ddff; --g2: #4aa8e6; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .6rem; border-radius: 999px; font-size: .82rem; font-weight: 650; background: var(--surface-3); color: var(--muted); }
.chip .icon { width: .95rem; height: .95rem; }
.chip.tone-ok { background: var(--ok-bg); color: var(--ok); } .chip.tone-warn { background: var(--warn-bg); color: var(--warn); }
.chip.tone-bad { background: var(--bad-bg); color: var(--bad); } .chip.tone-info { background: var(--info-bg); color: var(--info); }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: .65rem .9rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
.cell-actions { display: flex; gap: .35rem; justify-content: flex-end; flex-wrap: wrap; }

/* ------------------------------------------------------------------ states */
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 3rem 1rem; color: var(--muted); }
.loading.inline { padding: 1.25rem; flex-direction: row; }
.orbit { position: relative; display: inline-block; width: 3.2rem; height: 3.2rem; }
.orbit-core { position: absolute; inset: 28%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #4db2ff 45%, #1e9bff 70%, #06306a); box-shadow: 0 0 18px 3px var(--glow-blue); }
.orbit-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--gold-bg); border-bottom-color: var(--accent-bg); animation: spin 1.6s linear infinite; }
.orbit-dot { position: absolute; left: 50%; top: -3px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--gold-bg); box-shadow: 0 0 10px 2px var(--glow-orange); transform-origin: 50% calc(1.6rem + 3px); animation: spin 1.6s linear infinite; }
.loading.inline .orbit { width: 1.75rem; height: 1.75rem; }
.loading.inline .orbit-dot { transform-origin: 50% calc(.875rem + 3px); }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .35rem; padding: 2.5rem 1.25rem; max-width: 34rem; margin: 0 auto; }
.empty.compact { padding: 1rem; }
.empty h2 { margin: .25rem 0 0; }
.empty p { margin: 0; }
.empty-icon { display: grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: 18px; background: linear-gradient(145deg, var(--info-bg), var(--surface-3)); border: 1px solid var(--line); color: var(--accent); margin-bottom: .5rem; box-shadow: 0 0 24px -6px var(--glow-blue); }
.empty-icon .icon { width: 1.6rem; height: 1.6rem; }
.empty-error .empty-icon { color: var(--bad); background: var(--bad-bg); box-shadow: none; }
.empty-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; margin-top: .75rem; }
.skeletons { display: grid; gap: .75rem; }
.skeleton { height: 3rem; border-radius: 12px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.notice { display: flex; gap: .75rem; align-items: flex-start; padding: .75rem 1rem; border-radius: 12px; background: var(--info-bg); border: 1px solid var(--line); }
.notice.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn); }
.notice.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.notice p:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------------ toasts, dialogs, menus, tabs */
.toasts { position: fixed; z-index: 90; right: 1rem; bottom: 1rem; width: min(24rem, calc(100vw - 2rem)); pointer-events: none; }
.toasts-live { display: grid; gap: .5rem; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: .6rem; padding: .6rem .6rem .6rem .9rem; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line-strong); box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
.toast .icon { color: var(--ok); }
.toast-error { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }
.toast-error .icon { color: var(--bad); }
.toast-msg { flex: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 899px) { .toasts { bottom: 5rem; } }

dialog.dlg { padding: 0; border: 1px solid var(--line-strong); border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); width: min(100vw - 1.5rem, 34rem); max-height: calc(100vh - 2rem); overflow: hidden; }
dialog.dlg-sm { width: min(100vw - 1.5rem, 26rem); } dialog.dlg-lg { width: min(100vw - 1.5rem, 46rem); } dialog.dlg-xl { width: min(100vw - 1.5rem, 68rem); }
dialog.dlg::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }
.dlg-inner { display: flex; flex-direction: column; max-height: calc(100vh - 2rem); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem .5rem; }
.dlg-title { margin: 0; font-size: 1.2rem; }
.dlg-body { padding: .5rem 1.25rem 1rem; overflow-y: auto; min-height: 0; }
.dlg-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; padding: .75rem 1.25rem 1rem; border-top: 1px solid var(--line); background: var(--surface-2); }

.menu { position: fixed; z-index: 80; left: var(--mx, 0); top: var(--my, 0); min-width: 13rem; max-width: 20rem; padding: .35rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow); }
.menu-item { display: flex; align-items: center; gap: .65rem; width: 100%; padding: .5rem .65rem; border: 0; border-radius: 9px; background: transparent; color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); outline: none; }
.menu-item:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.menu-item.danger { color: var(--bad); }
.menu-item[disabled] { opacity: .45; cursor: not-allowed; }
.menu-label { flex: 1; }
.menu-sep { height: 1px; background: var(--line); margin: .3rem .25rem; }
.menu-heading { padding: .4rem .65rem .2rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; }

.tablist { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); overflow-x: auto; margin-bottom: 1rem; scrollbar-width: thin; }
.tab { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem .9rem; border: 0; border-bottom: 3px solid transparent; background: transparent; color: var(--muted); font: inherit; font-weight: 650; cursor: pointer; white-space: nowrap; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent-bg); }
.subnav { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); overflow-x: auto; margin: 0 0 1.25rem; padding: 0; list-style: none; scrollbar-width: thin; }
.subnav a { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem .9rem; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 650; text-decoration: none; white-space: nowrap; margin-bottom: -1px; }
.subnav a:hover { color: var(--text); }
.subnav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent-bg); }

/* combobox / people picker */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 5; left: 0; right: 0; top: 4.4rem; margin: 0; padding: .3rem; list-style: none; max-height: 14rem; overflow-y: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); }
.combo-opt { display: flex; align-items: center; gap: .6rem; padding: .4rem .5rem; border-radius: 9px; cursor: pointer; }
.combo-opt.active, .combo-opt:hover { background: var(--surface-3); }
.combo-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.members { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .25rem; }
.member { display: flex; align-items: center; gap: .65rem; padding: .4rem .25rem; flex-wrap: wrap; }
.member-text { flex: 1; min-width: 8rem; }
.share-add { display: grid; gap: .75rem; padding-top: 1rem; border-top: 1px solid var(--line); }

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .orbit-ring, .orbit-dot { animation: none !important; }
}

.manage-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.manage-row { display: flex; align-items: center; gap: .4rem; padding: .35rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.manage-name { flex: 1; min-width: 7rem; display: flex; align-items: center; gap: .5rem; font-weight: 600; }

/* ------------------------------------------------------------------ auth pages */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; position: relative; z-index: 1; outline: none; }
.auth-card { width: min(100%, 32rem); border-radius: 24px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.auth-hero { padding: 2rem 1.5rem 1rem; display: grid; place-items: center; background: radial-gradient(30rem 14rem at 50% 0, rgba(77, 178, 255, .35), transparent 70%), radial-gradient(24rem 12rem at 100% 100%, rgba(255, 167, 51, .25), transparent 70%), linear-gradient(180deg, #0c1428, #070b16); }
.auth-hero img { width: min(100%, 22rem); height: auto; filter: drop-shadow(0 10px 30px var(--glow-blue)); }
.auth-body { padding: 1.5rem 1.75rem 1.75rem; text-align: center; display: grid; gap: .75rem; }
.auth-body h1 { font-size: 1.5rem; }
.btn-wide { display: flex; width: 100%; padding: .8rem 1.1rem; font-size: 1.05rem; }
.loading.boot { min-height: 100vh; }

/* ------------------------------------------------------------------ settings */
.settings-body { display: grid; gap: 1rem; }
.settings-body > .card + .card { margin-top: 0; }
.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .75rem; margin: 1rem 0 0; }
.level { padding: .75rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.level dt { margin-bottom: .3rem; } .level dd { margin: 0; font-size: .88rem; color: var(--muted); }
.sources { display: grid; gap: .75rem; }
.source { padding: 1rem 1.15rem; }
.source-head { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: flex-start; justify-content: space-between; }
.source-text { flex: 1; min-width: 14rem; } .source-text h3 { font-size: 1.05rem; } .source-text p { margin: .1rem 0; font-size: .9rem; }
.effective { font-size: .82rem; }
.source-ctl, .cat-ctl { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; } .source-ctl .select { min-width: 15rem; } .cat-ctl .select { min-width: 15rem; }
.save-status { font-size: .82rem; min-width: 3.5rem; }
.cats { list-style: none; margin: .75rem 0 0; padding: .5rem 0 0; border-top: 1px solid var(--line); display: grid; gap: .1rem; }
.cat { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; padding: .6rem 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.cat:last-child { border-bottom: 0; }
.cat-text { display: flex; flex-direction: column; flex: 1; min-width: 14rem; font-size: .92rem; }
.cat-level { font-size: .8rem; }
.locked { display: flex; gap: .4rem; align-items: flex-start; margin-top: .25rem; color: var(--gold); font-size: .85rem; } .locked .icon { width: 1rem; height: 1rem; margin-top: .15rem; }
.pair { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; margin-top: 1rem; padding: 1rem; border-radius: 14px; background: var(--surface); border: 1px dashed var(--accent); }
.pair-code { font: 800 2.2rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .14em; padding: .6rem 1rem; border-radius: 12px; background: var(--field); border: 1px solid var(--line-strong); }
.pair-code.expired { opacity: .4; text-decoration: line-through; }
.pair-side p { margin: 0 0 .5rem; } .steps { margin: 0; padding-left: 1.2rem; flex-basis: 100%; }
.devices { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.device { display: flex; align-items: center; gap: .85rem; padding: .75rem 1rem; flex-wrap: wrap; }
.device + .device { margin-top: 0; }
.device-icon { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 12px; background: var(--info-bg); color: var(--accent); }
.device-text { flex: 1; min-width: 10rem; display: flex; flex-direction: column; font-size: .92rem; }

/* ------------------------------------------------------------------ admin */
.admin-body { display: grid; gap: 1rem; }
.ostats { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .75rem; }
.ostat { display: flex; align-items: center; gap: .85rem; padding: 1rem; border-radius: 16px; background: linear-gradient(170deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); }
.ostat-icon { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 12px; background: var(--surface-3); color: var(--tone, var(--info)); }
.ostat-value { font-size: 1.7rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.conn { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .5rem; }
.conn li { display: flex; gap: .6rem; align-items: flex-start; }
.app-cell { display: flex; align-items: center; gap: .65rem; } .app-cell > span { display: flex; flex-direction: column; line-height: 1.25; }
.pills { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.stack-sm { display: flex; flex-direction: column; gap: .1rem; font-size: .88rem; }
.err-text { color: var(--bad); font-size: .8rem; max-width: 18rem; overflow-wrap: anywhere; }
.secret { display: block; padding: .5rem .7rem; border-radius: 10px; background: var(--field); border: 1px solid var(--line-strong); margin-bottom: .35rem; }
.kv { display: grid; gap: .3rem; margin: 0; } .kv div { display: flex; justify-content: space-between; gap: 1rem; } .kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; }
.small { font-size: .8rem; } .block { display: block; } .grow { flex: 1; min-width: 12rem; }
.row .field.grow { margin-right: .25rem; }

/* ------------------------------------------------------------------ command palette */
dialog.palette { padding: 0; border: 1px solid var(--line-strong); border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow), 0 0 0 1px var(--glow-blue); width: min(100vw - 1.5rem, 40rem); margin-top: 12vh; max-height: 70vh; overflow: hidden; }
dialog.palette::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }
.pal-box { display: flex; flex-direction: column; max-height: 70vh; }
.pal-head { display: flex; align-items: center; gap: .6rem; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
.pal-input { flex: 1; min-width: 0; font: inherit; font-size: 1.05rem; padding: .35rem 0; border: 0; background: transparent; color: var(--text); }
.pal-input:focus { outline: none; }
.pal-head:focus-within { box-shadow: inset 0 -2px 0 var(--accent-bg); }
.pal-list { list-style: none; margin: 0; padding: .35rem; overflow-y: auto; min-height: 3rem; }
.pal-group { padding: .5rem .6rem .2rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; }
.pal-opt { display: flex; align-items: center; gap: .7rem; padding: .5rem .6rem; border-radius: 10px; cursor: pointer; }
.pal-opt.active { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--accent-bg); }
.pal-ic { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 9px; background: var(--info-bg); color: var(--accent); flex: none; }
.pal-text { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; } .pal-text .muted { font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-status { margin: 0; padding: 0 1rem .4rem; font-size: .85rem; color: var(--muted); min-height: 1.2rem; }
.pal-foot { margin: 0; padding: .5rem 1rem; border-top: 1px solid var(--line); font-size: .8rem; background: var(--surface-2); }
.boot-msg { text-align: center; padding: 4rem 1rem; color: var(--muted); }
}
