/* ══════════════════════════════════════════════════════════════════════════
   Jarvis — design system.
   Apple-style dark UI: system font, Liquid Glass materials (glass.js), and
   motion values taken from Emil Kowalski's design-engineering standards
   (github.com/emilkowalski/skills — apple-design, emil-design-eng, animate).

   Every color in the app's inline styles points at a token below, so the
   whole look is retuned here, in one place.
   ══════════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;

  /* — ground: graphite, lit by a faint neutron-star violet — */
  --bg: #111114;
  --wallpaper:
    radial-gradient(900px 620px at 8% -12%, rgba(139, 108, 255, 0.16), transparent 62%),
    radial-gradient(800px 600px at 108% 112%, rgba(110, 76, 230, 0.13), transparent 64%),
    radial-gradient(520px 380px at 62% 38%, rgba(196, 177, 255, 0.035), transparent 70%),
    linear-gradient(180deg, #141418 0%, #0f0f12 100%);

  /* — labels (Apple dark: primary / secondary / tertiary) — */
  --text: #f2f2f5;
  --text-2: rgba(235, 235, 245, 0.64);
  --text-3: rgba(235, 235, 245, 0.40);

  /* — separators & fills (neutral grey, never tinted) — */
  --sep: rgba(255, 255, 255, 0.085);
  --sep-strong: rgba(255, 255, 255, 0.16);
  --fill: rgba(255, 255, 255, 0.05);
  --fill-2: rgba(255, 255, 255, 0.08);
  --fill-3: rgba(255, 255, 255, 0.12);
  --well: rgba(0, 0, 0, 0.28);

  /* — surfaces — */
  /* Cards read as glass without paying for a blur: a light top edge fading
     down (light catching the material), over the graphite ground. */
  --card: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.028) 42%, rgba(255, 255, 255, 0.022) 100%);
  --accent-card: linear-gradient(180deg, rgba(157, 124, 255, 0.17), rgba(157, 124, 255, 0.07));
  --surface: #1e1e23;                          /* solid, for rings and dense tables */
  --surface-2: #2a2a31;
  --glass-tint: rgba(62, 62, 72, 0.36);        /* Liquid Glass tint — cool grey */
  --glass-tint-strong: rgba(34, 34, 40, 0.70); /* heavier material for big surfaces */

  /* — accent: neutron-star violet — */
  --accent: #9d7cff;
  --accent-strong: #7657f5;                    /* solid fills under white text (≥4.5:1) */
  --accent-gradient: linear-gradient(90deg, #7657f5, #b9a2ff);
  --accent-text: #c6b5ff;
  --accent-fill: rgba(157, 124, 255, 0.15);
  --accent-sep: rgba(157, 124, 255, 0.40);
  --teal: #64d2ff;
  --indigo: #5e5ce6;
  --purple: #bf5af2;
  --green: #30d158;
  --green-sep: rgba(48, 209, 88, 0.40);
  --orange: #ff9f0a;
  --orange-sep: rgba(255, 159, 10, 0.40);
  --yellow: #ffd60a;
  --red: #ff6961;
  --red-sep: rgba(255, 69, 58, 0.42);

  /* — type — */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  /* — shape — */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* — motion (emil-design-eng: strong custom curves, UI under 300ms) — */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-press: 160ms;
  --dur-fast: 150ms;
  --dur-ui: 200ms;
  --dur-modal: 250ms;

  /* legacy names still used by a few class rules */
  --color-bg: var(--bg);
  --color-surface: var(--surface);
  --color-text: var(--text);
  --color-accent: var(--accent);
  --color-divider: var(--sep);
}

/* ── base ─────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  background: var(--wallpaper);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  accent-color: var(--accent);
}

/* Size-specific tracking: tighten as type grows, body stays at 0. */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
}
h1 { font-size: 32px; letter-spacing: -0.022em; line-height: 1.08; }
h2 { font-size: 26px; letter-spacing: -0.02em; }
h3 { font-size: 21px; }
h4 { font-size: 17px; letter-spacing: -0.01em; }
h5 { font-size: 15px; letter-spacing: -0.005em; }
h6 { font-size: 12px; letter-spacing: 0; }
b, strong { font-weight: 600; }
p { margin: 0 0 8px; }
a { color: var(--accent-text); text-underline-offset: 3px; }
img { display: block; max-width: 100%; }
figure { margin: 0; }
code, kbd, pre, samp { font-family: var(--mono); }
figcaption { font-size: 11px; margin-top: 3px; color: var(--text-3); }
.text-muted { color: var(--text-2); }
.lighten { mix-blend-mode: lighten; background-color: transparent; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--accent) 38%, transparent); }
::placeholder { color: var(--text-3); opacity: 1; }

* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.16) transparent; }

/* ── press feedback (every pressable element) ─────────────────────────── */
/* apple-design §1: feedback lives on the press and is instant.
   emil: scale(0.97) on :active, 160ms strong ease-out. */

button, .btn, [role="button"], summary {
  -webkit-tap-highlight-color: transparent;
  transition:
    transform var(--dur-press) var(--ease-out),
    background-color var(--dur-fast) ease,
    color var(--dur-fast) ease,
    box-shadow var(--dur-fast) ease,
    opacity var(--dur-fast) ease;
}
button:active:not(:disabled), .btn:active:not(:disabled), [role="button"]:active {
  transform: scale(0.97);
}
button:disabled { cursor: default; }

