:root {
    /* Auto-compact threshold (cross-level landmark). Overridden at runtime
       by public/settings.js from /_api/settings.autoCompactPct. */
    --compact-threshold: 83.5%;
    --bg: #0d1117; --surface: #161b22; --surface-hover: #1c2129; --surface-active: #1a2535; --border: #30363d;
    --text: #e6edf3; --dim: #8b949e; --accent: #58a6ff;
    --green: #3fb950; --yellow: #d29922; --red: #f85149;
    --purple: #bc8cff; --orange: #f0883e;
    /* Context bar segments */
    --color-cache-read: #4dd0e1; --color-cache-write: #ff8a65; --color-input: #ce93d8;
    /* Section categories */
    --color-system: #1f6feb; --color-system-deep: #1158c7; --color-system-mid: #388bfd;
    --color-system-light: #58a6ff; --color-system-pale: #79c0ff; --color-system-muted: #3d5a8a;
    --color-system-soft: #5d80c8; --color-system-faint: #a5c8ff;
    --color-tools: #2ea043; --color-mcp-tools: #3fb950; --color-messages: #e3b341;
    /* Content types */
    --color-thinking: #ce93d8; --color-tool-use: #ff8a65; --color-tool-result: #4dd0e1;
    /* Diff */
    --color-diff-add: #56d364; --color-diff-del: #f85149;
  }
  [data-theme="light"] {
    --bg: #ffffff; --surface: #f6f8fa; --surface-hover: #eaeef2; --surface-active: #ddf4ff; --border: #d0d7de;
    --text: #1f2328; --dim: #656d76; --accent: #0969da;
    --green: #1a7f37; --yellow: #9a6700; --red: #d1242f;
    --purple: #8250df; --orange: #bc4c00;
    --color-cache-read: #0891b2; --color-cache-write: #c2410c; --color-input: #9333ea;
    --color-system: #0969da; --color-system-deep: #0550ae; --color-system-mid: #0969da;
    --color-system-light: #218bff; --color-system-pale: #54aeff; --color-system-muted: #3d5a8a;
    --color-system-soft: #3b82f6; --color-system-faint: #85b8ff;
    --color-tools: #1a7f37; --color-mcp-tools: #2da44e; --color-messages: #9a6700;
    --color-thinking: #8250df; --color-tool-use: #bc4c00; --color-tool-result: #0891b2;
    --color-diff-add: #1a7f37; --color-diff-del: #d1242f;
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  body {
    font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
    font-size: 13px; background: var(--bg); color: var(--text);
    height: 100vh; height: 100svh; display: flex; flex-direction: column; overflow: hidden; touch-action: manipulation;
  }

  /* ── Miller Columns Layout ── */
  #app { display: flex; flex-direction: column; height: 100vh; height: 100svh; overflow: hidden; }
  #topbar { border-bottom: 1px solid var(--border); flex-shrink: 0; }
  #topbar-row1 { display: flex; align-items: center; gap: 12px; padding: 6px 16px; }
  #topbar-row1 h1 { font-size: 15px; color: var(--accent); display: flex; align-items: center; gap: 8px; white-space: nowrap; margin: 0; }
  h1 .dot { width: 8px; height: 8px; background: var(--green); border-radius: 50%; animation: pulse 2s infinite; }
  @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
  #topbar-tabs { display: flex; gap: 2px; margin-left: 4px; }
  .topbar-tab { background: none; border: none; border-bottom: 2px solid transparent; color: var(--dim); padding: 4px 10px; font-size: 12px; font-family: inherit; cursor: pointer; white-space: nowrap; display: flex; align-items: center; transition: color 0.15s, border-color 0.15s; outline: none; }
  .topbar-tab:hover { color: var(--text); }
  .topbar-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
  #status-cluster { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--dim); flex-shrink: 0; }
  #topbar-row1 #theme-toggle { background: none; border: 1px solid var(--border); color: var(--dim); padding: 3px 8px; font-size: 11px; border-radius: 3px; cursor: pointer; flex-shrink: 0; }
  #topbar-row1 #theme-toggle:hover { background: var(--surface-hover); }
  #topbar-row1 #stats-toggle { font-size: 10px; letter-spacing: 0.05em; flex-shrink: 0; user-select: none; cursor: pointer; }
  #topbar-row1 #stats-toggle:hover { opacity: 0.8; }
  #topbar-row2 { display: flex; align-items: center; padding: 3px 16px 5px; font-size: 12px; border-top: 1px solid var(--border); min-height: 26px; }
  #row2-dashboard, #row2-sysprompt { display: flex; align-items: center; gap: 8px; width: 100%; }
  #breadcrumb { color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 120px; flex: 1; }
  #breadcrumb .bc-seg { cursor: pointer; transition: color 0.1s; }
  #breadcrumb .bc-seg:hover { color: var(--accent); }
  #breadcrumb .bc-sep { color: var(--border); margin: 0 2px; cursor: default; }
  #copy-link-btn { background: none; border: none; color: var(--dim); cursor: pointer; font-size: 12px; padding: 2px 4px; flex-shrink: 0; }
  #copy-link-btn:hover { color: var(--text); }
  #sidebar-toggle-btn { width: auto; padding: 0 4px; font-family: inherit; }
  #sidebar-toggle-btn:hover { background: var(--surface-hover); }
  #quota-ticker { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }
  #qt-bar-wrap { display: flex; align-items: center; gap: 5px; }
  .qt-bar-track { width: 80px; height: 7px; background: var(--border); border-radius: 4px; overflow: hidden; }
  #qt-bar-fill { height: 100%; width: 0%; background: var(--green); border-radius: 4px; transition: width 0.5s, background 0.5s; }
  #qt-bar-pct, #qt-bar-time { font-size: 10px; color: var(--dim); }
  #qt-chip { font-size: 10px; color: var(--dim); }
  .qt-notify { font-size: 12px; background: none; border: none; cursor: pointer; padding: 0 4px; line-height: 1; filter: grayscale(1); opacity: 0.6; transition: opacity 0.15s, filter 0.15s; }
  .qt-notify:hover { opacity: 1; }
  .qt-notify.enabled { filter: none; opacity: 1; }
  .qt-notify.denied { opacity: 0.4; cursor: not-allowed; }
  #row2-sysprompt span { font-size: 11px; color: var(--dim); }

  #columns { display: flex; flex: 1; min-height: 0; overflow: hidden; }
  .col { overflow-y: auto; overflow-x: hidden; border-right: 1px solid var(--border); flex-shrink: 0; min-width: 0; border-top: 2px solid transparent; transition: border-top-color 0.15s; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
  .col::-webkit-scrollbar { width: 4px; }
  .col::-webkit-scrollbar-track { background: transparent; }
  .col::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
  .col::-webkit-scrollbar-thumb:hover { background: var(--dim); }
  .col.col-focused { border-top-color: var(--accent); }
  .col:last-child { border-right: none; flex: 1; }

  /* Focused mode: collapse all columns except detail */
  #columns.focused #col-projects,
  #columns.focused #col-sessions,
  #columns.focused #col-sections { display: none; }
  #columns.focused #col-turns { display: none; }
  #columns.focused #col-detail { flex: 1; }
  /* Workflow focused: col-turns hosts the swimlane, keep it visible */
  #columns.focused.wf-active #col-turns { display: flex; flex: 1; }

  /* Expand button in detail header */
  .expand-btn { cursor: pointer; color: var(--dim); font-size: 14px; padding: 2px 4px; border-radius: 3px; transition: color 0.1s, background 0.1s; }
  .expand-btn:hover { color: var(--text); background: var(--surface-hover); }

  /* Timeline accordion in detail */
  .tl-step { border-bottom: none; }
  .tl-step-summary { display: grid; grid-template-columns: 28px minmax(0, 1fr) 24px; align-items: start; column-gap: 4px; cursor: pointer; padding: 4px 8px 4px 4px; transition: background 0.1s; }
  .tl-step-summary:hover { background: var(--surface-hover); }
  .tl-step-summary.active { background: var(--surface-active); box-shadow: inset 3px 0 0 0 var(--accent); }
  .tl-step-main { min-width: 0; }
  .tl-step-summary .msg-list-row { padding-right: 0; }
  .tl-step-num { color: var(--dim); font-family: 'SF Mono', 'Cascadia Code', monospace; font-size: 10px; line-height: 1.2; opacity: 0.75; pointer-events: none; padding-top: 1px; text-align: left; }
  .tl-step-star { justify-self: stretch; width: 24px; background: none; border: none; color: var(--dim); cursor: pointer; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 15px; line-height: 1; padding: 1px 0; opacity: 0.65; user-select: none; text-align: right; }
  .tl-step-star:hover { opacity: 1; color: var(--yellow); }
  .tl-step-star.starred { opacity: 1; color: var(--yellow); }
  .tool-call-error { background: rgba(248,81,73,0.12); border-left: 2px solid var(--red); }
  .tl-step-detail { padding: 8px 12px; border-top: 1px solid var(--border); background: var(--bg); }

  /* Timeline split pane in focused mode */
  /* overflow-x auto: below the min-width sum (~645px) the split scrolls instead of clipping the detail pane */
  .tl-split { display: flex; flex: 1; overflow-x: auto; overflow-y: hidden; }
  .tl-split .tl-with-minimap { flex: none; min-width: 360px; max-width: 500px; }
  .tl-split-detail { flex: 1; min-width: 280px; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

  /* Horizontal resize handle between steps and detail */
  .tl-resize-handle { width: 5px; flex-shrink: 0; cursor: col-resize; background: var(--border); }

  /* Token minimap — vertical color strip beside timeline */
  .tl-with-minimap { display: flex; flex: 1; overflow: hidden; }
  .tl-scroll-area { flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: var(--border) transparent; scroll-padding-block: 40px; }
  .minimap { width: 64px; flex-shrink: 0; position: relative; border-right: 1px solid var(--border); background: var(--bg); overflow: hidden; cursor: pointer; }
  /* ponytail: zone threshold lines — smart (40%) and danger (80%). CSS-only, no JS needed */
  .minimap::before, .minimap::after {
    content: ''; position: absolute; left: 0; right: 0; height: 0;
    border-top: 1px dashed; pointer-events: none; z-index: 2;
  }
  .minimap::before { top: 40%; border-color: var(--green); opacity: 0.5; }
  .minimap::after { top: 80%; border-color: var(--red); opacity: 0.5; }
  .minimap-cache-bar { display: flex; height: 4px; width: 100%; flex-shrink: 0; }
  .minimap-cache-bar > div { min-width: 1px; }
  .minimap-blocks { width: 100%; opacity: 0.7; transition: opacity 0.25s ease; overflow: hidden; }
  .minimap:hover .minimap-blocks { opacity: 1; }
  .minimap-block { width: 100%; transition: opacity 0.15s; position: relative; overflow: hidden; }
  .minimap-block .mm-label { position: absolute; left: 2px; top: 0; right: 2px; font-size: 8px; line-height: 1; color: var(--bg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; opacity: 0.9; }
  .minimap-block.mm-active { opacity: 1 !important; filter: brightness(1.8); outline: 1px solid var(--text); z-index: 1; }
  .minimap-block.mm-highlight { filter: brightness(2); z-index: 1; box-shadow: 0 0 0 1px var(--text); }
  .minimap-empty { width: 100%; }
  .minimap-usage { position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; font-size: 8px; color: var(--dim); pointer-events: none; }
  .tl-step-summary.mm-hover { background: var(--surface-hover); outline: 1px solid var(--border); outline-offset: -1px; }
  [data-theme="light"] .minimap-cache-bar > div { opacity: 0.8; }
  #col-projects { width: 220px; transition: width 0.18s ease, opacity 0.18s ease; }
  #col-sessions { width: 220px; transition: width 0.18s ease, opacity 0.18s ease; }
  /* Sidebar collapse (#206): animate Projects + Sessions out instead of
     display:none, so overview/detail eases into the freed width. */
  #columns.sidebar-collapsed #col-projects,
  #columns.sidebar-collapsed #col-sessions {
    width: 0; min-width: 0; opacity: 0; overflow: hidden; pointer-events: none; border-right: none;
  }

  .project-item { padding: 7px 10px; cursor: pointer; border-left: 3px solid transparent; border-bottom: 1px solid var(--border); }
  .project-item:hover { background: var(--surface-hover); }
  .project-item.selected { border-left-color: var(--accent); background: var(--surface-active); }
  .project-item .pi-name { font-size: 12px; color: var(--text); font-weight: bold; display: flex; align-items: center; gap: 6px; }
  .project-item .pi-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .project-item .pi-name.all { color: var(--dim); font-weight: normal; }
  .project-item .pi-meta { font-size: 11px; color: var(--dim); margin-top: 2px; }
  .project-item .pi-cost { color: var(--yellow); }
  .project-item .pi-range { font-size: 10px; color: var(--dim); margin-top: 1px; }
  /* #324: hidden by default; shown by .wf-active or .cold-loading on #columns */
  #col-turns { width: 220px; position: relative; display: none; }
  #col-sections { width: 220px; }

  .col-empty { color: var(--dim); text-align: center; padding: 40px 12px; font-size: 12px; }
  .loading-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; flex: 1; }
  .loading-spinner { width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: ccxray-spin 0.8s linear infinite; }
  @keyframes ccxray-spin { to { transform: rotate(360deg); } }
  .col-title { padding: 10px 12px; font-size: 10px; font-weight: 600; color: var(--dim); letter-spacing: 0.08em; text-transform: uppercase; border-bottom: 2px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
  #cmd-bar { flex-shrink: 0; border-top: 1px solid var(--border); background: var(--surface); user-select: none; transition: opacity 0.15s; overflow: hidden; }
  #cmd-bar.hidden { display: none; }
  #cmd-bar.overlay-active { opacity: 0; pointer-events: none; }
  #cmd-bar-row1 { height: 28px; display: flex; align-items: center; gap: 10px; padding: 0 12px; font-size: 11px; color: var(--dim); overflow-x: auto; overflow-y: hidden; white-space: nowrap; flex-wrap: nowrap; scrollbar-width: thin; }
  #cmd-bar-row1::-webkit-scrollbar { height: 3px; }
  #cmd-bar-row1::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
  #cmd-bar-row2 { display: none; }
  .cmd-key { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; flex: 0 0 auto; }
  .cmd-key.disabled { opacity: 0.3; }
  .cmd-sep { color: var(--border); margin: 0 1px; flex: 0 0 auto; }
  .cmd-key-btn { background: none; border: none; color: inherit; cursor: pointer; font-size: 11px; font-family: inherit; display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; padding: 2px 5px; margin: -2px -5px; border-radius: 4px; }
  .cmd-key-btn:hover { background: var(--surface-hover); color: var(--text); }
  .cmd-key-btn:active { opacity: 0.6; }
  kbd { display: inline-block; padding: 1px 5px; border: 1px solid var(--border); border-radius: 3px; font-size: 10px; font-family: monospace; background: var(--bg); color: var(--text); }

  /* ── Status dots ── */
  .sdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; flex-shrink: 0; vertical-align: middle; border: none; background: none; padding: 0; outline: none; cursor: default; }
  .sdot-stream { background: var(--green); }
  .sdot-idle { background: var(--yellow); }
  .sdot-off { background: transparent; border: 1px solid var(--border); }
  .sdot-armed { box-shadow: 0 0 0 3px rgba(210, 153, 34, 0.5); cursor: pointer; }
  .sdot-armed:hover { box-shadow: 0 0 0 3px rgba(210, 153, 34, 0.9); }
  .sdot-stream:not(.sdot-armed):hover, .sdot-idle:not(.sdot-armed):hover { box-shadow: 0 0 0 3px rgba(210, 153, 34, 0.25); cursor: pointer; }

  /* ── Session items ── */
  .session-item { padding: 8px 10px; cursor: pointer; border-left: 3px solid transparent; border-bottom: 1px solid var(--border); }
  .session-item:hover { background: var(--surface-hover); }
  .session-item.selected { border-left-color: var(--purple); background: var(--surface-active); }
  .session-item .si-row1 { display: flex; align-items: center; gap: 4px; margin-bottom: 2px; }
  .session-item .sid { color: var(--purple); font-size: 12px; font-weight: bold; white-space: nowrap; flex-shrink: 0; }
  .session-item .si-title {
    font-size: 11px; color: var(--text); margin-bottom: 2px;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3;
    overflow: hidden; word-break: break-word; line-height: 1.25;
  }
  .session-item .si-row2 { font-size: 11px; color: var(--dim); margin-bottom: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .session-item .si-cost-row { font-size: 12px; font-weight: bold; margin-bottom: 2px; }
  .session-item .si-time-row { font-size: 11px; color: var(--dim); margin-top: 3px; display: flex; align-items: center; gap: 4px; }
  .si-meta-row { display: flex; align-items: center; justify-content: space-between; margin-top: 3px; gap: 6px; }
  .si-meta-row .si-cache { margin-top: 0; }
  .si-time { font-size: 10px; color: var(--fg); white-space: nowrap; }
  .session-item .si-cost { color: var(--yellow); }


  .ctx-alert { font-size: 10px; font-weight: bold; }
  .ctx-alert-yellow { color: var(--yellow); }
  .ctx-alert-red { color: var(--red); }
  .ctx-alert-historical { color: var(--dim); font-weight: normal; opacity: 0.7; }
  .ctx-alert-dim { color: var(--dim); font-weight: normal; }
  .si-ctx-wrap { display: flex; align-items: center; gap: 5px; margin-top: 3px; margin-bottom: 2px; }
  .si-ctx-wrap .si-ctx-bar { flex: 1; margin-top: 0; }
  .si-ctx-bar {
    position: relative;
    height: 2px;
    background: var(--border);
    border-radius: 1px;
    margin-top: 3px;
    overflow: visible;
    cursor: help;
  }
  .si-ctx-bar::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: var(--pct, 0%);
    background: var(--accent);
    border-radius: 1px;
    transition: width 0.3s, background 0.3s;
  }
  .si-ctx-bar::after {
    content: '';
    position: absolute;
    left: var(--compact-threshold);
    top: -1px; bottom: -1px;
    width: 1px;
    background: var(--dim);
    opacity: 0.7;
  }
  .si-ctx-bar.over-compact::before { background: var(--red); }
  .si-ctx-bar.over-compact::after { background: var(--red); opacity: 1; }
  .si-ctx-bar.historical::before { background: var(--dim); opacity: 0.5; }
  .si-ctx-bar.historical::after { opacity: 0.4; }
  .si-cache { font-size: 10px; margin-top: 3px; font-variant-numeric: tabular-nums; }
  .si-cache.cache-far { color: var(--green); }
  .si-cache.cache-near { color: var(--yellow); }
  .si-cache.cache-close { color: var(--red); animation: cachePulse 1s ease-in-out infinite; }
  .si-cache.cache-expired { color: var(--dim); opacity: 0.55; font-style: italic; }
  .si-cache.cache-server { color: var(--green); opacity: 0.8; }
  @keyframes cachePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
  .launch-btn { background: none; border: 1px solid var(--border); color: var(--green); width: 18px; height: 18px; border-radius: 50%; cursor: pointer; font-size: 10px; display: inline-flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; }
  .launch-btn:hover { background: var(--green); color: #000; border-color: var(--green); }
  .pin-btn { background: none; border: none; color: var(--dim); cursor: pointer; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 15px; line-height: 1; padding: 0 2px; opacity: 0.6; transition: opacity 0.15s, color 0.15s; margin-left: auto; flex-shrink: 0; user-select: none; }
  .pin-btn:hover { opacity: 1; color: var(--yellow); }
  .pin-btn.pinned { opacity: 1; color: var(--yellow); }
  .pin-btn.derived { opacity: 0.85; color: var(--dim); }
  .pin-btn.derived:hover { opacity: 1; color: var(--yellow); }
  .pin-btn.disabled { opacity: 0.25; cursor: not-allowed; }
  .pin-btn.disabled:hover { opacity: 0.25; color: var(--dim); }
  /* Chip-style count for derived state (☆ followed by a small framed number).
     The chip pattern signals "count of items" so users don't misread the
     digit as a version or duration. Yellow text ties back to star vocab. */
  .pin-btn-count { display: inline-block; margin-left: 3px; padding: 0 5px; border-radius: 7px; background: var(--surface); color: var(--yellow); font-size: 10px; font-weight: 600; line-height: 1.5; vertical-align: middle; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
  /* Star popover: lists which descendants are keeping a parent retained.
     Anchored under the derived ☆N badge; dismissed by Esc / outside click /
     re-clicking the badge. */
  /* Popover sits above the dashboard so it must stand off the page surface
     visually. --surface-hover is one tier lighter than --surface in dark
     theme, providing a "floating panel" feel; combined with a stronger
     shadow and a slightly brighter border, the panel reads as elevated in
     both themes without needing per-theme overrides. */
  .star-popover { background: var(--surface-hover); border: 1px solid var(--accent); border-radius: 6px; box-shadow: 0 12px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04); min-width: 300px; width: min(426px, calc(100vw - 16px)); max-height: 320px; overflow-y: auto; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 12px; color: var(--text); }
  .star-popover-title { position: relative; padding: 8px 32px 6px 10px; color: var(--text); font-size: 11px; border-bottom: 1px solid var(--border); background: var(--surface-active); }
  .star-popover-close { position: absolute; top: 4px; right: 6px; background: none; border: none; color: var(--dim); cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: 3px; font-family: inherit; }
  .star-popover-close:hover { color: var(--text); background: var(--surface-hover, var(--bg)); }
  .star-popover-body { padding: 4px 0; }
  .star-popover-item { display: flex; align-items: center; gap: 6px; padding: 4px 10px; cursor: pointer; }
  .star-popover-item:hover { background: var(--surface-hover, var(--bg)); }
  .star-popover-item:hover .star-popover-label { color: var(--accent, var(--yellow)); }
  .star-popover-item.pop-row-focused { background: var(--surface-active); box-shadow: inset 2px 0 0 0 var(--accent, var(--yellow)); }
  .star-popover-item.pop-row-focused .star-popover-label { color: var(--accent, var(--yellow)); }
  .star-popover-glyph-btn { background: none; border: none; color: var(--dim); cursor: pointer; flex-shrink: 0; font-size: 15px; line-height: 1; padding: 1px 4px; border-radius: 3px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; user-select: none; transition: transform 0.1s, background 0.1s; }
  .star-popover-glyph-btn.starred { color: var(--yellow); }
  /* Hover gives feedback via scale + background only — color is reserved for
     state (.starred = yellow, default = dim) so the ★/☆ flip is unambiguous
     even when the cursor is still hovering after a click. */
  .star-popover-glyph-btn:hover { transform: scale(1.2); background: var(--surface-hover, var(--bg)); }
  .star-popover-label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: 'SF Mono', 'Cascadia Code', monospace; font-size: 11px; }
  .star-popover-time { margin-left: auto; flex: 0 0 auto; color: var(--dim); text-align: right; white-space: nowrap; font-family: 'SF Mono', 'Cascadia Code', monospace; font-size: 11px; }


  /* ── Turn items ── */
  .turn-item { padding: 7px 10px; cursor: pointer; border-left: 2px solid transparent; border-bottom: 1px solid var(--border); }
  .turn-item:hover { background: var(--surface-hover); }
  .turn-item.selected { border-left-color: var(--accent); background: var(--surface-hover); }
  /* Line 1: identity */
  .turn-item .turn-identity { display: flex; gap: 6px; align-items: center; font-size: 12px; flex-wrap: nowrap; }
  .turn-model { color: var(--purple); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .turn-item .status-dot { font-size: 10px; line-height: 1; flex-shrink: 0; }
  .turn-item .status-dot-ok { color: var(--green); }
  .turn-item .status-dot-err { color: var(--red); }
  .turn-item .turn-wait { color: var(--dim); font-size: 11px; flex-shrink: 0; }
  .turn-item .turn-critical-marker { font-size: 10px; color: var(--red); font-weight: bold; flex-shrink: 0; }
  .turn-item .turn-imported-badge { font-size: 10px; color: var(--cyan); margin-left: 4px; flex-shrink: 0; opacity: 0.7; }
  .turn-item .turn-star { margin-left: auto; flex-shrink: 0; cursor: pointer; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 15px; line-height: 1; padding: 0 2px; user-select: none; opacity: 0.6; }
  .turn-item .turn-star:hover { opacity: 1; }
  .turn-item .turn-star.starred { color: var(--yellow); opacity: 1; }
  .turn-item .turn-star.derived { color: var(--dim); opacity: 0.85; }
  .turn-item .turn-star.derived:hover { color: var(--yellow); opacity: 1; }
  .turn-item .turn-star.disabled { opacity: 0.25; cursor: not-allowed; }
  .turn-item .turn-cost-line { font-size: 11px; color: var(--dim); text-align: right; margin-top: 2px; }
  /* Line 2: title */
  .turn-item .turn-title { font-size: 11px; color: var(--text); margin-top: 2px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
  /* Line 3: ctx bar */
  /* Line 4: secondary — time + tools */
  .turn-item .turn-secondary { display: flex; flex-direction: column; gap: 3px; font-size: 9px; color: var(--dim); margin-top: 3px; }
  .turn-item .turn-time-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
  .turn-item .turn-tools-row { display: flex; flex-wrap: wrap; gap: 3px; }
  .turn-item .turn-elapsed { white-space: nowrap; }
  .turn-item .turn-wait-gap { white-space: nowrap; }
  .turn-item .turn-think { color: var(--purple); white-space: nowrap; }
  /* Line 5: warning/notice risk */
  .turn-item .turn-risk-line { font-size: 9px; color: var(--dim); margin-top: 2px; }
  /* Legacy — still used by detail views */
  .turn-item .status-ok { color: var(--green); }
  .turn-item .status-err { color: var(--red); }
  .tool-chip { font-size: 9px; color: var(--dim); background: var(--bg2, var(--surface-hover)); border-radius: 3px; padding: 0 3px; }
  .cred-highlight { background: rgba(240, 136, 62, 0.25); color: var(--orange); border-radius: 2px; padding: 0 1px; }
  .source-badge { font-size: 9px; border-radius: 2px; padding: 0 3px; margin-left: 4px; opacity: 0.75; flex-shrink: 0; }
  .source-local { color: #666; border: 1px solid #666; }
  .source-local-sensitive { color: var(--orange); border: 1px solid var(--orange); opacity: 0.9; }
  .source-network { color: #5b9bd5; border: 1px solid #5b9bd5; }
  .turn-sub { opacity: 0.7; }
  .turn-sub:hover { opacity: 1; }
  .turn-sub.selected { opacity: 1; border-left-color: var(--orange) !important; }

  .si-tools { font-size: 10px; color: var(--dim); margin: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .si-preview { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
  .si-truncated { font-size: 10px; color: var(--yellow); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .turn-elapsed-secondary { color: var(--dim); font-size: 10px; }
  .col-sticky-header { position: sticky; top: 0; z-index: 2; background: var(--surface); }
  #scroll-toggle { user-select: none; }
  #scroll-toggle .scroll-on, #scroll-toggle .scroll-off { padding: 1px 4px; border-radius: 3px; color: var(--dim); }
  #scroll-toggle .scroll-on.active { color: var(--green); background: rgba(63,185,80,0.15); }
  #scroll-toggle .scroll-off.active { color: var(--red); background: rgba(248,81,73,0.15); }
  #stats-toggle { user-select: none; }
  #stats-toggle .stats-on, #stats-toggle .stats-off { padding: 1px 4px; border-radius: 3px; color: var(--dim); }
  #stats-toggle .stats-on.active { color: var(--green); background: rgba(63,185,80,0.15); }
  #stats-toggle .stats-off.active { color: var(--red); background: rgba(248,81,73,0.15); }
  #session-tool-bar { padding: 4px 10px; font-size: 10px; color: var(--dim); border-bottom: 1px solid var(--border); display: flex; flex-wrap: nowrap; gap: 4px; align-items: center; overflow: hidden; white-space: nowrap; }
  .turn-ctx-bar { margin-top: 5px; margin-bottom: 4px; }
  .turn-ctx-bar-bg { height: 3px; border-radius: 1.5px; background: var(--border); overflow: visible; display: flex; position: relative; }
  /* Cross-level auto-compact landmark (see design D10). Tick sits on the 3px
     bar itself — not on the wrapper — so it doesn't extend across the
     hit:/ctx: label row below. L2 keeps its own per-turn color thresholds
     (D11). Tick height 5px (1 above + 3 bar + 1 below). */
  .turn-ctx-bar-bg::after {
    content: '';
    position: absolute;
    left: var(--compact-threshold);
    top: -1px; bottom: -1px;
    width: 1px;
    background: var(--dim);
    opacity: 0.7;
    pointer-events: none;
  }
  /* L3 big context-breakdown bar (turn detail header + sticky) — shares the
     same landmark tick as L1/L2. Bar uses overflow:visible so tick extends
     slightly above/below for visibility. */
  .ctx-big-bar { position: relative; }
  .ctx-big-bar::after {
    content: '';
    position: absolute;
    left: var(--compact-threshold);
    top: -2px; bottom: -2px;
    width: 1px;
    background: var(--text);
    opacity: 0.45;
    pointer-events: none;
  }
  .turn-ctx-labels { display: flex; font-size: 9px; margin-top: 1px; line-height: 1; }
  .turn-ctx-pct { color: var(--dim); margin-left: auto; }
  .turn-ctx-pct.ctx-critical { color: var(--red); }
  .turn-ctx-pct.ctx-warning { color: var(--yellow); }
  .turn-hit-pct { color: var(--color-cache-read); }
  .turn-hit-pct.hit-cold { color: var(--red); }
  #ctx-legend { padding: 3px 10px 4px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; font-size: 9px; color: var(--dim); }
  .ctx-legend-dot { display: inline-block; width: 7px; height: 7px; border-radius: 1px; margin-right: 2px; vertical-align: middle; }
  #session-sparkline { padding: 6px 10px; border-bottom: 1px solid var(--border); display: none; }
  #session-sparkline svg { width: 100%; height: 56px; }

  /* ── Scorecard hover card ── */
  .scorecard-tooltip { position: absolute; right: 100%; top: 0; margin-right: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 10px; z-index: 10; width: 180px; box-shadow: 0 4px 12px rgba(0,0,0,0.4); pointer-events: none; }
  .scorecard-tooltip .sc-row { display: flex; justify-content: space-between; margin-bottom: 3px; }
  .scorecard-tooltip .sc-label { color: var(--dim); }
  .scorecard-tooltip .sc-value { color: var(--text); font-weight: bold; }
  .scorecard-tooltip .sc-bar { height: 4px; border-radius: 2px; background: var(--border); margin-bottom: 4px; }
  .scorecard-tooltip .sc-bar-fill { height: 100%; border-radius: 2px; }

  /* ── Sections column ── */
  .col-header { padding: 10px 12px; border-bottom: 2px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 1; }
  .col-header .ch-line1 { font-size: 12px; margin-bottom: 4px; }
  .col-header .ch-line2 { font-size: 11px; color: var(--dim); }
  .section-item { padding: 8px 12px; cursor: pointer; border-left: 3px solid transparent; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 6px; }
  .section-item:hover { background: var(--surface-hover); }
  .section-item.selected { border-left-color: var(--accent); background: var(--surface-hover); }
  .section-item .si-name { font-size: 12px; flex: 1; }
  .section-item .si-badge { font-size: 11px; color: var(--dim); background: var(--border); padding: 1px 5px; border-radius: 3px; white-space: nowrap; }
  .section-item .si-arrow { color: var(--dim); font-size: 11px; flex-shrink: 0; }
  .section-group-title { padding: 6px 12px 2px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--dim); border-top: 1px solid var(--border); }
  .section-group-title:first-child { border-top: none; }

  /* ── Detail column ── */
  #col-detail { display: flex; flex-direction: column; overflow: hidden; transition: opacity 0.15s ease; }
  .new-turn-pill, .sub-pill {
    position: sticky;
    bottom: 12px;
    align-self: center;
    margin: 0 auto;
    display: block;
    width: fit-content;
    padding: 3px 12px;
    border-radius: 12px;
    font-size: 11px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 10;
  }
  .new-turn-pill {
    background: var(--accent);
    color: var(--bg);
    animation: slideUp 0.3s ease;
  }
  @keyframes slideUp {
    from { transform: translateX(-50%) translateY(10px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
  }
  /* Peek-only pill for subagent turns — no animation (HELD badge retains
     animation monopoly, see docs/designs/follow-live-turn-subagent.md SP3) */
  .sub-pill {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--dim);
  }
  .sub-pill.has-errors {
    color: var(--red);
  }
  .ctx-sticky { position: sticky; top: 0; background: var(--surface); border-bottom: 2px solid var(--border); padding: 10px 12px; z-index: 2; flex-shrink: 0; }
  .ctx-sticky-title { font-size: 11px; color: var(--dim); margin-bottom: 6px; }
  .detail-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
  .detail-scroll::-webkit-scrollbar { width: 4px; }
  .detail-scroll::-webkit-scrollbar-track { background: transparent; }
  .detail-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
  .detail-scroll::-webkit-scrollbar-thumb:hover { background: var(--dim); }
  .detail-content { padding: 12px; }

  /* ── Shared content styles ── */
  .section { border-bottom: 1px solid var(--border); }
  .section:last-child { border-bottom: none; }
  .section-header { padding: 8px 14px; cursor: pointer; color: var(--accent); font-size: 12px; user-select: none; display: flex; align-items: center; gap: 6px; }
  .section-header:hover { background: var(--surface-hover); }
  .section-header .arrow { color: var(--dim); font-size: 10px; transition: transform 0.15s; }
  .section-header.open .arrow { transform: rotate(90deg); }
  .section-header .badge { background: var(--border); color: var(--dim); padding: 1px 6px; border-radius: 4px; font-size: 11px; }
  .section-content { display: none; padding: 8px 14px; overflow: auto; }
  .section-content.open { display: block; }
  pre { white-space: pre-wrap; word-break: break-all; font-size: 12px; line-height: 1.5; }
  .msg { margin-bottom: 8px; padding: 8px; border-radius: 4px; border: 1px solid var(--border); }
  .msg-role { font-size: 11px; font-weight: bold; margin-bottom: 4px; }
  .msg-role.user { color: var(--accent); }
  .msg-role.assistant { color: var(--green); }
  .tool-grid { display: flex; flex-wrap: wrap; gap: 4px; }
  .tool-tag { background: var(--border); padding: 2px 8px; border-radius: 4px; font-size: 11px; color: var(--dim); }
  .content-block { margin-bottom: 6px; padding: 6px 8px; background: var(--bg); border-radius: 4px; }
  .content-block .type { font-size: 11px; color: var(--yellow); margin-bottom: 2px; }
  .msg-list-row { display: flex; align-items: baseline; gap: 4px; font-size: 11px; line-height: 1.4; overflow: hidden; }
  .msg-list-idx { flex-shrink: 0; color: var(--dim); }
  .msg-list-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
  .msg-list-tok { flex-shrink: 0; font-size: 10px; color: var(--dim); margin-left: auto; }
  .msg-thinking-line { font-size: 10px; color: var(--purple); opacity: 0.75; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.5; }
  .section-item.has-thinking { flex-direction: column; align-items: stretch; }
  .msg-badge { font-size: 9px; font-weight: bold; padding: 0 4px; border-radius: 3px; flex-shrink: 0; letter-spacing: 0.03em; }
  .msg-badge-human        { background: var(--accent);  color: var(--bg); }
  .msg-badge-tool_results { background: var(--border);  color: var(--dim); }
  .msg-badge-system       { background: var(--yellow);  color: var(--bg); }
  .msg-badge-call         { background: var(--green);   color: var(--bg); }
  .msg-badge-think        { background: var(--purple);  color: var(--bg); }

  /* ── Sysprompt Diff UI ── */
  .section-item.has-subline { flex-direction: column; align-items: stretch; gap: 2px; }
  .section-item.has-subline .si-main { display: flex; align-items: center; gap: 6px; }
  .section-item .si-subline { text-align: right; padding-right: 13px; font-size: 10px; color: var(--dim); cursor: pointer; }
  .section-item .si-subline:hover { color: var(--text); }
  .version-banner { background: var(--surface-hover); border-bottom: 1px solid var(--accent); padding: 6px 12px; font-size: 11px; color: var(--text); display: flex; align-items: center; gap: 8px; }
  .version-banner .vb-dot { color: var(--accent); }
  .version-banner .vb-ver { color: var(--purple); font-weight: bold; }
  .version-banner .vb-delta { color: var(--green); }
  .version-banner .vb-view { color: var(--accent); cursor: pointer; text-decoration: underline; }
  .version-banner .vb-close { margin-left: auto; cursor: pointer; color: var(--dim); }

  /* ── Intercept UI ── */
  .held-badge { font-size: 9px; font-weight: bold; color: #fff; background: var(--red); padding: 0 5px; border-radius: 3px; margin-left: auto; flex-shrink: 0; cursor: pointer; animation: held-pulse 1.5s ease-in-out infinite; }
  @keyframes held-pulse { 50% { opacity: 0.7; } }
  #topbar-held { font-size: 10px; color: var(--bg); background: var(--yellow); cursor: pointer; padding: 1px 8px; border-radius: 10px; font-weight: 600; display: none; animation: held-pulse 1.5s ease-in-out infinite; }
  #topbar-held:hover { opacity: 0.85; }

  .intercept-overlay { position: absolute; inset: 0; z-index: 100; background: var(--surface); display: flex; flex-direction: column; border-left: 2px solid var(--yellow); }
  .intercept-header { padding: 10px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
  .intercept-header .ih-title { font-size: 12px; color: var(--yellow); font-weight: bold; flex: 1; }
  .intercept-header .ih-session { font-size: 11px; color: var(--dim); }
  .intercept-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 0 10px; }
  .intercept-tab { padding: 6px 12px; font-size: 11px; color: var(--dim); cursor: pointer; border-bottom: 2px solid transparent; }
  .intercept-tab:hover { color: var(--text); }
  .intercept-tab.active { color: var(--yellow); border-bottom-color: var(--yellow); }
  .intercept-editor { flex: 1; overflow: auto; padding: 10px 14px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
  .intercept-editor::-webkit-scrollbar { width: 4px; }
  .intercept-editor::-webkit-scrollbar-track { background: transparent; }
  .intercept-editor::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
  .intercept-editor textarea { width: 100%; min-height: 120px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 8px; font-family: inherit; font-size: 12px; resize: vertical; }
  .intercept-editor textarea:focus { outline: none; border-color: var(--yellow); }
  .intercept-editor select { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 4px 8px; font-family: inherit; font-size: 12px; }
  .intercept-summary { padding: 6px 14px; font-size: 11px; color: var(--dim); border-top: 1px solid var(--border); }
  .intercept-countdown { height: 4px; background: var(--bg); flex-shrink: 0; }
  .intercept-countdown-bar { height: 100%; transition: width 1s linear, background-color 0.5s; border-radius: 2px; }
  .intercept-actions { padding: 10px 14px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
  .intercept-actions button { padding: 5px 16px; border-radius: 4px; cursor: pointer; font-family: inherit; font-size: 12px; border: 1px solid var(--border); }
  .intercept-actions .btn-reject { background: transparent; color: var(--red); border-color: var(--red); }
  .intercept-actions .btn-reject:hover { background: rgba(248, 81, 73, 0.15); }
  .intercept-actions .btn-approve { background: var(--green); color: #000; border-color: var(--green); font-weight: bold; }
  .intercept-actions .btn-approve:hover { opacity: 0.9; }
  .ie-msg { padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; margin-bottom: 6px; cursor: pointer; }
  .ie-msg:hover { background: var(--surface-hover); }
  .ie-msg .ie-msg-role { font-size: 11px; font-weight: bold; margin-bottom: 2px; }
  .ie-msg .ie-msg-role.user { color: var(--accent); }
  .ie-msg .ie-msg-role.assistant { color: var(--green); }
  .ie-msg .ie-msg-preview { font-size: 11px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ie-msg.expanded textarea { margin-top: 6px; }
  .ie-tool-item { display: flex; align-items: center; gap: 6px; padding: 4px 0; font-size: 12px; }
  .ie-tool-item label { cursor: pointer; flex: 1; }
  .ie-tool-item input[type=checkbox] { accent-color: var(--yellow); }

  /* ── Fullscreen Page Shell ── */
  .fullscreen-page { display: none; flex: 1; background: var(--bg); flex-direction: column; overflow: hidden; }
  .fullscreen-page.open { display: flex; }
  .fullscreen-page > .fp-header { display: none; }
  .fp-back, .fp-close { background: none; border: none; color: var(--dim); cursor: pointer; font-size: 14px; padding: 4px 8px; flex-shrink: 0; }
  .fp-back:hover, .fp-close:hover { color: var(--text); }
  .fp-close { margin-left: auto; }
  .fp-title { font-size: 14px; font-weight: 600; color: var(--text); }
  .fp-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
  .fp-actions + .fp-close { margin-left: 0; }
  .fp-toolbar { padding: 8px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .fp-content { flex: 1; overflow-y: auto; padding: 20px; }

  /* ── Fullscreen Page: Cost-specific ── */
  .cost-card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 14px; max-width: 400px; }
  .cost-card + .cost-card { margin-top: 12px; }
  .cost-card-label { font-size: 10px; color: var(--dim); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }

  /* ── Fullscreen Page: Changelog-specific ── */
  .sp-changelog-body { display: flex; flex: 1; overflow: hidden; }
  .sp-agent-list { width: 170px; flex-shrink: 0; border-right: 1px solid var(--border); border-top: 2px solid transparent; transition: border-top-color 0.15s; overflow-y: auto; padding: 8px 0; }
  .sp-agent-item { padding: 8px 10px; font-size: 11px; color: var(--dim); cursor: pointer; border-left: 3px solid transparent; }
  .sp-agent-item:hover { background: var(--surface-hover); color: var(--text); }
  .sp-agent-item.active { border-left-color: var(--accent); color: var(--text); background: var(--surface-active); }
  .sp-agent-list.focused,
  .sp-version-list.focused { border-top-color: var(--accent); }
  .sp-agent-item .sp-agent-label { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sp-agent-item .sp-agent-meta { font-size: 9px; color: var(--dim); margin-top: 2px; }
  .sp-version-list { width: 280px; flex-shrink: 0; border-right: 1px solid var(--border); border-top: 2px solid transparent; transition: border-top-color 0.15s; overflow-y: auto; padding: 8px 0; }
  .sp-version-list-title { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.05em; padding: 4px 12px 8px; }
  .sp-version-item { padding: 6px 12px; font-size: 11px; color: var(--dim); cursor: pointer; display: grid; grid-template-columns: 42px 1fr auto auto; gap: 4px; align-items: center; border-left: 3px solid transparent; white-space: nowrap; }
  .sp-version-item:hover { background: var(--surface-hover); color: var(--text); }
  .sp-version-item.active { border-left-color: var(--accent); color: var(--text); background: var(--surface-active); }
  .sp-version-item.sp-version-unchanged { opacity: 0.45; }
  .sp-version-item.sp-version-unchanged:hover { opacity: 1; }
  .sp-content-area { flex: 1; overflow-y: auto; padding: 12px 16px; }
  .sp-status-bar { height: 28px; display: flex; align-items: center; gap: 10px; padding: 0 12px; font-size: 11px; color: var(--dim); border-top: 1px solid var(--border); flex-shrink: 0; overflow-x: auto; overflow-y: hidden; white-space: nowrap; user-select: none; }

  /* ── iPad (768–1024px): narrower version list ── */
  @media (max-width: 1024px) and (min-width: 768px) {
    .sp-version-list { width: 160px; }
    .sp-version-item { grid-template-columns: 36px 1fr; }
    .sp-version-item .sp-size-col,
    .sp-version-item .sp-delta-col { display: none; }
  }

  /* ── iPhone (<768px): push/pop navigation ── */
  @media (max-width: 767px) {
    .sp-changelog-body { flex-direction: column; position: relative; }
    .sp-agent-list { display: none; }
    .sp-version-list { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
    .sp-version-item { grid-template-columns: 42px 1fr auto auto; }
    .sp-content-area { width: 100%; display: none; }
    .sp-changelog-body.sp-mobile-detail .sp-version-list { display: none; }
    .sp-changelog-body.sp-mobile-detail .sp-content-area { display: block; flex: 1; }
  }
  @media (max-width: 599px) {
    .fp-content { padding: 12px; }
    .cost-card { border: none; border-radius: 0; border-bottom: 1px solid var(--border); max-width: none; }
  }

  /* ── Toast Notifications ── */
  #toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
  .toast { pointer-events: auto; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--yellow); color: var(--text); padding: 10px 14px; border-radius: 4px; font-size: 12px; max-width: 400px; cursor: pointer; animation: toast-in 0.3s ease-out; line-height: 1.5; }
  .toast.fade-out { animation: toast-out 0.3s ease-in forwards; }
  @keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes toast-out { from { opacity: 1; } to { opacity: 0; transform: translateY(10px); } }

  /* ── Detail Panel: Tool-Specific Rendering ── */
  .detail-tool-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
  .detail-tool-title { font-size: 13px; font-weight: bold; display: flex; align-items: center; gap: 6px; }
  .detail-meta { padding: 4px 0; font-size: 12px; color: var(--dim); }
  .detail-meta code { color: var(--accent); background: var(--bg); padding: 1px 4px; border-radius: 2px; font-size: 11px; }
  .detail-meta-line { font-size: 11px; color: var(--dim); margin-top: 2px; }
  .detail-tag { font-size: 9px; background: var(--border); color: var(--dim); padding: 1px 4px; border-radius: 2px; }
  .detail-cmd-block { background: var(--bg); border: 1px solid var(--border); padding: 8px; border-radius: 4px; }
  .detail-collapse-bar { text-align: center; padding: 6px; margin: 4px 0; background: var(--surface); border: 1px dashed var(--border); border-radius: 4px; color: var(--dim); font-size: 11px; cursor: pointer; }
  .detail-collapse-bar:hover { background: var(--surface-hover); color: var(--accent); }
  .detail-diff { border: 1px solid var(--border); border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
  .detail-diff-section { padding: 4px 0; }
  .detail-diff-label { font-size: 10px; color: var(--dim); padding: 2px 8px; font-weight: 600; letter-spacing: 0.05em; }
  .detail-diff-old { background: rgba(248, 81, 73, 0.06); border-bottom: 1px solid var(--border); }
  .detail-diff-new { background: rgba(63, 185, 80, 0.06); }
  .diff-line-del { color: var(--red); }
  .diff-line-add { color: var(--green); }
  .detail-thinking .think-para { margin-bottom: 12px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; font-size: 12px; }
  .detail-copy-btn { background: none; border: 1px solid var(--border); border-radius: 3px; color: var(--dim); cursor: pointer; padding: 2px 6px; font-size: 11px; flex-shrink: 0; }
  .detail-copy-btn:hover { color: var(--text); background: var(--surface); }
  .detail-input-details summary { cursor: pointer; font-size: 11px; color: var(--yellow); margin-bottom: 2px; }
  .detail-input-details { margin-bottom: 6px; padding: 6px 8px; background: var(--bg); border-radius: 4px; }

  /* Intercept-edited request banner (server-authoritative; see renderEditedBanner) */
  .edit-banner { margin-bottom: 8px; padding: 6px 8px; background: var(--bg); border: 1px solid var(--border); border-left: 3px solid var(--yellow); border-radius: 4px; }
  .edit-badge { display: inline-block; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; color: var(--bg); background: var(--yellow); padding: 1px 6px; border-radius: 3px; }
  .edit-summary { margin-top: 4px; }
  .edit-summary-line { font-size: 11px; color: var(--dim); white-space: pre-wrap; word-break: break-word; }
  .edit-original { margin-top: 6px; }
  .edit-original summary { cursor: pointer; font-size: 11px; color: var(--yellow); }

/* ── Prompt badge (#89) ── */
.prompt-badge { padding: 4px 10px; font-size: 11px; color: var(--dim); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 4px; }
.prompt-badge-sub { opacity: 0.5; }
.provider-dot { font-size: 10px; }
.provider-anthropic { color: #a855f7; }
.provider-openai { color: #22c55e; }
.provider-grok { color: #a78bfa; } /* Grok display group (UI only; wire stays openai) */
.provider-unknown { color: #6b7280; }
.prompt-link { color: var(--accent); text-decoration: none; cursor: pointer; margin-left: 6px; font-size: 10px; }
.prompt-link:hover { text-decoration: underline; }
.tools-warning { padding: 4px 10px; font-size: 11px; color: #f59e0b; background: rgba(245,158,11,0.08); border-bottom: 1px solid var(--border); }
.tools-compare-toggle { color: var(--accent); cursor: pointer; text-decoration: none; margin-left: 8px; font-size: 10px; }
.tools-compare-toggle:hover { text-decoration: underline; }
.tools-diff { padding: 4px 10px; font-family: monospace; font-size: 11px; }
.tools-added { color: #22c55e; }
.tools-removed { color: #f87171; }
.tools-diff-summary { color: var(--dim); margin-top: 2px; }
/* ── Agent group headers (#89) ── */
.agent-group-header { padding: 6px 10px 2px; font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.version-sessions { font-size: 10px; color: var(--dim); cursor: pointer; padding: 0 10px 4px; }
.version-sessions:hover { color: var(--fg); }
.session-list { padding: 0 10px 4px 20px; font-size: 10px; font-family: monospace; }
.session-list a { color: var(--accent); text-decoration: none; display: block; padding: 1px 0; }
.session-list a:hover { text-decoration: underline; }
.sysprompt-breadcrumb { padding: 6px 12px; font-size: 11px; border-bottom: 1px solid var(--border); background: var(--surface); }
.sysprompt-breadcrumb a { color: var(--accent); text-decoration: none; cursor: pointer; }
.sysprompt-breadcrumb a:hover { text-decoration: underline; }

/* Restore: hide empty right-side columns (#332) */

/* Cold-loading: hide empty sections/detail, let turns fill the space (#316) */
#columns.cold-loading #col-sections,
#columns.cold-loading #col-detail { display: none; }
#columns.cold-loading #col-turns { display: block; flex: 1; overflow: hidden; }

/* ── Workflow Swimlane Timeline (#91) ── */
/* When workflow is active, col-turns becomes the full-width right area;
   col-sections and col-detail are hidden (agent card + steps live inside col-turns) */
#columns.wf-active #col-sections,
#columns.wf-active #col-detail { display: none; }
#columns.wf-active #col-turns { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
#columns.wf-active #col-turns .turn-item { display: none !important; }
#columns.wf-active #col-turns .col-sticky-header { display: none; }
#wf-timeline { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
#wf-overview { flex-shrink: 0; border-bottom: 1px solid var(--border); position: relative; display: flex; align-items: flex-start; }
#wf-overview-label { width: 240px; flex-shrink: 0; padding: 4px 10px; font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.5px; display: flex; flex-direction: column; gap: 3px; }
#wf-overview-label .wf-ol-row { display: flex; align-items: center; gap: 4px; }
/* Row 2 always renders (toggle button never disappears) so the label's
   height and every button's position stay fixed whether focus mode is on
   or off — only the pager fades in on the right, filling otherwise-empty
   space instead of the row itself appearing/disappearing. Toggle stays far
   left, pager far right — more separation than the flagged 4px gap, so
   they don't read as one adjacent control pair. */
#wf-overview-label .wf-ol-row-mode { justify-content: space-between; }
#wf-overview-label button { background: transparent; border: 1px solid var(--border); color: var(--dim); width: 18px; height: 18px; font-size: 12px; cursor: pointer; border-radius: 2px; display: flex; align-items: center; justify-content: center; padding: 0; }
#wf-overview-label button:hover { color: var(--text); border-color: var(--dim); }
#wf-overview-label button.active { color: var(--accent); border-color: var(--accent); }
#wf-overview-label .wf-lane-pos { font-size: 10px; color: var(--dim); white-space: nowrap; }
/* height set by JS: wfOverviewHeight(laneCount), 28-48px */
#wf-minimap-canvas { flex: 1; min-width: 0; height: 28px; cursor: pointer; display: block; margin: 2px 8px 2px 0; }
#wf-lanes-section { position: relative; flex-shrink: 0; overflow-y: auto; overflow-x: hidden; transition: max-height 200ms ease; }
#wf-cursor { position: absolute; top: 0; bottom: 0; min-width: 3px; background: var(--accent); opacity: 0.35; pointer-events: none; z-index: 10; }
#wf-main-svg { display: block; position: sticky; top: 0; z-index: 5; background: var(--bg); }
#wf-sub-scroll { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
#wf-sub-scroll::-webkit-scrollbar { width: 4px; }
#wf-sub-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
#wf-sub-svg { display: block; }
#wf-resize { height: 8px; cursor: row-resize; background: var(--bg); flex-shrink: 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); transition: background 0.15s, height 0.15s; display: flex; align-items: center; justify-content: center; }
#wf-resize::after { content: ''; width: 32px; height: 3px; border-radius: 2px; background: var(--border); }
#wf-resize:hover { background: rgba(88,166,255,0.2); }
#wf-resize:hover::after { background: var(--dim); }
/* Lane-focus mode locks the strip's height (nothing left to drag), so this
   same spot becomes a click target back to the normal draggable state
   instead of a grip handle that silently stops responding at the floor. */
#wf-resize.wf-resize-expand { height: 15px; cursor: pointer; }
#wf-resize.wf-resize-expand::after { content: '▾ show all agents'; width: auto; height: auto; border-radius: 0; background: none; color: var(--dim); font-size: 10px; letter-spacing: 0.2px; }
#wf-resize.wf-resize-expand:hover::after { color: var(--text); }
#wf-detail-area { flex: 1; display: flex; min-height: 180px; overflow: hidden; }
#wf-agent-card-panel { width: 240px; flex-shrink: 0; overflow-y: auto; border-right: 1px solid var(--border); background: var(--surface); }
#wf-steps-panel { flex: 1; overflow-y: auto; min-width: 0; }
.weather-overlay { position: fixed; display: none; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 12px 16px; font-size: 13px; color: var(--text); z-index: 200; pointer-events: none; max-width: 380px; box-shadow: 0 4px 20px rgba(0,0,0,0.6); line-height: 1.8; }
.weather-overlay .wo-header { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.weather-overlay .wo-factors { color: var(--dim); font-size: 13px; margin-bottom: 8px; }
.weather-overlay .wo-action { color: var(--text); font-size: 13px; }
.wo-turn-link { color: var(--link, #58a6ff); cursor: pointer; text-decoration: underline; }
.wo-turn-link:hover { color: var(--link-hover, #79c0ff); }
.wf-tooltip { position: fixed; display: none; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 6px 10px; font-size: 11px; color: var(--text); z-index: 100; pointer-events: none; max-width: 300px; box-shadow: 0 2px 8px rgba(0,0,0,0.3); line-height: 1.6; }
.wf-tooltip .r { display: flex; justify-content: space-between; gap: 16px; }
.wf-tooltip .l { color: var(--dim); }
.wf-tooltip .v { font-weight: 600; }
.wf-tooltip .wf-tt-good { color: #3fb950; }
.wf-tooltip .wf-tt-warn { color: #d29922; }
.wf-tooltip .wf-tt-danger { color: #f85149; }
.wf-tooltip .wf-tt-outlier { color: #f0883e; font-weight: 400; }
.wf-tooltip .wf-tt-lock { color: var(--accent); font-size: 9px; font-weight: 400; }
/* v8 spotlight (hover/lock) + cross-lane dim */
#wf-timeline g.wf-lane.dim { opacity: 0.55; transition: opacity 0.15s; }
#wf-timeline g.wf-lane.dim:hover { opacity: 0.7; }
#wf-timeline g.wf-lane.wf-spot .wf-b,
#wf-timeline g.wf-lane.wf-spot .wf-c,
#wf-timeline g.wf-lane.wf-spot .wf-e { opacity: 0.2; }
#wf-timeline g.wf-lane.wf-spot .wf-b.hl,
#wf-timeline g.wf-lane.wf-spot .wf-c.hl,
#wf-timeline g.wf-lane.wf-spot .wf-e.hl { opacity: 1; }
.wf-agent-card { padding: 8px 12px; }
.wf-agent-card .wf-ac-name { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 6px; }
.wf-agent-card .wf-ac-model { font-size: 10px; padding: 1px 6px; border-radius: 3px; font-weight: normal; }
.wf-agent-card .wf-ac-meta { font-size: 11px; color: var(--dim); margin-top: 4px; }
.wf-agent-card .wf-ac-section { margin-top: 8px; font-size: 11px; }
.wf-agent-card .wf-ac-section-title { color: var(--dim); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px; }
.wf-agent-card .wf-ac-row { display: flex; justify-content: space-between; padding: 1px 0; }
.wf-agent-card .wf-ac-row .wf-ac-val { color: var(--text); }
.wf-agent-card .wf-ac-tool { color: var(--dim); }
.wf-agent-card .wf-ac-tool-count { color: var(--text); margin-left: 4px; }
.wf-agent-card .wf-ac-nav { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 1px; }
.wf-agent-card .wf-ac-nav-item { display: flex; justify-content: space-between; padding: 4px 6px; color: var(--dim); cursor: pointer; font-size: 11px; border-radius: 3px; }
.wf-agent-card .wf-ac-nav-item:hover { background: var(--surface-hover); color: var(--text); }
.wf-agent-card .wf-ac-nav-active { background: var(--surface-active); color: var(--text); }
.wf-agent-card .wf-ac-nav-badge { font-size: 10px; color: var(--dim); }
#wf-steps-content { flex: 1; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; }
/* Focused timeline inside workflow: header stays fixed, split pane fills remaining space */
#wf-steps-content > .fp-header,
#wf-steps-content > .col-header { flex-shrink: 0; }
#wf-steps-content > .tl-split { flex: 1; min-height: 0; }
@media (pointer: coarse) {
  #wf-resize { height: 16px; }
  #wf-resize::after { content: ''; display: block; width: 24px; height: 3px; background: var(--dim); border-radius: 2px; margin: 6px auto; }
}

/* ── Skeleton Loading States (#184) ── */
.skeleton {
  background: linear-gradient(90deg, #2a2a2a 25%, #333 50%, #2a2a2a 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: 4px;
}
[data-theme="light"] .skeleton {
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
}
@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { display: inline-block; height: 12px; width: 80px; vertical-align: middle; }
.skeleton-block { display: block; width: 100%; height: 14px; margin-bottom: 4px; }

/* ── Turn Card (L2 left panel, #251) ─────────────────────────── */
.wf-turn-card { padding: 12px; font-size: 12px; }
.wf-tc-back { cursor: pointer; color: var(--accent); font-size: 11px; margin-bottom: 6px; }
.wf-tc-back:hover { text-decoration: underline; }
.wf-tc-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.wf-tc-crumb { font-size: 11px; color: var(--dim); margin-bottom: 10px; }
.wf-tc-ctx-bar { height: 4px; background: var(--surface); border-radius: 2px; margin-top: 4px; overflow: hidden; }

/* ── Hover Preview (#251) ─────────────────────────────────────── */
.wf-hover-preview { padding: 12px; font-size: 12px; }
.wf-hp-title { padding: 4px 8px; border-radius: 3px; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.wf-hp-row { display: flex; justify-content: space-between; padding: 2px 0; }
.wf-hp-row span:last-child { font-family: 'SF Mono','Cascadia Code','Fira Code',monospace; font-size: 11px; }
.wf-hp-lane-ctx { margin-top: 8px; font-size: 10px; color: var(--dim); }
