/* ============================================================================
   APEX MOBILE - "MERIDIAN"
   ----------------------------------------------------------------------------
   A navigation chart at night (2026-08-08). Carbon-black field, pure white
   ink, ONE red signal point. The canvas is a technical surface: a halftone
   dot field and hairline routes carry the space; monospaced small-cap
   coordinates float over it; content lives on floating rounded slabs with
   large soft corners and enormous negative space. Primary actions are white
   pills (ink inverted); red is reserved for what is ALIVE or WRONG - a
   running turn, an alert, the one signal lamp. Nothing decorates that does
   not also inform. Two themes: Meridian (default, carbon) and Dawn
   ('aether', paper chart - same geometry, ink flipped).

   CONTRACT PINS (guarded by scripts/check-mobile-*.mjs - do not "clean up"):
   - html/body height ladders: -webkit-fill-available BEFORE 100dvh, and the
     @supports fill-available block gated on (not (height: 100dvh)).
   - `.body {` is THE screen scroller: flex:1 + min-height:0 + overflow-y:auto
     + -webkit-overflow-scrolling:touch, in one rule.
   - `.deck-dock { position: fixed;` stays fixed.
   - aether: :root[data-theme='aether'] block, --bg-canvas: #F4EFE9;,
     [data-theme='aether'] body::before layer + reduced-motion opt-out.
   - .msg-att / .msg-att-vid / .lightbox-media sizing, .app-error-* anatomy,
     .bubble.no-reply, .theme-pick, .tp-tile.on, .register grouping.
   - The P3 LIQUID GLASS STATUS block at the end of this file is preserved
     verbatim (phase semantics mirror the desktop motion system).
   ========================================================================== */

/* == 1. TOKENS - MERIDIAN (default: the chart at night) =================== */
:root {
  /* Field ladder - neutral carbon. No warm cast, no mid-grey mud. */
  --bg-well: #000000;      /* true ground behind everything */
  --bg-canvas: #0A0A0B;    /* the field (pinned via theme system) */
  --bg-surface: #121214;   /* P2 raised: composer, cards, tool wells */
  --bg-raised: #19191C;    /* hover, inset wells */
  --bg-high: #1F1F23;      /* strongest surface; above this = borders only */

  /* Ink - pure white ladder */
  --tx: #F5F5F3;
  --tx-2: #A3A3A0;
  --tx-3: #6D6D6B;
  --tx-4: #48484A;

  /* Hairlines - the route layer */
  --line: rgba(245, 245, 243, 0.08);
  --line-strong: rgba(245, 245, 243, 0.16);

  /* THE signal. One red. Alive or wrong; never furniture. */
  --accent: #FF453A;
  --accent-2: #C93B31;
  --accent-hi: #FF6B61;
  --accent-soft: rgba(255, 69, 58, 0.13);
  --accent-ink: #FFFFFF;
  --ember-glow: rgba(255, 69, 58, 0.30);    /* focus / live bloom */
  --ember-wash: rgba(245, 245, 243, 0.03);  /* the ONE ambient wash (composer) */

  /* Inverted CTA - primary actions are white pills, black ink. */
  --cta: #F5F5F3;
  --cta-hi: #FFFFFF;
  --cta-ink: #0A0A0B;

  /* Halftone field - the dot lattice under the void. Static, zero runtime. */
  --grain: radial-gradient(rgba(245, 245, 243, 0.05) 1px, transparent 1px);

  /* Signal - meaning only, never decoration */
  --ok: #62BD87;
  --ok-soft: rgba(98, 189, 135, 0.13);
  --warn: #D8A320;
  --warn-soft: rgba(216, 163, 32, 0.13);
  --danger: #FF453A;
  --danger-soft: rgba(255, 69, 58, 0.13);
  --info: #7A9BB4;
  --info-soft: rgba(122, 155, 180, 0.13);

  /* Material. Flat slabs + hairline rims. Zero chrome: no sheens, no facets.
     Only true floats (P3) blur + shadow. */
  --glass: rgba(10, 10, 11, 0.93);            /* chrome bars: near-opaque carbon */
  --glass-heavy: rgba(18, 18, 20, 0.92);      /* P3 float body: sheets, drawer */
  --glass-blur: 22px;
  --glass-card-blur: 12px;
  --glass-fill: #121214;                       /* flat P2 fill (paired token) */
  --glass-fill-2: #121214;
  --glass-rim: rgba(245, 245, 243, 0.08);      /* default hairline */
  --glass-rim-strong: rgba(245, 245, 243, 0.16);
  --glass-hi: transparent;                     /* zero chrome: no specular */
  --glass-sheen: transparent;
  --glass-inner: inset 0 0 0 0 transparent;    /* zero chrome: no lit facet */
  --edge-ink: rgba(0, 0, 0, 0.30);

  /* Elevation - shadow ONLY on things genuinely above other content. */
  --sh-card: 0 1px 2px rgba(0, 0, 0, 0.45), 0 10px 28px -14px rgba(0, 0, 0, 0.75);
  --sh-float: 0 2px 8px rgba(0, 0, 0, 0.55), 0 28px 64px -22px rgba(0, 0, 0, 0.90);
  --sh-soft: 0 1px 2px rgba(0, 0, 0, 0.40);
  --sh-lift: 0 2px 8px rgba(0, 0, 0, 0.50), 0 22px 56px -20px rgba(0, 0, 0, 0.65);
  --sh-1: var(--sh-card);
  --sh-2: var(--sh-float);
  --sh-dock: 0 2px 8px rgba(0, 0, 0, 0.55), 0 20px 52px -18px rgba(0, 0, 0, 0.85);
  --glow-accent: 0 4px 18px -8px rgba(255, 69, 58, 0.55);
  --ring-track: #232327;                       /* meter track (border band) */
  --track: #232327;

  /* Geometry - large soft corners; interactive = full pill */
  --r-xs: 10px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 20px;
  --r-xl: 24px;
  --r-2xl: 28px;
  --r-full: 999px;

  /* Type - native optical stack (pinned). Coordinates are mono small-caps. */
  --f-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
  --f-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  --f-mono: ui-monospace, 'SFMono-Regular', 'SF Mono', Menlo, Consolas, monospace;
  --f-serif: ui-serif, 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --track-caps: 0.14em;                        /* micro-label letterspacing */

  /* Safe areas */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);

  /* Motion - decisive start, long settle. Spring only for send + sheets. */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-nav: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur: 240ms;

  /* Legacy aliases - app.js emits inline SVG/styles against these names. */
  --clay: var(--accent);
  --clay-ink: var(--accent-ink);
  --accent-rgb: 255, 69, 58;
  --border: var(--line-strong);
  --text: var(--tx);
  --text-dim: var(--tx-2);
  --text-faint: var(--tx-4);
  --online: var(--ok);
  --success: var(--ok);
  --ctx-ok: var(--tx-2);
  --ctx-warn: var(--warn);
  --ctx-danger: var(--danger);
  --tx-1: var(--tx);
}

/* == 1b. TOKENS - DAWN ('aether': the paper chart) ======================== */
:root[data-theme='aether'] {
  --bg-well: #E9E3D8;
  --bg-canvas: #F4EFE9;
  --bg-surface: #FCF9F4;
  --bg-raised: #EDE7DB;
  --bg-high: #E5DED1;

  --tx: #17171A;
  --tx-2: #55554F;
  --tx-3: #7B7B74;
  --tx-4: #9C9C93;

  --line: rgba(23, 23, 26, 0.10);
  --line-strong: rgba(23, 23, 26, 0.19);

  /* The red deepened for daylight legibility. */
  --accent: #D92D20;
  --accent-2: #A8271D;
  --accent-hi: #E5483C;
  --accent-soft: rgba(217, 45, 32, 0.10);
  --accent-ink: #FFFFFF;
  --ember-glow: rgba(217, 45, 32, 0.22);
  --ember-wash: rgba(23, 23, 26, 0.025);

  /* Inverted CTA on paper: carbon pill, paper ink. */
  --cta: #17171A;
  --cta-hi: #000000;
  --cta-ink: #F5F5F3;

  --grain: radial-gradient(rgba(23, 23, 26, 0.055) 1px, transparent 1px);

  --ok: #2E7D4F;
  --ok-soft: rgba(46, 125, 79, 0.12);
  --warn: #8A6A10;
  --warn-soft: rgba(138, 106, 16, 0.13);
  --danger: #C62B1F;
  --danger-soft: rgba(198, 43, 31, 0.11);
  --info: #52708A;
  --info-soft: rgba(82, 112, 138, 0.12);

  --glass: rgba(252, 249, 244, 0.95);
  --glass-heavy: rgba(252, 249, 244, 0.94);
  --glass-fill: #FCF9F4;
  --glass-fill-2: #FCF9F4;
  --glass-rim: rgba(23, 23, 26, 0.10);
  --glass-rim-strong: rgba(23, 23, 26, 0.19);
  --glass-hi: transparent;
  --glass-sheen: transparent;
  --glass-inner: inset 0 0 0 0 transparent;
  --edge-ink: rgba(40, 40, 46, 0.10);

  --sh-card: 0 1px 2px rgba(40, 40, 46, 0.06), 0 10px 28px -14px rgba(40, 40, 46, 0.16);
  --sh-float: 0 2px 8px rgba(40, 40, 46, 0.08), 0 28px 64px -22px rgba(40, 40, 46, 0.26);
  --sh-soft: 0 1px 2px rgba(40, 40, 46, 0.08);
  --sh-lift: 0 2px 8px rgba(40, 40, 46, 0.08), 0 22px 56px -20px rgba(40, 40, 46, 0.16);
  --sh-dock: 0 2px 8px rgba(40, 40, 46, 0.10), 0 20px 52px -18px rgba(40, 40, 46, 0.24);
  --glow-accent: 0 4px 18px -8px rgba(217, 45, 32, 0.38);
  --ring-track: #D8D2C4;
  --track: #D8D2C4;

  --accent-rgb: 217, 45, 32;

  /* The liquid status object reads material tones per theme (outside the
     pinned phase block, look-only). */
  --lg-surface: #FFFFFF;
  --lg-depth: #C6C0B2;
}

/* == 2. RESET + HEIGHT LADDER (pinned) ==================================== */
*, *::before, *::after { box-sizing: border-box; }
* { -webkit-tap-highlight-color: transparent; }

html {
  height: -webkit-fill-available;
  height: 100dvh;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  height: -webkit-fill-available;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg-canvas);
  color: var(--tx);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
}

/* Older iOS only (no dvh): fall back to fill-available. Gated so it can never
   override the dvh ladder on modern Safari. */
@supports (-webkit-touch-callout: none) and (not (height: 100dvh)) {
  html, body { height: -webkit-fill-available; }
}

/* == 3. THE FIELD =========================================================
   The canvas is a chart, not paint: a static halftone dot lattice fades in
   from the top of the field (dense at the horizon, dissolving by mid-screen),
   and a second, finer registration layer prints one hairline rule under the
   status region. STATIC on purpose - zero per-frame cost. Red never appears
   here; the field is monochrome so the one signal can matter. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: var(--grain);
  background-size: 20px 20px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.55) 26%, rgba(0, 0, 0, 0.14) 52%, rgba(0, 0, 0, 0.10));
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.55) 26%, rgba(0, 0, 0, 0.14) 52%, rgba(0, 0, 0, 0.10));
}

/* Dawn: the same lattice printed in ink-on-paper; STATIC (animation: none; -
   never a drifting aurora). The paper itself is the light. */
[data-theme='aether'] body::before {
  animation: none;
  background-image: var(--grain);
  background-size: 20px 20px;
}

button, input, textarea, select {
  font-family: inherit;
  color: inherit;
}
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent-hi); text-decoration: none; }
img, video { max-width: 100%; }
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 0; height: 0; }

button, [role='button'] { touch-action: manipulation; }
input, textarea, select { font-size: 16px; } /* stops iOS input auto-zoom */

/* Screen-reader live region for motion phases: visually hidden, announced. */
.motion-live-region {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* == 4. APP FRAME + SCREEN HEIGHT MODEL =================================== */
.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 1;
}

/* Every mounted screen is a REAL bounded flex column. Never rely on
   display:contents wrappers - they break the iOS flex height chain. */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: transparent;
  animation: screen-in 300ms var(--ease-out) both;
}
.screen.is-sub { animation: screen-sub-in 280ms var(--ease-out) both; }
@keyframes screen-in {
  from { opacity: 0; transform: translate3d(0, 5px, 0); }
  to { opacity: 1; transform: none; }
}
@keyframes screen-sub-in {
  from { opacity: 0.35; transform: translate3d(16px, 0, 0); }
  to { opacity: 1; transform: none; }
}

/* NAV TRAVEL - screens push and pop like native planes, they never just swap.
   Push: the session slides in from the right carrying an edge shadow while the
   list parallaxes left behind a dim. Pop reverses both planes. Transform and
   opacity only; classes are applied by mount() for REAL navigation and removed
   on animation end, so fixed chrome re-anchors to the viewport at rest. */
.screen.nav-push {
  animation: nav-push-in 380ms var(--ease) both;
  box-shadow: -20px 0 52px rgba(0, 0, 0, 0.42);
}
.screen.nav-pop { animation: nav-pop-in 360ms var(--ease) both; }
.screen.nav-exit { pointer-events: none; }
.screen.nav-exit-left { animation: nav-exit-left 380ms var(--ease) both; }
.screen.nav-exit-right {
  animation: nav-exit-right 360ms var(--ease) both;
  box-shadow: -20px 0 52px rgba(0, 0, 0, 0.42);
  z-index: 2;
}
/* The plane sitting on the LEFT is under a dim that tracks the travel. */
.screen.nav-exit-left::after,
.screen.nav-pop::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 99;
  pointer-events: none;
  background: #000;
}
.screen.nav-exit-left::after { animation: nav-dim 380ms var(--ease) both; }
.screen.nav-pop::after { animation: nav-undim 360ms var(--ease) both; }
@keyframes nav-push-in { from { transform: translate3d(100%, 0, 0); } to { transform: translate3d(0, 0, 0); } }
@keyframes nav-exit-left { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(-24%, 0, 0); } }
@keyframes nav-pop-in { from { transform: translate3d(-24%, 0, 0); } to { transform: translate3d(0, 0, 0); } }
@keyframes nav-exit-right { from { transform: translate3d(0, 0, 0); } to { transform: translate3d(102%, 0, 0); } }
@keyframes nav-dim { from { opacity: 0; } to { opacity: 0.24; } }
@keyframes nav-undim { from { opacity: 0.24; } to { opacity: 0; } }

/* THE scroller (contract rule - home-scroll guard reads this block). */
.body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  position: relative;
}

html, body, .screen, .body { max-width: 100%; overflow-x: hidden; }

/* == 5. BOOT ============================================================== */
.boot {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-canvas);
}

/* == 6. SHARED PRIMITIVES ================================================= */
/* Circular icon button - the chrome verb everywhere (>= 44px). MERIDIAN
   chrome is drawn, not filled: a hairline ring on the bare field. */
.bar-orb {
  position: relative;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--r-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--tx-2);
  background: transparent;
  border: 1px solid var(--line-strong);
  transition: transform 160ms var(--ease), background-color 160ms var(--ease), color 160ms var(--ease);
}
.bar-orb:active { transform: scale(0.92); color: var(--tx); background: var(--bg-raised); }

.mono { font-family: var(--f-mono); }
.dim { color: var(--tx-3); }
.danger { color: var(--danger); }
.wide { width: 100%; }
.big { font-size: 20px; color: var(--tx-3); }
.icon { display: flex; }

.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Placeholder material: STATIC (no skeleton shimmer - motion is a readout,
   and a placeholder is not a process). The dot field carries the texture. */
.shimmer { background: var(--bg-raised); }

/* Skeletons - static flat blocks separated by hairlines. */
.skel-anim { display: flex; flex-direction: column; gap: 0; padding: 8px 0; }
.skel {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.skel .sq {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-raised);
}
.skel .ln { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skel .b {
  height: 10px;
  border-radius: 5px;
  background: var(--bg-raised);
}
.skel .b.s { width: 55%; }

/* Generic empty states (thread + files) */
.empty { text-align: center; color: var(--tx-3); }
.empty .t { font-family: var(--f-sans); font-size: 16px; font-weight: 600; color: var(--tx); letter-spacing: -0.01em; }
.empty .s { font-size: 13.5px; color: var(--tx-3); margin-top: 6px; line-height: 1.55; }

/* Primary pill - INVERTED INK. The strongest object on any screen is a white
   pill with black text (carbon on paper in Dawn). Red never fills a button. */
.btn-primary {
  height: 54px;
  border-radius: var(--r-full);
  background: var(--cta);
  color: var(--cta-ink);
  font-family: var(--f-sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--sh-soft);
  transition: transform 160ms var(--ease), background-color 160ms var(--ease), opacity 160ms var(--ease);
}
.btn-primary:active { transform: scale(0.97); background: var(--cta-hi); }
.btn-primary[disabled] { opacity: 0.5; box-shadow: none; }
.btn-ghost {
  height: 44px;
  padding: 0 20px;
  border-radius: var(--r-full);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--tx-2);
  font-family: var(--f-sans);
  font-size: 14px;
  font-weight: 500;
}
.btn-spin {
  width: 18px;
  height: 18px;
  border-radius: var(--r-full);
  border: 2px solid rgba(0, 0, 0, 0.18);
  border-top-color: var(--cta-ink);
  animation: spin 0.8s linear infinite;
}

