Skip to content

Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More

114 KB
Raw Blame
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Memory · claude-mem</title>
  <link rel="icon" type="image/webp" href="claude-mem-logomark.webp">
  <!-- The saved theme on <html> before the first paint: scripts/build-viewer.js puts src/ui/viewer/utils/theme-pre-paint.ts's script here. -->
  <script>(function (key, choices, followsSystem, dark, light, appearanceKey, presets, fonts, readings, defaultAppearance) {
  var choice = followsSystem
  try {
    var saved = localStorage.getItem(key)
    if (choices.indexOf(saved) >= 0) choice = saved
  } catch (error) {
    console.warn('The saved theme could not be read, so the page follows the system theme:', error)
  }
  if (choice === followsSystem) choice = matchMedia('(prefers-color-scheme: dark)').matches ? dark : light
  var root = document.documentElement
  root.setAttribute('data-theme', choice)
  var look = defaultAppearance
  try {
    var stored = JSON.parse(localStorage.getItem(appearanceKey) || 'null')
    if (stored) look = {
      preset: presets.indexOf(stored.preset) >= 0 ? stored.preset : defaultAppearance.preset,
      font: fonts.indexOf(stored.font) >= 0 ? stored.font : defaultAppearance.font,
      reading: readings.indexOf(stored.reading) >= 0 ? stored.reading : defaultAppearance.reading
    }
  } catch (error) {
    console.warn('The saved reading appearance could not be read, so the default is used:', error)
  }
  root.setAttribute('data-palette', look.preset)
  root.setAttribute('data-font', look.font)
  root.setAttribute('data-reading', look.reading)
})("claude-mem-theme", ["system","light","dark"], "system", "dark", "light", "claude-mem-theme-appearance", ["default","warm-cream","neutral-light","warm-tint","neutral-dark"], ["default","sans","serif","mono"], ["compact","default","comfortable"], {"preset":"default","font":"default","reading":"default"})</script>
  <style>
    @font-face {
      font-family: 'Geist Variable';
      font-style: normal;
      font-display: swap;
      font-weight: 100 900;
      src: url('assets/fonts/geist-cyrillic-ext-wght-normal.woff2') format('woff2-variations');
      unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
    }
    @font-face {
      font-family: 'Geist Variable';
      font-style: normal;
      font-display: swap;
      font-weight: 100 900;
      src: url('assets/fonts/geist-cyrillic-wght-normal.woff2') format('woff2-variations');
      unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
    }
    @font-face {
      font-family: 'Geist Variable';
      font-style: normal;
      font-display: swap;
      font-weight: 100 900;
      src: url('assets/fonts/geist-latin-ext-wght-normal.woff2') format('woff2-variations');
      unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
    }
    @font-face {
      font-family: 'Geist Variable';
      font-style: normal;
      font-display: swap;
      font-weight: 100 900;
      src: url('assets/fonts/geist-latin-wght-normal.woff2') format('woff2-variations');
      unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
    }
    @font-face {
      font-family: 'Geist Mono Variable';
      font-style: normal;
      font-display: swap;
      font-weight: 100 900;
      src: url('assets/fonts/geist-mono-cyrillic-wght-normal.woff2') format('woff2-variations');
      unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
    }
    @font-face {
      font-family: 'Geist Mono Variable';
      font-style: normal;
      font-display: swap;
      font-weight: 100 900;
      src: url('assets/fonts/geist-mono-latin-ext-wght-normal.woff2') format('woff2-variations');
      unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
    }
    @font-face {
      font-family: 'Geist Mono Variable';
      font-style: normal;
      font-display: swap;
      font-weight: 100 900;
      src: url('assets/fonts/geist-mono-latin-wght-normal.woff2') format('woff2-variations');
      unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
    }

    /* Memory's token sheet (My Work design pass, Phase 11): the same look as My Work. The values are Codex's ink-and-paper
       palette with one green action colour, the ones Phase 3 put in src/ui/my-work/src/index.css (both themes), under the
       viewer's own token names; the brain mark keeps its orange (--color-brand-mark, My Work's --brand-mark).
       Mapping from My Work: --background to --color-bg-primary; --card to --color-bg-card and -header; --muted (Codex
       --alt) to -secondary, -card-hover and -control-hover; --foreground to --color-text-primary; --muted-foreground to
       -secondary and -muted (Codex --weak is -tertiary); --border to --color-border-primary (decorative, shared with the
       scrollbar); Codex --soft (the line between rows) to --color-border-secondary; --control-edge to --color-border-control
       (3:1 on every surface); --primary and --primary-foreground to --color-bg-button and --color-text-button; the place
       and link green to --color-accent-primary; --ring to --color-accent-focus; --destructive to --color-accent-error.
       Tones: the record and session marks' tints (Codex .sketch-icon): green, blue, purple, amber and the brand's.
       Type:       Geist for words, Geist Mono for ids, times, counts, paths and logs. Sizes: 12 tags and keys, 13 small meta,
                   14 meta, legends and logs, 15 tabs, buttons and places, 16 body and every field, 17 row titles, 18 lead
                   text, 20 the brand on a phone, 22 the brand and a section on a phone, 24 a panel on a phone, 26 a
                   section (a day), 28 a panel, 34 the page title on a phone, clamp(38px, 3.55vw, 53px) the page title.
                   tests/viewer/viewer-type-scale.test.ts holds the stylesheet to the sizes, faces, widths and radii here.
       Layout:     72px bar (57px on a phone, with a 63px bottom bar); pages in a 1064px column (a reading page 900px),
                   56px sides (18px on a phone). The same widths as My Work's bar and pages.
       Breakpoints: My Work's: 767px (phone: bottom bar; with pointer: coarse, the touch rule), 1023px (the bar's narrow
                   sizes) and 1279px (Find work's words in the bar). Nothing else.
       Radius:     tags 4px; controls (buttons, fields, menus) 8px; search boxes and the row marks 10px; panels and dialogs
                   14px; round things 999px.
       Sizes:      every control 44px tall (rows, tabs, buttons, fields), the bar's places and Memory included; text links
                   and time stamps at least 24px (WCAG 2.5.8); every control 44px on touch (pointer: coarse, or under 768px).
       tests/viewer/viewer-token-contrast.test.ts checks the contrast pairs; theme-tokens.test.ts keeps the three blocks in step. */

    /* Light theme */
    :root,
    [data-theme="light"] {
      --color-bg-primary: #f6f5f0;
      --color-bg-secondary: #eeeee7;
      --color-bg-tertiary: #eeeee7;
      --color-bg-header: #fffef9;
      --color-bg-card: #fffef9;
      --color-bg-card-hover: #eeeee7;
      --color-bg-input: #fffef9;
      --color-bg-button: #203e30;
      --color-bg-button-hover: #1e3a2d;
      --color-bg-control-hover: #eeeee7;
      --color-bg-scrollbar-track: #f6f5f0;
      --color-bg-scrollbar-thumb: #cfd2c8;
      --color-bg-scrollbar-thumb-hover: #7a857c;

      --color-border-primary: #cfd2c8;
      --color-border-secondary: #dfe2d8;
      --color-border-control: #7a857c;
      --color-border-hover: #536057;
      --color-border-focus: #22684f;
      --color-border-observation: #b9d0db;

      --color-text-primary: #202923;
      --color-text-secondary: #536057;
      --color-text-tertiary: #626d65;
      --color-text-header: #202923;
      --color-text-title: #202923;
      --color-text-button: #fbfff8;

      --color-accent-primary: #1b664e;
      --color-accent-focus: #22684f;
      --color-accent-success: #1b664e;
      --color-accent-error: #a33733;

      --color-tone-green: #1b664e;
      --color-tone-green-bg: #e1eee4;
      --color-tone-blue: #285d72;
      --color-tone-blue-bg: #deeaf0;
      --color-tone-purple: #654a73;
      --color-tone-purple-bg: #eee5f1;
      --color-tone-amber: #784b09;
      --color-tone-amber-bg: #f7ecd6;
      --color-tone-brand: #b44627;
      --color-tone-brand-bg: #f8e8df;
      --color-brand-mark: #d86441;

      --color-skeleton-base: #dfe2d8;
      --shadow-focus: 0 0 0 2px rgba(34, 104, 79, 0.3);
      --shadow-panel: 0 2px 4px rgba(30, 41, 31, 0.035);

      --color-log-debug: #536057;
      --color-log-info: #285d72;
      --color-log-warn: #784b09;
      --color-log-error: #a33733;
      --color-log-success: #1b664e;
      --color-log-component: #654a73;

      --font-sans: 'Geist Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      --font-terminal: 'Geist Mono Variable', ui-monospace, SFMono-Regular, Menlo, monospace;
    }

    /* Dark theme */
    [data-theme="dark"] {
      --color-bg-primary: #171b18;
      --color-bg-secondary: #262d26;
      --color-bg-tertiary: #262d26;
      --color-bg-header: #202520;
      --color-bg-card: #202520;
      --color-bg-card-hover: #262d26;
      --color-bg-input: #202520;
      --color-bg-button: #c3e4c7;
      --color-bg-button-hover: #b7d6bb;
      --color-bg-control-hover: #262d26;
      --color-bg-scrollbar-track: #171b18;
      --color-bg-scrollbar-thumb: #434b42;
      --color-bg-scrollbar-thumb-hover: #7e897f;

      --color-border-primary: #434b42;
      --color-border-secondary: #343d35;
      --color-border-control: #7e897f;
      --color-border-hover: #b4bcb1;
      --color-border-focus: #b2e0bb;
      --color-border-observation: #41575f;

      --color-text-primary: #f4f3e9;
      --color-text-secondary: #b4bcb1;
      --color-text-tertiary: #a9b3a8;
      --color-text-header: #f4f3e9;
      --color-text-title: #f4f3e9;
      --color-text-button: #173426;

      --color-accent-primary: #a1d6b5;
      --color-accent-focus: #b2e0bb;
      --color-accent-success: #a1d6b5;
      --color-accent-error: #f39a96;

      --color-tone-green: #a1d6b5;
      --color-tone-green-bg: #2a3d30;
      --color-tone-blue: #afd3dd;
      --color-tone-blue-bg: #29383e;
      --color-tone-purple: #d9bedf;
      --color-tone-purple-bg: #382e3c;
      --color-tone-amber: #efd096;
      --color-tone-amber-bg: #382f22;
      --color-tone-brand: #f1a183;
      --color-tone-brand-bg: #382b24;
      --color-brand-mark: #d86441;

      --color-skeleton-base: #343d35;
      --shadow-focus: 0 0 0 2px rgba(178, 224, 187, 0.25);
      --shadow-panel: 0 0 #0000;

      --color-log-debug: #b4bcb1;
      --color-log-info: #afd3dd;
      --color-log-warn: #efd096;
      --color-log-error: #f39a96;
      --color-log-success: #a1d6b5;
      --color-log-component: #d9bedf;

      --font-sans: 'Geist Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      --font-terminal: 'Geist Mono Variable', ui-monospace, SFMono-Regular, Menlo, monospace;
    }

    /* System preference default before the theme hook sets data-theme.
       Must mirror [data-theme="dark"] exactly; :root already holds light. */
    @media (prefers-color-scheme: dark) {
      :root:not([data-theme]) {
        --color-bg-primary: #171b18;
        --color-bg-secondary: #262d26;
        --color-bg-tertiary: #262d26;
        --color-bg-header: #202520;
        --color-bg-card: #202520;
        --color-bg-card-hover: #262d26;
        --color-bg-input: #202520;
        --color-bg-button: #c3e4c7;
        --color-bg-button-hover: #b7d6bb;
        --color-bg-control-hover: #262d26;
        --color-bg-scrollbar-track: #171b18;
        --color-bg-scrollbar-thumb: #434b42;
        --color-bg-scrollbar-thumb-hover: #7e897f;

        --color-border-primary: #434b42;
        --color-border-secondary: #343d35;
        --color-border-control: #7e897f;
        --color-border-hover: #b4bcb1;
        --color-border-focus: #b2e0bb;
        --color-border-observation: #41575f;

        --color-text-primary: #f4f3e9;
        --color-text-secondary: #b4bcb1;
        --color-text-tertiary: #a9b3a8;
        --color-text-header: #f4f3e9;
        --color-text-title: #f4f3e9;
        --color-text-button: #173426;

        --color-accent-primary: #a1d6b5;
        --color-accent-focus: #b2e0bb;
        --color-accent-success: #a1d6b5;
        --color-accent-error: #f39a96;

        --color-tone-green: #a1d6b5;
        --color-tone-green-bg: #2a3d30;
        --color-tone-blue: #afd3dd;
        --color-tone-blue-bg: #29383e;
        --color-tone-purple: #d9bedf;
        --color-tone-purple-bg: #382e3c;
        --color-tone-amber: #efd096;
        --color-tone-amber-bg: #382f22;
        --color-tone-brand: #f1a183;
        --color-tone-brand-bg: #382b24;
        --color-brand-mark: #d86441;

        --color-skeleton-base: #343d35;
        --shadow-focus: 0 0 0 2px rgba(178, 224, 187, 0.25);
        --shadow-panel: 0 0 #0000;

        --color-log-debug: #b4bcb1;
        --color-log-info: #afd3dd;
        --color-log-warn: #efd096;
        --color-log-error: #f39a96;
        --color-log-success: #a1d6b5;
        --color-log-component: #d9bedf;

        --font-sans: 'Geist Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        --font-terminal: 'Geist Mono Variable', ui-monospace, SFMono-Regular, Menlo, monospace;
      }
    }

    /* Readable palettes (the theme presets both apps offer): a warm page for long reading, two neutral ones and the
       designer's warm tint. Each sets every token the stylesheet reads, so no green cast survives from the theme under
       it. Each belongs to one theme (PALETTE_THEMES in src/ui/theme-appearance.ts) and applies only under it: picking a
       palette also picks its theme, and switching the theme afterwards shows that theme's own palette, never a mix. */

    [data-theme="light"][data-palette="warm-cream"] {
      --color-bg-primary: #f5f2eb;
      --color-bg-secondary: #ece7dc;
      --color-bg-tertiary: #ece7dc;
      --color-bg-header: #fffdf8;
      --color-bg-card: #fffdf8;
      --color-bg-card-hover: #ece7dc;
      --color-bg-input: #fffdf8;
      --color-bg-button: #4a3828;
      --color-bg-button-hover: #3d2e21;
      --color-bg-control-hover: #ece7dc;
      --color-bg-scrollbar-track: #f5f2eb;
      --color-bg-scrollbar-thumb: #cfc7b8;
      --color-bg-scrollbar-thumb-hover: #8a8174;
      --color-border-primary: #d6cec0;
      --color-border-secondary: #e3dccf;
      --color-border-control: #8a8174;
      --color-border-hover: #6b6256;
      --color-border-focus: #8a4b2f;
      --color-border-observation: #c9b6a0;
      --color-text-primary: #202020;
      --color-text-secondary: #5c554b;
      --color-text-tertiary: #6d655a;
      --color-text-header: #202020;
      --color-text-title: #202020;
      --color-text-button: #fbf8f1;
      --color-accent-primary: #8a4b2f;
      --color-accent-focus: #8a4b2f;
      --color-accent-success: #3f6b44;
      --color-accent-error: #a33733;
      --color-tone-green: #3f6b44;
      --color-tone-green-bg: #e2ebdf;
      --color-tone-blue: #3d6477;
      --color-tone-blue-bg: #e0e9ed;
      --color-tone-purple: #76516b;
      --color-tone-purple-bg: #eee4e9;
      --color-tone-amber: #7b511a;
      --color-tone-amber-bg: #f5e8d2;
      --color-tone-brand: #a6472b;
      --color-tone-brand-bg: #f5e4d9;
      --color-brand-mark: #d86441;
      --color-skeleton-base: #e3dccf;
      --shadow-focus: 0 0 0 2px rgba(138, 75, 47, 0.3);
      --shadow-panel: 0 2px 4px rgba(61, 46, 33, 0.04);
      --color-log-debug: #5c554b;
      --color-log-info: #3d6477;
      --color-log-warn: #7b511a;
      --color-log-error: #a33733;
      --color-log-success: #3f6b44;
      --color-log-component: #76516b;
      --font-sans: 'Geist Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      --font-terminal: 'Geist Mono Variable', ui-monospace, SFMono-Regular, Menlo, monospace;
    }

    [data-theme="light"][data-palette="neutral-light"] {
      --color-bg-primary: #fafafa;
      --color-bg-secondary: #f0f0f0;
      --color-bg-tertiary: #f0f0f0;
      --color-bg-header: #ffffff;
      --color-bg-card: #ffffff;
      --color-bg-card-hover: #f0f0f0;
      --color-bg-input: #ffffff;
      --color-bg-button: #242424;
      --color-bg-button-hover: #333333;
      --color-bg-control-hover: #f0f0f0;
      --color-bg-scrollbar-track: #fafafa;
      --color-bg-scrollbar-thumb: #d4d4d4;
      --color-bg-scrollbar-thumb-hover: #7a7a7a;
      --color-border-primary: #d4d4d4;
      --color-border-secondary: #e5e5e5;
      --color-border-control: #7a7a7a;
      --color-border-hover: #525252;
      --color-border-focus: #1f5d8a;
      --color-border-observation: #c4c4c4;
      --color-text-primary: #242424;
      --color-text-secondary: #525252;
      --color-text-tertiary: #616161;
      --color-text-header: #242424;
      --color-text-title: #242424;
      --color-text-button: #fafafa;
      --color-accent-primary: #1f5d8a;
      --color-accent-focus: #1f5d8a;
      --color-accent-success: #2f6b3a;
      --color-accent-error: #a33733;
      --color-tone-green: #2f6b3a;
      --color-tone-green-bg: #e3eee5;
      --color-tone-blue: #285d72;
      --color-tone-blue-bg: #e1ebf0;
      --color-tone-purple: #654a73;
      --color-tone-purple-bg: #eee6f0;
      --color-tone-amber: #784b09;
      --color-tone-amber-bg: #f7ecd6;
      --color-tone-brand: #a94b2d;
      --color-tone-brand-bg: #f7e8e1;
      --color-brand-mark: #d86441;
      --color-skeleton-base: #e5e5e5;
      --shadow-focus: 0 0 0 2px rgba(31, 93, 138, 0.3);
      --shadow-panel: 0 2px 4px rgba(31, 41, 31, 0.035);
      --color-log-debug: #525252;
      --color-log-info: #285d72;
      --color-log-warn: #784b09;
      --color-log-error: #a33733;
      --color-log-success: #2f6b3a;
      --color-log-component: #654a73;
      --font-sans: 'Geist Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      --font-terminal: 'Geist Mono Variable', ui-monospace, SFMono-Regular, Menlo, monospace;
    }

    [data-theme="light"][data-palette="warm-tint"] {
      --color-bg-primary: #edd1b0;
      --color-bg-secondary: #e4c39c;
      --color-bg-tertiary: #e4c39c;
      --color-bg-header: #f8e4cc;
      --color-bg-card: #f8e4cc;
      --color-bg-card-hover: #e4c39c;
      --color-bg-input: #f8e4cc;
      --color-bg-button: #4a2f1c;
      --color-bg-button-hover: #3b2516;
      --color-bg-control-hover: #e4c39c;
      --color-bg-scrollbar-track: #edd1b0;
      --color-bg-scrollbar-thumb: #c3a47f;
      --color-bg-scrollbar-thumb-hover: #8a6b46;
      --color-border-primary: #c9a77d;
      --color-border-secondary: #d8bb95;
      --color-border-control: #8a6b46;
      --color-border-hover: #6f5330;
      --color-border-focus: #6f4324;
      --color-border-observation: #c9a77d;
      --color-text-primary: #202020;
      --color-text-secondary: #4a3a2b;
      --color-text-tertiary: #5b4938;
      --color-text-header: #202020;
      --color-text-title: #202020;
      --color-text-button: #fff8ee;
      --color-accent-primary: #6f3b16;
      --color-accent-focus: #6f4324;
      --color-accent-success: #2f5b34;
      --color-accent-error: #8f2f2b;
      --color-tone-green: #2f5b34;
      --color-tone-green-bg: #e2e7d4;
      --color-tone-blue: #355a6b;
      --color-tone-blue-bg: #dfe6e5;
      --color-tone-purple: #6b455f;
      --color-tone-purple-bg: #eadde0;
      --color-tone-amber: #714511;
      --color-tone-amber-bg: #f1dfbf;
      --color-tone-brand: #8f3c21;
      --color-tone-brand-bg: #f0d9c8;
      --color-brand-mark: #b9502f;
      --color-skeleton-base: #d8bb95;
      --shadow-focus: 0 0 0 2px rgba(111, 67, 36, 0.3);
      --shadow-panel: 0 2px 4px rgba(74, 47, 28, 0.05);
      --color-log-debug: #4a3a2b;
      --color-log-info: #355a6b;
      --color-log-warn: #714511;
      --color-log-error: #8f2f2b;
      --color-log-success: #2f5b34;
      --color-log-component: #6b455f;
      --font-sans: 'Geist Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      --font-terminal: 'Geist Mono Variable', ui-monospace, SFMono-Regular, Menlo, monospace;
    }

    [data-theme="dark"][data-palette="neutral-dark"] {
      --color-bg-primary: #22252a;
      --color-bg-secondary: #2d3138;
      --color-bg-tertiary: #2d3138;
      --color-bg-header: #282c32;
      --color-bg-card: #282c32;
      --color-bg-card-hover: #2d3138;
      --color-bg-input: #282c32;
      --color-bg-button: #e0e0e0;
      --color-bg-button-hover: #d0d0d0;
      --color-bg-control-hover: #2d3138;
      --color-bg-scrollbar-track: #22252a;
      --color-bg-scrollbar-thumb: #444a52;
      --color-bg-scrollbar-thumb-hover: #818a94;
      --color-border-primary: #444a52;
      --color-border-secondary: #343a41;
      --color-border-control: #818a94;
      --color-border-hover: #b8c0c9;
      --color-border-focus: #a9c7e8;
      --color-border-observation: #46535f;
      --color-text-primary: #e0e0e0;
      --color-text-secondary: #b8c0c9;
      --color-text-tertiary: #aab3bc;
      --color-text-header: #e0e0e0;
      --color-text-title: #e0e0e0;
      --color-text-button: #22252a;
      --color-accent-primary: #9cc7f0;
      --color-accent-focus: #a9c7e8;
      --color-accent-success: #98d6a6;
      --color-accent-error: #f39a96;
      --color-tone-green: #98d6a6;
      --color-tone-green-bg: #2b3a31;
      --color-tone-blue: #a9cbe3;
      --color-tone-blue-bg: #293740;
      --color-tone-purple: #d3bfe0;
      --color-tone-purple-bg: #36303d;
      --color-tone-amber: #e5cf9f;
      --color-tone-amber-bg: #373328;
      --color-tone-brand: #eaa88d;
      --color-tone-brand-bg: #372d28;
      --color-brand-mark: #d86441;
      --color-skeleton-base: #343a41;
      --shadow-focus: 0 0 0 2px rgba(169, 199, 232, 0.25);
      --shadow-panel: 0 0 #0000;
      --color-log-debug: #b8c0c9;
      --color-log-info: #a9cbe3;
      --color-log-warn: #e5cf9f;
      --color-log-error: #f39a96;
      --color-log-success: #98d6a6;
      --color-log-component: #d3bfe0;
      --font-sans: 'Geist Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
      --font-terminal: 'Geist Mono Variable', ui-monospace, SFMono-Regular, Menlo, monospace;
    }

    /* Font choices replace only the words' face; Geist Mono keeps ids, times and logs. */
    [data-font="sans"] { --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
    [data-font="serif"] { --font-sans: Georgia, 'Iowan Old Style', 'Palatino Linotype', 'Times New Roman', serif; }
    [data-font="mono"] { --font-sans: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

    /* Reading sizes: Memory's type sizes are the fixed sheet above (tests/viewer/viewer-type-scale.test.ts), so here a
       size choice made in My Work sets only the line height that goes with it, never a page zoom (the windowed feed and
       the menus measure the page, and zooming would change what they measure). */
    [data-reading="compact"] { --theme-line-height: 1.45; }
    [data-reading="default"] { --theme-line-height: 1.54; }
    [data-reading="comfortable"] { --theme-line-height: 1.65; }

    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      background: var(--color-bg-primary);
      color: var(--color-text-primary);
      overflow: hidden;
    }

    @keyframes pulse {
      0%, 100% {
        transform: scale(1);
      }
      50% {
        transform: scale(1.1);
      }
    }

    .theme-toggle-btn {
      background: var(--color-bg-card);
      border: 1px solid var(--color-border-primary);
      border-radius: 6px;
      padding: 0;
      width: 36px;
      height: 36px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--color-text-secondary);
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    }

    .theme-toggle-btn:hover {
      background: var(--color-bg-card-hover);
      border-color: var(--color-border-focus);
      color: var(--color-text-primary);
      transform: translateY(-1px);
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    }

    /* GitHub Stars Button - Similar to Community Button */
    .github-stars-btn {
      background: var(--color-bg-card);
      border: 1px solid var(--color-border-primary);
      border-radius: 6px;
      padding: 0 14px;
      height: 36px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--color-text-secondary);
      font-size: 13px;
      font-weight: 500;
      text-decoration: none;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      white-space: nowrap;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    }

    .github-stars-btn:hover {
      background: var(--color-bg-card-hover);
      border-color: var(--color-border-focus);
      color: var(--color-text-primary);
      transform: translateY(-1px);
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    }

    .github-stars-btn:active {
      transform: translateY(0);
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    }

    /* Stars count animation */
    .stars-count {
      animation: countUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
      display: inline-block;
    }

    .stars-loading {
      opacity: 0.5;
      animation: pulse 1.5s ease-in-out infinite;
    }

    @keyframes countUp {
      from {
        opacity: 0;
        transform: translateY(8px);
      }
      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    /* TeamBrain discovery link: quieter than the trial CTA beside it, and gone
       once this install is in a team (Header.tsx). */

    .teambrain-cta {
      display: inline-flex;
      align-items: center;
      height: 30px;
      padding: 0 12px;
      border: 1px solid var(--color-border-primary);
      border-radius: 999px;
      color: var(--color-text-secondary);
      background: var(--color-bg-card);
      font-size: 12px;
      font-weight: 500;
      white-space: nowrap;
      text-decoration: none;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .teambrain-cta:hover {
      color: var(--color-text-primary);
      border-color: var(--color-border-focus);
      background: var(--color-bg-card-hover);
    }

    .icon-link {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 36px;
      height: 36px;
      color: var(--color-text-secondary);
      background: var(--color-bg-card);
      border: 1px solid var(--color-border-primary);
      border-radius: 6px;
      text-decoration: none;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    }

    .icon-link:hover {
      background: var(--color-bg-card-hover);
      border-color: var(--color-border-focus);
      color: var(--color-text-primary);
      transform: translateY(-1px);
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    }

    .theme-toggle-btn svg {
      width: 18px;
      height: 18px;
    }

    @keyframes pulse {

      0%,
      100% {
        opacity: 1;
      }

      50% {
        opacity: 0.5;
      }
    }

    /* Base look of form controls. :where() keeps these at zero specificity, so
       every component's own rules (including its :hover) always win; before, the
       global hover painted any hovered button blue under non-white text. */
    :where(select, input, button) {
      background: var(--color-bg-input);
      color: var(--color-text-primary);
      border: 1px solid var(--color-border-control);
      padding: 6px 12px;
      font-family: inherit;
      font-size: 13px;
      border-radius: 6px;
      transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    }

    :where(select, input):hover {
      border-color: var(--color-border-focus);
    }

    :where(select, input):focus {
      outline: none;
      border-color: var(--color-border-focus);
      box-shadow: var(--shadow-focus);
    }

    /* A plain button is neutral: the card surface, a 3:1 edge and a lighter
       neutral under the pointer. The one blue action in a region uses .btn-primary. */
    :where(button) {
      background: var(--color-bg-card);
      color: var(--color-text-primary);
      font-weight: 500;
      cursor: pointer;
    }

    :where(button:hover:not(:disabled)),
    :where(button:active:not(:disabled)) {
      background: var(--color-bg-control-hover);
    }

    :where(button:disabled) {
      opacity: 0.5;
      cursor: not-allowed;
    }

    .view-mode-toggle {
      display: flex;
      align-items: center;
      gap: 4px;
      background: var(--color-bg-tertiary);
      border: 1px solid var(--color-border-primary);
      padding: 4px 8px;
      border-radius: 4px;
      cursor: pointer;
      color: var(--color-text-secondary);
      transition: all 0.15s ease;
      font-size: 12px;
      font-weight: 500;
      text-transform: lowercase;
      font-family: var(--font-terminal);
    }

    .view-mode-toggle svg {
      flex-shrink: 0;
      opacity: 0.7;
      transition: opacity 0.15s ease;
    }

    .view-mode-toggle:hover {
      background: var(--color-bg-card-hover);
      border-color: var(--color-border-hover);
      color: var(--color-text-primary);
    }

    .view-mode-toggle:hover svg {
      opacity: 1;
    }

    .view-mode-toggle.active {
      background: var(--color-accent-primary);
      border-color: var(--color-accent-primary);
      color: var(--color-text-button);
    }

    .view-mode-toggle.active svg {
      opacity: 1;
    }

    .card-delete-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--color-bg-tertiary);
      border: 1px solid var(--color-border-primary);
      padding: 4px 6px;
      border-radius: 4px;
      cursor: pointer;
      color: var(--color-text-secondary);
      transition: all 0.15s ease;
      flex-shrink: 0;
    }

    .card-delete-btn svg {
      flex-shrink: 0;
      opacity: 0.7;
      transition: opacity 0.15s ease;
    }

    .card-delete-btn:hover {
      background: #fde8e8;
      border-color: #e5534b;
      color: #cf222e;
    }

    .card-delete-btn:hover svg {
      opacity: 1;
    }

    .card-delete-btn:disabled {
      opacity: 0.5;
      cursor: default;
    }

    .card-delete-error {
      color: var(--color-accent-error);
      font-size: 12px;
      max-width: 320px;
    }

    /* Observation images: bounded thumbnail strip and gallery */
    .media-strip {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
      margin-top: 14px;
    }

    .media-thumb {
      position: relative;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
    }

    .media-thumb-button {
      position: relative;
      width: 96px;
      height: 72px;
      padding: 0;
      border: 1px solid var(--color-border-primary);
      border-radius: 6px;
      background: var(--color-bg-tertiary);
      color: var(--color-text-tertiary);
      cursor: pointer;
      overflow: hidden;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .media-thumb-button:hover {
      border-color: var(--color-border-hover);
    }

    .media-thumb-button:focus-visible,
    .media-lightbox-nav:focus-visible,
    .media-lightbox-close:focus-visible,
    .media-thumb-retry:focus-visible {
      outline: 2px solid var(--color-border-focus);
      outline-offset: 2px;
    }

    .media-thumb-button img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

    .media-thumb-status {
      padding: 4px 4px 16px;
      font-size: 12px;
      line-height: 1.3;
      text-align: center;
    }

    .media-thumb--rejected .media-thumb-status,
    .media-thumb--failed .media-thumb-status,
    .media-thumb--error .media-thumb-status {
      color: var(--color-accent-error);
    }

    .media-thumb-more {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      font-weight: 600;
      color: #ffffff;
      background: rgba(0, 0, 0, 0.55);
    }

    .media-thumb-retry {
      font-size: 12px;
      padding: 1px 8px;
      border: 1px solid var(--color-border-primary);
      border-radius: 4px;
      background: var(--color-bg-button);
      color: var(--color-text-button);
      cursor: pointer;
    }

    .media-strip-count {
      font-size: 12px;
      color: var(--color-text-tertiary);
    }

    .media-lightbox {
      background: var(--color-bg-primary);
      border: 1px solid var(--color-border-primary);
      border-radius: 8px;
      width: 100%;
      max-width: 1100px;
      max-height: 100%;
      display: flex;
      flex-direction: column;
      overflow: auto;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
      outline: none;
    }

    .media-lightbox-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      padding: 12px 16px;
      border-bottom: 1px solid var(--color-border-primary);
      background: var(--color-bg-header);
    }

    .media-lightbox-title {
      margin: 0;
      font-size: 16px;
      font-weight: 600;
      color: var(--color-text-header);
    }

    .media-lightbox-label {
      margin-left: 8px;
      font-weight: 400;
      font-size: 12px;
      color: var(--color-text-tertiary);
      font-family: var(--font-terminal);
    }

    .media-lightbox-stage {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 12px;
      min-height: 200px;
    }

    .media-lightbox-frame {
      flex: 1;
      min-width: 0;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .media-lightbox-frame img {
      max-width: 100%;
      max-height: 65vh;
      width: auto;
      height: auto;
      object-fit: contain;
      border-radius: 4px;
    }

    .media-lightbox-status {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      color: var(--color-text-secondary);
      font-size: 13px;
    }

    .media-lightbox-nav {
      flex-shrink: 0;
      width: 36px;
      height: 36px;
      border-radius: 999px;
      border: 1px solid var(--color-border-primary);
      background: var(--color-bg-card);
      color: var(--color-text-primary);
      font-size: 18px;
      line-height: 1;
      cursor: pointer;
    }

    .media-lightbox-nav:disabled {
      opacity: 0.35;
      cursor: default;
    }

    .media-lightbox-provenance {
      display: grid;
      grid-template-columns: max-content 1fr;
      gap: 4px 12px;
      margin: 0;
      padding: 0 16px 12px;
      font-size: 12px;
      color: var(--color-text-secondary);
    }

    .media-lightbox-provenance dt {
      color: var(--color-text-tertiary);
    }

    .media-lightbox-provenance dd {
      margin: 0;
      overflow-wrap: anywhere;
    }

    .media-lightbox-owner {
      padding: 0 16px 16px;
      font-size: 12px;
      color: var(--color-text-tertiary);
    }

    .media-lightbox-owner .media-lightbox-provenance {
      padding: 8px 0 0;
    }

    .media-lightbox-path {
      font-family: var(--font-terminal);
    }

    @media (max-width: 767px) {
      .media-thumb-button {
        width: 72px;
        height: 60px;
      }

      .media-lightbox-backdrop {
        padding: 0;
      }

      .media-lightbox {
        border-radius: 0;
        height: 100%;
      }

      .media-lightbox-stage {
        padding: 8px 4px;
      }

      .media-lightbox-nav {
        width: 32px;
        height: 32px;
      }
    }

    ::-webkit-scrollbar {
      width: 10px;
    }

    ::-webkit-scrollbar-track {
      background: var(--color-bg-scrollbar-track);
    }

    ::-webkit-scrollbar-thumb {
      background: var(--color-bg-scrollbar-thumb);
      border-radius: 999px;
    }

    ::-webkit-scrollbar-thumb:hover {
      background: var(--color-bg-scrollbar-thumb-hover);
    }

    .spinner {
      width: 12px;
      height: 12px;
      border: 2px solid var(--color-border-primary);
      border-top-color: var(--color-accent-focus);
      border-radius: 999px;
      animation: spin 0.8s linear infinite;
    }

    @keyframes spin {
      to {
        transform: rotate(360deg);
      }
    }

    @keyframes shimmer {
      0% {
        background-position: 200% 0;
      }

      100% {
        background-position: -200% 0;
      }
    }

    /* Scroll to top button */

    @keyframes fadeInUp {
      from {
        opacity: 0;
        transform: translateY(10px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    /* Phone (767px and below), first pass; the phone rules below win where both set a property. */
    @media (max-width: 767px) {

      /* Hide icon links (docs, github, twitter) on tablet */
      .icon-link,
      .teambrain-cta {
        display: none;
      }

    }

    /* Phone (767px and below) */
    @media (max-width: 767px) {

      /* Hide GitHub stars button on mobile */
      .github-stars-btn {
        display: none;
      }
    }

    /* Phone (767px and below), second pass */
    @media (max-width: 767px) {

      /* Hide icon links on mobile */
      .icon-link,
      .teambrain-cta {
        display: none;
      }

      .theme-toggle-btn, .icon-link {
        width: 32px;
        height: 32px;
        flex-shrink: 0;
      }

      .theme-toggle-btn svg, .icon-link svg {
        width: 16px;
        height: 16px;
      }

    }

    /* Dialog backdrop and close button, for the image viewer (ObservationMedia.tsx). */
    .modal-backdrop {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.65);
      backdrop-filter: blur(4px);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 1000;
      animation: fadeIn 0.2s ease-out;
      padding: 20px;
    }

    .modal-close-btn {
      background: transparent;
      border: 1px solid var(--color-border-primary);
      width: 32px;
      height: 32px;
      border-radius: 6px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--color-text-secondary);
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      padding: 0;
    }

    .modal-close-btn:hover {
      background: var(--color-bg-card-hover);
      border-color: var(--color-border-focus);
      color: var(--color-text-primary);
      transform: scale(1.05);
    }

    .modal-close-btn:active {
      transform: scale(0.95);
    }

    /* Animations */
    @keyframes fadeIn {
      from {
        opacity: 0;
      }
      to {
        opacity: 1;
      }
    }

    @keyframes slideUp {
      from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
      }
      to {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }

    /* Memory refinement: layout, grouping and responsive space. */
    html, body, #root { height: 100%; }
    #root { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
    .modal-close-btn { flex-shrink: 0; }
    @media (max-width: 767px) {
      .modal-close-btn { position: absolute; top: 16px; right: 16px; }
    }
    /* Memory refinement: readable type and quiet, legible metadata. */
    .view-mode-toggle { font-size: 12px; }
    /* Memory refinement: focus, contrast and finish. */
    .visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
    button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--color-accent-focus); outline-offset: 3px; }
    .view-mode-toggle, .card-delete-btn { min-height: 30px; }
    .card-delete-btn { min-width: 30px; }
    .card-delete-btn svg { opacity: 1; }
    .modal-backdrop { background: rgb(0 0 0 / .45); }
    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
    }
    /* ==========================================================================
       Pro Max v16 viewer shell. Tokens live in the three blocks at the top; these
       rules use them only. Control sizes are the token sheet's (C12).
       ========================================================================== */
    /* Elements this shell hides with the hidden attribute while their own rule sets a display. */
    .menu-popover[hidden], .project-picker-popover[hidden] { display: none; }
    .tabular { font-variant-numeric: tabular-nums; }
    .link-button { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 0 2px; border: 0; border-radius: 4px; background: none; color: var(--color-accent-primary); font-size: 13px; font-weight: 500; cursor: pointer; }
    .link-button:hover:not(:disabled) { background: none; text-decoration: underline; }
    .copy-button { display: inline-flex; align-items: center; gap: 6px; }
    .copy-button.link-button { color: var(--color-text-secondary); }
    .copy-button.link-button:hover:not(:disabled) { color: var(--color-text-primary); }

    .theme-toggle-btn, .menu-trigger { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--color-border-control); border-radius: 6px; background: var(--color-bg-card); color: var(--color-text-secondary); box-shadow: none; flex-shrink: 0; }
    .theme-toggle-btn:hover:not(:disabled), .menu-trigger:hover:not(:disabled) { background: var(--color-bg-control-hover); border-color: var(--color-border-control); color: var(--color-text-primary); transform: none; box-shadow: none; }
    .github-stars-btn { display: inline-flex; gap: 8px; height: 36px; padding: 0 12px; border-color: var(--color-border-control); color: var(--color-text-primary); }
    .github-stars-btn:hover { transform: none; box-shadow: none; border-color: var(--color-border-control); background: var(--color-bg-control-hover); }
    .github-stars-divider { width: 1px; align-self: stretch; margin: 8px 0; background: var(--color-border-control); }
    .stars-count, .stars-loading { font-variant-numeric: tabular-nums; animation: none; }

    /* Searchable Project filter. */
    .project-picker { position: relative; display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
    .project-picker-trigger { display: inline-flex; align-items: center; gap: 8px; width: 220px; height: 34px; padding: 0 10px; border: 1px solid var(--color-border-control); border-radius: 6px; background: var(--color-bg-card); color: var(--color-text-primary); font-size: 13px; text-align: left; }
    .project-picker-trigger:hover:not(:disabled) { background: var(--color-bg-control-hover); }
    .project-picker--filtered .project-picker-trigger { border-color: var(--color-accent-primary); }
    .project-picker-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .project-picker-popover { position: absolute; top: calc(100% + 6px); right: 0; z-index: 80; width: 340px; max-width: calc(100vw - 24px); padding: 8px; border: 1px solid var(--color-border-control); border-radius: 8px; background: var(--color-bg-card); box-shadow: 0 12px 32px rgb(0 0 0 / .28); }
    .project-picker-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid var(--color-border-control); border-radius: 6px; color: var(--color-text-secondary); }
    .project-picker-search:focus-within { outline: 2px solid var(--color-accent-focus); outline-offset: 2px; }
    .project-picker-search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: transparent; color: var(--color-text-primary); font-size: 14px; box-shadow: none; }
    .project-picker-search input:focus, .project-picker-search input:focus-visible { outline: none; box-shadow: none; }
    .project-picker-count { margin: 8px 6px 4px; font-size: 12px; color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }
    .project-picker-list { max-height: min(360px, 60vh); margin: 0; padding: 0; overflow-y: auto; list-style: none; }
    .project-picker-option { display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 4px 8px; border-radius: 6px; color: var(--color-text-primary); font-size: 13px; cursor: pointer; }
    .project-picker-option.active { background: var(--color-bg-control-hover); }
    .project-picker-option[aria-selected="true"] { color: var(--color-accent-primary); font-weight: 600; }
    .project-picker-check { display: inline-flex; width: 16px; flex-shrink: 0; }
    .project-picker-name { min-width: 0; overflow-wrap: anywhere; }
    .project-picker-none { padding: 10px 8px; font-size: 13px; color: var(--color-text-secondary); }
    .project-picker-more { margin: 6px 6px 2px; }

    /* The "…" menu (header and cards). */
    .menu-button { position: relative; display: inline-flex; flex-shrink: 0; }
    .menu-button--open .menu-trigger { border-color: var(--color-accent-primary); background: var(--color-bg-control-hover); color: var(--color-text-primary); }
    .menu-popover { position: absolute; top: calc(100% + 6px); z-index: 70; min-width: 240px; max-width: min(320px, calc(100vw - 24px)); max-height: calc(100dvh - 88px); overflow-y: auto; padding: 6px; border: 1px solid var(--color-border-control); border-radius: 8px; background: var(--color-bg-card); box-shadow: 0 12px 32px rgb(0 0 0 / .28); text-align: left; }
    .menu-popover--end { right: 0; }
    .menu-popover--start { left: 0; }
    .menu-popover--up { top: auto; bottom: calc(100% + 6px); }
    .menu-item { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--color-text-primary); font-size: 14px; font-weight: 500; line-height: 1.3; text-align: left; text-decoration: none; cursor: pointer; }
    .menu-item:hover:not(:disabled), .menu-item:focus-visible { background: var(--color-bg-control-hover); }
    .menu-item:focus-visible { outline: 2px solid var(--color-accent-focus); outline-offset: -2px; }
    .menu-item-icon { display: inline-flex; align-items: center; color: var(--color-text-secondary); }
    .menu-item-label { min-width: 0; overflow-wrap: anywhere; }
    .menu-item-hint { color: var(--color-text-secondary); font-size: 13px; font-variant-numeric: tabular-nums; }
    .menu-item-check { display: inline-flex; min-width: 14px; color: var(--color-accent-primary); }
    .menu-item--checked { color: var(--color-accent-primary); }
    .menu-item--danger, .menu-item--danger .menu-item-icon { color: var(--color-accent-error); }
    .menu-separator { height: 1px; margin: 6px 4px; background: var(--color-border-primary); }
    .menu-group-label { display: flex; align-items: center; gap: 6px; padding: 8px 10px 4px; font-size: 12px; font-weight: 600; color: var(--color-text-secondary); }
    .menu-group--segments { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 0 4px 4px; }
    .menu-group--segments .menu-group-label { grid-column: 1 / -1; padding-left: 6px; }
    .header-menu { min-width: 300px; }
    .menu-segment { display: flex; justify-content: center; gap: 0; padding: 0 6px; border: 1px solid var(--color-border-control); font-size: 13px; white-space: nowrap; }
    .menu-segment .menu-item-check, .menu-segment .menu-item-icon:empty { display: none; }
    .menu-segment.menu-item--checked { border-color: var(--color-accent-primary); background: var(--color-bg-control-hover); }
    .menu-segment.menu-item--checked .menu-item-icon { color: inherit; }

    /* Page heading, tabs, filters (F1, F7, F11, F26). */
    .memory-page-notices { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: -12px 0 20px; }
    .memory-page-notices button { min-height: 36px; padding: 0 14px; }
    .memory-page-notices p { color: var(--color-text-secondary); font-size: 13px; }

    .short-time { position: relative; display: inline-flex; align-items: center; min-height: 24px; padding: 0 4px; border: 0; border-radius: 4px; background: none; color: var(--color-text-secondary); font: inherit; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer; }
    .short-time:hover:not(:disabled) { background: none; color: var(--color-text-primary); text-decoration: underline dotted; }
    .short-time:focus-visible::after { content: attr(data-full); position: absolute; top: calc(100% + 6px); right: 0; z-index: 20; padding: 4px 8px; border: 1px solid var(--color-border-control); border-radius: 6px; background: var(--color-bg-header); color: var(--color-text-primary); font-size: 12px; white-space: nowrap; box-shadow: 0 6px 18px rgb(0 0 0 / .22); }
    .short-time[aria-pressed="true"]:focus-visible::after { content: none; }
    /* One line under the title (F15); "Show more" opens the whole line in place when it is cut. */
    .view-mode-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid var(--color-border-control); border-radius: 6px; background: var(--color-bg-card); color: var(--color-text-primary); font-family: inherit; font-size: 13px; font-weight: 500; text-transform: none; }
    .view-mode-toggle:hover:not(:disabled) { background: var(--color-bg-control-hover); border-color: var(--color-border-control); color: var(--color-text-primary); }
    .view-mode-toggle.active, .view-mode-toggle.active:hover:not(:disabled) { background: var(--color-bg-card); border-color: var(--color-accent-primary); color: var(--color-accent-primary); }
    .card-delete-btn { min-width: 36px; min-height: 36px; border-color: var(--color-border-control); background: var(--color-bg-card); }
    .card-delete-btn:hover:not(:disabled) { border-color: var(--color-accent-error); background: var(--color-bg-card); color: var(--color-accent-error); }
    .card-delete-error { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; max-width: none; margin-top: 10px; color: var(--color-accent-error); font-size: 13px; }
    .inline-confirm { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-top: 10px; padding: 8px 10px 8px 12px; border: 1px solid var(--color-accent-error); border-radius: 6px; background: var(--color-bg-card); }
    .inline-confirm-question { flex: 1 1 auto; font-size: 13px; color: var(--color-text-primary); }
    .inline-confirm-actions { display: flex; gap: 8px; }
    .inline-confirm button { min-height: 36px; padding: 0 12px; }
    .inline-confirm-danger { border: 1px solid var(--color-accent-error); background: var(--color-bg-card); color: var(--color-accent-error); font-weight: 600; }
    .inline-confirm-danger:hover:not(:disabled) { background: var(--color-bg-control-hover); }
    .inline-confirm-danger[aria-disabled="true"] { cursor: progress; }

    /* Images (F16). */
    .media-strip-summary { flex-basis: 100%; margin: 0; font-size: 12px; color: var(--color-text-secondary); }
    .media-strip-count { font-size: 12px; color: var(--color-text-secondary); }
    .media-lightbox-footer { padding: 10px 16px 4px; border-top: 1px solid var(--color-border-primary); }
    .media-lightbox-facts { display: flex; flex-wrap: wrap; gap: 4px 0; margin: 0; font-size: 13px; color: var(--color-text-primary); font-variant-numeric: tabular-nums; }
    .media-lightbox-facts > span + span::before { content: '·'; padding: 0 8px; color: var(--color-text-secondary); }
    .media-lightbox-inspection { margin: 2px 0 0; font-size: 12px; color: var(--color-text-secondary); }
    .media-lightbox-close.modal-close-btn { width: 44px; height: 44px; border-color: var(--color-border-control); }
    .media-lightbox-frame img { max-height: 72vh; }

    /* Error card (F10). */
    .viewer-error-page { flex: 1; min-height: 0; overflow-y: auto; display: flex; align-items: flex-start; justify-content: center; padding: 64px 16px; }
    .viewer-error-card { width: 100%; max-width: 600px; }
    .viewer-error-eyebrow { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--color-accent-error); }
    .viewer-error-card h2 { margin-bottom: 10px; font-size: 26px; line-height: 1.25; color: var(--color-text-title); }
    .viewer-error-body { margin-bottom: 20px; color: var(--color-text-secondary); line-height: 1.6; }
    .viewer-error-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
    .viewer-error-details-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--color-border-primary); }
    .viewer-error-details { flex: 1; min-width: 0; }
    .viewer-error-details summary { display: list-item; min-height: 36px; line-height: 36px; color: var(--color-text-primary); cursor: pointer; }
    .viewer-error-details pre { max-height: 260px; margin-top: 8px; padding: 10px; overflow: auto; border-radius: 6px; background: var(--color-bg-primary); color: var(--color-text-secondary); font-family: var(--font-terminal); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
    .viewer-error-copy { min-height: 36px; flex-shrink: 0; }

    /* Phone: the project picker as its icon, its list and the menus inside the window. */
    @media (max-width: 767px) {
      .project-picker-trigger { justify-content: center; width: 44px; height: 44px; padding: 0; }
      .project-picker-value { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
      .project-picker-popover { position: fixed; top: 60px; left: 12px; right: 12px; width: auto; }
      .menu-popover { max-height: calc(100dvh - 72px); }
    }
    /* ==== Phase 10 · settings (fields, terminal preview) ==== */
    /* Settings (F3, F8, F24): a section list on the left and one section at a time; the preview on the right with
       the Agent and Project it previews above it; a footer that says whether anything is unsaved. Edges of fields,
       switches and the dimmed Save use --color-border-control (3:1); text uses the 4.5:1 text tokens. */
    .form-field-label { font-size: 13px; font-weight: 600; line-height: 1.45; color: var(--color-text-primary); }
    .field-error { display: flex; align-items: flex-start; gap: 6px; margin: 0; font-size: 13px; line-height: 1.45; color: var(--color-accent-error); }
    .field-error svg { flex-shrink: 0; margin-top: 2px; }
    .field-help { display: flex; flex-direction: column; gap: 4px; max-width: 65ch; font-size: 12px; line-height: 1.5; color: var(--color-text-secondary); overflow-wrap: anywhere; }
    .field-help code { font-family: var(--font-terminal); font-size: 12px; }
    .field-secret { position: relative; display: flex; }
    .field-secret-toggle { position: absolute; top: 0; right: 0; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 0; border-left: 1px solid var(--color-border-control); border-radius: 0 6px 6px 0; background: transparent; color: var(--color-text-secondary); }
    .field-secret-toggle:hover:not(:disabled) { background: var(--color-bg-control-hover); color: var(--color-text-primary); }
    .field-secret-toggle[aria-pressed="true"] { color: var(--color-accent-primary); }
    .field-readonly { position: relative; display: flex; align-items: center; }
    .field-readonly > svg { position: absolute; left: 12px; color: var(--color-text-secondary); pointer-events: none; }
    .toggle-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
    .toggle-label { font-size: 13px; font-weight: 600; line-height: 1.45; color: var(--color-text-primary); cursor: pointer; }
    .toggle-switch { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; min-height: 36px; padding: 0 4px; border: 0; border-radius: 6px; background: transparent; color: var(--color-text-primary); }
    .toggle-switch:hover:not(:disabled) { background: transparent; }
    .toggle-track { position: relative; display: inline-block; flex-shrink: 0; width: 40px; height: 22px; border: 1px solid var(--color-border-control); border-radius: 999px; background: var(--color-bg-card); transition: background-color .15s ease, border-color .15s ease; }
    .toggle-switch:hover:not(:disabled) .toggle-track { border-color: var(--color-border-focus); }
    .toggle-knob { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 999px; background: var(--color-text-secondary); transition: transform .15s ease; }
    .toggle-switch.on .toggle-track { border-color: var(--color-bg-button); background: var(--color-bg-button); }
    .toggle-switch.on .toggle-knob { transform: translateX(18px); background: var(--color-text-button); }
    .toggle-word { min-width: 3ch; font-size: 13px; font-weight: 600; color: var(--color-text-secondary); text-align: left; }
    .toggle-switch.on .toggle-word { color: var(--color-text-primary); }
    .subsection-label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--color-text-secondary); }
    /* The preview is a well in the page colour; --color-log-* and the text tokens are its ANSI palette (TerminalPreview.tsx). */
    .settings-error-details { margin-top: 4px; color: var(--color-text-secondary); }
    .settings-error-details summary { display: inline-flex; align-items: center; min-height: 36px; cursor: pointer; font-size: 13px; }
    /* A save's cause is cut at 240 characters before it gets here (SAVE_ERROR_MAX_CHARS, utils/save-error.ts). The
       longest, with its "✗ Error: " prefix, takes 144px (eight 16px lines) in the 390px footer and 48px at 1440
       (measured 2026-11-16), so 160px shows it whole; only a longer text scrolls inside the box, and none is cut. */
    .settings-error-details pre { max-height: 160px; margin-top: 4px; padding: 8px 10px; overflow: auto; border-radius: 6px; background: var(--color-bg-card); font-family: var(--font-terminal); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
    @media (pointer: coarse), (max-width: 767px) {
      .field-secret-toggle { width: 44px; height: 44px; }
      .toggle-switch, .settings-error-details summary { min-height: 44px; }
    }
    /* ==== end of Phase 10 blocks ==== */
    /* Touch: every control at least 44px tall (WCAG 2.5.5 / UI UX Pro Max touch-target-size). */
    @media (pointer: coarse), (max-width: 767px) {
      .theme-toggle-btn, .menu-trigger, .card-delete-btn { width: 44px; height: 44px; min-width: 44px; }
      .view-mode-toggle, .menu-item, .inline-confirm button, .memory-page-notices button, .link-button, .short-time, .project-picker-option, .github-stars-btn, .project-picker-search, .viewer-error-copy { min-height: 44px; }
      .project-picker-search { height: 44px; }
      .viewer-error-details summary { min-height: 44px; line-height: 44px; }
    }
    /* Fields on a touch screen read 16px: iOS Safari zooms the whole page into a focused field whose text is under 16px.
       :root and :not() lift this over the dialog's and the search fields' own sizes (0,2,1), and it comes last. */
    @media (pointer: coarse), (max-width: 767px) {
      :root :is(input, select, textarea):not([type="checkbox"], [type="radio"], [type="range"]) { font-size: 16px; }
    }

    /* ==========================================================================
       Memory design pass (My Work design pass, Phase 11): the bar, the page and the parts every Memory page shares.
       Codex's layouts (codex-astra/.review/design.css): .global, .pagehead, .crumbs, .tabs, .toolbar, .searchbox, .btn,
       .textbtn, .icbtn, .listrow, .rowtitle, .rowmeta, .sketch-icon, .sectionline, .panel, .formrow; My Work's bar sizes.
       Every class here starts with mem-. A page's own rules go in its block below.
       ========================================================================== */
    body { font-family: var(--font-sans); font-size: 16px; line-height: var(--theme-line-height, 1.54); -webkit-font-smoothing: antialiased; }
    .mem-bar a:focus-visible, .mem-bar button:focus-visible, .mem-bottom-bar a:focus-visible, .mem-page a:focus-visible,
    .mem-page button:focus-visible, .mem-page select:focus-visible, .mem-page input:focus-visible, .mem-page summary:focus-visible {
      outline: 3px solid var(--color-accent-focus); outline-offset: 4px;
    }

    /* The bar: the brain mark and its name, My Work's places, Find work, Memory (the page shown) and "…". */
    .mem-bar { position: relative; z-index: 30; flex: none; height: 72px; background: var(--color-bg-header); border-bottom: 1px solid var(--color-border-primary); }
    .mem-bar-inner { display: flex; align-items: center; gap: 30px; height: 100%; max-width: 1380px; margin: 0 auto; padding: 0 46px; }
    .mem-brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; flex: none; border-radius: 8px; color: var(--color-text-primary); font-size: 22px; font-weight: 660; letter-spacing: -0.058em; line-height: 1; text-decoration: none; white-space: nowrap; }
    .mem-brand svg { width: 34px; height: 33px; flex: none; color: var(--color-brand-mark); }
    .mem-places { display: flex; align-items: center; gap: 4px; }
    .mem-place { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 13px; border-bottom: 2px solid transparent; border-radius: 8px; color: var(--color-text-secondary); font-size: 15px; font-weight: 550; text-decoration: none; white-space: nowrap; }
    .mem-place:hover, .mem-findwork:hover, .mem-memory-link:hover, .mem-bottom-place:hover { background: var(--color-bg-control-hover); color: var(--color-text-primary); }
    .mem-bar-tools { display: flex; align-items: center; gap: 12px; margin-left: auto; }
    .mem-findwork { display: inline-flex; align-items: center; gap: 16px; min-height: 44px; padding: 0 10px 0 12px; border: 1px solid var(--color-border-primary); border-radius: 8px; background: var(--color-bg-primary); color: var(--color-text-secondary); font-size: 14px; text-decoration: none; white-space: nowrap; }
    .mem-findwork kbd { padding: 1px 4px; border: 1px solid var(--color-border-primary); border-radius: 4px; color: var(--color-text-secondary); font-family: var(--font-terminal); font-size: 12px; }
    .mem-bar-divider { width: 1px; height: 24px; flex: none; background: var(--color-border-primary); }
    .mem-memory-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px; border-bottom: 2px solid transparent; border-radius: 8px; color: var(--color-text-secondary); font-size: 14px; text-decoration: none; white-space: nowrap; }
    /* The page shown: green tint and words, and a 2px edge along its foot (more than colour, WCAG 1.4.1), as in My Work's bar. */
    .mem-place[aria-current="page"], .mem-memory-link[aria-current="page"], .mem-bottom-place[aria-current="page"] {
      border-bottom-color: var(--color-tone-green); background: var(--color-tone-green-bg); color: var(--color-tone-green);
    }
    .mem-bar svg, .mem-bottom-bar svg { flex: none; }
    .mem-bar .header-more { width: 44px; height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--color-text-secondary); }
    .mem-bar .header-more:hover:not(:disabled), .mem-bar .header-more[aria-expanded="true"] { background: var(--color-bg-control-hover); color: var(--color-text-primary); }
    .mem-bottom-bar { display: none; }

    /* A page: its own scroll box under the bar, Codex's 1064px column (a reading page 900px). */
    .mem-scroll { flex: 1; min-height: 0; overflow-y: auto; }
    .mem-page { max-width: 1064px; margin: 0 auto; padding: 46px 56px 64px; }
    .mem-page--reading { max-width: 900px; }
    .mem-pagehead { margin: 0 0 32px; }
    .mem-title { margin: 0; color: var(--color-text-primary); font-size: clamp(38px, 3.55vw, 53px); font-weight: 575; line-height: 1.13; letter-spacing: -0.052em; overflow-wrap: anywhere; text-wrap: pretty; }
    /* A page's heading takes focus after an in-app page change (App.tsx), so the next Tab starts in the page; it is not a
       control, so it draws no focus ring (the controls after it do). */
    .mem-title[tabindex="-1"]:focus { outline: none; }
    .mem-leadtext { max-width: 65ch; margin: 10px 0 0; color: var(--color-text-secondary); font-size: 18px; line-height: 1.53; }
    .mem-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -10px 0 18px; color: var(--color-text-secondary); font-size: 14px; }
    .mem-crumbs ol { display: contents; list-style: none; }
    .mem-crumbs li { display: inline-flex; align-items: center; gap: 8px; }
    .mem-crumbs a, .mem-crumbs [aria-current="page"] { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; border-radius: 8px; color: inherit; text-decoration: none; }
    .mem-crumbs a:hover { color: var(--color-accent-primary); }
    .mem-crumbs [aria-current="page"] { color: var(--color-text-primary); }
    .mem-tabs { display: flex; flex-wrap: wrap; align-items: stretch; gap: 19px; margin: 20px 0 22px; border-bottom: 1px solid var(--color-border-primary); }
    .mem-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: -1px; padding: 6px 2px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--color-text-secondary); font: inherit; font-size: 15px; font-weight: 540; text-decoration: none; cursor: pointer; }
    .mem-tab:hover:not(:disabled) { background: none; color: var(--color-accent-primary); }
    .mem-tab[aria-current="page"], .mem-tab[aria-selected="true"], .mem-tab[aria-pressed="true"] { border-bottom-color: var(--color-accent-primary); color: var(--color-accent-primary); }
    .mem-tagnum { padding: 2px 6px; border-radius: 4px; background: var(--color-bg-secondary); color: var(--color-text-secondary); font-size: 13px; line-height: 1.2; font-variant-numeric: tabular-nums; }
    .mem-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 18px; }
    .mem-search { display: flex; flex: 1; align-items: center; gap: 12px; min-width: 0; min-height: 46px; padding: 0 13px; border: 1px solid var(--color-border-control); border-radius: 10px; background: var(--color-bg-card); color: var(--color-text-secondary); }
    .mem-search input { flex: 1; width: 100%; min-width: 0; padding: 9px 0; border: 0; background: transparent; color: var(--color-text-primary); font: inherit; font-size: 16px; outline: none; }
    .mem-search input::placeholder { color: var(--color-text-secondary); opacity: 1; }
    .mem-search:focus-within { outline: 3px solid var(--color-accent-focus); outline-offset: 2px; }
    .mem-page .mem-search input:focus-visible { outline: none; }
    .mem-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 16px; border: 1px solid var(--color-border-control); border-radius: 8px; background: var(--color-bg-card); box-shadow: var(--shadow-panel); color: var(--color-text-primary); font: inherit; font-size: 15px; font-weight: 570; line-height: 1.2; text-decoration: none; white-space: nowrap; cursor: pointer; }
    .mem-btn:hover:not(:disabled) { background: var(--color-bg-control-hover); }
    .mem-btn--primary { border-color: var(--color-bg-button); background: var(--color-bg-button); color: var(--color-text-button); }
    .mem-btn--primary:hover:not(:disabled) { background: var(--color-bg-button-hover); }
    .mem-btn:disabled, .mem-textbtn:disabled { cursor: not-allowed; opacity: 0.65; }
    .mem-textbtn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 5px; border: 0; border-radius: 8px; background: none; color: var(--color-accent-primary); font: inherit; font-size: 15px; font-weight: 570; text-decoration: none; cursor: pointer; }
    .mem-textbtn:hover:not(:disabled) { background: var(--color-tone-green-bg); }
    .mem-iconbtn { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--color-text-secondary); cursor: pointer; }
    .mem-iconbtn:hover:not(:disabled) { background: var(--color-bg-control-hover); color: var(--color-text-primary); }
    .mem-select { min-height: 44px; max-width: 100%; padding: 8px 10px; border: 1px solid var(--color-border-control); border-radius: 8px; background: var(--color-bg-primary); color: var(--color-text-primary); font: inherit; font-size: 16px; }
    .mem-checkline { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
    .mem-checkline input { width: 19px; height: 19px; flex: none; accent-color: var(--color-accent-primary); }

    /* A heading over rows (a day, "29 memories") with its count at the right. */
    .mem-sectionline { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 15px; }
    .mem-section-title { margin: 0; color: var(--color-text-primary); font-size: 26px; font-weight: 575; line-height: 1.13; letter-spacing: -0.043em; }
    .mem-legend { color: var(--color-text-secondary); font-size: 14px; font-weight: 540; line-height: 1.44; white-space: nowrap; font-variant-numeric: tabular-nums; }

    /* One row: a mark, the title with its facts under it, what sits at its end, the chevron. */
    .mem-row { display: flex; align-items: center; gap: 16px; width: 100%; min-width: 0; padding: 17px 4px; border: 0; border-bottom: 1px solid var(--color-border-secondary); border-radius: 2px; background: none; color: inherit; font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
    .mem-row:hover:not(:disabled) { background: var(--color-bg-control-hover); }
    .mem-row-body { flex: 1; min-width: 0; }
    .mem-row-title { color: var(--color-text-primary); font-size: 17px; font-weight: 565; line-height: 1.35; letter-spacing: -0.016em; overflow-wrap: anywhere; }
    .mem-row-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; color: var(--color-text-secondary); font-size: 14px; line-height: 1.42; }
    .mem-row-meta > * { min-width: 0; overflow-wrap: anywhere; }
    .mem-sep { color: var(--color-text-tertiary); }
    .mem-row-end { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; color: var(--color-text-secondary); font-size: 14px; white-space: nowrap; font-variant-numeric: tabular-nums; }
    .mem-chev { flex: none; width: 18px; height: 18px; color: var(--color-text-tertiary); }
    .mem-time { flex: none; width: 76px; padding-top: 1px; color: var(--color-text-secondary); font-size: 14px; font-variant-numeric: tabular-nums; }
    .mem-row--record { align-items: flex-start; }
    .mem-mark { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 10px; background: var(--color-bg-secondary); color: var(--color-text-secondary); }
    .mem-mark svg { width: 20px; height: 20px; }
    .mem-row--record .mem-mark { width: 33px; height: 33px; border-radius: 8px; }
    .mem-row--record .mem-mark svg { width: 18px; height: 18px; }
    .mem-mark[data-tone="green"] { background: var(--color-tone-green-bg); color: var(--color-tone-green); }
    .mem-mark[data-tone="blue"] { background: var(--color-tone-blue-bg); color: var(--color-tone-blue); }
    .mem-mark[data-tone="purple"] { background: var(--color-tone-purple-bg); color: var(--color-tone-purple); }
    .mem-mark[data-tone="amber"] { background: var(--color-tone-amber-bg); color: var(--color-tone-amber); }
    .mem-mark[data-tone="brand"] { background: var(--color-tone-brand-bg); color: var(--color-tone-brand); }

    /* Panels, form rows, words. */
    .mem-panel { padding: 25px 28px; border: 1px solid var(--color-border-primary); border-radius: 14px; background: var(--color-bg-card); box-shadow: var(--shadow-panel); }
    .mem-panel-title { margin: 0; color: var(--color-text-primary); font-size: 28px; font-weight: 575; line-height: 1.13; letter-spacing: -0.043em; }
    .mem-formrow { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 54px; padding: 13px 0; border-bottom: 1px solid var(--color-border-secondary); }
    .mem-formrow:last-child { border-bottom: 0; }
    .mem-footeracts { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 22px; }
    .mem-meta { color: var(--color-text-secondary); font-size: 14px; line-height: 1.44; }
    .mem-code { font-family: var(--font-terminal); font-size: 14px; overflow-wrap: anywhere; }

    /* The end of a list (loading, empty, failed with Retry, the end line), the search note and the All projects picker in a
       toolbar: the timeline's, also used by the Sessions list and a session's page. */
    .mem-toolbar .project-picker { flex: none; }
    .mem-toolbar .project-picker-trigger { width: auto; max-width: 280px; height: auto; font-size: 15px; text-align: left; }
    .mem-toolbar .project-picker--filtered .project-picker-trigger, .mem-types-trigger--chosen { border-color: var(--color-accent-primary); color: var(--color-accent-primary); }
    .mem-toolbar .project-picker-popover { left: 0; right: auto; top: calc(100% + 6px); }
    .mem-find-note { margin: -6px 0 18px; }
    .mem-ending { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 20px 0; color: var(--color-text-secondary); font-size: 14px; }
    .mem-ending--failed { align-items: flex-start; justify-content: flex-start; margin-top: 16px; padding: 16px 18px; border: 1px solid var(--color-border-primary); border-radius: 14px; background: var(--color-bg-card); color: var(--color-text-primary); }
    .mem-ending--failed > svg { flex: none; margin-top: 3px; color: var(--color-log-warn); }
    .mem-ending-text { flex: 1; min-width: 0; }
    .mem-ending-plain { margin: 0; font-size: 15px; }
    .mem-ending-details summary { display: inline-flex; align-items: center; min-height: 44px; color: var(--color-text-secondary); font-size: 14px; cursor: pointer; }
    .mem-ending-details pre { margin: 0; color: var(--color-text-secondary); font-family: var(--font-terminal); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
    .mem-ending--end::before, .mem-ending--end::after { content: ''; flex: 1; height: 1px; background: var(--color-border-primary); }
    .mem-sentinel { height: 20px; margin: 10px 0; }
    .mem-empty { display: grid; justify-items: center; gap: 8px; margin-top: 16px; text-align: center; }
    .mem-empty-title { margin: 6px 0 0; color: var(--color-text-primary); font-size: 22px; font-weight: 575; line-height: 1.2; letter-spacing: -0.03em; }
    .mem-empty .mem-meta { max-width: 52ch; margin: 0; }
    .mem-empty .mem-footeracts { justify-content: center; margin-top: 10px; }

    /* Narrow desktop: Find work keeps its mark (its words from 1280px, as in My Work's bar), the bar's narrow sizes below 1024px. */
    @media (max-width: 1279px) {
      .mem-findwork { gap: 0; padding: 0 12px; }
      .mem-findwork kbd, .mem-bar-divider { display: none; }
      .mem-findwork-words { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    }
    @media (max-width: 1023px) {
      .mem-bar-inner { gap: 16px; padding: 0 26px; }
      .mem-brand { font-size: 20px; }
      .mem-brand svg { width: 28px; height: 27px; }
      .mem-place { padding: 8px; font-size: 14px; }
      .mem-bar-tools { gap: 4px; }
      .mem-memory-link-words { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    }
    /* Phone: the places move to a bottom bar under the page; the top keeps the mark, Find work's mark and "…". */
    @media (max-width: 767px) {
      .mem-bar { height: 57px; }
      .mem-bar-inner { gap: 8px; padding: 0 18px; }
      .mem-places, .mem-memory-link { display: none; }
      .mem-bar-tools { gap: 2px; }
      .mem-findwork { justify-content: center; width: 44px; padding: 0; border: 0; background: none; }
      /* The foot of #root's column, under the page's scroll box (PlaceBottomBar is drawn after the page). */
      .mem-bottom-bar { display: grid; flex: none; margin-top: auto; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; min-height: 63px; padding: 4px 8px max(5px, env(safe-area-inset-bottom)); border-top: 1px solid var(--color-border-primary); background: var(--color-bg-header); }
      .mem-bottom-place { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 44px; border-bottom: 2px solid transparent; border-radius: 8px; color: var(--color-text-secondary); font-size: 12px; font-weight: 555; text-decoration: none; }
      .mem-bottom-place span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
      .mem-page { padding: 24px 18px 32px; }
      .mem-pagehead { margin-bottom: 18px; }
      .mem-title { font-size: 34px; letter-spacing: -0.048em; }
      .mem-leadtext { margin-top: 8px; font-size: 16px; line-height: 1.52; }
      .mem-crumbs { gap: 4px; margin: -10px 0 8px; font-size: 13px; }
      .mem-crumbs a, .mem-crumbs [aria-current="page"] { min-height: 44px; }
      .mem-tabs { gap: 11px; margin: 14px 0 16px; }
      .mem-tab { gap: 4px; font-size: 14px; }
      .mem-tagnum { font-size: 12px; }
      .mem-toolbar { gap: 7px; margin-bottom: 14px; }
      .mem-toolbar .mem-search { flex: 1 1 100%; }
      .mem-btn { padding: 9px 12px; }
      .mem-textbtn { padding: 8px 4px; }
      .mem-section-title { font-size: 22px; }
      .mem-legend { font-size: 13px; }
      .mem-row { gap: 8px; padding: 13px 2px; }
      .mem-row-title { font-size: 16px; }
      .mem-row-meta { gap: 5px; font-size: 13px; }
      .mem-row-end { gap: 4px; font-size: 13px; }
      .mem-time { width: 53px; font-size: 13px; }
      .mem-row--record .mem-mark { display: none; }
      .mem-panel { padding: 18px; }
      .mem-panel-title { font-size: 24px; }
      .mem-formrow { gap: 10px; }
    }
    @media (pointer: coarse) {
      .mem-crumbs a, .mem-crumbs [aria-current="page"] { min-height: 44px; }
    }

    /* ==== Phase 11 · timeline (Feed, record rows, filters, welcome) ==== */
    /* The timeline's scroll box (Feed): the pinned bar inside it sticks to its top. scroll-padding-top is the room the
       bar takes (10px + 46px + 8px; .mem-position-bar); an opening record row reads it to stay clear of the bar. */
    .mem-feed { position: relative; scroll-padding-top: 64px; }

    /* The find box, All projects and All types (Codex's toolbar); the note under it while a search or a type is on. */
    .mem-toolbar .menu-trigger.mem-btn { width: auto; height: auto; padding: 9px 16px; }
    .mem-types-value { overflow: hidden; text-overflow: ellipsis; }
    .mem-types-menu { min-width: 260px; }
    .mem-types-count { margin: 4px 10px 6px; color: var(--color-text-secondary); font-size: 13px; font-variant-numeric: tabular-nums; }
    .mem-types-item .menu-item-hint { font-family: var(--font-terminal); font-size: 13px; }

    /* The welcome panel and the Cloud Sync offer, above the toolbar (Codex's .welcome). */
    .mem-welcome, .mem-gift { display: flex; align-items: flex-start; gap: 18px; margin: 0 0 25px; }
    .mem-welcome:focus { outline: none; }
    .mem-welcome:focus-visible { outline: 3px solid var(--color-accent-focus); outline-offset: 4px; }
    .mem-welcome-body, .mem-gift-body { flex: 1; min-width: 0; }
    .mem-welcome-title, .mem-gift-title { margin: 0 0 5px; color: var(--color-text-primary); font-size: 24px; font-weight: 575; line-height: 1.2; letter-spacing: -0.043em; }
    .mem-welcome-text, .mem-gift-text { max-width: 65ch; margin: 0; color: var(--color-text-secondary); font-size: 16px; line-height: 1.53; }
    .mem-welcome-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 8px; }
    .mem-gift-body .mem-textbtn { margin-top: 6px; }
    .mem-welcome > .mem-iconbtn, .mem-gift > .mem-iconbtn { margin: -6px -8px 0 auto; }

    /* A day's heading over its rows; the first says how many memories are loaded. */
    .mem-record-day { margin: 34px 0 0; padding-bottom: 15px; border-bottom: 1px solid var(--color-border-primary); }
    .mem-record-day--first { margin-top: 6px; }

    /* One record (RecordRow): the row's button, then what it opens in place. The rule sits under the whole record. */
    .mem-record { border-bottom: 1px solid var(--color-border-secondary); }
    .mem-record .mem-record-row { border-bottom: 0; }
    .mem-record-row .mem-row-title { display: block; }
    .mem-record--prompt .mem-row-title { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
    .mem-record-row .mem-time { padding-top: 2px; }
    .mem-record-row:focus-visible { outline-offset: -3px; }
    .mem-record-chev { display: inline-flex; margin-top: 2px; transition: transform 0.15s ease; }
    .mem-record--open .mem-record-chev { transform: rotate(90deg); color: var(--color-text-secondary); }
    .mem-record--open .mem-record-row { background: var(--color-bg-control-hover); }
    .mem-record-details { display: grid; gap: 20px; padding: 6px 4px 24px 145px; }
    .mem-record-lead { max-width: 72ch; margin: 0; color: var(--color-text-secondary); font-size: 16px; line-height: 1.53; overflow-wrap: anywhere; }
    .mem-record-section { min-width: 0; }
    .mem-record-sectionline { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
    .mem-record-heading { margin: 0; color: var(--color-text-primary); font-size: 17px; font-weight: 575; line-height: 1.35; letter-spacing: -0.016em; }
    .mem-record-facts { display: grid; gap: 6px; max-width: 75ch; margin: 0; padding-left: 20px; color: var(--color-text-primary); font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
    .mem-record-text { max-width: 75ch; margin: 0; color: var(--color-text-primary); font-size: 15px; line-height: 1.6; white-space: pre-line; overflow-wrap: anywhere; }
    .mem-record-prompt { white-space: pre-wrap; }
    .mem-record-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
    .mem-record-chips li { padding: 2px 8px; border: 1px solid var(--color-border-primary); border-radius: 4px; color: var(--color-text-secondary); font-size: 13px; }
    .mem-record-files { margin: 0 0 4px; color: var(--color-text-secondary); font-family: var(--font-terminal); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
    .mem-record-files-label { color: var(--color-text-primary); }
    .mem-record-repeats { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
    .mem-record-repeats li { display: grid; gap: 2px; }
    .mem-record-repeat-text { color: var(--color-text-primary); font-size: 15px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
    .mem-record-stamp { display: flex; flex-wrap: wrap; gap: 4px 7px; margin: 0; }
    .mem-record-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin-top: -8px; }
    .mem-record-actions .menu-trigger.mem-textbtn { width: auto; height: auto; padding: 8px 5px; border: 0; background: none; color: var(--color-accent-primary); }
    .mem-record-actions .menu-trigger.mem-textbtn:hover:not(:disabled), .mem-record-actions .menu-button--open .menu-trigger { background: var(--color-tone-green-bg); }
    .mem-record-actions .copy-button.mem-textbtn { color: var(--color-accent-primary); }
    .mem-record-delete { padding: 0 4px 16px 145px; }
    .mem-record-delete .inline-confirm, .mem-record-delete .card-delete-error { margin-top: 0; }
    .mem-record-delete .inline-confirm button { min-height: 44px; }

    /* The pinned bar: the row at the top's day and time, its place, Top. */
    .mem-position { position: sticky; top: 0; z-index: 30; height: 0; }
    .mem-position-bar { position: absolute; top: 10px; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: 4px 4px 4px 14px; border: 1px solid var(--color-border-primary); border-radius: 10px; background: var(--color-bg-header); box-shadow: var(--shadow-panel); color: var(--color-text-secondary); font-size: 14px; }
    .mem-position-bar[hidden] { display: none; }
    .mem-position-when { color: var(--color-text-primary); font-weight: 560; font-variant-numeric: tabular-nums; white-space: nowrap; }
    .mem-position-count { flex: 1; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
    .mem-btn.mem-position-top { min-height: 36px; padding: 6px 12px; box-shadow: none; font-size: 14px; }

    /* The day rail along the right edge of a wide window: where each loaded day starts, and where the reader is. */
    .mem-dayrail { position: fixed; top: 112px; bottom: 96px; right: 16px; z-index: 20; width: 72px; border-right: 1px solid var(--color-border-primary); }
    .mem-dayrail-mark { position: absolute; right: 6px; min-height: 24px; padding: 0 4px; transform: translateY(-50%); border: 0; border-radius: 4px; background: transparent; color: var(--color-text-secondary); font: inherit; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; cursor: pointer; }
    .mem-dayrail-mark:hover:not(:disabled) { background: var(--color-bg-control-hover); color: var(--color-text-primary); }
    .mem-dayrail-mark:focus-visible { outline: 3px solid var(--color-accent-focus); outline-offset: 0; }
    .mem-dayrail-more { margin-left: 4px; color: var(--color-text-tertiary); }
    .mem-dayrail-here { position: absolute; right: -2px; width: 3px; height: 16px; border-radius: 999px; background: var(--color-accent-primary); }

    /* Top at the window's foot, on a wide window only (the pinned bar has Top at every width). */
    .mem-totop { position: fixed; right: 24px; bottom: 24px; z-index: 50; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--color-border-control); border-radius: 999px; background: var(--color-bg-card); box-shadow: var(--shadow-panel); color: var(--color-text-secondary); cursor: pointer; }
    .mem-totop:hover:not(:disabled) { background: var(--color-bg-control-hover); color: var(--color-text-primary); }
    .mem-totop:focus-visible { outline: 3px solid var(--color-accent-focus); outline-offset: 4px; }

    /* The end of the list: placeholder rows, loading, the failed line with Retry, Load older, the end line, empty. */
    .mem-skeleton-row { display: flex; align-items: flex-start; gap: 16px; padding: 17px 4px; border-bottom: 1px solid var(--color-border-secondary); }
    .mem-skeleton-line { display: block; width: 100%; height: 12px; margin: 5px 0; border-radius: 4px; background: var(--color-skeleton-base); }
    .mem-skeleton-line--time { flex: none; width: 56px; margin-right: 20px; }
    .mem-skeleton-line--short { width: 38%; }
    .mem-skeleton-mark { flex: none; width: 33px; height: 33px; border-radius: 8px; background: var(--color-skeleton-base); }
    .mem-skeleton-body { flex: 1; min-width: 0; }

    @media (max-width: 1279px) {
      .mem-dayrail, .mem-totop { display: none; }
    }
    @media (max-width: 767px) {
      /* The older phone rules above draw this trigger as a 44px mark with its words hidden; here it keeps its words. */
      .mem-toolbar .project-picker-trigger { justify-content: flex-start; width: auto; max-width: 100%; height: auto; padding: 9px 12px; font-size: 14px; }
      .mem-toolbar .project-picker-value { position: static; width: auto; height: auto; clip-path: none; text-overflow: ellipsis; }
      .mem-toolbar .menu-trigger.mem-btn { padding: 9px 12px; font-size: 14px; }
      .mem-toolbar .project-picker, .mem-toolbar .menu-button { min-width: 0; }
      .mem-welcome, .mem-gift { gap: 11px; }
      .mem-welcome > .mem-mark { display: none; }
      .mem-welcome-title, .mem-gift-title { font-size: 22px; }
      .mem-welcome-actions { flex-direction: column; align-items: flex-start; gap: 4px; }
      .mem-record-day { margin-top: 22px; padding-bottom: 9px; }
      .mem-record-day--first { margin-top: 4px; }
      .mem-record-details, .mem-record-delete { padding-left: 2px; padding-right: 2px; }
      .mem-record-details { gap: 16px; }
      .mem-record-actions { gap: 4px 16px; }
      .mem-position-bar { gap: 8px; padding-left: 10px; font-size: 13px; }
      .mem-position-count { display: none; }
      .mem-position-when { flex: 1; overflow: hidden; text-overflow: ellipsis; }
      .mem-btn.mem-position-top { min-height: 44px; }
      .mem-skeleton-mark { display: none; }
      .mem-skeleton-line--time { width: 40px; margin-right: 10px; }
    }
    @media (pointer: coarse) {
      .mem-dayrail-mark { min-height: 44px; }
    }
    @media (prefers-reduced-motion: reduce) {
      .mem-record-chev { transition: none; }
    }
    /* ==== end Phase 11 · timeline ==== */

    /* ==== Phase 11 · sessions (list, one session) ==== */
    /* The Sessions list (SessionList, SessionCard; Codex's memory-sessions). A day's heading over its rows. */
    .mem-session-day { margin: 34px 0 0; padding-bottom: 15px; border-bottom: 1px solid var(--color-border-primary); }
    .mem-session-day--first { margin-top: 6px; }
    /* One session: the row's link, its "…" beside it (never inside it), the rule under both; a delete asks below. */
    .mem-session-row-main { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--color-border-secondary); }
    .mem-session-row-main > .mem-session-link { flex: 1; min-width: 0; border-bottom: 0; }
    .mem-session-row-main > .menu-button { flex: none; }
    .mem-session-link:focus-visible { outline-offset: -3px; }
    .mem-session-row--deleting .mem-session-link { opacity: 0.6; }
    /* Two lines at most (a summary request can run to 200 characters); the whole name is in its title and on the session's page. */
    .mem-session-name { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
    .mem-session-tool { text-transform: capitalize; }
    .mem-session-id { font-family: var(--font-terminal); font-size: 13px; font-variant-numeric: tabular-nums; }
    .mem-session-time { font-variant-numeric: tabular-nums; }
    .mem-session-row .inline-confirm, .mem-session-row .card-delete-error { margin: 8px 0 12px; }
    .mem-session-row .card-delete-error { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: none; }
    .mem-session-row .inline-confirm button { min-height: 44px; }
    .mem-sessions-more { flex-direction: column; gap: 8px; }
    .mem-sessions-loaded { font-variant-numeric: tabular-nums; }

    /* One session's page (SessionDetailPage; Codex's memory-session): the breadcrumb is its one way back. */
    .mem-session-crumb-here { flex: 1 1 0; min-width: 0; }
    .mem-session-crumb-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .mem-session-flag { display: flex; align-items: center; gap: 7px; margin: 0 0 8px; color: var(--color-text-secondary); font-size: 14px; font-weight: 580; }
    .mem-session-flag-mark { display: inline-flex; flex: none; }
    .mem-session-head { margin-bottom: 28px; }
    /* A name longer than two lines of the page heading (LONG_SESSION_TITLE_CHARS) reads at the phone's heading size. */
    .mem-session-title--long { font-size: 34px; letter-spacing: -0.048em; }
    .mem-session-lead { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
    .mem-session-lead .mem-session-id { font-size: inherit; }
    .mem-session-lead .short-time { min-height: 24px; padding: 0; color: inherit; font: inherit; }
    .mem-session-lead .short-time:focus-visible::after { right: auto; left: 0; }
    /* On touch the time span is a 44px target like every control (it is 24px, a text link's floor, on a desktop). */
    @media (pointer: coarse), (max-width: 767px) { .mem-session-lead .short-time { min-height: 44px; } }
    .mem-session-utility { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 0 0 34px; color: var(--color-text-secondary); font-size: 14px; }
    .mem-session-project { color: var(--color-text-secondary); font-size: 13px; }
    .mem-session-utility .mem-session-copy { font-size: 14px; }
    .mem-session-utility .copy-button svg { width: 18px; height: 18px; }

    @media (max-width: 767px) {
      .mem-session-day { margin-top: 22px; padding-bottom: 9px; }
      .mem-session-day--first { margin-top: 4px; }
      .mem-session-row-main { gap: 0; }
      /* The "…" sits at the row's end and the whole row is a link: the chevron gives its width to the name, three lines. */
      .mem-session-link .mem-chev { display: none; }
      .mem-session-name { -webkit-line-clamp: 3; }
      .mem-session-head { margin-bottom: 18px; }
      .mem-session-title--long { font-size: 24px; letter-spacing: -0.03em; }
      .mem-session-utility { flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 22px; }
    }
    /* ==== end Phase 11 · sessions ==== */

    /* ==== Phase 11 · settings (settings page, context preview) ==== */
    /* Memory settings (#/settings/<category>) and the saved context preview (#/context-preview), two pages in Codex's
       900px reading column (ContextSettingsModal.tsx SettingsPage, ContextPreviewPage.tsx). The categories are a column
       beside the fields on a desktop, with the preview link under them, and a select above the fields on a phone, with
       the preview link beside it; the fields sit in one panel as form rows. The field components keep their own classes
       (form-field, toggle-row, field-help…); this block sizes them for a page. */
    .settings-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px 36px; align-items: start; }
    .settings-side { display: flex; grid-column: 1; flex-direction: column; gap: 12px; position: sticky; top: 24px; }
    .settings-categories ul { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
    .settings-categories a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 8px 12px; border-radius: 8px; color: var(--color-text-secondary); font-size: 15px; font-weight: 550; text-decoration: none; }
    .settings-categories a:hover { background: var(--color-bg-control-hover); color: var(--color-text-primary); }
    /* The category shown: green tint and words, and a 3px edge at its start (more than colour, WCAG 1.4.1), as the bar's places. */
    .settings-categories a[aria-current="page"] { background: var(--color-tone-green-bg); box-shadow: inset 3px 0 0 var(--color-tone-green); color: var(--color-tone-green); font-weight: 620; }
    .settings-category-hint { color: var(--color-text-secondary); font-size: 13px; font-weight: 500; }
    .settings-categories a[aria-current="page"] .settings-category-hint { color: inherit; }
    .settings-category-select { display: none; }
    .settings-category-select label { color: var(--color-text-primary); }
    .settings-column { grid-column: 2; }

    /* One category: its heading, then a form row per field, a line between each. */
    .settings-category-panel { display: flex; flex-direction: column; }
    .settings-category-panel[hidden] { display: none; }
    .settings-category-heading { margin-bottom: 6px; }
    .settings-category-heading p { margin: 6px 0 0; color: var(--color-text-secondary); font-size: 15px; line-height: 1.5; }
    .settings-category-panel > :not(.settings-category-heading) { padding: 15px 0; border-top: 1px solid var(--color-border-secondary); }
    .settings-category-panel > .settings-category-heading + * { border-top: 0; }
    .settings-category-panel > :last-child { padding-bottom: 0; }
    .settings-page .form-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; }
    .settings-page .form-field-label, .settings-page .toggle-label { color: var(--color-text-primary); font-size: 16px; font-weight: 560; line-height: 1.4; }
    .settings-page .field-help, .settings-page .toggle-description { color: var(--color-text-secondary); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
    .settings-page .field-help code, .settings-page .toggle-description code { font-family: var(--font-terminal); font-size: 13px; }
    .settings-page .field-error { font-size: 14px; }
    .settings-page .form-field input, .settings-page .form-field select { width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid var(--color-border-control); border-radius: 8px; background: var(--color-bg-primary); color: var(--color-text-primary); font: inherit; font-size: 16px; }
    .settings-page .form-field input:hover, .settings-page .form-field select:hover { border-color: var(--color-border-focus); }
    .settings-page .form-field--error input { border-color: var(--color-accent-error); }
    /* A number: its name and help at the start, the field at the end of the row (Codex's formrow). */
    .settings-page .form-field:has(> input[type="number"]) { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 4px 20px; align-items: center; }
    .settings-page .form-field:has(> input[type="number"]) > .form-field-label { grid-column: 1; grid-row: 1; }
    .settings-page .form-field:has(> input[type="number"]) > input { grid-column: 2; grid-row: 1 / span 2; }
    .settings-page .form-field:has(> input[type="number"]) > .field-help { grid-column: 1; grid-row: 2; }
    .settings-page .form-field:has(> input[type="number"]) > .field-error { grid-column: 1 / -1; grid-row: 3; }
    .settings-page .field-secret input { padding-right: 52px; }
    .settings-page .field-secret-toggle { width: 44px; height: 44px; border-radius: 0 8px 8px 0; }
    .settings-page .field-readonly input { padding-left: 38px; border-style: dashed; background: transparent; color: var(--color-text-secondary); font-family: var(--font-terminal); font-size: 14px; }
    .settings-page .toggle-group { display: flex; flex-direction: column; }
    .settings-page .toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
    .settings-page .toggle-group > .toggle-row + .toggle-row { margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--color-border-secondary); }
    .settings-page .toggle-switch { min-height: 44px; }
    .settings-page .display-subsection { display: flex; flex-direction: column; gap: 15px; }

    /* "Saved context preview · Open preview →": one link from every category, in view at every width without scrolling
       (under the column, above the footer held at the foot of a 1440x844 window). Its sentence describes the link. */
    .settings-preview-link { padding: 12px 12px 0; border-top: 1px solid var(--color-border-secondary); }
    .settings-preview-link-title { margin: 0; color: var(--color-text-secondary); font-size: 14px; font-weight: 600; line-height: 1.35; }
    .settings-preview-link .mem-textbtn { margin-left: -5px; }

    /* Save, Cancel and the save state: at the foot of the window however long the category is, at rest after the page. */
    .settings-footer { position: sticky; bottom: 0; z-index: 2; margin-top: 28px; padding: 14px 0 16px; border-top: 1px solid var(--color-border-primary); background: var(--color-bg-primary); }
    .settings-footer .mem-footeracts { margin-top: 0; }
    .settings-footer-acts[hidden] { display: none; }
    .settings-footer .inline-confirm { margin: 0; }
    .settings-footer .inline-confirm-question { font-size: 15px; }
    .settings-footer .inline-confirm button { min-height: 44px; }
    .settings-page .settings-footer-state { display: flex; flex: 1 1 220px; flex-direction: column; gap: 4px; min-width: 0; }
    .settings-page .settings-changes { margin: 0; color: var(--color-text-secondary); font-size: 14px; }
    .settings-page .settings-changes--dirty { color: var(--color-text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }
    .settings-page .save-status { color: var(--color-text-secondary); font-size: 14px; }
    .settings-page .save-status .success { display: inline-flex; align-items: center; gap: 6px; color: var(--color-accent-success); }
    .settings-page .save-status .error { color: var(--color-accent-error); }
    .settings-page .save-status .error > .mem-btn { margin-left: 8px; }
    /* Save is dimmed until something changes, while saving and before the settings load; its words stay 4.5:1 (E8's lesson). */
    .settings-page .save-btn[aria-disabled="true"], .settings-page .save-btn[aria-disabled="true"]:hover:not(:disabled), .settings-page .save-btn:disabled { border-color: var(--color-border-control); background: var(--color-bg-card); box-shadow: none; color: var(--color-text-secondary); opacity: 1; cursor: not-allowed; }

    /* The saved context preview page: Source and Project as form rows, Wrap lines and Copy preview, the text in a box. */
    .context-preview-choices { margin-bottom: 18px; }
    .context-preview-choices label { color: var(--color-text-primary); }
    /* A native select is as wide as its longest choice (a source can run 45 characters), so both get a width. */
    .context-preview-choices .context-preview-source { width: min(50%, 240px); }
    .context-preview-choices .context-preview-project { width: min(70%, 440px); }
    .context-preview-tools { margin: 0 0 16px; }
    .context-preview-box { overflow: hidden; border: 1px solid var(--color-border-primary); border-radius: 14px; background: var(--color-bg-primary); }
    /* The preview's well is --color-bg-primary: its ANSI palette (TerminalPreview.tsx) is held to 4.5:1 on it. */
    .context-preview-text { margin: 0; padding: 24px; overflow-x: auto; background: var(--color-bg-primary); color: var(--color-text-primary); font-family: var(--font-terminal); font-size: 15px; line-height: 1.7; white-space: pre; }
    .context-preview-text--wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
    .context-preview-text:focus-visible { outline: 3px solid var(--color-accent-focus); outline-offset: -3px; }
    .context-preview-loading { padding: 24px; color: var(--color-text-secondary); font-family: var(--font-terminal); font-size: 14px; }
    .context-preview-note { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 24px; border-top: 1px solid var(--color-border-primary); background: var(--color-bg-card); color: var(--color-text-secondary); font-size: 14px; line-height: 1.45; }
    .context-preview-note > svg { flex: none; }
    .context-preview-note .mem-textbtn { font-size: 14px; }
    .context-preview-error { padding: 16px; border: 1px solid var(--color-border-control); border-radius: 10px; color: var(--color-accent-error); font-size: 15px; }

    @media (max-width: 1023px) {
      .settings-layout { grid-template-columns: 160px minmax(0, 1fr); gap: 20px 28px; }
    }
    /* Phone: the select takes the column's place above the fields (never a sideways strip), and the preview link is the
       row beside it, its name at the start and "Open preview" at the end, as the select's row. */
    @media (max-width: 767px) {
      .settings-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
      .settings-side { gap: 0; position: static; }
      .settings-categories { display: none; }
      .settings-category-select { display: flex; }
      .settings-column { grid-column: 1; }
      .settings-preview-link { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 54px; padding: 5px 0; border-top: 0; border-bottom: 1px solid var(--color-border-primary); }
      .settings-preview-link-title { color: var(--color-text-primary); font-size: 16px; font-weight: 400; }
      .settings-preview-link .mem-textbtn { margin: 0 -5px 0 0; }
      .settings-category-heading p { font-size: 14px; }
      .settings-page .form-field:has(> input[type="number"]) { grid-template-columns: minmax(0, 1fr) 100px; gap: 4px 12px; }
      .settings-footer { margin-top: 20px; padding: 10px 0 12px; }
      .settings-footer .mem-footeracts { gap: 4px 12px; }
      .settings-page .settings-footer-state { flex-basis: 120px; }
      .context-preview-choices .context-preview-source { width: min(60%, 240px); }
      .context-preview-choices .context-preview-project { width: 70%; }
      .context-preview-text { padding: 15px; font-size: 14px; }
      .context-preview-loading { padding: 15px; }
      .context-preview-note { padding: 10px 15px; }
    }
    /* ==== end Phase 11 · settings ==== */

    /* ==== Phase 11 · logs (logs page) ==== */
    /* Memory logs (#/logs, LogsPage.tsx; Codex's memory-logs layout and .loggrid). A full-height page: the heading,
       the first row (Find in logs, the severity control with its counts, Filter, Log actions) and the list, which fills
       the rest of the window and scrolls in its own box. Rows are recycled past 50, so every row is one fixed height
       (--mem-log-row), which the list measures: 48px on a desktop (Codex's 13px padding around a 21px line, and 44px
       or more on touch), 64px on a phone, where the message takes a line of its own under time, level and component. */
    .mem-logs-scroll { display: flex; flex-direction: column; }
    /* The columns: a time stamp (12 characters of Geist Mono at 14px), a level (5: DEBUG, ERROR), the longest
       component the logger writes (CHROMA_SYNC, 11), the message, the chevron. */
    .mem-logs { --mem-log-row: 48px; --mem-log-columns: 108px 64px 112px minmax(0, 1fr) 18px; display: flex; flex: 1 0 auto; flex-direction: column; width: 100%; padding-bottom: 24px; }
    .mem-logs-toolbar .mem-search { flex: 1 1 280px; }
    .mem-logs-levels { display: inline-flex; flex: none; align-items: stretch; gap: 2px; min-height: 46px; padding: 1px; border: 1px solid var(--color-border-control); border-radius: 10px; background: var(--color-bg-card); }
    .mem-logs-level { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--color-text-secondary); font: inherit; font-size: 15px; font-weight: 540; white-space: nowrap; cursor: pointer; }
    .mem-logs-level:hover:not(:disabled) { background: var(--color-bg-control-hover); color: var(--color-text-primary); }
    /* The chosen severity: green tint and words, and an edge around it (more than colour, WCAG 1.4.1). */
    .mem-logs-level[aria-checked="true"], .mem-logs-level[aria-checked="true"]:hover:not(:disabled) { background: var(--color-tone-green-bg); box-shadow: inset 0 0 0 1px var(--color-accent-primary); color: var(--color-accent-primary); }
    .mem-logs-level[aria-checked="true"] .mem-tagnum { background: var(--color-bg-card); color: var(--color-accent-primary); }
    .mem-logs-actions-wrap { display: flex; }
    /* "Log actions" is a worded button, not the 36px (44px on touch) square every other menu trigger is. */
    .mem-logs .mem-logs-actions.menu-trigger { width: auto; min-width: 0; height: auto; min-height: 44px; padding: 9px 16px; border-color: var(--color-border-control); border-radius: 8px; background: var(--color-bg-card); box-shadow: var(--shadow-panel); color: var(--color-text-primary); font-size: 15px; }
    .mem-logs .mem-logs-actions.menu-trigger:hover:not(:disabled), .mem-logs .menu-button--open .mem-logs-actions.menu-trigger { border-color: var(--color-border-control); background: var(--color-bg-control-hover); color: var(--color-text-primary); }
    .mem-logs-menu { min-width: 220px; }
    .mem-logs-clear[aria-disabled="true"] { opacity: 0.65; cursor: progress; }

    /* "Filter": the components and alignment only, while it is open. The panel follows the Filter button in the page
       (so Tab goes from Filter into it) and is drawn under the whole first row: last in the row's order, a line of
       its own. 8px over the row's 10px gap keeps the 18px between the first row and the panel. */
    .mem-logs-filters { display: grid; flex: 1 1 100%; order: 1; gap: 6px; margin: 8px 0 0; padding: 14px 18px; border: 1px solid var(--color-border-primary); border-radius: 10px; background: var(--color-bg-card); }
    .mem-logs-fieldset { min-width: 0; border: 0; }
    .mem-logs-fieldset legend { margin-bottom: 2px; color: var(--color-text-secondary); font-size: 14px; font-weight: 570; }
    .mem-logs-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0 16px; }
    .mem-logs-filters .mem-checkline { color: var(--color-text-primary); font-size: 15px; }
    .mem-logs-alignment { border-top: 1px solid var(--color-border-secondary); }

    .mem-logs-question { margin: 0 0 18px; }
    .mem-logs-question .inline-confirm { margin-top: 0; }
    .mem-logs-note { margin: 0 0 12px; color: var(--color-text-secondary); font-size: 14px; }
    .mem-logs-error { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 14px; padding: 10px 14px; border-left: 3px solid var(--color-accent-error); border-radius: 0 8px 8px 0; background: var(--color-bg-card); color: var(--color-accent-error); font-size: 14px; overflow-wrap: anywhere; }
    .mem-logs-error svg { flex: none; margin-top: 3px; }

    /* The list: column heads, then the rows in their own scroll box that fills the page. It never gets shorter than
       four rows, what Codex's phone mockup shows below its controls at 390x844; in a shorter window the page scrolls. */
    .mem-logs-head { display: grid; grid-template-columns: var(--mem-log-columns); column-gap: 14px; padding: 0 0 10px; border-bottom: 1px solid var(--color-border-primary); color: var(--color-text-primary); font-family: var(--font-terminal); font-size: 14px; }
    .mem-logs-list { flex: 1 1 0; min-height: calc(var(--mem-log-row) * 4); overflow-x: hidden; overflow-y: auto; overflow-anchor: none; }
    .mem-logs-state { padding: 28px 0; color: var(--color-text-secondary); font-size: 15px; }
    .mem-log-toggle { display: grid; grid-template-columns: var(--mem-log-columns); align-items: center; column-gap: 14px; width: 100%; height: var(--mem-log-row); padding: 0; overflow: hidden; border: 0; border-radius: 0; background: transparent; box-shadow: inset 0 -1px 0 var(--color-border-secondary); color: var(--color-text-primary); font-family: var(--font-terminal); font-size: 14px; line-height: 1.5; text-align: left; cursor: pointer; }
    .mem-log-toggle:hover:not(:disabled) { background: var(--color-bg-control-hover); }
    .mem-logs .mem-log-toggle:focus-visible { outline-offset: -3px; }
    /* An error row carries a faint red wash so 2 errors stand out among 900 lines; under the pointer it takes the plain hover. */
    .mem-log-row--error .mem-log-toggle { background: color-mix(in srgb, var(--color-log-error) 8%, transparent); }
    .mem-log-row--error .mem-log-toggle:hover:not(:disabled) { background: var(--color-bg-control-hover); }
    .mem-log-cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .mem-log-time { color: var(--color-text-secondary); font-variant-numeric: tabular-nums; }
    .mem-log-level { text-transform: capitalize; }
    .mem-log-level[data-level="DEBUG"] { color: var(--color-log-debug); }
    .mem-log-level[data-level="WARN"] { color: var(--color-log-warn); }
    .mem-log-level[data-level="ERROR"] { color: var(--color-log-error); font-weight: 600; }
    .mem-log-correlation { margin-right: 8px; color: var(--color-text-secondary); }
    .mem-log-message--success { color: var(--color-log-success); }
    .mem-log-message--failure { color: var(--color-log-error); }
    .mem-log-message--happyPath { color: var(--color-log-warn); }
    /* A stack or payload line under its record: starts at the time column and keeps its indentation. */
    .mem-log-continued { grid-column: 1 / -2; color: var(--color-text-secondary); white-space: pre; }
    /* Square, so the chevron turned a quarter for an open row stays inside its column; the row button clips the
       corners it sweeps on the way (.mem-log-toggle's overflow), so the turn never widens the list. */
    .mem-log-chev { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; color: var(--color-text-tertiary); transition: transform .15s ease; }
    .mem-log-row--open .mem-log-chev { transform: rotate(90deg); }
    .mem-log-details { padding: 10px 12px 14px; border-bottom: 1px solid var(--color-border-secondary); background: var(--color-bg-secondary); }
    .mem-log-full { margin: 0 0 10px; color: var(--color-text-primary); font-family: var(--font-terminal); font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
    @media (prefers-reduced-motion: reduce) {
      .mem-log-chev { transition: none; }
    }
    /* Phone: the search and the severity control each take the width, the three choices sharing it; Filter and Log
       actions share the next line; no column heads; a row is time, level and component over its message. */
    @media (max-width: 767px) {
      .mem-logs { --mem-log-row: 64px; padding-bottom: 12px; }
      .mem-logs-levels { flex: 1 1 100%; }
      /* Each choice grows from its own width, so "All levels 1,000" keeps one line; longer words wrap inside it. */
      .mem-logs-level { flex: 1 1 auto; flex-wrap: wrap; gap: 2px 4px; min-width: 0; padding: 0 4px; font-size: 14px; white-space: normal; }
      /* Filter and Log actions share a line in two equal halves. Equal 40% bases, not 0: a 0 base grows from the
         button's own padding, which only Filter has, so Filter came out 26px wider. Two 40% bases and the gap fit. */
      .mem-logs-filter, .mem-logs-actions-wrap { flex: 1 1 40%; min-width: 0; }
      .mem-logs-actions-wrap .menu-button { flex: 1; }
      .mem-logs .mem-logs-actions.menu-trigger, .mem-logs-filter { width: 100%; padding: 9px 12px; }
      .mem-logs-filters { padding: 10px 14px; }
      .mem-logs-head { display: none; }
      .mem-logs-list { border-top: 1px solid var(--color-border-primary); }
      .mem-log-toggle { grid-template-columns: auto auto minmax(0, 1fr) 18px; grid-template-rows: auto auto; align-content: center; gap: 4px 10px; font-size: 13px; }
      /* The message and a stack line span the time, level and component columns, which size to their words: their
         own width (up to 5,000 characters) must not count in those columns' widths, or the row runs off the screen. */
      .mem-log-text { grid-column: 1 / 4; grid-row: 2; font-size: 14px; contain: inline-size; }
      .mem-log-chev { grid-column: 4; grid-row: 1 / 3; }
      .mem-log-continued { grid-column: 1 / 4; grid-row: 1 / 3; contain: inline-size; }
    }
    @media (pointer: coarse), (max-width: 767px) {
      .mem-logs-level { min-height: 44px; }
    }
    /* ==== end Phase 11 · logs ==== */
  </style>
</head>

<body>
  <div id="root"></div>
  <script src="viewer-bundle.js"></script>
</body>

</html>