* { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    /* Max width of the chat column (messages + composer). Per-device preference,
       set by the Appearance panel via localStorage; 100% = fill the pane. The cap
       is applied as horizontal PADDING on the scroll container so the scrollbar
       stays on the pane's right edge instead of hugging the narrowed content.
       900px matches themes.js _CHAT_W_DEFAULT so first paint = unset default. */
    --sp-chat-max-w: 900px;
    --sp-bg: #0d1117;
    --sp-surface: #161b22;
    --sp-border: #30363d;
    --sp-border-bright: #484f58;
    --sp-panel: #21262d;
    --sp-accent: #58a6ff;
    --sp-accent-dim: rgba(88, 166, 255, 0.35);
    --sp-text: #e6edf3;
    --sp-text-dim: #9ab0c8;
    --sp-success: #3fb950;
    --sp-danger: #f85149;
    --sp-warn: #d29922;
    /* Status tints (badge backgrounds, dot glows), 15% like --sp-accent-dim.
       Defined here once, they follow whichever theme palette is active. Until
       2026-11 they were read but never defined, so those tints were missing. */
    --sp-success-dim: color-mix(in srgb, var(--sp-success) 15%, transparent);
    --sp-danger-dim: color-mix(in srgb, var(--sp-danger) 15%, transparent);
    --sp-warn-dim: color-mix(in srgb, var(--sp-warn) 15%, transparent);
    --sp-purple: #a78bfa;   /* the "memory" status dot */
    --sp-font-mono: 'JetBrains Mono', Consolas, monospace;
    /* The Linux VM terminal stays dark in every theme (xterm's 16 ANSI colours
       are made for a dark ground) but neutral, not the old blue-black #0d1117. */
    --sp-terminal-bg: #1d1d1b;
    /* Scrollbars get their own token so a theme with hard black borders
       (clear) does not also get hard black scrollbars. */
    --sp-scrollbar: rgba(255,255,255,0.14);
    --sp-scrollbar-hover: rgba(255,255,255,0.32);
    /* -- Icon rail ---------------------------------------------------------
       The rail is its own plane, one step away from the panel, and is styled
       ONLY through these tokens + the .rail-* classes -- no per-theme
       .files-open-btn or .sidebar-collapse-btn override reaches into it. Dark
       themes deepen the surface; Light sets its own soft grey (the
       "light" block). Each colour token declares a static fallback first, for
       browsers without color-mix(). */
    --rail-w: 46px;
    --sp-rail: #0a0d12;
    --sp-rail: color-mix(in srgb, var(--sp-surface, #161b22) 62%, #000);
    --sp-rail-border: var(--sp-border, #30363d);
    --sp-rail-ink: var(--sp-text-dim, #9ab0c8);
    --sp-rail-ink-hot: var(--sp-accent, #58a6ff);
    --sp-rail-hot-bg: rgba(255,255,255,0.07);
    --sp-rail-hot-bg: color-mix(in srgb, var(--sp-accent, #58a6ff) 15%, transparent);
  }
  /* ── Theme palettes ──────────────────────────────────────────────────────
     Each theme's colours, fixed. (Until 2026-11 themes.js injected these at
     runtime and let users override them with colour pickers; both are gone.)
     :root[data-theme] outranks the [data-theme] blocks further down, so these
     tokens are the single source of truth. --sp-accent-dim = accent at 15%;
     --sp-accent-neg = the accent with its hue turned 180deg. */
  :root[data-theme="light"] {
    --sp-bg: #ffffff;
    --sp-surface: #f6f8fa;
    --sp-panel: #eaeef2;
    --sp-accent: #5a8f1c;   /* moss lime: 3.9:1 on white (the brand olive #93a332 was 2.8:1; sky blue #85c4f0 before that) */
    --sp-text: #1f2328;
    --sp-text-dim: #656d76;
    --sp-border: #d0d7de;
    --sp-border-bright: #b0b7be;
    --sp-success: #1f883d;
    --sp-danger: #cf222e;
    --sp-warn: #9a6700;
    --sp-accent-dim: rgba(90,143,28,0.15);
    --sp-accent-neg: #511c8f;
  }
  :root[data-theme="olive"] {
    --sp-bg: #1D1D1B;
    --sp-surface: #21211e;
    --sp-panel: #242422;
    --sp-accent: #93a332;
    --sp-text: #FAF9F2;
    --sp-text-dim: #BEBDB2;
    --sp-border: rgba(150,149,139,0.12);
    --sp-border-bright: rgba(150,149,139,0.2);
    --sp-success: #6C9E2C;
    --sp-danger: #D8504A;
    --sp-warn: #C9A25A;
    --sp-accent-dim: rgba(147,163,50,0.15);
    --sp-accent-neg: #4232a3;
  }
  :root[data-theme="aurora"] {
    --sp-bg: #0b0c0b;
    --sp-surface: #141613;
    --sp-panel: #1b1e1a;
    --sp-accent: #9be7c4;    /* mint */
    --sp-accent-2: #c2e070;  /* lime: brand brackets, gradient starts */
    --sp-text: #f1f3ef;
    --sp-text-dim: #a8ada3;
    --sp-border: rgba(255,255,255,0.09);
    --sp-border-bright: rgba(255,255,255,0.16);
    --sp-success: #7fd99a;
    --sp-danger: #ff7b72;
    --sp-warn: #e3b45c;
    --sp-accent-dim: rgba(155,231,196,0.15);
    --sp-accent-neg: #e79bbe;
  }
  :root[data-theme="aurora-light"] {
    --sp-bg: #eaeee5;        /* green-tinted grey ground */
    --sp-surface: #fbfcf9;
    --sp-panel: #f1f4ed;
    --sp-accent: #23936b;    /* deep mint: 4.1:1 on white */
    --sp-accent-2: #7aa51f;  /* lime: brand brackets, gradient starts */
    --sp-text: #1b1f1a;
    --sp-text-dim: #5f665c;
    --sp-border: rgba(60,80,40,0.10);
    --sp-border-bright: rgba(60,80,40,0.18);
    --sp-success: #2f8f4e;
    --sp-danger: #c9423a;
    --sp-warn: #a8781a;
    --sp-accent-dim: rgba(35,147,107,0.14);
    --sp-accent-neg: #932348;
  }
  [data-theme="light"] .mobile-header .brand .bracket { color: var(--sp-accent); }
  [data-theme="light"] {
    --sp-scrollbar: rgba(0,0,0,0.12);
    --sp-scrollbar-hover: rgba(0,0,0,0.30);
    /* Light: a soft grey rail, one step darker than the chat list (#f6f8fa),
       with grey icons that turn moss on hover. (Until 2026-11 it inverted to
       the near-black text colour.) */
    --sp-rail: #eef1f4;
    --sp-rail-border: var(--sp-border);
    --sp-rail-ink: var(--sp-text-dim);
    --sp-rail-ink-hot: var(--sp-accent);
    --sp-rail-hot-bg: color-mix(in srgb, var(--sp-accent) 12%, transparent);
  }
  /* Light: user bubbles run from the moss accent to a brighter lime, with a
     soft accent glow. */
  [data-theme="light"] .user .bubble {
    background: linear-gradient(135deg, var(--sp-accent), #9cc93f);
    color: #fff;
    border-radius: 18px 18px 6px 18px;
    font-weight: 500;
    box-shadow: 0 4px 16px color-mix(in srgb, var(--sp-accent) 20%, transparent);
  }
  [data-theme="light"] .user::before { background: color-mix(in srgb, var(--sp-accent) 10%, transparent); transform: translate(3px, 3px); }
  body {
    font: 14px -apple-system, system-ui, 'Segoe UI', sans-serif;
    background: var(--sp-bg);
    color: var(--sp-text);
    height: 100vh;
    display: flex;
  }
  aside {
    width: var(--sidebar-width, 300px);
    padding: 1rem 0rem 0rem 1rem;
    background: var(--sp-surface);
    border-right: 1px solid var(--sp-border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: scroll;
    overflow-x: hidden;
    position: relative;
    z-index: 2;
  }

  /* Resize handle for the sidebar */
  .sidebar-resize-handle {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 4px;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
    transition: background 0.15s;
    /* Sensible default before JS positions it on the right edge of <aside>.
       JS measures getBoundingClientRect(), so it already clears the rail. */
    left: calc(var(--rail-w, 46px) + var(--sidebar-width, 300px) - 2px);
  }
  .sidebar-resize-handle:hover,
  .sidebar-resize-handle.active {
    background: var(--sp-accent);
  }
  /* When sidebar is collapsed, hide the handle */
  aside.collapsed + .sidebar-resize-handle {
    display: none;
  }



  /* Scrollbars — quiet native style (default for all scrollables).
     4px translucent thumb that FADES IN when its container is hovered/focused
     and fades back out when it isn't. scrollbar-color is animatable in modern
     Chromium/Firefox, so the fade is a plain CSS transition — no JS. Colour
     comes from --sp-scrollbar, never from --sp-border. */
  html { scrollbar-width: thin; scrollbar-color: var(--sp-scrollbar) transparent; }
  ::-webkit-scrollbar { width: 4px; height: 4px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--sp-scrollbar); border-radius: 2px; }
  ::-webkit-scrollbar-thumb:hover,
  ::-webkit-scrollbar-thumb:active { background: var(--sp-scrollbar-hover); }
  ::-webkit-scrollbar-corner { background: transparent; }

  /* Fade: idle = barely-there (alpha 0.05), hover/focus-within = full token.
     transition on scrollbar-color animates the thumb+track color pair. */
  * {
    scrollbar-color: rgba(127,127,127,0.05) transparent;
    transition: scrollbar-color 0.35s ease;
  }
  *:hover, *:focus-within {
    scrollbar-color: var(--sp-scrollbar) transparent;
  }
  aside:hover, aside:focus-within,
  .conv-host:hover, .conv-host:focus-within {
    scrollbar-color: var(--sp-scrollbar-hover) transparent;
  }
  @media (prefers-reduced-motion: reduce) {
    * { transition: none; }
  }

  /* Sidebar: hidden scrollbar + shadow + chevron hints */
  aside input[type="color"] { padding: 0; }
  aside input, aside button:not(.sort-btn) {
    padding: 0.45rem 0.625rem;
    background: var(--sp-bg);
    border: 1px solid var(--sp-border);
    color: var(--sp-text);
    font: inherit;
    align-self: stretch;
  }
  aside button:not(.sort-btn) { background: var(--sp-accent); border-color: var(--sp-accent); color: var(--sp-text); cursor: pointer; }
  aside button:not(.sort-btn):hover { background: #79b8ff; }
  aside button:not(.sort-btn):disabled,
  aside button:not(.sort-btn):disabled:hover:not(.sort-btn) {
    background: var(--sp-warn);
    border-color: var(--sp-warn);
    color: var(--sp-bg);
    cursor: not-allowed;
    animation: sync-pulse 1.2s ease-in-out infinite;
  }
  @keyframes sync-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

  aside button:not(.sort-btn).ghost:disabled,
  aside button:not(.sort-btn).ghost:disabled:hover:not(.sort-btn) {
    background: transparent;
    border-color: #21262d;
    color: #6e7681;
    cursor: default;
    animation: none;
    opacity: 0.6;
  }
  aside button:not(.sort-btn).ghost { background: var(--sp-panel); color: var(--sp-text-dim); border: 1px solid var(--sp-border); }
  aside button:not(.sort-btn).ghost:hover { background: var(--sp-surface); color: var(--sp-text); border-color: var(--sp-border-bright); }
  aside fieldset { border: 1px solid var(--sp-border); border-radius: 5px; padding: 0.5rem 0.75rem; display: flex; flex-direction: column; gap: 0.375rem; }
  aside legend { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--sp-text-dim); padding: 0 0.25rem; }
  aside .row { display: flex; gap: 0.25rem; }
  aside .row > * { flex: 1; }
  aside .hint { font-size: 0.7rem; color: var(--sp-text-dim); }
  aside .navbar { display: flex; gap: 0.25rem; align-items: stretch; }
  aside .navbar input {
    width: 100%;
    flex: 1;
    border: none;
    background: var(--sp-panel);
    color: var(--sp-text);
    padding: 0.45rem 0.625rem;
    border-radius: 8px;
    clip-path: none;
  }
  aside .navbar .back {
    flex: 0 0 32px;
    padding: 0;
    border: none;
    background: var(--sp-panel);
    color: var(--sp-text);
    cursor: pointer;
    border-radius: 8px;
    clip-path: none;
    font-size: 1rem;
    line-height: 32px;
    text-align: center;
  }
  aside .navbar .back:hover { background: var(--sp-surface); }
  ul.fs-list { list-style: none; display: flex; flex-direction: column; gap: 0.2rem; min-height: 60px; border: 1px dashed transparent; border-radius: 4px; transition: border-color 0.15s, background 0.15s; }
  ul.fs-list.drag-over { border-color: var(--sp-accent); background: var(--sp-accent-dim); }
  .ctx-menu { position: fixed; background: var(--sp-surface); border: 1px solid var(--sp-border); border-radius: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.5); z-index: 1200; padding: 0.25rem 0; font-size: 0.82rem; min-width: 140px; }
  .ctx-menu button { display: block; width: 100%; padding: 0.4rem 0.75rem; background: transparent; border: none; color: var(--sp-text); text-align: left; cursor: pointer; font: inherit; }
  .ctx-menu button:hover { background: var(--sp-panel); }
  .ctx-menu button.danger { color: var(--sp-danger); }
  .ctx-menu .ctx-info { padding: 0.35rem 0.75rem; color: var(--sp-text-dim); font-size: 0.78rem; border-bottom: 1px solid var(--sp-border); cursor: default; white-space: normal; overflow-wrap: break-word; }
  .ctx-menu .ctx-info.ctx-sort-header { border-bottom: none; border-top: 1px solid var(--sp-border); }
  ul.fs-list li { display: flex; align-items: center; justify-content: space-between; gap: 0.25rem; padding: 0.2rem 0.2rem; background: transparent; border: none; border-radius: 4px; font: 0.78rem 'JetBrains Mono', Consolas, monospace; }
  ul.fs-list li.empty { color: var(--sp-text-dim); justify-content: center; font-style: italic; font-family: inherit; }
  ul.fs-list button.name { background: none; border: none; padding: 0; margin: 0; text-align: left; color: inherit; font: inherit; cursor: pointer; }
  ul.fs-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; cursor: pointer; }
  ul.fs-list .name:hover { text-decoration: underline; }
  /* ...but NOT in the chat list: those rows already answer the cursor with a
     colour lift (dim -> --sp-text), and an underline on top of it was a
     second signal for the same event. The Files list keeps the underline --
     there the name is the click target, here the whole row is. */
  ul.conv-list .name:hover { text-decoration: none; }
  ul.fs-list .name.folder { color: var(--sp-text); }
  ul.fs-list .file-size { font-size: 0.7rem; color: var(--sp-text-dim); white-space: nowrap; margin-left: 0.5rem; }
  /* Collapsible "SANDPIE" section header in the Files panel — splits the app's
     own system files from the user's files. Mirrors the conversations "Archived"
     toggle. The border-top + margin give the visual separation. */
  ul.fs-list li.sandpie-toggle {
    cursor: pointer; user-select: none;
    color: var(--sp-text-dim);
    font-size: 0.68rem; letter-spacing: 0.05em; text-transform: uppercase;
    justify-content: flex-start; gap: 0.3rem;
    padding: 0.4rem 0.2rem 0.2rem; margin-top: 0.8rem;
  }
  ul.fs-list li.sandpie-toggle:hover { color: var(--sp-text); }
  /* Children align flush with the normal/user files above (same left padding as
     the base li) — the header + collapse is the grouping cue, not an indent. */
  ul.fs-list li.sandpie-child { padding-left: 0.2rem; }

  /* Settings → System prompt: Tools & Skills lists (checkbox + expand-to-edit). */
  .sp-block { margin-top: 1.1rem; border-top: 1px solid var(--sp-border); padding-top: 0.7rem; }
  .sp-block-head { font-size: 0.82rem; font-weight: 600; color: var(--sp-text); display: flex; align-items: baseline; gap: 0.45rem; margin-bottom: 0.5rem; }
  .sp-count { font-size: 0.7rem; color: var(--sp-text-dim); font-weight: 400; }
  .sp-block-hint { font-size: 0.7rem; color: var(--sp-text-dim); margin: 0.2rem 0 0.55rem; line-height: 1.4; }
  /* Self-contained card: its OWN panel background + text colour (mirrors the prompt
     textarea), so rows stay legible regardless of the modal/--sp-surface colour. */
  .sp-item { border: 1px solid var(--sp-border); border-radius: 6px; margin-bottom: 0.35rem; overflow: hidden; background: var(--sp-panel); color: var(--sp-text); }
  .sp-item-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.55rem; cursor: pointer; }
  .sp-item-head:hover { background: var(--sp-border); }
  /* CRITICAL: override .modal-content input { width:100%; padding:0.5rem; border; ... }
     (and any mobile @media variant) — otherwise each row checkbox stretches to the
     full row and pushes the name/description off past .sp-item's overflow:hidden, so
     only the checkbox shows. !important keeps it bulletproof on phones too. */
  .sp-item-head input[type="checkbox"] { flex: 0 0 auto !important; width: auto !important; min-width: 0 !important; margin: 0 !important; padding: 0 !important; border: none !important; background: none !important; border-radius: 0 !important; cursor: pointer; }
  .modal-content input[type="checkbox"] { width: auto !important; padding: 0 !important; background: none !important; border: none !important; }
  .sp-item-name { font: 0.8rem 'JetBrains Mono', Consolas, monospace; color: var(--sp-text); white-space: nowrap; flex: 0 0 auto; }
  .sp-item-meta { font-size: 0.62rem; color: var(--sp-text-dim); text-transform: uppercase; letter-spacing: 0.04em; margin-left: auto; white-space: nowrap; }
  .sp-caret { font-size: 0.7rem; color: var(--sp-text-dim); }
  .sp-item-body { padding: 0.5rem 0.55rem; border-top: 1px solid var(--sp-border); }
  .sp-edit { width: 100%; resize: vertical; padding: 0.45rem; background: var(--sp-bg); border: 1px solid var(--sp-border); border-radius: 5px; color: var(--sp-text); font: 0.74rem 'JetBrains Mono', Consolas, monospace; line-height: 1.45; box-sizing: border-box; }
  .sp-item-btns { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.45rem; }
  .sp-item-btns button { font-size: 0.72rem; padding: 0.2rem 0.55rem; }
  .sp-item-btns button:disabled { opacity: 0.45; cursor: default; }
  .sp-item-status { font-size: 0.7rem; color: var(--sp-text-dim); }
  .sp-skill-err { font-size: 0.7rem; color: var(--sp-accent-neg, #e06c75); margin-bottom: 0.25rem; }

  /* KaTeX math (rendered by conversations.js renderMd). Let wide display equations
     scroll horizontally instead of overflowing the message bubble. */
  .katex-display { overflow-x: auto; overflow-y: hidden; padding: 2px 0; margin: 0.5em 0; }
  .katex-display > .katex { white-space: nowrap; }

  .file-viewer { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 1000;  }
  .file-viewer .panel { background: var(--sp-bg); border: 1px solid var(--sp-border); border-radius: 8px; max-width: min(900px, 100%); max-height: 100%; width: 100%; display: flex; flex-direction: column; overflow: hidden; }
  .file-viewer .panel header { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--sp-border); }
  .file-viewer .panel header .title { font: 0.85rem 'JetBrains Mono', Consolas, monospace; color: var(--sp-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .file-viewer .panel header button { background: transparent; border: none; color: var(--sp-text-dim); font-size: 1.1rem; cursor: pointer; padding: 0 0.25rem; }
  .file-viewer .panel header button:hover { color: var(--sp-danger); }
  .file-viewer .body { padding: 0.75rem 0.9rem; overflow: auto; }
  .file-viewer pre { margin: 0; white-space: pre-wrap; word-wrap: break-word; font: 0.8rem/1.45 'JetBrains Mono', Consolas, monospace; color: var(--sp-text); }
  .file-viewer img, .file-viewer video, .file-viewer audio { max-width: 100%; display: block; margin: 0 auto; }
  .file-viewer .meta { color: var(--sp-text-dim); font-size: 0.78rem; }
  .file-viewer .panel header button.mode { font-size: 0.78rem; padding: 0.1rem 0.4rem; border: 1px solid var(--sp-border); border-radius: 3px; }
  .file-viewer .panel header button.mode:hover { color: var(--sp-text); border-color: var(--sp-accent); }
  .file-viewer textarea.editor { width: 100%; min-height: 60vh; background: var(--sp-bg); color: var(--sp-text); border: 1px solid var(--sp-border); border-radius: 4px; padding: 0.5rem; font: 0.8rem/1.45 'JetBrains Mono', Consolas, monospace; resize: vertical; box-sizing: border-box; outline: none; }
  .file-viewer textarea.editor:focus { border-color: var(--sp-accent); }
  /* Rendered Markdown (file-viewer.js openText, .md-body). The global reset at the
     top of this file zeroes every margin and padding, so lists lose their indent
     (markers hang at the pane edge) and blocks touch — everything a Markdown
     document needs is restored here. One left edge: text of paragraphs, headings
     and list items lines up; only the markers sit in the list's gutter. */
  .file-viewer .md-body > * + * { margin-top: 0.7em; }
  .file-viewer .md-body h1, .file-viewer .md-body h2, .file-viewer .md-body h3,
  .file-viewer .md-body h4, .file-viewer .md-body h5, .file-viewer .md-body h6 { color: var(--sp-text); line-height: 1.3; }
  .file-viewer .md-body h1 { font-size: 1.5em; }
  .file-viewer .md-body h2 { font-size: 1.25em; }
  .file-viewer .md-body h3 { font-size: 1.1em; }
  .file-viewer .md-body h4, .file-viewer .md-body h5, .file-viewer .md-body h6 { font-size: 1em; }
  .file-viewer .md-body > :is(h1, h2, h3, h4, h5, h6):not(:first-child) { margin-top: 1.3em; }
  .file-viewer .md-body h1, .file-viewer .md-body h2 { border-bottom: 1px solid var(--sp-border); padding-bottom: 0.25em; }
  .file-viewer .md-body ul, .file-viewer .md-body ol { padding-left: 1.6em; }
  .file-viewer .md-body li + li, .file-viewer .md-body li > ul, .file-viewer .md-body li > ol, .file-viewer .md-body li > p + p { margin-top: 0.25em; }
  .file-viewer .md-body hr { border: 0; border-top: 1px solid var(--sp-border); margin: 1.2em 0; }
  .file-viewer .md-body code { background: var(--sp-surface); padding: 0.15em 0.35em; border-radius: 3px; font: 0.85em 'JetBrains Mono', Consolas, monospace; }
  .file-viewer .md-body pre { background: var(--sp-surface); padding: 0.6rem; border-radius: 4px; overflow: auto; }
  .file-viewer .md-body pre code { background: transparent; padding: 0; }
  .file-viewer .md-body blockquote { border-left: 3px solid var(--sp-border); padding-left: 0.8rem; color: var(--sp-text-dim); }
  .file-viewer .md-body a { color: var(--sp-accent); }
  .file-viewer .md-body table { border-collapse: collapse; }
  .file-viewer .md-body th, .file-viewer .md-body td { border: 1px solid var(--sp-border); padding: 0.3rem 0.6rem; }
  /* YAML frontmatter, shown as a small key/value table instead of being parsed as Markdown. */
  .file-viewer .md-body table.md-fm { font: 0.75rem/1.4 'JetBrains Mono', Consolas, monospace; color: var(--sp-text-dim); margin-bottom: 1.2em; }
  .file-viewer .md-body table.md-fm td { border: 0; border-bottom: 1px solid var(--sp-border); padding: 0.25rem 1rem 0.25rem 0; vertical-align: top; }
  .file-viewer .md-body table.md-fm td:first-child { white-space: nowrap; }
  .file-viewer .md-body table.md-fm td:last-child { color: var(--sp-text); overflow-wrap: anywhere; }
  /* PPTX viewer: force light-theme context so SVG text (which inherits currentColor)
     is visible on white slide backgrounds. Sandpie's dark theme sets color:white
     which makes text invisible without this override. Only target text elements
     that have NO explicit fill attribute — respect the library's explicit colors. */
  .pptx-viewer-container { color: #333 !important; background: #fff !important; }
  .pptx-viewer-container svg { color: #333; }
  .pptx-viewer-container svg text:not([fill]) { fill: #333; }
  ul.fs-list button { padding: 0; width: 18px; height: 18px; line-height: 1; font-size: 0.9rem; background: transparent; border: none; color: var(--sp-text-dim); cursor: pointer; }
  ul.fs-list button:hover { color: var(--sp-danger); background: transparent; }

  /* Settings modal also lives on <body> (so position:fixed anchors to the
     viewport, not a themed sidebar's backdrop-filter): a body-level modal is
     outside the sidebar, so its ghost buttons are restyled here. */
  #settingsModal button.ghost { background: var(--sp-panel); color: var(--sp-text-dim); border: 1px solid var(--sp-border); border-radius: 6px; padding: 0.35rem 0.6rem; font: inherit; font-size: 0.8rem; cursor: pointer; }
  #settingsModal button.ghost:hover:not(:disabled) { background: var(--sp-surface); color: var(--sp-text); border-color: var(--sp-border-bright); }
#searchModal button.ghost { background: var(--sp-panel); color: var(--sp-text-dim); border: 1px solid var(--sp-border); border-radius: 6px; padding: 0.35rem 0.6rem; font: inherit; font-size: 0.8rem; cursor: pointer; }
#searchModal button.ghost:hover:not(:disabled) { background: var(--sp-surface); color: var(--sp-text); border-color: var(--sp-border-bright); }  #settingsModal button.ghost.active { background: var(--sp-accent-dim); color: var(--sp-text); border-color: var(--sp-accent); }
  /* Chat width slider (Appearance panel) */
  .chat-width-row { display: flex; align-items: center; gap: 0.6rem; }
  .chat-width-row input[type="range"] { flex: 1; min-width: 0; accent-color: var(--sp-accent); cursor: pointer; }
  .chat-width-val { font: 0.72rem 'JetBrains Mono', Consolas, monospace; color: var(--sp-text); min-width: 4.5ch; text-align: right; font-variant-numeric: tabular-nums; }
  main { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; }

  #messagesWrap { flex: 1; display: flex; flex-direction: row; min-height: 0; }
  #messages { flex: 1; display: flex; flex-direction: column; min-width: 0; }
  #messagesSide {
    flex: 1; display: flex; flex-direction: column; min-width: 0;
  }

  body:not(.side-open):not(.artifact-side-open):not(.viewer-side-open) #messagesSide { display: none; }
  body.artifact-side-open #messagesSide,
  body.viewer-side-open #messagesSide { display: flex; flex-direction: column; }
  body.side-open #messages,
  body.side-open #messagesSide { transition: opacity 0.15s, filter 0.15s; }

  #messagesSide.artifact-mode { padding: 0; gap: 0; overflow: hidden; }
  #messagesSide.artifact-mode > *:not(#artifactPanelHeader):not(#artifactPanelFrame) { display: none !important; }
  #messagesSide:not(.artifact-mode) #artifactPanelHeader,
  #messagesSide:not(.artifact-mode) #artifactPanelFrame { display: none; }

  #artifactPanelHeader {
    display: flex; align-items: center; justify-content: space-between;
    padding: 4px 10px; background: var(--sp-panel); border-bottom: 1px solid var(--sp-border);
    font: 11px monospace; color: var(--sp-text-dim); flex-shrink: 0;
  }
  #artifactPanelTitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #artifactPanelClose {
    background: none; border: none; color: var(--sp-text-dim); cursor: pointer;
    font-size: 14px; padding: 0 2px; line-height: 1; flex-shrink: 0;
  }
  #artifactPanelClose:hover { color: var(--sp-text); }
  /* Per-pane conversation titlebar — inherits the fv-header/artifact-header
     recipe (file-viewer.js buildPane): panel bar, 11px mono, hairline bottom,
     round icon-button close (the ✕ IS .artifact-icon-btn). Always visible on
     desktop — JS sets display:flex even for a fresh 'New chat' pane; hidden on
     mobile, and covered
     by the artifact/viewer-mode `> *:not(...)` rules when those are active.
     The bottom edge dissolves into the chat with a fading shadow (no hairline). */
  .pane-titlebar {
    display: none;               /* shown only while a conversation is mounted */
    flex: none; width: 100%;
    align-items: center; gap: 5px;
    padding: 2px 8px;
    font: 11px monospace; color: var(--sp-text-dim);
    position: relative;
    z-index: 1;
    user-select: none;
  }
  .pt-title {
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    text-align: right;
  }
  .pt-title.fresh { font-style: italic; opacity: .85; }

  #artifactPanelFrame { flex: 1; border: 0; background: transparent; min-height: 0; }

  /* Unified file/artifact viewer hosted in the side panel (desktop). The same
     .file-viewer overlay is reused, restyled to fill the column instead of being
     a centered modal — so all .file-viewer .panel internals apply unchanged. */
  #messagesSide.viewer-mode { padding: 0; gap: 0; overflow: hidden; }
  #messagesSide.viewer-mode > *:not(.file-viewer) { display: none !important; }
  .file-viewer.side { position: static; inset: auto; padding: 0; background: transparent; z-index: auto; display: block; }
  .file-viewer.side .panel { width: 100%; height: 100%; max-width: none; max-height: none; border: 0; border-radius: 0; }
  .file-viewer.side .body { flex: 1; min-height: 0; }

  #sideResizer {
    width: 1px; flex-shrink: 0; cursor: col-resize;
    background: var(--sp-border); transition: background 0.15s; position: relative;
  }
  /* The hover visual lives on the ::after overlay, NOT on the element: widening the
     element itself is a flex-layout change that shoves the panes (jank). The
     sidebar-resize-handle avoids this by being position:fixed — same idea here,
     painting 3px wide over its neighbours without touching layout. */
  #sideResizer::after { content: ''; position: absolute; inset: 0 -1.5px; z-index: 5; }
  #sideResizer:hover::after, #sideResizer.dragging::after { background: var(--sp-accent); }
  body:not(.side-open):not(.artifact-side-open):not(.viewer-side-open) #sideResizer { display: none; }
  .artifact-icon-btn {
    cursor: pointer; background: var(--sp-surface); border: 1px solid var(--sp-border);
    color: var(--sp-text-dim); border-radius: 50%; width: 20px; height: 20px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 11px; line-height: 1; text-decoration: none; flex-shrink: 0;
    transition: background 0.1s, color 0.1s, border-color 0.1s;
  }
  .artifact-icon-btn:hover { background: var(--sp-accent); border-color: var(--sp-accent); color: var(--sp-text); }
  /* file-viewer header text buttons (Save / Source) — pill sibling of artifact-icon-btn */
  .fv-hbtn-text {
    cursor: pointer; background: var(--sp-surface); border: 1px solid var(--sp-border);
    color: var(--sp-text-dim); border-radius: 10px; height: 20px; padding: 0 8px;
    display: inline-flex; align-items: center; font-size: 10px; line-height: 1; flex-shrink: 0;
    transition: background 0.1s, color 0.1s, border-color 0.1s;
  }
  .fv-hbtn-text:hover { background: var(--sp-accent); border-color: var(--sp-accent); color: var(--sp-text); }
  .artifact-panel-btn {  }
  /* The unfocused pane is dimmed to show which conversation is active. It must
     only ever dim a MESSAGE section: when the side pane is showing a document
     (file viewer / artifact) the pane holds no conversation at all, and greying
     out the artifact you are reading is both wrong and a trap — the viewer
     renders in an iframe, so clicking it cannot bubble out to restore the
     focus. Excluded via :not(), so the document always renders at full opacity. */
  body.side-open.active-left  #messagesSide:not(.viewer-mode):not(.artifact-mode),
  body.side-open.active-right #messages {
    opacity: 0.55; filter: grayscale(0.25); cursor: pointer;
  }
  body.side-open.active-left  #messagesSide:not(.viewer-mode):not(.artifact-mode):hover,
  body.side-open.active-right #messages:hover { opacity: 0.75; }
  #messagesWrap.drop-target { position: relative; }
  #messagesWrap.drop-target::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px dashed var(--sp-accent);
    border-radius: 10px;
    pointer-events: none;
    z-index: 9999;
  }
  .msg { max-width: 85%; min-width: 0; padding: 0.75rem 1rem; line-height: 1.5; overflow-wrap: anywhere; position: relative; }
  .user {
    align-self: flex-end;
    position: relative;
    padding: 0;
    background: transparent;
    max-width: 82%;
  }
  .user .bubble {
    display: block;
    padding: 0.75rem 1rem;
    background: var(--sp-accent);
    color: var(--sp-text);
    white-space: pre-wrap;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  }
  .user::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(88, 166, 255, 0.5);
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
    transform: translate(5px, 5px);
  }
  .assistant {
    align-self: flex-start;
    padding: 0.75rem 1rem 0.75rem 1.25rem;
    color: var(--sp-text);
    line-height: 1.6;
    border-left: 2px solid var(--sp-accent-dim);
    max-width: 90%;
  }
  .assistant .bubble {
    display: block;
  }

  /* Assistant replies: original inline actions strip (always visible).
     User bubbles: floating toolbar below the bubble — hover (PC), tap
     (mobile) or text selection reveals it. */
  .msg-actions { display: flex; align-items: center; gap: 4px; margin-top: 4px; opacity: 1; }
  .msg.user { position: relative; }
  .msg.user > .msg-actions {
    position: absolute; z-index: 6; bottom: -34px; right: 8px; margin-top: 0;
    background: var(--sp-panel); border: 1px solid var(--sp-border-bright);
    border-radius: 8px; padding: 2px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.45);
    opacity: 0; pointer-events: none; transform: translateY(-3px);
    transition: opacity 0.12s ease, transform 0.12s ease;
  }
  .msg.user > .msg-actions.show { opacity: 1; pointer-events: auto; transform: none; }
  @media (hover:hover) and (pointer:fine) {
    .msg.user:hover > .msg-actions { opacity: 1; pointer-events: auto; transform: none; }
  }
  .msg-actions .act-copy {
    min-width: 26px; min-height: 26px; padding: 4px 9px 4px 7px; display: inline-flex; align-items: center; gap: 7px;
    background: transparent; border: 1px solid transparent; border-radius: 6px;
    color: var(--sp-text-dim); cursor: pointer;
    transition: color 0.1s, background 0.1s, border-color 0.1s;
  }
  .msg-actions .act-copy svg { width: 14px; height: 14px; fill: currentColor; flex: 0 0 auto; }
  .msg-actions .act-label { font-size: 12px; line-height: 1; white-space: nowrap; }
  .msg-actions .act-copy:hover { color: var(--sp-accent); background: var(--sp-accent-dim); border-color: var(--sp-border-bright); }
  .msg-actions .act-copy.done { color: var(--sp-accent); background: var(--sp-accent-dim); border-color: var(--sp-accent); }
  .msg-actions .act-tts.playing { color: var(--sp-accent); background: var(--sp-accent-dim); border-color: var(--sp-accent); animation: ttsPulse 1.2s ease-in-out infinite; }
  @keyframes ttsPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
  /* Report action outside the assistant actions strip (err/status bubbles) */
  .msg > .act-copy.act-report {
    display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0;
    background: transparent; border: 1px solid transparent; border-radius: 6px;
    color: var(--sp-text-dim); cursor: pointer; margin-top: 6px; font-style: normal;
    transition: color 0.1s, background 0.1s, border-color 0.1s;
  }
  .msg > .act-copy.act-report svg { width: 14px; height: 14px; fill: currentColor; }
  .msg > .act-copy.act-report:hover { color: var(--sp-accent); background: var(--sp-accent-dim); border-color: var(--sp-border-bright); }
  .msg > .act-copy.act-report.done { color: var(--sp-accent); background: var(--sp-accent-dim); border-color: var(--sp-accent); }
  .err { align-self: center; color: var(--sp-danger); font-style: italic; }
  .info { align-self: center; color: var(--sp-text-dim); font-style: italic; font-size: 0.85em; }
  .assistant > *:first-child { margin-top: 0; }
  .assistant > *:last-child { margin-bottom: 0; }
  .assistant p { margin: 0.5em 0; }
  .assistant pre { background: transparent; border: 1px solid var(--sp-border); padding: 0.75rem; border-radius: 5px; margin: 0.5em 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--sp-text-dim); font: 0.85em 'Space Mono', 'JetBrains Mono', monospace; }
  .assistant code { font-family: inherit; }
  .assistant pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
  .assistant ul, .assistant ol, .msg.lp-say ul, .msg.lp-say ol { padding-left: 1em; margin: 0.5em 0; }
  .assistant a { color: var(--sp-accent); }
  .assistant a.lr-plain { color: inherit; cursor: text; }   /* a file reference whose file can't be found: plain text, never a broken link */
  .assistant blockquote { border-left: 3px solid var(--sp-border); padding-left: 0.75em; color: var(--sp-text-dim); margin: 0.5em 0; }
  .assistant h1, .assistant h2, .assistant h3 { margin: 0.75em 0 0.5em; line-height: 1.3; }
  .assistant table { border-collapse: collapse; margin: 2em 0; }
  .assistant th, .assistant td { border: 1px solid var(--sp-border); padding: 0.25em 0.5em; }
  form { display: flex; flex-direction: column; gap: 0.5rem; padding: 0rem 1.5rem 1rem; }

  /* Composer pinned to the bottom of its pane (main + side). Sticky so it stays
     visible while messages scroll; the artifact-mode rule hides the side one so
     an open artifact gets the full pane height. */
  form.composer {
    position: sticky; bottom: 0; z-index: 1;
    /* Same cap as .conv-host so the input box lines up under the messages while
       the form's background/border still span the full pane. */
    padding-inline: max(1.5rem, calc((100% - var(--sp-chat-max-w)) / 2));
  }
  #messagesSide form.composer { }
  .input-wrap {
    display: flex;
    flex-direction: column;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 16px;
    transition: border-color 0.15s, box-shadow 0.15s;
    overflow: hidden;
  }
  .input-wrap:focus-within {
    border-color: var(--sp-accent);
    box-shadow: 0 0 0 3px var(--sp-accent-dim);
  }
  .input-wrap textarea {
    flex: 1;
    padding: 0.65rem 0.85rem 0.4rem;
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--sp-text);
    font: inherit;
    resize: none;
    overflow-x: hidden;
    overflow-y: hidden;
    line-height: 1.4;
    min-height: calc(1.4em + 0.8rem);
    max-height: 12em;
    outline: none;
    field-sizing: content;
  }
  .input-bar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.4rem 0.35rem;
    min-height: 28px;
  }
  /* Icon buttons (attach, mic, voice, bolt, send) never shrink: the send
     button's play glyph is a zero-size CSS triangle, so without this it is
     the first flex item squeezed to 0 width on narrow screens. Only the
     model picker gives way, by truncating its label. */
  .input-bar .attach-btn,
  .input-bar .send-btn { flex: 0 0 auto; }
  .attach-btn {
    cursor: pointer;
    background: transparent !important;
    border: none !important;
    color: var(--sp-text-dim) !important;
    padding: 0.15rem 0.4rem !important;
    border-radius: 6px !important;
    font-size: 1.15rem !important;
    font-weight: 300 !important;
    line-height: 1 !important;
    transition: background 0.1s, color 0.1s !important;
  }
  .attach-btn:hover {
    background: var(--sp-panel) !important;
    color: var(--sp-text) !important;
  }

  /* Mic button (speech-to-text.js) — inherits .attach-btn; holds an inline SVG
     glyph, not an emoji. Recording pulses in the danger colour; busy dims. */
  .mic-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
  }
  .mic-btn svg { display: block; }
  .mic-btn.recording {
    color: var(--sp-danger) !important;
    animation: micPulse 1.2s ease-in-out infinite;
  }
  .mic-btn.busy {
    color: var(--sp-accent) !important;
    opacity: 1;
  }
  .mic-btn .stt-spinner { animation: sttSpin 0.8s linear infinite; }
  /* Voice-conversation button (tts.js) — mic+arrow glyph next to the mic;
     lit in the theme accent while voice mode is ON. */
  .voice-btn { display: inline-flex !important; align-items: center; justify-content: center; }
  .voice-btn svg { display: block; width: 18px; height: 18px; fill: currentColor; }
  .voice-btn.voice-on {
    color: var(--sp-accent) !important;
    animation: micPulse 1.2s ease-in-out infinite;
  }
  @keyframes sttSpin { to { transform: rotate(360deg); } }
  @keyframes micPulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.45; }
  }
  /* Lite quick-toggle (conversations.js) — bolt next to the mic; lit in the
     theme accent while LITE mode is on for the active conversation. */
  .lite-btn { display: inline-flex !important; align-items: center; justify-content: center; }
  .lite-btn svg { display: block; }
  .lite-btn.active { color: var(--sp-success) !important; filter: drop-shadow(0 0 4px var(--sp-success)); }

  /* Composer model picker (dropup) */
  .model-picker { position: relative; display: inline-flex; flex: 0 1 auto; min-width: 0; }
  .mp-trigger { display: inline-flex; align-items: center; gap: 0.3rem; max-width: min(220px, 100%); min-width: 2.5rem; padding: 0.2rem 0.55rem; background: var(--sp-panel); border: 1px solid var(--sp-border); border-radius: 999px; color: var(--sp-text); font: inherit; font-size: 0.72rem; cursor: pointer; white-space: nowrap; }
  .mp-trigger:hover { border-color: var(--sp-accent); }
  .mp-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
  .mp-caret { color: var(--sp-text-dim); font-size: 0.6rem; line-height: 1; transition: transform 0.15s; }
  .model-picker.open .mp-caret { transform: rotate(180deg); }
  /* position:fixed (JS sets bottom/left from the trigger rect) so the dropup escapes
     .input-wrap's overflow:hidden instead of being clipped above the composer. */
  .mp-panel { display: none; position: fixed; min-width: 200px; max-width: 300px; max-height: 50vh; overflow-y: auto; background: var(--sp-surface); border: 1px solid var(--sp-border); border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.45); z-index: 1000; padding: 0.3rem; }
  .mp-panel.visible { display: block; }
  .mp-hdr { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--sp-text-dim); padding: 0.3rem 0.5rem 0.2rem; }
  .mp-sep { height: 1px; background: var(--sp-border); margin: 0.35rem 0.3rem; }
  .mp-item { display: block; width: 100%; text-align: left; padding: 0.35rem 0.5rem; background: transparent; border: none; border-radius: 5px; color: var(--sp-text); font: inherit; font-size: 0.8rem; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mp-item:hover { background: var(--sp-panel); }
  .mp-item.active { background: var(--sp-accent-dim); }
  .mp-empty { padding: 0.4rem 0.5rem; font-size: 0.72rem; color: var(--sp-text-dim); }


  /* ---- Reasoning effort slider (inside the model-picker dropup) ---- */
  .rs-block { padding: 0.35rem 0.5rem 0.45rem; }
  .rs-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
  .rs-head .rs-name { font-size: 0.72rem; color: var(--sp-text); font-weight: 600; }
  .rs-head .rs-val { font-size: 0.72rem; color: var(--sp-accent); font-weight: 600; }
  .rs-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; background: transparent; cursor: pointer; margin: 0; }
  .rs-slider:focus-visible { outline: 1px solid var(--sp-accent); outline-offset: 2px; border-radius: 4px; }
  .rs-slider::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--sp-success), var(--sp-accent) 70%, var(--sp-warn)); }
  .rs-slider::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--sp-success), var(--sp-accent) 70%, var(--sp-warn)); }
  .rs-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--sp-surface); border: 2px solid var(--sp-accent); box-shadow: 0 1px 4px rgba(0,0,0,0.5); margin-top: -5px; }
  .rs-slider::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--sp-surface); border: 2px solid var(--sp-accent); box-shadow: 0 1px 4px rgba(0,0,0,0.5); }
  .rs-ticks { display: flex; justify-content: space-between; margin-top: 4px; }
  .rs-ticks span { font-size: 0.58rem; color: var(--sp-text-dim); }
  .rs-ticks span.on { color: var(--sp-text); font-weight: 600; }
  .send-btn {
    margin-left: auto;
    width: 32px;
    height: 32px;
    padding: 0 !important;
    background: var(--sp-accent) !important;
    border: none !important;
    border-radius: 8px !important;
    color: var(--sp-bg) !important;
    font-size: 0.9rem !important;
    line-height: 1 !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.15s, text-shadow 0.1s !important;
    box-shadow: 0 2px 8px rgba(88,166,255,0.35);
    text-shadow: none;
  }
  .send-btn .ic-play {
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 0.42em 0 0.42em 0.68em;
    border-color: transparent transparent transparent currentColor;
    margin-left: 0.11em;
  }
  .send-btn .ic-stop {
    display: block;
    width: 0.62em;
    height: 0.62em;
    background: currentColor;
    border-radius: 1px;
  }
  .send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(88,166,255,0.45);
  }
  .send-btn:active {
    transform: scale(0.78);
    transition: transform 0.06s ease-out;
  }
  .send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none !important;
  }
  /* Input styles moved to .input-wrap, .input-bar, .attach-btn, .send-btn */

  /* Legacy form styling for modular version compatibility */
  form > textarea {
    flex: 1;
    padding: 0.5rem 1rem;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 8px;
    color: var(--sp-text);
    font: inherit;
    resize: none;
    overflow-y: hidden;
    line-height: 1.4;
    min-height: calc(1.4em + 1rem + 2px);
  }
  form > button {
    padding: 0.5rem 1.25rem;
    background: var(--sp-accent);
    border: none;
    border-radius: 8px;
    color: var(--sp-bg);
    cursor: pointer;
  }
  form > button:disabled { opacity: 0.5; cursor: not-allowed; }

  /* Timer slot: transparent over the page, like the composer around it. (It
     once took a per-theme --slot-bg; the last definition went 2026-09-14.) */
  .msg-timer-slot { position: relative; padding-bottom: 0.25rem; }
  .msg-timer {
    font: 0.7rem 'JetBrains Mono', Consolas, monospace;
    color: var(--sp-accent);
    display: flex; align-items: center;
    padding: 0.25rem 1.75rem 0.25rem;
    /* Follow the chat width cap: composer padding + the usual 0.25rem inset. */
    padding-inline: calc(max(1.5rem, (100% - var(--sp-chat-max-w)) / 2) + 0.25rem);
    user-select: none;
    font-variant-numeric: tabular-nums;
  }
  /* elapsed time leads in the accent colour; tokens + rate sit a step back */
  .msg-timer .mt-tok,
  .msg-timer .mt-rate,
  .msg-timer .mt-ctx { color: var(--sp-text-dim); }
  .msg-timer .mt-ctx { cursor: pointer; }
  .msg-timer .mt-ctx:hover { color: var(--sp-accent); }
  /* ctx counter as a pie ring: track = full context window, arc = used.
     Replaces the raw "38,412 ctx" text (exact count lives in the tooltip +
     the ctx popup). Warn >=75% amber, hot >=90% red. */
  .msg-timer .mt-ctx { display: inline-flex; align-items: center; vertical-align: middle; margin-bottom: 1px; }
  .msg-timer .mt-ctx svg { width: 12px; height: 12px; transform: rotate(-90deg); display: block; }
  .msg-timer .mt-ctx .ctx-track { stroke: var(--sp-text-dim); opacity: 0.45; }   /* --sp-border can be near-invisible on light grounds */
  .msg-timer .mt-ctx .ctx-fill {
    stroke: var(--sp-accent); stroke-linecap: round;
    transition: stroke-dashoffset 0.4s, stroke 0.3s;
  }
  .msg-timer .mt-ctx.warn .ctx-fill { stroke: var(--sp-warn); }
  .msg-timer .mt-ctx.hot .ctx-fill { stroke: var(--sp-danger); }
  .msg-timer .mt-ctx:hover .ctx-fill { stroke: var(--sp-accent); }
  .msg-timer .mt-rate { cursor: pointer; }
  .msg-timer .mt-rate:hover { color: var(--sp-accent); }
  /* Project chip - far right of the msg-timer row, composer-aligned (UI only). */
  .msg-timer .mt-proj {
    margin-left: auto;
    display: inline-flex; align-items: center; gap: 5px;
    font: inherit; font-size: 0.68rem;
    padding: 1px 8px; border-radius: 999px; cursor: pointer;
    border: 1px solid transparent; white-space: nowrap;
  }
  .msg-timer .mt-proj:hover { border-color: var(--sp-border-bright); color: var(--sp-text); }
  .msg-timer .mt-proj.open { border-color: var(--sp-accent); color: var(--sp-text); }
  .msg-timer .mt-proj.none { border-style: dashed; }
  .msg-timer .mt-proj .mt-proj-caret { font-size: 0.55rem; opacity: 0.7; }
  .proj-panel { min-width: 180px; max-width: 260px; }
  .proj-panel .proj-item {
    display: flex; align-items: center; gap: 0.45rem;
    padding: 0.35rem 0.5rem; border-radius: 5px;
    font-size: 0.8rem; cursor: pointer; color: var(--sp-text);
  }
  .proj-panel .proj-item:hover, .proj-panel .proj-item.sel { background: var(--sp-panel); }
  .proj-panel .proj-item .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .proj-panel .proj-item .proj-del {
    margin-left: auto; display: none;
    background: transparent; border: none; cursor: pointer;
    color: var(--sp-text-dim); font-size: 0.7rem; padding: 0 2px; line-height: 1;
  }
  .proj-panel .proj-item .proj-del:hover { color: var(--sp-danger); }
  .proj-panel .proj-item:hover .proj-del { display: inline-block; }
  .proj-panel .proj-item.none { color: var(--sp-text-dim); }
  .msg-timer .mt-sep { color: var(--sp-text-dim); opacity: 0.55; margin: 0 0.3rem; }
  .msg-timer.done { color: #6e7681; }
  /* once settled, the whole line dims to one tone */
  .msg-timer.done .mt-tok,
  .msg-timer.done .mt-rate,
  .msg-timer.done .mt-sep,
  .msg-timer.done .mt-ctx { color: inherit; }   /* ctx was left out: it kept --sp-text-dim while siblings dimmed to the settled grey */

  .msg-timer .mt-todos {
    cursor: pointer;
  }

  /* ---- neural-net thinking toggle icon ---- */
  .msg-timer .mt-nn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 12px; height: 12px;
    cursor: pointer; color: var(--sp-text-dim);
    opacity: 0.5;
    transition: opacity 0.15s, color 0.15s;
    margin-bottom: 1px;
    vertical-align: middle;
    background: transparent; border: none; padding: 0;
  }
  .msg-timer .mt-nn:hover { opacity: 1; }
  .msg-timer .mt-nn.on { color: var(--sp-accent); opacity: 1; }
  /* Settled (tick) state: accent-filled circle behind the tick mark */
  .msg-timer .mt-nn.tick {
    border-radius: 100%;
    background-color: var(--sp-accent);
    color: #fff;
    opacity: 1;
  }
  .msg-timer .mt-nn svg {
    width: 12px; height: 12px;
    fill: none; stroke: currentColor;
    stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
  }
    @keyframes ring-out { 0%{ color: var(--sp-accent); opacity: 0.9; } 80%{ color: #334155; opacity: 0; } 100%{ opacity: 0; } }
  @keyframes ring-out-d1 { 0%{ color: #334155; opacity: 0; } 25%{ color: var(--sp-accent); opacity: 0.8; filter: drop-shadow(0 0 2px currentColor); } 85%{ color: #334155; opacity: 0; } 100%{ opacity: 0; } }
  @keyframes ring-out-d2 { 0%{ color: #334155; opacity: 0; } 25%{ color: #334155; opacity: 0; } 45%{ color: var(--sp-accent); opacity: 0.7; filter: drop-shadow(0 0 2px currentColor); } 90%{ color: #334155; opacity: 0; } 100%{ opacity: 0; } }
  @keyframes ring-center { 0%,100%{ color: var(--sp-accent); opacity: 1; } 50%{ color: var(--sp-accent); opacity: 0.5; } }
  .msg-timer .mt-nn.thinking svg .r1, .msg-timer .mt-nn.streaming svg .r1 { animation: ring-out 1.6s ease-out infinite; }
  .msg-timer .mt-nn.thinking svg .r2, .msg-timer .mt-nn.streaming svg .r2 { animation: ring-out-d1 1.6s ease-out infinite; }
  .msg-timer .mt-nn.thinking svg .r3, .msg-timer .mt-nn.streaming svg .r3 { animation: ring-out-d2 1.6s ease-out infinite; }
  .msg-timer .mt-nn.thinking svg .r-c, .msg-timer .mt-nn.streaming svg .r-c { animation: ring-center 1.6s ease-in-out infinite; }
  .msg-timer .mt-nn.thinking, .msg-timer .mt-nn.streaming { opacity: 1; color: var(--sp-accent); }
  /* The timer bar NEVER hides. An idle slot is filled by JS with a real-looking
     placeholder (nn icon · idle · 0s · – ctx), dimmed via .done — see
     _fillPlaceholderTimer in conversations.js. No bare-text fallback here. */
  .msg-timer .mt-todos:empty { display: none; }

  /* ---- per-conversation context popup (anchored to the ctx counter) ---- */
  .ctx-popup {
    position: fixed;
    z-index: 1000;
    min-width: 200px;
    max-width: 280px;
    padding: 0.6rem 0.7rem;
    background: var(--sp-panel);
    border: 1px solid var(--sp-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    font: 0.74rem 'JetBrains Mono', Consolas, monospace;
    color: var(--sp-text);
  }
  .ctx-popup-title {
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--sp-text-dim);
    margin-bottom: 2rem;
  }
  .ctx-popup-row {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    line-height: 1.7;
    color: var(--sp-text-dim);
  }
  .ctx-popup-row b { color: var(--sp-text); font-weight: 600; }
  .ctx-popup-note { color: var(--sp-text-dim); line-height: 1.5; }
  .ctx-popup-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--sp-border);
    overflow: hidden;
    margin: 0.35rem 0;
  }
  .ctx-popup-bar > div { height: 100%; background: var(--sp-accent); }
  /* turn-profile popup: colour-coded time bands */
  .ctx-popup .rp-prefill { color: var(--sp-warn); }
  .ctx-popup .rp-decode { color: var(--sp-success); }
  .ctx-popup .rp-tool { color: var(--sp-accent); }
  .ctx-popup .rp-cx { color: var(--sp-text); }

  aside details.service {
    border: none;
    background: transparent;
    position: relative;
    --chamfer: 8px;
  }
  aside details.service summary {
    list-style: none;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sp-text-dim);
    user-select: none;
    background: var(--sp-bg);
    clip-path: polygon(var(--chamfer) 0, 100% 0, 100% calc(100% - var(--chamfer)), calc(100% - var(--chamfer)) 100%, 0 100%, 0 var(--chamfer));
    position: relative;
    z-index: 1;
    transition: color 0.15s, background 0.15s;
  }
  aside details.service summary::-webkit-details-marker { display: none; }
  aside details.service[open] summary {
    color: var(--sp-text);
    background: var(--sp-panel);
  }
  aside details.service summary:hover { color: var(--sp-text); background: var(--sp-panel); }
  aside details.service[open] .service-body {
    padding: 0.5rem 0.75rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    position: relative;
    z-index: 1;
  }
  aside details.service .service-body {
    padding: 0 0.75rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    position: relative;
    z-index: 1;
  }
  /* A closed <details> must hide its body. The rules above set display:flex on
     .service-body unconditionally, which overrides the native details collapse —
     so without this a section with no `open` attribute still renders expanded. */
  aside details.service:not([open]) .service-body { display: none; }
  aside .status-dot {
    margin-left: auto;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--sp-border);
    flex-shrink: 0;
  }
  aside .status-dot.ok   { background: var(--sp-accent); box-shadow: 0 0 4px var(--sp-accent-dim); }
  aside .status-dot.mem  { background: var(--sp-purple, #a78bfa); box-shadow: 0 0 4px rgba(167, 139, 250, 0.4); }
  aside .status-dot.warn { background: var(--sp-warn); box-shadow: 0 0 4px var(--sp-warn-dim); }
  aside .status-dot.err  { background: var(--sp-danger); box-shadow: 0 0 4px var(--sp-danger-dim); }

  aside .status-dot.busy { animation: status-dot-pulse 0.9s ease-in-out infinite; }
  @keyframes status-dot-pulse {
    0%, 100% { transform: scale(1);    opacity: 1;   }
    50%      { transform: scale(1.55); opacity: 0.55; }
  }
  /* ---- device-switch splash screen (full-screen Globe) ----------------- */
  #deviceSyncSplash { position: fixed; inset: 0; z-index: 9999; background: var(--sp-bg); display: flex; flex-direction: column; align-items: center; justify-content: center; }
  #deviceSyncSplash .splash-grid { position: absolute; inset: 0; background-image: radial-gradient(circle, var(--sp-border) 1px, transparent 1px); background-size: 24px 24px; opacity: 0.15; pointer-events: none; }
  #deviceSyncSplash .splash-glow { position: absolute; width: 420px; height: 420px; top: 50%; left: 50%; transform: translate(-50%, -50%); background: radial-gradient(circle, var(--sp-accent-dim) 0%, transparent 65%); border-radius: 50%; pointer-events: none; animation: splash-glow-pulse 4s ease-in-out infinite; }
  @keyframes splash-glow-pulse { 0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: .6; } 50% { transform: translate(-50%, -50%) scale(1.12); opacity: .9; } }
  #deviceSyncSplash .splash-content { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
  /* Entrance fade applies to the decorative elements only — the progress bar
     below is excluded so it's visible (and animating) from the very first frame. */
  #deviceSyncSplash .splash-icon-ring,
  #deviceSyncSplash .splash-brand,
  #deviceSyncSplash .splash-tagline { animation: splash-content-in .45s ease-out both; }
  @keyframes splash-content-in { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
  #deviceSyncSplash .splash-icon-ring { width: 120px; height: 120px; border-radius: 50%; position: relative; display: flex; align-items: center; justify-content: center; margin-bottom: 1.8rem; }
  #deviceSyncSplash .splash-icon-ring .ring-outer { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--sp-border); animation: splash-ring-spin 6s linear infinite; }
  #deviceSyncSplash .splash-icon-ring .ring-inner { position: absolute; inset: 14px; border-radius: 50%; border: 1.5px dashed var(--sp-accent-dim); animation: splash-ring-spin 10s linear infinite reverse; }
  @keyframes splash-ring-spin { to { transform: rotate(360deg); } }
  #deviceSyncSplash .splash-icon-ring .ring-emoji { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; color: var(--sp-text); }
  #deviceSyncSplash .splash-icon-ring .ring-svg { width: 46px; height: 46px; }
  #deviceSyncSplash .splash-brand { font-family: 'Share Tech Mono', monospace; font-weight: 400; font-size: 2.2rem; letter-spacing: 2px; color: var(--sp-text); }
  #deviceSyncSplash .splash-brand .bracket { color: var(--sp-accent); }
  #deviceSyncSplash .splash-tagline { font-size: 0.75rem; color: var(--sp-text-dim); letter-spacing: 2px; text-transform: uppercase; margin-top: 1.4rem; }
  #deviceSyncSplash .splash-progress { margin-top: 2.2rem; width: 220px; }
  #deviceSyncSplash .splash-progress-track { height: 4px; background: var(--sp-bg); border-radius: 4px; overflow: hidden; }
  /* BASE STATE = indeterminate pulse: the bar always animates, even before the
     cursor check returns. `.determinate` (added by JS) stops the pulse and lets
     the width be driven by download progress. */
  #deviceSyncSplash .splash-progress-fill { height: 100%; width: 40%; background: linear-gradient(90deg, var(--sp-accent), var(--sp-success)); border-radius: 4px; position: relative; animation: splash-indeterminate 1.1s ease-in-out infinite; }
  #deviceSyncSplash .splash-progress-fill::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.12) 50%, transparent 100%); animation: splash-shimmer 1.6s infinite; }
  @keyframes splash-shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
  #deviceSyncSplash .splash-progress-fill.determinate { width: 0%; animation: none; transition: width .3s ease; }
  @keyframes splash-indeterminate { 0% { margin-left: -42%; } 100% { margin-left: 100%; } }
  #deviceSyncSplash .splash-progress-label { display: flex; justify-content: space-between; margin-top: 0.55rem; font-size: 0.62rem; color: var(--sp-text-dim); letter-spacing: 1px; }

  /* Generic indeterminate loading state (file viewer office render, etc.) */
  .sp-loading { display: flex; flex-direction: column; align-items: center; gap: 0.9rem; padding: 2.5rem 1rem; color: var(--sp-text-dim); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; }
  .sp-loading .sp-bar { position: relative; width: 180px; height: 3px; background: var(--sp-border); border-radius: 2px; overflow: hidden; }
  .sp-loading .sp-bar::after { content: ''; position: absolute; top: 0; height: 100%; width: 40%; background: var(--sp-accent); border-radius: 2px; animation: sp-indeterminate 1.1s ease-in-out infinite; }
  @keyframes sp-indeterminate { 0% { left: -42%; } 100% { left: 100%; } }
  ul.conv-list li { cursor: pointer; transition: background 0.1s, border-color 0.1s; }
  /* Hover is a TEXT change only -- the background swap read as a second
     selected state next to .active. The colour lift lives in the .name rule
     below; nothing here paints a ground. */
  ul.conv-list li:hover { background: transparent; }
  ul.conv-list li.active,
ul.conv-list li.in-panel {
  background: var(--sp-panel);
  border-color: var(--sp-accent);
}
ul.conv-list li.active {
  outline: 1px solid var(--sp-accent);
}
  ul.conv-list li.lp-active { background: var(--sp-accent-dim); border-color: var(--sp-accent); }
  /* Multi-select (shift/ctrl click + rubber band): a row in the active selection. */
  ul.conv-list li.selected {
    background: var(--sp-accent-dim);
    border-color: var(--sp-accent);
  }
  ul.conv-list li.selected .name { color: var(--sp-text); }
  /* Sidebar hierarchy: the chat list is an INDEX, not content. Left at
     --sp-text every title competed with the message you are actually reading
     (and with the panel title), while every other label in the panel --
     timestamps, group headers, the count -- was already dim. Inactive names
     drop to --sp-text-dim; hover brings one back to full strength; the
     active row keeps whatever colour its theme paints on the <li>.

     `color: inherit` on the states below is load-bearing: several themes
     colour the ROW (e.g. ul.conv-list li.active { color: var(--sp-accent) }
     in a theme block) and let .name inherit it. A direct colour
     on .name would beat that inheritance and kill the accent. These rules
     must also stay AFTER the :hover rule -- they tie on specificity. */
  ul.conv-list li .name { color: var(--sp-text-dim); transition: color 0.1s; }
  [data-theme="olive"] ul.conv-list li .name { color: var(--sp-text-mid); }
  ul.conv-list li:hover .name { color: var(--sp-text); }
  ul.conv-list li.active .name,
  ul.conv-list li.in-panel .name,
  ul.conv-list li.lp-active .name,
  ul.conv-list li.conv-retitled .name { color: inherit; }
  /* Translucent rubber-band rectangle drawn when the user shift+drags on empty
     sidebar space; every conv row it intersects joins the selection. */
  .conv-rubber {
    position: fixed;
    background: rgba(88, 166, 255, 0.14);
    border: 1px solid var(--sp-accent);
    border-radius: 2px;
    pointer-events: none;
    z-index: 120;
  }
  /* Auto-title landing (auto-title.js → maybeAutoTitle): the row pulses accent
     while the generated name types itself in. The ring is a box-shadow, NOT
     border-color — the retitled row is usually the ACTIVE one, whose accent
     border/outline would visibly blink off when the keyframes ended. */
  ul.conv-list li.conv-retitled { animation: conv-retitle-pulse 900ms cubic-bezier(.22,.61,.36,1) 1; }
  @keyframes conv-retitle-pulse {
      0% { background: var(--sp-accent-dim); box-shadow: 0 0 0 1px var(--sp-accent), 0 0 10px 0 var(--sp-accent-dim); }
     55% { background: var(--sp-accent-dim); box-shadow: 0 0 0 1px var(--sp-accent), 0 0 6px 0 var(--sp-accent-dim); }
    100% { background: transparent; box-shadow: 0 0 0 0 transparent, 0 0 0 0 transparent; }
  }
  ul.conv-list li.conv-retitled .name { animation: conv-retitle-ink 900ms ease-out 1; }
  @keyframes conv-retitle-ink { 0%, 40% { color: var(--sp-accent); } 100% { color: var(--sp-text); } }
  /* Caret, only while characters are still being written. It rides at the end of
     .name, so on a title too long for the sidebar it is clipped along with the
     tail (text-overflow: ellipsis) — titles are 3-6 words, so that's rare. */
  ul.conv-list .name.conv-typing::after {
    content: '▌'; color: var(--sp-accent); margin-left: 1px;
    animation: conv-caret-blink 0.7s step-end infinite;
  }
  @keyframes conv-caret-blink { 50% { opacity: 0; } }
  @media (prefers-reduced-motion: reduce) {
    /* No pulse, no typing — the new title is simply there (JS checks the same
       query and skips straight to the final text). */
    ul.conv-list li.conv-retitled,
    ul.conv-list li.conv-retitled .name { animation: none; }
    ul.conv-list .name.conv-typing::after { content: none; }
  }
  ul.conv-list li.archived { opacity: 0.75; }   /* was 0.55: names are dim now, and 0.55 on top of that fell below AA */

  /* ── Sidebar date-group headers ────────────────────────────────────────────
     Rendered as <li> inside the list so they flow with it, but they carry no
     data-cid, which is what keeps every selection path (highlight, shift-range,
     rubber band) from ever seeing them. These rules sit AFTER the row rules
     above because they tie on specificity with `ul.conv-list li:hover`. */
  ul.conv-list li.conv-group {
    display: block;
    margin-top: 0.5rem;
    padding: 0.5rem 0.5rem 0.5rem;
    background: transparent;
    border: none;
    border-radius: 0;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--sp-text-dim);
    cursor: default;
    user-select: none;
    /* Clicks fall through to the <ul>, so a shift+drag that starts on a header
       still begins a rubber-band selection instead of dying on it. */
    pointer-events: none;
  }
  ul.conv-list li.conv-group:first-child { padding-top: 0.1rem; }

  /* Collapsible groups: the header row IS the control -- no inner button.
     pointer-events go back to auto, which the rubber band survives: its
     listener is on the <ul>, the event still bubbles there, and the band only
     bails when the target sits inside an li[data-cid]. A header has no cid. */
  ul.conv-list li.conv-group[role="button"] {
    pointer-events: auto;
    display: flex; align-items: center; gap: 0.35rem;
    /* ul.fs-list li sets justify-content:space-between (name left, meta right);
       a header is one group of three spans, so it packs to the start instead --
       without this the chevron pinned left and the label flew to the right. */
    justify-content: flex-start;
    white-space: nowrap;      /* "LAST WEEK" wrapped to two lines without this */
    cursor: pointer;
  }
  ul.conv-list li.conv-group:hover { color: var(--sp-text); }
  ul.conv-list li.conv-group:focus-visible {
    outline: 1px solid var(--sp-accent); outline-offset: 2px; border-radius: 3px;
  }
  /* No chevron: a closed group is signalled by its hidden-row count appearing
     and its rows going away. The affordance that a header is clickable is the
     pointer cursor plus the colour lift on hover. */
  /* The count appears only while the group is closed, so an open list carries
     no extra numbers. :empty keeps the gap from reserving space. */
  ul.conv-list li.conv-group .cg-n {
    font-size: 0.55rem; letter-spacing: 0.06em;
    opacity: 0.6; font-variant-numeric: tabular-nums;
  }
  ul.conv-list li.conv-group .cg-n:empty { display: none; }
  /* Rows of a closed group. A class, not [hidden]: ul.fs-list li sets
     display:flex, which would beat [hidden]'s display:none. */
  ul.conv-list li.conv-row-hidden { display: none; }

/* Shared file section — mirrors Archived conversation pattern */
.shared-toggle {
    background: transparent; border: none; color: var(--sp-text-dim);
    font: 0.7rem inherit; padding: 0.45rem 0.4rem 0.15rem; justify-content: flex-start;
    letter-spacing: 0.04em; text-transform: uppercase;
    cursor: pointer; margin-top: 0.6rem;
  }
.shared-toggle:hover { color: var(--sp-text); background: transparent; border: none; }
.shared { opacity: 0.55; }
  ul.conv-list .name { font-family: inherit; font-size: 0.78rem; }
  ul.conv-list li .gen-dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--sp-accent);
    box-shadow: 0 0 5px var(--sp-accent-dim);
    flex-shrink: 0;
    min-width: 0;
    font-size: 0;
    text-align: left;
    animation: status-dot-pulse 0.9s ease-in-out infinite;
  }
  ul.conv-list li .conv-meta {
    width: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    color: var(--sp-text-dim);
    opacity: 0.6;
    flex-shrink: 0;
    text-align: right;
    user-select: none;
  }
  .conv-meta.just-done svg { width: 0.8rem; height: 0.8rem; display: block; }
  ul.conv-list li .conv-meta.unseen {
    color: var(--sp-accent);
    opacity: 0.9;
    font-weight: 600;
  }

  .conv-host {
    display: flex; flex-direction: column; gap: 1rem;
    flex: 1 1 auto; min-height: 0;
    /* Anchor by default so reading AND chunked loading never jiggle — the browser
       holds the viewport through prepends and async reflow (artifacts/images/
       KaTeX). Measured: overflow-anchor:auto = 0px drift vs 150px with manual
       compensation. */
    overflow-y: auto; padding: 1.5rem; scrollbar-gutter: stable; overflow-anchor: auto;
    padding-inline: max(1.5rem, calc((100% - var(--sp-chat-max-w)) / 2));
  }
  /* Only during active streaming do we hand scroll control back to the app's
     manual token-by-token scroll-to-bottom — auto anchoring would fight it. */
  .conv-host.sp-streaming { overflow-anchor: none; }

  /* Rail scrollbar — conversation area ONLY (modules/scrollbar.js).
     The native bar is hidden on .conv-host and replaced by a rail drawn in the
     pane: hairline track, square thumb, one accent tick per user turn. Ghost
     behaviour: invisible at rest, fades in on hover / focus-within / drag and
     for 900ms after a scroll. Every other scrollable keeps the quiet native bar
     above. Colours come from the scrollbar/accent tokens, never --sp-border
     alone, so a theme with hard borders does not leak them into the thumb. */
  .osb-host { scrollbar-width: none; scrollbar-gutter: auto; }
  .osb-host::-webkit-scrollbar { display: none; }
  #messagesSide.osb-pane { position: relative; }   /* #messages already is */
  /* Sidebar rail mounts in <body>. body is 100vh at 0,0 with margin reset, so
     positioning it changes nothing for its other absolute children. */
  body.osb-pane { position: relative; }
  .osb-rail.osb-aside { z-index: 3; }              /* above aside (z 2), below the resize handle (z 10) and modals */
  /* The aside has no right padding: the native bar's gutter used to keep the
     chat titles off the edge. With the bar hidden, reserve the rail's lane
     (4px gap + 10px rail) so titles ellipsize before it instead of under it. */
  aside.osb-host { padding-right: 14px; }
  .osb-rail.osb-aside .osb-thumb { left: 3px; right: 3px; }   /* 4px thumb: a list wants a quieter bar than the conversation */
  .osb-rail {
    position: absolute; width: 10px; z-index: 30;  /* top/left set by JS in mount coordinates */
    opacity: 0; transition: opacity 0.35s ease; touch-action: none;
    /* An invisible rail must not eat clicks near the host's right edge, so it
       only takes pointer events while it is actually on screen. Hover still
       works: events fall through to the host, whose pointerenter shows it. */
    pointer-events: none;
  }
  .osb-rail.osb-show, .osb-rail.osb-scrolling, .osb-rail.osb-dragging { opacity: 1; transition-duration: 0.12s; pointer-events: auto; }
  .osb-rail::before { content: ""; position: absolute; top: 0; bottom: 0; left: 4px; background: var(--sp-scrollbar); }
  .osb-thumb {
    position: absolute; left: 1px; right: 1px; top: 0; min-height: 24px;
    background: var(--sp-scrollbar-hover); cursor: grab; will-change: transform;
    /* Eased follow: scroll updates land once per frame, so without a transition
       a wheel tick moves the thumb in one hard step. 90ms is short enough to
       feel attached, long enough to read as motion. Height eases too — it only
       changes while a reply streams. Dragging turns it off so the thumb sits
       exactly under the pointer. */
    transition: background 0.2s, transform 0.09s ease-out, height 0.15s ease-out;
  }
  .osb-rail.osb-dragging .osb-thumb { transition: background 0.2s; }
  .osb-rail:hover .osb-thumb, .osb-rail.osb-dragging .osb-thumb { background: var(--sp-accent); }
  .osb-rail.osb-dragging .osb-thumb { cursor: grabbing; }
  .osb-ticks { position: absolute; inset: 0; pointer-events: none; }
  .osb-ticks i { position: absolute; left: 0; right: 0; height: 1px; background: var(--sp-accent); opacity: 0.8; }
  @media (prefers-reduced-motion: reduce) {
    .osb-rail, .osb-thumb, .osb-rail.osb-dragging .osb-thumb { transition: none; }
  }

  @media (prefers-reduced-motion: reduce) {
  }

  .mobile-header { display: none; }
  .backdrop { display: none; }

  /* The chat list is the panel's only body content now that the identity footer
     is gone, so it takes the whole remaining column height instead of stopping
     at the height of its rows. */
  #convSection { flex: 1 1 auto; min-height: 0; }

  /* Panel head -- the brand and the icon buttons moved to the rail, so this row
     is now just a label for what the panel holds. */
  .sidebar-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0 0.25rem 0.6rem 0.25rem;
    margin-bottom: 0.15rem;
    border-bottom: 1px solid var(--sp-border);
    flex-shrink: 0;
  }
  .sp-panel-title {
    font-size: 0.86rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--sp-text);
  }
  .sp-panel-count {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 0.62rem;
    color: var(--sp-text-dim);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  /* Sidebar sort toggle (time / project) - sits right of the count. */
  .sort-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
  }
  .sort-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--sp-text-dim);
    cursor: pointer;
  }
  .sort-btn .material-symbols-outlined { font-size: 15px; }
  .sort-btn:hover { color: var(--sp-text); background: var(--sp-panel); }
  .sort-btn.active { color: var(--sp-text); }
  .mobile-header .brand .bracket { color: var(--sp-accent); transition: color 0.15s; }
  .mobile-header .brand .name { transition: color 0.15s; }
  /* Shared look for the sidebar collapse button. */
  .sidebar-collapse-btn {
    background: var(--sp-bg);
    border: 1px solid var(--sp-border);
    color: var(--sp-text);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    clip-path: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    padding: 0;
  }
  /* Material Symbols' own class sets font-size: 24px on the span, which beats the
     button's inherited font-size -- size the icon directly. */
  .sidebar-collapse-btn .material-symbols-outlined { font-size: 20px; }
  .sidebar-collapse-btn:hover {
    background: var(--sp-surface);
    color: var(--sp-accent);
    box-shadow: 0 0 20px 4px var(--sp-accent-dim), 0 0 40px 6px var(--sp-accent-dim), 0 4px 8px rgba(0,0,0,0.6);
  }
  aside.collapsed {
    width: 0;
    padding: 0;
    border: none;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
  }
  aside.collapsed .sidebar-header,
  aside.collapsed .service,
  aside.collapsed .navbar {
    display: none;
  }
  /* -- Icon rail ----------------------------------------------------------
     ALWAYS visible: a normal flex child of <body>, to the left of <aside>,
     holding the brand mark, the panel toggle, new chat, files and the identity
     avatar. It survives the panel being collapsed, which is the point --
     collapsing now hides the chat list only, never the controls. */
  .sidebar-rail {
    flex: none;
    width: var(--rail-w, 46px);
    background: var(--sp-rail);
    border-right: 1px solid var(--sp-rail-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.85rem 0 max(0.85rem, env(safe-area-inset-bottom));
    z-index: 3;
  }
  .rail-mark {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.9rem;
    letter-spacing: 1px;
    color: var(--sp-rail-ink-hot);
    margin-bottom: 0.5rem;
    user-select: none;
    text-decoration: none;           /* it is a link now (opens the landing page) */
    -webkit-tap-highlight-color: transparent;
  }
  .rail-mark:active { opacity: .6; }
  /* One button style for the whole rail, driven only by the rail tokens, so no
     per-theme .files-open-btn / .sidebar-collapse-btn rule can leak in. */
  .rail-btn {
    position: relative;
    width: 32px; height: 32px;
    flex: none;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--sp-rail-ink);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    clip-path: none;
    transition: background 0.15s ease, color 0.15s ease;
  }
  .rail-btn .material-symbols-outlined { font-size: 19px; color: inherit; }
  /* The rail menu toggle (restore-sidebar counterpart of .au-hide) matches it at 20px. */
  #sidebarRail button.rail-btn:first-of-type .material-symbols-outlined { font-size: 20px; }
  .rail-btn:hover {
    background: var(--sp-rail-hot-bg);
    color: var(--sp-rail-ink-hot);
  }
  .rail-btn:focus-visible {
    outline: 2px solid var(--sp-rail-ink-hot);
    outline-offset: 1px;
  }
  /* Identity avatar pinned to the rail's bottom */
  .rail-id-btn {
    margin-top: auto;
    width: 32px; height: 32px;
    flex: none;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    cursor: pointer; user-select: none;
    background: var(--sp-rail-hot-bg);
    color: var(--sp-rail-ink);
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  }
  .rail-id-btn:hover {
    color: var(--sp-rail-ink-hot);
    transform: translateY(-1px);
  }
  .sb-avatar-svg { width: 20px; height: 20px; }
  /* ── Unseen-completion badge ───────────────────────────────────────────────
     Rides the sidebar toggle. Hidden by default; JS sets [hidden] when the count
     is zero, and the :not([hidden]) rules below opt it back in for exactly the
     states where the list itself is not already on screen. */
  .sp-badge {
    display: none;
    position: absolute; top: -3px; right: -3px;
    min-width: 15px; height: 15px;
    padding: 0 3px;
    border-radius: 999px;
    font: 600 9px/1 'JetBrains Mono', Consolas, monospace;
    font-variant-numeric: tabular-nums;
    align-items: center; justify-content: center;
    pointer-events: none;
  }
  /* Desktop: only while the list is collapsed — with it open you can read the
     rows themselves. Colours come from the RAIL tokens, so the ball stays
     legible on a rail that inverts to near-black in the light themes. */
  body.sidebar-collapsed .sidebar-rail .sp-badge:not([hidden]) {
    display: flex;
    background: var(--sp-rail-ink-hot);
    color: var(--sp-rail);
    box-shadow: 0 0 0 2px var(--sp-rail);
  }

  @media (max-width: 768px), (hover: none) and (pointer: coarse) {
    .artifact-grid { grid-template-columns: minmax(0, 400px); }
    .osb-rail.osb-aside { display: none; }   /* drawer is fixed + animated; touch gets the native indicator */
    aside.osb-host { scrollbar-width: auto; }
    aside.osb-host { padding-right: 0; }
    aside.osb-host::-webkit-scrollbar { display: initial; }
    body {
      flex-direction: column;

      height: 100vh;
      height: 100dvh;
    }
    .mobile-header {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      padding: 0.5rem 0.75rem;
      padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));   /* Android app / iOS: the header runs under the status bar (viewport-fit=cover) */
      background: var(--sp-surface);
      border-bottom: 1px solid var(--sp-border);
      flex: 0 0 auto;

      position: relative;
      z-index: 101;
    }
    .mobile-header .hamburger {
      width: 44px; height: 44px;
      padding: 0;
      background: transparent;
      border: 1px solid var(--sp-border);
      border-radius: 6px;
      color: var(--sp-text);
      font-size: 1.2rem;
      cursor: pointer;
      display: flex; align-items: center; justify-content: center;
    }
    .mobile-header .hamburger:active { background: var(--sp-panel); }
    .mobile-header .brand {
      font-family: 'Share Tech Mono', monospace;
      font-weight: 400;
      font-size: 1.15rem;
      letter-spacing: 2px;
      color: var(--sp-text);
      position: relative;
      display: inline-block;
      text-decoration: none;           /* it is a link now (opens the landing page) */
      -webkit-tap-highlight-color: transparent;
    }
    .mobile-header .brand:active { opacity: .6; }
    aside {
      position: fixed;

      top: max(calc(env(safe-area-inset-top, 0px) + 49px));
      bottom: 0;
      left: -100%;
      width: min(85vw, 320px);
      z-index: 100;
      transition: left 0.22s ease-out;
      padding-top: 1rem;
      padding-bottom: max(1rem, env(safe-area-inset-bottom));
      box-shadow: 0 0 24px rgba(0,0,0,0.4);
    }
    aside.collapsed {
      width: min(85vw, 320px);
      padding: 1rem;
      left: -100%;
    }
    /* The mobile header already carries brand + new chat + files + toggle, so
       the rail would only duplicate it beside an off-screen drawer. */
    .sidebar-rail { display: none; }
    /* No rail here, so the badge rides the header hamburger, and the drawer
       being OPEN is the mobile equivalent of the desktop list being expanded —
       body.sidebar-collapsed means nothing on this breakpoint. Neutral ink
       rather than the accent: it sits on --sp-surface, where a pale accent
       (e.g. a pastel one) would not hold its own against white. */
    .mobile-header .sidebar-collapse-btn { position: relative; }
    .mobile-header .sp-badge:not([hidden]) {
      display: flex;
      background: var(--sp-text);
      color: var(--sp-bg);
      box-shadow: 0 0 0 2px var(--sp-surface);
    }
    body.sidebar-open .mobile-header .sp-badge { display: none; }
    .sidebar-resize-handle { display: none; }
    body.sidebar-open aside { left: 0; }
    .backdrop {
      display: block;
      position: fixed;
      inset: 0;
      background: rgba(0,0,0,0.6);
      z-index: 99;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.22s;
    }
    body.sidebar-open .backdrop {
      opacity: 1;
      pointer-events: auto;
    }

    main { flex: 1 1 auto; min-height: 0; }

    body.side-open #messagesSide,
    body.artifact-side-open #messagesSide,
    body.viewer-side-open #messagesSide { display: none !important; }
    .pane-titlebar { display: none !important; }
    body.side-open #messages { flex: 1; }
    #sideResizer { display: none !important; }

    aside input, aside button:not(.sort-btn) {
      padding: 0.65rem 0.75rem;
      font-size: 0.95rem;
    }
    aside details.service summary { padding: 0.75rem 0.85rem; font-size: 0.85rem; }
    ul.fs-list button { width: 28px; height: 28px; font-size: 1.1rem; }
    form {
      padding: 0rem 1rem;
      padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    }
    form input, form textarea { font-size: 16px;  }
    .conv-host, #homeCenter { padding: 1rem; }
    /* Desktop .msg-timer sits 1.75rem from the pane edge over a 1.5rem form padding
       (0.25rem inset). Mobile form padding drops to 1rem, so match the same inset:
       1.25rem keeps the timer's visual offset from the composer identical. */
    .msg-timer { padding-left: 1.25rem; padding-right: 1.75rem; }
    /* Chat width cap is desktop-only: pin every capped element back to its
       fixed mobile padding so --sp-chat-max-w has no effect on phones. */
    .conv-host, form.composer, .dock-body { padding-inline: 1rem; }
    .msg { max-width: 95%; }

    /* Settings modal — the desktop two-column (150px nav | panels) layout leaves
       the actual settings panels far too narrow on a phone. Go near-full-width
       and stack the nav as a horizontal, scrollable tab strip on top, so the
       panels get the modal's full width. */
    #settingsModal .modal-content {
      width: 96vw !important;
      max-width: none !important;
      max-height: 90vh !important;
      max-height: 90dvh !important;
    }
    #settingsModal .modal-content > div:last-child { flex-direction: column; }
    #settingsNav {
      flex: 0 0 auto !important;
      flex-direction: row !important;
      gap: 0.4rem !important;
      padding: 0.5rem 0.6rem !important;
      border-right: none !important;
      border-bottom: 1px solid var(--sp-border) !important;
      overflow-x: auto !important;
      overflow-y: hidden !important;
      scrollbar-width: none;
    }
    #settingsNav::-webkit-scrollbar { display: none; }
    #settingsNav button { flex: 0 0 auto; white-space: nowrap; }
    #settingsPanels { padding: 0.9rem 1rem !important; }
  }
  .chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.3rem;
  }
  .chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.7rem;
    border-radius: 12px;
    font-size: 0.78rem;
    background: var(--sp-panel);
    border: 1px solid var(--sp-border);
    color: var(--sp-text-dim);
    cursor: pointer;
    user-select: none;
    transition: all 0.15s;
    white-space: nowrap;
  }
  .chip:hover {
    border-color: var(--sp-text-dim);
    color: var(--sp-text);
  }
  .chip.add {
    border-style: dashed;
  }
  /* Settings-modal model list: informational chips — not selectable, no active state */
  .chip.plain {
    cursor: default;
    user-select: text;
  }
  .chip.plain:hover {
    border-color: var(--sp-border);
    color: var(--sp-text-dim);
  }
  .modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
  }
  .modal-content {
    position: relative;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    padding: 1.2rem;
    width: 90%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
  }
  .modal-content h3 {
    margin: 0 0 0.3rem 0;
    font-size: 1rem;
    font-weight: 600;
  }
  .modal-content input {
    width: 100%;
    padding: 0.5rem;
    background: var(--sp-bg);
    border: 1px solid var(--sp-border);
    border-radius: 6px;
    color: var(--sp-text);
    font-size: 0.85rem;
  }
  /* Match the provider-form dropdowns (type / model picker) to the inputs above. */
  #providerForm select {
    width: 100%;
    padding: 0.5rem;
    background: var(--sp-bg);
    border: 1px solid var(--sp-border);
    border-radius: 6px;
    color: var(--sp-text);
    font-size: 0.85rem;
    cursor: pointer;
  }
  #providerForm select option { background: var(--sp-surface); color: var(--sp-text); }
  .modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.4rem;
  }
  /* sandpiePrompt (core.js): in-page prompt() — above menus and every modal it can be
     raised from (Files 1100, file viewer 1000, pickers 2000); below the splash/tips (9999). */
  .sp-prompt { z-index: 5000; }
  .sp-prompt .sp-prompt-msg { font-size: 0.85rem; color: var(--sp-text); }
  .sp-prompt .modal-actions button { border-radius: 6px; padding: 0.35rem 0.8rem; font: inherit; font-size: 0.8rem; cursor: pointer; }
  .sp-prompt .sp-prompt-cancel { background: var(--sp-panel); color: var(--sp-text-dim); border: 1px solid var(--sp-border); }
  .sp-prompt .sp-prompt-cancel:hover { background: var(--sp-surface); color: var(--sp-text); border-color: var(--sp-border-bright); }
  .sp-prompt .sp-prompt-ok { background: var(--sp-accent); color: var(--sp-bg); border: 1px solid var(--sp-accent); }
  .sp-prompt .sp-prompt-ok:hover { filter: brightness(1.1); }
  .context-menu {
    position: fixed;
    z-index: 300;
    background: var(--sp-surface);
    border: 1px solid var(--sp-border);
    border-radius: 6px;
    padding: 0.3rem 0;
    min-width: 120px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  }


  /* ---- Tool call: Terminal aesthetic ----
     Collapsed: bare >>> prompt line, no border, no background.
     Hover: subtle panel bg + border.
     Expanded: header becomes terminal title bar, body unfolds below. */
  .tool-call {
    display: flex;
    flex-direction: column;
    align-self: flex-start;
    width: fit-content;
    max-width: 88%;
    font: 12px/1.5 'JetBrains Mono', 'Space Mono', ui-monospace, monospace;
  }
  .tool-call .tc-collapsed {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s ease, border-color 0.15s ease;
  }
  .tool-call .tc-collapsed:hover {
    background: var(--sp-panel);
    border-color: var(--sp-border);
  }
  .tool-call.expanded .tc-collapsed {
    background: var(--sp-panel);
    border: 1px solid var(--sp-border);
    border-radius: 6px 6px 0 0;
    border-bottom: 1px solid var(--sp-border);
    padding: 0.2rem 0.6rem;
  }
  .tool-call { padding: 0; }
  .tool-call .tc-expanded { display: none; }
  .tool-call.expanded .tc-expanded { display: block; }

  .tc-prompt {
    flex-shrink: 0;
    color: var(--sp-accent);
    font-weight: 700;
  }

  /* ---- Task Register: consecutive tool calls grouped in one block titled by
     the active checklist item (tgLogFor in conversations.js). Collapsed, only
     the newest call row shows, so a long grind stays one block tall; the header
     strip draws one DRAM-style cell per call (pulsing = running) plus a hollow
     cell per remaining checklist item. */
  .msg.tool-group {
    padding: 0;
    align-self: flex-start;
    width: fit-content;
    min-width: min(22rem, 100%);
    max-width: 88%;
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    overflow: hidden;
    font: 12px/1.5 'JetBrains Mono', 'Space Mono', ui-monospace, monospace;
  }
  /* Tray layout: row 1 is pure text (">>> title ▸", title wraps by word); the
     cells + counter sit in a tinted footer tray under a hairline, so the
     machinery reads as its own stratum. */
  .tool-group .tg-hd {
    display: flex; flex-direction: column;
    border-bottom: 1px solid var(--sp-border);
    cursor: pointer; user-select: none;
  }
  .tool-group .tg-row {
    display: flex; align-items: flex-start; gap: 0.5rem;
    padding: 0.38rem 0.7rem;
    transition: background 0.15s ease;
  }
  .tool-group .tg-hd:hover .tg-row { background: var(--sp-panel); }
  .tool-group .tg-prompt { flex: none; color: var(--sp-accent); font-weight: 700; }
  /* The title is the user's main feedback — never truncate it; wrap by WORD
     (break-word: mid-word breaks only when a single word can't fit at all). */
  .tool-group .tg-title {
    color: var(--sp-text-dim);
    flex: 1 1 auto; min-width: 0; overflow-wrap: break-word;
  }
  /* Untitled register (no active task): VISIBLE — Claude-mode todos have no
     plan-first gate, so real work can run before/without a checklist. The
     header self-titles from the latest call's own label (tgUpdate). A group
     holding only planning/bookkeeping still hides whole via .tg-empty. */

  /* Local-file references in replies (hydrateLocalRefs): clickable paths open
     the file viewer; OPFS images render inline. */
  .msg .lr-file { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 2px; }
  .msg .lr-file:hover { color: var(--sp-accent); }
  .msg img[data-lr-done] { display: block; border-radius: 6px; margin: 0.35rem 0; }
  .tool-group .tg-tray {
    display: flex; align-items: center; gap: 0.6rem;
    background: var(--sp-panel);
    padding: 0.3rem 0.7rem;
  }
  .tool-group .tg-count { flex: none; margin-left: auto; color: var(--sp-text-dim); font-size: 10.5px; white-space: nowrap; }
  .tool-group .tg-count.tick { animation: tg-count-pop 0.3s ease; }
  @keyframes tg-count-pop { 30% { transform: scale(1.2); color: var(--sp-accent); } }
  .tool-group .tg-strip {
    display: flex; align-items: center; gap: 3px;
    flex-wrap: wrap; justify-content: flex-start;
    flex: 1 1 auto; min-width: 0;
  }
  .tool-group .tg-cell {
    width: 6px; height: 6px; border-radius: 1.5px; background: var(--sp-accent); flex: none;
    animation: tg-cell-in 0.28s ease;
  }
  .tool-group .tg-cell.run {
    background: transparent;
    outline: 1.5px solid var(--sp-accent); outline-offset: -1.5px;
    /* tg-cell-in stays first in BOTH lists: animations persist by name, so
       toggling .run mid-flight never restarts the entrance. */
    animation: tg-cell-in 0.28s ease, tg-pulse 1s ease-in-out infinite;
  }
  /* Estimated-remainder cell: hollow, border-toned; fills (drops .est) as the
     call it predicted actually lands. */
  .tool-group .tg-cell.est { background: transparent; outline: 1px solid var(--sp-border); outline-offset: -1px; }
  @keyframes tg-cell-in { from { width: 0; opacity: 0; } }
  @keyframes tg-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
  @media (prefers-reduced-motion: reduce) {
    .tool-group .tg-cell, .tool-group .tg-cell.run, .tool-group .tg-count.tick { animation: none; }
  }
  .tool-group .tg-log { display: flex; flex-direction: column; padding: 0.15rem 0.3rem; }
  /* Planning (write_todos) rows are bookkeeping, not work: never shown, in any
     state, grouped OR loose (the pre-plan call lands ungrouped) — the checklist
     stays reachable via the timer badge. A register holding only planning hides
     entirely (tgUpdate/tcMarkPlan set the classes). */
  .msg.tool-call.tc-plan { display: none; }
  .msg.tool-group.tg-empty { display: none; }
  /* Collapsed register: the header pill ALONE — running calls included (a live
     call is signalled by the pulsing strip cell, not a row, so nothing janks
     as sub-second calls come and go). The log lives behind the header toggle. */
  .tool-group:not(.tg-open) .tg-hd { border-bottom: none; }
  .tool-group:not(.tg-open) .tg-log { display: none; }
  .tool-group .tg-log > .msg.tool-call { max-width: 100%; }

  .tool-box {
    background: var(--sp-bg);
    border: 1px solid var(--sp-border);
    border-top: none;
    border-radius: 0 0 6px 6px;
    overflow: hidden;
  }
  .tool-box .tool-code {
    padding: 0.3rem 0.6rem;
    color: var(--sp-text);
    font: 11px/1.5 'JetBrains Mono', 'Space Mono', ui-monospace, monospace;
    white-space: pre-wrap;
    overflow-x: auto;
  }
  .tool-box .tool-code .line::before {
    content: ">>> ";
    color: var(--sp-text-dim);
    user-select: none;
    font-size: 10px;
    opacity: 0.5;
  }
  .tool-box .tool-sep {
    margin: 0 0.6rem;
  }
  .tool-box .tool-result {
    padding: 0.3rem 0.6rem;
    color: var(--sp-accent);
    font: 11px/1.5 'JetBrains Mono', 'Space Mono', ui-monospace, monospace;
    white-space: pre-wrap;
  }
  .tool-box .tool-result-image { padding: 0.4rem 0.6rem; }
  .tool-box .tool-todos {
    padding: 0.35rem 0.6rem 0.45rem;
    font: 11px/1.5 'JetBrains Mono', 'Space Mono', ui-monospace, monospace;
  }
  .tool-box .tool-todos-head {
    color: var(--sp-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 10px;
    margin-bottom: 0.3rem;
  }
  .tool-box .tool-todo {
    display: flex;
    gap: 0.65rem;
    align-items: baseline;
    padding: 1px 0;
    color: var(--sp-text);
  }
  .tool-box .tool-todo-mark { flex: none; width: 1ch; text-align: center; }
  .tool-box .tool-todo-completed { color: var(--sp-text-dim); }
  .tool-box .tool-todo-completed .tool-todo-text { text-decoration: line-through; }
  .tool-box .tool-todo-completed .tool-todo-mark { color: #3fb950; }
  .tool-box .tool-todo-in_progress { color: var(--sp-accent); }
  .tool-box .tool-todo-in_progress .tool-todo-mark { color: var(--sp-accent); }
  .tool-box .tool-todo-pending .tool-todo-mark { color: var(--sp-text-dim); }
  .tool-box .tool-todo-wait { color: var(--sp-warn); }
  .tool-box .tool-todo-wait .tool-todo-mark { color: var(--sp-warn); }
  /* Claim badges: hypothesis items + their evidence-backed verdicts. */
  .tool-box .tool-todo-claim-badge {
    flex: none; font-size: 10px; font-weight: 600; letter-spacing: 0.4px;
    padding: 0 5px; border-radius: 8px; line-height: 16px; align-self: center;
    border: 1px solid var(--sp-text-dim); color: var(--sp-text-dim);
  }
  .tool-box .tool-todo-claim-badge.claim-confirmed { border-color: #3fb950; color: #3fb950; }
  .tool-box .tool-todo-claim-badge.claim-refuted { border-color: #f85149; color: #f85149; }
  .tool-box .tool-todo-evidence { flex: none; font-size: 10px; color: var(--sp-text-dim); align-self: center; }
  /* Blocked-by dependency indicator (⛓ + blocker ids). */
  .tool-box .tool-todo-blocked { flex: none; font-size: 10px; color: var(--sp-text-dim); align-self: center; opacity: .8; }
  /* Auto-adversary audit badges: ✓ pass, ! overridden after repeated fails,
     · skipped/unavailable, ×N close rejected N times. Hover for full text. */
  .tool-box .tool-todo-audit-badge {
    flex: none; font-size: 10px; font-weight: 600; letter-spacing: 0.4px;
    padding: 0 5px; border-radius: 8px; line-height: 16px; align-self: center;
    border: 1px solid var(--sp-text-dim); color: var(--sp-text-dim); cursor: help;
  }
  .tool-box .tool-todo-audit-badge.audit-pass { border-color: #3fb950; color: #3fb950; }
  .tool-box .tool-todo-audit-badge.audit-override { border-color: #d29922; color: #d29922; }
  .tool-box .tool-todo-audit-badge.audit-fail { border-color: #f85149; color: #f85149; }
  .tool-box .tool-todo-audit-badge.audit-clickable { cursor: pointer; }
  .tool-box .tool-todo-audit-badge.audit-clickable:hover { filter: brightness(1.3); }
  .tool-todo-audit-log { white-space: pre-wrap; word-break: break-word; font-size: 12px; line-height: 1.5; margin: 0; padding: 8px 4px; }
  /* ask-card: multiple-choice clarification (Mockup B — conversational bubble) */
  .ask-card {
    align-self: flex-start;
    width: fit-content;
    max-width: 88%;
    background: var(--sp-panel);
    border: 1px solid var(--sp-accent);
    border-radius: 14px 14px 14px 4px;
    padding: 1rem 1.1rem;
    margin: 0.25rem 0;
    box-shadow: 0 0 30px var(--sp-accent-dim);
    font: 12px/1.5 'JetBrains Mono','Space Mono',ui-monospace,monospace;
  }
  .ask-card-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
  }
  .ask-card-head .ask-q-icon {
    width: 26px; height: 26px;
    background: var(--sp-accent-dim);
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; color: var(--sp-accent); font-weight: 700;
    flex-shrink: 0;
  }
  .ask-card-head .ask-q-title {
    font-size: 13px; font-weight: 600; color: var(--sp-text); letter-spacing: 0.2px;
    line-height: 1.35;
  }
  .ask-card-head .ask-qcount {
    margin-left: auto;
    font-size: 11px; color: var(--sp-text-dim);
    background: var(--sp-bg);
    padding: 1px 8px; border-radius: 10px;
  }
  .ask-q {
    margin-bottom: 0.5rem;
  }
  .ask-q { margin-bottom: 0.5rem; }
  .ask-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  .ask-chip {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--sp-border);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    background: var(--sp-surface);
    color: var(--sp-text);
    transition: all 0.12s;
    user-select: none;
  }
  .ask-chip .chip-label { flex: 1; }
  .ask-chip:hover { border-color: var(--sp-accent); background: var(--sp-panel); }
  .ask-chip.selected {
    border-color: var(--sp-accent);
    background: var(--sp-accent-dim);
    color: var(--sp-accent);
  }
  .ask-chip[data-rec="1"] { border-color: var(--sp-accent); border-style: dashed; }
  .ask-chip[data-rec="1"].selected { border-style: solid; }
  .ask-chip .chip-radio { font-size: 10px; }
  .ask-chip .chip-rec {
    font-size: 9px;
    color: var(--sp-accent);
    background: var(--sp-panel);
    padding: 0 5px; border-radius: 8px;
    letter-spacing: 0.3px;
  }
  .ask-free-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0.5rem;
    background: var(--sp-bg);
    border: 1px solid var(--sp-border);
    border-radius: 10px;
    padding: 0.35rem 0.8rem;
    color: var(--sp-text);
    font: 12px/1.5 'JetBrains Mono',monospace;
    outline: none;
    resize: none;                 /* vertical growth handled by JS auto-grow */
    overflow-y: hidden;
    min-height: 28px;
    line-height: 1.5;
  }
  .ask-free-input:focus { border-color: var(--sp-accent); }
  .ask-free-input.selected {
    border-color: var(--sp-accent);
    background: var(--sp-accent-dim);
    color: var(--sp-accent);
  }
  .ask-free-input::placeholder { color: var(--sp-text-dim); opacity: 0.8; }
  .ask-dots {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin: 0.6rem 0 0.4rem;
  }
  .ask-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--sp-border);
    transition: background 0.2s;
  }
  .ask-dot.active { background: var(--sp-accent); }
  .ask-dot.done { background: var(--sp-accent-dim); }
  .ask-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    padding-top: 0.6rem;
  }
  .ask-btn {
    font: 11px/1.4 'JetBrains Mono',monospace;
    padding: 0.35rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--sp-border);
    cursor: pointer;
    background: var(--sp-surface);
    color: var(--sp-text);
    transition: 0.12s;
  }
  .ask-btn:hover { border-color: var(--sp-border-bright); background: var(--sp-panel); }
  .ask-btn.primary {
    background: var(--sp-accent);
    color: var(--sp-bg);
    border-color: var(--sp-accent);
    font-weight: 600;
  }
  .ask-btn.primary:hover { filter: brightness(1.1); }
  /* Read-only answers summary rendered inside the ask tool-box (the raw
     'answers:[...]' JSON stays model-only). One Q → A pair per row. */
  .ask-answered {
    padding: 0.3rem 0.6rem 0.4rem;
    font: 11px/1.6 'JetBrains Mono','Space Mono',ui-monospace,monospace;
  }
  .ask-answered-q { color: var(--sp-text-dim); padding: 1px 0; }
  .ask-answered-a {
    color: var(--sp-accent);
    font-weight: 600;
    padding: 0 0 3px 1.2em;   /* nests under the question text */
  }
  /* Stale/unanswered ask: the turn died (reload or abort) before the user could
     answer. The box shows a notice; a surviving card is dimmed + disabled. */
  .ask-stale {
    padding: 0.35rem 0.6rem;
    font: 11px/1.5 'JetBrains Mono','Space Mono',ui-monospace,monospace;
    color: var(--sp-warn);
    border-top: 1px dashed var(--sp-border);
  }
  .ask-stale-card {
    opacity: 0.55;
    pointer-events: none;
  }
  .ask-stale-note {
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 1px dashed var(--sp-border);
    font-size: 10.5px;
    color: var(--sp-warn);
  }

  .tool-box .tool-image {
    max-width: 100%;
    max-height: 320px;
    border-radius: 8px;
    display: block;
  }
  .repl-loader {
    flex-shrink: 0;
    display: inline-flex;
    gap: 2px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 700;
    font-size: 12px;
    line-height: 1;
    color: var(--sp-accent);
  }
  .repl-loader > i { font-style: normal; opacity: 0.3; animation: repl-sweep 1.15s ease-in-out infinite; }
  .repl-loader > i:nth-child(2) { animation-delay: 0.19s; }
  .repl-loader > i:nth-child(3) { animation-delay: 0.38s; }
  .tc-title { color: var(--sp-text-dim); white-space: nowrap; font-weight: 500; }
  .tc-title b { color: var(--sp-accent); font-weight: 600; }
  .tc-meta {
    margin-left: auto;
    font-size: 10px;
    color: var(--sp-text-dim);
    opacity: 0.6;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .tc-dim { opacity: 0.65; }

  .artifact-meta-row {
    display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
    padding: 8px 12px; font: 11px monospace; color: var(--sp-text-dim);
    background: var(--sp-surface);
  }
  .artifact-show-btn {
    background: var(--sp-panel); border: 1px solid var(--sp-border);
    border-radius: 8px; padding: 3px 10px; font: 11px monospace;
    color: var(--sp-text); cursor: pointer; white-space: nowrap;
    transition: background 0.1s, border-color 0.1s;
  }
  .artifact-show-btn:hover { background: var(--sp-accent); border-color: var(--sp-accent); color: var(--sp-bg); }
  .artifact-meta-info { color: var(--sp-text-dim); }
  /* Compaction-in-progress banner (shown while a compact agent summarizes) */
  .compaction-progress { display: flex; align-items: center; gap: 0.5rem; margin: 0.6rem auto; padding: 0.45rem 0.85rem; max-width: max-content; font-size: 0.76rem; color: var(--sp-text-dim); background: var(--sp-panel); border: 1px solid var(--sp-border); border-radius: 999px; }
  .compaction-progress .cp-spin { width: 12px; height: 12px; flex: none; border: 2px solid var(--sp-border-bright, #484f58); border-top-color: var(--sp-accent); border-radius: 50%; animation: cp-spin 0.7s linear infinite; }
  @keyframes cp-spin { to { transform: rotate(360deg); } }
  /* Missing-font warning in the office→PDF converter */
  /* V2 preview-thumbnail artifact card (office body + collapsed representation) */
  /* The preview fills the whole card and the footer floats ON it, so the
     image is the card rather than a band above a label. */
  .artifact-card-body {
    cursor: pointer; outline: none; position: relative;
    /* a neutral grey mixed from the theme's own ground and ink: dark grey on
       the dark palettes, light grey on white, opaque enough to sit on any
       image without a scrim behind it. */
    --acf-pill: color-mix(in srgb, var(--sp-bg) 78%, var(--sp-text));
  }
  .artifact-card-body:focus-visible { box-shadow: inset 0 0 0 2px var(--sp-accent); }
  /* 154px = the old 104px band plus the ~50px the footer used to occupy
     below it, so the card keeps its overall height while the image gains
     the footer's strip. No bottom border: nothing sits under it now. */
  .artifact-card-body .ac-thumb { position: relative; height: 154px; background: var(--sp-bg); display: grid; place-items: center; border-bottom: 0; overflow: hidden; }
  /* ↗ open-in-new-tab — the ONLY inline control (pin/share/download live in the
     side panel). Sits top-right of the thumb; stops the card's open action. */
  .artifact-card-body .ac-newtab {
    position: absolute; top: 7px; right: 7px; width: 26px; height: 26px;
    display: grid; place-items: center; padding: 0; cursor: pointer;
    background: color-mix(in srgb, var(--sp-panel) 82%, transparent);
    color: var(--sp-text-dim); border: 1px solid var(--sp-border);
    border-radius: 7px; opacity: 0; transition: opacity 0.12s, background 0.12s, color 0.12s;
    backdrop-filter: blur(3px);
  }
  .artifact-card-body:hover .ac-newtab, .artifact-card-body:focus-within .ac-newtab { opacity: 1; }
  .artifact-card-body .ac-newtab:hover { background: var(--sp-accent); border-color: var(--sp-accent); color: var(--sp-text); }
  .artifact-card-body .ac-newtab svg { width: 14px; height: 14px; }
  .artifact-card-body .ac-newtab.ac-newtab-ft { position: static; opacity: 0.7; width: 22px; height: 22px; flex: none; backdrop-filter: none; background: transparent; border-color: transparent; }
  .artifact-card-body:hover .ac-newtab.ac-newtab-ft { opacity: 1; }
  /* 🌐 Translating… badge — overlay pill, top-left of the thumb */
  .artifact-card-body .ac-lx {
    position: absolute; top: 7px; left: 7px; max-width: calc(100% - 44px);
    padding: 2px 8px; font: 10px monospace; font-style: italic;
    color: var(--sp-text-dim); background: color-mix(in srgb, var(--sp-panel) 88%, transparent);
    border: 1px solid var(--sp-border); border-radius: 999px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; backdrop-filter: blur(3px);
  }
  .artifact-card-body .ac-page { width: 124px; background: #fdfdfd; border-radius: 3px 3px 0 0; padding: 12px 13px 0; box-shadow: 0 2px 12px rgba(0,0,0,0.4); }
  .artifact-card-body .ac-page i { display: block; height: 4px; border-radius: 2px; background: #c9d3de; margin-bottom: 6px; }
  .artifact-card-body .ac-page i.t { width: 40%; height: 6px; background: var(--sp-accent); margin-bottom: 9px; }
  .artifact-card-body .ac-page i.m { width: 84%; }
  .artifact-card-body .ac-page i.s { width: 56%; }
  /* The footer is a PILL sitting on the image -- icon + kind, nothing else.
     No scrim across the card and no backdrop blur: the pill carries its own
     ground, so the preview stays unobscured everywhere but under the label. */
  .artifact-card-body .ac-ft {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 0;
    position: absolute; left: 10px; bottom: 10px; right: auto; z-index: 2;
    width: fit-content; max-width: calc(100% - 20px);
    background: var(--acf-pill);
    border-radius: 999px;
    transition: background 0.12s;
  }
  .artifact-card-body:hover .ac-ft {
    background: color-mix(in srgb, var(--sp-accent) 24%, var(--acf-pill));
  }
  /* inside a pill the label sizes to its text instead of pushing to the edge */
  .artifact-card-body .ac-ft .ac-sub { flex: none; }
  /* Compact cards have no visible thumb -- the footer IS the card, so it goes
     back into the flow or it would collapse to nothing. */
  .artifact-compact .ac-ft {
    position: static; background: none;
    display: flex; width: auto; max-width: none;
    border-radius: 0; padding: 3px 10px;
  }
  .artifact-compact .ac-ft .ac-sub { flex: 1; }
  .artifact-compact:hover .ac-ft { background: color-mix(in srgb, var(--sp-accent) 9%, transparent); }
  .artifact-card-body .ac-ic { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; }
  .artifact-card-body .ac-ic svg { width: 17px; height: 17px; }
  .artifact-card-body .ac-sub { flex: 1; min-width: 0; padding-right: 1rem; font-size: 11.5px; color: var(--sp-text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .artifact-card-body .ac-go { flex: none; color: var(--sp-text-dim); font-size: 18px; line-height: 1; transition: color 0.12s, transform 0.12s; }
  .artifact-card-body:hover .ac-go { color: var(--sp-accent); transform: translateX(2px); }
  /* Compact (minimized / card-only) artifact: a slim strip instead of the tall
     preview card — no faux-page banner, no 250px min-height, tight footer row.
     The class is toggled by collapseArtifact/expandArtifact and set permanently
     on card-only types (office docs, non-renderable). */
  /* flex:none matters: the 250px min-height doubled as anti-squeeze inside the
     flex conv host — without it a compact card would shrink to its borders. */
  .artifact-wrap.artifact-compact { min-height: 0 !important; min-width: 0 !important; flex: none; align-self: stretch; }
  .artifact-compact .ac-thumb { display: none; }
  .artifact-compact .ac-ft { padding: 3px 10px; gap: 8px; }
  .artifact-compact .ac-ic { width: 20px; height: 20px; border-radius: 5px; }
  .artifact-compact .ac-ic svg { width: 12px; height: 12px; }
  .artifact-compact .ac-sub { font-size: 11px; }
  .artifact-compact .ac-go { font-size: 15px; }
  /* Real preview image (captured HTML thumbnail, or the image file itself) layered
     over the faux-page placeholder; fades in on load, leaving the placeholder as a
     fallback if capture fails. */
  .artifact-card-body .ac-shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; background: var(--sp-bg); opacity: 0; transition: opacity 0.25s; }
  .artifact-card-body .ac-shot.ready { opacity: 1; }
  /* Per-turn wrapping grid: several deliverable cards flow side by side; a single
     card fills the row (auto-fit collapses the empty tracks). */
  /* TWO columns whenever two cards exist, and they SHRINK to share the row --
     that is the whole point of having no minimum. auto-fit cannot do this: it
     derives its column count from the track floor, so a floor of 0 counts by
     the 400px ceiling instead and drops to one column below ~812px. A fixed
     2-track template has no such coupling; each track is 0..400px, so the pair
     narrows with the pane instead of collapsing to a single card. */
  .artifact-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 400px)); gap: 12px; margin-top: 0.5rem; align-self: stretch; }
  /* Same 0.3rem inset the message blocks carry, so an artifact lines up with
     the conversation instead of sitting proud of it. On a bare card (the
     legacy path renders one straight into the host, outside any grid) the
     rule applies to the wrap itself; inside a grid the GRID owns the inset,
     or the two would stack. */
  .artifact-grid,
  .file-bundle,
  .conv-host > .artifact-wrap { margin-left: 0.3rem; margin-right: 0.3rem; }
  .artifact-grid > .artifact-wrap { margin-top: 0 !important; min-width: 0; }
  .artifact-grid > .artifact-wrap.ac-hidden { display: none !important; }
  /* "+N more" overflow tile — folds a flood of cards behind one cell (GRID_CAP). */
  .artifact-grid > .ac-more {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    min-height: 140px; border: 1px dashed var(--sp-border-bright, #484f58); border-radius: 10px;
    background: var(--sp-panel); color: var(--sp-text-dim); cursor: pointer;
    transition: border-color 0.12s, color 0.12s, background 0.12s; outline: none;
  }
  .artifact-grid > .ac-more:hover { border-color: var(--sp-accent); color: var(--sp-accent); background: color-mix(in srgb, var(--sp-accent) 8%, transparent); }
  .artifact-grid > .ac-more:focus-visible { box-shadow: 0 0 0 2px var(--sp-accent); }
  .ac-more .ac-more-n { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 22px; font-weight: 600; line-height: 1; }
  .ac-more .ac-more-lbl { font: 11px 'JetBrains Mono', ui-monospace, monospace; }
  /* "N images" stack tile — folds 3+ image cards of one grid behind a 2x2 mosaic
     of the newest four (applyImageStack). Folded cards get .ac-stacked (hidden). */
  .artifact-grid > .artifact-wrap.ac-stacked { display: none !important; }
  .artifact-grid > .ac-stack {
    border: 1px solid var(--sp-border); border-radius: 8px; overflow: hidden; min-width: 0;
    background: var(--sp-panel); cursor: pointer; outline: none; transition: border-color 0.12s;
  }
  .artifact-grid > .ac-stack:hover { border-color: var(--sp-border-bright, #484f58); }
  .artifact-grid > .ac-stack:focus-visible { box-shadow: 0 0 0 2px var(--sp-accent); }
  .ac-stack .ac-stack-mosaic { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 51px; gap: 2px; height: 104px; background: var(--sp-bg); border-bottom: 1px solid var(--sp-border); }
  .ac-stack .ac-stack-cell { position: relative; overflow: hidden; background: var(--sp-surface); }
  .ac-stack .ac-stack-cell img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; opacity: 0; transition: opacity 0.25s; }
  .ac-stack .ac-stack-cell img.ready { opacity: 1; }
  .ac-stack .ac-stack-n { position: absolute; inset: 0; display: grid; place-items: center; font: 600 15px 'JetBrains Mono', ui-monospace, monospace; color: var(--sp-text); background: color-mix(in srgb, var(--sp-bg) 62%, transparent); }
  .ac-stack .ac-ft { display: flex; align-items: center; gap: 10px; padding: 10px 12px; transition: background 0.12s; }
  .ac-stack:hover .ac-ft { background: color-mix(in srgb, var(--sp-accent) 9%, transparent); }
  .ac-stack .ac-ic { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; }
  .ac-stack .ac-ic svg { width: 17px; height: 17px; }
  .ac-stack .ac-sub { flex: 1; min-width: 0; font-size: 11.5px; color: var(--sp-text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ac-stack .ac-go { flex: none; color: var(--sp-text-dim); font-size: 18px; line-height: 1; transition: color 0.12s, transform 0.12s; }
  .ac-stack:hover .ac-go { color: var(--sp-accent); transform: translateX(2px); }
  .ac-stack.ac-stack-open .ac-go, .ac-stack.ac-stack-open:hover .ac-go { transform: rotate(90deg); }
  /* Shared file-bundle card (Option C): code + data + everything that isn't a
     standalone HTML/image/office deliverable folds into one "N other files" pile. */
  /* flex:none + align-self:stretch are load-bearing: .conv-host is a flex column,
     so without them this card gets squeezed to ~1px (same gotcha as .artifact-compact). */
  .file-bundle { border: 1px solid var(--sp-border); border-radius: 8px; overflow: hidden; margin-top: 12px; flex: none; align-self: stretch; width: fit-content; }
  .file-bundle .fb-head { display: flex; align-items: center; gap: 14px; padding: 12px 14px; cursor: pointer; user-select: none; transition: background 0.12s; }
  .file-bundle .fb-head:hover { background: color-mix(in srgb, var(--sp-accent) 6%, transparent); }
  /* Layered pile of file edges with a count badge on the top card */
  .file-bundle .fb-pile { position: relative; width: 34px; height: 30px; flex: none; }
  .file-bundle .fb-pile b { position: absolute; border: 1px solid var(--sp-border); border-radius: 4px; background: var(--sp-surface); }
  .file-bundle .fb-pile b:nth-child(1) { inset: 6px 0 0 8px; opacity: 0.5; }
  .file-bundle .fb-pile b:nth-child(2) { inset: 3px 4px 3px 4px; opacity: 0.75; }
  .file-bundle .fb-pile b:nth-child(3) { inset: 0 8px 6px 0; background: var(--sp-panel); display: grid; place-items: center; }
  .file-bundle .fb-num { position: relative; z-index: 2; font-size: 11px; font-weight: 700; color: var(--sp-accent); }
  .file-bundle .fb-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
  .file-bundle .fb-title { font-size: 12.5px; color: var(--sp-text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .file-bundle .fb-title b { color: var(--sp-text); font-weight: 500; }
  .file-bundle .fb-sub { font-size: 11px; color: var(--sp-text-dim); white-space: nowrap; }
  .file-bundle .fb-cta { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--sp-accent); white-space: nowrap; flex: none; }
  .file-bundle .fb-chevron { width: 14px; height: 14px; display: grid; place-items: center; transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
  .file-bundle.fb-open .fb-chevron { transform: rotate(90deg); }
  .file-bundle .fb-lbl-hide { display: none; }
  .file-bundle.fb-open .fb-lbl-hide { display: inline; }
  .file-bundle .fb-list { border-top: 1px solid var(--sp-border); max-height: 340px; overflow: auto; }
  .file-bundle .fb-row { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--sp-border); transition: background 0.1s; }
  .file-bundle .fb-row:first-child { border-top: none; }
  .file-bundle .fb-row:hover { background: color-mix(in srgb, var(--sp-accent) 6%, transparent); }
  .file-bundle .fb-row-icon { flex-shrink: 0; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 5px; background: var(--sp-panel); color: var(--sp-text-dim); font-size: 7.5px; font-weight: 700; letter-spacing: 0.02em; }
  .file-bundle .fb-row-name { flex: 1; min-width: 0; font-size: 12.5px; color: var(--sp-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .file-bundle .fb-row-size { flex-shrink: 0; font-size: 11px; color: var(--sp-text-dim); }
  .file-bundle .fb-row-expand { flex-shrink: 0; width: 26px; height: 26px; border-radius: 5px; border: none; background: transparent; color: var(--sp-text-dim); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; transition: background 0.12s, color 0.12s; }
  .file-bundle .fb-row-expand:hover { background: var(--sp-surface); color: var(--sp-accent); }
  @keyframes repl-sweep { 0%, 55%, 100% { opacity: 0.3; } 28% { opacity: 1; text-shadow: 0 0 6px var(--sp-accent-dim); } }
  @keyframes tc-fade {
    from { opacity: 0; transform: translateY(3px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  /* Composer attachments — multiple items wrap; each carries its own remove ✕. */
  .image-preview { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.25rem 0; align-items: center; }
  .image-preview img { max-height: 60px; border-radius: 4px; border: 1px solid var(--sp-border); }
  .attach-item { display: inline-flex; align-items: center; gap: 0.2rem; }
  .image-preview .remove-btn { background: none; border: none; color: var(--sp-danger); cursor: pointer; font-size: 1rem; padding: 0 0.15rem; line-height: 1; }

  /* App-wide drag-and-drop veil (shown only while dragging files in). It never
     captures pointer events — the drop is handled on window. */
  .drop-overlay {
    position: fixed; inset: 0; z-index: 99999;
    display: none; align-items: center; justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    pointer-events: none;
  }
  .drop-overlay.active { display: flex; }
  .drop-overlay-inner {
    display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
    padding: 1.5rem 2.5rem; border-radius: 14px;
    border: 2px dashed var(--sp-accent); background: var(--sp-panel); color: var(--sp-text);
    font-size: 1.05rem; font-weight: 600; box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
  }
  .drop-overlay-inner .dz-icon { font-size: 2rem; line-height: 1; color: var(--sp-accent); }

  /* Attachment chip for non-image documents — used both in the composer preview
     and inside message bubbles. */
  .file-chip {
    display: inline-flex; align-items: center; gap: 0.45rem;
    padding: 0.3rem 0.55rem; max-width: 100%; vertical-align: middle;
    background: var(--sp-panel); border: 1px solid var(--sp-border); border-radius: 8px;
  }
  .file-chip .fc-icon { font-size: 1rem; line-height: 1; flex: none; }
  .file-chip .fc-name { font-size: 0.8rem; color: var(--sp-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 16rem; }
  .file-chip .fc-size { font-size: 0.7rem; color: var(--sp-text-dim); flex: none; }
  .bubble .file-chip { cursor: pointer; }
  .bubble .file-chip:hover { border-color: var(--sp-accent); }

  #attachBtn { background: transparent; border: 1px solid var(--sp-border); color: var(--sp-text-dim); padding: 0 0.6rem; cursor: pointer; border-radius: 4px; }
  #attachBtn:hover { color: var(--sp-accent); border-color: var(--sp-accent); }
  @media (prefers-reduced-motion: reduce) {
  }

  /* A message must never be squashed by the scroll container.
     .conv-host is a COLUMN flex container, and a flex item whose overflow is not
     `visible` gets an automatic minimum size of 0 instead of its content size — so
     flex-shrink compresses it once the conversation is taller than the host. The
     thinking box is the only message with overflow:hidden, so it was the only one
     that collapsed (59px of content clipped to a 24px strip, its summary and body
     laid out below the clip and painting under the next message). Scoped to .msg so
     #homeCenter keeps its flex:1 1 auto. */
  .conv-host > .msg, #messages > .msg, #messagesSide > .msg { flex-shrink: 0; }

  /* Streamed reasoning ("thinking") box */
  /* Routine run divider (routines.js): a dated rule opens every run of a routine's
     conversation; its instructions fold out underneath. Full width, no bubble. */
  .msg.routine-sep {
    max-width: none; width: 100%; padding: 0;
    margin: 1.5rem 0 0.75rem;
  }
  .msg.routine-sep > summary {
    list-style: none; cursor: pointer; user-select: none;
    display: flex; align-items: center; gap: 0.75rem;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 0.68rem; letter-spacing: 0.06em;
    color: var(--sp-text-dim);
  }
  .msg.routine-sep > summary::-webkit-details-marker { display: none; }
  .msg.routine-sep > summary:hover { color: var(--sp-text); }
  .msg.routine-sep .rs-line { flex: 1; height: 1px; background: var(--sp-border); }
  .msg.routine-sep .rs-at { white-space: nowrap; font-variant-numeric: tabular-nums; }
  .msg.routine-sep .rs-body {
    margin: 0.6rem auto 0; max-width: 85%;
    padding: 0.5rem 0.75rem;
    border-left: 2px solid var(--sp-border);
    color: var(--sp-text-dim); font-size: 0.8rem; line-height: 1.45;
    white-space: pre-wrap; word-break: break-word;
  }
  .msg.think {
    margin: 0.25rem 0 0.5rem;
    max-width: 85%;
    border-left: 3px solid var(--sp-accent);
    border-radius: 0 6px 6px 0;
    background: var(--sp-surface);
    font-size: 0.8rem;
    overflow: hidden;
  }
  .msg.think > summary {
    cursor: pointer;
    list-style: none;
    padding: 0.5rem 0.75rem;
    color: var(--sp-text-dim);
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
  }
  .msg.think > summary::-webkit-details-marker { display: none; }
  .msg.think > summary::before {
    content: '▸';
    font-size: 0.7rem;
    transition: transform 0.15s ease;
  }
  .msg.think[open] > summary::before { transform: rotate(90deg); }
  .msg.think:not(.done) > summary { color: var(--sp-accent); }
  .msg.think.done .repl-loader { display: none; }
    .msg.think .think-body {
    padding: 0.5rem 0.75rem;
    color: var(--sp-text-dim);
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'Space Mono', monospace;
    line-height: 1.45;
  }
  .msg.think .think-body::-webkit-scrollbar { display: none; }
  .msg.think .think-body { scrollbar-width: none; -ms-overflow-style: none; }
  .msg.think .think-body { scrollbar-width: none; -ms-overflow-style: none; }
  /* Hide scrollbar */
  .msg.think .think-body::-webkit-scrollbar { display: none; }
  .msg.think .think-body { scrollbar-width: none; }

  /* ---- Claude-style: thoughts hidden by default ---- */
  .msg.think { display: none; }
  body.thoughts-visible .msg.think { display: block; }
/* ==============================================================================
   RICH THEME SYSTEM — per-theme overrides
   Appended to sandpie.css. Base CSS above is the unthemed default (it was the
   classic-dark theme, retired 2026-11; every theme now sets data-theme).
   [data-theme="light"] is "classic-light".
   ============================================================================== */

/* =============================================================================
   OLIVE THEME — aurora structure (glass rail + gradients) with the GasN2
   dark-oliva palette: graphite #1D1D1B ground, olive accent #93a332.
   ============================================================================== */

[data-theme="olive"] {
  /* Aurora is glass, not flat: the rail gets its own translucent ground. */
  --sp-rail: rgba(18,18,16,0.72);
  --sp-rail-border: rgba(150,149,139,0.16);
  --sp-rail-ink: var(--sp-text-dim, var(--sp-text-dim));
  --sp-rail-ink-hot: var(--sp-accent, var(--sp-accent));
  --sp-rail-hot-bg: color-mix(in srgb, var(--sp-accent) 16%, transparent);
  --sp-accent-dim: var(--sp-accent-dim);
  --sp-text-mid: #D8D7CD;
}

[data-theme="olive"] body {
  background: #1D1D1B;
  color: var(--sp-text);
}

[data-theme="olive"] aside {
  background: rgba(35,35,32,0.55);
  border-right: 1px solid rgba(150,149,139,0.1);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

[data-theme="olive"] .mobile-header .brand .bracket { color: var(--sp-accent); }
[data-theme="olive"] .mobile-header .brand {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--sp-text-dim);
  letter-spacing: 0.5px;
}

[data-theme="olive"] aside button:not(.sort-btn) { background: var(--sp-accent); border: none; color: #1D1D1B; border-radius: 6px; font-weight: 500; }
[data-theme="olive"] aside button:not(.sort-btn):hover { background: var(--sp-text); color: var(--sp-accent); }
[data-theme="olive"] .sidebar-collapse-btn {
  background: rgba(43,43,40,0.5);
  border: 1px solid rgba(150,149,139,0.1);
  color: var(--sp-text-dim);
  border-radius: 8px;
}

[data-theme="olive"] .sidebar-collapse-btn:hover {
  background: color-mix(in srgb, var(--sp-accent) 10%, transparent);
  border-color: color-mix(in srgb, var(--sp-accent) 30%, transparent);
  color: var(--sp-accent);
}

[data-theme="olive"] .files-open-btn {
  background: rgba(43,43,40,0.5);
  border: 1px solid rgba(150,149,139,0.1);
  color: var(--sp-text-dim);
  border-radius: 8px;
}

[data-theme="olive"] .files-open-btn:hover {
  background: color-mix(in srgb, var(--sp-accent) 10%, transparent);
  border-color: color-mix(in srgb, var(--sp-accent) 30%, transparent);
  color: var(--sp-accent);
}

[data-theme="olive"] .files-open-btn .material-symbols-outlined { color: var(--sp-text-dim); }
[data-theme="olive"] .files-open-btn:hover .material-symbols-outlined { color: var(--sp-accent); }

[data-theme="olive"] aside details.service summary {
  background: rgba(43,43,40,0.5);
  color: var(--sp-text-dim);
  border: 1px solid rgba(150,149,139,0.06);
  border-radius: 8px;
  backdrop-filter: blur(12px);
}

[data-theme="olive"] aside details.service[open] summary { color: var(--sp-accent); }
[data-theme="olive"] aside details.service summary:hover { color: var(--sp-text); border-color: rgba(255,255,255,0.15); background: rgba(255,255,255,0.05); }
[data-theme="olive"] aside details.service .service-body { background: rgba(35,35,32,0.4); border-radius: 0 0 8px 8px; margin-top: -4px; padding-top: 0.75rem; backdrop-filter: blur(12px); }
[data-theme="olive"] aside input { background: rgba(0,0,0,0.2); border: 1px solid rgba(150,149,139,0.1); color: var(--sp-text); border-radius: 6px; }
[data-theme="olive"] aside input:focus { border-color: var(--sp-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sp-accent) 10%, transparent); background: rgba(0,0,0,0.35); }
[data-theme="olive"] aside button:not(.sort-btn).ghost { background: transparent; color: var(--sp-accent); border: 1px solid rgba(150,149,139,0.15); border-radius: 6px; }
[data-theme="olive"] aside button:not(.sort-btn).ghost:hover { background: color-mix(in srgb, var(--sp-accent) 5%, transparent); border-color: color-mix(in srgb, var(--sp-accent) 25%, transparent); }
[data-theme="olive"] aside button:not(.sort-btn):disabled,
[data-theme="olive"] aside button:not(.sort-btn):disabled:hover { background: transparent; border-color: rgba(150,149,139,0.08); color: var(--sp-text-dim); }
[data-theme="olive"] .status-dot.ok { background: var(--sp-accent); box-shadow: 0 0 6px color-mix(in srgb, var(--sp-accent) 30%, transparent); }
[data-theme="olive"] .status-dot.err { background: var(--sp-danger); }
[data-theme="olive"] ul.conv-list li:hover { background: transparent; }
[data-theme="olive"] ul.conv-list li.active,
[data-theme="olive"] ul.conv-list li.in-panel {
  background: linear-gradient(135deg, color-mix(in srgb, var(--sp-accent) 10%, transparent), color-mix(in srgb, var(--sp-warn) 6%, transparent));
  border-color: color-mix(in srgb, var(--sp-accent) 20%, transparent);
  color: var(--sp-accent);
}
[data-theme="olive"] ul.conv-list li.active {
  outline: 1px solid var(--sp-accent);
}

[data-theme="olive"] main { background: linear-gradient(180deg, #1D1D1B 0%, #232320 100%); }


[data-theme="olive"] .user .bubble { background: linear-gradient(135deg, var(--sp-accent), var(--sp-warn)); color: #fff; border-radius: 18px 18px 6px 18px; font-weight: 500; box-shadow: 0 4px 16px color-mix(in srgb, var(--sp-accent) 20%, transparent); }
[data-theme="olive"] .user::before { background: color-mix(in srgb, var(--sp-accent) 10%, transparent); transform: translate(3px, 3px); }
[data-theme="olive"] .assistant { color: var(--sp-text); border-left: 2px solid color-mix(in srgb, var(--sp-warn) 30%, transparent); background: rgba(35,35,32,0.55); }
[data-theme="olive"] .assistant::before { background: linear-gradient(180deg, var(--sp-accent), var(--sp-warn)); box-shadow: 0 0 12px color-mix(in srgb, var(--sp-accent) 20%, transparent); }
[data-theme="olive"] .assistant code { color: var(--sp-accent); }
[data-theme="olive"] .assistant pre { background: rgba(35,35,32,0.8); }
[data-theme="olive"] .assistant pre code { background: transparent; color: var(--sp-text-dim); }

[data-theme="olive"] .input-wrap { background: rgba(0,0,0,0.25); border: 1px solid rgba(255,255,255,0.08); border-radius: 16px; }
[data-theme="olive"] .mp-panel { background: rgba(35,35,32,0.92); border: 1px solid rgba(150,149,139,0.15); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 8px 32px rgba(0,0,0,0.5); }
[data-theme="olive"] .input-wrap:focus-within { border-color: color-mix(in srgb, var(--sp-accent) 30%, transparent); background: rgba(0,0,0,0.4); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sp-accent) 8%, transparent), 0 8px 32px rgba(0,0,0,0.2); }
[data-theme="olive"] .input-wrap textarea { color: var(--sp-text); }
[data-theme="olive"] .attach-btn { background: transparent !important; color: var(--sp-text-dim) !important; }
[data-theme="olive"] .attach-btn:hover { background: rgba(255,255,255,0.05) !important; color: var(--sp-accent) !important; }
[data-theme="olive"] .send-btn { width: 36px; height: 36px; background: linear-gradient(135deg, var(--sp-accent), var(--sp-warn)) !important; border: none !important; border-radius: 12px; color: #fff !important; box-shadow: 0 2px 12px color-mix(in srgb, var(--sp-accent) 25%, transparent); }
[data-theme="olive"] .send-btn:hover { background: linear-gradient(135deg, var(--sp-accent), var(--sp-warn)) !important; box-shadow: 0 4px 20px color-mix(in srgb, var(--sp-accent) 35%, transparent); transform: translateY(-1px); }
[data-theme="olive"] .modal-backdrop {
  background: rgba(7,11,20,0.7);
}

/* Aurora: solid backgrounds for context menus and settings modal (remove --sp-surface transparency) */
[data-theme="olive"] .ctx-menu { background: #232320; border-color: var(--sp-border); }
[data-theme="olive"] .context-menu { background: #232320; border-color: var(--sp-border); box-shadow: 0 4px 20px rgba(0,0,0,0.6); }
[data-theme="olive"] .modal-content { background: #232320; }
[data-theme="olive"] .ctx-popup { background: #232320; border-color: var(--sp-border); }
[data-theme="olive"] .ctx-popup .ctx-popup-row b { color: var(--sp-text); }

/* ── Local-inference GPU yield ─────────────────────────────────────────────
   While the in-tab WebGPU model is generating (body.sp-decoding, toggled by
   local-LLM engines removed), suppress GPU-compositor work that competes with the decode
   loop for the SHARED GPU. backdrop-filter:blur() recomputes EVERY frame the
   streamed text behind it changes — the single biggest offender — and infinite
   CSS animations composite every frame. This was the focused-tab decode collapse
   (GPU ~20% focused vs 100% backgrounded): the decode loop is fine, but expensive
   foreground compositing starves the GPU only when the tab is visible. One-time
   style recalc per message (on class toggle), not per frame. */
body.sp-decoding *,
body.sp-decoding *::before,
body.sp-decoding *::after {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  animation-play-state: paused !important;
}
/* ---- persistence banner -------------------------------------------------- */
.persist-banner {
  padding: 6px 8px;
  margin: 4px 0;
  border-radius: 6px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.persist-granted {
  background-color: rgba(34,197,94,0.15);
  color: #166534;
}
.persist-denied {
  background-color: rgba(239,68,68,0.15);
  color: #991b1b;
}
.persist-banner button {
  padding: 3px 10px;
  border-radius: 4px;
  border: 1px solid currentColor;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}
.persist-banner button:hover {
  background: rgba(0,0,0,0.05);
}

/* ---- Command output panel (text-only CLI style) ------------------------ */
/* Sits inside the pane directly above the composer (which has its own border-top),
   so no border-bottom here — that would read as a double rule. */
.cmd-output {
  font: 0.82rem 'JetBrains Mono', Consolas, monospace;
  line-height: 1.5;
  /* Same horizontal cap as the chat column (--sp-chat-max-w, set by
     themes.js applyChatWidth) so command output lines up with the chat. */
  padding-inline: max(1.5rem, calc((100% - var(--sp-chat-max-w)) / 2));
}
.cmd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.3rem 0.7rem;
  background: var(--sp-panel);
  border-bottom: 1px solid var(--sp-border);
}
.cmd-prompt {
  color: var(--sp-accent);
  font-weight: 600;
}
.cmd-close {
  background: transparent;
  border: none;
  color: var(--sp-text-dim);
  font: inherit;
  cursor: pointer;
  padding: 0 0.3rem;
}
.cmd-close:hover { color: var(--sp-text); }
.cmd-body {
  margin: 0 0 1rem 0;
  padding: 0.5rem 0.7rem;
  background: var(--sp-bg);
  color: var(--sp-text);
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}



/* ═══════════════ pinned files ═══════════════ */
/* Pin toggle icon (viewer header + artifact header). Unpinned = greyed-out /
   inactive pin; pinned = full-colour pin, so the state reads at a glance. */
.pin-toggle { filter: grayscale(1); opacity: 0.5; transition: filter .12s, opacity .12s, transform .12s; }
.pin-toggle:hover { opacity: 0.85; }
.pin-toggle.pinned { filter: none; opacity: 1; }
.pin-toggle.pinned:hover { transform: scale(1.08); }

/* Home-screen "Pinned" app grid (rendered into #welcome by pins.js) */
.pinned-home { width: 100%; user-select: none; margin-bottom: 2rem; }
/* flex-wrap + center so any number of tiles stays centred (grid auto-fill left
   empty column tracks, pinning a single item to the left edge). */
.pin-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.1rem 0.7rem; }
.pin-tile { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; width: 78px; }
.pin-tile-btn { all: unset; cursor: pointer; }
.pin-thumb {
  width: 60px; height: 60px; border-radius: 15px; overflow: hidden;
  background: var(--sp-panel); border: 1px solid var(--sp-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--sp-text-dim); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.03em;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  transition: transform .12s ease, border-color .12s, box-shadow .12s;
}
.pin-thumb.has-thumb { color: transparent; }   /* image covers the badge text */
.pin-thumb svg { width: 30px; height: 30px; display: block; color: rgba(255,255,255,0.95); filter: drop-shadow(0 1px 2px rgba(0,0,0,0.25)); }   /* thematic icon sizing */
/* App-icon tile (option A): big thematic SVG + short type tag + brand-colour
   band (theme-color) at the bottom of the tile. */
.pin-thumb .pin-app {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; position: relative;
}
.pin-thumb .pin-app-ic { display: flex; align-items: center; justify-content: center; }
.pin-thumb .pin-app-ic svg { width: 34px; height: 34px; }
.pin-thumb .pin-app-tag {
  font-size: 6.5px; font-weight: 700; letter-spacing: 0.08em;
  color: rgba(255,255,255,0.92); line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.pin-thumb .pin-app-band { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; }
/* colourful, token-driven app-icon tiles: the typed extension sits on a colour
   derived from the theme's semantic tokens (so it adapts to any theme). A resolved
   real thumbnail (.has-thumb) still overrides. color-mix darkens one end for depth
   + white-glyph legibility on both light and dark palettes. */
.pin-thumb[data-ext="html"], .pin-thumb[data-ext="htm"], .pin-thumb[data-ext="svg"] { background: linear-gradient(145deg, var(--sp-accent), color-mix(in srgb, var(--sp-accent), #000 34%)); color: var(--sp-bg); border-color: transparent; }
.pin-thumb[data-ext="pdf"] { background: linear-gradient(145deg, var(--sp-danger), color-mix(in srgb, var(--sp-danger), #000 26%)); color: var(--sp-bg); border-color: transparent; }
.pin-thumb[data-ext="csv"], .pin-thumb[data-ext="xlsx"], .pin-thumb[data-ext="xls"], .pin-thumb[data-ext="ods"] { background: linear-gradient(145deg, var(--sp-success), color-mix(in srgb, var(--sp-success), #000 26%)); color: var(--sp-bg); border-color: transparent; }
.pin-thumb[data-ext="json"], .pin-thumb[data-ext="js"], .pin-thumb[data-ext="py"], .pin-thumb[data-ext="sh"], .pin-thumb[data-ext="ts"], .pin-thumb[data-ext="yaml"] { background: linear-gradient(145deg, var(--sp-warn), color-mix(in srgb, var(--sp-warn), #000 24%)); color: var(--sp-bg); border-color: transparent; }
.pin-thumb[data-ext="md"], .pin-thumb[data-ext="markdown"], .pin-thumb[data-ext="txt"], .pin-thumb[data-ext="doc"], .pin-thumb[data-ext="docx"] { background: linear-gradient(145deg, color-mix(in srgb, var(--sp-accent), var(--sp-surface) 40%), color-mix(in srgb, var(--sp-accent), #000 34%)); color: var(--sp-bg); border-color: transparent; }
.pin-thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pin-tile-btn:hover .pin-thumb, .pin-tile-btn:focus-visible .pin-thumb {
  transform: translateY(-2px); border-color: var(--sp-accent); box-shadow: 0 4px 10px rgba(0,0,0,0.28);
}
.pin-tile-btn:active .pin-thumb { transform: translateY(0) scale(0.96); }
.pin-tile-label {
  max-width: 78px; font-size: 0.72rem; line-height: 1.15; color: var(--sp-text);
  text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pin-tile-unpin {
  position: absolute; top: -5px; right: 4px;
  width: 18px; height: 18px; border-radius: 50%; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--sp-bg); border: 1px solid var(--sp-border); color: var(--sp-text-dim);
  font-size: 0.7rem; line-height: 1; cursor: pointer;
  opacity: 0; transition: opacity .12s, color .12s, border-color .12s;
}
.pin-tile:hover .pin-tile-unpin { opacity: 1; }
.pin-tile-unpin:hover { color: var(--sp-accent); border-color: var(--sp-accent); }
/* drag to reorder. Tiles slide to their new slot; the one being dragged lifts and
   dims so the gap it will land in is obvious. The unpin ✕ is suppressed mid-drag —
   it sits under the cursor and inviting a mis-click there would be cruel. */
.pin-tile { transition: transform .15s ease; }
/* Never let a native image/text drag start here — it would fire the app's
   "Drop files to attach" overlay and swallow the reorder gesture. */
.pin-tile, .pin-tile * { -webkit-user-drag: none; user-drag: none; }
.pin-thumb-img { pointer-events: none; }
.pin-reordering .pin-tile { cursor: grabbing; }
.pin-reordering .pin-tile-unpin { opacity: 0 !important; pointer-events: none; }
.pin-tile.pin-dragging { opacity: 0.55; transform: scale(1.06); transition: none; }
.pin-tile.pin-dragging .pin-thumb { box-shadow: 0 6px 18px rgba(0,0,0,0.28); }
@media (prefers-reduced-motion: reduce) { .pin-tile { transition: none; } }
/* ═══════════════ sharing ═══════════════ */
.share-modal-back { position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; }
.share-modal { background: var(--sp-panel); color: var(--sp-text); border: 1px solid var(--sp-border); border-radius: 10px; padding: 1.1rem 1.2rem; width: min(420px, 92vw); box-shadow: 0 12px 40px rgba(0,0,0,0.4); }
.share-modal-h { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.8rem; }
.share-modal-from { font-size: 0.78rem; color: var(--sp-text-dim); margin: -0.5rem 0 0.7rem; overflow-wrap: anywhere; }
.share-opt { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; padding: 0.35rem 0; flex-wrap: wrap; }
.share-opt.share-dim { opacity: 0.5; }
.share-in { flex: 1; min-width: 140px; background: var(--sp-bg); border: 1px solid var(--sp-border); border-radius: 5px; color: var(--sp-text); padding: 3px 7px; font-size: 0.8rem; }
.share-modal-btns { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1rem; }
/* .ghost is scoped to `aside`; this modal lives on <body>, so restyle its buttons
   to match the app (same pattern as #settingsModal). */
.share-modal button.ghost { background: var(--sp-panel); color: var(--sp-text-dim); border: 1px solid var(--sp-border); border-radius: 6px; padding: 0.35rem 0.8rem; font: inherit; font-size: 0.8rem; cursor: pointer; }
.share-modal button.ghost:hover:not(:disabled) { background: var(--sp-surface); color: var(--sp-text); border-color: var(--sp-border-bright); }
.share-modal button.share-primary { color: var(--sp-accent); border-color: var(--sp-accent); }
.share-modal button.share-primary:hover:not(:disabled) { background: var(--sp-accent); color: var(--sp-bg); border-color: var(--sp-accent); }
.share-modal-msg { font-size: 0.76rem; color: var(--sp-text-dim); margin-top: 0.6rem; min-height: 1em; }

/* ── home sky (modules/home-sky.js): a pixel-cloud field behind the LEFT pane,
   shown only while #homeCenter is on screen. The pane becomes a stacking
   context so the z-index:-1 canvas sits above the pane's ground but under
   every in-flow child (conv-host, composer, command panel). Colours come from
   the theme tokens at runtime, so nothing here is theme-specific. */
#messages { position: relative; isolation: isolate; }
#homeSky {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: -1; pointer-events: none; image-rendering: pixelated;
  opacity: 0; transition: opacity .6s ease;
}
#homeSky.sky-on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #homeSky { transition: none; } }
/* Greeting sits a little above the pane's centre (homeCenter is centred by its
   host); the bottom padding is what lifts it. Fades out with .home-leave. */
.home-greeting {
  font-weight: 300; font-size: 1.3rem; line-height: 1.2; letter-spacing: .01em;
  color: var(--sp-text); text-align: center; white-space: nowrap;
  padding-bottom: clamp(3rem, 22vh, 14rem);
}
/* Project cards under the greeting (folders.js paintHome): the greeting's tall bottom padding
   moves below the row so the pair stays centred as one block. */
.home-greeting:has(+ .home-projects) { padding-bottom: 1.4rem; }
/* The folder picker that mounts in a new chat is disabled: never shown, any theme. */
.home-projects {
  display: none;
}
/* The row is never wider than the home pane (no horizontal scrollbar, ever): the pane widens
   to fit four cards when there is room, cards shrink before they could overflow, and the pane
   clips sideways as a last guard (clip, not hidden: vertical scrolling is untouched). */
#homeCenter:has(> .home-projects) { max-width: 700px; overflow-x: clip; }
.hp-card {
  flex: 0 1 150px; min-width: 0; width: 150px; height: 60px; box-sizing: border-box; padding: 9px 12px; border: 1px solid var(--sp-border-bright, var(--sp-border)); border-radius: 9px;
  display: flex; flex-direction: column; justify-content: space-between; cursor: pointer; background: transparent;
  font-family: 'JetBrains Mono', Consolas, monospace; transition: border-color .12s, background .12s;
}
.hp-card:hover { border-color: var(--sp-accent); background: var(--sp-panel); }
/* Hover \u00d7 (top-right) to remove the project from the list */
.hp-card { position: relative; }
.hp-card .hp-gear { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; padding: 0; border: none; border-radius: 50%;
  background: transparent; color: var(--sp-text-dim); cursor: pointer; opacity: 0; transition: opacity .12s, background .12s, color .12s, transform .08s; display: flex; align-items: center; justify-content: center; }
.hp-card:hover .hp-gear { opacity: 1; }
.hp-card .hp-gear svg { width: 12px; height: 12px; display: block; }
.hp-card .hp-gear:active { transform: scale(.78); background: var(--sp-accent); color: var(--sp-bg); }
.hp-card .hp-gear:hover { background: var(--sp-panel); color: var(--sp-text); }
.hp-card.ph .hp-gear, .hp-card.new .hp-gear, .hp-card.more .hp-gear, .hp-card.auto .hp-gear, .hp-card.remote .hp-gear { display: none; }
.hp-card .hp-gear[hidden] { display: none; }
.hp-card.sel { border-color: var(--sp-accent); }
.hp-card .nm { color: var(--sp-text-mid, var(--sp-text)); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-card.sel .nm { color: var(--sp-accent); }
.hp-card .ft { display: flex; justify-content: space-between; color: var(--sp-text-dim); font-size: .62rem; opacity: .8; }
.hp-card.new, .hp-card.more, .hp-card.ph { border-style: dashed; justify-content: center; align-items: center; }
.hp-card.new .nm, .hp-card.more .nm, .hp-card.ph .nm { color: var(--sp-text-dim); }
.hp-card.new .ft, .hp-card.more .ft, .hp-card.ph .ft { display: none; }
.hp-card.ph { border-color: var(--sp-border); cursor: pointer; }
.hp-card.remote { opacity: .45; cursor: default; border-style: dotted; }
/* Files dock: a PC / cloud folder's file this device cannot open (artifacts.js) */
.artifact-wrap.artifact-away { opacity: .45; border-style: dotted !important; }
.artifact-wrap.artifact-away .artifact-card-body { cursor: default; }
.hp-card.remote:hover { border-color: var(--sp-border-bright, var(--sp-border)); background: transparent; }
.hp-card.ph .nm { opacity: .6; }
@media (max-width: 600px) { .hp-card { flex: 0 1 calc(50% - 5px); width: auto; } }

#homeCenter {
    width: 100%; max-width: 520px; margin: 0 auto;
    display: flex; flex-direction: column;
    justify-content: safe center;    /* center when short, scroll-align when tall */
    overflow-y: auto; padding: 1.5rem;
    flex: 1 1 auto; min-height: 0;   /* home screen: fill the pane so scroll engages */
  }
  /* Inside a mounted conv-host the host is the scroll container — homeCenter is a
     content-height plain child that scrolls WITH the conversation. */
  .conv-host > #homeCenter {
    flex: 0 0 auto; min-height: 0;
    overflow: visible; padding: 0 0 1.5rem;
    justify-content: flex-start;
  }
  /* A conversation with no messages yet (a fresh "+ New chat") must still LOOK
     like the home screen: the host centres its only child. `safe` degrades to
     start alignment once the lists outgrow the pane, so nothing is clipped out
     of reach at the top. */
  .conv-host:not(:has(.msg)) { justify-content: safe center; }
  .conv-host:not(:has(.msg)) > #homeCenter { padding: 0; }

  /* Entrance for a LIVE-sent user message: a short rise + fade. Only keyed
     messages carry .msg-enter (addMsg animate=true); load replays never do. */
  .msg.user.msg-enter { animation: user-enter .28s ease-out; }
  @keyframes user-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
  @media (prefers-reduced-motion: reduce) { .msg.user.msg-enter { animation: none; } .gen-activity-body { transition: none; } }

  /* Shared home screen sinks out on the first live message of a fresh chat. */
  #homeCenter.home-leave {
    animation: home-out .55s ease forwards;
    pointer-events: none;
    max-height: var(--home-h, 520px);
    overflow: hidden;
    padding: 0;
  }
  /* Fade first, THEN reclaim the space: the box is already invisible by 60%,
     so no shrinking box is ever seen — the first message just slides up into
     the emptied gap. (The old version animated height+fade together, which
     read as a visible shrink.) */
  @keyframes home-out {
    0%   { opacity: 1; max-height: var(--home-h, 520px); }
    60%  { opacity: 0; max-height: var(--home-h, 520px); }
    100% { opacity: 0; max-height: 0; }
  }
  @media (prefers-reduced-motion: reduce) { #homeCenter.home-leave { max-height: 0; opacity: 0; overflow: hidden; } }
.shared-home { width: 100%; text-align: left; user-select: none; }
.shared-home-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--sp-text-dim); margin: 0.8rem 0 0.4rem; padding-left: 0.2rem; }
.shared-tile { flex: none; width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em; background: var(--sp-panel); border: 1px solid var(--sp-border); color: var(--sp-text-dim); }
.shared-tile.skill { background: transparent; border-color: var(--sp-accent); color: var(--sp-accent); }
  .shared-tile.wide { font-size: 0.56rem; letter-spacing: 0; }
.shared-group-title { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sp-text-dim); margin: 0.6rem 0 0.2rem; }
.shared-group-title:first-child { margin-top: 0; }
.shared-file { display: flex; align-items: center; gap: 8px; padding: 0.3rem 0.4rem; border: 1px solid transparent; border-radius: 6px; }
.shared-thumb { flex: none; width: 26px; height: 26px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 14px; background: var(--sp-panel); border: 1px solid var(--sp-border); overflow: hidden; }
.shared-thumb.has-thumb { border-color: var(--sp-border-bright); }
.shared-thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shared-file:hover { border-color: var(--sp-border); background: var(--sp-panel); }
.shared-file-name { flex: 1; min-width: 0; font-size: 0.85rem; color: var(--sp-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shared-file-open { flex: 1; min-width: 0; font-size: 0.85rem; color: var(--sp-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: transparent; border: none; text-align: left; cursor: pointer; padding: 0.1rem 0; }
.shared-file-open:hover { color: var(--sp-accent); }
.shared-file-nested { margin-left: 1.6rem; }
.shared-by { font-size: 0.72rem; color: var(--sp-text-dim); flex: none; }
.shared-accept { font-size: 0.72rem; font-weight: 600; padding: 3px 12px; flex: none; color: var(--sp-accent); background: transparent; border: 1px solid var(--sp-accent); border-radius: 7px; cursor: pointer; }
.shared-accept:hover { background: var(--sp-accent-dim); }
.shared-dismiss { flex: none; background: transparent; border: none; color: var(--sp-text); cursor: pointer; font-size: 0.8rem; padding: 2px 6px; }
.shared-dismiss:hover { color: var(--sp-danger); }
.shared-dismiss.disabled { color: var(--sp-text-dim); cursor: not-allowed; opacity: 0.6; }
.shared-dismiss.disabled:hover { color: var(--sp-text-dim); }
  .shared-tip { position: fixed; z-index: 9999; display: none; background: var(--sp-surface);
    color: var(--sp-text); border: 1px solid var(--sp-border); border-radius: 8px;
    padding: 6px 10px; font-size: 0.78rem; line-height: 1.4; max-width: 240px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.5); pointer-events: none; }
/* pending invites, grouped into one accent-tinted card (the on-home notification surface) */
.share-invites { border: 1px solid var(--sp-accent); background: var(--sp-accent-dim); border-radius: 12px; padding: 0.5rem 0.55rem; margin: 0.5rem 0 1.1rem; }
.share-invites .shared-home-title { margin: 0.15rem 0.3rem 0.45rem; }
.shared-file.invite { background: var(--sp-bg); border-color: transparent; margin-top: 0.3rem; }
/* collapsible group bars (Shared with me / Team artifacts) — count pushed right */
.shared-toggle { background: none; border: none; border-top: 1px solid var(--sp-border); cursor: pointer; display: flex; align-items: center; gap: 0.45rem; width: 100%; text-align: left; text-transform: none; letter-spacing: 0; font-size: 0.82rem; font-weight: 600; color: var(--sp-text-dim); padding: 0.62rem 0.15rem; margin: 0; transition: color .12s; }
.shared-toggle:hover { color: var(--sp-text); border-top: 1px solid var(--sp-border); }
.shared-caret { font-size: 0.6rem; width: 0.8em; display: inline-block; flex: none; color: var(--sp-text-dim); }
.shared-group-name { flex: none; }
.shared-count { margin-left: auto; font-size: 0.64rem; font-weight: 600; font-family: ui-monospace, monospace; color: var(--sp-text-dim); background: var(--sp-surface); border: 1px solid var(--sp-border); border-radius: 12px; padding: 0.14rem 0.46rem; }
.shared-list { display: flex; flex-direction: column; padding-bottom: 0.3rem; }
.shared-pin { flex: none; background: transparent; border: none; cursor: pointer; font-size: 0.8rem; line-height: 1; padding: 2px 4px; }
/* Owner-only delete (removes the shared folder from the hub for everyone). */
.shared-delete { flex: none; background: transparent; border: none; cursor: pointer; font-size: 0.8rem; line-height: 1; padding: 2px 4px; color: var(--sp-text-dim); opacity: 0.85; transition: opacity 0.12s, color 0.12s, filter 0.12s; }
.shared-delete:hover { color: var(--sp-text); opacity: 1; filter: drop-shadow(0 0 3px rgba(248,81,73,0.6)); }
.shared-delete:disabled { opacity: 0.4; cursor: default; }
.shared-skill-badge { flex: none; font-size: 0.58rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--sp-accent); border: 1px solid var(--sp-accent); border-radius: 8px; padding: 0.12rem 0.42rem; }
  /* Settings → Sharing tab (shared/team lists moved off the home screen) */
  .share-head { display: flex; align-items: baseline; gap: 0.55rem; margin-bottom: 0.9rem; }
  .share-head h3 { margin: 0; font-size: 1rem; font-weight: 600; }
  .share-total { font-size: 0.72rem; color: var(--sp-text-dim); }
  .share-sec-title { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sp-text-dim); margin: 0.9rem 0 0.35rem; padding-left: 0.1rem; }
  .share-list { list-style: none; display: flex; flex-direction: column; gap: 0.3rem; }
  .share-empty-hint { font-size: 0.72rem; color: var(--sp-text-dim); opacity: 0.8; padding: 0.2rem 0.1rem; }
  /* pinnedHome "+Add" tile — same footprint as every pin tile; count rides inside the icon */
  .pin-tile.add-tile { justify-content: center; background: transparent; cursor: pointer; }
  .pin-tile.add-tile:hover { background: var(--sp-panel); }
  .add-icon {
    position: relative; width: 60px; height: 60px; border-radius: 15px; overflow: visible;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.35rem; line-height: 1; color: var(--sp-accent);
    background: var(--sp-panel); border: 1px solid var(--sp-border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
    transition: transform .12s ease, border-color .12s, box-shadow .12s;
  }
  .pin-tile.add-tile:hover .add-icon, .pin-tile.add-tile:focus-visible .add-icon {
    transform: translateY(-2px); border-color: var(--sp-accent); box-shadow: 0 4px 10px rgba(0,0,0,0.28);
  }
  .pin-tile.add-tile:active .add-icon { transform: translateY(0) scale(0.96); }
  .add-icon .add-count { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--sp-accent); color: var(--sp-bg); font-size: 0.6rem; font-weight: 700; line-height: 18px; text-align: center; }
  .add-label { max-width: 78px; font-size: 0.72rem; line-height: 1.15; color: var(--sp-text); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* Settings → Fonts tab */
  .font-list { list-style: none; display: flex; flex-direction: column; gap: 0.3rem; }
  .font-add-btn {
    margin-left: auto; background: var(--sp-panel); border: 1px solid var(--sp-border);
    border-radius: 6px; color: var(--sp-text); font: 0.72rem inherit;
    padding: 0.28rem 0.6rem; cursor: pointer; flex-shrink: 0;
  }
  .font-add-btn:hover { border-color: var(--sp-accent); }
  .font-list .sp-item-body { padding: 0.3rem 0.4rem 0.45rem; }
  .font-row {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.32rem 0.45rem; border-radius: 6px;
  }
  .font-row:hover { background: var(--sp-border); }
  .font-row.legacy { opacity: 0.55; }
  .font-row .font-name { flex: 1 1 auto; min-width: 0; font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .font-row .font-size { flex-shrink: 0; font-size: 0.62rem; color: var(--sp-text-dim); font-variant-numeric: tabular-nums; }
  .font-row .font-del {
    flex-shrink: 0; background: transparent; border: none; color: var(--sp-text-dim);
    font-size: 0.7rem; cursor: pointer; padding: 2px 6px; border-radius: 4px;
  }
  .font-row .font-del:hover { color: var(--sp-danger); background: var(--sp-bg); }
  .font-row.font-empty { cursor: default; justify-content: center; color: var(--sp-text-dim); font-size: 0.75rem; padding: 1rem 0.5rem; opacity: 0.75; }
  .font-row.font-empty:hover { background: var(--sp-panel); }
  .font-note { font-size: 0.72rem; color: var(--sp-text-dim); opacity: 0.9; padding: 0.2rem 0.1rem; }

.share-opt.share-pin { margin-top: 0.3rem; padding-top: 0.5rem; border-top: 1px solid var(--sp-border); font-size: 0.8rem; color: var(--sp-text-dim); }

.share-banner {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3000;   /* scoped to <main>, not over the sidebar */
  background: var(--sp-accent); color: var(--sp-bg);
  font-size: 0.82rem; font-weight: 500; text-align: center;
  padding: 0.5rem 1rem; cursor: pointer; user-select: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.share-banner:hover { filter: brightness(1.06); }

/* write_todos renders as a normal tool again (2026-08-31): the checklist card
   inside its tool box and the progress badge in the timer line are visible, like
   any other tool's result. (Un-hidden — was display:none from 2026-08-27.) */

/* ---- Files explorer modal (files-modal.js) ------------------------------- */
/* Same chrome as .sidebar-collapse-btn (bg panel, border, 32px square) */
.files-open-btn {
  background: var(--sp-bg); border: 1px solid var(--sp-border); color: var(--sp-text);
  border-radius: 6px; width: 32px; height: 32px; padding: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.files-open-btn:hover {
  background: var(--sp-surface); color: var(--sp-accent);
  box-shadow: 0 0 20px 4px var(--sp-accent-dim), 0 0 40px 6px var(--sp-accent-dim), 0 4px 8px rgba(0,0,0,0.6);
}
.files-open-btn .material-symbols-outlined { font-size: 20px; color: var(--sp-text); font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24; }
.files-open-btn:hover .material-symbols-outlined { color: var(--sp-accent); }
.files-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 1100; }
.files-modal .fm-panel { background: var(--sp-bg); border: 1px solid var(--sp-border-bright, var(--sp-border)); border-radius: 10px; width: min(860px, 94vw); height: min(600px, 90vh); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,0.55); }
.files-modal .fm-title { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--sp-border); background: var(--sp-surface); }
.files-modal .fm-title .fm-name { font: 0.85rem 'JetBrains Mono', Consolas, monospace; color: var(--sp-text); }
.files-modal .fm-title .fm-close { margin-left: auto; background: transparent; border: none; color: var(--sp-text-dim); font-size: 1.1rem; cursor: pointer; }
.files-modal .fm-title .fm-close:hover { color: var(--sp-text); }
.files-modal .fm-nav { display: flex; align-items: center; gap: 0.4rem; padding: 0.5rem 0.9rem; border-bottom: 1px solid var(--sp-border); }
.files-modal .fm-nav .material-symbols-outlined { font-size: 18px; color: var(--sp-text-dim); }
.files-modal .fm-nav button.fm-ic { background: transparent; border: none; color: var(--sp-text-dim); cursor: pointer; padding: 2px; display: flex; border-radius: 4px; }
.files-modal .fm-nav button.fm-ic:hover { color: var(--sp-text); background: var(--sp-surface); }
.files-modal .fm-nav input { flex: 1; background: var(--sp-panel); border: 1px solid var(--sp-border); border-radius: 4px; color: var(--sp-text); font: 0.8rem 'JetBrains Mono', Consolas, monospace; padding: 0.35rem 0.6rem; }
.files-modal .fm-body { flex: 1; overflow: auto; padding: 0.5rem 0.9rem; }
/* Apps launcher: same shell as Files, sized to its grid rather than the viewport. */
.apps-modal .fm-panel { width: min(600px, 94vw); height: auto; max-height: min(640px, 88vh); }
.apps-modal .fm-body { padding: 1.4rem 1.2rem 1.6rem; }
.apps-modal .pinned-home { margin-bottom: 0; }
.files-modal .fm-foot { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0.9rem; border-top: 1px solid var(--sp-border); background: var(--sp-surface); font-size: 0.78rem; color: var(--sp-text-dim); }
.files-modal .fm-foot .fm-sp { flex: 1; }
.files-modal .fm-foot button { background: var(--sp-panel); border: 1px solid var(--sp-border); color: var(--sp-text); border-radius: 4px; padding: 0.3rem 0.7rem; font-size: 0.78rem; cursor: pointer; }
.files-modal .fm-foot button:hover { background: var(--sp-surface); }
.files-modal ul.fs-list li { padding: 0.3rem 0.3rem; }
.files-modal ul.fs-list li .name { cursor: pointer; display: flex; align-items: center; gap: 0.35rem; }
.files-modal ul.fs-list li .name .material-symbols-outlined { font-size: 17px; color: var(--sp-text-dim); }
.files-modal ul.fs-list li .name:hover { color: var(--sp-text); }
/* Multi-select (shift/ctrl click): a row in the active selection — mirrors the conv-list treatment */
.files-modal ul.fs-list li.selected {
  background: var(--sp-accent-dim);
  border-color: var(--sp-accent);
}
.files-modal ul.fs-list li.selected .name { color: var(--sp-text); }

/* Grid view (files explorer modal): icon tiles like a normal OS explorer */
.files-modal .fm-nav button.fm-view-on { color: var(--sp-accent); background: var(--sp-accent-dim); }
.files-modal ul.fs-list.fm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.files-modal ul.fs-list.fm-grid li { display: block; padding: 10px 6px; text-align: center; border: 1px solid transparent; border-radius: 8px; }
.files-modal ul.fs-list.fm-grid li:hover { background: var(--sp-surface); }
.files-modal ul.fs-list.fm-grid li .name { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.files-modal ul.fs-list.fm-grid li .name .fm-tile-icon { font-size: 26px; line-height: 1; }
.files-modal ul.fs-list.fm-grid li .name .fm-tile-name { font-size: 0.72rem; color: var(--sp-text); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files-modal ul.fs-list.fm-grid li .name .fm-tile-size { font-size: 0.65rem; color: var(--sp-text-dim); }

  /* ---- Line Ladder unveil (respond() one-shot paint, 2026-09-13) ----
     Top-level blocks of a freshly painted assistant reply pop in one by one.
     The full markdown is rendered exactly once by _paintContent(); this is a
     pure visual overlay (opacity/transform only, no layout properties), so it
     never reintroduces the O(n^2) re-render the 2026-09-02 one-shot fix removed.
     Hidden state is gated on .ll-play so history re-renders, streaming paints
     and reduced-motion always show the reply instantly. */
  .msg.assistant.ll-play .ll-block {
    opacity: 0;
    transform: translateY(0.5em);
    animation: llPop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
    animation-delay: var(--ll-d, 0ms);
  }
  @keyframes llPop { to { opacity: 1; transform: none; } }
  @media (prefers-reduced-motion: reduce) {
    .msg.assistant.ll-play .ll-block { animation: none; opacity: 1; transform: none; }
  }
  .proj-panel .proj-add {
    display: flex; align-items: center; gap: 0.45rem; margin: 0.25rem 0.15rem 0.15rem;
    padding: 0.4rem 0.5rem; border-radius: 5px; border: 1px dashed var(--sp-border-bright);
    font-size: 0.75rem; color: var(--sp-text-dim); cursor: pointer;
  }
  .proj-panel .proj-add:hover { color: var(--sp-text); border-color: var(--sp-accent); }
  .proj-panel .proj-add .plus { color: var(--sp-accent); font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════════════
   AURORA — floating glass panels over two green glows (lime top-left, mint
   bottom-right). Desktop: the sidebar and the chat are separate rounded glass
   panels; the sidebar gets its own header ([sandpie] mark + hide), a Search box
   that filters the chat list (modules/sidebar-search.js, no server), labelled
   New chat / Files / Apps rows and a Settings footer. Collapsed, the icon rail
   is a 64px glass strip. The .au-only markup exists in every theme but only
   shows here (desktop); mobile keeps its header + drawer, recoloured.
   Every selector is prefixed :is([data-theme="aurora"], [data-theme="aurora-light"]), so Light and Olive are
   untouched.
   ═══════════════════════════════════════════════════════════════════════ */
.au-only { display: none; }
:is([data-theme="aurora"], [data-theme="aurora-light"]) {
  --sp-scrollbar: rgba(255,255,255,0.12);
  --sp-scrollbar-hover: rgba(255,255,255,0.28);
  --sp-rail: rgba(255,255,255,0.045);
  --sp-rail-border: var(--sp-border);
  --sp-rail-ink: var(--sp-text-dim);
  --sp-rail-ink-hot: var(--sp-accent);
  --sp-rail-hot-bg: color-mix(in srgb, var(--sp-accent) 14%, transparent);
  --sp-text-mid: #d6dad2;
  --au-glass: rgba(255,255,255,0.045);
  --au-glass-2: rgba(255,255,255,0.08);
  --au-font: 'Figtree', 'Segoe UI', system-ui, sans-serif;
}
:is([data-theme="aurora"], [data-theme="aurora-light"]) body {
  background:
    radial-gradient(60% 70% at 8% 0%, rgba(150,200,60,0.24), transparent 60%),
    radial-gradient(50% 60% at 100% 100%, rgba(80,210,170,0.20), transparent 60%),
    radial-gradient(40% 40% at 70% 20%, rgba(255,170,120,0.07), transparent 60%),
    var(--sp-bg);
  font-family: var(--au-font);
}
:is([data-theme="aurora"], [data-theme="aurora-light"]) .mobile-header .brand .bracket { color: var(--sp-accent-2); }
:is([data-theme="aurora"], [data-theme="aurora-light"]) .mobile-header .brand { font-family: var(--au-font); font-weight: 700; letter-spacing: 0; }

/* Composer: glass box, round gradient send, pill model picker. */
:is([data-theme="aurora"], [data-theme="aurora-light"]) .input-wrap { background: rgba(255,255,255,0.06); border-color: var(--sp-border); border-radius: 20px; }
:is([data-theme="aurora"], [data-theme="aurora-light"]) .input-wrap:focus-within { border-color: color-mix(in srgb, var(--sp-accent) 45%, transparent); box-shadow: 0 0 0 3px var(--sp-accent-dim); }
:is([data-theme="aurora"], [data-theme="aurora-light"]) .send-btn {
  width: 34px; height: 34px;
  border-radius: 50% !important;
  background: linear-gradient(135deg, var(--sp-accent-2), var(--sp-accent)) !important;
  color: #0b0c0b !important;
}
/* Aurora (dark) send button: paper-plane send icon, rounded-square stop. The
   app swaps the icon by replacing the span (refreshSendButtonFor), so the
   transition runs as a pop-in keyframe on the incoming icon — the same
   scale+rotate swap as mockup gallery 2. Aurora-light keeps the plain glyphs. */
[data-theme="aurora"] .send-btn .ic-play {
  width: 16px; height: 16px; border: 0; margin: 0;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M14.7 1.3c.6-.6 0-1.6-.8-1.4L1.4 4.2c-.8.2-.9 1.3-.1 1.6l4.9 1.9 1.9 4.9c.3.8 1.4.7 1.6-.1l4.3-12.5c0-.1-.1.1.7 1.3z' transform='scale(.92) translate(.6 .6)'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M14.7 1.3c.6-.6 0-1.6-.8-1.4L1.4 4.2c-.8.2-.9 1.3-.1 1.6l4.9 1.9 1.9 4.9c.3.8 1.4.7 1.6-.1l4.3-12.5c0-.1-.1.1.7 1.3z' transform='scale(.92) translate(.6 .6)'/%3E%3C/svg%3E") center/contain no-repeat;
  animation: au-icon-in 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
[data-theme="aurora"] .send-btn .ic-stop {
  width: 13px; height: 13px; border-radius: 3.5px;
  animation: au-icon-in 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes au-icon-in {
  0%   { transform: scale(0) rotate(-90deg); opacity: 0; }
  60%  { transform: scale(1.15) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  [data-theme="aurora"] .send-btn .ic-play,
  [data-theme="aurora"] .send-btn .ic-stop { animation: none; }
}
:is([data-theme="aurora"], [data-theme="aurora-light"]) .mp-trigger { background: rgba(255,255,255,0.05); border-color: var(--sp-border); font-family: var(--au-font); font-weight: 600; }
:is([data-theme="aurora"], [data-theme="aurora-light"]) .mp-trigger:hover { border-color: color-mix(in srgb, var(--sp-accent) 45%, transparent); }
/* Stats line above the composer + the folder chip that opens the file dock. */
:is([data-theme="aurora"], [data-theme="aurora-light"]) .msg-timer { color: color-mix(in srgb, var(--sp-text-dim) 80%, transparent); }
:is([data-theme="aurora"], [data-theme="aurora-light"]) .mt-folder .dock-hd { border: 1px solid var(--sp-border); border-radius: 999px; background: rgba(255,255,255,0.05); padding: 1px 9px; }
:is([data-theme="aurora"], [data-theme="aurora-light"]) .mt-folder .dock-hd:hover,
:is([data-theme="aurora"], [data-theme="aurora-light"]) .mt-folder .dock-hd.open { border-color: color-mix(in srgb, var(--sp-accent) 45%, transparent); color: var(--sp-text); }

/* Chat list rows. */
:is([data-theme="aurora"], [data-theme="aurora-light"]) ul.conv-list li { border-radius: 12px; border-color: transparent; }
:is([data-theme="aurora"], [data-theme="aurora-light"]) ul.conv-list li:hover { background: var(--au-glass-2); }
:is([data-theme="aurora"], [data-theme="aurora-light"]) ul.conv-list li.active,
:is([data-theme="aurora"], [data-theme="aurora-light"]) ul.conv-list li.in-panel { background: rgba(255,255,255,0.10); border-color: transparent; outline: none; color: var(--sp-text); }
:is([data-theme="aurora"], [data-theme="aurora-light"]) ul.conv-list .name { font-family: var(--au-font); font-weight: 500; }
:is([data-theme="aurora"], [data-theme="aurora-light"]) ul.conv-list li.conv-group { font-family: var(--au-font); }
  /* Aurora: the base :first-child padding-top tweak (0.1rem) is unwanted — keep the uniform 0.5rem. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) ul.conv-list li.conv-group:first-child { padding-top: 0.5rem; }

@media (min-width: 769px) and (hover: hover), (min-width: 769px) and (pointer: fine) {
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-only { display: flex; }
  /* Open: the panel carries its own nav, so the icon rail steps aside. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .sidebar-rail { display: none; }   /* morph shell: the sidebar itself becomes the rail */


  /* The open sidebar: a floating glass panel. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside {
    margin: 10px 0 10px 10px; padding: 12px 10px 0 10px;
    border-radius: 18px; border: 1px solid var(--sp-border);
    background: var(--au-glass);
    backdrop-filter: blur(24px) saturate(140%);
    box-shadow: 0 30px 60px -30px rgba(0,0,0,0.8), inset 0 1px 0 rgba(255,255,255,0.06);
    /* The pane itself never scrolls: the chat list scrolls inside its own
       region so the Settings card stays pinned to the bottom. */
    overflow: hidden;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) #convSection { overflow-y: auto; min-height: 0; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) #convSection.osb-host { padding-right: 14px; }   /* rail lane (scrollbar.js) */
  /* -- Morph shell: sidebar and siderail are one object. Collapsing shrinks
     the panel itself into a 64px icon strip instead of swapping to a rail. -- */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside { transition: width .38s cubic-bezier(.4,0,.2,1), flex-basis .38s cubic-bezier(.4,0,.2,1); flex: 0 1 var(--sidebar-width, 300px); }
  /* Collapse is the exact reverse of expansion. This transient class changes
     size only; the final rail layout lands when the 380ms morph completes. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.morph-collapsing {
    width: 64px !important; min-width: 64px !important; flex: 0 0 64px !important;
    transition: width .38s cubic-bezier(.8,0,.6,1), flex-basis .38s cubic-bezier(.8,0,.6,1);
  }
  /* Keep the open inner canvas fixed while either morph direction runs. The
     shrinking panel clips it; shortcuts, chat titles and footers never reflow.
     22px = 20px horizontal padding + 2px border on the open panel. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside:not(.collapsed) > :is(.au-top, .au-nav, #convSection, .au-foot) {
    width: calc(var(--sidebar-width, 300px) - 22px);
    min-width: calc(var(--sidebar-width, 300px) - 22px);
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed {
    width: 64px !important; min-width: 64px !important; flex: 0 0 64px !important;
    opacity: 1; pointer-events: auto; overflow: hidden;
  }
  /* Expansion: labels, logo and the conversation list fade in after .12s.
     Collapse reverses it: hold until .08s, fade .08s-.26s, finish at .38s. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside :is(.au-lbl, .au-mark) { transition: opacity .18s ease, max-width .18s ease, margin .18s ease, padding .18s ease; max-width: 240px; overflow: hidden; white-space: nowrap; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside:not(.collapsed) :is(.au-lbl, .au-mark) { transition-delay: .12s; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.morph-collapsing :is(.au-lbl, .au-mark) {
    opacity: 0; max-width: 0; margin: 0; padding: 0;
    transition: opacity .18s cubic-bezier(.75,0,.75,.9) .08s, max-width .18s cubic-bezier(.75,0,.75,.9) .08s, margin .18s cubic-bezier(.75,0,.75,.9) .08s, padding .18s cubic-bezier(.75,0,.75,.9) .08s;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-lbl { opacity: 0; max-width: 0; margin: 0; padding: 0; flex: none; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-mark { max-width: 0; margin: 0; padding: 0; font-size: 0; opacity: 0; overflow: hidden; white-space: nowrap; flex: none; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside #convSection { opacity: 1; transition: opacity .18s ease .12s, scrollbar-color .35s ease; @starting-style { opacity: 0; } }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.morph-collapsing #convSection { opacity: 0; transition: opacity .18s cubic-bezier(.75,0,.75,.9) .08s, scrollbar-color .35s ease; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed #convSection { opacity: 0; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .sidebar-header,
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed #convSection { display: none; }
  /* Uniform 40px rows on one axis: kill asymmetric padding, flex gap and auto
     margins so every icon centers identically (toggle included). */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-top { padding: 0; margin: 0; justify-content: center; position: static; }
  /* Hairline: a separate transitioning layer rather than content created only
     after the layout commits. It stays aligned to the collapsing 42px rail. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside::after {
    content: ""; position: absolute; top: 62.5px; right: 11px; width: 42px; height: 1px;
    background: linear-gradient(to right, transparent 0 11px, var(--sp-border) 11px 31px, transparent 31px);
    opacity: 0; pointer-events: none;
    transition: opacity .18s cubic-bezier(.75,0,.75,.9) .08s;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.morph-collapsing::after,
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed::after {
    opacity: 1; transition: opacity .18s ease .12s;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-nav { padding: 0; margin: 0 0 6px; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-foot { padding: 8px 0 12px; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-row { width: 42px; min-width: 42px; height: 40px; margin: 0; padding: 0 10px 0 12px; justify-content: flex-start; gap: 0; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-me { width: 42px; min-width: 42px; height: 44px; margin: 0; padding: 0 0 0 6px; justify-content: flex-start; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-hide { width: 34px; min-width: 34px; height: 34px; margin: 0; padding: 0; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-search { background: transparent; border: none; box-shadow: none; outline: none; cursor: pointer; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-search::before { opacity: 0; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-search input,
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-row kbd { display: none; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-search input { pointer-events: none; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-search .material-symbols-outlined { color: var(--sp-text-dim); }   /* open-state search icon is bright by design; dim it back on the rail */
  /* Hover parity: every rail control brightens bg + icon alike. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-search:hover { background: var(--au-glass-2); }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-row:hover .material-symbols-outlined,
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-search:hover .material-symbols-outlined { color: var(--sp-text); }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-me:hover svg { color: var(--sp-text); }
  /* Toggle: no rotation. Absolute anchoring keeps the control visible as the
     panel shrinks, instead of moving it off-panel then snapping it back. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside button.au-hide {
    position: absolute; top: 18px; right: 13px; margin: 0;
    transition: right .38s cubic-bezier(.4,0,.2,1);
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.morph-collapsing button.au-hide {
    right: 14px; transition: right .38s cubic-bezier(.8,0,.6,1);
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed button.au-hide { right:14px; margin: 0; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside button.au-hide .material-symbols-outlined {
    font-size: 20px; opacity: 1; transition: opacity .18s ease .12s;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.morph-collapsing button.au-hide .material-symbols-outlined,
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed button.au-hide .material-symbols-outlined {
    opacity: 0; transition: opacity .18s cubic-bezier(.75,0,.75,.9) .08s;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside button.au-hide::before {
    content: "dock_to_right"; position: absolute; inset: 0; display: grid; place-items: center;
    font-family: 'Material Symbols Outlined'; font-size: 20px; font-weight: normal;
    font-style: normal; line-height: 1; letter-spacing: normal; text-transform: none;
    white-space: nowrap; direction: ltr; -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased; font-feature-settings: 'liga';
    opacity: 0; transition: opacity .18s cubic-bezier(.75,0,.75,.9) .08s;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.morph-collapsing button.au-hide::before,
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed button.au-hide::before {
    opacity: 1; transition: opacity .18s ease .12s;
  }
  /* Tooltips in rail mode: the labels are gone, so icons must name themselves. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-row,
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-me { position: relative; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed [data-tip]::after {
    content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
    background: var(--au-glass-2); color: var(--sp-text); padding: 5px 10px; border-radius: 7px;
    font: 500 12px var(--au-font); white-space: nowrap; opacity: 0; pointer-events: none;
    transition: opacity .12s ease .3s; border: 1px solid var(--sp-border); z-index: 999;
    box-shadow: 0 6px 18px rgba(0,0,0,.5);
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed [data-tip]:hover::after { opacity: 1; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) main {
    margin: 10px; border-radius: 18px; overflow: hidden;
    background: rgba(8,10,8,0.55); border: 1px solid var(--sp-border);
  }

  /* Panel header: [sandpie] + hide. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-top { align-items: center; height: 44px; padding: 0 2px 0 8px; flex-shrink: 0; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-mark { font: 700 19px/1 var(--au-font); color: var(--sp-text); text-decoration: none; white-space: nowrap; max-width: 240px; overflow: hidden; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-mark i { font-style: normal; color: var(--sp-accent-2); }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside button.au-hide {
    margin-left: auto; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 10px;
    background: transparent; color: var(--sp-text-dim); display: grid; place-items: center; align-self: center;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside button.au-hide:hover { background: var(--au-glass-2); color: var(--sp-text); }

  /* Rows: Search (gradient edge), New chat, Files, Apps, Settings. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-nav { flex-direction: column; flex-shrink: 0; margin-bottom: 6px; gap: 4px; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-row,
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside button.au-row {
    display: flex; align-items: center; gap: 12px; height: 40px; width: 100%; flex: none;
    padding: 0 10px 0 12px; border: 0; border-radius: 12px; background: transparent;
    color: var(--sp-text); font: 500 14px var(--au-font); text-align: left; cursor: pointer; box-shadow: none;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-row .material-symbols-outlined { font-size: 20px; width: 20px; flex: none; color: var(--sp-text-dim); }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-row:hover,
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside button.au-row:hover { background: var(--au-glass-2); color: var(--sp-text); }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-search {
    position: relative; height: 42px; border-radius: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04));
    cursor: pointer;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-search::before {
    content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
    opacity: 1; transition: opacity .18s ease .12s;
    background: linear-gradient(120deg, color-mix(in srgb, var(--sp-accent-2) 90%, transparent), color-mix(in srgb, var(--sp-accent) 70%, transparent), rgba(255,255,255,0.1));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.morph-collapsing .au-search::before {
    opacity: 0; transition: opacity .18s cubic-bezier(.75,0,.75,.9) .08s;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-search .material-symbols-outlined { color: var(--sp-text-dim); }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-row kbd { margin-left: auto; font: 11px 'JetBrains Mono', Consolas, monospace; color: color-mix(in srgb, var(--sp-text-dim) 75%, transparent); }

  /* "Chats" heading: hidden entirely in Aurora. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside .sidebar-header { display: none; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) #convSortToggle { display: none; }

  /* Footer: avatar + Settings, pinned under the list. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-foot { margin-top: auto; padding: 8px 0 12px; flex-shrink: 0; z-index: 1; }
  /* Foot layout: Settings on the left, the sun/moon theme toggle on the right. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  /* .au-row is width:100% + flex:none - inside the foot it must yield room for the toggle. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-foot .au-row { width: auto; flex: 1 1 auto; min-width: 0; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-foot .theme-mode-btn { height: 34px; flex: none; padding: 0 12px 0 10px; border: 0; border-radius: 17px; background: transparent; color: var(--sp-text-dim); display: flex; align-items: center; gap: 6px; align-self: center; transition: background-color .25s ease, color .25s ease; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-foot .theme-mode-btn .material-symbols-outlined {
    font-size: 20px; opacity: 1; transition: opacity .18s ease .12s;
  }
  /* The expanded theme icon moves off-canvas during a collapse. Keep a second
     glyph at the rail's fixed final x-coordinate so it only fades in place
     through the reversible morph instead of appearing at the layout hand-off. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside::before {
    content: "dark_mode"; position: absolute; right: auto; left: 22px; bottom: 70px;
    width: 20px; height: 20px; display: block; color: var(--sp-text-dim);
    font-family: 'Material Symbols Outlined'; font-size: 20px; font-weight: normal;
    font-style: normal; line-height: 20px; letter-spacing: normal; text-transform: none;
    white-space: nowrap; direction: ltr; -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased; font-feature-settings: 'liga';
    opacity: 0; pointer-events: none; z-index: 2;
    transition: opacity .18s cubic-bezier(.75,0,.75,.9) .08s;
  }
  [data-theme="aurora-light"] aside::before { content: "light_mode"; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.morph-collapsing::before,
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed::before {
    opacity: 1; transition: opacity .18s ease .12s;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.morph-collapsing .au-foot .theme-mode-btn .material-symbols-outlined,
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-foot .theme-mode-btn .material-symbols-outlined {
    opacity: 0; transition: opacity .18s cubic-bezier(.75,0,.75,.9) .08s;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-foot .theme-mode-btn:hover { background: var(--au-glass-2); color: var(--sp-text); }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-foot .theme-mode-btn .au-lbl { font: 500 13px var(--au-font); }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-foot .theme-mode-btn { width: 34px; padding: 0; border-radius: 10px; display: grid; place-items: center; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-foot .theme-mode-btn .au-lbl { opacity: 0; max-width: 0; margin: 0; padding: 0; }
  /* Rail (collapsed): the foot stacks vertically - sun/moon ABOVE the settings avatar. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-foot { flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside.collapsed .au-foot .theme-mode-btn { order: -1; width: 42px; height: 40px; padding: 0 10px 0 12px; display: flex; align-items: center; justify-content: flex-start; border-radius: 12px; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside button.au-me { height: 44px; padding-left: 6px; }
  /* Settings avatar: identical to the rail identity button — 32px round chip,
     20px icon, rail-ink grey that turns accent on hover. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-me .sb-avatar-svg {
    width: 32px; height: 32px; padding: 6px; box-sizing: border-box; flex: none;
    border-radius: 50%; background: var(--sp-rail-hot-bg); color: var(--sp-rail-ink);
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-me:hover .sb-avatar-svg { color: var(--sp-rail-ink-hot); transform: translateY(-1px); }
}

/* =============================================================
   Mobile drawer = the desktop sidebar's anatomy (reconciled navbar,
   2026-11-27). The mobile header keeps only brand + New chat +
   hamburger; Search / Files / Apps / Settings and the theme toggle
   moved into the drawer, which shows the same .au-* structure and
   row geometry as the desktop panel above — one component, both
   breakpoints. No kbd shortcut hints and no sort toggle on touch;
   :active stands in for :hover where there is no pointer.
   ============================================================= */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
  :is([data-theme="aurora"], [data-theme="aurora-light"]) :is(.au-nav, .au-foot) { display: flex; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside {
    display: flex; flex-direction: column;
    padding: 12px 10px max(1rem, env(safe-area-inset-bottom, 0px)) 10px;
    background: var(--au-glass);
    backdrop-filter: blur(24px) saturate(140%);
    -webkit-backdrop-filter: blur(24px) saturate(140%);
    overflow: hidden;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) #convSection { overflow-y: auto; min-height: 0; flex: 1 1 auto; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside .sidebar-header,
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside #convSortToggle { display: none; }   /* no time/project toggle on mobile */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside .au-row kbd { display: none; }       /* no shortcut hints on touch */

  /* No brand row in the drawer on mobile: the navbar owns brand + toggle. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-top { display: none; }

  /* Rows: Search (gradient edge), New chat, Files, Apps — same 40px rows. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-nav { flex-direction: column; flex-shrink: 0; margin-bottom: 6px; gap: 4px; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-row {
    display: flex; align-items: center; gap: 12px; height: 40px; width: 100%; flex: none;
    padding: 0 10px 0 12px; border: 0; border-radius: 12px; background: transparent;
    color: var(--sp-text); font: 500 14px var(--au-font); text-align: left; cursor: pointer; box-shadow: none;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-row .material-symbols-outlined { font-size: 20px; width: 20px; flex: none; color: var(--sp-text-dim); }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-row:active { background: var(--au-glass-2); color: var(--sp-text); }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-search {
    position: relative; height: 42px; border-radius: 14px;
    background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04));
    cursor: pointer;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-search::before {
    content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
    background: linear-gradient(120deg, color-mix(in srgb, var(--sp-accent-2) 90%, transparent), color-mix(in srgb, var(--sp-accent) 70%, transparent), rgba(255,255,255,0.1));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-search .material-symbols-outlined { color: var(--sp-text-dim); }

  /* Footer: Settings avatar left, dark/light right — one row, as on desktop. */
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-foot { margin-top: auto; padding: 8px 0 12px; flex-shrink: 0; align-items: center; justify-content: space-between; gap: 8px; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-foot .au-row { width: auto; flex: 1 1 auto; min-width: 0; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-foot .theme-mode-btn { height: 34px; flex: none; padding: 0 12px 0 10px; border: 0; border-radius: 17px; background: transparent; color: var(--sp-text-dim); display: flex; align-items: center; gap: 6px; align-self: center; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-foot .theme-mode-btn .material-symbols-outlined { font-size: 20px; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-foot .theme-mode-btn .au-lbl { font: 500 13px var(--au-font); }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-foot .theme-mode-btn:active { background: var(--au-glass-2); color: var(--sp-text); }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) aside button.au-me { height: 44px; padding-left: 6px; }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-me .sb-avatar-svg {
    width: 32px; height: 32px; padding: 6px; box-sizing: border-box; flex: none;
    border-radius: 50%; background: var(--sp-rail-hot-bg); color: var(--sp-rail-ink);
  }
  :is([data-theme="aurora"], [data-theme="aurora-light"]) .au-me:active .sb-avatar-svg { color: var(--sp-rail-ink-hot); }

  /* Navbar polish (mobile): New chat as a neutral chip - same border,
     background and ink as the hamburger button, just wider. */
  .mobile-header .new-chat-chip {
    width: auto; height: 32px; padding: 0 12px 0 10px; gap: 6px; border-radius: 6px;
    background: var(--sp-bg);
    border: 1px solid var(--sp-border);
  }
  .mobile-header .new-chat-chip .material-symbols-outlined { font-size: 18px; color: var(--sp-text); }
  .mobile-header .new-chat-chip .chip-lbl { font-size: 13px; font-weight: 500; color: var(--sp-text); white-space: nowrap; }
}



/* Cinematic theme flip: animate two page snapshots instead of recoloring every
   element and pseudo-element throughout the transition. */
::view-transition { pointer-events: none; }
::view-transition-group(root) {
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(.45,0,.15,1);
}
::view-transition-image-pair(root) { isolation: isolate; }
::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: 2s;
  animation-timing-function: cubic-bezier(.45,0,.15,1);
  animation-fill-mode: both;
  mix-blend-mode: normal;
}
::view-transition-old(root) { animation-name: sp-theme-dissolve-old; }
::view-transition-new(root) { animation-name: sp-theme-dissolve-new; }
@keyframes sp-theme-dissolve-old { from { opacity: 1; } to { opacity: 0; } }
@keyframes sp-theme-dissolve-new {
  from { opacity: 0; transform: scale(1.012); }
  to { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(root), ::view-transition-old(root), ::view-transition-new(root) { animation-duration: .01ms; }
}


/* ═══════════════════════════════════════════════════════════════════════
   AURORA LIGHT — Aurora's layout (rules above match it too) on a light,
   green-tinted ground. No glows and no glass: the colour lives in the
   tinted neutrals and the accent; depth comes from soft, layered shadows
   under solid near-white panels. Conversation styling is Light's.
   ═══════════════════════════════════════════════════════════════════════ */
[data-theme="aurora-light"] {
  --sp-scrollbar: rgba(0,0,0,0.12);
  --sp-scrollbar-hover: rgba(0,0,0,0.28);
  --sp-text-mid: #3a4037;
  --sp-rail: #f8faf5;
  --sp-rail-hot-bg: color-mix(in srgb, var(--sp-accent) 12%, transparent);
  --au-glass: #f8faf5;
  --au-glass-2: rgba(40,60,30,0.05);
  --au-lift: 0 1px 2px rgba(40,60,30,0.06), 0 14px 34px -14px rgba(40,60,30,0.22);
}
[data-theme="aurora-light"] body { background: var(--sp-bg); }
[data-theme="aurora-light"] main { background: var(--sp-surface); }
[data-theme="aurora-light"] .user .bubble {
  background: linear-gradient(135deg, var(--sp-accent-2), var(--sp-accent));
  color: #fff;
}
[data-theme="aurora-light"] .input-wrap { background: #ffffff; box-shadow: 0 12px 30px -18px rgba(40,60,30,0.35); }
/* Aurora-light send button: the Neutral Glass mockup — surface-white fill,
   hairline border, ink paper-plane icon; mint appears on hover, and while
   generating the button fills with ink. Overrides the shared lime->mint gradient. */
[data-theme="aurora-light"] .send-btn {
  background: var(--sp-surface) !important;
  border: 1px solid var(--sp-border-bright) !important;
  color: var(--sp-text) !important;
  box-shadow: 0 1px 4px rgba(30,50,20,0.08);
}
[data-theme="aurora-light"] .send-btn:hover {
  border-color: var(--sp-accent);
  color: var(--sp-accent) !important;
  box-shadow: 0 2px 8px rgba(30,50,20,0.10);
}
/* While generating: Pure Glass — the chip is completely unchanged, only the
   stop icon turns mint. The quietest possible active signal. */
[data-theme="aurora-light"] .send-btn.sending {
  color: var(--sp-accent) !important;
}
[data-theme="aurora-light"] .send-btn .ic-play {
  width: 16px; height: 16px; border: 0; margin: 0;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M14.7 1.3c.6-.6 0-1.6-.8-1.4L1.4 4.2c-.8.2-.9 1.3-.1 1.6l4.9 1.9 1.9 4.9c.3.8 1.4.7 1.6-.1l4.3-12.5c0-.1-.1.1.7 1.3z' transform='scale(.92) translate(.6 .6)'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M14.7 1.3c.6-.6 0-1.6-.8-1.4L1.4 4.2c-.8.2-.9 1.3-.1 1.6l4.9 1.9 1.9 4.9c.3.8 1.4.7 1.6-.1l4.3-12.5c0-.1-.1.1.7 1.3z' transform='scale(.92) translate(.6 .6)'/%3E%3C/svg%3E") center/contain no-repeat;
  animation: au-icon-in 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
[data-theme="aurora-light"] .send-btn .ic-stop {
  width: 13px; height: 13px; border-radius: 3.5px;
  animation: au-icon-in 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@media (prefers-reduced-motion: reduce) {
  [data-theme="aurora-light"] .send-btn .ic-play,
  [data-theme="aurora-light"] .send-btn .ic-stop { animation: none; }
}
[data-theme="aurora-light"] .mp-trigger,
[data-theme="aurora-light"] .mt-folder .dock-hd { background: #ffffff; }
[data-theme="aurora-light"] ul.conv-list li.active,
[data-theme="aurora-light"] ul.conv-list li.in-panel { background: #ffffff; box-shadow: 0 1px 3px rgba(40,60,30,0.10); }
@media (min-width: 769px) and (hover: hover), (min-width: 769px) and (pointer: fine) {
  [data-theme="aurora-light"] .sidebar-rail,
  [data-theme="aurora-light"] aside {
    backdrop-filter: none;
    border-color: rgba(60,80,40,0.07);
    box-shadow: var(--au-lift);
  }
  [data-theme="aurora-light"] main { background: var(--sp-surface); border-color: rgba(60,80,40,0.07); box-shadow: var(--au-lift); }
  [data-theme="aurora-light"] .au-search,
  [data-theme="aurora-light"] #railSearchBtn { background: #ffffff; }
}

/* ═══════════════════════════════════════════════════════════════════════
   RAIL conversation layout — shared by olive, light and aurora.

   The idea: one continuous 2px rail down the left of a turn, its TONE
   changing per role — accent for your query, a hairline for machinery, a
   mid tone for the reply. Blocks butt together (margin:0, space from
   internal padding) so the line never breaks; a new turn simply leaves a
   gap in the rail, and that gap IS the separator. The only warm point on
   the rail is whatever is running right now.

   Colours come from the theme tokens via color-mix, so each palette carries
   the layout. Width: --sp-chat-max-w (the Appearance slider) stays the sole
   authority, as in every other theme -- no ch caps anywhere.

   These were four copy-pasted blocks until 2026-11; what differs per theme
   (rail tints, paragraph rhythm, heading weights) follows right after, in
   olive's block here and in the LIGHT block further down.
   ═══════════════════════════════════════════════════════════════════════ */
/* --- one left edge for every role: no align-self, no per-role width ---
   Child combinators only: .msg.tool-call lives nested inside .tg-log and
   must keep its own styling. */
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .conv-host > .msg,
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) #messages > .msg,
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) #messagesSide > .msg {
  align-self: stretch; width: auto; max-width: none; min-width: 0;
  /* 0.3rem of side margin on every block. Left/right only -- the vertical
     margins stay 0 so the rail is still one unbroken line, and so the
     later rules that own margin-top (the turn separator) still win.
     It cannot live on .conv-host: that element's padding-inline is the
     chat-width cap, so adding to it fights the width setting. */
  margin: 0 0.3rem;
  border: 0; border-radius: 0;
  padding: 3px 0 3px var(--sprail-gut);        /* space comes from inside */
  background: none;
  transition: border-color 0.14s ease;
}
/* the host's own flex gap would reopen the breaks the margins just lost */
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .conv-host { gap: 0; }
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .conv-host > .msg.user:first-child { margin-top: 0; }
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .msg.user::before { display: none; }
   /* offset ghost */
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .msg.user .bubble {
  background: none; color: var(--sp-text); padding: 0; clip-path: none;
  box-shadow: none; border-radius: 0; font-weight: 400;
  font: 12px/1.5 var(--sprail-mono); white-space: pre-wrap;
  font-style: italic;
}
/* --- machinery: the two-storey card collapses to one line. The title row
   and the tray share a baseline, the DRAM strip goes, the count stays. --- */
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .conv-host > .msg.tool-group,
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) #messages > .msg.tool-group,
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) #messagesSide > .msg.tool-group {
  border-left-color: var(--sprail-ops);
  padding-top: 2px; padding-bottom: 2px;
  /* shrink-wrap, never a fixed cap: the count stays beside its title at any
     configured chat width, and the group still cannot exceed the column. */
  width: fit-content; max-width: 100%;
  overflow: visible;
  font: 11px/1.65 var(--sprail-mono);
}
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .tool-group .tg-hd {
  flex-direction: row; align-items: baseline; border-bottom: 0; gap: 0.6ch;
}
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .tool-group .tg-row { padding: 0; gap: 0.6ch; color: var(--sp-text-dim); flex: 1 1 auto; }
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .tool-group .tg-hd:hover .tg-row { background: none; color: var(--sp-text); }
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .tool-group .tg-prompt { display: none; }
   /* the bar is the prompt now */
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .tool-group .tg-title { color: inherit; }
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .tool-group .tg-tray { background: none; padding: 0; flex: none; gap: 0.5ch; }
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .tool-group .tg-strip { display: none; }
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .tool-group .tg-count {
  font-size: 10px; color: var(--sprail-count); font-variant-numeric: tabular-nums;
}
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .tool-group:has(.tg-cell.run) .tg-row { color: var(--sp-text); }
/* expanded call log keeps its own indent under the collapsed header */
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .tool-group .tg-log { padding: 0.15rem 0 0; }
/* Shared rail typography: Light mode's compact heading hierarchy and
   comfortable prose rhythm apply to both supported theme modes. Palette and
   text color remain in the per-theme blocks below. */
:is(html[data-theme="aurora"], html[data-theme="aurora-light"]) .msg.assistant p { margin: 0 0 0.68em; }
:is(html[data-theme="aurora"], html[data-theme="aurora-light"]) .msg.assistant li { margin: 0.3em 0; }
/* Bold lead-ins stay scannable without turning dense replies speckled. */
:is(html[data-theme="aurora"], html[data-theme="aurora-light"]) .msg.assistant strong,
:is(html[data-theme="aurora"], html[data-theme="aurora-light"]) .msg.assistant b { font-weight: 500; }
:is(html[data-theme="aurora"], html[data-theme="aurora-light"]) .msg.assistant h2,
:is(html[data-theme="aurora"], html[data-theme="aurora-light"]) .msg.assistant h3 {
  margin: 1.65em 0 0.5em; line-height: 1.25;
  font-weight: 600; letter-spacing: -0.02em;
}
:is(html[data-theme="aurora"], html[data-theme="aurora-light"]) .msg.assistant h2 { font-size: 1.16rem; }
:is(html[data-theme="aurora"], html[data-theme="aurora-light"]) .msg.assistant h3 { font-size: 1.02rem; }
:is(html[data-theme="aurora"], html[data-theme="aurora-light"]) .msg.assistant > .bubble > h2:first-child,
:is(html[data-theme="aurora"], html[data-theme="aurora-light"]) .msg.assistant > .bubble > h3:first-child { margin-top: 0.25em; }
:is(html[data-theme="aurora"], html[data-theme="aurora-light"]) .msg.assistant ul { margin: 0.3em 0 0.62em; padding-left: 1.12em; }
:is(html[data-theme="aurora"], html[data-theme="aurora-light"]) .msg.assistant > .bubble > :last-child { margin-bottom: 0; }
/* --- thinking blocks sit on the rail too, or the line breaks around them --- */
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .conv-host > .msg.think,
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) #messages > .msg.think,
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) #messagesSide > .msg.think {
  border-left-color: var(--sprail-ops);
  padding-top: 2px; padding-bottom: 2px;
  font-size: 11.5px;
}
/* --- the settled timer reads as the rail's footnote --- */
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .msg-timer { font-size: 10.5px; }

/* Rail layout — olive and aurora. */
:is(html[data-theme="olive"], html[data-theme="aurora"]) {
  /* NB: --rail-* is already taken by the icon rail; these are --sprail-*. */
  --sprail-w: 2px;
  --sprail-gut: 11px;
  --sprail-ground: color-mix(in srgb, var(--sp-text) 4%, transparent);
  --sprail-ops:    color-mix(in srgb, var(--sp-text) 14%, transparent);
  --sprail-out:    color-mix(in srgb, var(--sp-text) 26%, transparent);
  --sprail-hot:    color-mix(in srgb, var(--sp-text) 42%, transparent);
  --sprail-count:  color-mix(in srgb, var(--sp-text-dim) 55%, transparent);
  --sprail-chip:   color-mix(in srgb, var(--sp-text) 7%, transparent);
  /* same stack the tool-group header already uses */
  --sprail-mono: 'JetBrains Mono', 'Space Mono', ui-monospace, monospace;
}
/* --- your query: head of the rail. Full text, never compressed. --- */
:is(html[data-theme="olive"], html[data-theme="aurora"]) .conv-host > .msg.user,
:is(html[data-theme="olive"], html[data-theme="aurora"]) #messages > .msg.user,
:is(html[data-theme="olive"], html[data-theme="aurora"]) #messagesSide > .msg.user {
  border-left-color: var(--sprail-ops);
  background: none;
  padding: 2rem 10px 2rem var(--sprail-gut);
  margin-top: 40px;            /* the gap in the rail = the turn separator */
}
/* --- the reply: the only sans, and the only thing at reading size --- */
:is(html[data-theme="olive"], html[data-theme="aurora"]) .conv-host > .msg.assistant,
:is(html[data-theme="olive"], html[data-theme="aurora"]) #messages > .msg.assistant,
:is(html[data-theme="olive"], html[data-theme="aurora"]) #messagesSide > .msg.assistant {
  border-left-color: var(--sp-accent);
  padding-right: 0.5rem;
  padding-top: 2rem; padding-bottom: 2rem;
  margin-bottom: 14px;         /* separation after the reply */
  font-size: 15px; line-height: 1.6;
}
/* --- the rail answers the cursor --- */
:is(html[data-theme="olive"], html[data-theme="aurora"]) .conv-host > .msg.tool-group:hover,
:is(html[data-theme="olive"], html[data-theme="aurora"]) #messages > .msg.tool-group:hover,
:is(html[data-theme="olive"], html[data-theme="aurora"]) #messagesSide > .msg.tool-group:hover {
  border-left-color: var(--sprail-hot);
}
:is(html[data-theme="olive"], html[data-theme="aurora"]) .conv-host > .msg.assistant:hover,
:is(html[data-theme="olive"], html[data-theme="aurora"]) #messages > .msg.assistant:hover,
:is(html[data-theme="olive"], html[data-theme="aurora"]) #messagesSide > .msg.assistant:hover {
  border-left-color: color-mix(in srgb, var(--sp-accent) 70%, var(--sp-text));
}

/* ═══════════════════════════════════════════════════════════════════════
   RUNNING TOOL-GROUP — title shimmer.  ALL THEMES.

   A gradient sweeps across the letters of the running group's title, the
   way a skeleton loader does, but on real text: nothing is added to the
   DOM and nothing changes size, so a long grind never twitches the
   layout. Indeterminate by design -- it says the job is alive and makes
   no claim about how far along it is.

   A live group is the one holding a .tg-cell.run (there is no .running
   class). On the rail-layout themes the cell strip is hidden, so this is their
   ONLY running indicator; elsewhere it runs alongside the existing
   pulsing cell.

   The gradient is built from theme tokens, so every palette carries it.
   ═══════════════════════════════════════════════════════════════════════ */
.tool-group:has(.tg-cell.run) .tg-title {
  background-image: linear-gradient(100deg,
    var(--sp-text-dim) 30%,
    var(--sp-text)     45%,
    var(--sp-accent)   50%,
    var(--sp-text)     55%,
    var(--sp-text-dim) 70%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  animation: tg-title-sweep 2.1s linear infinite;
}
@keyframes tg-title-sweep {
  from { background-position: 120% 0; }
  to   { background-position: -120% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .tool-group:has(.tg-cell.run) .tg-title {
    animation: none; background-image: none; color: var(--sp-text);
  }
}

/* ═══════════════════════════════════════════════════════════════════════
   RAIL conversation layout — light-only differences (the shared
   rules are in the RAIL block above).
   ═══════════════════════════════════════════════════════════════════════ */
:is(html[data-theme="light"], html[data-theme="aurora-light"]) {
  --sprail-w: 2px;
  --sprail-gut: 11px;
  /* The rail uses the theme's accent as published -- no deepening. */
  --sprail-key:    var(--sp-accent);
  --sprail-ground: color-mix(in srgb, var(--sp-text) 3%, transparent);
  --sprail-ops:    color-mix(in srgb, var(--sprail-key) 42%, transparent);
  --sprail-out:    color-mix(in srgb, var(--sp-text) 20%, transparent);
  --sprail-count:  color-mix(in srgb, var(--sp-text-dim) 70%, transparent);
  --sprail-chip:   color-mix(in srgb, var(--sp-text) 6%, transparent);
  --sprail-mono: 'JetBrains Mono', 'Space Mono', ui-monospace, monospace;
}
/* --- your query: head of the rail. Full text, never compressed. --- */
:is(html[data-theme="light"], html[data-theme="aurora-light"]) .conv-host > .msg.user,
:is(html[data-theme="light"], html[data-theme="aurora-light"]) #messages > .msg.user,
:is(html[data-theme="light"], html[data-theme="aurora-light"]) #messagesSide > .msg.user {
  /* Inverted: the ACCENT marks the answer, not the question -- and the
     tint follows it onto the reply. The query is a line of text on a
     rail; the answer is the thing with weight. */
  border-left-color: var(--sprail-out);
  background: none;
  padding: 2rem 10px 2rem var(--sprail-gut);
  margin-top: 40px;            /* the gap in the rail = the turn separator */
}
/* the one warm point on the rail: the group that is running right now.
   There is no .running class — a live group is the one holding a .tg-cell.run. */
:is(html[data-theme="light"], html[data-theme="aurora-light"]) .conv-host > .msg.tool-group:has(.tg-cell.run),
:is(html[data-theme="light"], html[data-theme="aurora-light"]) #messages > .msg.tool-group:has(.tg-cell.run),
:is(html[data-theme="light"], html[data-theme="aurora-light"]) #messagesSide > .msg.tool-group:has(.tg-cell.run) {
  border-left-color: color-mix(in srgb, var(--sp-accent) 60%, transparent);
}
/* --- the reply: the only sans, and the only thing at reading size --- */
:is(html[data-theme="light"], html[data-theme="aurora-light"]) .conv-host > .msg.assistant,
:is(html[data-theme="light"], html[data-theme="aurora-light"]) #messages > .msg.assistant,
:is(html[data-theme="light"], html[data-theme="aurora-light"]) #messagesSide > .msg.assistant {
  border-left-color: var(--sprail-key);

  padding-right: 0.5rem;   /* the tint needs air on the far side of the prose */
  padding-top: 2rem; padding-bottom: 2rem;
  margin-bottom: 14px;         /* separation after the reply */
  font-size: 15px; line-height: 1.6;
}
/* Only the light palettes' text-color treatment remains theme-scoped;
   font metrics and spacing are shared by both supported theme modes above. */
:is(html[data-theme="light"], html[data-theme="aurora-light"]) .msg.assistant strong,
:is(html[data-theme="light"], html[data-theme="aurora-light"]) .msg.assistant b { color: color-mix(in srgb, var(--sp-text) 82%, #000); }
:is(html[data-theme="light"], html[data-theme="aurora-light"]) .msg.assistant h2,
:is(html[data-theme="light"], html[data-theme="aurora-light"]) .msg.assistant h3 { color: color-mix(in srgb, var(--sp-text) 70%, #000); }

/* ═══════════════════════════════════════════════════════════════════════
   MESSAGE ACTIONS — a kebab, top-right, menu on click.  ALL THEMES.

   The toolbar used to render permanently under every reply: three icons on
   every turn, which over a long thread is more chrome than content. The
   buttons and their handlers are untouched (attachKebab in
   conversations.js) -- they just live inside a popover now, and the only
   thing on screen is a 3-dot mark that fades in while you are over the
   message.

   Anchored to the block's top-right corner. Note this is the one element
   in the conversation that uses a right-hand edge; everything else hangs
   off the left rail.
   ═══════════════════════════════════════════════════════════════════════ */
.msg { position: relative; }
.msg > .msg-kebab {
  position: absolute; top: 3px; right: 3px; z-index: 5;
  width: 22px; height: 22px; padding: 0; margin: 0; border: 0;
  /* a slight ground so the mark is findable once revealed: three dim dots
     alone on a busy reply were easy to miss. */
  background: color-mix(in srgb, var(--sp-text) 7%, transparent);
  border-radius: 5px; cursor: pointer;
  display: grid; place-items: center;
  color: color-mix(in srgb, var(--sp-text) 42%, transparent);
  opacity: 0; transition: opacity 0.13s ease, color 0.13s ease, background 0.13s ease;
}
.msg > .msg-kebab svg { width: 14px; height: 14px; display: block; fill: currentColor; }
.msg:hover > .msg-kebab,
.msg.kebab-open > .msg-kebab { opacity: 1; }
.msg > .msg-kebab:hover,
.msg.kebab-open > .msg-kebab {
  color: var(--sp-text);
  background: color-mix(in srgb, var(--sp-text) 15%, transparent);
}
.msg > .msg-kebab:focus-visible { opacity: 1; outline: 1px solid var(--sp-accent); outline-offset: 1px; }

/* the old strip becomes the menu: hidden until the kebab opens it. The
   !important is unfortunate but earned -- several themes set their own
   .msg-actions display/opacity and this has to win in all of them. */
.msg > .msg-actions {
  display: none !important;
  /* The legacy user-bubble rule pins this toolbar with bottom:-34px and
     left/right offsets of its own, and an absolutely positioned box with
     BOTH top and bottom set stretches between them -- so the menu has to
     null those out, not just set its own top. opacity/pointer-events are
     forced for the same reason: that rule hides the strip at opacity 0. */
  position: absolute; top: 28px; right: 3px !important; bottom: auto !important; left: auto !important;
  z-index: 6;
  flex-direction: column; align-items: stretch; gap: 2px;
  min-width: 34px; margin: 0; padding: 3px;
  background: var(--sp-surface);
  border: 1px solid var(--sp-border-bright);
  border-radius: 8px;
  box-shadow: 0 8px 26px rgba(0,0,0,0.38);
  opacity: 1 !important; transform: none !important; pointer-events: auto !important;
}
.msg.kebab-open > .msg-actions { display: flex !important; }
.msg.kebab-open > .msg-actions .act-copy {
  width: 100%; justify-content: flex-start;
  background: none; border: 0; border-radius: 5px;
}
.msg.kebab-open > .msg-actions .act-copy:hover {
  background: color-mix(in srgb, var(--sp-text) 10%, transparent);
  border: 0;
}
@media (prefers-reduced-motion: reduce) {
  .msg > .msg-kebab { transition: none; }
}

/* ── Artifact dock (drawer variant) ──────────────────────────────────────
   Collapsed = a chip in the timer row, right-aligned (the old project-chip
   spot). Open = a grid of 64px artifact cards dropping down between the
   timer slot and the composer, width-capped to line up with it. The items
   ARE the existing artifact cards (renderArtifact → buildArtifactCard),
   so thumbnails come from the same SandpieArtifactThumbs provider. */
.dock {
  margin-left: auto;   /* push the chip to the right edge of the timer row */
  display: inline-flex;
}
.dock-hd {
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 0.68rem; color: var(--sp-text-dim);
  padding: 1px 9px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--sp-border); white-space: nowrap;
  transition: border-color .15s, color .15s;
}
.dock-hd:hover { border-color: var(--sp-border-bright); color: var(--sp-text); }
.dock-hd .caret { font-size: 9px; opacity: .65; transition: transform .16s; }
.dock-slot.open .dock-hd .caret { transform: rotate(90deg); }
.dock-hd .n { color: var(--sp-text); font-variant-numeric: tabular-nums; }
/* drawer body: grid of artifact cards, drops down under the timer row */
.dock-body {
  max-height: 0; overflow: hidden;
  transition: max-height .22s cubic-bezier(.4,0,.2,1);
  padding-inline: max(1.5rem, calc((100% - var(--sp-chat-max-w)) / 2));
  /* flex:none is LOAD-BEARING: as a flex child of the pane it would otherwise
     be squeezed by flex-shrink when it expands (sliver under the sticky
     composer). With it, the drawer keeps its height and the transcript
     (conv-host, flex:1 1 auto + min-height:0) absorbs the push-up instead. */
  flex: none;
}
.dock-slot.open .dock-body { max-height: 420px; }
.dock-in {
  border: 1px solid color-mix(in srgb, var(--sp-text) 10%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--sp-bg) 82%, var(--sp-text) 4%);
  overflow: hidden; margin-bottom: 6px;
}
/* expanded content (all files / bundle cards) scrolls inside the drawer:
   the body keeps its 420px animation cap, the in-box scrolls beyond it */
.dock-slot.open .dock-in { max-height: 396px; overflow-y: auto; }
/* the reused file-bundle TABLE inside the dock: spans the grid, no outer
   chrome (.dock-in is the frame); rows keep their fb-row styling */
.dock-in .grid .file-bundle.dock-fb { grid-column: 1 / -1; margin-top: 0; border: none; border-radius: 8px; width: auto; }
/* in the dock the list is not a scroller of its own (the transcript's file-bundle caps it at
   340px): the dock scrolls as one, so the list uses all the room it has */
.dock-in .grid .file-bundle.dock-fb .fb-list { border-top: 1px solid var(--sp-border); max-height: none; overflow: visible; }
.dock-in .grid .file-bundle.dock-fb .fb-row { padding: 8px 11px; }
.dock-in .grid { width: 100%; min-width: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding: 11px; }
/* dock cards: compact filename pill (plain name, smaller) */
.dock-in .grid .artifact-card-body .ac-ft { left: 6px; bottom: 6px; max-width: calc(100% - 12px); }
.dock-in .grid .artifact-card-body .ac-sub { padding: 0 9px; font-size: 10px; }
/* artifact cards live inside the dock grid: neutralize the transcript card's
   outer margins so the grid controls spacing */
.dock-in .grid .artifact-wrap { margin-top: 0; align-self: stretch; max-width: 100%; }
.dock-in .grid .artifact-card-body { height: 100%; }
.dock-in .grid .ac-thumb { height: 64px; }
.dock-in .grid .artifact-compact { display: flex; align-items: center; }
.dock-in .grid .artifact-compact .artifact-card-body { flex: 1; }
.dock-more {
  grid-column: 1 / -1;
  font: 10.5px 'JetBrains Mono', Consolas, monospace; color: var(--sp-text-dim);
  padding: 4px 2px 0; cursor: pointer; text-align: center;
}
.dock-more:hover { color: var(--sp-text); }
/* the drawer's 0-files placeholder (chip always renders, even at 0 files) */

/* Last-round markers: accent border + notification dot on cards touched in the current round */
.artifact-wrap.dock-new {
  border-color: var(--sp-accent) !important;
}
.artifact-wrap.dock-new::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sp-accent);
  z-index: 2;
}
.dock-empty {
  grid-column: 1 / -1;
  text-align: center; padding: 16px 0 6px;
  font: 10.5px 'JetBrains Mono', Consolas, monospace;
  color: var(--sp-text-dim); letter-spacing: .06em;
}
@media (max-width: 767px) {
  .dock-in .grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .dock-body { transition: none; }
}
/* Mobile: the 1rem pin for .dock-body must come AFTER the base .dock-body rule
   (same specificity, later wins) - the pin inside the <=767px block near the top
   of the file loses the cascade to the desktop max() formula below. */
@media (max-width: 767px) {
  .dock-body { padding-inline: 1rem; }
}

/* ── The dock, C layout: the folder chip opens it; one header row (folder ▾ · tabs · count ·
   placement · close) above the active tab. Also hosted in the side column (.dock-side). ── */
.mt-folder .dock-hd .rot { display: inline-grid; overflow: hidden; vertical-align: bottom; }
.mt-folder .dock-hd .rot > span { grid-area: 1 / 1; white-space: nowrap; transition: transform .38s cubic-bezier(.4,0,.2,1), opacity .38s; }
.mt-folder .dock-hd .rot .fl { transform: translateY(100%); opacity: 0; color: var(--sp-accent); }
.mt-folder .dock-hd.flash .rot .nm { transform: translateY(-100%); opacity: 0; }
.mt-folder .dock-hd.flash .rot .fl { transform: translateY(0); opacity: 1; }
.mt-folder .dock-hd.open { border-color: var(--sp-accent); color: var(--sp-accent); }
@media (prefers-reduced-motion: reduce) { .mt-folder .dock-hd .rot > span { transition: none; } }
.dk-hd { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--sp-border); flex-wrap: nowrap; position: sticky; top: 0; z-index: 2; background: inherit; min-width: 0; }
.dock-in { background: color-mix(in srgb, var(--sp-bg) 82%, var(--sp-text) 4%); }
.dk-folder { display: inline-flex; align-items: center; gap: 6px; max-width: 30%; flex: 0 1 auto; min-width: 0; border: 1px solid var(--sp-border-bright, var(--sp-border)); border-radius: 7px; padding: 2px 8px; background: transparent; color: var(--sp-text); font: 11px 'JetBrains Mono', Consolas, monospace; cursor: pointer; }
.dk-folder .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-folder .car { color: var(--sp-text-dim); font-size: 9px; }
.dk-folder:hover, .dk-folder.open { border-color: var(--sp-accent); }
.dk-seg { display: inline-flex; flex: 0 1 auto; min-width: 0; border: 1px solid var(--sp-border-bright, var(--sp-border)); border-radius: 8px; overflow-x: auto; scrollbar-width: none; }
.dk-seg::-webkit-scrollbar { display: none; }
.dk-ic { flex: none; }
.dk-tab { border: 0; border-right: 1px solid var(--sp-border-bright, var(--sp-border)); background: transparent; color: var(--sp-text-dim); padding: 2px 9px; font: 11px 'JetBrains Mono', Consolas, monospace; cursor: pointer; white-space: nowrap; }
.dk-tab:last-child { border-right: 0; }
.dk-tab .c { margin-left: 5px; opacity: .8; }
.dk-tab:hover { color: var(--sp-text); }
.dk-tab.on { background: color-mix(in srgb, var(--sp-accent) 16%, transparent); color: var(--sp-accent); }
.dk-sp { flex: 1; }
.dk-count { font: 10.5px 'JetBrains Mono', Consolas, monospace; color: var(--sp-text-dim); white-space: nowrap; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: clip; }

.dk-ic { width: 26px; height: 22px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--sp-border-bright, var(--sp-border)); border-radius: 7px; background: transparent; color: var(--sp-text-dim); cursor: pointer; padding: 0; }
.dk-ic svg { width: 14px; height: 14px; }
.dk-ic:hover { border-color: var(--sp-accent); color: var(--sp-text); }
.dk-memo { padding: 22px 12px 24px; text-align: center; font: 11px 'JetBrains Mono', Consolas, monospace; color: var(--sp-text-dim); line-height: 1.7; }
.dk-memo .a { color: var(--sp-text); }
/* a narrow dock (side column, small panes): the tabs take their own row under the folder */
.dock-in { container-type: inline-size; }
.dk-folder { min-width: 5em; max-width: 45%; }
@container (max-width: 560px) {
  .dk-hd { flex-wrap: wrap; row-gap: 6px; }
  .dk-seg { order: 9; flex: 1 1 100%; }
  .dk-tab { flex: 1 1 auto; text-align: center; }
  .dk-count { display: inline; }
}
/* side column host */
.dock-side { height: 100%; display: flex; flex-direction: column; background: var(--sp-bg); }
.dock-side .dock-in { border: 0; border-radius: 0; margin: 0; height: 100%; display: flex; flex-direction: column; max-height: none; overflow: hidden; }
.dock-side .dk-body { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--sp-scrollbar-hover, rgba(150,149,139,.45)) transparent; }
.dock-side .dk-body::-webkit-scrollbar { width: 8px; }
.dock-side .dk-body::-webkit-scrollbar-thumb { background: var(--sp-scrollbar-hover, rgba(150,149,139,.45)); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
.dock-side .dk-body::-webkit-scrollbar-track { background: transparent; }
.dock-side .dock-in .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
/* ---- folder history (modules/folder-history.js): the desktop shadow layer's timeline ---- */
.fh-modal { width: min(760px, 94vw); max-height: 86vh; display: flex; flex-direction: column; }
.fh-h { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.fh-h .fh-name { color: var(--sp-accent); }
.fh-h .fh-status { font-size: 0.72rem; font-weight: 400; color: var(--sp-text-dim); white-space: nowrap; }
.fh-list { flex: 1 1 auto; min-height: 8rem; overflow: auto; border: 1px solid var(--sp-border); border-radius: 6px; font-size: 0.78rem; }
.fh-empty { padding: 1rem; color: var(--sp-text-dim); text-align: center; }
.fh-entry { border-bottom: 1px solid var(--sp-border); }
.fh-entry:last-child { border-bottom: 0; }
.fh-row { display: grid; grid-template-columns: auto auto 1fr auto auto; gap: 0.6rem; align-items: center; padding: 0.4rem 0.6rem; cursor: pointer; }
.fh-row:hover { background: var(--sp-surface); }
.fh-time { color: var(--sp-text-dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fh-tool { font-size: 0.68rem; padding: 0.05rem 0.4rem; border: 1px solid var(--sp-border); border-radius: 999px; color: var(--sp-text-dim); white-space: nowrap; }
.fh-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Consolas, monospace; font-size: 0.74rem; }
.fh-count { color: var(--sp-text-dim); white-space: nowrap; font-size: 0.72rem; }
.fh-changes { padding: 0.1rem 0.6rem 0.5rem 2.2rem; }
.fh-change { display: grid; grid-template-columns: 6.2rem 1fr auto auto; gap: 0.6rem; align-items: center; padding: 0.2rem 0; }
.fh-change .fh-op { font-size: 0.68rem; color: var(--sp-text-dim); }
.fh-change .fh-op[data-op="deleted"], .fh-change .fh-op[data-op="deleted-dir"] { color: var(--sp-danger); }
.fh-change .fh-op[data-op="new"], .fh-change .fh-op[data-op="mkdir"] { color: var(--sp-success); }
.fh-change .fh-op[data-op="conflict"] { color: var(--sp-warn, #e0a030); font-weight: 600; }
.fh-change .fh-path { font-family: ui-monospace, Consolas, monospace; font-size: 0.74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fh-change .fh-size { color: var(--sp-text-dim); font-size: 0.7rem; white-space: nowrap; }
.fh-change.fh-err { grid-template-columns: 1fr; color: var(--sp-danger); }
.fh-modal button.ghost.fh-rewind, .fh-modal button.ghost.fh-restore { padding: 0.15rem 0.55rem; font-size: 0.7rem; white-space: nowrap; }
.proj-panel .proj-item .proj-cfg { display: none; margin-left: auto; background: none; border: 0; color: var(--sp-text-dim); cursor: pointer; font-size: 0.85rem; padding: 0 0.2rem; line-height: 1; }
.proj-panel .proj-item:hover .proj-cfg, .proj-panel .proj-item.sel .proj-cfg { display: inline-block; }
.proj-panel .proj-item .proj-cfg:hover { color: var(--sp-text); }
.fh-modal { position: relative; }
.fh-modal button.ghost.fh-remove { color: var(--sp-danger); }
.fh-modal button.ghost.fh-remove:hover:not(:disabled) { border-color: var(--sp-danger); color: var(--sp-danger); }
.fh-confirm { position: absolute; inset: 0; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; border-radius: 10px; }
.fh-confirm-box { background: var(--sp-panel); border: 1px solid var(--sp-danger); border-radius: 10px; padding: 1rem 1.2rem; width: min(440px, 90%); font-size: 0.8rem; }
.fh-confirm-box p { margin: 0 0 0.6rem; color: var(--sp-text-dim); }
.fh-confirm-box ul { margin: 0 0 0.6rem; padding-left: 1.1rem; color: var(--sp-text-dim); max-height: 9rem; overflow: auto; }
.fh-confirm-box code { font-family: ui-monospace, Consolas, monospace; font-size: 0.72rem; }
.fh-confirm-box { border-color: var(--sp-border-bright); }
.fh-confirm-box button.ghost.fh-confirm-ok { color: var(--sp-text); border-color: var(--sp-accent); }
.fh-confirm-box button.ghost.fh-confirm-ok.fh-danger { color: var(--sp-danger); border-color: var(--sp-danger); }
.fh-confirm-box .share-modal-btns { margin-top: 0.6rem; }

.fh-change .fh-path.fh-link { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.fh-change .fh-path.fh-link:hover { color: var(--sp-accent); }
.file-viewer.fv-external .fv-header { border-bottom-color: var(--sp-accent); }

.proj-panel .proj-item.auto .nm { font-style: italic; }
/* A project on another PC / in a disconnected cloud: listed like its home card, not pickable. */
.proj-panel .proj-item.off { opacity: .45; cursor: default; }
.proj-panel .proj-item.off:hover { background: transparent; }

/* --- >>> lean: progress timeline (conversations.js lpProseEl / _tgBuild .lp-step) ---
   The model's progress notes (.lp-say) and the tool groups after them (.lp-step) sit on
   the conversation's spine. Flat siblings of .conv-host, so every theme's own .msg /
   .msg.tool-group rules still apply. The section that is running (the newest note,
   .lp-now, and the groups after it) glows on the spine in the accent colour until the
   turn ends; nothing folds after the turn.
   Rail themes (olive, light, aurora): every .msg draws a --sprail-w
   left border at the same x, so the timeline IS that spine; notes take the tool groups'
   rail colour (--sprail-ops). Classic dark (no spine): a 2px line is drawn instead.
   The glow is an accent strip (::before) over the spine on each running element, whose
   OPACITY pulses: a compositor-only animation, no restyle. Each element's --lp-d (set by
   conversations.js lpPhase) starts it at the page clock's phase, so a note and the groups
   after it pulse together. It used to animate an inherited custom property on .conv-host,
   which restyled the whole conversation every frame (the lean UI lag, 2026-11-10). */
@keyframes lp-glow-o { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .conv-host > .msg.lp-say {
  border-left-color: var(--sprail-ops);
}
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .conv-host > :is(.msg.lp-say.lp-now, .msg.lp-say.lp-now ~ .msg.tool-group.lp-step) {
  position: relative;
}
:is(html[data-theme="olive"], html[data-theme="light"], html[data-theme="aurora"], html[data-theme="aurora-light"]) .conv-host > :is(.msg.lp-say.lp-now, .msg.lp-say.lp-now ~ .msg.tool-group.lp-step)::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: calc(-1 * var(--sprail-w)); width: var(--sprail-w);
  background: var(--sp-accent); pointer-events: none; will-change: opacity;
  animation: lp-glow-o 1.8s ease-in-out infinite; animation-delay: var(--lp-d, 0s);
}
/* classic dark: no spine, so indent the work and draw one at the spine's width */
html:not([data-theme]) .conv-host > .msg.lp-say,
html:not([data-theme]) .conv-host > .msg.tool-group.lp-step { position: relative; margin-left: 1.2rem; overflow: visible; }
html:not([data-theme]) .conv-host > .msg.lp-say::after,
html:not([data-theme]) .conv-host > .msg.tool-group.lp-step::after {
  content: ''; position: absolute; left: calc(-0.7rem - 1px); top: -1rem; bottom: 0; width: 2px;
  background: color-mix(in srgb, var(--sp-text-dim) 38%, var(--sp-bg)); pointer-events: none;
}
html:not([data-theme]) .conv-host > :is(.msg.lp-say.lp-now, .msg.lp-say.lp-now ~ .msg.tool-group.lp-step)::before {
  content: ''; position: absolute; left: calc(-0.7rem - 1px); top: -1rem; bottom: 0; width: 2px;
  background: var(--sp-accent); pointer-events: none; will-change: opacity;
  animation: lp-glow-o 1.8s ease-in-out infinite; animation-delay: var(--lp-d, 0s);
}
html:not([data-theme]) .conv-host > .msg:not(.lp-say):not(.lp-step):not(.think) + :is(.msg.lp-say.lp-now, .msg.lp-say.lp-now ~ .msg.tool-group.lp-step)::before { top: 0.8em; }
html:not([data-theme]) .conv-host > .msg:not(.lp-say):not(.lp-step):not(.think) + .msg.lp-say::after,
html:not([data-theme]) .conv-host > .msg:not(.lp-say):not(.lp-step):not(.think) + .msg.tool-group.lp-step::after { top: 0.8em; }
/* a note appears whole when its round starts working, with the reply's pop-in (llPop) */
.msg.lp-say.lp-in > .bubble { opacity: 0; transform: translateY(0.5em); animation: llPop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1) forwards; }
.msg.lp-say { background: none; }
/* Typography: a note is an aside, quieter than the reply — a touch smaller, dimmer,
   a readable measure; the running note brightens. Sections breathe with space ABOVE each
   note (padding, so the spine stays unbroken) while a tool line hugs its own note. */
.msg.lp-say > .bubble {
  display: block; background: none; border: 0; padding: 0; margin: 0;
  font-size: 0.84rem; line-height: 1.55;
  color: color-mix(in srgb, var(--sp-text) 70%, var(--sp-bg));
}
.msg.lp-say > .bubble strong { font-weight: 600; color: color-mix(in srgb, var(--sp-text) 82%, var(--sp-bg)); }
.conv-host > .msg.lp-say.lp-now > .bubble { color: color-mix(in srgb, var(--sp-text) 88%, var(--sp-bg)); }
.conv-host > .msg.lp-say { padding-top: 0.9rem !important; padding-bottom: 0 !important; }
.conv-host > .msg.user + .msg.lp-say, .conv-host > .msg.think + .msg.lp-say { padding-top: 0.5rem !important; }
.conv-host > .msg.tool-group.lp-step { padding-top: 4px !important; }
.conv-host > .msg.tool-group.lp-step:has(+ .msg.assistant) { padding-bottom: 0.9rem !important; }
.msg.lp-say > .bubble > :first-child { margin-top: 0; }
.msg.lp-say > .bubble > :last-child { margin-bottom: 0; }
.msg.lp-say > .bubble p { margin: 0 0 0.3em; }
.msg.tool-group.lp-step:has(.msg.tool-call.in-flight) .tg-title {
  background: linear-gradient(90deg, var(--sp-text-dim) 0%, var(--sp-text-dim) 38%, var(--sp-text) 50%, var(--sp-text-dim) 62%, var(--sp-text-dim) 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: lp-sweep 2.2s linear infinite;
}
@keyframes lp-sweep { from { background-position: 100% 0; } to { background-position: -150% 0; } }
@media (prefers-reduced-motion: reduce) {
  .conv-host > :is(.msg.lp-say.lp-now, .msg.lp-say.lp-now ~ .msg.tool-group.lp-step)::before, .msg.lp-say.lp-in > .bubble, .msg.tool-group.lp-step:has(.msg.tool-call.in-flight) .tg-title { animation: none; opacity: 1; transform: none; }
}
/* lean: a dim ">" leads each tool line, so the machine's work reads apart from the notes
   at a glance. The group's own ">>>" prompt span (hidden by the rail themes) is shown as
   a single ">" (the span clipped to 1ch, so it keeps the line's font and baseline) in the [n] count colour. Lean only: the full harness keeps today's look. */
.conv-host > .msg.tool-group.lp-step .tg-prompt {
  display: inline-block !important; flex: none; width: 1ch; overflow: hidden; white-space: nowrap; vertical-align: baseline;
  font: inherit; font-weight: 400; color: var(--sprail-count, color-mix(in srgb, var(--sp-text-dim) 55%, transparent));
}


/* ── Unified search modal (modules/search-modal.js) ────────────────────
   Every source runs at once. Theme-agnostic base (--sp-* vars); aurora adds
   the glass panel + gradient ring from the approved merged-results mockup. */
#searchModal [hidden] { display: none !important; }
#searchModal .search-modal-content {
  max-width: 640px; width: 92%; max-height: 72vh;
  display: flex; flex-direction: column;
  padding: 0; overflow: hidden; border-radius: 18px;
}
.sm-srow { display: flex; align-items: center; gap: 11px; padding: 13px 14px 11px 18px; border-bottom: 1px solid var(--sp-border); }
.sm-srow .sm-mag { width: 19px; height: 19px; flex: none; color: var(--sp-accent-2); }
#searchModal .sm-srow input {
  flex: 1; min-width: 0; width: auto; padding: 0; border: 0; background: transparent;
  outline: none; box-shadow: none; color: var(--sp-text); font-size: 16px; font-weight: 500; font-family: inherit;
}
#searchModal .sm-srow input::placeholder { color: var(--sp-text-dim); }
.sm-empty { min-height: 126px; display: flex; justify-content: center; align-items: center; padding: 25px 20px 33px; color: var(--sp-text-dim); font-size: 13px; text-align: center; }
.sm-results { flex: 1; min-height: 0; max-height: 56vh; overflow-y: auto; padding: 1px 8px 13px; scroll-padding: 7px; scrollbar-width: thin; scrollbar-color: var(--sp-border-bright) transparent; }
.sm-group { display: flex; align-items: center; gap: 7px; min-height: 32px; padding: 12px 10px 6px; font-size: 12px; font-weight: 650; color: var(--sp-text-dim); }
.sm-group::after { content: ''; order: 3; flex: 1; height: 1px; background: var(--sp-border); margin-left: 3px; }
.sm-group-state { display: flex; align-items: center; gap: 6px; order: 4; color: var(--sp-text-dim); font-size: 10.5px; font-weight: 450; white-space: nowrap; }
.sm-spinner { display: inline-block; width: 11px; height: 11px; flex: none; border: 1.5px solid var(--sp-accent-dim); border-top-color: var(--sp-accent); border-radius: 50%; animation: sm-spin .85s linear infinite; }
@keyframes sm-spin { to { transform: rotate(360deg); } }
.sm-item { display: flex; align-items: center; gap: 11px; min-height: 42px; padding: 7px 10px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; position: relative; }
.sm-item:hover { background: var(--sp-panel); }
.sm-item.sel { background: var(--sp-panel); border-color: color-mix(in srgb, var(--sp-accent) 25%, transparent); }
.sm-main { flex: 1; min-width: 0; }
.sm-title { font-size: 13.5px; font-weight: 500; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-sub { font-size: 11.5px; line-height: 1.55; color: var(--sp-text-dim); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-item[data-kind="chats"] .sm-sub { padding-left: 9px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; }
.sm-title mark, .sm-sub mark { background: none; color: var(--sp-accent); font-weight: 650; }
.sm-summary { color: var(--sp-text-dim); font-weight: 650; margin-right: .3em; }
.sm-filetype { width: 34px; height: 34px; flex: none; border-radius: 9px; display: flex; align-items: center; justify-content: center; font: 700 8.5px 'JetBrains Mono', Consolas, monospace; letter-spacing: .04em; color: var(--sp-accent); border: 1px solid var(--sp-border-bright); background: var(--sp-panel); }
.sm-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:is([data-theme="aurora"], [data-theme="aurora-light"]) #searchModal .modal-content {
  background: var(--au-glass, transparent);
  backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 30px 60px -30px var(--sp-bg), inset 0 1px 0 var(--sp-border);
}
:is([data-theme="aurora"], [data-theme="aurora-light"]) #searchModal .sm-item:hover,
:is([data-theme="aurora"], [data-theme="aurora-light"]) #searchModal .sm-item.sel { background: var(--au-glass-2, var(--sp-panel)); }
:is([data-theme="aurora"], [data-theme="aurora-light"]) #searchModal .modal-content::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(120deg, color-mix(in srgb, var(--sp-accent-2) 55%, transparent), color-mix(in srgb, var(--sp-accent) 35%, transparent) 40%, var(--sp-border));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
@media (max-width: 620px) {
  #searchModal .search-modal-content { width: calc(100% - 24px); border-radius: 15px; }
  .sm-results { max-height: 64vh; }
  .sm-srow { padding-left: 14px; }
  .sm-item { padding-left: 8px; padding-right: 8px; }
  .sm-title { font-size: 13px; }
  .sm-sub { font-size: 11px; }
}
/* B2: label rails and balanced asynchronous previews (2 chats, 1 other result). */
.sm-results { max-height: 60vh; padding: 4px 16px 18px; scroll-padding: 10px; }
.sm-section { display: grid; grid-template-columns: 96px minmax(0, 1fr); column-gap: 12px; padding: 22px 0 20px; }
.sm-section:first-child { padding-top: 16px; }
.sm-section:last-child { padding-bottom: 6px; }
.sm-section + .sm-section { border-top: 1px solid var(--sp-border); }
.sm-group { min-height: 18px; padding: 10px 0 0; color: var(--sp-accent); font-size: 10px; font-weight: 700; letter-spacing: .15em; line-height: 1.6; text-transform: uppercase; }
.sm-group { align-self: start; flex-wrap: wrap; align-content: flex-start; }
.sm-group::after { display: none; }
.sm-group-state { width: 100%; min-height: 14px; margin-left: 0; font-size: 10px; font-weight: 500; letter-spacing: 0; text-transform: none; order: initial; }
.sm-rows { grid-column: 2; min-width: 0; }
.sm-item { min-height: 44px; margin-bottom: 4px; padding: 7px 8px; border-radius: 8px; gap: 10px; background: none; }
.sm-title { font-size: 13.5px; line-height: 1.5; color: var(--sp-text); }
.sm-sub { margin-top: 2px; line-height: 1.55; }
.sm-item[data-kind="chats"] .sm-sub { padding-left: 0; -webkit-line-clamp: 1; }
.sm-filetype { width: 30px; height: 30px; border-radius: 8px; }
.sm-more { grid-column: 2; justify-self: start; width: max-content; max-width: 100%; margin: 2px 0 0; padding: 5px 8px; border: 0; border-radius: 5px; background: none; color: var(--sp-text-dim); font: inherit; font-size: 11px; line-height: 1.4; cursor: pointer; text-align: left; }
.sm-more:hover { background: none; color: var(--sp-accent); }
.sm-more:focus-visible { outline: 2px solid var(--sp-accent); outline-offset: 2px; }
@media (max-width: 620px) {
  .sm-results { max-height: 65vh; padding: 2px 14px 14px; }
  .sm-section { grid-template-columns: 70px minmax(0, 1fr); column-gap: 4px; padding: 19px 0 16px; }
  .sm-group { font-size: 9px; letter-spacing: .1em; }
  .sm-group-state { font-size: 9px; }
  .sm-item { padding: 7px 6px; }
  .sm-more { margin-left: 0; padding-left: 6px; }
}

/* Conversation last-activity date in search results. */
.sm-heading { display: flex; align-items: baseline; gap: 14px; min-width: 0; }
.sm-heading .sm-title { flex: 1; min-width: 0; }
.sm-date { flex: none; margin-left: auto; color: var(--sp-text-dim); font-family: var(--sp-font-mono); font-size: 10.5px; font-variant-numeric: tabular-nums; font-weight: 400; line-height: 1.5; white-space: nowrap; }
.sm-item.sel .sm-date { color: var(--sp-text); }
@media (max-width: 620px) { .sm-heading { gap: 8px; } .sm-date { font-size: 9.5px; } }

@media (prefers-reduced-motion: reduce) { .sm-spinner { animation-duration: 1.8s; } }

/* ── Files: search-native recent timeline (approved concept A) ─────────── */
#filesModal { padding: 50px 20px 24px; }
#filesModal [hidden] { display: none !important; }
#filesModal .fm-panel {
  position: relative; width: min(720px, 96vw); height: min(650px, calc(100vh - 100px));
  max-height: none; border-radius: 18px; background: var(--sp-bg);
  box-shadow: 0 30px 70px -24px rgba(0,0,0,.66), inset 0 1px 0 var(--sp-border);
}
#filesModal.fm-is-classic .fm-panel { width: min(860px, 94vw); height: min(650px, 90vh); }
:is([data-theme="aurora"], [data-theme="aurora-light"]) #filesModal .fm-panel {
  background: var(--au-glass, var(--sp-bg)); backdrop-filter: blur(24px) saturate(140%);
}
:is([data-theme="aurora"], [data-theme="aurora-light"]) #filesModal .fm-panel::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 5;
  background: linear-gradient(120deg, color-mix(in srgb, var(--sp-accent-2) 55%, transparent), color-mix(in srgb, var(--sp-accent) 35%, transparent) 40%, var(--sp-border));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
.fm-recent-view, .fm-classic-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#filesModal .fm-searchrow { flex: none; min-height: 58px; padding: 10px 15px 10px 19px; }
#filesModal .fm-searchrow input {
  flex: 1; min-width: 0; width: auto; padding: 5px 0; border: 0; background: transparent;
  outline: none; box-shadow: none; color: var(--sp-text); font-family: inherit; font-size: 16px; font-weight: 500;
}
#filesModal .fm-searchrow input::placeholder { color: var(--sp-text-dim); }
.fm-viewlabel { flex: none; color: var(--sp-text-dim); font-size: 10px; white-space: nowrap; }
#filesModal .fm-close-btn {
  flex: none; width: 30px; height: 30px; margin-left: 2px; padding: 0; border: 0; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center; background: none; color: var(--sp-text-dim); font-size: 18px; line-height: 1; cursor: pointer;
}
#filesModal .fm-close-btn:hover { background: var(--sp-panel); color: var(--sp-text); }
.fm-filterbar {
  flex: none; min-height: 49px; padding: 9px 17px; border-bottom: 1px solid var(--sp-border);
  display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none;
}
.fm-filterbar::-webkit-scrollbar { display: none; }
.fm-chip {
  flex: none; height: 27px; padding: 0 10px; border: 1px solid var(--sp-border); border-radius: 7px;
  display: inline-flex; align-items: center; gap: 6px; background: none; color: var(--sp-text-dim); font: inherit; font-size: 11px; cursor: pointer;
}
.fm-chip:hover { background: var(--sp-panel); color: var(--sp-text); }
.fm-chip.active { color: var(--sp-accent); background: var(--sp-accent-dim); border-color: color-mix(in srgb, var(--sp-accent) 35%, transparent); }
.fm-chip-count { font-size: 9px; opacity: .72; }
.fm-filter-sp { flex: 1; min-width: 4px; }
.fm-classic-btn {
  flex: none; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 5px 0 5px 8px; border: 0; background: none; color: var(--sp-text-dim); font: inherit; font-size: 11px; cursor: pointer;
}
.fm-classic-btn:hover { color: var(--sp-accent); }
.fm-classic-btn svg { width: 14px; height: 14px; }
#filesModal .fm-results { flex: 1; min-height: 0; max-height: none; padding: 4px 17px 16px; }
.fm-time-section { display: grid; grid-template-columns: 91px minmax(0, 1fr); column-gap: 14px; padding: 18px 0 17px; }
.fm-time-section:first-child { padding-top: 14px; }
.fm-time-section + .fm-time-section { border-top: 1px solid var(--sp-border); }
.fm-time-label { align-self: start; padding-top: 8px; color: var(--sp-accent); font-size: 10px; font-weight: 700; line-height: 1.55; letter-spacing: .14em; text-transform: uppercase; }
.fm-time-label > span { display: block; margin-top: 4px; color: var(--sp-text-dim); font-size: 9px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.fm-file-rows { grid-column: 2; min-width: 0; }
.fm-file-row {
  position: relative; width: 100%; min-height: 48px; margin-bottom: 3px; padding: 7px 9px;
  display: flex; align-items: center; gap: 11px; border: 1px solid transparent; border-radius: 9px;
  background: none; color: var(--sp-text); text-align: left; cursor: pointer;
}
.fm-file-row:hover, .fm-file-row.sel { background: var(--sp-panel); }
.fm-file-row.sel { border-color: color-mix(in srgb, var(--sp-accent) 28%, transparent); }
:is([data-theme="aurora"], [data-theme="aurora-light"]) #filesModal .fm-file-row:hover,
:is([data-theme="aurora"], [data-theme="aurora-light"]) #filesModal .fm-file-row.sel { background: var(--au-glass-2, var(--sp-panel)); }
.fm-type-badge {
  width: 31px; height: 31px; flex: none; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: var(--sp-accent); border: 1px solid var(--sp-border-bright); background: var(--sp-panel);
  font: 700 8px 'JetBrains Mono', Consolas, monospace; letter-spacing: .02em;
}
.fm-file-main { flex: 1; min-width: 0; }
.fm-file-title, .fm-file-path { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-file-title { font-size: 13px; font-weight: 500; line-height: 1.45; }
.fm-file-path { margin-top: 3px; color: var(--sp-text-dim); font-size: 10.5px; line-height: 1.4; }
.fm-file-title mark, .fm-file-path mark { background: none; color: var(--sp-accent); font-weight: 700; }
.fm-file-time { flex: none; align-self: center; text-align: right; color: var(--sp-text-dim); font: 10px 'JetBrains Mono', Consolas, monospace; }
.fm-file-size { display: block; margin-top: 5px; font-size: 9px; opacity: .75; }
.fm-more {
  grid-column: 2; justify-self: start; margin: 2px 0 0; padding: 5px 8px; border: 0; border-radius: 6px;
  background: none; color: var(--sp-text-dim); font: inherit; font-size: 10.5px; cursor: pointer;
}
.fm-more:hover { background: var(--sp-panel); color: var(--sp-accent); }
.fm-recent-foot {
  flex: none; min-height: 43px; padding: 8px 17px; border-top: 1px solid var(--sp-border);
  display: flex; align-items: center; gap: 11px; background: color-mix(in srgb, var(--sp-surface) 50%, transparent); color: var(--sp-text-dim); font-size: 10.5px;
}
.fm-recent-foot .fm-sp { flex: 1; }
.fm-empty { min-height: 190px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 9px; text-align: center; color: var(--sp-text-dim); font-size: 12px; }
.fm-empty strong { color: var(--sp-text); font-size: 13px; font-weight: 550; }
.fm-empty button { padding: 6px; border: 0; background: none; color: var(--sp-accent); font: inherit; font-size: 11px; cursor: pointer; }
.files-modal .fm-back-recent {
  flex: none; margin: -4px 0; padding: 4px 6px; border: 0; border-radius: 6px;
  display: inline-flex; align-items: center; gap: 6px; background: none; color: var(--sp-text-dim);
  font: inherit; font-size: 12px; line-height: 24px; white-space: nowrap; cursor: pointer;
}
.files-modal .fm-back-recent .material-symbols-outlined { font-size: 17px; }
.files-modal .fm-back-recent:hover { background: var(--sp-panel); color: var(--sp-accent); }
.fm-chip:focus-visible, .fm-classic-btn:focus-visible, .fm-more:focus-visible, .fm-recent-foot button:focus-visible, .fm-back-recent:focus-visible, #filesModal .fm-close-btn:focus-visible { outline: 2px solid var(--sp-accent); outline-offset: 2px; }
#filesModal .fm-title .fm-close-btn { margin-left: auto; }
@media (max-width: 620px) {
  #filesModal { padding: 12px; }
  #filesModal .fm-panel, #filesModal.fm-is-classic .fm-panel { width: 100%; height: calc(100vh - 24px); border-radius: 15px; }
  #filesModal .fm-searchrow { padding-left: 14px; }
  .fm-filterbar { padding-left: 11px; padding-right: 11px; }
  #filesModal .fm-results { padding-left: 11px; padding-right: 11px; }
  .fm-time-section { grid-template-columns: 61px minmax(0, 1fr); column-gap: 7px; }
  .fm-time-label { font-size: 9px; letter-spacing: .09em; }
  .fm-file-row { gap: 8px; padding-left: 6px; padding-right: 6px; }
  .fm-file-time { font-size: 8px; }
  .fm-file-size { display: none; }
  .files-modal .fm-title { gap: 6px; padding-left: 10px; padding-right: 10px; }
  .files-modal .fm-back-recent { padding-left: 4px; padding-right: 4px; font-size: 11px; }
  .fm-recent-foot { padding-left: 12px; padding-right: 12px; }
}

/* Branch experiment: softer rounded user turns in Dark / Light only.
   Restores the Olive Bold silhouette without its high-contrast semibold slab.
   Assistant replies, tools, and the other themes keep their current treatment. */
:is(html[data-theme="aurora"], html[data-theme="aurora-light"]) :is(.conv-host, #messages, #messagesSide) > .msg.user {
  align-self: flex-end;
  max-width: 82%;
  margin: 1rem 0.25rem 0.35rem;
  padding: 0;
  border: 0;
  background: transparent;
}
:is(html[data-theme="aurora"], html[data-theme="aurora-light"]) :is(.conv-host, #messages, #messagesSide) > .msg.user:first-child { margin-top: 0; }
:is(html[data-theme="aurora"], html[data-theme="aurora-light"]) :is(.conv-host, #messages, #messagesSide) > .msg.user::before { display: none; }
:is(html[data-theme="aurora"], html[data-theme="aurora-light"]) :is(.conv-host, #messages, #messagesSide) > .msg.user > .bubble {
  display: block;
  padding: 0.9rem 1.2rem;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 18px 18px 6px 18px;
  background: #30342e;
  color: var(--sp-text);
  box-shadow: 0 4px 14px rgba(0,0,0,0.20);
  font: 500 14px/1.5 -apple-system, system-ui, 'Segoe UI', sans-serif;
  clip-path: none;
  transition: transform 0.2s;
}
html[data-theme="aurora-light"] :is(.conv-host, #messages, #messagesSide) > .msg.user > .bubble {
  background: #e4e9de;
  border-color: rgba(60,80,40,0.10);
  box-shadow: 0 4px 14px rgba(40,55,30,0.10);
}
@media (max-width: 768px) {
  :is(html[data-theme="aurora"], html[data-theme="aurora-light"]) :is(.conv-host, #messages, #messagesSide) > .msg.user { max-width: 91%; }
}
@media (prefers-reduced-motion: reduce) {
  :is(html[data-theme="aurora"], html[data-theme="aurora-light"]) :is(.conv-host, #messages, #messagesSide) > .msg.user > .bubble { transition: none; }
}
/* Branch: Live Bubble generation anatomy.
   It reuses the real trajectory and source log. The generous sans-serif
   reading size and typing indicator borrow from everyday messaging; all surfaces,
   type and motion use the theme rather than introducing another visual system. */
.gen-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.gen-activity-source[hidden], .gen-activity[hidden], .gen-activity-body[hidden], .gen-wait[hidden] { display: none !important; }
html[data-gen-chat="live-bubble"][data-theme="aurora"],
html[data-gen-chat="live-bubble"][data-theme="aurora-light"] { --gen-gutter: 16px; }
:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .conv-host > .msg.assistant.gen-anchored {
  align-self: flex-start; position: relative;
  margin: 14px 6px 24px 0px; padding: 15px 18px;
  border-radius: 19px 19px 19px 7px;
  color: var(--sp-text);

  font: 15px/1.6 var(--au-font); overflow: visible;
  animation: gen-anchor-arrive 180ms ease-out;
}

:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .conv-host > .msg.assistant.gen-anchored > .bubble {
  display: block; position: relative; z-index: 1;
}
:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .conv-host > .msg.gen-activity {
  align-self: flex-start; position: relative;
  width: min(650px, calc(100% - var(--gen-gutter) - 12px)); max-width: calc(100% - var(--gen-gutter) - 12px);
  margin: 14px 6px 6px var(--gen-gutter); padding: 0 15px;
  border: 1px solid var(--sp-border); border-radius: 13px;
  background: var(--sp-panel); color: var(--sp-text-dim);
  font: 11px/1.5 var(--sp-font); overflow: hidden;
}
:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .gen-activity-toggle {
  display: flex; width: 100%; min-height: 40px; align-items: center; gap: 9px;
  padding: 0; border: 0; border-radius: 6px; background: transparent; color: inherit;
  font: inherit; text-align: left; cursor: pointer;
}
:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .gen-activity-toggle:focus-visible { outline: 2px solid var(--sp-accent); outline-offset: 2px; }
.gen-activity:not(.is-expanded) { cursor: pointer; }
.gen-activity:hover .gen-activity-label { color: var(--sp-accent); }
.gen-activity-signal { width: 6px; height: 6px; flex: 0 0 6px; border: 0; border-radius: 50%; background: var(--sp-accent); box-shadow: 0 0 0 3px var(--sp-accent-dim); animation: gen-signal 1.8s ease-in-out infinite; }
.gen-activity.is-done .gen-activity-signal, .gen-activity.has-answer .gen-activity-signal { background: var(--sp-border-bright); box-shadow: none; animation: none; }
.gen-activity-label { color: var(--sp-text); font-size: 12px; font-weight: 550; transition: color 150ms; }
.gen-activity-count { margin-left: 0; color: var(--sp-text-dim); white-space: nowrap; }
/* Height is animated explicitly from measured pixels in toggleActivity.
   A CSS height transition here conflicts with that animation on overflow changes. */
.gen-activity-body { max-height: 150px; padding: 2px 0 8px; overflow-y: hidden; overscroll-behavior: contain; scrollbar-width: none; }
.gen-activity-body::-webkit-scrollbar { width: 0; height: 0; display: none; }
.gen-activity.is-expanded .gen-activity-body { height: auto; max-height: none; overflow: visible; scrollbar-width: none; scrollbar-gutter: auto; }
.gen-activity.is-expanded .gen-activity-body::-webkit-scrollbar { display: none; width: 0; height: 0; }
.gen-activity.is-expanded .gen-activity-body::-webkit-scrollbar-thumb { background: var(--sp-border-bright); border-radius: 6px; }
.gen-activity.is-expanded .gen-activity-body.osb-host { scrollbar-width: none; scrollbar-gutter: auto; }
.gen-activity.is-expanded .gen-activity-body.osb-host::-webkit-scrollbar { display: none; }
.gen-activity .osb-rail.gen-activity-scrollbar { opacity: 1; pointer-events: auto; }
.gen-entry { position: relative; display: grid; grid-template-columns: minmax(0,1fr); align-items: center; min-height: 28px; padding: 5px 0; }
.gen-entry.is-new { animation: gen-entry-arrive 160ms cubic-bezier(0.2,0.72,0.25,1) both; }



.gen-entry-main { min-width: 0; }
.gen-entry-title { overflow: hidden; color: var(--sp-text-dim); font: 14px/1.5 var(--au-font); overflow-wrap: anywhere; }
.gen-entry.is-current .gen-entry-title { color: var(--sp-text); font-weight: 500; }
.gen-entry.is-virtual .gen-entry-title { color: var(--sp-accent); }
.gen-entry:nth-last-child(4):not(.is-virtual) { opacity: .85; }
.gen-entry:nth-last-child(5) { opacity: .62; }
.gen-entry-detail { grid-column: 1 / -1; min-width: 0; padding: 3px 0 9px; }
.gen-entry-detail-label { margin: 6px 0 4px; color: var(--sp-text-dim); font-size: 10px; }
.gen-entry-detail pre { max-width: 100%; margin: 0; padding: 8px 10px; overflow-x: auto; border: 0; border-radius: 7px; background: var(--sp-bg); color: var(--sp-text-dim); font: 10px/1.55 var(--sprail-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.gen-activity.is-expanded .gen-entry { align-items: start; min-height: 0; padding: 0; }
/* The trajectory must not extend into the separate typing row during settle animations. */
.gen-activity { overflow: hidden; }
/* Approved Quiet index history: row numbers provide orientation without
   arrows, labels, or extra borders. Results stay compact and wrap inline. */
.gen-entry-main, .gen-entry-toggle { display: flex; width: 100%; min-width: 0; align-items: center; }
.gen-activity.is-expanded .gen-entry-main, .gen-activity.is-expanded .gen-entry-toggle { min-height: 36px; gap: 13px; }
.gen-activity.is-expanded .gen-entry-main { padding: 0; }
.gen-entry-toggle { padding: 0; border: 0; background: transparent; color: var(--sp-text-dim); font: inherit; text-align: left; cursor: pointer; }
.gen-entry-index { flex: 0 0 25px; color: var(--sp-text-dim); font: 9px/1.5 var(--sprail-mono); letter-spacing: .03em; opacity: .72; transition: color .15s, opacity .15s; }
.gen-entry-index:empty { display: none; }
.gen-entry-main.is-static { cursor: text; }
.gen-entry-toggle > .gen-entry-title { flex: 1; min-width: 0; }
.gen-entry-toggle:hover, .gen-entry-toggle:focus-visible { color: var(--sp-text); }
.gen-entry-toggle:hover > .gen-entry-index, .gen-entry.is-open .gen-entry-index { color: var(--sp-accent); opacity: 1; }
.gen-entry.is-open .gen-entry-title { color: var(--sp-text); }
.gen-entry-toggle:focus-visible { outline: 1px solid var(--sp-accent); outline-offset: 4px; border-radius: 1px; }
.gen-entry-detail { margin-left: 38px; padding: 5px 0 17px; border: 0; color: var(--sp-text-dim); font: 10.5px/1.7 var(--sprail-mono); }
.gen-entry-detail[hidden] { display: none !important; }
.gen-entry-detail-label { display: block; margin: 0 0 3px; font: 9px/1.5 var(--sprail-mono); opacity: .72; }
.gen-entry-detail-label:not(:first-child) { margin-top: 11px; }
/* Expansion changes only the body's height and scrolling. Rows retain the
   approved collapsed 28px rhythm, fading, ellipsis and unnumbered titles. */
.gen-activity.is-expanded .gen-entry-index { display: none !important; }
.gen-activity.is-expanded .gen-entry,
.gen-activity.is-expanded .gen-entry:nth-last-child(4):not(.is-virtual),
.gen-activity.is-expanded .gen-entry:nth-last-child(5) { align-items: center; min-height: 28px; padding: 5px 0; }
.gen-activity.is-expanded .gen-entry:nth-last-child(4):not(.is-virtual) { opacity: .85; }
.gen-activity.is-expanded .gen-entry:nth-last-child(5) { opacity: .62; }
/* Expanded rows are the same compact rows, not a second visual mode. */
.gen-activity.is-expanded .gen-entry .gen-entry-main,
.gen-activity.is-expanded .gen-entry .gen-entry-toggle { min-height: 0; gap: 0; padding: 0; }
.gen-activity.is-expanded .gen-entry .gen-entry-title { overflow-wrap: anywhere; }
@media (max-width: 768px) {
  .gen-activity.is-expanded .gen-entry .gen-entry-main,
  .gen-activity.is-expanded .gen-entry .gen-entry-toggle { min-height: 0; gap: 0; }
}
.gen-activity.is-expanded .gen-entry-main,
.gen-activity.is-expanded .gen-entry-toggle { min-height: 0; gap: 0; padding: 0; }
.gen-activity.is-expanded .gen-entry-title { overflow-wrap: anywhere; }
.gen-activity.is-expanded .gen-entry-detail { margin-left: 0; }
@media (max-width: 768px) {
  .gen-activity.is-expanded .gen-entry-main,
  .gen-activity.is-expanded .gen-entry-toggle { min-height: 0; gap: 0; }
}
.gen-entry-detail pre { max-width: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.gen-entry.is-open .gen-entry-detail { border-bottom: 1px solid var(--sp-border); }
.gen-activity.is-expanded .gen-entry { align-items: center; opacity: 1; }

.gen-activity.is-expanded .gen-entry-detail pre { overflow-x: hidden; }.gen-activity.is-done:not(.is-expanded):not(.gen-stopped) .gen-activity-body { display: none; }
.gen-activity-arrow {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; flex: 0 0 18px; margin: 0;
  font-family: 'Material Symbols Outlined'; font-size: 18px; font-style: normal; font-weight: 400; line-height: 1; letter-spacing: normal;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}
.gen-activity-toggle .gen-activity-arrow { margin: 0; }
.gen-wait { display: flex; align-items: center; min-height: 24px; gap: 13px; }
.gen-dots { display: inline-flex; gap: 5px; align-items: center; color: var(--sp-accent); }
.gen-dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: gen-dot 1.2s ease-in-out infinite; }
.gen-dots i:nth-child(2) { animation-delay: 160ms; }
.gen-dots i:nth-child(3) { animation-delay: 320ms; }
  .gen-wait > .gen-stop-icon { display: none; align-items: center; font-size: 15px; line-height: 1; color: var(--sp-text-dim); }
  .gen-stopped > .gen-wait > .gen-stop-icon { display: inline-flex; }
.gen-wait-hint { color: var(--sp-text-dim); font: 11px/1.5 var(--sp-font); }
.conv-host > .msg.assistant.gen-anchored .msg-kebab { top: 8px; right: 8px; }

/* The kebab is for finished replies only: hide it on every assistant message
   in the chat except the Live Bubble response block, and even there only once
   the response is complete -- the anchor loses gen-awaiting when the answer
   lands or the turn settles, so a still-preparing block shows nothing. Hover
   reveal stays the base .msg:hover rule. */
html[data-gen-chat] .conv-host > .msg.assistant > .msg-kebab { display: none; }
html[data-gen-chat] .conv-host > .msg.assistant.gen-anchored:not(.gen-awaiting) > .msg-kebab { display: grid; }
.conv-host > .msg.lp-say.lp-now ~ .msg.tool-group.lp-step::before { animation: none; }

/* Live Bubble: no second panel or attached stack. The activity is the opening
   state of the SAME message; dots and then the answer replace it in one object. */
:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .conv-host > .msg.assistant.gen-anchored {
  padding: 0 12px 16px; border-radius: 19px 19px 19px 7px;
  transition: border-color 180ms;
}
:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .gen-anchored > .msg.gen-activity.gen-in-reply {
  width: 100%; max-width: none; margin: 0 0 2px; padding: 0;
  border: 0; border-radius: 0;
  background: transparent; overflow: hidden;
}
:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .gen-in-reply .gen-activity-toggle { min-height: 28px; gap: 6px; }
/* Compact trajectory: no thinking label, signal dot, bullet, or timer shortcut. */
html[data-gen-chat] :is(.gen-activity-signal,.gen-activity-label,.gen-entry-node) { display: none; }
html[data-gen-chat] .gen-entry { grid-template-columns: minmax(0,1fr); column-gap: 0; }
html[data-gen-chat] .msg-timer > .mt-nn { display: none; }
:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .gen-in-reply .gen-activity-label { font-weight: 550; }
:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .gen-in-reply .gen-activity-body { height: auto; max-height: 150px; overflow: hidden; }
:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .gen-in-reply.is-expanded .gen-activity-body { height: auto; max-height: none; overflow: visible; }
:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat])
:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .gen-in-reply.has-answer:not(.is-expanded) .gen-activity-body,
:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .gen-in-reply.is-done:not(.is-expanded):not(.gen-stopped) .gen-activity-body { display: none; }
:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .gen-anchored .gen-wait { padding-top: 12px; }
:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .gen-anchored:not(.gen-awaiting) > .bubble { padding-top: 13px; }
/* Keep prose at SandPie's normal reading rhythm; only activity is utility-sized. */
:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .gen-anchored .gen-content {
  font: 400 15px/1.6 var(--au-font); letter-spacing: normal;
}
:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .gen-anchored .gen-content p { margin: 0 0 .55rem; }
:is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .gen-anchored .gen-content p:last-child { margin-bottom: 0; }
/* Quiet trail: the existing activity control follows the waiting status. */
:is(html[data-theme="aurora"],html[data-theme="aurora-light"]) .gen-wait.has-activity-control { gap: 11px; }
:is(html[data-theme="aurora"],html[data-theme="aurora-light"]) .gen-wait.has-activity-control > .gen-wait-hint { white-space: nowrap; }
:is(html[data-theme="aurora"],html[data-theme="aurora-light"]) .gen-wait.has-activity-control > .gen-wait-hint::after { content: '·'; margin-left: 11px; opacity: .65; }
:is(html[data-theme="aurora"],html[data-theme="aurora-light"]) .gen-wait > .gen-activity-toggle { display: inline-flex; flex: 0 0 auto; width: auto; min-height: 24px; gap: 7px; padding: 2px 0; border-radius: 0; color: var(--sp-text-dim); text-align: left; transition: color 150ms; }
:is(html[data-theme="aurora"],html[data-theme="aurora-light"]) .gen-wait > .gen-activity-toggle[hidden] { display: none !important; }
:is(html[data-theme="aurora"],html[data-theme="aurora-light"]) .gen-wait > .gen-activity-toggle:hover,
:is(html[data-theme="aurora"],html[data-theme="aurora-light"]) .gen-wait > .gen-activity-toggle[aria-expanded="true"] { color: var(--sp-accent); }
:is(html[data-theme="aurora"],html[data-theme="aurora-light"]) .gen-wait > .gen-activity-toggle .gen-activity-count { margin: 0; }
:is(html[data-theme="aurora"],html[data-theme="aurora-light"]) .gen-anchored:not(.gen-awaiting) > .gen-wait { padding-top: 0; }
:is(html[data-theme="aurora"],html[data-theme="aurora-light"]) .gen-anchored:not(.gen-awaiting):not(.gen-stopped) > .gen-wait > :is(.gen-dots,.gen-wait-hint) { display: none; }
:is(html[data-theme="aurora"],html[data-theme="aurora-light"]) .gen-anchored.gen-stopped > .gen-wait > .gen-dots { display: none; }
:is(html[data-theme="aurora"],html[data-theme="aurora-light"]) .gen-anchored.gen-stopped > .gen-wait { padding-top: 12px; }
@keyframes gen-dot { 0%,70%,100% { opacity: .3; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-3px); } }
@keyframes gen-signal { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes gen-anchor-arrive { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes gen-entry-arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width:768px) {
  html[data-gen-chat="live-bubble"][data-theme="aurora"],
  html[data-gen-chat="live-bubble"][data-theme="aurora-light"] { --gen-gutter: 12px; }
  :is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .conv-host > .msg.assistant.gen-anchored { margin-right: 4px; padding: 0 6px 16px; }
  :is(html[data-theme="aurora"][data-gen-chat],html[data-theme="aurora-light"][data-gen-chat]) .conv-host > .msg.gen-activity { width: auto; max-width: calc(100% - var(--gen-gutter) - 8px); margin-right: 4px; padding: 0 12px; }

  .conv-host > .msg.assistant.gen-anchored.gen-historical { animation: none; }
}
@media (prefers-reduced-motion:reduce) {
  .gen-anchored, .gen-dots i, .gen-activity-signal, .gen-entry.is-new { animation: none; }
  .gen-activity-arrow, .gen-activity-label, .gen-activity-body, .gen-wait > .gen-activity-toggle { transition: none !important; }
}
  /* ── Dictation: Concept C — focused recording ── */
  .input-bar.stt-composer-actions { position: relative; min-height: 40px; padding: 5px 8px 6px; }
  .input-bar.stt-composer-actions:not(.stt-mic-mode) .mic-btn { display: none !important; }
  .input-bar.stt-composer-actions.stt-mic-mode > .send-btn { display: none !important; }
  .input-bar.stt-composer-actions > .mic-btn {
    margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
    width: 35px; height: 35px; flex: 0 0 35px; padding: 0 !important;
    border: 1px solid color-mix(in srgb, var(--sp-accent) 18%, transparent) !important;
    border-radius: 50% !important; background: color-mix(in srgb, var(--sp-accent) 8%, transparent) !important;
    color: var(--sp-accent) !important; cursor: pointer; box-shadow: none !important;
    transition: transform .16s, background .16s, color .16s !important;
  }
  .input-bar.stt-composer-actions > .mic-btn:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--sp-accent) 13%, transparent) !important; }
  .input-bar.stt-composer-actions > .send-btn {
    width: 35px; height: 35px; flex: 0 0 35px; border-radius: 50% !important;
    background: var(--sp-accent) !important; color: var(--sp-bg) !important;
    border: 0 !important; box-shadow: 0 0 24px var(--sp-accent-dim) !important;
  }
  .input-bar.stt-composer-actions > .mic-btn.recording { background: var(--sp-accent) !important; color: var(--sp-bg) !important; animation: none; }
  .input-bar.stt-composer-actions > .mic-btn:disabled { opacity: .65; cursor: wait; }
  .stt-rec { display: block; padding: 10px 16px 0; animation: sttFocusReveal .15s ease-out; }
  .stt-rec[hidden], .stt-rec-bar[hidden] { display: none !important; }
  .stt-focus-transcript { max-height: 4.4em; overflow-y: auto; color: var(--sp-text); font-size: .9rem; line-height: 1.45; overflow-wrap: anywhere; }
  .stt-rec-bar { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px; height: 35px; padding-right: 10px; }
  .stt-cancel {
    width: 28px; height: 28px; flex: 0 0 28px; padding: 0; cursor: pointer;
    border: 0; border-radius: 8px; background: transparent; color: var(--sp-text-dim);
    display: inline-flex; align-items: center; justify-content: center;
  }
  .stt-cancel:hover { color: var(--sp-text); background: var(--sp-panel); }
  .stt-time { flex: 0 0 auto; min-width: 2.6em; color: var(--sp-text-dim); font-variant-numeric: tabular-nums; font-family: ui-monospace, monospace; font-size: .8rem; }
  .stt-wave { flex: 1 1 auto; min-width: 0; overflow: hidden; display: flex; align-items: center; justify-content: flex-end; gap: 2px; height: 24px; color: var(--sp-accent); pointer-events: none; }
  .stt-wave i { display: block; flex: 0 0 2px; width: 2px; height: 3px; border-radius: 2px; background: currentColor; }
  .input-wrap.stt-listening { border-color: color-mix(in srgb, var(--sp-accent) 48%, transparent); box-shadow: 0 0 0 3px var(--sp-accent-dim); }
  .input-wrap.stt-listening > textarea { display: none !important; }
  .input-wrap.stt-listening > .input-bar > :not(#micBtn):not(#sttLiveStatus):not(#sttRecBar) { display: none !important; }
  .input-bar.stt-composer-actions > .mic-btn .stt-spinner { animation: sttSpin .8s linear infinite; }
  @keyframes sttFocusReveal { from { opacity: 0; } to { opacity: 1; } }
  @media (prefers-reduced-motion: reduce) {
    .stt-rec { animation: none; }
  }

/* Activity trajectory is label-only: retain compact indent and stacked history. */

html[data-gen-chat] .gen-in-reply .gen-activity-count { margin: 0; }
html[data-gen-chat] .gen-in-reply .gen-activity-arrow { margin-left: 0; }
/* Only the leftmost separator followed the removed thinking control. */
.msg-timer > .mt-sep:first-child { display: none; }

/* A static history row is not an invitation to close the whole history. */
html[data-gen-chat] .gen-activity:not(.is-expanded) .gen-entry { pointer-events: none; }
@media (max-width: 768px) {
  .gen-activity.is-expanded .gen-entry-main,
  .gen-activity.is-expanded .gen-entry-toggle { min-height: 44px; gap: 9px; }
  .gen-activity.is-expanded .gen-entry-index { flex-basis: 22px; font-size: 9px; }
  .gen-activity.is-expanded .gen-entry-detail { margin-left: 31px; padding-right: 4px; }
}

/* Steers join the prompt's turn; acknowledgement restores full opacity. */
:is(html[data-theme='olive'][data-gen-chat='live-bubble'],html[data-theme='light'][data-gen-chat='live-bubble'],html[data-theme='aurora'][data-gen-chat='live-bubble'],html[data-theme='aurora-light'][data-gen-chat='live-bubble']) .conv-host > .msg.user.gen-steer-pending {
  opacity: .58;
  transition: none;
}
:is(html[data-theme='olive'][data-gen-chat='live-bubble'],html[data-theme='light'][data-gen-chat='live-bubble'],html[data-theme='aurora'][data-gen-chat='live-bubble'],html[data-theme='aurora-light'][data-gen-chat='live-bubble']) .conv-host > .msg.user { transition: opacity 160ms ease; }