/* Coordinate label - mono micro: 10px, +0.14em tracking, uppercase, muted.
   The chart's printed registration text; type carries the structure. */
.opt-label, .deck-label, .cst-label, .grok-sec-tag {
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--tx-3);
}

/* Presence pill (login foot + sub-screen headers) - drawn, not filled. */
.conn-pill, .login-presence {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--tx-3);
  font-size: 11px;
  font-family: var(--f-mono);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.conn-pill .dot, .login-presence .dot {
  width: 6px; height: 6px; min-width: 6px;
  border-radius: var(--r-full);
  background: var(--tx-4);
}
.conn-pill.online .dot, .login-presence.online .dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.conn-pill.online, .login-presence.online { color: var(--tx-2); }
.conn-pill.connecting .dot { background: var(--warn); }

/* == 7. LOGIN =============================================================
   The chart cover: wordmark alone in the void over the dot horizon, a single
   bordered panel (Reference-B anatomy) holding the fields, one white pill. */
.login {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 32px;
  padding: calc(var(--safe-t) + 32px) 24px calc(var(--safe-b) + 28px);
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
}
.login-brand { text-align: center; display: flex; flex-direction: column; align-items: center; }
.login-brand h1 {
  margin: 20px 0 10px;
  font-family: var(--f-sans);
  font-size: 44px;
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1;
}
.login-brand p {
  margin: 0;
  color: var(--tx-3);
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
}

.login-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  box-shadow: var(--sh-card);
  padding: 24px 20px 20px;
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field label {
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--tx-3);
  padding-left: 16px;
}
.field input, .field textarea {
  min-height: 52px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-canvas);
  padding: 12px 16px;
  font-size: 16px; /* 16px stops iOS input auto-zoom - zoom itself stays enabled */
  color: var(--tx);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.field textarea { border-radius: var(--r-md); }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--tx-3);
  box-shadow: 0 0 0 3px rgba(245, 245, 243, 0.07);
}
.field input[aria-invalid='true'] { border-color: var(--danger); }

.login-err {
  min-height: 20px;
  color: var(--danger);
  font-size: 13.5px;
  text-align: center;
}
.login-foot { display: flex; justify-content: center; }

.field-pass { position: relative; display: flex; }
.field-pass input { flex: 1; width: 100%; padding-right: 54px; }
.pass-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tx-4);
  transition: color 140ms var(--ease), background-color 140ms var(--ease);
}
.pass-eye:active { background: var(--bg-raised); }
.pass-eye.on { color: var(--tx); }

/* == 8. HOME ==============================================================
   The deck: enormous air up top (topbar ghosts + a big sans headline over the
   dot horizon), then the sessions on FLOATING SLABS - rounded bordered sheets
   that hold rows (strong title / quiet meta), Reference-A anatomy. The one
   verb is a white disc floating bottom-right. Red appears only where
   something is alive: the working rail, the unread point, the now-marker. */
.deck-body {
  padding: calc(var(--safe-t) + 12px) 0 calc(var(--safe-b) + 104px);
}
.deck-topbar, .now-inbox, .deck-empty { margin-left: 20px; margin-right: 20px; }
.ask-band { margin: 0 16px 4px; }

/* Topbar: bare glyphs floating over the field (44px targets intact). */
.deck-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0 0;
  min-height: 52px;
}
.deck-topbar .bar-orb {
  background: none;
  border-color: transparent;
  box-shadow: none;
}
.deck-topbar .bar-orb:active { background: var(--bg-surface); }
/* Without the circle the presence dot hugs the glyph, not the ghost bounds. */
.deck-topbar .desk-dot { top: 7px; right: 7px; }
.deck-brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.deck-mark { display: flex; }
.deck-mark svg { width: 20px; height: 20px; }
.deck-word {
  font-family: var(--f-sans);
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.deck-menu-btn { overflow: visible; }
.desk-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  border-radius: var(--r-full);
  background: var(--ok);
  border: 2px solid var(--bg-canvas);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 200ms var(--ease), transform 200ms var(--ease-pop), background-color 200ms var(--ease);
}
.desk-dot.off { opacity: 0; }
.desk-dot.online { opacity: 1; transform: scale(1); background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.desk-dot.connecting { opacity: 1; transform: scale(1); background: var(--warn); }

/* Hero: one big sans line in the void - display weight, tight tracking, over
   the dot horizon. A mono coordinate eyebrow above it carries the ONE red
   point on a resting screen (the now-marker); presence prints below. */
.now-inbox {
  margin-top: 48px;
  margin-bottom: 44px;
  padding: 0 4px;
}
/* The lens column exists only while the fleet is live; at rest the headline
   sits alone in air (block layout, no reserved slot). */
.now-inbox.has-lens {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px;
  gap: 16px;
  align-items: start;
}
.now-inbox > .liquid-glass-status-hero { order: 2; margin-top: 8px; }
.now-copy { min-width: 0; order: 1; }
.now-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--tx-3);
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
}
.now-kicker::before {
  content: '';
  width: 5px;
  height: 5px;
  min-width: 5px;
  border-radius: var(--r-full);
  background: var(--accent);
}
.now-copy h1 {
  margin: 0;
  color: var(--tx);
  font-family: var(--f-sans);
  font-size: 31px;
  line-height: 36px;
  font-weight: 650;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.now-summary {
  margin: 10px 0 0;
  color: var(--tx-2);
  font-size: 14.5px;
  line-height: 1.5;
  max-width: 300px;
}
.now-presence {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 20px;
  margin-top: 16px;
}
.hdr-large-sub {
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--tx-3);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
}
.sub-dot { width: 6px; height: 6px; min-width: 6px; border-radius: var(--r-full); background: var(--tx-4); }
.hdr-large-sub.live { color: var(--tx-2); }
.hdr-large-sub.live .sub-dot { background: var(--ok); box-shadow: 0 0 7px var(--ok); }
.hdr-large-sub.connecting { color: var(--warn); }
.hdr-large-sub.connecting .sub-dot { background: var(--warn); }
.hdr-large-sub.off .sub-dot { background: var(--tx-4); }
.hdr-large-sub.ok { color: var(--tx-3); }
.hdr-large-sub.warn { color: var(--warn); }

/* Session groups: a mono coordinate label with a hairline route running to
   the right edge, then one floating slab per group. */
.deck-groups { display: flex; flex-direction: column; gap: 0; margin-top: 0; }
.deck-label { padding: 0 24px 10px; margin-top: 36px; display: flex; align-items: center; gap: 10px; }
.deck-label::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.deck-groups > .deck-label:first-child { margin-top: 0; }
/* An unlabeled register following another register still gets group air. */
.deck-groups > .register + .register { margin-top: 36px; }

/* The slab (contract: .register groups rows, overflow hidden). A bordered
   rounded sheet floating on the field - Reference A's bottom card, made the
   list's whole material. */
.register {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  margin: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-2xl);
  background: var(--bg-surface);
  box-shadow: var(--sh-card);
}
.register .row { border-bottom: 1px solid var(--line); }
.register .row:last-child { border-bottom: 0; }

/* One row = a strong title over ONE quiet secondary line. Nothing else at
   rest: no orb, no gauge, no chevron. The raised voice belongs to WORKING
   rows alone: the liquid state object, the live tool line, a 2px red rail.
   Unread is one red point. That restraint is the whole state system. */
.row {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 74px;
  text-align: left;
  padding: 15px 18px;
  background: transparent;
  transition: background-color 150ms var(--ease);
  position: relative;
}
.row:active { background: var(--bg-raised); }
.row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: transparent;
}
.row[data-state='working']::before { background: var(--accent); }
.row > .liquid-glass-status { flex: none; }
.row-main { flex: 1; min-width: 0; }
.row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.row-title {
  font-family: var(--f-sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  color: var(--tx);
}
.row-ws { margin-top: 2px; font-size: 10.5px; color: var(--tx-4); font-family: var(--f-mono); letter-spacing: 0.04em; }
.row-sub {
  display: block;
  margin-top: 5px;
  font-family: var(--f-body);
  font-size: 13px;
  letter-spacing: 0;
  color: var(--tx-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-sub.mono {
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.01em;
}
.row[data-state='working'] .row-sub { color: var(--accent-hi); }
.row .unread {
  width: 8px; height: 8px; min-width: 8px;
  border-radius: var(--r-full);
  background: var(--accent);
}

/* Needs-you: a floating slab staged by a 2px warn rail. Still, not pulsing:
   stillness demands attention. */
.ask-band {
  width: auto;
  text-align: left;
  border: 1px solid var(--line);
  border-left: 2px solid var(--warn);
  border-radius: var(--r-xl);
  background: var(--bg-surface);
  box-shadow: var(--sh-card);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: background-color 150ms var(--ease);
}
.ask-band:active { background: var(--bg-raised); }
.ask-band-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--warn);
}
.ask-band-meta .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.ask-band-model { color: var(--tx-4); }
.ask-band-wait { color: var(--warn); }
.ask-band-q {
  font-family: var(--f-sans);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--tx);
}
.ask-band-prev { font-size: 13px; color: var(--tx-3); }
.ask-band-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.band-btn {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: var(--r-full);
  background: transparent;
  border: 1px solid var(--line-strong);
  font-family: var(--f-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--tx);
  transition: transform 140ms var(--ease);
}
.band-btn:active { transform: scale(0.95); }
.band-btn.primary {
  background: var(--cta);
  border-color: transparent;
  color: var(--cta-ink);
  font-weight: 600;
}

/* Empty desk - genuinely empty: the hero greets, the disc holds the one verb,
   and the void holds a single quiet sentence over the dots. Nothing else. */
.deck-empty { text-align: center; padding: 96px 4px 10px; }
.deck-empty-sub {
  font-size: 14px;
  line-height: 1.6;
  color: var(--tx-3);
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}

/* Collapsed mini-header once the hero scrolls away. Opaque carbon chrome. */
.deck-smallbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  background: var(--glass);
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}
.deck-smallbar.on, .deck-smallbar.show { opacity: 1; transform: none; pointer-events: auto; }
.deck-smallbar-mark { display: flex; }
.deck-smallbar-mark svg { width: 17px; height: 17px; }
.deck-smallbar-title { font-family: var(--f-sans); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

/* Dock: ONE 58px WHITE disc in the thumb zone - inverted ink, the screen's
   one verb. It genuinely floats, so it alone earns the deep shadow.
   (Contract: fixed.) */
.deck-dock { position: fixed;
  left: auto;
  right: 18px;
  bottom: calc(var(--safe-b) + 18px);
  z-index: 14;
  width: 58px;
  height: 58px;
  border-radius: var(--r-full);
  overflow: hidden;
}
.dock-new {
  width: 58px;
  height: 58px;
  min-width: 58px;
  min-height: 58px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cta);
  color: var(--cta-ink);
  box-shadow: var(--sh-dock);
  transition: transform 150ms var(--ease), background-color 150ms var(--ease);
}
.dock-new:active { transform: scale(0.92); background: var(--cta-hi); }
.dock-new svg { width: 22px; height: 22px; }
.deck-topbar-spacer { width: 44px; min-width: 44px; height: 44px; }

/* Pull-to-refresh */
.ptr {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 0;
  overflow: hidden;
  color: var(--tx-3);
  font-size: 13px;
  font-family: var(--f-sans);
  transition: height 180ms var(--ease);
}
.ptr.show { height: 44px; }

/* Home entrance stagger (navigation only, never live updates; capped at 6 -
   past 6 it reads as loading, not craft). */
.stagger > * { animation: rise-in 160ms var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 24ms; }
.stagger > *:nth-child(3) { animation-delay: 48ms; }
.stagger > *:nth-child(4) { animation-delay: 72ms; }
.stagger > *:nth-child(5) { animation-delay: 96ms; }
.stagger > *:nth-child(6) { animation-delay: 120ms; }
@keyframes rise-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
/* == 9. DRAWER (Desk) ===================================================== */
.drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(11, 10, 9, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fade-in 240ms var(--ease) both;
  transition: opacity 260ms var(--ease);
}
[data-theme='aether'] .drawer-scrim { background: rgba(60, 44, 30, 0.28); }
.drawer-scrim.out { opacity: 0; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 31;
  width: min(86vw, 356px);
  display: flex;
  flex-direction: column;
  background: var(--glass-heavy);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.1);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.1);
  border-right: 1px solid var(--glass-rim-strong);
  transform: translateX(-104%);
  transition: transform 300ms var(--ease);
  box-shadow: var(--sh-float);
}
.drawer.in { transform: none; }
.drawer-scrim.out .drawer { transform: translateX(-104%); }

.drawer-head {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: calc(var(--safe-t) + 20px) 20px 12px;
}
.drawer-logo { display: flex; }
.drawer-logo svg { width: 44px; height: 44px; border-radius: 14px; box-shadow: var(--sh-soft); }
.drawer-id { min-width: 0; flex: 1; }
.drawer-name {
  font-family: var(--f-sans);
  font-size: 17px;
  font-weight: 550;
  letter-spacing: -0.015em;
}
.drawer-email {
  font-size: 12.5px;
  color: var(--tx-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 22px 6px;
  font-size: 12.5px;
  color: var(--tx-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drawer-status .dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: var(--r-full);
  background: var(--tx-4);
}
.drawer-status.online .dot { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.drawer-large-title {
  font-family: var(--f-sans);
  font-size: 30px;
  font-weight: 550;
  letter-spacing: -0.03em;
  padding: 8px 22px 2px;
}
.drawer-mini-title {
  font-family: var(--f-sans);
  font-size: 11.5px;
  font-weight: 550;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tx-4);
  padding: 18px 22px 6px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms var(--ease), transform 160ms var(--ease);
  pointer-events: none;
}
.drawer.scrolled .drawer-mini-title { opacity: 1; transform: none; }
.drawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--safe-b) + 84px);
}
.drawer-nav { display: flex; flex-direction: column; padding: 2px 14px 8px; }
.focused-nav { padding-top: 12px; gap: 4px; }
.drawer-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  min-height: 54px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  color: var(--tx);
  font-family: var(--f-sans);
  font-size: 15.5px;
  font-weight: 500;
  transition: background-color 140ms var(--ease);
}
.drawer-item:active { background: var(--bg-raised); }
.di-ic {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--tx-2);
}
.di-lbl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.di-go { color: var(--tx-4); display: flex; opacity: 0.7; }
.drawer-ver { font-family: var(--f-mono); font-size: 11px; color: var(--tx-4); padding: 0 22px; }

.drawer-signout {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 10px 20px calc(var(--safe-b) + 12px);
  min-height: 48px;
  border-radius: var(--r-full);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: color-mix(in srgb, var(--danger) 66%, var(--tx-2));
  font-family: var(--f-sans);
  font-size: 14.5px;
  font-weight: 500;
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.drawer-signout:active { background: var(--danger-soft); color: var(--danger); }
.so-ic { display: flex; }

/* == 10. SHEETS - floating glass slabs ==================================== */
.sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(11, 10, 9, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fade-in 220ms var(--ease) both;
}
[data-theme='aether'] .sheet-scrim { background: rgba(60, 44, 30, 0.30); }
/* First rows of a fresh sheet settle in with a 24ms stagger, capped at 6. */
.sheet .drawer-item:nth-child(-n+6) { animation: rise-in 160ms var(--ease) both; }
.sheet .drawer-item:nth-child(2) { animation-delay: 24ms; }
.sheet .drawer-item:nth-child(3) { animation-delay: 48ms; }
.sheet .drawer-item:nth-child(4) { animation-delay: 72ms; }
.sheet .drawer-item:nth-child(5) { animation-delay: 96ms; }
.sheet .drawer-item:nth-child(6) { animation-delay: 120ms; }
.sheet-scrim.leaving { animation: fade-out 200ms var(--ease) both; }
@keyframes fade-out { to { opacity: 0; } }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  background: var(--glass-heavy);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.1);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.1);
  border: 1px solid var(--glass-rim-strong);
  border-bottom: 0;
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  padding-bottom: calc(var(--safe-b) + 14px);
  box-shadow: var(--sh-float);
  animation: sheet-up 420ms var(--ease-spring) both;
  will-change: transform;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}
.sheet.leaving { animation: sheet-down 240ms var(--ease) both; }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-down { from { transform: none; } to { transform: translateY(105%); } }