/* Inline-styled buttons can't take a CSS background on hover, so they
   brighten instead. Gated to real pointers: touch fires hovers on tap. */
@media (hover: hover) and (pointer: fine) {
  button:not(.glass):not(.btn):not(.nav-item):not(:disabled):hover { filter: brightness(1.18); }
}

/* ── Liquid Glass ─────────────────────────────────────────────────────── */
/* Frost + tint + a soft bright edge work everywhere. Elements marked
   data-glass="lens" also get the live refraction from glass.js (Chromium
   supports backdrop-filter:url(); Safari/Firefox keep the frost). */

.glass {
  --glass-blur: 20px;
  background: var(--glass-tint);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.075),
    0 6px 20px rgba(0, 0, 0, 0.22);
}
.glass-lens { --glass-blur: 7px; }
.glass-thick {
  --glass-blur: 40px;
  background: var(--glass-tint-strong);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    0 24px 60px rgba(0, 0, 0, 0.45);
}
@media (hover: hover) and (pointer: fine) {
  button.glass:not(:disabled):hover { background: rgba(84, 84, 96, 0.44); }
}

/* ── app shell ────────────────────────────────────────────────────────── */

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
}

.sidebar {
  width: 228px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 10px 10px;
  padding: 14px 10px 10px;
  overflow-y: auto;
  border-radius: 22px;
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 8px; }
.brand-orb {
  position: relative;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 50%;
  /* a neutron star: white-hot core, violet corona */
  background: radial-gradient(circle at 50% 50%, #ffffff 0 16%, #e6dcff 26%, #b39bff 44%, #7657f5 68%, #2d2066 100%);
  box-shadow: 0 0 0 1px rgba(196, 177, 255, 0.28), 0 0 18px rgba(157, 124, 255, 0.45);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--font-display); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--text-3); line-height: 1.2; }

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-group-title {
  padding: 12px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  background: transparent;
}
.nav-item > i { font-size: 16px; width: 18px; text-align: center; color: var(--accent); flex: none; }
.nav-item > span:first-of-type { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item[aria-current="page"] { background: var(--fill-3); }
@media (hover: hover) and (pointer: fine) {
  .nav-item:not([aria-current="page"]):hover { background: var(--fill); }
}
.nav-item .tag { padding: 0 7px; min-width: 20px; justify-content: center; font-size: 11px; line-height: 18px; }

/* A nav item with a submenu (Clients → its slices). */
.nav-row { display: flex; align-items: center; gap: 2px; }
.nav-row > .nav-item { flex: 1; min-width: 0; }
.nav-caret { flex: none; display: grid; place-items: center; width: 22px; height: 26px; border: 0; border-radius: 6px; font: inherit; color: var(--text-3); cursor: pointer; background: transparent; }
.nav-caret > i { font-size: 11px; }
@media (hover: hover) and (pointer: fine) {
  .nav-caret:hover { color: var(--text); background: var(--fill-2); }
}
.nav-caret:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.nav-subs { display: flex; flex-direction: column; gap: 1px; margin: 1px 0 3px 18px; padding-left: 9px; box-shadow: inset 1px 0 0 var(--sep); }
.nav-sub {
  display: flex; align-items: center; gap: 7px; width: 100%; min-height: 26px; padding: 0 8px;
  border: 0; border-radius: var(--r-sm); font: inherit; font-size: 12px; text-align: left;
  cursor: pointer; color: var(--text-2); background: transparent;
}
.nav-sub > span:not(.nav-sub-dot):not(.nav-sub-count) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sub-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; }
.nav-sub-count { flex: none; font-size: 11px; font-variant-numeric: tabular-nums; opacity: .6; }
.nav-sub[aria-current="page"] { color: var(--text); background: var(--fill-3); }
@media (hover: hover) and (pointer: fine) {
  .nav-sub:not([aria-current="page"]):hover { color: var(--text); background: var(--fill); }
}

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.backend-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 12px;
  background: var(--fill);
  font-size: 12px;
  color: var(--text-2);
}

.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--green); }

/* Switch — a compact on/off control for dense tables and cards (Autonomy). */
.switch { position: relative; display: inline-block; width: 30px; height: 17px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--fill-2);
  box-shadow: inset 0 0 0 1px var(--sep); transition: background var(--dur-fast) var(--ease-out); pointer-events: none;
}
.switch span::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--text-2); transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.switch input:checked + span { background: var(--accent-strong); box-shadow: inset 0 0 0 1px var(--accent-sep); }
.switch input:checked + span::after { transform: translateX(13px); background: #fff; }
.switch input:disabled + span { opacity: 0.4; }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.dot-live { box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent); }
.dot-off { background: var(--orange); box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 22%, transparent); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 6px;
}
.pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 13px;
  border: 0;
  border-radius: var(--r-pill);
  font: inherit;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  cursor: pointer;
}
.pill > i { font-size: 15px; color: var(--accent); }
.pill-static { cursor: default; }
.pill .pill-label { color: var(--text-2); }
.pill .pill-value { font-variant-numeric: tabular-nums; font-weight: 500; }
.kbd {
  font-family: var(--font);
  font-size: 11px;
  color: var(--text-3);
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--fill-2);
}