.sheet > .sheet-handle { align-self: center; flex: none; margin: 11px 0 5px; }
.sheet-grab {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0 4px;
  touch-action: none;
}
.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: var(--r-full);
  background: var(--track);
}
.sheet h2, .sheet h3 {
  font-family: var(--f-sans);
  letter-spacing: -0.01em;
  margin: 8px 22px 4px;
}
.sheet h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; }
.sheet .sub {
  margin: 2px 22px 6px;
  font-size: 13.5px;
  color: var(--tx-3);
  line-height: 1.5;
}
.sheet > .opt-label { margin: 18px 22px 6px; flex: none; }
.sheet > .btn-primary { margin: 14px 18px 4px; flex: none; }
.sheet > .quick-apps { padding: 6px 18px; }
.sheet > .browse-row { padding: 8px 18px 0; }
.sheet-body, .sheet .body { padding: 8px 18px 4px; }
.sheet-actions { display: flex; gap: 10px; padding: 12px 18px 0; }
.sheet-action {
  flex: 1;
  min-height: 50px;
  border-radius: var(--r-full);
  font-family: var(--f-sans);
  font-size: 15px;
  font-weight: 600;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  color: var(--tx);
  transition: transform 150ms var(--ease);
}
.sheet-action:active { transform: scale(0.97); }
.sheet-action.primary {
  background: var(--cta);
  border: 0;
  color: var(--cta-ink);
}
.sheet-action.ghost { background: none; border-color: var(--line); color: var(--tx-2); box-shadow: none; }
.sheet-action.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 34%, var(--glass-rim)); }
.sheet-action[disabled] { opacity: 0.5; }
.sheet > .sheet-action { margin: 8px 18px 0; flex: none; }
.sheet-sep { height: 1px; background: var(--line); margin: 16px 18px 4px; }
.sheet-link-row {
  display: flex; align-items: center; gap: 13px;
  width: auto; margin: 4px 14px; padding: 13px 14px;
  border-radius: var(--r-lg);
  border: 1px solid var(--glass-rim);
  background:
    linear-gradient(180deg, var(--glass-hi), transparent 30%),
    linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner);
  text-align: left; cursor: pointer;
  transition: transform 180ms var(--ease);
}
.sheet-link-row:active { transform: scale(0.98); }
.slr-ic {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none;
  border-radius: var(--r-sm);
  background: var(--bg-high); color: var(--tx-2);
}
.slr-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.slr-title { font-family: var(--f-sans); font-size: 15px; font-weight: 550; color: var(--tx); }
.slr-sub { font-size: 12.5px; color: var(--tx-3); }
.slr-caret { color: var(--tx-4); font-size: 20px; flex: none; }

/* Option pills (models, efforts): glass chips, clay-ringed selection. */
.opts { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 18px 8px; }
.opt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 17px;
  border-radius: var(--r-full);
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--tx-2);
  font-family: var(--f-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 150ms var(--ease), color 150ms var(--ease), transform 150ms var(--ease), box-shadow 150ms var(--ease);
}
.opt:active { transform: scale(0.95); }
.opt.sel {
  border-color: var(--tx);
  color: var(--tx);
  background: var(--bg-raised);
  box-shadow: 0 0 0 1px var(--tx) inset;
}
.opt .sub { font-size: 12px; color: var(--tx-3); font-weight: 450; }
.so-ic { color: var(--tx-3); }
.opt[data-prov='codex'].sel { border-color: #7FA88C; box-shadow: 0 0 0 1px #7FA88C inset; }
.opt[data-prov='xai'].sel { border-color: #B3A79C; box-shadow: 0 0 0 1px #B3A79C inset; }
.opt[data-prov='kimi'].sel { border-color: #6E8CA0; box-shadow: 0 0 0 1px #6E8CA0 inset; }

.model-pick { display: flex; flex-direction: column; gap: 2px; }
.model-search-wrap {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 4px 18px 10px;
  background: linear-gradient(180deg, var(--glass-heavy) 72%, transparent);
}
.model-search {
  width: 100%;
  box-sizing: border-box;
  min-height: 46px;
  padding: 11px 18px;
  border-radius: var(--r-full);
  border: 1px solid var(--line);
  background: var(--bg-surface);
  color: var(--tx);
  font-family: var(--f-sans);
  font-size: 16px; /* stop iOS zoom */
  font-weight: 500;
  outline: none;
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.model-search::placeholder { color: var(--tx-4); font-weight: 450; }
.model-search:focus {
  border-color: var(--tx-3);
  box-shadow: 0 0 0 3px rgba(245, 245, 243, 0.07);
}
.model-empty { padding: 18px 22px 8px; font-size: 13.5px; color: var(--tx-4); font-family: var(--f-sans); }
.model-grp {
  display: flex; align-items: center; gap: 8px;
  padding: 16px 22px 7px;
  font-family: var(--f-sans);
  font-size: 11px;
  font-weight: 550;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--tx-3);
}
.model-grp-dot {
  width: 7px; height: 7px; border-radius: 50%;
  box-shadow: 0 0 8px currentColor;
  flex: none;
}
.model-grp[hidden], .model-pick .opts[hidden], .model-empty[hidden] { display: none !important; }

/* Segmented control */
.sm, .send-mode {
  display: flex;
  flex: 1;
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-full);
  background: color-mix(in srgb, var(--bg-canvas) 72%, transparent);
  border: 1px solid var(--line);
}
.sm-opt, .send-mode > * {
  flex: 1;
  min-height: 36px;
  padding: 8px 6px;
  border-radius: var(--r-full);
  text-align: center;
  font-family: var(--f-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--tx-3);
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.sm-opt.on, .send-mode > .on {
  background: var(--bg-high);
  color: var(--tx);
  box-shadow: var(--sh-soft);
}
.control { display: flex; flex-direction: column; gap: 6px; padding: 8px 18px; }

/* Quick app tiles (New chat sheet) */
.quick-apps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 6px 22px;
}
.quick-app {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-height: 62px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  font-family: var(--f-sans);
  font-size: 14px;
  font-weight: 600;
  color: var(--tx);
  transition: transform 140ms var(--ease);
}
.quick-app:active { transform: scale(0.96); }
.qa-name { color: inherit; }
.qa-sub { font-size: 11px; color: var(--tx-4); font-weight: 500; }

/* Workspace picker bits */
.browse-row { display: flex; align-items: center; gap: 9px; }
.browse-btn {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--r-full);
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--tx-2);
  font-family: var(--f-sans);
  font-size: 13.5px;
  font-weight: 500;
}
.browse-ic { display: flex; color: var(--tx-3); }
.browse-val {
  flex: 1;
  min-width: 0;
  font-family: var(--f-mono);
  font-size: 12.5px;
  color: var(--tx-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}
.browse-go { display: flex; color: var(--tx-4); }
.browse-clear {
  min-height: 44px;
  padding: 9px 16px;
  border-radius: var(--r-full);
  background: none;
  border: 1px solid var(--line);
  color: var(--tx-3);
  font-family: var(--f-sans);
  font-size: 12.5px;
  font-weight: 500;
}

/* == 11. CONTROL CENTER / ACCOUNTS / USAGE / UPDATE / THEMES ============== */
.control-center-nav { padding: 4px 14px 8px; }
.sheet-account-body { padding: 8px 18px calc(var(--safe-b) + 14px); }
.accounts-sheet, .usage-sheet, .agents-sheet, .worker-control-sheet { padding-bottom: calc(var(--safe-b) + 14px); }

.du-head {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  padding: 13px 2px;
  font-family: var(--f-sans);
  font-size: 14.5px;
  font-weight: 550;
  color: var(--tx);
}
.du-ic { display: flex; color: var(--tx-2); }
.da-note { font-size: 12px; color: var(--tx-4); padding: 8px 2px; line-height: 1.5; }
.drawer-accounts { padding: 4px 20px 0; }
.da-list { display: flex; flex-direction: column; gap: 8px; }
.da-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 13px;
  border-radius: var(--r-lg);
  background: var(--bg-raised);
  border: 1px solid var(--line);
}
.da-av, .pa-av {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-high);
  color: var(--tx-2);
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: 13px;
}
.da-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; text-align: left; }
.da-name { font-family: var(--f-sans); font-size: 14px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.da-sub { font-size: 12px; color: var(--tx-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.da-chk { color: var(--ok); display: flex; }
.da-state { font-size: 12px; color: var(--tx-3); font-family: var(--f-sans); }
.da-row.on { border-color: color-mix(in srgb, var(--ok) 34%, var(--glass-rim)); }
.da-row.busy { opacity: 0.65; }

/* Provider cards */
.pa-list { display: flex; flex-direction: column; gap: 10px; }
.pa-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px 14px;
  border-radius: var(--r-xl);
  background: var(--bg-raised);
  border: 1px solid var(--line);
}
.pa-card.busy { opacity: 0.68; }
.pa-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pa-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pa-name {
  font-family: var(--f-sans); font-size: 14.5px; font-weight: 550;
  display: flex; align-items: baseline; gap: 7px; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pa-mode {
  font-size: 10.5px; font-weight: 550; letter-spacing: 0.04em;
  color: var(--tx-3);
  background: var(--bg-high);
  border-radius: var(--r-full);
  padding: 2px 8px;
  flex: none;
}
.pa-sub { font-size: 12px; color: var(--tx-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pa-sub.on { color: var(--tx-2); }
.pa-dot { width: 8px; height: 8px; min-width: 8px; border-radius: var(--r-full); background: var(--tx-4); }
.pa-dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok-soft); }
.pa-accts { display: flex; flex-direction: column; gap: 6px; }
.pa-acct {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  background: var(--bg-surface);
  border: 1px solid var(--line);
  text-align: left;
}
.pa-acct.on { border-color: color-mix(in srgb, var(--ok) 36%, var(--line)); }
.pa-acct:disabled { opacity: 0.85; }
.pa-acct-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pa-acct-name { font-family: var(--f-sans); font-size: 13px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pa-acct-sub { font-size: 11.5px; color: var(--tx-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pa-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--r-full);
  background: var(--bg-high);
  color: var(--tx);
  border: 1px solid var(--line);
  font-family: var(--f-sans);
  font-size: 13px;
  font-weight: 550;
  transition: transform 140ms var(--ease);
}
.pa-btn:active { transform: scale(0.95); }
.pa-btn:disabled { opacity: 0.5; }
.pa-btn.accent {
  background: var(--cta);
  color: var(--cta-ink);
  border-color: transparent;
  font-weight: 600;
}
.pa-btn.quiet { background: transparent; color: var(--tx-3); }
.pa-keyrow { display: flex; align-items: center; gap: 8px; }
.pa-key {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 9px 14px;
  border-radius: var(--r-md);
  background: var(--bg-surface);
  border: 1px solid var(--line);
  color: var(--tx);
  font-family: var(--f-mono);
  font-size: 16px; /* 16px stops iOS input auto-zoom */
}
.pa-key:focus { outline: none; border-color: var(--tx-3); }
.pa-key::placeholder { color: var(--tx-4); font-family: var(--f-body); font-size: 13px; }
.pa-hint { font-size: 11.5px; color: var(--tx-4); line-height: 1.45; }

/* Device-flow (Grok / Kimi) */
.pa-card.device-pending { border-color: color-mix(in srgb, var(--accent) 38%, var(--glass-rim)); }
.pa-device {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--accent) 7%, var(--bg-surface));
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
}
.pa-device.err {
  background: color-mix(in srgb, var(--danger) 9%, var(--bg-surface));
  border-color: color-mix(in srgb, var(--danger) 34%, var(--line));
}
.pa-device-code {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: color-mix(in srgb, var(--bg-well) 78%, transparent);
  color: var(--tx);
  font-family: var(--f-mono);
  font-size: 22px;
  font-weight: 550;
  letter-spacing: 0.14em;
  text-align: center;
  padding: 14px 12px;
  border-radius: 12px;
  line-height: 1.15;
  cursor: pointer;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
  user-select: all;
  -webkit-user-select: all;
}
.pa-device-code:active { transform: scale(0.98); opacity: 0.92; }
.pa-device-caption {
  font-size: 11px;
  color: var(--tx-4);
  text-align: center;
  margin-top: -4px;
  letter-spacing: 0.02em;
}
.pa-device-open { width: 100%; justify-content: center; }
.pa-device-wait {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--tx-3);
  line-height: 1.4;
  text-align: center;
}
.pa-device-wait.err { color: var(--danger); }
.pa-device-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
  animation: device-breathe 1.6s ease-in-out infinite;
}
@keyframes device-breathe {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; }
}

/* USAGE - the flagship instrument (Reference-B anatomy, MERIDIAN ink).
   One bordered rounded panel per account: a plain title row (label left,
   ACTIVE lamp right), then hairline-separated quota windows. Each window is
   a real meter: label left / value right in tabular mono, a thin full-width
   track under them, and the fill is white ink whose LEADING EDGE carries the
   one red point - a glowing tick that marks exactly where you stand. */
.usage-windows { display: flex; flex-direction: column; gap: 12px; padding: 10px 18px 4px; }
.usage-account {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 18px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--bg-surface);
}
.usage-account-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.usage-account-title {
  min-width: 0;
  overflow: hidden;
  color: var(--tx);
  font-family: var(--f-sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.usage-active {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ok);
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
}
.usage-active::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 8px var(--ok);
}
.usage-account-meta { color: var(--tx-4); font-size: 11.5px; line-height: 1.4; padding-bottom: 6px; font-family: var(--f-mono); }
.usage-error {
  margin: 6px 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--line));
  border-left: 2px solid var(--danger);
  border-radius: var(--r-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 11.5px;
  line-height: 1.4;
}

/* One measured quota window. */
.umeter { padding: 14px 0 12px; border-top: 1px solid var(--line); }
.umeter:first-of-type { border-top: 0; }
.um-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.um-label { font-family: var(--f-sans); font-size: 14px; font-weight: 500; color: var(--tx-2); letter-spacing: -0.005em; }
.um-pct {
  font-family: var(--f-mono);
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--tx);
  letter-spacing: 0.01em;
}
.um-track {
  margin-top: 12px;
  height: 4px;
  border-radius: var(--r-full);
  background: var(--ring-track);
  overflow: visible;
  position: relative;
}
.um-fill {
  position: relative;
  height: 100%;
  min-width: 4px;
  max-width: 100%;
  border-radius: var(--r-full);
  background: var(--tx);
  transition: width 500ms var(--ease-out);
}
/* The one red point: a lamp riding the leading edge of the ink. */
.um-fill::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: var(--r-full);
  transform: translateY(-50%);
  background: var(--accent);
  box-shadow: 0 0 10px var(--ember-glow);
}
.um-reset {
  margin-top: 10px;
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--tx-4);
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
}
.um-empty { font-size: 13px; color: var(--tx-3); padding: 8px 2px; line-height: 1.6; }
.um-empty strong { color: var(--tx); font-weight: 600; display: block; font-size: 14px; }
.umeter.unavailable .um-pct { color: var(--tx-3); }
.umeter.unavailable .um-fill { background: var(--tx-4); }
.umeter.unavailable .um-fill::after { background: var(--tx-3); box-shadow: none; }
.umeter.rejected .um-pct { color: var(--danger); }
.umeter.rejected .um-fill { background: var(--danger); }

/* Update card */
.drawer-update {
  margin: 8px 18px;
  padding: 15px 16px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  background: var(--bg-raised);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.drawer-update .upd-btn, .drawer-update .upd-check { align-self: flex-start; }
.upd-head { display: flex; align-items: center; gap: 10px; }
.upd-dot {
  width: 9px;
  height: 9px;
  min-width: 9px;
  border-radius: var(--r-full);
  background: var(--tx-4);
}
.upd-head.live .upd-dot { background: var(--ok); box-shadow: 0 0 8px var(--ok-soft); }
.upd-head.avail .upd-dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.upd-head.updating .upd-dot { background: var(--warn); }
.upd-head.error .upd-dot { background: var(--danger); }
.upd-title { font-family: var(--f-sans); font-weight: 550; font-size: 15px; }
.upd-sub, .upd-note { font-size: 12.5px; color: var(--tx-3); line-height: 1.45; }
.upd-text { flex: 1; min-width: 0; }
.upd-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: var(--r-full);
  background: var(--cta);
  color: var(--cta-ink);
  font-family: var(--f-sans);
  font-size: 14px;
  font-weight: 600;
  transition: transform 140ms var(--ease);
}
.upd-btn:active { transform: scale(0.95); }
.upd-btn.ghost { background: var(--bg-high); color: var(--tx-2); box-shadow: none; }
.upd-btn-ic { display: flex; }
.upd-check {
  min-height: 44px;
  padding: 9px 18px;
  border-radius: var(--r-full);
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--tx-2);
  font-family: var(--f-sans);
  font-size: 13.5px;
  font-weight: 500;
}
.upd-spin { display: inline-flex; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
.updating { opacity: 0.7; pointer-events: none; }
.has-update { border-color: color-mix(in srgb, var(--accent) 45%, var(--glass-rim)) !important; }

/* Theme picker (contract: .theme-pick / .tp-tile.on) */
.theme-pick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 10px 18px 8px;
}
.tp-tile {
  border-radius: var(--r-lg);
  border: 1.5px solid var(--line);
  background: var(--bg-raised);
  padding: 13px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 150ms var(--ease), border-color 150ms var(--ease);
}
.tp-tile:active { transform: scale(0.96); }
.tp-tile.on {
  border-color: var(--tx);
  box-shadow: 0 0 0 1px var(--tx) inset;
}
.tp-swatch {
  height: 52px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  /* Preview: the theme's own prism corner over its canvas. */
  background:
    radial-gradient(120% 120% at 88% 0%, var(--tp-ac, var(--accent)) 0 18%, transparent 60%),
    var(--tp-bg, var(--bg-raised));
}
.tp-name { font-family: var(--f-sans); font-size: 14.5px; font-weight: 550; }
.tp-desc { font-size: 11.5px; color: var(--tx-3); line-height: 1.35; }

/* == 12. SUB-SCREEN HEADER (chat / files / browser / diagnostics) ========= */
.hdr {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: calc(var(--safe-t) + 8px) 14px 8px;
  padding-top: calc(env(safe-area-inset-top, 0px) + 8px);
  background: var(--glass);
  border-bottom: 1px solid var(--line);
}
.hdr-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
}
.hdr-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--tx-2);
  background: transparent;
  border: 1px solid var(--line-strong);
  transition: transform 150ms var(--ease), color 150ms var(--ease);
  position: relative;
}
.hdr-btn:active { transform: scale(0.92); color: var(--tx); }
.hdr-btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--glass-rim)); }
.hdr-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-family: var(--f-sans);
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hdr-actions { display: flex; align-items: center; gap: 8px; }
#chat-compact.pending { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--glass-rim)); }
#chat-compact.pending svg { animation: spin 900ms linear infinite; }
#chat-compact.error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 55%, var(--glass-rim)); }
#chat-compact:disabled { opacity: 0.55; }

/* == 13. FILES ============================================================ */
.list { display: flex; flex-direction: column; gap: 10px; }
.files-list { display: flex; flex-direction: column; gap: 0; padding: 12px 18px calc(var(--safe-b) + 20px); }
.files-list, .list.files-list {
  margin: 12px 18px calc(var(--safe-b) + 20px);
  padding: 0;
  border-radius: 26px;
  border: 1px solid var(--glass-rim);
  background:
    linear-gradient(180deg, var(--glass-hi), transparent 20%),
    linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner), var(--sh-card);
  overflow: hidden;
}
.cell {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left;
  min-height: 60px;
  padding: 12px 16px;
  background: transparent;
  border-bottom: 1px solid var(--line);
  transition: background-color 150ms var(--ease);
}
.cell:last-child { border-bottom: 0; }
.cell:active { background: var(--bg-raised); }
.file-cell { min-height: 60px; }
.dimmed { opacity: 0.45; }
.dimmed:active { background: transparent; }
.file-ic { display: flex; color: var(--tx-3); }
.file-ic.dir { color: var(--tx-2); }
.file-main { flex: 1; min-width: 0; }
.file-name {
  font-family: var(--f-sans);
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-sub { font-size: 11.5px; color: var(--tx-4); font-family: var(--f-mono); margin-top: 1px; }
.file-caret { display: flex; color: var(--tx-4); opacity: 0.6; }
.file-view { padding: 12px 18px calc(var(--safe-b) + 20px); }
.file-img { width: 100%; border-radius: var(--r-md); border: 1px solid var(--glass-rim); box-shadow: var(--sh-card); }
.file-text {
  font-family: var(--f-mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-well);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--tx-2);
  padding: 14px;
  overflow-x: auto;
}
[data-theme='aether'] .file-text { background: #FBF8F3; }
.file-trunc { font-size: 12px; color: var(--tx-4); text-align: center; padding: 8px; }
.dl-ic { display: flex; }

.crumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 10px 18px 0;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--tx-3);
}
.crumb {
  min-height: 32px;
  padding: 6px 11px;
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  border: 1px solid var(--glass-rim);
  white-space: nowrap;
  flex-shrink: 0;
}
.crumb-sep { color: var(--tx-4); flex-shrink: 0; display: flex; }
.crumb.root { color: var(--tx-2); border-color: var(--line-strong); }
.crumb.root.on { background: var(--bg-raised); color: var(--tx); }

.pick-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px calc(var(--safe-b) + 14px);
  background: var(--glass);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-top: 1px solid var(--glass-rim);
}
.pick-path {
  flex: 1;
  min-width: 0;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--tx-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;
  text-align: left;
}
.pick-use {
  min-height: 44px;
  padding: 9px 20px;
  border-radius: var(--r-full);
  background: var(--cta);
  color: var(--cta-ink);
  font-family: var(--f-sans);
  font-size: 13.5px;
  font-weight: 600;
}
.pick-use[disabled] { opacity: 0.5; }

/* == 14. ASK SHEET ======================================================== */
.ask-sheet .ask-form { display: flex; flex-direction: column; gap: 12px; padding: 8px 18px; }
.ask-field { display: flex; flex-direction: column; gap: 6px; }
.ask-field-lbl { font-family: var(--f-sans); font-size: 13.5px; font-weight: 500; color: var(--tx-2); }
.ask-input, .ask-textarea {
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-surface);
  color: var(--tx);
  font-size: 16px;
  padding: 12px 15px;
  margin: 0 18px;
}
.ask-field .ask-input, .ask-opts + .ask-actions .ask-input { margin: 0; }
.ask-form .ask-input { margin: 0; }
.ask-other { padding: 4px 18px 0; }
.ask-other .ask-input { margin: 0; width: 100%; }
.ask-textarea { min-height: 88px; resize: vertical; }
.ask-input:focus, .ask-textarea:focus { outline: none; border-color: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.ask-opts { display: flex; flex-direction: column; gap: 8px; padding: 8px 18px 0; }
.ask-opts.compact { padding: 0; }
.ask-opt {
  display: flex;
  align-items: center;
  gap: 11px;
  text-align: left;
  min-height: 50px;
  padding: 13px 15px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--glass-rim);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner);
  color: var(--tx);
  font-size: 14.5px;
  transition: border-color 150ms var(--ease);
}
.ask-opt.sel, .ask-opt.on { border-color: var(--warn); background: linear-gradient(180deg, var(--warn-soft), transparent 80%), linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2)); }
.ask-opt.recommended { border-color: color-mix(in srgb, var(--warn) 45%, var(--glass-rim)); }
.ask-opt-txt { flex: 1; min-width: 0; }
.ask-badge {
  flex: none;
  padding: 3px 9px;
  border-radius: var(--r-full);
  background: var(--warn-soft);
  color: var(--warn);
  font-family: var(--f-sans);
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.ask-check { display: flex; width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--line-strong); }
.ask-opt.on .ask-check { background: var(--warn); border-color: var(--warn); }
.ask-yn { display: flex; gap: 10px; }
.ask-yn-btn {
  flex: 1;
  min-height: 48px;
  border-radius: var(--r-full);
  border: 1.5px solid var(--glass-rim);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  font-family: var(--f-sans);
  font-size: 15px;
  font-weight: 550;
  color: var(--tx);
}
.ask-yn-btn.sel, .ask-yn-btn.on { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.ask-actions { display: flex; gap: 10px; padding: 12px 18px 0; }
.ask-btn {
  flex: 1;
  min-height: 50px;
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  border: 1px solid var(--glass-rim);
  box-shadow: var(--glass-inner);
  font-family: var(--f-sans);
  font-size: 15px;
  font-weight: 550;
  color: var(--tx);
}
.ask-btn.primary { background: var(--accent); border: 0; color: var(--accent-ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), var(--glow-accent); }
.ask-btn.ghost { background: none; box-shadow: none; color: var(--tx-2); }
.ask-btn.wide { flex: none; width: calc(100% - 36px); margin: 12px 18px 0; }

/* == 15. BROWSER MIRROR =================================================== */
.browser-bar {
  display: flex;
  /* Explicit row + no-grow: the generic `.view` helper (flex:1 column) also
     lands on this node as a MODE class, and must not turn the bar into a
     stretched column. */
  flex-direction: row;
  flex: 0 0 auto;
  min-height: 0;
  align-items: center;
  gap: 8px;
  padding: 10px 14px calc(var(--safe-b) + 12px);
  background: var(--glass);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  border-top: 1px solid var(--glass-rim);
  position: relative;
}
.browser-field {
  flex: 1;
  min-width: 0;
  display: flex;
}
.browser-key {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  border-radius: var(--r-full);
  border: 1px solid var(--line);
  background: var(--bg-surface);
  color: var(--tx);
  font-family: var(--f-mono);
  font-size: 16px;
  padding: 0 16px;
}
.browser-key:focus { outline: none; border-color: var(--tx-3); }
.browser-mode {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  border: 1px solid var(--glass-rim);
  box-shadow: var(--glass-inner);
  color: var(--tx-2);
  font-family: var(--f-sans);
  font-size: 12.5px;
  font-weight: 550;
}
.browser-mode .bm-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tx-4); }
.browser-mode.control { color: var(--accent-hi); border-color: color-mix(in srgb, var(--accent) 40%, var(--glass-rim)); }
.browser-mode.control .bm-dot { background: var(--accent); box-shadow: 0 0 7px var(--accent); }
.browser-refresh, .browser-enter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 16px;
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  border: 1px solid var(--glass-rim);
  box-shadow: var(--glass-inner);
  color: var(--tx-2);
  font-family: var(--f-sans);
  font-size: 13px;
  font-weight: 550;
}
.browser-stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-well);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
}
.browser-img { display: block; width: 100%; height: auto; }
.browser-img.live { outline: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: -1px; }
.browser-wait {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--tx-3);
  font-size: 13.5px;
  font-family: var(--f-sans);
}
.browser-view-hint {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--tx-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.browser-bar.view { align-items: center; }

.browser-tabs {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 2px 10px;
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}
.browser-tabs::-webkit-scrollbar { display: none; }
.browser-tabs:empty, .browser-tabs.empty { display: none; }
.browser-tab {
  display: inline-flex; align-items: center; gap: 8px;
  flex: none; max-width: 190px;
  min-height: 36px;
  padding: 7px 13px 7px 9px;
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  border: 1px solid var(--glass-rim);
  box-shadow: var(--glass-inner);
  font-family: var(--f-sans); font-size: 12.5px; font-weight: 500;
  color: var(--tx-3);
  scroll-snap-align: start;
  cursor: pointer;
  transition: transform 200ms var(--ease), color 160ms var(--ease), border-color 180ms var(--ease);
}
.browser-tab:active { transform: scale(0.95); }
.browser-tab.active {
  color: var(--tx);
  border-color: var(--tx);
  box-shadow: 0 0 0 1px var(--tx) inset;
}
.browser-tab-fav { width: 16px; height: 16px; border-radius: 4px; flex: none; object-fit: cover; }
.browser-tab-fav.mono {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--f-sans);
  font-size: 9.5px;
  font-weight: 550;
  line-height: 1;
  color: #fff;
  background: hsl(var(--fav-h, 24) 42% 42%);
  border-radius: 4px;
}
.browser-tab.active .browser-tab-fav.mono { box-shadow: none; }
.browser-tab-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.browser-tab.skeleton { width: 120px; height: 34px; border: 0; background: var(--glass-fill-2); animation: skel-pulse 1.3s var(--ease-out) infinite; }
@keyframes skel-pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 0.85; } }

.fp-stage { flex: 1; min-height: 0; overflow: hidden; position: relative; background: var(--bg-well); }
.fp-scroll { height: 100%; overflow: auto; -webkit-overflow-scrolling: touch; }
.fp-img { display: block; width: 100%; height: auto; }
.fp-msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
}
.fp-msg-ic { color: var(--tx-4); font-family: var(--f-sans); font-size: 22px; font-weight: 550; }
.fp-msg-t { font-family: var(--f-sans); font-size: 16px; font-weight: 550; }
.fp-msg-s { font-size: 13px; color: var(--tx-3); max-width: 280px; line-height: 1.5; }
.fp-reload, .fp-retry {
  margin-top: 6px;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  border: 1px solid var(--glass-rim);
  box-shadow: var(--glass-inner);
  font-family: var(--f-sans);
  font-size: 13.5px;
  font-weight: 550;
  color: var(--tx);
}
.fp-reload { position: absolute; top: 12px; right: 12px; min-height: 36px; padding: 8px 10px; }
.zoomed { cursor: grab; }

/* == 16. GROK STUDIO ====================================================== */
.grok-sheet { display: flex; flex-direction: column; }
.grok-top { display: flex; align-items: center; gap: 12px; padding: 6px 22px 2px; }
.grok-top-l { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.grok-top-tt { min-width: 0; }
.grok-mark {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.16), transparent 44%),
    linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  border: 1px solid var(--glass-rim);
  box-shadow: var(--glass-inner);
  color: var(--tx);
}
.grok-h1 { font-family: var(--f-sans); font-size: 18px; font-weight: 550; letter-spacing: -0.015em; }
.grok-h2 { font-size: 12.5px; color: var(--tx-3); }
.grok-tabs {
  display: flex;
  gap: 4px;
  margin: 12px 18px 0;
  padding: 4px;
  border-radius: var(--r-full);
  background: color-mix(in srgb, var(--bg-canvas) 72%, transparent);
  border: 1px solid var(--line);
}
.grok-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 9px 4px;
  border-radius: var(--r-full);
  font-family: var(--f-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--tx-3);
  transition: background-color 160ms var(--ease), color 160ms var(--ease);
}
.grok-tab.on {
  background: linear-gradient(180deg, var(--glass-hi), transparent 45%), linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  color: var(--tx);
  box-shadow: var(--glass-inner), var(--sh-soft);
}
.grok-tab-ic { display: flex; }
.grok-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 18px calc(var(--safe-b) + 16px);
}
.grok-form { display: flex; flex-direction: column; gap: 12px; }
.grok-flabel { font-family: var(--f-sans); font-size: 12.5px; font-weight: 550; color: var(--tx-3); }
.grok-input {
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--bg-surface);
  color: var(--tx);
  font-size: 16px;
  padding: 12px 15px;
  min-height: 76px;
  resize: vertical;
}
.grok-input:focus { outline: none; border-color: var(--tx-3); box-shadow: 0 0 0 3px rgba(245, 245, 243, 0.07); }
.grok-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.grok-pill {
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--r-full);
  border: 1.5px solid var(--glass-rim);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner);
  font-family: var(--f-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--tx-2);
  transition: border-color 140ms var(--ease), color 140ms var(--ease);
}
.grok-pill.on { border-color: var(--tx); color: var(--tx); background: var(--bg-raised); }
.grok-slider-row { display: flex; align-items: center; gap: 12px; }
.grok-slider { flex: 1; accent-color: var(--accent); min-height: 30px; }
.grok-slider-val { font-family: var(--f-mono); font-size: 13px; color: var(--tx-2); min-width: 40px; text-align: right; font-variant-numeric: tabular-nums; }
.grok-note { font-size: 12px; color: var(--tx-4); line-height: 1.5; }
.grok-gen {
  min-height: 52px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background: var(--cta);
  color: var(--cta-ink);
  font-family: var(--f-sans);
  font-size: 16px;
  font-weight: 600;
  transition: transform 150ms var(--ease);
}
.grok-gen:active { transform: scale(0.97); }
.grok-gen[disabled] { opacity: 0.55; box-shadow: none; }
.grok-gen-ic { display: flex; }
.grok-gen-spin {
  width: 18px;
  height: 18px;
  border-radius: var(--r-full);
  border: 2px solid rgba(0, 0, 0, 0.22);
  border-top-color: var(--accent-ink);
  animation: spin 0.8s linear infinite;
}
.grok-err {
  border-radius: var(--r-md);
  border: 1px solid color-mix(in srgb, var(--danger) 34%, var(--line));
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  padding: 11px 14px;
  line-height: 1.45;
  margin-top: 12px;
}
.grok-results { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.grok-result-media { width: 100%; border-radius: var(--r-md); border: 1px solid var(--glass-rim); box-shadow: var(--sh-card); }
.grok-result-audio { width: 100%; }
.grok-gallery { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.grok-gallery-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px;
}
.grok-gallery-strip::-webkit-scrollbar { display: none; }
.grok-gtile {
  position: relative;
  width: 96px;
  height: 96px;
  min-width: 96px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--glass-rim);
  background: var(--bg-raised);
  box-shadow: var(--sh-soft);
}
.grok-gtile img, .grok-gtile video { width: 100%; height: 100%; object-fit: cover; }
.grok-gtile.vid, .grok-gtile.aud { display: flex; align-items: center; justify-content: center; color: var(--tx-2); }
.grok-gtile-badge {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 3px 7px;
  border-radius: var(--r-full);
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  color: #fff;
}
.grok-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 36px 24px;
}
.grok-gate-ic { color: var(--tx-4); }
.grok-gate-t { font-family: var(--f-sans); font-size: 17px; font-weight: 550; }
.grok-gate-s { font-size: 13.5px; color: var(--tx-3); max-width: 300px; line-height: 1.5; }
.grok-gate-retry {
  margin-top: 8px;
  min-height: 44px;
  padding: 10px 24px;
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  border: 1px solid var(--glass-rim);
  box-shadow: var(--glass-inner);
  font-family: var(--f-sans);
  font-size: 14px;
  font-weight: 550;
  color: var(--tx);
}