.clock { flex: none; margin: 0 auto; display: flex; flex-direction: column; align-items: center; line-height: 1.1; white-space: nowrap; }
.clock-date { font-size: 11px; color: var(--text-3); }
.clock-time { font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }

.content { flex: 1; min-height: 0; padding: 8px 16px 12px; }

.composer-bar { padding: 4px 16px 14px; }
.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 980px;
  margin: 0 auto;
  padding: 5px 5px 5px 16px;
  border-radius: var(--r-pill);
}
.composer > i { font-size: 17px; color: var(--accent); flex: none; }
.composer input[name="goal"] {
  flex: 1;
  min-width: 0;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.composer-agents {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: none;
  padding: 0 8px 0 10px;
  box-shadow: inset 1px 0 0 var(--sep-strong);
  color: var(--text-2);
}
.composer-agents select { border: 0; background: transparent; color: var(--text); font: inherit; font-size: 12px; outline: none; cursor: pointer; }
.composer .btn-primary { border-radius: var(--r-pill); height: 34px; padding: 0 16px; }

/* ── buttons ──────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 12px;
  border: 0;
  border-radius: var(--r-sm);
  font-family: var(--font);
  font-weight: 500;
  font-size: 13px;
  line-height: 1.2;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn svg { display: block; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn-primary { color: #fff; background: var(--accent-strong); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.3); }
.btn-secondary { background: var(--fill-2); box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.10); }
.btn-ghost { color: var(--accent-text); padding-inline: 6px; }
.btn-icon { width: 30px; height: 30px; padding: 0; }
.btn-block { width: 100%; margin-top: 6px; }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:not(:disabled):hover { background: #8466fa; }
  .btn-secondary:not(:disabled):hover { background: var(--fill-3); }
  .btn-ghost:not(:disabled):hover { background: var(--accent-fill); }
}
.btn-primary:active:not(:disabled) { background: #6a4be6; }

/* ── forms ────────────────────────────────────────────────────────────── */

.field > label { display: block; font-size: 12px; margin-bottom: 5px; color: var(--text-2); }
.input {
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
  color: var(--text);
  caret-color: var(--accent);
  background: var(--fill);
  border: 0;
  border-radius: var(--r-sm);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.14);
  transition: box-shadow var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.input:focus, .input:focus-visible {
  outline: none;
  background: var(--fill-2);
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}
select.input { appearance: none; -webkit-appearance: none; padding-right: 28px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='rgba(235,235,245,.6)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
select option { background: var(--surface-2); color: var(--text); }
textarea.input { min-height: 90px; resize: vertical; line-height: 1.5; }

.radio { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.radio input, .seg-opt input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.radio .dot { width: 16px; height: 16px; background: transparent; box-shadow: inset 0 0 0 1.5px var(--sep-strong); }
.radio input:checked + .dot { background: var(--accent); box-shadow: inset 0 0 0 4px var(--surface); }
.radio input:focus-visible + .dot { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Segmented control, Apple-style: a sunken track and a raised thumb. */
.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: 9px; background: var(--fill-2); }
.seg-opt {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  font-size: 12px; cursor: pointer; border-radius: 7px; color: var(--text-2);
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}
.seg-opt:has(input:checked) { color: var(--text); background: rgba(118, 118, 128, 0.42); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.seg-opt:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: -2px; }

input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
input[type="range"] { accent-color: var(--accent); }

/* ── cards ────────────────────────────────────────────────────────────── */

.card {
  display: flex; flex-direction: column; gap: 6px; padding: 14px;
  border-radius: var(--r-lg); background: var(--card);
  box-shadow: inset 0 0 0 1px var(--sep);
}
.card-kicker { font-size: 11px; font-weight: 600; color: var(--accent-text); }
.card-title { font-family: var(--font-display); font-weight: 600; font-size: 17px; line-height: 1.2; letter-spacing: -0.01em; }
.card-body { margin: 0; font-size: 13px; color: var(--text-2); flex: 1; }
.card-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3); }
.elev-sm { box-shadow: inset 0 0 0 1px var(--sep); }
.elev-md { box-shadow: inset 0 0 0 1px var(--sep), 0 8px 24px rgba(0, 0, 0, 0.35); }
.elev-lg { box-shadow: inset 0 0 0 1px var(--sep-strong), 0 20px 50px rgba(0, 0, 0, 0.5); }

.section-card {
  display: flex; flex-direction: column; gap: 10px; padding: 14px;
  border-radius: var(--r-lg); background: var(--card);
  box-shadow: inset 0 0 0 1px var(--sep);
}
.section-card-head { display: flex; align-items: center; gap: 8px; }
.section-card-head i { font-size: 16px; color: var(--accent); }
.section-card-head b { font-size: 13px; font-weight: 600; }

/* ── tags ─────────────────────────────────────────────────────────────── */

.tag {
  display: inline-flex; align-items: center; font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: var(--r-pill); white-space: nowrap;
  background: var(--fill-2); color: var(--text-2);
}
.tag-accent { background: var(--accent-fill); color: var(--accent-text); }
.tag-accent-2 { background: color-mix(in srgb, var(--indigo) 22%, transparent); color: #a5a4ff; }
.tag-neutral { background: var(--fill-2); color: var(--text-2); }
.tag-outline { background: transparent; box-shadow: inset 0 0 0 1px var(--accent-sep); color: var(--accent-text); }

/* ── tables ───────────────────────────────────────────────────────────── */

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; font-weight: 600; color: var(--text-3);
  padding: 6px 8px; border-bottom: 1px solid var(--sep);
}
.table td { padding: 7px 8px; border-bottom: 1px solid color-mix(in srgb, var(--sep) 70%, transparent); }
.table tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.018); }
@media (hover: hover) and (pointer: fine) {
  .table tbody tr:hover { background: var(--fill); }
}
.hr { height: 1px; border: 0; margin: 10px 0; background: var(--sep); }