/* == 17. ELXR PANEL ======================================================= */
.elxr-sheet { display: flex; flex-direction: column; }
.elxr-top { display: flex; align-items: center; gap: 12px; padding: 6px 22px 2px; }
.elxr-top-l { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.elxr-top-r { display: flex; align-items: center; gap: 8px; }
.elxr-top-tt { min-width: 0; }
.elxr-shield {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-high);
  color: var(--tx-2);
  border: 1px solid var(--line);
}
.elxr-h1 { font-family: var(--f-sans); font-size: 18px; font-weight: 550; }
.elxr-h2 { font-size: 12.5px; color: var(--tx-3); }
.elxr-refresh {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  border: 1px solid var(--glass-rim);
  box-shadow: var(--glass-inner);
  color: var(--tx-2);
}
.elxr-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 18px calc(var(--safe-b) + 16px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.elxr-doing, .elxr-money, .elxr-needs, .elxr-progress-card {
  border-radius: var(--r-lg);
  border: 1px solid var(--glass-rim);
  background:
    linear-gradient(180deg, var(--glass-hi), transparent 24%),
    linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner), var(--sh-card);
  padding: 16px;
}
.elxr-doing.working { border-color: color-mix(in srgb, var(--accent) 34%, var(--glass-rim)); }
.elxr-doing-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.elxr-doing-tag, .elxr-money-tag, .elxr-progress-tag, .elxr-needs-t {
  font-family: var(--f-sans);
  font-size: 11px;
  font-weight: 550;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--tx-3);
}
.elxr-doing-status { display: flex; align-items: center; gap: 7px; font-family: var(--f-sans); font-size: 12.5px; font-weight: 500; color: var(--tx-3); }
.elxr-doing-status.working { color: var(--accent-hi); }
.elxr-doing-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tx-4); }
.elxr-doing-dot.working {
  background: var(--accent);
}
.elxr-doing-headline { font-family: var(--f-sans); font-size: 16.5px; font-weight: 550; margin-top: 10px; line-height: 1.35; letter-spacing: -0.01em; }
.elxr-doing-focus { font-size: 13px; color: var(--tx-2); margin-top: 5px; line-height: 1.5; }
.elxr-doing-focus.dim { color: var(--tx-4); }
.elxr-money-big { padding: 8px 0 14px; }
.elxr-money-big .l { font-size: 12.5px; color: var(--tx-3); font-family: var(--f-sans); font-weight: 500; }
.elxr-money-big .v {
  font-family: var(--f-sans);
  font-size: 40px;
  font-weight: 550;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--tx);
}
.elxr-money-big .n { font-size: 12px; color: var(--tx-4); margin-top: 2px; }
.elxr-needs { border-color: color-mix(in srgb, var(--warn) 42%, var(--glass-rim)); }
.elxr-needs-t { color: var(--warn); display: flex; align-items: center; gap: 8px; }
.elxr-needs-dot { width: 8px; height: 8px; min-width: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.elxr-needs-list { display: flex; flex-direction: column; gap: 9px; margin-top: 10px; }
.elxr-needs-row { font-size: 13.5px; line-height: 1.5; }
.elxr-progress-cell .pg-n { font-family: var(--f-sans); font-size: 22px; font-weight: 550; font-variant-numeric: tabular-nums; }
.elxr-progress-cell .pg-l { font-size: 11.5px; color: var(--tx-3); font-family: var(--f-sans); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.elxr-progress { margin-top: 10px; }
.elxr-progress-arrow { color: var(--tx-4); }
.elxr-filed-head { color: var(--tx-2); }
.elxr-err {
  border-radius: var(--r-md);
  border: 1px solid color-mix(in srgb, var(--danger) 34%, var(--line));
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  padding: 11px 14px;
}
.elxr-skel { display: flex; flex-direction: column; gap: 10px; }
.elxr-skel-hero { height: 92px; border-radius: var(--r-lg); }
.elxr-skel-row { height: 56px; border-radius: var(--r-md); }
.elxr-loading-txt { text-align: center; font-size: 12.5px; color: var(--tx-4); }

/* == 18. DIAGNOSTICS ====================================================== */
.diag-meta {
  margin: 12px 18px 0;
  padding: 13px 15px;
  border-radius: var(--r-lg);
  border: 1px solid var(--glass-rim);
  background:
    linear-gradient(180deg, var(--glass-hi), transparent 26%),
    linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner), var(--sh-soft);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.diag-meta-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 12.5px; line-height: 1.4; }
.diag-k { color: var(--tx-4); flex: none; }
.diag-v { color: var(--tx-2); font-family: var(--f-mono); font-size: 11px; text-align: right; word-break: break-word; min-width: 0; }
.diag-actions { display: flex; gap: 10px; margin: 10px 18px; }
.diag-btn {
  flex: 1;
  min-height: 44px;
  padding: 10px 0;
  border-radius: var(--r-full);
  border: 1px solid var(--glass-rim);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner);
  color: var(--tx-2);
  font-family: var(--f-sans);
  font-size: 13.5px;
  font-weight: 550;
}
.diag-btn:active { background: var(--bg-raised); }
.diag-btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, var(--glass-rim)); }
.diag-list { margin: 0 18px 28px; display: flex; flex-direction: column; }
.diag-empty { padding: 28px 8px; text-align: center; color: var(--tx-4); font-size: 13px; line-height: 1.5; }
.diag-row { padding: 10px 2px; border-bottom: 1px solid var(--line); }
.diag-row.err .diag-type { color: var(--danger); }
.diag-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.diag-type { font-family: var(--f-mono); font-size: 11px; font-weight: 550; color: var(--tx-2); }
.diag-ts { font-family: var(--f-mono); font-size: 10.5px; color: var(--tx-4); white-space: nowrap; }
.diag-msg { font-size: 12.5px; color: var(--tx-2); line-height: 1.45; margin-top: 2px; word-break: break-word; }
.diag-extra { font-family: var(--f-mono); font-size: 10.5px; color: var(--tx-4); margin-top: 3px; white-space: pre-wrap; word-break: break-word; }

/* == 19. PROTO BANNER + TOASTS + APP ERRORS =============================== */
#proto-banner {
  position: fixed;
  top: calc(var(--safe-t) + 10px);
  left: 0;
  right: 0;
  z-index: 56;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.proto-strip,
.proto-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  min-height: 40px;
  padding: 9px 16px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--glass-hi), transparent 40%), var(--glass-heavy);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-rim-strong);
  box-shadow: var(--sh-float);
  font-family: var(--f-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--tx);
  pointer-events: auto;
  animation: toast-in 280ms var(--ease-pop) both;
}
.proto-strip.refresh { border-color: var(--accent); cursor: pointer; }
.proto-strip.refresh:active { transform: scale(0.97); }
.proto-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: proto-pulse 1.6s ease-in-out infinite;
}
.proto-chip.ok { color: var(--ok); }
.proto-chip.pending { color: var(--tx-2); }
.proto-chip.subtle { color: var(--tx-4); font-weight: 500; font-size: 12px; padding: 6px 12px; min-height: 32px; }
.proto-spin {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin 900ms linear infinite;
}
@keyframes proto-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.toast-wrap {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--safe-b) + 96px);
  z-index: 55;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--glass-hi), transparent 24%), var(--glass-heavy);
  backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.3);
  border: 1px solid var(--glass-rim-strong);
  box-shadow: var(--sh-float);
  font-size: 13.5px;
  pointer-events: auto;
  animation: toast-in 280ms var(--ease-pop) both;
}
.toast .tt { font-family: var(--f-sans); font-weight: 550; font-size: 13.5px; }
.toast .tb { display: block; color: var(--tx-2); font-size: 12.5px; line-height: 1.4; }
.toast.ok, .toast.success { border-left: 3px solid var(--ok); }
.toast.warn { border-left: 3px solid var(--warn); }
.toast.err, .toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

/* App error surfacing (contract-pinned anatomy). */
.app-error-wrap {
  position: fixed;
  top: calc(var(--safe-t) + 8px);
  left: 12px;
  right: 12px;
  z-index: 58;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.app-error-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--glass-hi), transparent 26%), var(--glass-heavy);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-rim-strong);
  border-left: 3px solid var(--warn);
  box-shadow: var(--sh-float);
  pointer-events: auto;
  animation: toast-in 280ms var(--ease-pop) both;
}
.app-error-banner.lvl-error { border-left-color: var(--danger); }
.app-error-banner.lvl-warn { border-left-color: var(--warn); }
[data-theme='aether'] .app-error-banner {
  background: rgba(252, 250, 246, 0.92);
}
.app-error-banner.leaving { opacity: 0; transform: translateY(-8px); transition: opacity 300ms var(--ease), transform 300ms var(--ease); }
.aeb-main { flex: 1; min-width: 0; }
.aeb-msg { font-size: 13.5px; line-height: 1.45; word-break: break-word; }
.aeb-sub { font-size: 11.5px; color: var(--tx-3); margin-top: 2px; }
.aeb-code { font-family: var(--f-mono); font-size: 11px; color: var(--tx-4); }
.aeb-x { color: var(--tx-3); padding: 2px 6px; flex-shrink: 0; font-size: 16px; }
.app-error-msg { align-items: stretch; }
.app-error-inline {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  border-left: 3px solid var(--danger);
  background: var(--bg-surface);
  font-size: 13px;
}
.app-error-inline.lvl-warn { border-left-color: var(--warn); }
.aei-txt { flex: 1; min-width: 0; color: var(--tx-2); line-height: 1.45; word-break: break-word; }
.aei-code { font-family: var(--f-mono); font-size: 11px; color: var(--tx-4); }

/* == 20. SLASH MENU + /btw ================================================ */
.slash-menu {
  border: 1px solid var(--glass-rim);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--glass-hi), transparent 16%), var(--glass-heavy);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  overflow: hidden;
  overflow-y: auto;
  max-height: 240px;
  box-shadow: var(--sh-float);
}
.slash-menu[hidden] { display: none; }
.slash-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 44px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.slash-item:last-child { border-bottom: 0; }
.slash-item.sel, .slash-item:active { background: var(--bg-raised); }
.slash-nm {
  font-family: var(--f-mono);
  font-size: 13px;
  font-weight: 550;
  color: var(--tx);
  white-space: nowrap;
}
.slash-ds {
  font-size: 12.5px;
  color: var(--tx-3);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btw-sheet { display: flex; flex-direction: column; max-height: 82dvh; }
.btw-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 18px 12px;
  border-bottom: 1px solid var(--line);
}
.btw-title { font-family: var(--f-sans); font-size: 15px; font-weight: 550; color: var(--tx); }
.btw-sub { font-size: 11.5px; color: var(--tx-4); margin-top: 1px; }
.btw-close {
  margin-left: auto;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: var(--r-full);
  border: 1px solid var(--glass-rim);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  color: var(--tx-2);
  font-size: 12.5px;
  font-weight: 500;
}
.btw-close:active { transform: scale(0.97); }
.btw-feed {
  flex: 1;
  min-height: 140px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.btw-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.btw-msg.user { align-self: flex-end; background: var(--bg-high); color: var(--tx); border-bottom-right-radius: 7px; }
.btw-msg.assistant {
  align-self: flex-start;
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  border: 1px solid var(--glass-rim);
  color: var(--tx-2);
  border-bottom-left-radius: 7px;
}
.btw-msg.pending { color: var(--tx-4); }
.btw-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 14px calc(var(--safe-b) + 14px);
  border-top: 1px solid var(--line);
}
.btw-input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--bg-surface);
  color: var(--tx);
  padding: 11px 16px;
  font: inherit;
  font-size: 16px;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  outline: none;
}
.btw-input:focus { border-color: var(--tx-3); }
.btw-ask {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--cta);
  color: var(--cta-ink);
  font-size: 18px;
  font-weight: 550;
  flex-shrink: 0;
}
.btw-ask:active { transform: scale(0.94); }
/* == 21. CHAT ============================================================= */
.hdr.hdr-chat { padding-bottom: 6px; }
.hdr.hdr-chat .hdr-row { min-height: 54px; }
.chat-id {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 12px;
  border-radius: var(--r-lg);
  transition: background-color 140ms var(--ease);
}
.chat-id:active { background: var(--bg-raised); }
.chat-id-title {
  max-width: 100%;
  font-family: var(--f-sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-id-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--tx-3);
  font-family: var(--f-sans);
  max-width: 100%;
}
.chat-id-sub-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-id-dot {
  width: 7px;
  height: 7px;
  min-width: 7px;
  border-radius: var(--r-full);
  background: var(--tx-4);
  transition: background-color 200ms var(--ease);
}
.chat-id-dot[data-state='working'], .chat-id-dot.busy {
  background: var(--accent);
}
.chat-id-dot.online { background: var(--ok); box-shadow: 0 0 7px var(--ok); }

/* In-chat workspace chip (44px effective target via ::after hit-slop). */
.chat-ws {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 2px 0 0;
  min-width: 0;
}
.chat-ws:empty { display: none; }
.chat-ws-chip {
  position: relative;
  min-height: 30px;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border: 1px solid var(--glass-rim);
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner);
  color: var(--tx-3);
  font-family: var(--f-sans);
  font-size: 11.5px;
  cursor: pointer;
  transition: color 140ms var(--ease);
}
/* >=44px EFFECTIVE touch target (30 + 2*7) without inflating the header row. */
.chat-ws-chip::after { content: ''; position: absolute; inset: -7px -10px; }
.chat-ws-chip:active { color: var(--tx); }
.chat-ws-chip:focus-visible { outline: 2px solid rgba(245, 245, 243, 0.7); outline-offset: 2px; }
.chat-ws-ic { display: inline-flex; flex: none; color: var(--tx-4); }
.chat-ws-ic svg { width: 13px; height: 13px; }
.chat-ws-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  letter-spacing: -0.01em;
}
.chat-ws-chev { flex: none; color: var(--tx-4); font-size: 13px; line-height: 1; transform: rotate(90deg); transition: transform 180ms var(--ease); }
.chat-ws[data-open] .chat-ws-chev { transform: rotate(-90deg); }
.chat-ws-full {
  display: flex;
  align-items: flex-start;
  align-self: stretch;
  gap: 8px;
  max-width: 100%;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  background: var(--bg-surface);
  border: 1px solid var(--line);
  animation: ws-reveal 200ms var(--ease);
}
.chat-ws-path {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--tx-2);
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
}
.chat-ws-copy {
  flex: none;
  min-height: 30px;
  padding: 5px 12px;
  border: 1px solid var(--glass-rim);
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  color: var(--tx-2);
  font-family: var(--f-sans);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}
.chat-ws-copy:active { color: var(--tx); }
.chat-ws-copy:focus-visible { outline: 2px solid rgba(245, 245, 243, 0.7); outline-offset: 2px; }
@keyframes ws-reveal { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

/* Context ring (header, right) */
.ctx-ring {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--r-full);
  transition: transform 200ms var(--ease);
}
.ctx-ring:active { transform: scale(0.9); }
.ctx-ring.unread .ring-prog, .ctx-ring.unread .arc-fill { opacity: 0.25; }
.ctx-ring-svg { display: block; }
.ctx-pct {
  position: absolute;
  bottom: 7px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--f-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--tx-2);
}

/* Thread */
.chat-body { background: transparent; }
.thread, .chat-thread {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 18px var(--thread-pad-b, 24px);
  max-width: 760px;
  width: 100%;
  margin: 0 auto;
}
.body.chat-body { scroll-padding-bottom: var(--thread-pad-b, 24px); }
.thread { flex: 1 0 auto; }
.thread > .empty { margin: auto 0; }

.msg { display: flex; flex-direction: column; max-width: 100%; }
.msg.user { align-items: flex-end; }
.msg.assistant { align-items: stretch; }

/* User = INVERTED INK: the operator writes on the white slab (carbon slab on
   paper in Dawn). The strongest object in the thread is your own word.
   Entrance: fade + rise, 160ms - "it landed". */
.bubble {
  max-width: 84%;
  padding: 12px 16px;
  border-radius: var(--r-lg);
  border-bottom-right-radius: 6px;
  background: var(--cta);
  border: 0;
  color: var(--cta-ink);
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  box-shadow: var(--sh-soft);
  animation: bubble-in 160ms var(--ease) both;
}
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Assistant = flush warm ink beside a 1px turn rail: ember while the turn is
   live, hairline once settled. Instrument grammar, not a box. */
.msg.assistant .bubble {
  max-width: 100%;
  padding: 2px 2px;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 15px;
  line-height: 1.64;
  color: var(--tx);
  animation: none;
}
.msg.assistant {
  position: relative;
  padding-left: 14px;
}
.msg.assistant::before {
  content: '';
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 1px;
  background: var(--line);
  transition: background-color 600ms var(--ease);
}
.msg.assistant::after {
  content: '';
  position: absolute;
  left: -1px;
  top: 3px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--tx-4);
}
.msg.assistant:is([data-motion-phase='thinking'], [data-motion-phase='streaming'],
  [data-motion-phase='tool'], [data-motion-phase='browser'], [data-motion-phase='queued'],
  [data-motion-phase='steered'], [data-motion-phase='compaction'])::before {
  background: var(--accent);
}
.msg.assistant:is([data-motion-phase='thinking'], [data-motion-phase='streaming'],
  [data-motion-phase='tool'], [data-motion-phase='browser'], [data-motion-phase='queued'],
  [data-motion-phase='steered'], [data-motion-phase='compaction'])::after {
  background: var(--accent);
}
.bubble.no-reply { opacity: 0.72; font-style: italic; color: var(--tx-3); }
.empty-stream { color: var(--tx-3); font-size: 14px; }

.msg-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  row-gap: 8px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--tx-4);
  font-family: var(--f-sans);
}
.msg-foot .think-pill { max-width: 100%; min-width: 0; }
.msg.user .msg-foot { justify-content: flex-end; }

.msg-time {
  font-family: var(--f-sans);
  font-size: 10.5px;
  color: var(--tx-4);
  letter-spacing: 0.01em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  user-select: none;
  -webkit-user-select: none;
}
.msg.user > .msg-time { margin-top: 4px; padding-right: 4px; }

/* Day divider - centered hairline, static, muted. */
.day-divider {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 2px 8px;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--tx-4);
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  user-select: none;
  -webkit-user-select: none;
}
.day-divider::before,
.day-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.day-divider-label { flex: none; }

.steer-badge {
  padding: 3px 10px;
  border-radius: var(--r-full);
  background: var(--bg-high);
  color: var(--tx-2);
  font-weight: 550;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 5px;
}

/* Shared cross-session context pill */
.shared-context-wrap { align-items: center; }
.shared-context { max-width: min(92%, 680px); min-width: 0; }
.shared-context-pill {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 8px 14px;
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  border: 1px solid var(--line-strong);
  color: var(--tx-2);
  font-family: var(--f-sans);
  font-size: 11.5px;
  cursor: pointer;
  list-style: none;
}
.shared-context-pill::-webkit-details-marker { display: none; }
.shared-context-pill:focus-visible { outline: 2px solid rgba(245, 245, 243, 0.7); outline-offset: 2px; }
.shared-context-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shared-context-state { flex: none; color: var(--tx-4); font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.shared-context-live { width: 7px; height: 7px; flex: none; border-radius: var(--r-full); background: var(--ok); }
.shared-context-body {
  margin-top: 7px;
  padding: 12px 14px;
  max-height: 256px;
  overflow-y: auto;
  border-radius: var(--r-lg);
  background: var(--bg-surface);
  border: 1px solid var(--line);
  color: var(--tx-2);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Markdown inside assistant turns */
.msg.assistant p { margin: 0 0 10px; }
.msg.assistant p:last-child { margin-bottom: 0; }
.msg.assistant h1, .msg.assistant h2, .msg.assistant h3, .msg.assistant h4 {
  font-family: var(--f-sans);
  letter-spacing: -0.02em;
  line-height: 1.22;
  margin: 20px 0 8px;
  font-weight: 550;
}
.msg.assistant h1 { font-size: 22px; }
.msg.assistant h2 { font-size: 19px; }
.msg.assistant h3 { font-size: 17px; }
.msg.assistant h4 { font-size: 15.5px; }
.msg.assistant ul, .msg.assistant ol { margin: 6px 0 12px; padding-left: 22px; }
.msg.assistant li { margin: 4px 0; }
.msg.assistant blockquote {
  margin: 10px 0;
  padding: 10px 15px;
  border-left: 3px solid var(--accent);
  border-radius: 6px 14px 14px 6px;
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  color: var(--tx-2);
}
.msg.assistant code {
  font-family: var(--f-mono);
  font-size: 0.86em;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 1.5px 6px;
}
.msg.assistant pre {
  margin: 10px 0;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--bg-well);
  border: 1px solid var(--line);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
[data-theme='aether'] .msg.assistant pre { background: #FBF8F3; }
.msg.assistant pre code { background: none; border: 0; padding: 0; font-size: 12.5px; line-height: 1.55; color: var(--tx-2); }
.msg.assistant table { border-collapse: collapse; margin: 10px 0; width: 100%; font-size: 13.5px; display: block; overflow-x: auto; }
.msg.assistant th, .msg.assistant td { border: 1px solid var(--line-strong); padding: 6px 10px; text-align: left; }
.msg.assistant th { font-family: var(--f-sans); background: var(--bg-surface); }
.msg.assistant hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.msg.assistant img { border-radius: var(--r-md); }

/* Streaming caret: a 2px ember bar pulsing opacity - words arriving, not
   typewriter theatre. Runs ONLY while tokens stream. */
.cursor {
  display: inline-block;
  width: 2px;
  height: 16px;
  margin-left: 3px;
  vertical-align: -3px;
  border-radius: 1px;
  background: var(--accent);
  animation: cursor-blink 1800ms var(--ease) infinite;
}
@keyframes cursor-blink { 50% { opacity: 0.25; } }

/* Attachments (contract-pinned sizing) */
.msg-atts, .assistant-atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.msg.user .msg-atts { justify-content: flex-end; }
.msg-att {
  max-width: min(248px, 72vw);
  max-height: 340px;
  width: auto;
  height: auto;
  object-fit: cover;
  cursor: pointer;
  border-radius: var(--r-md);
  border: 1px solid var(--glass-rim);
  background: var(--bg-surface);
  box-shadow: var(--sh-soft);
  display: block;
}
.msg-att-vid {
  width: min(220px, 70vw);
  height: 240px;
  object-fit: cover;
  border-radius: var(--r-md);
}
.msg-att-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 9px 14px;
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  border: 1px solid var(--glass-rim);
  box-shadow: var(--glass-inner);
  font-size: 13px;
  color: var(--tx-2);
  max-width: 100%;
}
.msg-att-ic { display: flex; color: var(--tx-3); }
.msg-att-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-att-chip.tappable { cursor: pointer; }
.msg-att-audio { width: min(300px, 78vw); }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(10, 7, 4, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  padding: calc(var(--safe-t) + 16px) 16px calc(var(--safe-b) + 16px);
  animation: fade-in 200ms var(--ease) both;
}
.lightbox-media {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--r-sm);
}

/* Empty-thread welcome */
.chat-welcome { text-align: center; padding: 48px 22px 20px; }
.cw-mark { color: var(--accent); margin-bottom: 14px; display: flex; justify-content: center; filter: drop-shadow(0 4px 12px rgba(var(--accent-rgb), 0.4)); }
.cw-title { font-family: var(--f-sans); font-size: 23px; font-weight: 550; letter-spacing: -0.025em; color: var(--tx); }
.cw-sub { margin-top: 8px; font-size: 14px; color: var(--tx-3); max-width: 300px; margin-left: auto; margin-right: auto; line-height: 1.5; }

/* Floating "working" indicator */
.working-ind { align-items: flex-start; }
.working-ind .bubble.empty-stream {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: none;
  padding: 10px 14px;
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  border: 1px solid var(--glass-rim);
  box-shadow: var(--glass-inner);
  animation: none;
}

/* == 22. THINKING + TOOLS ================================================= */
.think-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  align-self: stretch;
  gap: 0;
}
.msg-foot .think-pill.open {
  flex-basis: 100%;
  width: 100%;
  min-width: 0;
}
.think-head {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  min-width: 44px;
  padding: 9px 14px 9px 11px;
  border-radius: var(--r-full);
  background: var(--bg-surface);
  border: 1px solid var(--line);
  box-shadow: var(--glass-inner);
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--tx-2);
  transition: border-color 200ms var(--ease-out), transform 200ms var(--ease);
  box-sizing: border-box;
}
.think-head:active { transform: scale(0.97); }
.think-pill.live .think-head {
  border-color: rgba(var(--accent-rgb), 0.40);
  color: var(--tx);
}
.think-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 62vw; }
/* Live label: colour, not shimmer - the orb beside it carries the motion. */
.think-label.shimmer, .think-label.live-think {
  background: none;
  color: var(--accent-hi);
}
.think-caret { display: flex; color: var(--tx-4); transition: transform 260ms var(--ease-out); }
.think-pill.open .think-caret { transform: rotate(90deg); }
.think-pill .think-body { display: none; width: 100%; }
.think-pill.open .think-body { display: block; }
.think-body {
  margin-top: 9px;
  padding: 13px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--glass-rim);
  border-left: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner);
  color: var(--tx-2);
  font-size: 13.5px;
  line-height: 1.62;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: think-reveal 280ms var(--ease-out) both;
}
@keyframes think-reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Tool rows: one quiet glass chip per call; clusters fold into a card. */
.tool-run {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border-radius: var(--r-md);
  overflow: hidden;
}
.tool-run:empty { display: none; }
.tool-run:not(.cluster) { background: none; border: 0; box-shadow: none; overflow: visible; }
.tool-run.cluster {
  border: 1px solid var(--line);
  background: var(--bg-surface);
  box-shadow: var(--glass-inner);
}
.tool-run.cluster.live { border-color: rgba(var(--accent-rgb), 0.30); }
.tool-run .tool-run-body { display: none; }
.tool-run.open .tool-run-body { display: block; }
.tool-run-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  text-align: left;
  padding: 10px 14px;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--tx-2);
  transition: background-color 160ms var(--ease-out);
}
.tool-run-head:active { background: var(--bg-raised); }
.tool-run-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; letter-spacing: -0.01em; }
.tool-run-caret { display: flex; color: var(--tx-4); transition: transform 260ms var(--ease-out); }
.tool-run.open .tool-run-caret { transform: rotate(90deg); }
.tool-run-body {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-well) 55%, transparent);
  padding: 8px 12px;
  font-family: var(--f-mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--tx-3);
  max-height: 280px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.tool-row-wrap { display: flex; flex-direction: column; align-self: flex-start; max-width: 100%; min-width: 0; }
.tool-row-wrap .tool-chip { text-align: left; width: 100%; }
/* Tool call = a quiet mono row behind a 2px rail: ember while running, fading
   to hairline once it worked (the memory of it recedes). */
.tool-chip {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  min-width: 44px;
  padding: 9px 13px 9px 11px;
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: transparent;
  border: 0;
  border-left: 2px solid var(--line);
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--tx-2);
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
  transition: transform 200ms var(--ease), border-color 600ms var(--ease), background-color 150ms var(--ease);
}
.tool-chip.busy { border-left-color: var(--accent); }
.tool-chip:active { transform: scale(0.98); background: var(--bg-surface); }
.tool-run-body .tool-row-wrap { align-self: stretch; }
.tool-run-body .tool-chip {
  background: none; border: 0; box-shadow: none;
  border-radius: 10px;
  padding: 6px 4px; align-self: stretch;
  min-height: 40px;
}
.tool-chip .nm { font-family: var(--f-sans); font-weight: 550; letter-spacing: -0.01em; }
.tool-chip .sm { color: var(--tx-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-chip .ic { display: flex; color: var(--info); }
.tool-chip.done .ic { color: var(--ok); }
.tool-chip-caret {
  margin-left: auto;
  padding-left: 6px;
  color: var(--tx-4);
  font-size: 13px;
  line-height: 1;
  transition: transform 200ms var(--ease-out);
}
.tool-row-wrap.open > .tool-chip .tool-chip-caret { transform: rotate(90deg); }

.tool-detail {
  margin-top: 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--glass-rim);
  border-left: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner);
  padding: 10px 12px;
  max-width: 100%;
  min-width: 0;
  animation: think-reveal 220ms var(--ease-out);
}
.tool-detail-load { display: flex; align-items: center; gap: 8px; color: var(--tx-3); font-size: 12.5px; padding: 2px 0; }
.tool-detail-note { color: var(--tx-3); font-size: 12.5px; line-height: 1.5; }
.tool-detail-label {
  font-family: var(--f-sans);
  font-size: 10.5px;
  font-weight: 550;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--tx-4);
  margin: 8px 0 4px;
}
.tool-detail-label:first-child { margin-top: 0; }
.tool-detail-pre {
  font-family: var(--f-mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--tx-2);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  margin: 0;
  max-height: 300px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--bg-well);
  border: 1px solid var(--line);
}
[data-theme='aether'] .tool-detail-pre { background: #FBF8F3; }
.tool-detail-content.masked { display: none; }
.tool-detail-content.masked.revealed { display: block; }
.tool-detail-mask-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.tool-detail-mask-note { color: var(--warn); font-size: 12px; font-weight: 500; }
.tool-detail-reveal, .tool-detail-copy {
  min-height: 36px;
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-family: var(--f-sans);
  font-size: 12px;
  font-weight: 550;
  color: var(--tx-2);
  border: 1px solid var(--glass-rim);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner);
  transition: transform 160ms var(--ease-out);
}
.tool-detail-reveal:active, .tool-detail-copy:active { transform: scale(0.94); }
.tool-detail-copy[disabled] { color: var(--ok); opacity: 0.9; }
.tool-detail-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.tool-detail-trunc { margin-right: auto; color: var(--tx-4); font-size: 11px; font-style: italic; }

/* Message foot affordances */
.usage-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 12px;
  border-radius: var(--r-full);
  border: 1px solid var(--glass-rim);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner);
  color: var(--tx-3);
  font-family: var(--f-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  transition: transform 200ms var(--ease), color 160ms var(--ease-out);
}
.usage-chip:active { transform: scale(0.95); color: var(--tx); }
.usage-ic { display: flex; color: var(--tx-4); }
.usage-txt { min-width: 0; }
.usage-caret { display: flex; color: var(--tx-4); }
.err-tag {
  padding: 5px 12px;
  border-radius: var(--r-full);
  background: var(--danger-soft);
  color: var(--danger);
  font-family: var(--f-sans);
  font-size: 11.5px;
  font-weight: 550;
}
.msg-retry-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 5px 12px;
  border-radius: var(--r-full);
  font-family: var(--f-sans);
  font-size: 12px;
  font-weight: 550;
  color: var(--tx-2);
  background: transparent;
  border: 1px solid var(--line-strong);
  transition: transform 160ms var(--ease-out);
}
.msg-retry-btn:active { transform: scale(0.94); }
.msg-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  height: 44px;
  padding: 0 12px;
  margin: -11px -8px;
  border-radius: var(--r-full);
  color: var(--tx-4);
  font-size: 15px;
  line-height: 1;
  letter-spacing: 1px;
  border: 1px solid transparent;
  transition: color 160ms var(--ease-out), transform 160ms var(--ease-out);
  box-sizing: border-box;
}
.msg-more:active { color: var(--tx-2); transform: scale(0.9); }

/* Context + usage sheets */
.ctx-big-bar {
  height: 8px;
  border-radius: var(--r-full);
  background: var(--ring-track);
  box-shadow: inset 0 1px 1.5px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  margin: 10px 22px 0;
}
.ctx-big-bar i {
  display: block;
  height: 100%;
  min-width: 8px;
  border-radius: var(--r-full);
  background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.4), transparent 55%);
  transition: width 400ms var(--ease);
}
.ctx-big-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 8px 22px 4px; }
.ctx-big-pct { font-family: var(--f-mono); font-size: 14px; font-variant-numeric: tabular-nums; }
.ctx-big-used { font-size: 12px; color: var(--tx-3); font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.context-note { font-size: 12px; color: var(--tx-4); line-height: 1.5; margin: 6px 22px 0; }
.context-note.compact { margin-top: 4px; }
.usage-rows { display: flex; flex-direction: column; gap: 0; margin: 10px 18px 0; border: 1px solid var(--glass-rim); border-radius: var(--r-lg); background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2)); box-shadow: var(--glass-inner); overflow: hidden; }
.usage-row { padding: 12px 15px; border-top: 1px solid var(--line); }
.usage-row:first-child { border-top: 0; }
.usage-row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.usage-row-label { font-family: var(--f-sans); font-size: 13.5px; font-weight: 500; }
.usage-row-val { font-family: var(--f-mono); font-size: 13px; color: var(--tx); font-variant-numeric: tabular-nums; }
.usage-row-desc { font-size: 11.5px; color: var(--tx-4); margin-top: 3px; line-height: 1.45; }