/* ── dialog / modal ───────────────────────────────────────────────────── */
/* Dim to focus (apple-design §12). The scrim carries no backdrop-filter:
   a filtered scrim would become the dialog's backdrop root and flatten its
   glass into a plain grey. Modals stay centered (emil: modals are exempt
   from origin-aware scaling). Enter plays once, on open only. */

.modal-backdrop, .dialog-backdrop {
  position: fixed; inset: 0; z-index: 250;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px; overflow: auto;
  background: rgba(0, 0, 0, 0.5);
}
.dialog-backdrop { align-items: center; }
.modal, .dialog {
  display: flex; flex-direction: column;
  border-radius: 22px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  transform-origin: center;
}
.dialog { width: min(440px, 100%); gap: 10px; padding: 18px; }
.dialog-title { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.dialog-body { font-size: 13px; color: var(--text-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 12px 20px; box-shadow: inset 0 -1px 0 var(--sep); }
.modal-head > b { font-family: var(--font-display); font-size: 15px; font-weight: 600; flex: 1; letter-spacing: -0.005em; }

.is-opening.modal-backdrop, .is-opening.dialog-backdrop { transition: opacity var(--dur-modal) var(--ease-out); }
.is-opening .modal, .is-opening .dialog { transition: opacity var(--dur-modal) var(--ease-out), transform var(--dur-modal) var(--ease-out); }
@starting-style {
  .is-opening.modal-backdrop, .is-opening.dialog-backdrop { opacity: 0; }
  .is-opening .modal, .is-opening .dialog { opacity: 0; transform: scale(0.96); }
}

/* Close button — the circular grey "x" Apple sheets use. */
.close-btn {
  width: 26px; height: 26px; flex: none; border: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--fill-2); color: var(--text-2); cursor: pointer;
}
.close-btn i { font-size: 13px; }

/* ── toast ────────────────────────────────────────────────────────────── */
/* Sonner's recipe: slightly slower, plain `ease`, enters and leaves from
   the bottom. It's only inserted when the message changes, so the entry
   never replays on background re-renders. */

.toast {
  position: fixed; left: 50%; bottom: 84px; z-index: 9999;
  translate: -50% 0;
  max-width: min(560px, calc(100vw - 32px));
  padding: 11px 18px;
  border-radius: 18px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  transition: opacity 400ms ease, transform 400ms ease;
}
@starting-style {
  .toast { opacity: 0; transform: translateY(100%); }
}
.toast.is-leaving {
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}

/* ── the Omni-Controller chat (frontend/chat.js) ──────────────────────── */
/* The chat is the console, so it gets the whole content area: conversation on
   the left, the workspace rail on the right. Everything here reads a token —
   no colour is written twice. */

.chat-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 14px; height: 100%; min-height: 0;
}
.chat-main {
  position: relative; display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  border-radius: 14px; background: var(--card); box-shadow: 0 0 0 1px var(--sep);
}
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; box-shadow: inset 0 -1px 0 var(--sep); }
/* A tool summary can be a whole sentence. It gets one line and an ellipsis —
   the full text is on the step row, which is where you would look for it. */
#chat-status { min-width: 0; max-width: 46%; }
#chat-status > span { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; }
#chat-status-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 16px; scroll-behavior: auto; }
.chat-side { display: flex; flex-direction: column; gap: 10px; min-height: 0; overflow-y: auto; }

.chat-composer { display: flex; align-items: flex-end; gap: 8px; padding: 12px; box-shadow: inset 0 1px 0 var(--sep); }
.chat-composer textarea {
  flex: 1; min-width: 0; min-height: 44px; max-height: 160px; resize: none;
  padding: 11px 16px; border-radius: 22px; border: 0; outline: none;
  font: inherit; font-size: 13.5px; line-height: 1.45; color: var(--text);
  background: var(--fill); box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.14);
}

/* The ROOT ARMED badge. Armed is the quiet state; disarmed is the one that
   has to be noticed, because it changes what an answer can mean. */
.chat-root-badge {
  display: inline-flex; align-items: center; gap: 5px; flex: none; cursor: pointer;
  padding: 3px 9px; border: 0; border-radius: 11px; font: inherit; font-size: 10.5px;
  letter-spacing: 0.06em; font-weight: 600;
  color: var(--accent-text); background: var(--accent-fill); box-shadow: inset 0 0 0 1px var(--accent-sep);
}
.chat-root-badge[data-armed="false"] { color: var(--orange); background: color-mix(in srgb, var(--orange) 14%, transparent); box-shadow: inset 0 0 0 1px var(--orange-sep); }