/* Plan strip + banners */
.plan-strip {
  margin: 10px 18px 0;
  border-radius: var(--r-md);
  border: 1px solid var(--glass-rim);
  background:
    linear-gradient(180deg, var(--glass-hi), transparent 34%),
    linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner);
  overflow: hidden;
}
.plan-head {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 44px;
  text-align: left;
  padding: 10px 14px;
  font-family: var(--f-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--tx-2);
}
.plan-ic { display: flex; color: var(--accent); }
.plan-ic.done { color: var(--ok); }
.plan-count { font-family: var(--f-mono); font-size: 12px; color: var(--tx-3); font-variant-numeric: tabular-nums; }
.plan-current { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-current.live { color: var(--tx); }
.plan-caret { display: flex; color: var(--tx-4); transition: transform 200ms var(--ease); }
.plan-strip.open .plan-caret { transform: rotate(90deg); }
.plan-list { border-top: 1px solid var(--line); padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.plan-item { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--tx-2); }
.plan-item.done { color: var(--tx-4); text-decoration: line-through; }
.plan-item.active { color: var(--accent-hi); }
.plan-item-ic { display: flex; margin-top: 1px; flex-shrink: 0; }
.plan-item-txt { min-width: 0; word-break: break-word; }

.ask-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 18px 0;
}
.ask-banner-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 12px 15px;
  border-radius: var(--r-md);
  border: 1px solid color-mix(in srgb, var(--warn) 42%, var(--glass-rim));
  background:
    linear-gradient(180deg, var(--glass-hi), transparent 30%),
    linear-gradient(180deg, var(--warn-soft), transparent 75%),
    linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner), var(--sh-soft);
  text-align: left;
}
.ask-banner-dot {
  width: 9px;
  height: 9px;
  min-width: 9px;
  border-radius: var(--r-full);
  background: var(--warn);
  animation: warn-pulse 1800ms var(--ease) 1;
}
@keyframes warn-pulse { 50% { opacity: 0.35; } }
.ask-banner-txt { flex: 1; min-width: 0; font-size: 13.5px; color: var(--tx); font-weight: 550; }
.ask-banner-cta {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 7px 15px;
  border-radius: var(--r-full);
  background: var(--warn);
  color: #241A05;
  font-family: var(--f-sans);
  font-size: 12.5px;
  font-weight: 550;
  flex-shrink: 0;
}

.rl-banner {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin: 10px 18px 0;
}
.rl-banner-btn {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 50px;
  padding: 12px 15px;
  border-radius: var(--r-md);
  border: 1px solid color-mix(in srgb, var(--danger) 36%, var(--glass-rim));
  background:
    linear-gradient(180deg, var(--glass-hi), transparent 30%),
    linear-gradient(180deg, var(--danger-soft), transparent 75%),
    linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner), var(--sh-soft);
  text-align: left;
}
.rl-banner-ic { display: flex; color: var(--danger); margin-top: 1px; }
.rl-banner-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rl-banner-ttl { font-family: var(--f-sans); font-size: 14px; font-weight: 550; }
.rl-banner-sub { font-size: 12.5px; color: var(--tx-2); margin-top: 2px; line-height: 1.45; }
.rl-banner-cta {
  align-self: center;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  border: 1px solid var(--glass-rim);
  font-family: var(--f-sans);
  font-size: 12.5px;
  font-weight: 550;
  color: var(--tx);
  flex-shrink: 0;
}
.rl-banner-x {
  color: var(--tx-4);
  min-width: 44px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Agents (worker strip + sheet) */
.agents-badge {
  display: flex;
  align-items: center;
  gap: 9px;
  width: auto;
  margin: 10px 18px 0;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--glass-hi), transparent 42%), linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  border: 1px solid var(--glass-rim);
  box-shadow: var(--glass-inner);
  font-family: var(--f-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--tx-2);
  transition: border-color 160ms var(--ease);
}
.agents-badge.live { border-color: color-mix(in srgb, var(--accent) 38%, var(--glass-rim)); }
.agents-pulse {
  width: 9px;
  height: 9px;
  min-width: 9px;
  border-radius: var(--r-full);
  background: var(--accent);
}
.agents-run { color: var(--tx); font-variant-numeric: tabular-nums; }
.agents-lbl { flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agents-chev { display: flex; color: var(--tx-4); }

.agents-sheet-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-right: 18px;
}
.agents-sheet-title > div:first-child { min-width: 0; }
.agent-add {
  min-width: 64px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--glass-rim));
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent-hi);
  font-family: var(--f-sans);
  font-size: 13px;
  font-weight: 550;
}
.agents-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 18px 0;
}
.agent-card {
  border-radius: var(--r-md);
  border: 1px solid var(--glass-rim);
  background:
    linear-gradient(180deg, var(--glass-hi), transparent 28%),
    linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner);
  overflow: hidden;
}
.agent-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  text-align: left;
  padding: 12px 14px;
}
.agent-state {
  width: 9px;
  height: 9px;
  min-width: 9px;
  border-radius: 50%;
  background: var(--tx-4);
}
.agent-state.active { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.agent-state.done { background: var(--ok); }
.agent-main { flex: 1; min-width: 0; }
.agent-label {
  font-family: var(--f-sans);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-model {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--tx-3);
  font-family: var(--f-sans);
}
.agent-model-dot { width: 6px; height: 6px; border-radius: var(--r-full); box-shadow: 0 0 7px currentColor; flex-shrink: 0; }
.agent-model-txt { white-space: nowrap; }
.agent-sub { font-size: 12.5px; color: var(--tx-3); margin-top: 4px; }
.agent-summary {
  font-size: 13px;
  color: var(--tx-2);
  line-height: 1.5;
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}
.agent-caret { display: flex; color: var(--tx-4); transition: transform 200ms var(--ease); }
.agent-card.open .agent-caret { transform: rotate(90deg); }
.agent-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  padding: 0 12px 12px;
}
.agent-controls button {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--glass-rim);
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner);
  color: var(--tx-2);
  font-family: var(--f-sans);
  font-size: 12px;
  font-weight: 550;
}
.agent-controls button.danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 26%, var(--glass-rim)); }
.agent-controls button:disabled { opacity: 0.55; }
.agent-events { border-top: 1px solid var(--line); padding: 10px 14px; display: flex; flex-direction: column; gap: 7px; }
.agent-ev { display: flex; gap: 8px; font-size: 12px; }
.agent-ev-type {
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--tx-2);
  background: var(--bg-high);
  border-radius: 6px;
  padding: 1px 7px;
  align-self: flex-start;
  flex-shrink: 0;
}
.agent-ev-txt { color: var(--tx-3); word-break: break-word; min-width: 0; }
.agent-ev-empty { font-size: 12px; color: var(--tx-4); }
.worker-control-input {
  display: block;
  width: calc(100% - 36px);
  min-height: 112px;
  margin: 12px 18px 4px;
  padding: 13px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  outline: none;
  background: var(--bg-surface);
  color: var(--tx);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.45;
}
.worker-control-input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Jump to latest (reserved row above the composer) */
.jump-latest-wrap {
  position: relative;
  flex: 0 0 0;
  height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 11;
  overflow: visible;
  transition: height 200ms var(--ease-out), flex-basis 200ms var(--ease-out);
}
.jump-latest-wrap.show { flex-basis: 52px; height: 52px; }
.jump-latest {
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: var(--r-full);
  font-family: var(--f-sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--cta-ink);
  background: var(--cta);
  border: 0;
  box-shadow: var(--sh-float);
  opacity: 0;
  transform: translateY(14px) scale(0.9);
  transition: opacity 200ms var(--ease-out), transform 240ms var(--ease-out);
}
.jump-latest.show { opacity: 1; transform: scale(1); pointer-events: auto; }
.jump-latest:active { transform: scale(0.96); }
.jump-latest-ic { font-size: 13px; line-height: 1; }
@media (max-width: 520px) {
  .jump-latest { width: 44px; padding: 0; border-radius: 50%; }
  .jump-latest-label { display: none; }
}

/* Message action sheet */
.msg-sheet-preview {
  margin: 6px 22px 0;
  padding: 9px 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--glass-rim);
  background: var(--glass-fill-2);
  color: var(--tx-3);
  font-size: 12.5px;
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.msg-sheet-actions { display: flex; flex-direction: column; gap: 8px; padding: 14px 18px 4px; }
.msg-sheet-actions .sheet-action {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  width: 100%;
}
.msg-sheet-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--tx-2);
  background: var(--bg-high);
}
.msg-edit-ta {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-surface);
  color: var(--tx);
  font-size: 16px;
  line-height: 1.5;
  padding: 11px 13px;
}
.msg-edit-ta:focus { outline: none; border-color: var(--tx-3); }

/* Stop-after-tool armed badge on the send control */
.comp-send.stop.stop-after { position: relative; }
.comp-send.stop.stop-after::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--warn);
  border: 2px solid var(--bg-surface);
  box-shadow: 0 0 8px color-mix(in srgb, var(--warn) 70%, transparent);
}

/* Composer "+" capability menu */
.sheet-action.plus-attach {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 12px 18px 0;
  min-height: 64px;
  padding: 14px 16px;
  text-align: left;
  border-radius: var(--r-md);
  background: var(--bg-raised);
  border: 1px solid var(--line);
}
.sheet > .sheet-action.plus-attach { margin: 12px 18px 0; }
.plus-attach-ic {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 13px; flex: none;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.plus-attach-ic svg { width: 20px; height: 20px; }
.plus-attach-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.plus-attach-title { font-family: var(--f-sans); font-size: 15px; font-weight: 550; color: var(--tx); letter-spacing: -0.01em; }
.plus-attach-sub { font-size: 12px; color: var(--tx-4); }
.plus-cap-body {
  max-height: 46vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 4px;
}

/* Per-session access */
.access-load, .access-empty { text-align: center; padding: 34px 24px; }
.access-empty-t { font-family: var(--f-sans); font-size: 16px; font-weight: 550; color: var(--tx); }
.access-empty-s { font-size: 13px; color: var(--tx-4); margin-top: 6px; line-height: 1.5; }
.access-sec {
  margin: 12px 14px;
  padding: 4px 4px 8px;
  border-radius: var(--r-md);
  border: 1px solid var(--glass-rim);
  background:
    linear-gradient(180deg, var(--glass-hi), transparent 26%),
    linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner);
}
.access-sec-head { display: flex; align-items: center; gap: 9px; padding: 12px 12px 8px; }
.access-sec-ic {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 9px; flex: none;
  background: var(--bg-high); color: var(--tx-2);
}
.access-sec-title { flex: 1; font-family: var(--f-sans); font-size: 14px; font-weight: 550; color: var(--tx); letter-spacing: -0.01em; }
.access-sec-count {
  font-family: var(--f-mono); font-size: 11px; color: var(--tx-4);
  padding: 2px 8px; border-radius: var(--r-full);
  background: var(--bg-high);
}
.access-note { font-size: 12px; color: var(--tx-4); padding: 0 12px 8px; line-height: 1.45; }
.access-list { display: flex; flex-direction: column; }
.access-row {
  display: flex; align-items: center; gap: 12px;
  min-height: 52px;
  padding: 10px 12px; margin: 0;
  border: 0; border-top: 1px solid var(--line);
  border-radius: 0; box-shadow: none; background: none;
}
.access-list .access-row:first-child { border-top: 0; }
.access-row.unavail { opacity: 0.5; }
.access-row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.access-row-name { font-family: var(--f-sans); font-size: 14px; font-weight: 500; color: var(--tx); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.access-row-detail { font-size: 12px; color: var(--tx-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.access-viewonly {
  font-family: var(--f-sans); font-size: 10.5px; font-weight: 550;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--tx-4);
  padding: 4px 10px; border-radius: var(--r-full);
  background: var(--bg-high);
  flex: none;
}
.access-toggle {
  position: relative; flex: none;
  width: 50px; height: 30px; border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--ring-track);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: background-color 260ms var(--ease-out), border-color 260ms var(--ease-out);
}
.access-toggle .access-knob {
  position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  transition: transform 260ms var(--ease-out);
}
.access-toggle.on { background: var(--ok); border-color: var(--ok); box-shadow: none; }
.access-toggle.on .access-knob { transform: translateX(20px); }
.access-toggle.busy { opacity: 0.6; }
.cap-group { margin: 6px 14px; padding: 0; }
.plus-cap-body .access-sec.cap-group { background: none; border: 0; box-shadow: none; }
.cap-group-head {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 50px;
  padding: 10px 12px; margin: 0;
  border: 1px solid var(--glass-rim);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--glass-hi), transparent 40%), linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  box-shadow: var(--glass-inner);
  text-align: left;
  cursor: pointer;
  transition: background-color 160ms var(--ease);
}
.cap-group.open .cap-group-head { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.cap-group-sum {
  flex: none;
  font-family: var(--f-mono); font-size: 11px; color: var(--tx-4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 40%;
}
.cap-group-caret { display: flex; flex: none; color: var(--tx-4); transition: transform 200ms var(--ease); }
.cap-group-caret svg { width: 14px; height: 14px; }
.cap-group.open .cap-group-caret { transform: rotate(90deg); }
.cap-group .access-list {
  border: 1px solid var(--glass-rim); border-top: 0;
  border-radius: 0 0 var(--r-md) var(--r-md);
  padding: 0 4px;
  background: linear-gradient(180deg, var(--glass-fill-2), var(--glass-fill-2));
}

/* == 23. COMPOSER ========================================================= */
.composer {
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  padding: 10px 14px calc(var(--safe-b) + 22px);
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
/* THE one ember bloom in the app: static ambient warmth anchored behind the
   composer. 6% alpha, never animated, no second gradient anywhere. */
.composer::before {
  content: '';
  position: absolute;
  inset: -40px 0 0 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(120% 90% at 50% 100%, var(--ember-wash), transparent 60%);
}
.composer > * { position: relative; z-index: 1; }

/* Quick prompt chips */
.qa-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 2px;
  mask-image: linear-gradient(90deg, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 92%, transparent);
}
.qa-chips::-webkit-scrollbar { display: none; }
.qa-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 16px;
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--glass-hi), transparent 46%), linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  border: 1px solid var(--glass-rim);
  box-shadow: var(--glass-inner);
  font-family: var(--f-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--tx-2);
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 140ms var(--ease), border-color 140ms var(--ease);
}
.qa-chip:active { transform: scale(0.94); border-color: var(--tx); color: var(--tx); }

/* Queued messages */
.queue-chips { display: flex; flex-direction: column; gap: 6px; }
.queue-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--r-md);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--tx);
}
.qc-ic { display: flex; color: var(--tx-2); flex-shrink: 0; }
.qc-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qc-att { color: var(--tx-3); font-size: 11.5px; flex-shrink: 0; }
.queue-preview { font-size: 12px; color: var(--tx-3); }

/* Attachment tray */
.att-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.att-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px 7px 12px;
  border-radius: var(--r-full);
  background: linear-gradient(180deg, var(--glass-fill), var(--glass-fill-2));
  border: 1px solid var(--glass-rim);
  box-shadow: var(--glass-inner);
  font-size: 12.5px;
  color: var(--tx-2);
  max-width: 220px;
}
.att-chip img {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  object-fit: cover;
}
.att-chip .att-file { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.att-file-ext {
  flex: none;
  padding: 4px 6px;
  border-radius: 7px;
  background: var(--bg-high);
  color: var(--tx-2);
  font-family: var(--f-mono);
  font-size: 9.5px;
  font-weight: 550;
  letter-spacing: 0.04em;
}
.att-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
.att-x {
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-high);
  color: var(--tx-3);
  position: relative;
}
.att-x::before { content: ''; position: absolute; inset: -9px; border-radius: var(--r-full); }

/* The field: a floating rounded slab - flat fill, hairline rim, big soft
   corners - never blurred (the composer is the hot path). Focus sharpens the
   rim to ink; no colored bloom. */
.comp-row {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  min-height: 54px;
  background: var(--bg-surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  padding: 7px;
  box-shadow: var(--sh-card);
  position: relative;
  isolation: isolate;
  overflow: hidden;
}
.comp-row > * { position: relative; z-index: 1; }
.comp-row:focus-within {
  border-color: var(--tx-3);
  box-shadow: 0 0 0 3px rgba(245, 245, 243, 0.06), var(--sh-card);
}
.att-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-raised);
  color: var(--tx-2);
  transition: transform 150ms var(--ease);
  position: relative;
}
.att-btn::before { content: ''; position: absolute; inset: -4px; border-radius: var(--r-full); }
.att-btn:active { transform: scale(0.9); }
.comp-field { flex: 1; min-width: 0; display: flex; align-items: center; }
.comp-input {
  width: 100%;
  border: 0;
  background: none;
  resize: none;
  font-size: 16px; /* stops iOS auto-zoom */
  line-height: 1.45;
  color: var(--tx);
  max-height: 132px;
  padding: 9px 4px;
  font-family: var(--f-body);
}
.comp-input:focus { outline: none; }
.comp-input::placeholder { color: var(--tx-4); }
.comp-send {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: var(--cta);
  color: var(--cta-ink);
  flex-shrink: 0;
}
.comp-send:active { transform: scale(0.9); }
.comp-send[disabled] { opacity: 0.4; box-shadow: none; }
.comp-send.stop {
  background: var(--danger-soft);
  border: 1.5px solid color-mix(in srgb, var(--danger) 55%, transparent);
  color: var(--danger);
  box-shadow: none;
}