.chat-jump {
  position: absolute; left: 50%; bottom: 76px; transform: translateX(-50%); z-index: 3;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 5px 12px; border: 0; border-radius: 14px; font: inherit; font-size: 11.5px;
  color: var(--text); background: var(--surface-2); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35), inset 0 0 0 1px var(--sep-strong);
}
/* `hidden` is only display:none in the UA sheet, and any explicit display wins
   over it — every class here that sets one has to say so. */
.chat-jump[hidden], .chat-tab[hidden] { display: none; }

.bubble-mine, .bubble-theirs {
  max-width: 88%; padding: 10px 14px; border-radius: 16px; font-size: 13.5px; line-height: 1.5;
  overflow-wrap: anywhere;
}
.bubble-mine { border-bottom-right-radius: 4px; color: #fff; background: var(--accent-strong); }
.bubble-theirs { border-bottom-left-radius: 4px; background: rgba(255, 255, 255, 0.045); box-shadow: 0 0 0 1px var(--sep); }

.chat-thinking {
  display: inline-flex; align-items: center; gap: 10px; align-self: flex-start;
  padding: 9px 13px; border-radius: 16px; border-bottom-left-radius: 4px; font-size: 12px; color: var(--text-2);
  background: rgba(255, 255, 255, 0.045); box-shadow: 0 0 0 1px var(--sep);
}
.chat-empty { display: flex; flex-direction: column; gap: 12px; padding: 4px 2px 8px; }
.chat-chip {
  padding: 5px 11px; border: 0; border-radius: 16px; font: inherit; font-size: 11.5px; cursor: pointer;
  color: var(--accent-text); background: var(--accent-fill); box-shadow: inset 0 0 0 1px var(--accent-sep);
}

/* markdown inside a reply */
.chat-md > :first-child { margin-top: 0; }
.chat-md > :last-child { margin-bottom: 0; }
.chat-md p { margin: 0 0 8px; }
.chat-md ul, .chat-md ol { margin: 0 0 8px; padding-left: 20px; }
.chat-md li { margin: 2px 0; }
.chat-md a { color: var(--accent-text); }
.chat-md code { padding: 1px 5px; border-radius: 5px; background: var(--well); font-size: 12px; font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace; }
.chat-md blockquote { margin: 0 0 8px; padding-left: 10px; box-shadow: inset 2px 0 0 var(--sep-strong); color: var(--text-2); }
.chat-md table { border-collapse: collapse; font-size: 12px; margin: 0 0 8px; }
.chat-md th, .chat-md td { padding: 4px 8px; text-align: left; box-shadow: inset 0 -1px 0 var(--sep); }

.chat-code {
  position: relative; margin: 0 0 8px; padding: 26px 12px 10px; border-radius: 10px; overflow-x: auto;
  background: var(--well); box-shadow: inset 0 0 0 1px var(--sep);
  font-size: 12px; line-height: 1.5; font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
}
.chat-code code { padding: 0; background: none; font-size: inherit; }
.chat-code-bar {
  position: absolute; inset: 0 0 auto 0; display: flex; align-items: center; justify-content: space-between;
  padding: 3px 8px; font-size: 10px; color: var(--text-3);
}
.chat-code-bar button {
  border: 0; border-radius: 6px; padding: 2px 7px; cursor: pointer; font: inherit; font-size: 10px;
  color: var(--text-2); background: var(--fill-2);
}
.chat-code-bar button:hover { color: var(--text); background: var(--fill-3); }
.chat-code-lang { letter-spacing: 0.06em; text-transform: uppercase; }

/* ── tool steps ───────────────────────────────────────────────────────── */
/* The live feedback loop: one row per call, visible by default. Anything that
   failed opens itself, because that is the row you need to read. */
.chat-steps { display: flex; flex-direction: column; gap: 4px; }
.chat-step { border-radius: 10px; background: rgba(255, 255, 255, 0.025); box-shadow: inset 0 0 0 1px var(--sep); overflow: hidden; }
.chat-step[data-state="failed"] { box-shadow: inset 0 0 0 1px var(--red-sep); }
.chat-step[data-state="skipped"] { box-shadow: inset 0 0 0 1px var(--orange-sep); }
.chat-step-head {
  display: flex; align-items: center; gap: 7px; width: 100%; padding: 6px 10px;
  border: 0; background: none; cursor: pointer; font: inherit; font-size: 11.5px; color: var(--text-2); text-align: left;
}
.chat-step-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-tier2 {
  flex: none; padding: 0 6px; border-radius: 8px; font-size: 9.5px; letter-spacing: 0.06em;
  color: var(--orange); background: color-mix(in srgb, var(--orange) 14%, transparent);
}
.chat-step-body {
  margin: 0; padding: 8px 10px; max-height: 260px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: 11px; line-height: 1.45; color: var(--text-2); background: var(--well);
}
.chat-step-hint { display: flex; align-items: flex-start; gap: 6px; padding: 6px 10px; font-size: 11px; color: var(--accent-text); }

/* ── the job console ──────────────────────────────────────────────────── */
.chat-job { box-shadow: inset 0 1px 0 var(--sep); }
.chat-job-head { display: flex; align-items: center; gap: 8px; padding: 5px 10px; font-size: 10.5px; color: var(--text-2); }
.chat-job-term { padding: 4px 8px 8px; background: var(--well); }
.chat-job-collapsed { max-height: 64px; overflow: hidden; }
.chat-job-row { display: flex; flex-direction: column; gap: 3px; padding: 7px 9px; border-radius: 9px; background: rgba(255, 255, 255, 0.03); box-shadow: inset 0 0 0 1px var(--sep); font-size: 11.5px; }
.chat-job-row[data-state="running"] { box-shadow: inset 0 0 0 1px var(--accent-sep); }

/* ── action cards ─────────────────────────────────────────────────────── */
/* The last thing between a typo and a dead daemon, so it looks like it. */
.chat-card {
  display: flex; flex-direction: column; gap: 9px; padding: 12px 14px; border-radius: 12px;
  background: var(--accent-card); box-shadow: 0 0 0 1px var(--accent-sep);
  border-left: 3px solid var(--accent);
}
.chat-card[data-tier="2"] {
  background: color-mix(in srgb, var(--orange) 8%, var(--card));
  box-shadow: 0 0 0 1px var(--orange-sep);
  border-left-color: var(--orange);
}
.chat-card-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.chat-countdown { font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.chat-card-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 10.5px; color: var(--text-3); }
.chat-card-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.chat-card-edit { display: flex; flex-direction: column; gap: 6px; }
.chat-card-edit label { display: flex; flex-direction: column; gap: 3px; font-size: 10.5px; color: var(--text-3); }
.chat-impact { margin: 0; padding-left: 18px; font-size: 11.5px; line-height: 1.5; color: var(--orange); }
.chat-receipt {
  display: flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 10px; font-size: 11.5px;
  color: var(--text-2); background: rgba(255, 255, 255, 0.025); box-shadow: inset 0 0 0 1px var(--sep);
}
.chat-command { margin: 0; padding: 9px 11px; border-radius: 9px; background: var(--well); font-size: 12px; overflow-x: auto; font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace; }
.chat-diff { margin: 0; padding: 9px 11px; border-radius: 9px; background: var(--well); font-size: 11.5px; line-height: 1.5; overflow-x: auto; font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace; }
.chat-diff .add { display: block; color: var(--green); background: color-mix(in srgb, var(--green) 10%, transparent); }
.chat-diff .del { display: block; color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); }
.chat-diff .meta { display: block; color: var(--text-3); }
.chat-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.chat-table th { text-align: left; font-weight: 500; color: var(--text-3); font-size: 10.5px; }
.chat-table th, .chat-table td { padding: 3px 6px; box-shadow: inset 0 -1px 0 var(--sep); overflow-wrap: anywhere; }