/* Steer | Queue segmented toggle */
.comp-stream-tools {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}
.cst-label { padding: 0 2px 0 6px; }

/* == 24. MISC + RESPONSIVE ================================================ */
.apex-mark, .apex-tile { display: flex; }
.tb { display: flex; align-items: center; gap: 8px; }
.ln { border-top: 1px solid var(--line); margin: 10px 0; }
.rejected { opacity: 0.55; text-decoration: line-through; }
.scrolled { box-shadow: var(--sh-soft); }
.view:not(.browser-bar) { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.nm { font-family: var(--f-sans); font-weight: 550; }
.pg-l { color: var(--tx-3); }
.pg-n { font-family: var(--f-mono); }
.compact { padding: 8px 12px; }
.cluster:not(.tool-run) { display: flex; align-items: center; gap: 8px; }

@media (min-width: 560px) {
  .deck-body { max-width: 620px; margin: 0 auto; width: 100%; }
  .deck-dock { left: auto; right: 24px; width: 58px; transform: none; }
  .composer { max-width: 760px; margin: 0 auto; width: 100%; }
  .sheet { max-width: 620px; left: 50%; transform: translateX(-50%); border-radius: 28px 28px 0 0; }
  .sheet.leaving { transform: translateX(-50%); }
}
@media (min-width: 900px) {
  .chat-body .thread, .chat-thread { max-width: 820px; margin-left: auto; margin-right: auto; }
}
@media (max-width: 350px) {
  .deck-topbar, .now-inbox, .deck-empty { margin-left: 14px; margin-right: 14px; }
  .deck-label { padding-left: 14px; padding-right: 14px; }
  .now-copy h1 { font-size: 24px; line-height: 32px; }
  .deck-dock { right: 14px; left: auto; }
  .row { padding-left: 14px; padding-right: 14px; }
  .ask-band { padding-left: 14px; padding-right: 14px; }
}

@media (prefers-reduced-transparency: reduce) {
  .deck-dock,
  .hdr,
  .deck-smallbar,
  .sheet,
  .drawer,
  .comp-row {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background: var(--bg-surface) !important;
  }
}

/* Reduced-motion: decorative loops stop; entrances become instant. The final
   grouped rule below also covers the theme prism layer (static anyway). */
@media (prefers-reduced-motion: reduce) {
  [data-theme='aether'] body::before,
  .row-pulse-none { animation: none !important; }
  .screen, .screen.is-sub, .stagger > *, .bubble { animation-duration: 1ms !important; }
  .screen.nav-push, .screen.nav-pop, .screen.nav-exit-left, .screen.nav-exit-right,
  .screen.nav-exit-left::after, .screen.nav-pop::after { animation: none !important; }
  .sheet, .sheet.leaving, .sheet-scrim, .toast, .think-body, .tool-detail, .browser-tab { animation-duration: 1ms !important; }
  .drawer, .drawer-scrim, .deck-smallbar, .jump-latest { transition-duration: 1ms !important; }
  .shimmer, .skel .sq, .skel .b, .browser-tab.skeleton, .think-label.live-think { animation: none !important; }
  .app-error-banner { animation: none; }
  .pa-device-pulse, .proto-dot, .um-fill { animation: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  .row-tile .dot,
  .row-tile .dot[data-state='working'],
  .cursor,
  .spin,
  .btn-spin,
  .upd-spin,
  .proto-spin,
  .grok-gen-spin,
  .agents-pulse,
  .ask-banner-dot,
  .elxr-doing-dot.working,
  .chat-id-dot.busy,
  .chat-id-dot[data-state='working'],
  .tool-chip.busy .ic {
    animation: none !important;
  }
}

/* ==========================================================================
   QUIET COMPOSER STATE + FOCUS DISCIPLINE
   ========================================================================== */

/* One quiet physical composer. State lives in the action button and the copy,
   never in decorative motion: steer tints the send control toward info, queue
   toward amber, stop toward danger; pending dims it. (No animation here.) */
.composer[data-composer-state='stop'] .comp-row { border-color: var(--glass-rim-strong); }
.composer[data-composer-state='stop'] .comp-send { border-radius: 15px; background: var(--danger-soft); color: var(--danger); }
.composer[data-composer-state='steer'] .comp-send { background: var(--info-soft); color: var(--info); box-shadow: none; }
.composer[data-composer-state='queue'] .comp-send { background: var(--warn-soft); color: var(--warn); box-shadow: none; }
.composer[data-composer-state='pending'] .comp-send { transform: scale(0.9); opacity: 0.7; }

button:focus-visible,
[role='button']:focus-visible,
textarea:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(245, 245, 243, 0.55);
  outline-offset: 2px;
}
/* P3 LIQUID GLASS STATUS: BEGIN */
.liquid-glass-status {
  --liquid-glass-tone: var(--accent);
  --liquid-glass-success: var(--ok);
  --liquid-glass-warning: var(--warn);
  --liquid-glass-info: var(--info);
  --liquid-glass-danger: var(--danger);
  --liquid-glass-muted: var(--tx-3);
  --liquid-glass-surface: var(--bg-raised);
  --liquid-glass-depth: var(--bg-well);
  --liquid-glass-highlight: var(--tx);
  --liquid-glass-speed: 5.8s;
  --liquid-glass-energy: .72;
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  min-width: 20px;
  overflow: hidden;
  isolation: isolate;
  contain: layout paint;
  border: 1px solid color-mix(in srgb, var(--liquid-glass-tone) 34%, var(--line-strong));
  border-radius: 46% 54% 51% 49% / 52% 47% 53% 48%;
  background:
    radial-gradient(120% 120% at 31% 24%,
      color-mix(in srgb, var(--liquid-glass-highlight) 52%, transparent) 0 4%,
      color-mix(in srgb, var(--liquid-glass-highlight) 14%, transparent) 14%,
      transparent 34%),
    radial-gradient(90% 90% at 72% 82%, color-mix(in srgb, var(--liquid-glass-tone) 34%, transparent) 0 10%, transparent 58%),
    radial-gradient(140% 140% at 50% 118%, color-mix(in srgb, var(--liquid-glass-tone) 18%, transparent) 0 22%, transparent 60%),
    linear-gradient(137deg,
      color-mix(in srgb, var(--liquid-glass-tone) 26%, var(--liquid-glass-surface)),
      color-mix(in srgb, var(--liquid-glass-highlight) 6%, var(--liquid-glass-surface)) 46%,
      color-mix(in srgb, var(--liquid-glass-tone) 16%, var(--liquid-glass-depth)));
  box-shadow:
    inset 0 1px 1px color-mix(in srgb, var(--liquid-glass-highlight) 34%, transparent),
    inset 0 -2px 3px color-mix(in srgb, var(--liquid-glass-depth) 55%, transparent),
    inset 2px 3px 6px color-mix(in srgb, var(--liquid-glass-highlight) 10%, transparent),
    inset -3px -4px 9px color-mix(in srgb, var(--liquid-glass-tone) 16%, transparent),
    0 1px 2px color-mix(in srgb, var(--liquid-glass-depth) 40%, transparent),
    0 5px 14px color-mix(in srgb, var(--liquid-glass-depth) 26%, transparent),
    0 0 10px color-mix(in srgb, var(--liquid-glass-tone) 10%, transparent);
  opacity: var(--liquid-glass-energy);
  pointer-events: none;
  vertical-align: middle;
}
.liquid-glass-status-compact { width: 16px; height: 16px; min-width: 16px; }
.liquid-glass-status-hero {
  width: 58px;
  height: 58px;
  min-width: 58px;
  box-shadow:
    inset 0 2px 2px color-mix(in srgb, var(--liquid-glass-highlight) 36%, transparent),
    inset 0 -4px 7px color-mix(in srgb, var(--liquid-glass-depth) 58%, transparent),
    inset 5px 7px 14px color-mix(in srgb, var(--liquid-glass-highlight) 10%, transparent),
    inset -7px -9px 20px color-mix(in srgb, var(--liquid-glass-tone) 17%, transparent),
    0 2px 4px color-mix(in srgb, var(--liquid-glass-depth) 42%, transparent),
    0 13px 30px color-mix(in srgb, var(--liquid-glass-depth) 30%, transparent),
    0 0 22px color-mix(in srgb, var(--liquid-glass-tone) 10%, transparent);
}
.liquid-glass-status::before {
  content: '';
  position: absolute;
  inset: -34%;
  border-radius: 58% 42% 46% 54% / 43% 57% 41% 59%;
  background:
    radial-gradient(26% 22% at 34% 36%,
      color-mix(in srgb, var(--liquid-glass-highlight) 88%, transparent) 0 16%,
      color-mix(in srgb, var(--liquid-glass-highlight) 30%, transparent) 46%,
      transparent 74%),
    radial-gradient(52% 46% at 66% 63%, color-mix(in srgb, var(--liquid-glass-tone) 44%, transparent) 0 16%, transparent 62%),
    linear-gradient(118deg, transparent 30%,
      color-mix(in srgb, var(--liquid-glass-highlight) 22%, transparent) 44%,
      color-mix(in srgb, var(--liquid-glass-tone) 26%, transparent) 58%,
      transparent 74%);
  filter: blur(0.5px);
  mix-blend-mode: screen;
  opacity: .58;
  transform: translate3d(-16%, 9%, 0) rotate(-12deg) scale(.9);
  transform-origin: center;
  animation: none;
  will-change: auto;
}
.liquid-glass-status[data-motion-phase='idle'] { --liquid-glass-energy: .42; }
.liquid-glass-status[data-motion-phase='queued'] { --liquid-glass-speed: 7.2s; --liquid-glass-energy: .58; }
.liquid-glass-status[data-motion-phase='thinking'] { --liquid-glass-speed: 5.8s; --liquid-glass-energy: .78; }
.liquid-glass-status[data-motion-phase='tool'],
.liquid-glass-status[data-motion-phase='browser'] { --liquid-glass-speed: 3.4s; --liquid-glass-energy: .94; }
.liquid-glass-status[data-motion-phase='streaming'] { --liquid-glass-tone: var(--liquid-glass-success); --liquid-glass-speed: 4.4s; --liquid-glass-energy: .88; }
.liquid-glass-status[data-motion-phase='compaction'] { --liquid-glass-tone: var(--liquid-glass-warning); --liquid-glass-speed: 6.6s; --liquid-glass-energy: .76; }
.liquid-glass-status[data-motion-phase='steered'] { --liquid-glass-tone: var(--liquid-glass-info); --liquid-glass-speed: 4.8s; --liquid-glass-energy: .84; }
.liquid-glass-status[data-motion-phase='done'] { --liquid-glass-tone: var(--liquid-glass-success); --liquid-glass-energy: .62; }
.liquid-glass-status[data-motion-phase='error'] { --liquid-glass-tone: var(--liquid-glass-danger); --liquid-glass-energy: .82; }
.liquid-glass-status[data-motion-phase='stopped'] { --liquid-glass-tone: var(--liquid-glass-muted); --liquid-glass-energy: .48; }
.liquid-glass-status:is(
  [data-motion-phase='queued'],
  [data-motion-phase='thinking'],
  [data-motion-phase='tool'],
  [data-motion-phase='browser'],
  [data-motion-phase='streaming'],
  [data-motion-phase='compaction'],
  [data-motion-phase='steered']
):not([data-motion-static='true'])::before {
  animation: liquid-glass-refraction var(--liquid-glass-speed) var(--ease-out) infinite alternate;
  will-change: transform, opacity;
}
.liquid-glass-status[data-motion-phase='idle']::before,
.liquid-glass-status[data-motion-phase='done']::before,
.liquid-glass-status[data-motion-phase='error']::before,
.liquid-glass-status[data-motion-phase='stopped']::before,
.liquid-glass-status[data-motion-static='true']::before {
  animation: none;
  opacity: .52;
  transform: translate3d(6%, -3%, 0) rotate(10deg) scale(1.01);
  will-change: auto;
}
:root[data-motion-paused='true'] .liquid-glass-status::before,
.liquid-glass-status[data-motion-paused='true']::before {
  animation-play-state: paused !important;
  will-change: auto;
}
.working-status {
  min-height: 20px;
  padding: 1px 2px;
}
.composer .comp-row {
  animation: none !important;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.composer .comp-send {
  animation: none !important;
  transition: background-color 140ms var(--ease), color 140ms var(--ease), transform 120ms var(--ease), opacity 140ms var(--ease);
}
.composer .comp-row::before,
.composer .comp-row::after,
.composer .comp-send::before,
.composer .comp-send::after {
  animation: none !important;
}
@keyframes liquid-glass-refraction {
  0% { transform: translate3d(-17%, 10%, 0) rotate(-14deg) scale(.88); opacity: .34; }
  42% { transform: translate3d(3%, -4%, 0) rotate(3deg) scale(1.05); opacity: .78; }
  100% { transform: translate3d(19%, -12%, 0) rotate(18deg) scale(1.08); opacity: .58; }
}
@media (prefers-reduced-motion: reduce) {
  .liquid-glass-status::before {
    animation: none !important;
    transform: translate3d(6%, -3%, 0) rotate(10deg) scale(1.01);
    opacity: .56;
    will-change: auto !important;
  }
  .composer .comp-row,
  .composer .comp-send {
    transition-duration: 1ms !important;
  }
}
@media (forced-colors: active) {
  .liquid-glass-status {
    border: 2px solid CanvasText;
    background: Canvas;
    box-shadow: none;
    opacity: 1;
  }
  .liquid-glass-status::before {
    display: none;
    will-change: auto;
  }
}
/* P3 LIQUID GLASS STATUS: END */

/* Theme-tuned glass-bead material (look-only; the pinned block above owns
   phase semantics + motion). Dusk warms the internal highlight; Dawn gives the
   bead a porcelain body so it reads as glass in daylight. */
.liquid-glass-status { --liquid-glass-highlight: #FFF3E4; }
/* EMBER: on the darker ink field the hero bead's wide drop shadows read as a
   dark box. Keep its inset modelling, drop the outset blob (look-only). */
.liquid-glass-status-hero {
  box-shadow:
    inset 0 2px 2px color-mix(in srgb, var(--liquid-glass-highlight) 36%, transparent),
    inset 0 -4px 7px color-mix(in srgb, var(--liquid-glass-depth) 58%, transparent),
    inset 5px 7px 14px color-mix(in srgb, var(--liquid-glass-highlight) 10%, transparent),
    inset -7px -9px 20px color-mix(in srgb, var(--liquid-glass-tone) 17%, transparent),
    0 1px 2px rgba(0, 0, 0, 0.35);
}
[data-theme='aether'] .liquid-glass-status {
  --liquid-glass-highlight: #FFFFFF;
  --liquid-glass-surface: #FFFFFF;
  --liquid-glass-depth: #CDBFAC;
  border-color: rgba(255, 255, 255, 0.9);
}

/* ==========================================================================
   EMBER INSTRUMENT COMPONENTS (look-only; added 2026-08-08)
   The shared 180-degree arc gauge - one meter language for the chat header
   (40px) and the usage screen (72px), where a measurement has room to mean
   something. Never in the session list. Fill: ember to 80%, warn to 92%,
   stop past it. Plus the row-size state orb for WORKING rows.
   ========================================================================== */
.liquid-glass-status-row { width: 28px; height: 28px; min-width: 28px; }

.arc { position: relative; display: inline-flex; flex-direction: column; align-items: center; }
.arc-svg { display: block; width: 100%; height: auto; }
.arc-track { stroke: var(--track); }
.arc-tick { stroke: var(--tx-4); stroke-width: 2; }
.arc-fill, .ring-prog { transition: stroke-dashoffset 420ms var(--ease); }

/* Usage: one gauge per measured window - t-figure percentage in the mouth of
   the arc, endpoint ticks carrying the window label and the live reset
   countdown in mono micro. Same component as the rows, at 72px. */
.uarc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px 10px;
  padding: 10px 0 4px;
}
.uarc { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.uarc .arc { width: 72px; }
.uarc-pct {
  margin-top: -26px;
  font-family: var(--f-mono);
  font-size: 17px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  color: var(--tx);
  line-height: 1;
}
.uarc-pct .u { font-size: 10px; color: var(--tx-3); }
.uarc-label {
  margin-top: 8px;
  font-family: var(--f-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--tx-2);
  text-align: center;
}
.uarc-reset {
  margin-top: 2px;
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--tx-4);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.uarc.rejected .uarc-pct { color: var(--danger); }

/* Chat header context gauge reuses the same arc inside the 44px button. */
.ctx-ring .arc { width: 38px; }
.ctx-ring .arc-tick { display: none; }