/* ── the workspace rail ───────────────────────────────────────────────── */
.chat-tabs { display: flex; gap: 4px; padding: 5px; border-radius: 11px; background: var(--card); box-shadow: 0 0 0 1px var(--sep); }
.chat-tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px; position: relative;
  padding: 6px 4px; border: 0; border-radius: 8px; cursor: pointer; font: inherit; font-size: 11px;
  color: var(--text-3); background: transparent;
}
.chat-tab[aria-current="true"] { color: var(--accent-text); background: var(--accent-fill); }
.chat-badge { position: absolute; top: 4px; right: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.chat-panel { display: flex; flex-direction: column; gap: 9px; padding: 12px 13px; border-radius: 12px; background: var(--card); box-shadow: 0 0 0 1px var(--sep); }
.chat-panel-title { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.chat-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.chat-seg button {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 6px; border: 0; border-radius: 9px; cursor: pointer; font: inherit; font-size: 11.5px;
  color: var(--text-3); background: transparent; box-shadow: inset 0 0 0 1px var(--sep);
}
.chat-seg button[aria-current="true"] { color: var(--accent-text); background: var(--accent-fill); box-shadow: inset 0 0 0 1px var(--accent-sep); }
.chat-arm { display: flex; flex-direction: column; gap: 5px; padding: 9px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.025); box-shadow: inset 0 0 0 1px var(--sep); }
.chat-arm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; align-self: flex-start;
  padding: 5px 11px; border: 0; border-radius: 9px; cursor: pointer; font: inherit; font-size: 11px;
  letter-spacing: 0.06em; font-weight: 600;
  color: var(--accent-text); background: var(--accent-fill); box-shadow: inset 0 0 0 1px var(--accent-sep);
}
.chat-arm[data-armed="false"] .chat-arm-btn { color: var(--orange); background: color-mix(in srgb, var(--orange) 14%, transparent); box-shadow: inset 0 0 0 1px var(--orange-sep); }
.chat-arm-btn:disabled { cursor: not-allowed; opacity: 0.6; }
.chat-check { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-2); cursor: pointer; }
.chat-check input { accent-color: var(--accent); }
.chat-group summary { cursor: pointer; font-size: 11.5px; padding: 4px 0; text-transform: capitalize; }
.chat-cap { display: flex; align-items: center; gap: 8px; padding: 2px 0 2px 10px; }
.chat-cap code { font-size: 11px; }
.chat-risk {
  flex: none; padding: 0 6px; border-radius: 7px; font-size: 9.5px; letter-spacing: 0.04em;
  color: var(--text-3); background: var(--fill-2);
}
.chat-cap[data-risk="destructive"] .chat-risk, .chat-job-row[data-state="failed"] .chat-risk { color: var(--red); background: color-mix(in srgb, var(--red) 13%, transparent); }
.chat-cap[data-risk="outbound"] .chat-risk { color: var(--orange); background: color-mix(in srgb, var(--orange) 13%, transparent); }
.chat-audit { display: flex; flex-direction: column; gap: 2px; padding: 7px 9px; border-radius: 9px; background: rgba(255, 255, 255, 0.025); box-shadow: inset 0 0 0 1px var(--sep); }
.chat-audit[data-state="failed"], .chat-audit[data-state="skipped"] { box-shadow: inset 0 0 0 1px var(--orange-sep); }

/* ── the capability palette (⌘K) ──────────────────────────────────────── */
.chat-palette-backdrop { position: fixed; inset: 0; z-index: 300; display: flex; align-items: flex-start; justify-content: center; padding-top: 14vh; background: rgba(0, 0, 0, 0.45); }
.chat-palette { width: min(620px, 92vw); display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; background: var(--surface); box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--sep-strong); }
.chat-palette-input { display: flex; align-items: center; gap: 9px; padding: 12px 14px; box-shadow: inset 0 -1px 0 var(--sep); }
.chat-palette-input input { flex: 1; border: 0; outline: none; background: none; font: inherit; font-size: 14px; color: var(--text); }
.chat-palette-list { max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; }
.chat-palette-list button {
  display: flex; align-items: center; gap: 9px; padding: 8px 14px; border: 0; cursor: pointer;
  font: inherit; font-size: 12px; text-align: left; color: var(--text); background: transparent;
}
.chat-palette-list button[aria-current="true"] { background: var(--accent-fill); }
.chat-palette-list button .text-muted { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.chat-palette-foot { padding: 8px 14px; font-size: 10.5px; box-shadow: inset 0 1px 0 var(--sep); }

/* The operator uses this from a phone through the tunnel: the rail becomes a
   sheet under the conversation rather than a squeezed column beside it. */
@media (max-width: 900px) {
  .chat-grid { grid-template-columns: 1fr; height: auto; }
  .chat-main { min-height: 70vh; }
  .chat-side { max-height: none; }
  .bubble-mine, .bubble-theirs { max-width: 94%; }
}

/* ── icons ────────────────────────────────────────────────────────────── */
/* Icon glyphs must be inline-block: CSS transforms don't apply to plain
   inline boxes, which is what froze every `animation:spin` loader. */
.ph, .ph-fill { display: inline-block; }

/* ── conversation (Jarvis) ────────────────────────────────────────────── */
/* New messages grow in from their own corner, once — ids already on screen
   never replay on re-render. 280ms strong ease-out (emil: under 300ms). */
.msg-mine { transform-origin: bottom right; }
.msg-theirs { transform-origin: bottom left; }
.msg-in { transition: opacity 280ms var(--ease-out), transform 280ms var(--ease-out); }
@starting-style {
  .msg-in { opacity: 0; transform: translateY(8px) scale(0.98); }
}

/* iMessage-style typing bubble with a live label of what Jarvis is doing. */
.typing-bubble {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 16px; border-bottom-left-radius: 4px;
  background: rgba(255, 255, 255, 0.045); box-shadow: 0 0 0 1px var(--sep);
}
.typing-dots { display: inline-flex; align-items: center; gap: 4px; }
.typing-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-2);
  animation: typingDot 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0.32s; }
.typing-label { font-size: 12.5px; color: var(--text-2); }

.brain-status-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); white-space: nowrap; }
.brain-status-chip i { color: var(--accent); }

.brain-mic {
  flex: none; width: 44px; height: 44px; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; color: #fff; background: var(--accent-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 0 14px color-mix(in srgb, var(--accent) 30%, transparent);
}
.brain-mic.is-recording { background: #e5484d; box-shadow: 0 0 0 4px color-mix(in srgb, var(--red) 25%, transparent); }
.brain-mic:disabled { cursor: default; }
.brain-send { flex: none; width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.brain-send[aria-busy="true"] { opacity: 1; }

/* Skeleton while the conversation loads — shape first, content second. */
.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.09) 50%, rgba(255, 255, 255, 0.04) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 16px;
}

/* ── loops ────────────────────────────────────────────────────────────── */
/* #app is rebuilt on every telemetry tick; glass.js re-syncs these loops to
   the document clock after each rebuild so spinners never visibly restart. */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spinRev { to { transform: rotate(-360deg); } }
@keyframes coreGlow { 0%, 100% { opacity: 0.6; transform: scale(0.98); } 50% { opacity: 0.95; transform: scale(1.02); } }
@keyframes sweep { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes bar { 0%, 100% { transform: scaleY(0.18); } 50% { transform: scaleY(1); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes typingDot { 0%, 60%, 100% { opacity: 0.28; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ── accessibility ────────────────────────────────────────────────────── */
/* Reduced motion = gentler, not zero: keep fades, drop movement. */

@media (prefers-reduced-motion: reduce) {
  button:active:not(:disabled), .btn:active:not(:disabled), [role="button"]:active { transform: none; }
  .is-opening .modal, .is-opening .dialog { transition: opacity var(--dur-ui) ease; }
  @starting-style { .is-opening .modal, .is-opening .dialog { transform: none; } }
  .toast { transition: opacity var(--dur-ui) ease; }
  @starting-style { .toast { transform: none; } }
  .msg-in { transition: opacity var(--dur-ui) ease; }
  @starting-style { .msg-in { transform: none; } }
  .typing-dots span { animation-name: blink; }
  .skeleton { animation: none; }
  [style*="animation:coreGlow"], [style*="animation:bar"], [style*="animation:sweep"] { animation: none !important; }
}

@media (prefers-reduced-transparency: reduce) {
  .glass, .glass-lens, .glass-thick {
    background: #1f1f23 !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

@media (prefers-contrast: more) {
  :root { --sep: rgba(255, 255, 255, 0.28); --text-2: rgba(235, 235, 245, 0.85); --text-3: rgba(235, 235, 245, 0.65); }
  .glass, .glass-thick { background: #1c1c1e !important; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45) !important; }
}

/* ── responsive ───────────────────────────────────────────────────────── */
/* The sidebar folds to an icon rail on narrow windows — and earlier, when
   the docked chat is taking 360px of the width. */

@media (max-width: 900px) {
  .sidebar { width: 60px; padding-inline: 6px; }
  .sidebar .brand-text, .sidebar .nav-group-title, .sidebar .nav-item > span, .sidebar .nav-item .tag, .sidebar .nav-caret, .sidebar .nav-subs, .sidebar .backend-status span:not(.dot) { display: none; }
  .sidebar .brand { justify-content: center; padding-inline: 0; }
  .sidebar .nav-item { justify-content: center; padding: 0; }
  .sidebar .backend-status { justify-content: center; }
  .clock { display: none; }
}

/* Phone: the chat keeps the whole screen; the rail is already stacked under it. */
@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; row-gap: 6px; }
  .pill .pill-label, .pill .kbd { display: none; }
  .composer-agents { display: none; }
}

/* The Jarvis screen stacks its settings column under the conversation when
   its own width runs out (container query — it depends on the space left
   by the sidebar and chat, not on the window). */
.content { container-type: inline-size; }
/* Call mode (business.js bizCallModeShell) — the only thing on screen while calling. */
.call-mode { height: 100vh; overflow: auto; display: flex; flex-direction: column; color: var(--text); font-family: var(--font); font-size: 13px; background: var(--bg, #111114); container-type: inline-size; }
.call-mode-top { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; padding: 12px 20px; background: color-mix(in srgb, var(--bg, #111114) 88%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: inset 0 -1px 0 var(--sep); }
.call-mode-body { display: grid; grid-template-columns: 300px minmax(0, 1fr); align-items: start; gap: 0; }
.call-mode-body.no-list { grid-template-columns: minmax(0, 1fr); }
.call-mode-inner { width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* The checklist rail — sticks beside the lead you are on and scrolls on its own. */
.call-check { position: sticky; top: 52px; align-self: start; max-height: calc(100vh - 56px); display: flex; flex-direction: column; min-height: 0; background: var(--card); box-shadow: inset -1px 0 0 var(--sep); }
.call-check-head { display: flex; align-items: center; gap: 8px; padding: 12px 10px 8px; }
.call-check-list { flex: 1; min-height: 0; overflow: auto; padding: 0 6px 16px; display: flex; flex-direction: column; gap: 1px; }
.call-check-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; border-radius: 9px; font: inherit; color: inherit; text-align: left; cursor: pointer; background: transparent; }
.call-check-row.is-current { background: var(--accent-card); box-shadow: inset 0 0 0 1px var(--accent-sep); }
.call-check-row.is-done { opacity: .62; }
@media (hover: hover) and (pointer: fine) {
  .call-check-row:not(.is-current):hover { background: var(--fill); }
}
.call-check-sub { display: flex; align-items: center; gap: 6px; width: 100%; margin-top: 10px; padding: 6px 8px; border: 0; border-radius: 8px; font: inherit; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); cursor: pointer; background: transparent; }
.call-mode-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); gap: 16px; align-items: start; }
.call-mode-grid.no-script { grid-template-columns: minmax(0, 720px); justify-content: center; }
.call-mode-outcomes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.call-mode-outcome { justify-content: center; gap: 8px; padding: 12px 10px; font-size: 14px; white-space: nowrap; color: var(--tone); background: color-mix(in srgb, var(--tone) 12%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tone) 32%, transparent); }
.call-mode-outcome .kbd { opacity: .7; }
@media (hover: hover) and (pointer: fine) {
  .call-mode-outcome:hover:not(:disabled) { background: color-mix(in srgb, var(--tone) 22%, transparent); }
}
@container (max-width: 860px) {
  .call-mode-grid { grid-template-columns: minmax(0, 1fr); }
}
@container (max-width: 1040px) {
  /* Not enough width for a rail: the checklist becomes a band above the lead. */
  .call-mode-body { grid-template-columns: minmax(0, 1fr); }
  .call-check { position: static; max-height: 320px; box-shadow: inset 0 -1px 0 var(--sep); }
}

@container (max-width: 900px) {
  .biz-call-grid { grid-template-columns: minmax(0, 1fr) !important; }
}
@container (max-width: 640px) {
  .brain-grid { grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: minmax(0, 1fr) minmax(0, 40%); }
  .brain-grid > :last-child { overflow: auto; min-height: 0; }
}
