/* CoAuthor — one system. Palette dealt by the taste skill for a developer tool: cool grey + cobalt.
   Type: Inter (UI, a neutral face built for interfaces) + JetBrains Mono (code); the document is set in Source Serif 4. Shape: soft (see SOFT SHELL at the end: rounded cards on a canvas, pill controls). */
:root {
  --g-main: #eef0f3; --g-surface: #e2e5ea; --panel: #f7f8fa; --paper: #ffffff;
  --ink: #0b0c0e; --muted: #4a505a; --muted-2: #767c86;
  --line: rgba(11, 12, 14, .12); --line-2: rgba(11, 12, 14, .22); --line-3: rgba(11, 12, 14, .38);
  --on-ink: #ffffff; --ink-hover: #26282c; --btn-hover: #f1f2f4; --row-hover: #fafbfc;
  --ai: #8a4a0c; --ai-bar: #dba65a; --ai-bg: #fdf8ef; --ai-soft: #f7e9cf; --ai-line-bg: #fffaf1;
  --hu: #4a5478; --hu-bar: #aab2cc; --hu-soft: #e7eaf3;
  --ok: #1b6b3d; --ok-bar: #74b892; --ok-soft: #dcefe3;
  --cm: #be123c; --cm-bg: #ffe3ea; --cm-flash: #fda4b8;
  --err: #b91c1c; --err-soft: #fdecec; --err-line: #f5c2c7;
  --warn-bg: #fff8ea; --warn-line: #f3cf8e;
  --ins-bg: #d8f3e3; --ins-ink: #14532d; --del-bg: #fde2e2; --del-ink: #991b1b;
  --pdf-bg: #525659; --shadow: rgba(11, 12, 14, .16);
  --syn-cmd: #1f2de6; --syn-comment: #6b7280; --syn-num: #0f766e; --syn-string: #166534; --syn-builtin: #9a4a07; --syn-bracket: #4a505a;
  --cm-active: #f4f6fb; --cm-sel: #dfe3ff;
  color-scheme: light;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --serif: "Source Serif 4", "Iowan Old Style", Palatino, Georgia, serif;
  --m-in: 150ms; --m-out: 120ms; --m-press: 90ms; --m-panel: 200ms;
  --left: 268px; --right: 392px; --rail: 232px;
  /* the panels' widths as used: the width you dragged them to, unless that would squeeze the editor in the
     middle below ~360px; then they give way, but never below a share of the window (24% left, 34% right), so in a
     narrow window all three panes shrink together (like Overleaf) and the editor always keeps room */
  --left-w: min(var(--left), max(24vw, calc(100vw - var(--right) - 360px)));
  --right-w: min(var(--right), max(34vw, calc(100vw - var(--left-w) - 360px)));
  --ui-size: 13px; --code-size: 13.5px; --code-lh: 1.6; --code-liga: none; --doc-size: 16px;
}
:root[data-theme="dark"] {
  --g-main: #1b222c; --g-surface: #2f3a4c; --panel: #222a35; --paper: #262f3c;
  --ink: #edf0f5; --muted: #b5bdc9; --muted-2: #8e98a7;
  --line: rgba(230, 233, 239, .10); --line-2: rgba(230, 233, 239, .18); --line-3: rgba(230, 233, 239, .32);
  --on-ink: #151b23; --ink-hover: #cfd5df; --btn-hover: #323d4f; --row-hover: #2a3442;
  --ai: #f0b45e; --ai-bar: #a87a3c; --ai-bg: rgba(217, 161, 79, .07); --ai-soft: rgba(217, 161, 79, .18); --ai-line-bg: rgba(217, 161, 79, .06);
  --hu: #b3bcda; --hu-bar: #58637f; --hu-soft: rgba(163, 171, 201, .16);
  --ok: #86d3a6; --ok-bar: #4b8f69; --ok-soft: rgba(109, 179, 138, .16);
  --cm: #fb8aa5; --cm-bg: rgba(251, 127, 156, .16); --cm-flash: rgba(251, 127, 156, .45);
  --err: #f39a9a; --err-soft: rgba(243, 139, 139, .12); --err-line: rgba(243, 139, 139, .35);
  --warn-bg: rgba(240, 180, 94, .10); --warn-line: rgba(240, 180, 94, .35);
  --ins-bg: rgba(109, 179, 138, .24); --ins-ink: #a8e6c0; --del-bg: rgba(243, 139, 139, .18); --del-ink: #f5a3a3;
  --pdf-bg: #11161d; --shadow: rgba(0, 0, 0, .45);
  --syn-cmd: #8fb0ff; --syn-comment: #8e98a7; --syn-num: #5fd3c4; --syn-string: #9fd8a8; --syn-builtin: #f0b45e; --syn-bracket: #b5bdc9;
  --cm-active: rgba(255, 255, 255, .045); --cm-sel: rgba(143, 163, 255, .28);
  color-scheme: dark;
}
:root { --accent: #1f2de6; --accent-hover: #1b27c6; --on-accent: #ffffff; }
:root[data-accent="green"] { --accent: #0b7d3e; --accent-hover: #086531; }
:root[data-accent="teal"] { --accent: #0f766e; --accent-hover: #0b5e57; }
:root[data-accent="graphite"] { --accent: #374151; --accent-hover: #1f2937; }
:root[data-theme="dark"] { --accent: #8f9bff; --accent-hover: #a9b2ff; --on-accent: #10142e; }
:root[data-theme="dark"][data-accent="green"] { --accent: #4cc283; --accent-hover: #66d197; --on-accent: #0b1f13; }
:root[data-theme="dark"][data-accent="teal"] { --accent: #45c4b5; --accent-hover: #62d2c5; --on-accent: #08201d; }
:root[data-theme="dark"][data-accent="graphite"] { --accent: #cdd3dd; --accent-hover: #e2e6ec; --on-accent: #151b23; }
:root[data-accent="violet"] { --accent: #6d28d9; --accent-hover: #5b21b6; --on-accent: #ffffff; }
:root[data-theme="dark"][data-accent="violet"] { --accent: #b197fc; --accent-hover: #c4b1fd; --on-accent: #1c1236; }
:root[data-accent="plum"] { --accent: #a21caf; --accent-hover: #86198f; --on-accent: #ffffff; }
:root[data-theme="dark"][data-accent="plum"] { --accent: #e48ef0; --accent-hover: #eaa7f3; --on-accent: #250a29; }
:root[data-accent="rose"] { --accent: #be185d; --accent-hover: #9d174d; --on-accent: #ffffff; }
:root[data-theme="dark"][data-accent="rose"] { --accent: #f48fb1; --accent-hover: #f8a9c4; --on-accent: #2a0f1b; }
:root[data-accent="crimson"] { --accent: #c0262d; --accent-hover: #a11f25; --on-accent: #ffffff; }
:root[data-theme="dark"][data-accent="crimson"] { --accent: #f28b82; --accent-hover: #f5a39c; --on-accent: #2a0d0b; }
:root[data-accent="amber"] { --accent: #b45309; --accent-hover: #92400e; --on-accent: #ffffff; }
:root[data-theme="dark"][data-accent="amber"] { --accent: #f5b454; --accent-hover: #f8c477; --on-accent: #2a1a05; }
:root[data-accent="moss"] { --accent: #4d7c0f; --accent-hover: #3f6212; --on-accent: #ffffff; }
:root[data-theme="dark"][data-accent="moss"] { --accent: #a3d55f; --accent-hover: #b6e07c; --on-accent: #142006; }
:root[data-accent="sky"] { --accent: #0369a1; --accent-hover: #075985; --on-accent: #ffffff; }
:root[data-theme="dark"][data-accent="sky"] { --accent: #6cc4f0; --accent-hover: #8ad1f4; --on-accent: #052030; }
:root { --accent-soft: color-mix(in srgb, var(--accent) 11%, var(--paper)); --me-bg: color-mix(in srgb, var(--accent) 8%, var(--paper));
  --me-line: color-mix(in srgb, var(--accent) 22%, var(--paper)); --focus-ring: color-mix(in srgb, var(--accent) 22%, transparent); }
/* the code editor can have its own scheme (Settings → Appearance) */
:root[data-code-theme="dark"] .CodeMirror, :root[data-code-theme="dark"] .CodeMirror-hints { --panel: #222a35; --paper: #262f3c; --ink: #edf0f5; --muted: #b5bdc9; --muted-2: #8e98a7; --line: rgba(230, 233, 239, .10); --line-2: rgba(230, 233, 239, .18); --ai-line-bg: rgba(217, 161, 79, .06); --cm-bg: rgba(251, 127, 156, .16); --err-soft: rgba(243, 139, 139, .12); --syn-cmd: #8fb0ff; --syn-comment: #8e98a7; --syn-num: #5fd3c4; --syn-string: #9fd8a8; --syn-builtin: #f0b45e; --syn-bracket: #b5bdc9; --cm-active: rgba(255, 255, 255, .045); --cm-sel: rgba(143, 163, 255, .28); color-scheme: dark; }
:root[data-code-theme="light"] .CodeMirror, :root[data-code-theme="light"] .CodeMirror-hints { --panel: #f7f8fa; --paper: #ffffff; --ink: #0b0c0e; --muted: #4a505a; --muted-2: #767c86; --line: rgba(11, 12, 14, .12); --line-2: rgba(11, 12, 14, .22); --ai-line-bg: #fffaf1; --cm-bg: #ffe3ea; --err-soft: #fdecec; --syn-cmd: #1f2de6; --syn-comment: #6b7280; --syn-num: #0f766e; --syn-string: #166534; --syn-builtin: #9a4a07; --syn-bracket: #4a505a; --cm-active: #f4f6fb; --cm-sel: #dfe3ff; color-scheme: light; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font: 400 var(--ui-size)/1.45 var(--font); font-feature-settings: "cv11", "ss03"; font-variant-numeric: tabular-nums; color: var(--ink); background: var(--g-main); display: grid; grid-template-rows: 44px 1fr 26px; overflow: hidden; -webkit-font-smoothing: antialiased; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip-link { position: absolute; left: 8px; top: -40px; z-index: 100; background: var(--ink); color: var(--on-ink); padding: 6px 10px; border-radius: var(--r-sm); }
.skip-link:focus { top: 6px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 13px; }
.grow { flex: 1; }
svg.i { flex: none; display: block; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
input, textarea, select { font: 400 13px/1.45 var(--font); color: var(--ink); background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 6px 8px; width: 100%; transition: border-color var(--m-in), box-shadow 140ms; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
textarea { resize: vertical; }
label { display: block; font-size: 13px; font-weight: 500; margin: 12px 0 5px; }
label .muted { font-weight: 400; }

/* ---------------------------------------------------------------- buttons (one system) */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--paper); color: var(--ink); font: 500 13px/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: transform var(--m-out), background var(--m-out), border-color var(--m-out); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 13px; }
.btn.icon-only { padding: 0; width: 30px; justify-content: center; }
.btn.icon-only.sm { width: 26px; }
.btn.ai svg { color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary svg { color: var(--on-accent); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn.dark svg { color: var(--on-ink); }
.btn.ok svg { color: var(--ok-bar); }
.btn.danger { color: var(--err); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
@media (hover: hover) and (pointer: fine) {
  .btn:not(:disabled):hover { transform: translateY(-1px); background: var(--btn-hover); border-color: var(--line-3); transition-duration: var(--m-in); }
  .btn.primary:not(:disabled):hover { background: var(--accent-hover); border-color: var(--accent-hover); }
  .btn.dark:not(:disabled):hover { background: var(--ink-hover); }
}
.btn:not(:disabled):active { transform: translateY(1px) scale(.985); transition-duration: var(--m-press); }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--g-surface); font: 600 12px/1 var(--font); color: var(--ink); }
.count.hot { background: var(--accent); color: var(--on-accent); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: transparent; }
.dot.ok { background: var(--ok-bar); } .dot.err { background: var(--err); } .dot.run { background: var(--ai-bar); }
.vsep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.link { color: var(--accent); text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size var(--m-out); cursor: pointer; }
.link:hover { background-size: 100% 1px; transition-duration: var(--m-in); }

/* ---------------------------------------------------------------- top bar */
#top { display: flex; align-items: center; gap: 8px; padding: 0 10px; background: var(--panel); border-bottom: 1px solid var(--line); min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; border: 0; background: none; font: 600 14px/1 var(--font); letter-spacing: -.01em; cursor: pointer; padding: 4px; border-radius: var(--r-sm); color: var(--ink); }
.mark { display: inline-grid; grid-template-columns: repeat(3, 4px); gap: 2px; align-items: end; height: 14px; }
.mark i { display: block; width: 4px; background: var(--ink); border-radius: 1px; }
.mark i:nth-child(1) { height: 7px; } .mark i:nth-child(2) { height: 14px; background: var(--accent); } .mark i:nth-child(3) { height: 10px; }
.crumb-sep { color: var(--line-2); }
.proj-title { border: 0; background: none; font: 500 13.5px/1 var(--font); padding: 6px; border-radius: var(--r-sm); cursor: pointer; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.proj-title:hover { background: var(--g-surface); }
.seg { display: inline-flex; padding: 2px; background: var(--g-surface); border-radius: var(--r-md); margin-left: 6px; }
.seg button { border: 0; background: transparent; font: 500 13px/1 var(--font); padding: 6px 12px; border-radius: var(--r-sm); cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--ink); color: var(--on-ink); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; min-width: 0; }
@media (max-width: 1320px) { .top-actions .btn.ai { font-size: 0; gap: 0; padding: 0 8px; } .top-actions .btn.ai .count { font-size: 12px; margin-left: 4px; } }

/* ---------------------------------------------------------------- layout */
#app { display: grid; grid-template-columns: var(--left-w) 4px minmax(0, 1fr) 4px var(--right-w); min-height: 0; }
#left, #right { background: var(--panel); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.resizer { cursor: col-resize; background: var(--line); }
.resizer:hover, .resizer.drag { background: var(--accent); }
.tabs { display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line); flex: none; }
.tabs button { position: relative; border: 0; background: none; font: 500 13px/1 var(--font); color: var(--muted); padding: 12px 7px 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); }
.tabs button.on::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: -1px; height: 2px; background: var(--ink); }
.pane { flex: 1; overflow-y: auto; padding: 10px 12px 24px; min-height: 0; }
.pane.flush { padding: 0; display: flex; flex-direction: column; }
.pane-tools { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.empty { color: var(--muted); padding: 18px 6px; text-align: center; }

/* ---------------------------------------------------------------- file tree */
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree li > .row { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 6px; border-radius: var(--r-sm); cursor: pointer; position: relative; }
.tree li > .row:hover { background: var(--g-surface); }
.tree li > .row.on { background: var(--accent-soft); }
.tree .tw { width: 14px; color: var(--muted); }
.tree .fi { width: 16px; height: 16px; object-fit: contain; flex: none; }
.tree .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree .tag { font: 600 11.5px/1 var(--font); padding: 3px 5px; border-radius: 3px; background: var(--ink); color: var(--on-ink); }
.tree .mini { width: 34px; height: 4px; display: flex; border-radius: 2px; overflow: hidden; background: var(--g-surface); flex: none; }
.tree .mini i { height: 100%; }
.tree .acts { display: none; gap: 2px; }
.tree .row:hover .acts { display: flex; }
.tree .row:hover .mini, .tree .row:hover .sz { display: none; }
.tree .acts button { border: 0; background: none; padding: 3px; border-radius: 3px; cursor: pointer; color: var(--muted); }
.tree .acts button:hover { background: var(--paper); color: var(--ink); }
.tree .sz { color: var(--muted); font-size: 12px; }
.drop-hint { outline: 2px dashed var(--accent); outline-offset: -6px; }

/* ---------------------------------------------------------------- outline / kpis / brief */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; margin-bottom: 10px; }
.kpi { background: var(--paper); padding: 8px 9px; }
.kpi b { display: block; font: 600 17px/1.1 var(--font); letter-spacing: -.01em; }
.kpi span { color: var(--muted); font-size: 12.5px; }
.kpi.warn b { color: var(--ai); }
.meter { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--g-surface); }
.meter.big { height: 8px; }
.meter i, .mini i { display: block; height: 100%; }
.ai_draft-f { background: var(--ai-bar); } .human_edit-f { background: var(--hu-bar); } .approved-f { background: var(--ok-bar); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 8px 0 12px; color: var(--muted); font-size: 12.5px; }
.sw { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.sw.ai_draft { background: var(--ai-bar); } .sw.human_edit { background: var(--hu-bar); } .sw.approved { background: var(--ok-bar); }
.sw.comment { background: var(--cm-bg); box-shadow: inset 0 -2px 0 var(--cm); }
.outline-head { display: grid; grid-template-columns: 1fr 44px 52px; gap: 6px; color: var(--muted); font-size: 12.5px; padding: 0 6px 4px; border-bottom: 1px solid var(--line); }
.outline { list-style: none; padding: 0; margin: 0; }
.outline li { display: grid; grid-template-columns: 1fr 44px 52px; gap: 6px; align-items: center; padding: 5px 6px; border-radius: var(--r-sm); cursor: pointer; }
.outline li:hover { background: var(--g-surface); }
.outline .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outline .t small { color: var(--muted); font: 500 11.5px var(--mono); margin-left: 4px; }
.outline .l2 .t { padding-left: 12px; } .outline .l3 .t { padding-left: 24px; } .outline .l4 .t { padding-left: 36px; }
.outline .w { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ---------------------------------------------------------------- center */
#center { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--g-main); outline: none; }
.center-bar { flex: none; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--panel); min-width: 0; }
.center-bar .path { display: flex; align-items: center; gap: 6px; font: 500 13px var(--mono); min-width: 0; overflow: hidden; white-space: nowrap; }
.center-bar .path img { width: 16px; height: 16px; object-fit: contain; }
.center-bar .fstats { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.center-bar .fstats .meter { width: 70px; }
.center-bar .right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.toggle input { width: auto; accent-color: var(--accent); }
.scroll { flex: 1; overflow: auto; min-height: 0; }
#code { flex: 1; min-height: 0; position: relative; }
#viewer { display: flex; align-items: flex-start; justify-content: center; padding: 24px; }
#viewer img { max-width: 100%; background: #fff; border: 1px solid var(--line); }
#viewer iframe { width: 100%; height: 100%; border: 0; background: #fff; }

/* ---------------------------------------------------------------- the paper (visual mode): see the end of the file */
/* rendered LaTeX */
.txt .eq { margin: 8px 0; overflow-x: auto; overflow-y: hidden; }
.txt .cite { color: var(--accent); white-space: nowrap; }
.txt .ck.missing { color: var(--err); text-decoration: underline dotted; }
.txt .need { color: var(--err); background: var(--err-soft); border-radius: 3px; padding: 0 4px; font: 600 13px/1.5 var(--font); white-space: normal; }
.txt .need::before { content: "citation needed: "; font-weight: 500; }
.txt .xref { color: var(--accent); font: 500 13px var(--mono); }
.txt .fn { font-size: 13px; color: var(--muted); }
.txt .fn::before { content: "["; } .txt .fn::after { content: "]"; }
.txt .cmd { font: 500 12.5px var(--mono); color: var(--muted); }
.txt .sc { font-variant: small-caps; }
.txt ul, .txt ol { margin: 4px 0; padding-left: 24px; text-align: left; }
.txt .thm { margin: 6px 0; } .txt .thm .lbl { font-weight: 700; } .txt .thm.proof .lbl { font-style: italic; font-weight: 400; }
.txt .thm:not(.proof) { font-style: italic; }
.txt .abstract { margin: 4px 24px; font-size: 15px; } .txt .abstract .lbl { display: block; text-align: center; font-weight: 700; margin-bottom: 4px; }
.txt blockquote { margin: 6px 24px; }
.txt figure { margin: 10px 0; text-align: center; }
.txt figure .imgs { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.txt figure img { max-width: 100%; max-height: 360px; }
.txt figcaption { font-size: 14px; text-align: left; margin-top: 6px; }
.txt .tbl { overflow-x: auto; display: flex; justify-content: center; }
.txt table { border-collapse: collapse; font-size: 14.5px; margin: 6px 0; border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); }
.txt th { border-bottom: 1px solid var(--ink); font-weight: 600; }
.txt th, .txt td { padding: 3px 10px; text-align: center; }
.txt .fig-missing { font: 500 12.5px var(--mono); color: var(--muted); border: 1px dashed var(--line-2); padding: 18px; display: inline-block; }
.txt pre.src { text-align: left; font: 400 12.5px/1.5 var(--mono); background: var(--g-main); padding: 8px 10px; border-radius: var(--r-sm); overflow-x: auto; white-space: pre-wrap; }
.txt ins { background: var(--ins-bg); text-decoration: none; border-radius: 2px; }
.txt ins.m { background: none; box-shadow: inset 0 -2px 0 var(--ok-bar); }
.txt del { color: var(--err); text-decoration: line-through; user-select: none; }
mark.cmt { background: var(--cm-bg); box-shadow: inset 0 -2px 0 var(--cm); color: inherit; border-radius: 2px; cursor: pointer; }
mark.cmt.flash { animation: flash 1.2s; }
@keyframes flash { 0%, 60% { background: var(--cm-flash); } }
.edit-area { font: 400 var(--code-size)/var(--code-lh) var(--mono); font-variant-ligatures: var(--code-liga); min-height: 80px; margin: 4px 0; }
.edit-row { display: flex; align-items: center; gap: 6px; margin: 4px 0 8px; }
.edit-row .hint { margin-right: auto; color: var(--muted); font-size: 12.5px; }
.goal-edit { margin-top: 4px; }

details > summary { cursor: pointer; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.edit-row { display: flex; align-items: center; gap: 6px; margin: 6px 0 8px; }
.edit-row .hint { margin-right: auto; color: var(--muted); font-size: 12.5px; }
.goal-edit { margin-top: 4px; }

/* ---------------------------------------------------------------- code mode */
.CodeMirror { height: 100%; font: 400 var(--code-size)/var(--code-lh) var(--mono); font-variant-ligatures: var(--code-liga); background: var(--paper); color: var(--ink); }
.CodeMirror-gutters { background: var(--panel); border-right: 1px solid var(--line); }
.CodeMirror-linenumber { color: var(--muted-2); padding: 0 8px 0 4px; }
.CodeMirror-activeline-background { background: var(--cm-active); }
.CodeMirror-matchingbracket { color: var(--accent) !important; font-weight: 700; }
.pv-gutter { width: 5px; }
.pv-mark { width: 4px; height: 100%; min-height: 21px; margin-left: 1px; }
.pv-mark.ai_draft { background: var(--ai-bar); } .pv-mark.human_edit { background: var(--hu-bar); opacity: .5; } .pv-mark.approved { background: var(--ok-bar); }
.pv-bg-ai { background: var(--ai-line-bg); }
.cm-cmt { background: var(--cm-bg); border-bottom: 2px solid var(--cm); }
.cm-s-default .cm-tag { color: var(--syn-cmd); } .cm-s-default .cm-keyword { color: var(--syn-cmd); }
.cm-s-default .cm-bracket { color: var(--syn-bracket); } .cm-s-default .cm-comment { color: var(--syn-comment); font-style: italic; }
.cm-s-default .cm-atom { color: var(--syn-num); } .cm-s-default .cm-number { color: var(--syn-num); } .cm-s-default .cm-builtin { color: var(--syn-builtin); }
.cm-s-default .cm-variable-2 { color: var(--syn-num); } .cm-s-default .cm-string { color: var(--syn-string); }
.cm-errline { background: var(--err-soft); }

/* ---------------------------------------------------------------- right panel */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px; margin-bottom: 8px; }
.card .ctx { color: var(--muted); font-size: 12.5px; margin-bottom: 3px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .ctx:hover { color: var(--accent); }
.card .qt { font-weight: 500; margin-bottom: 6px; line-height: 1.35; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.chip { border: 1px solid var(--line-2); background: var(--paper); border-radius: 12px; padding: 3px 9px; font: 500 12.5px/1.2 var(--font); cursor: pointer; color: var(--ink); transition: background var(--m-out), border-color var(--m-out); }
.chip:hover { background: var(--g-surface); }
.chip.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.card .row { display: flex; gap: 4px; }
.card .row input { height: 28px; padding: 4px 8px; }
.card.done { background: transparent; }
.card.done .ans { color: var(--ok); }
.sect-h { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12.5px; margin: 12px 0 6px; }
.research-box { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px; margin-bottom: 8px; }
.research-box .row { display: flex; gap: 6px; }
.research-box .row input { height: 30px; }
.research-box .note { color: var(--muted); font-size: 12.5px; margin-top: 6px; line-height: 1.4; }
.ref-stats { display: flex; gap: 10px; color: var(--muted); font-size: 12.5px; margin: 6px 0; flex-wrap: wrap; }
.ref-stats b { color: var(--ink); }
.ref { padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 13px; }
.ref .top { display: flex; align-items: center; gap: 6px; }
.ref .key { font: 500 12px var(--mono); color: var(--accent); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ref .badge { font: 600 11.5px/1 var(--font); padding: 3px 5px; border-radius: 3px; white-space: nowrap; }
.badge.ver { color: var(--ok); background: var(--ok-soft); } .badge.unver { color: var(--ai); background: var(--ai-soft); } .badge.man { color: var(--muted); background: var(--g-surface); }
.badge.cited { color: var(--ink); background: var(--g-surface); } .badge.uncited { color: var(--muted); background: transparent; border: 1px dashed var(--line-2); }
.ref .t { font-weight: 500; margin: 3px 0 1px; line-height: 1.3; }
.ref .t a { color: inherit; text-decoration: none; } .ref .t a:hover { color: var(--accent); }
.ref .a { color: var(--muted); font-size: 12.5px; }
.ref .n { font-size: 12.5px; margin-top: 3px; line-height: 1.35; }
.ref .n b { color: var(--accent); font-weight: 600; }
.ref .x { margin-left: auto; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 3px; visibility: hidden; }
.ref:hover .x { visibility: visible; }
.ref .x:hover { color: var(--err); background: var(--g-surface); }
.commit { display: grid; grid-template-columns: 8px 1fr auto; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--line); cursor: pointer; align-items: start; font-size: 13px; }
.commit:hover { background: var(--g-surface); }
.commit .d { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; }
.commit .d.ai { background: var(--ai-bar); } .commit .d.human { background: var(--hu-bar); }
.commit .m { line-height: 1.3; }
.commit .w { color: var(--muted); font-size: 12px; margin-top: 2px; }
.commit .w b.ai { color: var(--ai); } .commit .w b.human { color: var(--hu); }
.commit .ch { font: 500 12px var(--mono); white-space: nowrap; text-align: right; }
.commit .ch .a { color: var(--ok); } .commit .ch .r { color: var(--err); }
.pdf-bar { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.pdf-msg { padding: 6px 10px; font-size: 13px; border-bottom: 1px solid var(--line); }
.pdf-msg.ok { color: var(--ok); } .pdf-msg.err { color: var(--err); }
.errs { max-height: 34%; overflow-y: auto; border-bottom: 1px solid var(--line); }
.err-row { display: grid; grid-template-columns: auto 1fr; gap: 8px; padding: 6px 10px; font-size: 13px; cursor: pointer; border-top: 1px solid var(--line); }
.err-row:hover { background: var(--g-surface); }
.err-row code { color: var(--err); }
.err-row.w code { color: var(--ai); }
#pdfFrame { flex: 1; width: 100%; border: 0; background: var(--pdf-bg); min-height: 0; }

/* ---------------------------------------------------------------- status bar */
#status { display: flex; align-items: center; gap: 0; background: var(--panel); border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); padding: 0 6px; white-space: nowrap; overflow: hidden; }
#status .s { padding: 0 8px; display: inline-flex; align-items: center; gap: 5px; border-right: 1px solid var(--line); height: 16px; }
#status .s:last-child { border-right: 0; }
#status .push { margin-left: auto; }
#status b { color: var(--ink); font-weight: 600; }
#status .warn { color: var(--ai); } #status .bad { color: var(--err); } #status .good { color: var(--ok); }

/* ---------------------------------------------------------------- popovers, modal, toasts */
#selPop { position: fixed; z-index: 40; }
.popover { position: fixed; z-index: 41; width: 420px; background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r-lg); padding: 10px; box-shadow: 0 12px 32px var(--shadow); }
.popover .quote { font-size: 13px; color: var(--muted); border-left: 2px solid var(--cm); padding-left: 8px; margin-bottom: 6px; max-height: 56px; overflow: hidden; }
.popover .row { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
#modal { position: fixed; inset: 0; background: rgba(11, 12, 14, .32); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding-top: 8vh; }
#modal[hidden] { display: none; }
.modal-card { background: var(--paper); border-radius: var(--r-lg); width: min(760px, 94vw); max-height: 84vh; overflow-y: auto; padding: 18px 20px; box-shadow: 0 24px 64px var(--shadow); }
.modal-card h2 { margin: 0 0 4px; font: 700 19px/1.25 var(--font); letter-spacing: -.01em; }
.modal-card .sub { color: var(--muted); margin: 0 0 8px; }
.modal-card .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.plan-row { display: grid; grid-template-columns: 20px 1fr 120px; gap: 6px; align-items: start; padding: 6px 0; border-bottom: 1px solid var(--line); }
.plan-row input[type=checkbox] { width: auto; margin-top: 8px; accent-color: var(--accent); }
.plan-row .goal-in { grid-column: 2 / 4; font-size: 13px; }
.proj-list { list-style: none; padding: 0; margin: 8px 0 0; border: 1px solid var(--line); border-radius: var(--r-md); max-height: 300px; overflow-y: auto; }
.proj-list li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.proj-list li:last-child { border-bottom: 0; }
.proj-list li:hover { background: var(--g-main); }
.proj-list li.on { background: var(--accent-soft); }
.proj-list .when { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.proj-list .del { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 3px; border-radius: 3px; }
.proj-list .del:hover { color: var(--err); background: var(--g-surface); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
pre.diff { font: 400 12.5px/1.5 var(--mono); white-space: pre-wrap; background: var(--g-main); border-radius: var(--r-md); padding: 10px; max-height: 56vh; overflow: auto; margin: 8px 0 0; }
pre.diff .add { background: var(--ins-bg); color: var(--ins-ink); } pre.diff .rem { background: var(--del-bg); color: var(--del-ink); text-decoration: line-through; }
pre.diff .file { display: block; color: var(--accent); font-weight: 500; margin-top: 8px; }
pre.diff .hunk { color: var(--muted); }
#busy { position: fixed; left: 50%; top: 52px; transform: translateX(-50%); background: var(--ink); color: var(--on-ink); padding: 7px 14px; border-radius: 16px; display: flex; gap: 8px; align-items: center; z-index: 60; font-weight: 600; box-shadow: 0 8px 24px var(--shadow); }
#busy[hidden] { display: none; }
.spinner { width: 12px; height: 12px; border: 2px solid color-mix(in srgb, var(--on-ink) 35%, transparent); border-top-color: var(--on-ink); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#toasts { position: fixed; bottom: 36px; left: 50%; transform: translateX(-50%); display: grid; gap: 6px; z-index: 70; }
.toast { background: var(--ink); color: var(--on-ink); padding: 8px 14px; border-radius: var(--r-md); font-size: 13.5px; box-shadow: 0 8px 24px var(--shadow); max-width: 620px; }
.toast.err { background: var(--err); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* ---------------------------------------------------------------- left panel: stacked sections */
.pane.stack { padding: 0; }
.lsec { border-bottom: 1px solid var(--line); }
.lsec-head { display: flex; align-items: center; gap: 3px; padding: 6px 8px 6px 4px; position: sticky; top: 0; background: var(--panel); z-index: 2; }
.lsec-toggle { border: 0; background: none; display: flex; align-items: center; gap: 5px; font: 600 12.5px/1 var(--font); color: var(--ink); cursor: pointer; padding: 5px 4px; border-radius: var(--r-sm); }
.lsec-toggle:hover { background: var(--g-surface); }
.lsec-toggle .small { font-weight: 400; }
.lsec-toggle svg { transition: transform var(--m-out); }
.lsec.collapsed .lsec-toggle svg { transform: rotate(-90deg); }
.lsec.collapsed .lsec-body { display: none; }
.lsec-body { padding: 0 10px 12px; }
#pane-files { padding: 0 6px 10px; max-height: 46vh; overflow-y: auto; }

/* ---------------------------------------------------------------- settings */
.set-nav button:hover { background: var(--g-surface); color: var(--ink); }
.prov-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 14px; }
.prov-card { position: relative; display: grid; grid-template-columns: 28px 1fr; gap: 2px 10px; align-items: center; text-align: left; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--paper); cursor: pointer; font: inherit; color: var(--ink); transition: border-color var(--m-out), transform var(--m-out); }
@media (hover: hover) and (pointer: fine) { .prov-card:hover { border-color: var(--line-3); transform: translateY(-1px); transition-duration: var(--m-in); } }
.prov-card.viewing { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.prov-card img { grid-row: 1 / 4; width: 26px; height: 26px; object-fit: contain; }
.prov-card .nm { font-weight: 700; }
.prov-card .st { font-size: 12.5px; color: var(--muted); }
.prov-card .st.ok { color: var(--ok); }
.prov-card .md { font: 500 12px var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prov-card .use { position: absolute; right: 8px; top: 8px; font: 600 11.5px/1 var(--font); padding: 3px 6px; border-radius: 3px; background: var(--accent); color: var(--on-accent); }
.detail { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; background: var(--paper); }
.detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.detail-head img { width: 20px; height: 20px; object-fit: contain; }
.irow { display: flex; gap: 6px; align-items: center; }
.irow input, .irow select { flex: 1; }
.radios { display: flex; gap: 16px; margin: 8px 0 2px; flex-wrap: wrap; }
.radios label, .set-scroll .toggle { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; font-size: 13.5px; color: var(--ink); }
.radios input, .set-scroll input[type=checkbox] { width: auto; accent-color: var(--accent); }
.keynote { font-size: 13px; color: var(--muted); margin: 6px 0 0; line-height: 1.45; }
.keynote.ok { color: var(--ok); }
.btnrow { display: flex; gap: 6px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.testout { font-size: 13px; }
.testout.ok { color: var(--ok); } .testout.bad { color: var(--err); }
.or-connect { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 10px 12px; background: var(--g-main); border-radius: var(--r-md); }
.or-connect img { width: 18px; height: 18px; object-fit: contain; }
.or-connect p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.mlist { margin-top: 8px; border: 1px solid var(--line); border-radius: var(--r-md); max-height: 240px; overflow-y: auto; }
.mlist .mrow { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.mlist .mrow:last-child { border-bottom: 0; }
.mlist .mrow:hover { background: var(--g-main); }
.mlist .mrow.on { background: var(--accent-soft); }
.mlist .mid { font: 500 12px var(--mono); color: var(--muted); }
.mlist .tags { display: flex; gap: 4px; align-items: center; }
.tagx { font: 600 11.5px/1 var(--font); padding: 3px 5px; border-radius: 3px; background: var(--g-surface); color: var(--muted); }
.tagx.free { background: var(--ok-soft); color: var(--ok); }
.status-line { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: var(--r-md); font-size: 13px; margin-top: 10px; line-height: 1.4; }
.status-line.ok { background: var(--ok-soft); color: var(--ok); } .status-line.warn { background: var(--ai-soft); color: var(--ai); }
fieldset { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 14px 14px; margin: 14px 0 0; }
legend { font-weight: 700; padding: 0 6px; }
.preview { margin-top: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--paper); }
.preview.ui { font-family: var(--font); font-size: var(--ui-size); }
.preview.code { font: 400 var(--code-size)/var(--code-lh) var(--mono); font-variant-ligatures: var(--code-liga); white-space: pre; overflow-x: auto; }
.preview.doc { font: 400 var(--doc-size)/1.62 var(--serif); text-align: justify; }
#status .s.click { cursor: pointer; }
#status .s.click:hover { color: var(--accent); }
.tabs { overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; }

/* ---------------------------------------------------------------- export menu */
.menu { position: relative; }
.menu-items { display: none; position: absolute; right: 0; top: calc(100% + 4px); background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r-md); box-shadow: 0 10px 28px var(--shadow); z-index: 30; min-width: 220px; padding: 4px; }
.menu-items.open { display: block; }
.menu-items a { display: block; padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; }
.menu-items a:hover { background: var(--g-main); }

/* ---------------------------------------------------------------- model router */
@media (hover: hover) and (pointer: fine) { .conn:hover { border-color: var(--line-3); transform: translateY(-1px); transition-duration: var(--m-in); } }
.conn.viewing { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.conn .v { font-weight: 600; }
.conn .m { font-size: 12.5px; color: var(--muted); }
.conn .st.ok { color: var(--ok); }
.conn .used { font-size: 12px; color: var(--muted); }
.bill { display: inline-block; font: 500 11.5px/1 var(--font); padding: 4px 6px; border-radius: 3px; white-space: nowrap; }
.bill.plan { background: var(--ok-soft); color: var(--ok); }
.bill.paid { background: var(--ai-soft); color: var(--ai); }
.bill.free { background: var(--accent-soft); color: var(--accent); }
.detail-head .bill { margin-left: 6px; }
.routes th { text-align: left; font-weight: 500; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.routes td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.routes td.task { font-weight: 500; white-space: nowrap; }
.routes input { font-family: var(--mono); font-size: 12.5px; }
.btn.signin-chatgpt { background: #0b0c0e; color: #fff; border-color: #0b0c0e; height: 36px; padding: 0 14px; font-weight: 500; }
.signin-chatgpt img { width: 16px; height: 16px; filter: invert(1); }
@media (hover: hover) and (pointer: fine) { .btn.signin-chatgpt:not(:disabled):hover { background: #26282c; border-color: #26282c; } }

/* ---------------------------------------------------------------- skills */
.palette-card { width: min(720px, 94vw); padding: 0; }
.palette { display: flex; flex-direction: column; max-height: 76vh; }
.pal-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.pal-head svg { color: var(--accent); }
.pal-head input { border: 0; box-shadow: none; padding: 4px 0; font-size: 15px; }
.pal-head input:focus { box-shadow: none; }
kbd { font: 500 11.5px var(--mono); color: var(--muted); border: 1px solid var(--line-2); border-radius: 4px; padding: 2px 5px; }
.pal-body { overflow-y: auto; }
.pal-list { list-style: none; margin: 0; padding: 6px; }
.pal-list li { padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.pal-list li.on { background: var(--accent-soft); }
.pal-list li:hover:not(.on) { background: var(--g-main); }
.pal-list .t, .sk-table .t { display: flex; align-items: center; gap: 8px; }
.pal-list .d, .sk-table .d { color: var(--muted); font-size: 12.5px; margin-top: 2px; line-height: 1.4; }
.src { margin-left: auto; font-size: 12px; color: var(--muted); }
.sk-mode { display: inline-flex; align-items: center; gap: 4px; font: 500 11.5px/1 var(--font); padding: 3px 6px; border-radius: 3px; background: var(--g-surface); color: var(--ink); }
.sk-mode.review { background: var(--cm-bg); color: var(--cm); }
.sk-mode.edit { background: var(--ai-soft); color: var(--ai); }
.sk-mode.insert { background: var(--accent-soft); color: var(--accent); }
.sk-mode.report { background: var(--ok-soft); color: var(--ok); }
.pal-run { border-top: 1px solid var(--line); padding: 12px 16px 14px; background: var(--panel); }
.pal-run .radios { margin: 8px 0; }
.pal-run input:disabled + * , .pal-run label:has(input:disabled) { color: var(--muted); }
.sk-table { list-style: none; padding: 0; margin: 10px 0 0; border: 1px solid var(--line); border-radius: var(--r-md); max-height: 50vh; overflow-y: auto; }
.sk-table li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.sk-table li:last-child { border-bottom: 0; }
.sk-table .acts { display: flex; gap: 4px; }
.mono-area { font: 400 13px/1.55 var(--mono); }
.who-ai { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--accent); font-weight: 500; margin-bottom: 2px; }
.sev { font-weight: 600; }
.sev.critical { color: var(--err); } .sev.major { color: var(--ai); } .sev.minor { color: var(--muted); }
.report-body { max-height: 56vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-md); padding: 4px 18px; font: 400 15px/1.6 var(--serif); }
.txt.md p { margin: 0 0 .6em; } .txt.md p:last-child { margin-bottom: 0; }
.txt.md h1, .txt.md h2, .txt.md h3 { font-family: var(--serif); }
.txt.md code { font: 400 .88em var(--mono); background: var(--g-main); padding: 1px 4px; border-radius: 3px; }
.txt.md pre { text-align: left; background: var(--g-main); padding: 8px 10px; border-radius: var(--r-sm); overflow-x: auto; }
.txt.md pre code { background: none; padding: 0; }
.txt.md table { margin: 6px auto; }
.txt.md td, .txt.md th { border-bottom: 1px solid var(--line); }
.txt.md img { max-width: 100%; }
.txt.md blockquote { border-left: 3px solid var(--line-2); margin: 6px 0; padding-left: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- Projects page */
body.home { display: block; overflow: auto; background: var(--g-main); }
body.home #top { position: sticky; top: 0; z-index: 20; height: 48px; }
.brand-name { color: var(--ink); }
a.brand { text-decoration: none; }
.home-nav { display: flex; gap: 2px; margin-left: 18px; height: 100%; }
.home-nav a { display: flex; align-items: center; padding: 0 12px; color: var(--muted); text-decoration: none; font-weight: 500; position: relative; }
.home-nav a:hover { color: var(--ink); }
.home-nav a.on { color: var(--ink); }
.home-nav a.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--ink); }
.home-main { max-width: 1280px; margin: 0 auto; padding: 28px 32px 80px; }
.home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.home-head h1 { font: 600 22px/1.2 var(--font); letter-spacing: -.01em; margin: 0 0 4px; }
.home-head p { margin: 0; max-width: 760px; }
.home-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.home-tools input#hQ, .home-tools input#skQ { max-width: 320px; }
.home-tools label { margin: 0 0 0 auto; font-weight: 400; }
.home-empty { background: var(--paper); border: 1px dashed var(--line-2); border-radius: var(--r-lg); padding: 40px; text-align: center; }
.ptable-wrap { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: visible; }
.ptable { width: 100%; border-collapse: collapse; }
.ptable th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ptable td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ptable tr:last-child td { border-bottom: 0; }
.ptable tbody tr:hover { background: var(--row-hover); }
.ptable tr.archived { opacity: .65; }
.ptable .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ptable td.num.warn { color: var(--ai); font-weight: 500; }
.ptitle { font-weight: 600; color: var(--ink); text-decoration: none; font-size: 14px; }
.ptitle:hover { color: var(--accent); }
.pobj { color: var(--muted); font-size: 12.5px; margin-top: 3px; max-width: 460px; line-height: 1.4; }
.pmeta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.fmt { font-weight: 500; padding: 1px 6px; border-radius: 3px; background: var(--g-surface); color: var(--ink); }
.fmt.markdown { background: var(--accent-soft); color: var(--accent); }
.pprog { width: 190px; }
.pprog .meter { margin: 6px 0 5px; }
.plast { max-width: 280px; }
.plast .d { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex: none; }
.plast .d.ai { background: var(--ai-bar); } .plast .d.human { background: var(--hu-bar); }
.plast .msg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 230px; }
.pacts { white-space: nowrap; text-align: right; }
.pacts .menu { display: inline-block; vertical-align: top; margin-left: 4px; }
.pacts a.btn { text-decoration: none; }
.menu-items a.danger { color: var(--err); }
.good { color: var(--ok); } .bad { color: var(--err); }
.sk-cols { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.sk-h { font: 600 14px var(--font); margin: 18px 0 6px; }
.sk-h:first-child { margin-top: 0; }
.sk-cols .sk-table { max-height: none; background: var(--paper); }
.sk-help { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; font-size: 13px; line-height: 1.5; position: sticky; top: 64px; }
.sk-help h3 { margin: 0 0 6px; font-size: 14px; }
.sk-help pre { font: 400 12px/1.5 var(--mono); background: var(--g-main); padding: 10px; border-radius: var(--r-md); overflow-x: auto; }
@media (max-width: 1000px) { .sk-cols { grid-template-columns: 1fr; } }

.sk-mode, .tagx, .src, .bill { white-space: nowrap; flex: none; }
.tagx { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
#routeInfo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 640px; }
.plast-in { display: flex; gap: 8px; max-width: 260px; }

/* ---------------------------------------------------------------- settings dialog */
.modal-card.wide { width: min(1060px, 96vw); height: min(800px, 88vh); max-height: none; padding: 0; overflow: hidden; display: flex; }
.settings { display: grid; grid-template-columns: 232px minmax(0, 1fr); width: 100%; height: 100%; min-height: 0; }
.set-nav { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 12px 14px; display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow-y: auto; }
.set-nav h2 { margin: 0; padding: 0 10px 16px; font: 600 17px/1.2 var(--font); letter-spacing: -.01em; }
.set-nav button { display: flex; align-items: flex-start; gap: 10px; width: 100%; border: 0; background: none; padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; text-align: left; color: var(--muted); font: inherit; }
.set-nav button svg { flex: none; margin-top: 1px; }
.set-nav button > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-nav button b { font: 500 13.5px/1.25 var(--font); color: var(--ink); }
.set-nav button small { font-size: 12px; line-height: 1.3; color: var(--muted); }
.set-nav button:hover { background: var(--g-surface); }
.set-nav button.on { background: var(--press); color: var(--ink); }
.set-nav .note { margin: auto 0 0; display: flex; gap: 8px; align-items: flex-start; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.45; color: var(--muted); }
.set-nav .note svg { flex: none; margin-top: 2px; }
.set-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.set-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 18px 20px 16px 28px; border-bottom: 1px solid var(--line); background: var(--paper); }
.set-head .eyebrow { margin: 0 0 6px; font: 500 12px/1 var(--font); color: var(--muted); }
.set-head h2 { margin: 0; font: 600 20px/1.2 var(--font); letter-spacing: -.012em; }
.set-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; max-width: 640px; }
.set-head #setClose { flex: none; }
.set-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 28px 28px; overscroll-behavior: contain; }
.set-sec { padding: 22px 0 24px; border-bottom: 1px solid var(--line); }
.set-sec:last-of-type { border-bottom: 0; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.sec-head h3 { margin: 0; font: 600 14.5px/1.3 var(--font); }
.sec-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; max-width: 600px; }
.form-grid { display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 132px; }
.field > label { margin: 0; font: 500 12.5px/1.2 var(--font); color: var(--muted); }
.field.grow { flex: 1 1 260px; }
.field.wide { flex: 1 1 100%; }
.field.inline { flex: none; flex-direction: row; align-items: center; gap: 8px; }
.field.inline select { width: 290px; }
.field select, .field input { height: 34px; }
.field-val { min-height: 34px; display: flex; align-items: center; gap: 6px; }
.set-foot { display: flex; justify-content: flex-end; padding-top: 4px; }
.set-scroll > .keynote { margin-top: 4px; }
.preview-label { margin: 14px 0 0; font: 500 12px/1 var(--font); color: var(--muted); }
.switch-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; margin: 0 0 14px; border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; font-weight: 400; color: var(--ink); }
.switch-row input { width: auto; margin: 2px 0 0; accent-color: var(--accent); }
.switch-row > span { display: flex; flex-direction: column; gap: 3px; }
.switch-row b { font-weight: 500; }
.switch-row small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.facts { margin: 16px 0 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--r-md); }
.facts li { display: grid; grid-template-columns: 180px 1fr; gap: 16px; padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.45; color: var(--muted); }
.facts li:last-child { border-bottom: 0; }
.facts b { color: var(--ink); font-weight: 500; }
/* provider cards */
.conn-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 12px; }
.conn { display: flex; flex-direction: column; align-items: stretch; gap: 10px; min-width: 0; padding: 12px; text-align: left; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--paper); cursor: pointer; font: inherit; color: var(--ink); transition: border-color var(--m-out), transform var(--m-out); }
.conn-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.conn-top img { flex: none; width: 22px; height: 22px; object-fit: contain; }
.conn-top > span { display: flex; flex-direction: column; min-width: 0; }
.conn .v { font-weight: 600; line-height: 1.25; }
.conn .m { font-size: 12.5px; line-height: 1.3; color: var(--muted); }
.conn .bill { align-self: flex-start; }
.conn-foot { margin-top: auto; display: flex; flex-direction: column; gap: 3px; padding-top: 9px; border-top: 1px solid var(--line); min-width: 0; }
.conn .st { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.conn .st > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn .st.ok { color: var(--ok); }
.conn .used { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail { border-color: var(--line-2); padding: 16px 18px; }
.detail > label { margin-top: 14px; }
.detail .radios { margin-top: 10px; }
/* routing table */
.routes { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 13px; }
.routes col.c-task { width: 19%; } .routes col.c-prov { width: 25%; } .routes col.c-model { width: 25%; } .routes col.c-eff { width: 14%; } .routes col.c-state { width: 17%; }
.routes th { padding: 0 10px 8px; font: 500 12.5px/1.2 var(--font); color: var(--muted); text-align: left; border-bottom: 1px solid var(--line); }
.routes td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.routes tr:last-child td { border-bottom: 0; }
.routes th:first-child, .routes td:first-child { padding-left: 0; }
.routes td.task { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.routes select, .routes input { width: 100%; min-width: 0; height: 32px; padding: 4px 8px; }
.routes input { font: 400 12.5px var(--mono); }
.routes td.state { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.warnline { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; color: var(--ai); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.warnline { border: 0; background: none; padding: 0; font: inherit; font-size: 12.5px; cursor: pointer; }
button.warnline:hover { text-decoration: underline; }
@media (max-width: 900px) {
  .settings { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .set-nav { flex-direction: row; overflow-x: auto; padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .set-nav h2, .set-nav .note, .set-nav button small { display: none; }
  .set-nav button { width: auto; flex: none; }
  .conn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sec-head { flex-direction: column; align-items: stretch; }
  .field.inline select { width: 100%; }
}

/* ---------------------------------------------------------------- assistant, jobs, edit with AI */
.spinner.sm, .spinner.xs { border-color: color-mix(in srgb, var(--accent) 22%, transparent); border-top-color: var(--accent); flex: none; }
.spinner.sm { width: 14px; height: 14px; }
.spinner.xs { width: 10px; height: 10px; border-width: 1.5px; display: inline-block; vertical-align: -1px; }
.top-actions kbd { margin-left: 4px; padding: 1px 4px; font-size: 11px; border-color: currentColor; opacity: .55; color: inherit; }
.ai-activity { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 2px 6px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 12px; }
.tabs .count.live { background: var(--accent-soft); color: var(--accent); gap: 3px; }
.tabs .count.cm, .count.cm { background: var(--cm-bg); color: var(--cm); }
#status .live { color: var(--accent); display: inline-flex; gap: 6px; align-items: center; }

/* commented paragraphs are easy to spot */
mark.cmt { background: var(--cm-bg); box-shadow: inset 0 -2px 0 var(--cm); }
.cmt-badge { display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 9px; background: var(--cm-bg); color: var(--cm); font: 600 12px/16px var(--font); }
.cmt-badge svg { color: var(--cm); }
.outline .ocm { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; padding: 0 5px; border-radius: 8px; background: var(--cm-bg); color: var(--cm); font: 600 11px/15px var(--font); vertical-align: 1px; }
.outline .ocm svg { color: var(--cm); }
.outline .spinner.xs { margin-left: 6px; }
.who-me { display: flex; align-items: center; gap: 4px; font: 600 12px var(--font); color: var(--cm); margin-bottom: 2px; }
.who-me svg { color: var(--cm); }

/* rail: busy state + overflow menu */
.rail-busy { display: flex; gap: 8px; align-items: flex-start; padding: 7px 9px; border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); border-radius: var(--r-md); background: var(--accent-soft); font-size: 12.5px; line-height: 1.4; }
.rail-busy b { color: var(--accent); font-weight: 600; }
.rail-busy .step { color: var(--ink); }
.rail-busy .spinner { margin-top: 2px; }
.mini { position: relative; display: inline-flex; }
.mini-menu { display: none; position: absolute; right: 0; top: calc(100% + 4px); z-index: 25; min-width: 200px; padding: 4px; background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r-md); box-shadow: 0 10px 28px var(--shadow); }
.mini.open .mini-menu { display: block; }
.mini-menu a { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: var(--r-sm); font-size: 13px; color: var(--ink); cursor: pointer; white-space: nowrap; }
.mini-menu a:hover { background: var(--g-main); }
.mini-menu a.danger, .mini-menu a.danger svg { color: var(--err); }

/* selection popover + edit popover */
#selPop { display: flex; gap: 4px; }
#selPop[hidden] { display: none; }
#editPop { width: 440px; }
#editPop .pop-h { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--accent); margin-bottom: 6px; }
#editPop .quote { border-left-color: var(--accent); max-height: 72px; }
#editPop textarea { resize: none; }
#editPop .chips { margin: 6px 0 0; }
#editPop .row { align-items: center; }
#editPop .hint, .popover .hint { color: var(--muted); font-size: 12px; }

/* the Assistant pane */
#pane-assistant { background: var(--g-main); }
.as-scroll { flex: 1; overflow-y: auto; padding: 10px 12px 16px; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.as-intro { padding: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); color: var(--muted); font-size: 13px; line-height: 1.5; }
.as-intro h3 { margin: 0 0 6px; color: var(--ink); font: 600 14px var(--font); }
.as-intro p { margin: 0 0 6px; }
.as-needs { border: 1px solid var(--warn-line); background: var(--warn-bg); border-radius: var(--r-md); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.as-h { display: flex; align-items: center; gap: 6px; font: 600 13px var(--font); color: var(--ai); }
.as-h svg { color: var(--ai); }
.as-q { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px; }
.as-q .ctx { font-size: 12px; color: var(--muted); cursor: pointer; margin-bottom: 2px; }
.as-q .ctx:hover { color: var(--accent); }
.as-q .qt { font-weight: 500; margin-bottom: 6px; }
.as-q .row { display: flex; gap: 4px; }
.as-q .row input { flex: 1; height: 28px; }
.as-q .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.as-msg { border-radius: var(--r-md); padding: 8px 10px; font-size: 13px; line-height: 1.5; border: 1px solid var(--line); background: var(--paper); }
.as-msg.me { margin-left: 22px; background: var(--me-bg); border-color: var(--me-line); }
.as-msg.ai { margin-right: 10px; }
.as-msg.failed { border-color: var(--err-line); background: var(--err-soft); }
.as-msg.cancelled { color: var(--muted); }
.as-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.as-meta span:first-child { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; color: var(--ink); }
.as-msg.ai .as-meta span:first-child, .as-msg.ai .as-meta svg { color: var(--accent); }
.as-msg.failed .as-meta span:first-child, .as-msg.failed .as-meta svg { color: var(--err); }
.as-msg blockquote { margin: 2px 0 4px; padding: 2px 8px; border-left: 2px solid var(--accent); color: var(--muted); font-size: 12.5px; }
.as-qref { font-size: 12.5px; color: var(--muted); }
.as-where { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 12px; color: var(--muted); cursor: pointer; }
a.as-where:hover { color: var(--accent); }
.as-changes { list-style: none; margin: 6px 0 0; padding: 0; border-top: 1px solid var(--line); }
.as-changes li { display: flex; align-items: baseline; gap: 6px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.as-changes li:last-child { border-bottom: 0; }
.as-changes .t { flex: 1; min-width: 0; cursor: pointer; }
.as-changes .t:hover { color: var(--accent); }
.tag { flex: none; font: 600 11px/1 var(--font); padding: 3px 5px; border-radius: 3px; background: var(--g-surface); color: var(--muted); }
.tag.changed { background: var(--ai-soft); color: var(--ai); }
.tag.conflict, .tag.comment { background: var(--cm-bg); color: var(--cm); }
.as-acts { flex: none; display: inline-flex; gap: 8px; }
.as-acts a { color: var(--accent); cursor: pointer; font-weight: 500; }
.as-acts.ok { color: var(--ok); align-items: center; gap: 3px; }
.as-acts.ok a { margin-left: 5px; } .as-acts.muted { color: var(--muted-2); }
.as-acts-row { margin-top: 4px; }
.as-changes li { flex-wrap: wrap; }
.as-cmp { flex: 1 0 100%; margin: 6px 0 2px; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.as-cmp-bar { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-bottom: 1px solid var(--line); background: var(--g-main); }
.as-cmp-bar .seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; }
.as-cmp-bar .seg button { border: 0; background: none; padding: 2px 8px; font: 500 11.5px var(--font); color: var(--muted); cursor: pointer; }
.as-cmp-bar .seg button, .as-cmp-bar .cmp-src, .as-cmp-bar a { white-space: nowrap; }
.as-cmp-bar .grow { flex: 1; }
.as-cmp-state { padding: 4px 10px 0; font-size: 11.5px; color: var(--muted-2); }
.as-cmp-bar .seg button.on { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.as-cmp-bar .cmp-src { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: none; color: var(--muted); font: 500 11.5px var(--font); cursor: pointer; }
.as-cmp-bar .cmp-src:hover { color: var(--ink); }
.as-cmp-bar .cmp-src.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.as-cmp-bar .muted { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-cmp-bar a { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); cursor: pointer; font-size: 12px; font-weight: 500; }
.as-cmp-body { padding: 8px 10px; font: 400 13px/1.55 var(--serif); max-height: 340px; overflow-y: auto; color: var(--ink); }
.as-cmp-src { margin: 0; font: 11.5px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; }
.as-note { margin-top: 6px; font-size: 12.5px; color: var(--muted); display: block; }
.as-note svg { vertical-align: -2px; margin-right: 4px; }
.as-note ul { margin: 4px 0 0; padding-left: 16px; }
.as-note.warn { color: var(--ai); }
.as-job { border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); background: var(--paper); border-radius: var(--r-md); padding: 8px 10px; font-size: 13px; margin-right: 10px; }
.as-job-h { display: flex; align-items: center; gap: 8px; }
.as-job-h b { font-weight: 500; }
.as-el { color: var(--muted); font: 500 12px var(--mono); }
.as-steps { margin: 6px 0 0; padding: 0 0 0 18px; font-size: 12.5px; color: var(--muted); }
.as-steps li.running { color: var(--accent); font-weight: 500; }
.as-steps li.failed { color: var(--err); }
.as-job .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.as-err { color: var(--err); font-size: 12.5px; margin-top: 4px; }
.as-compose { flex: none; border-top: 1px solid var(--line); background: var(--panel); padding: 8px 10px 10px; }
.as-sugg { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.as-sugg:empty { display: none; }
.chip.sugg { background: var(--paper); }
.chip.sugg:hover { border-color: var(--accent); color: var(--accent); }
.as-box { background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 6px 8px; }
.as-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.as-box textarea { border: 0; box-shadow: none; padding: 4px 0; resize: none; min-height: 44px; font-size: 13.5px; }
.as-box textarea:focus { box-shadow: none; }
.as-row { display: flex; align-items: center; gap: 8px; }
.as-scope { margin-bottom: 2px; }
.as-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 4px 2px 7px; border-radius: 10px; background: var(--g-surface); color: var(--muted); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.as-chip.on { background: var(--accent-soft); color: var(--accent); }
.as-chip button { border: 0; background: none; padding: 0 2px; cursor: pointer; color: inherit; display: inline-flex; }
/* a long chip (scope, "Refining the edit: …") shortens with … and keeps its × and the Attach button on the same line */
.as-scope .as-chip.on { flex: 1 1 0; min-width: 0; }
.as-chip .lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-chip svg, .as-chip button { flex: none; }

/* comments tab */
.cgroup { margin-bottom: 10px; }
.cg-h { display: flex; align-items: center; gap: 6px; font: 600 12.5px var(--font); color: var(--ink); margin: 10px 0 5px; cursor: pointer; }
.cg-h:hover { color: var(--accent); }
.cmt-row { cursor: pointer; }
.cmt-row .who { display: flex; align-items: center; gap: 4px; font: 600 12px var(--font); color: var(--cm); margin-bottom: 2px; }
.cmt-row.ai .who, .cmt-row.ai .who svg { color: var(--accent); }
.cmt-row .row { display: flex; gap: 10px; margin-top: 4px; }
.cmt-row .row a { font-size: 12.5px; color: var(--muted); cursor: pointer; }
.cmt-row .row a:hover { color: var(--ink); }


/* ---------------------------------------------------------------- theme details */
.CodeMirror-cursor { border-left-color: var(--ink); }
.CodeMirror-selected, .CodeMirror-focused .CodeMirror-selected, .CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: var(--cm-sel); }
.CodeMirror-gutters { background: var(--panel); }
:root[data-theme="dark"] .katex { color: var(--ink); }
:root[data-theme="dark"] #viewer img, :root[data-theme="dark"] .txt figure img { background: #fff; }
:root[data-theme="dark"] .brand img, :root[data-theme="dark"] img.brand-logo { filter: invert(1); }
:root[data-theme="dark"] .conn img[src*="openai"], :root[data-theme="dark"] .conn img[src*="anthropic"], :root[data-theme="dark"] .detail-head img[src*="openai"], :root[data-theme="dark"] .detail-head img[src*="anthropic"], :root[data-theme="dark"] .or-connect img { filter: invert(1); }
:root[data-theme="dark"] #modal { background: rgba(0, 0, 0, .55); }
:root[data-theme="dark"] img[src*="/files/light-"] { filter: invert(.85); }   /* black icons (TeX): light on dark, wherever they appear */
:root[data-pdf-dim="1"][data-theme="dark"] .pdf-page canvas { filter: brightness(.82) contrast(1.05); }
.theme-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 150px)); gap: 10px; }
.theme-card { display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--paper); cursor: pointer; font: 500 13px var(--font); color: var(--ink); text-align: left; }
.theme-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tc-prev { display: grid; grid-template-columns: 30% 1fr; grid-template-rows: 10px 1fr; height: 62px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.tc-prev i:nth-child(1) { grid-column: 1 / 3; } .tc-prev i:nth-child(3) { margin: 6px; border-radius: 2px; }
.tc-prev.light i:nth-child(1), .tc-prev.light i:nth-child(2) { background: #f7f8fa; } .tc-prev.light { background: #eef0f3; } .tc-prev.light i:nth-child(3) { background: #fff; }
.tc-prev.dark i:nth-child(1), .tc-prev.dark i:nth-child(2) { background: #222a35; } .tc-prev.dark { background: #1b222c; } .tc-prev.dark i:nth-child(3) { background: #262f3c; }
.tc-prev.system { background: linear-gradient(135deg, #eef0f3 50%, #1b222c 50%); } .tc-prev.system i:nth-child(1) { background: linear-gradient(90deg, #f7f8fa 50%, #222a35 50%); }
.tc-prev.system i:nth-child(2) { background: #f7f8fa; } .tc-prev.system i:nth-child(3) { background: linear-gradient(135deg, #fff 50%, #262f3c 50%); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; min-height: 34px; align-items: center; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--paper); background: var(--sw); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }

/* ---------------------------------------------------------------- left panel: progress + outline tree */
#meterAll { height: 6px; margin: 2px 0 8px; }
.legend { margin: 0 0 4px; gap: 4px 10px; font-size: 12px; }
.otree, .otree ul { list-style: none; margin: 0; padding: 0; }
.otree li.closed > ul { display: none; }
.otree .empty { color: var(--muted); padding: 8px 6px; }
.orow { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 4px; align-items: center; height: 26px; padding: 0 4px 0 calc(2px + var(--d) * 14px); border-radius: var(--r-sm); cursor: pointer; }
.orow:hover { background: var(--g-surface); }
.orow.cur { background: var(--accent-soft); }
.otw { border: 0; background: none; padding: 0; width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); cursor: pointer; border-radius: 3px; }
.otw:hover { background: var(--line); color: var(--ink); }
.otw svg { transition: transform var(--m-out); }
.otree li.closed > .orow .otw svg { transform: rotate(-90deg); }
.orow .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.otree > li > .orow .t { font-weight: 500; }
.orow .t small { color: var(--muted); font: 500 11px var(--mono); margin-left: 5px; }
.ometer { height: 4px; display: flex; border-radius: 2px; overflow: hidden; background: var(--g-surface); }
.ometer i { height: 100%; }
.otree .ocm { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; padding: 0 5px; border-radius: 8px; background: var(--cm-bg); color: var(--cm); font: 600 11px/15px var(--font); vertical-align: 1px; }
.otree .ocm svg { color: var(--cm); }
.otree .spinner.xs { margin-left: 6px; }


/* ================================================================ the paper: content first */
#visual { padding: 12px 12px 120px; container-type: inline-size; }
#paper.doc { display: flex; justify-content: center; align-items: flex-start; gap: 12px; min-height: 100%; }
#paper.doc.m-left { flex-direction: row-reverse; }
.sheet { flex: 1 1 auto; max-width: 1040px; min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 30px 52px 64px; font-size: var(--doc-size); }
.margin { flex: 0 0 248px; position: relative; align-self: stretch; }
#paper.doc.no-cards .margin { display: none; }
@container (max-width: 1100px) { .margin { flex-basis: 220px; } .sheet { padding: 26px 44px 60px; } }
@container (max-width: 820px) { #paper.doc { gap: 10px; } .margin { flex-basis: 196px; } .sheet { padding: 22px 36px 52px; } }
@container (max-width: 620px) { #paper.doc { display: block; } .margin { display: none; } .sheet { padding: 20px 30px 48px; } }
.sheet .bk { position: relative; }
.sheet .bk .sbar { position: absolute; left: -24px; top: 3px; bottom: 3px; width: 3px; border-radius: 2px; cursor: help; }
.bk.ai_draft .sbar { background: var(--ai-bar); }
.bk.human_edit .sbar { background: var(--hu-bar); opacity: .6; }
.bk.approved .sbar { background: var(--ok-bar); }
.sheet .bk.has-cmt::after { content: ""; position: absolute; right: -22px; top: 3px; bottom: 3px; width: 3px; border-radius: 2px; background: var(--cm); }
.sheet .txt { margin: 0 -6px; padding: 1px 6px; border-radius: var(--r-sm); transition: background var(--m-out); }
.bk.ai_draft .txt { background: var(--ai-bg); }
.bk.focus .txt { box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent); }
.bk.working .txt { opacity: .6; background-image: linear-gradient(100deg, transparent 30%, color-mix(in srgb, var(--accent) 8%, transparent) 50%, transparent 70%); background-size: 220% 100%; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.sheet .para { margin: 0 0 .55em; }
.para .txt { font: 400 1em/1.5 var(--serif); text-align: justify; hyphens: auto; }
.para .txt p { margin: 0; }
.sheet .heading { margin: 1em 0 .35em; }
.sheet .bk:first-child, .sheet .bk.front + .heading { margin-top: 0; }
.heading .txt { font-family: var(--serif); font-weight: 700; letter-spacing: -.005em; line-height: 1.25; }
.heading.l0 .txt { font-size: 1.5em; } .heading.l1 .txt { font-size: 1.22em; } .heading.l2 .txt { font-size: 1.06em; } .heading.l3 .txt, .heading.l4 .txt { font-size: 1em; }
.heading .num { color: var(--muted); font-weight: 600; margin-right: .55em; }
.heading .goal { font: italic 400 .84em/1.4 var(--serif); color: var(--muted); margin-top: 1px; }
.bk .fold { position: absolute; left: -46px; top: .2em; width: 20px; height: 20px; border: 0; background: none; color: var(--muted-2); border-radius: 4px; display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; transition: opacity var(--m-out); }
.bk.heading:hover .fold, .bk .fold.closed, .bk .fold:focus-visible { opacity: 1; }
.bk .fold:hover { background: var(--g-surface); color: var(--ink); }
.bk .fold svg { transition: transform var(--m-out); }
.bk .fold.closed svg { transform: rotate(-90deg); }
.fold-note { display: block; width: 100%; text-align: left; margin: 0 0 .8em; padding: 3px 8px; border: 1px dashed var(--line-2); border-radius: var(--r-sm); background: none; color: var(--muted); font: 500 12px var(--font); cursor: pointer; }
.fold-note:hover { color: var(--accent); border-color: var(--accent); }
.titleblock { text-align: center; padding: .3em 0 1.1em; }
.titleblock h1 { font: 600 1.5em/1.2 var(--serif); margin: 0 0 .3em; letter-spacing: -.01em; }
.titleblock .au { font: 400 1em var(--serif); color: var(--muted); }
.rawchip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 2px 9px; margin: 0 0 .7em; border-radius: 10px; background: var(--g-main); color: var(--muted); font: 500 12px var(--font); cursor: pointer; }
.rawchip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 11.5px var(--mono); }
.bk.front .rawchip span { font: 500 12px var(--font); }
.rawchip:hover { color: var(--accent); }
.pgbreak { display: flex; align-items: center; gap: 10px; margin: .5em 0 1em; color: var(--muted-2); font: 500 10.5px var(--font); text-transform: uppercase; letter-spacing: .08em; }
.pgbreak::before, .pgbreak::after { content: ""; flex: 1; border-top: 1px dashed var(--line-2); }
.sheet .incl { display: flex; align-items: center; gap: 6px; margin: 1.4em 0 .6em; font: 400 12px/1.4 var(--mono); color: var(--muted-2); cursor: pointer; user-select: none; }
.sheet .incl img { width: 14px; height: 14px; flex: none; }
.sheet .incl::after { content: ""; flex: 1; border-top: 1px dashed var(--line-2); margin-left: 6px; }
@media (hover: hover) and (pointer: fine) { .sheet .incl:hover { color: var(--accent); } }
.biblist { font: 400 .9em/1.5 var(--serif); padding: 4px 0 6px; }
.biblist h3 { font: 700 1.3em var(--serif); margin: 1em 0 .5em; }

/* hover toolbar: actions appear only where you point */
.bk > .tools { position: absolute; right: -8px; top: -31px; z-index: 6; display: none; align-items: center; gap: 1px; padding: 2px; background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r-md); box-shadow: 0 6px 18px var(--shadow); }
.bk:hover > .tools, .bk.focus > .tools, .bk:has(.mini.open) > .tools { display: flex; animation: toolsIn 140ms ease-out; }
@keyframes toolsIn { from { opacity: 0; transform: translateY(3px); } }
.bk.heading > .tools { top: -8px; }
.bk.focus:not(:hover) > .tools { opacity: .9; }
.sheet .bk:first-child > .tools { top: -24px; }
.tb { height: 24px; display: inline-flex; align-items: center; gap: 4px; padding: 0 7px; border: 0; background: none; border-radius: var(--r-sm); font: 500 12.5px var(--font); color: var(--ink); cursor: pointer; white-space: nowrap; text-decoration: none; }
.tb:hover { background: var(--g-surface); }
.tb.ai svg { color: var(--accent); } .tb.ok svg { color: var(--ok-bar); } .tb.danger, .tb.danger svg { color: var(--err); }
.tb.on { background: var(--accent-soft); color: var(--accent); }
.bk > .busy-tag { position: absolute; right: -8px; top: -26px; z-index: 6; display: flex; align-items: center; gap: 7px; padding: 3px 9px; background: var(--paper); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 12px; font: 500 12px var(--font); color: var(--accent); box-shadow: 0 6px 18px var(--shadow); }
.busy-tag .step { color: var(--ink); max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbadge { position: absolute; right: -54px; top: 1px; display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border: 0; border-radius: 9px; background: var(--cm-bg); color: var(--cm); font: 600 11.5px/16px var(--font); cursor: pointer; }
.cbadge svg { color: var(--cm); }
.sheet .inserter { position: absolute; left: 0; right: 0; bottom: -.5em; height: 10px; width: auto; z-index: 4; background: none; border: 0; }
.sheet .inserter .ins-btns { display: none; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); gap: 4px; }
.sheet .inserter:hover .ins-btns { display: flex; }
.sheet .inserter:hover::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed var(--accent); }
.bk.editing .txt { display: none; }
.CodeMirror.block-cm { height: auto; border: 1px solid var(--accent); border-radius: var(--r-sm); box-shadow: 0 0 0 3px var(--focus-ring); }
.CodeMirror.block-cm .CodeMirror-scroll { min-height: 64px; }
.CodeMirror.block-cm .CodeMirror-lines { padding: 8px 2px; }

/* comments in the margin (Overleaf style) */
.mcard { position: absolute; left: 0; right: 0; top: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 7px 9px; font-size: 12.5px; line-height: 1.4; box-shadow: 0 1px 2px var(--shadow); cursor: pointer; transition: transform 160ms ease-out, box-shadow var(--m-out); }
.mcard.active { box-shadow: 0 8px 24px var(--shadow); border-color: var(--line-2); z-index: 3; }
.mc-h { display: flex; align-items: center; gap: 6px; min-height: 18px; margin-bottom: 3px; color: var(--muted); font-size: 11.5px; }
.mc-h .who { display: flex; flex: 1 1 auto; min-width: 0; gap: 5px; align-items: center; white-space: nowrap; font-weight: 600; color: var(--cm); }
.mc-h .who svg { color: currentColor; }
.who svg { flex: none; } .who .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .sev { flex: none; font: 500 10.5px/16px var(--font); padding: 0 6px; border-radius: var(--r-pill); background: var(--hover); color: var(--muted); }
.who .sev.major { background: color-mix(in srgb, var(--ai) 14%, transparent); color: var(--ai); }
.who .sev.critical { background: color-mix(in srgb, var(--err) 14%, transparent); color: var(--err); }
.mc-h .when { flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted-2); }
.mc-x { flex: none; display: none; place-items: center; width: 18px; height: 18px; margin: -1px -4px 0 0; padding: 0; border: 0; border-radius: var(--r-xs); background: none; color: var(--muted-2); cursor: pointer; }
.mcard:hover .mc-x, .mcard.active .mc-x, .cpop .mc-x { display: grid; }
.mc-x:hover { background: var(--hover); color: var(--ink); }
.mcard.ai .who { color: var(--accent); } .mcard.chg .who { color: var(--ai); }
.mc-q { color: var(--muted); font-style: italic; border-left: 2px solid var(--line-2); padding-left: 6px; margin: 2px 0 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mc-t { white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.mcard.active .mc-t, .cpop .mc-t, .mcard.active .mc-q { -webkit-line-clamp: unset; display: block; }
.mc-r { margin-top: 4px; color: var(--accent); }
.mc-a { display: none; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.mcard.active .mc-a, .cpop .mc-a { display: flex; }
.mc-a a { color: var(--muted); cursor: pointer; display: inline-flex; gap: 3px; align-items: center; font-weight: 500; }
.mc-a a:hover { color: var(--ink); }
.mc-a a[data-mact="fix"], .mc-a a[data-mact="approve"] { color: var(--accent); }
.m-empty { color: var(--muted-2); font-size: 12px; padding: 6px 4px; }
mark.cmt { background: var(--cm-bg); box-shadow: inset 0 -2px 0 var(--cm); color: inherit; border-radius: 2px; cursor: pointer; }
mark.cmt.on { background: color-mix(in srgb, var(--cm) 28%, transparent); }
.cpop { width: 330px; padding: 6px; display: grid; gap: 6px; max-height: 60vh; overflow-y: auto; }
.cpop .mcard { position: static; box-shadow: none; }
.center-bar .btn.on { background: var(--cm-bg); color: var(--cm); border-color: transparent; }
.center-bar .btn.on svg { color: var(--cm); }

/* code mode: editor + comment margin, folding, autocomplete */
#code { display: flex; }
#cmHost { flex: 1; min-width: 0; height: 100%; }
.code-margin { flex: 0 0 272px; position: relative; overflow: hidden; border-left: 1px solid var(--line); background: var(--panel); }
#code.m-left { flex-direction: row-reverse; }
#code.m-left .code-margin { border-left: 0; border-right: 1px solid var(--line); }
#code.m-off .code-margin, #code.m-auto-off .code-margin { display: none; }
#code.m-tight .code-margin { flex-basis: 210px; }
.as-scroll > * { min-width: 0; }
.as-hlist li { min-width: 0; overflow: hidden; }
.code-margin .mwrap { position: absolute; left: 8px; right: 8px; top: 4px; }
.CodeMirror-foldgutter { width: 14px; }
.CodeMirror-foldgutter-open, .CodeMirror-foldgutter-folded { color: var(--muted-2); cursor: pointer; }
.CodeMirror-foldgutter-open:after { content: "\25BE"; } .CodeMirror-foldgutter-folded:after { content: "\25B8"; }
.CodeMirror-foldmarker { color: var(--accent); background: var(--accent-soft); border-radius: 3px; padding: 0 4px; font-family: var(--font); text-shadow: none; cursor: pointer; }
.cm-cmt { cursor: pointer; }
.CodeMirror-hints { background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r-md); box-shadow: 0 10px 28px var(--shadow); padding: 4px; font: 400 12.5px var(--font); max-height: 20em; max-width: 480px; z-index: 80; }
.CodeMirror-hint { color: var(--ink); padding: 4px 8px; border-radius: var(--r-sm); white-space: normal; max-width: 470px; }
li.CodeMirror-hint-active { background: var(--accent-soft); color: var(--ink); }
.CodeMirror-hint .hk { display: flex; gap: 12px; justify-content: space-between; align-items: baseline; }
.CodeMirror-hint .hk b { font: 500 12.5px var(--mono); }
.CodeMirror-hint .hk span { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.CodeMirror-hint .ht { color: var(--muted); font-size: 11.5px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* PDF tab: only the document */
#pane-pdf { background: var(--pdf-bg); }
.pdf-wrap { position: relative; display: flex; flex-direction: column; height: 100%; min-height: 0; }
.pdf-scroll { flex: 1; overflow: auto; min-height: 0; padding: 14px 0 64px; }
#pdfPages { display: flex; flex-direction: column; align-items: center; gap: 12px; min-width: min-content; padding: 0 14px; }
.pdf-scroll.fit { padding-top: 0; overflow-x: hidden; } .pdf-scroll.fit #pdfPages { padding: 0; gap: 8px; } .pdf-scroll.fit .pdf-page { box-shadow: none; }
.pdf-scroll { overscroll-behavior: contain; touch-action: pan-x pan-y; }
.pdf-page { background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); flex: none; }
.pdf-page canvas { display: block; width: 100%; height: 100%; }   /* stretches while a sharper render is on its way */
.pdf-empty { color: #c9ced6; text-align: center; padding: 60px 24px; font-size: 13px; line-height: 1.5; }
.pdf-empty .link { color: #aab6ff; }
.pdf-tools { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 1px; padding: 3px; background: color-mix(in srgb, var(--paper) 94%, transparent); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); opacity: .25; transition: opacity var(--m-in); backdrop-filter: blur(6px); }
.pdf-wrap:hover .pdf-tools, .pdf-tools:focus-within { opacity: 1; }
.pdf-tools .tb { height: 26px; min-width: 26px; justify-content: center; font-size: 13px; }
.pdf-tools .zoom { min-width: 48px; font-variant-numeric: tabular-nums; }
.pdf-tools .sep { width: 1px; height: 16px; background: var(--line-2); margin: 0 3px; }
.pdf-tools .pg { font: 500 12px var(--font); color: var(--muted); padding: 0 6px; font-variant-numeric: tabular-nums; min-width: 44px; text-align: center; }
.pdf-errs { background: var(--paper); border-bottom: 1px solid var(--line); }
.pdf-errs summary { display: flex; align-items: center; gap: 6px; padding: 7px 10px; margin: 0; color: var(--err); font: 500 12.5px var(--font); list-style: none; }
.pdf-errs summary::-webkit-details-marker { display: none; }
.pdf-errs .errs { max-height: 30vh; }

/* Assistant: chats, history, attachments */
.as-head { flex: none; display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-bottom: 1px solid var(--line); background: var(--panel); }
.as-title { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 86%; border: 0; background: none; padding: 5px 7px; border-radius: var(--r-sm); font: 600 13px var(--font); color: var(--ink); cursor: pointer; }
.as-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-title:hover, .as-title[aria-expanded="true"] { background: var(--g-surface); }
.as-hist-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.as-hq { margin-bottom: 8px; height: 30px; }
.as-hlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.as-hlist li { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); padding: 7px 9px; cursor: pointer; }
.as-hlist li.on { border-color: var(--accent); }
.as-hlist li:hover { border-color: var(--line-3); }
.as-hlist li.empty { cursor: default; color: var(--muted); }
.hl-t { display: flex; align-items: center; gap: 6px; }
.hl-t b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.hl-t .when { color: var(--muted); font-size: 11.5px; }
.hl-s { color: var(--muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-a { display: flex; align-items: center; gap: 2px; margin-top: 3px; }
.as-scope { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 2px; }
#asScope, #asFiles { display: contents; }
.as-attach { margin-left: auto; border: 0; background: none; color: var(--muted); font: 500 12px var(--font); display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 10px; cursor: pointer; }
.as-attach:hover { background: var(--g-surface); color: var(--ink); }
.as-chip.file { background: var(--accent-soft); color: var(--ink); }
.as-chip.file img { width: 13px; height: 13px; object-fit: contain; }
.as-files { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.as-file { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 9px; background: var(--paper); border: 1px solid var(--me-line); font-size: 11.5px; }
.as-file img { width: 12px; height: 12px; object-fit: contain; }
.attach-pop { width: 390px; }
.attach-pop .pop-h { display: flex; align-items: center; gap: 6px; font-weight: 600; }
.attach-pop .hint { margin: 4px 0 8px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.at-list { list-style: none; margin: 6px 0; padding: 0; max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.at-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; cursor: pointer; font-size: 12.5px; border-bottom: 1px solid var(--line); }
.at-list li:last-child { border-bottom: 0; }
.at-list li:hover { background: var(--g-main); }
.at-list li.on { background: var(--accent-soft); }
.at-list li.empty { cursor: default; color: var(--muted); }
.at-list li .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-list .fi { width: 14px; height: 14px; object-fit: contain; }
.md-render p { margin: 0 0 .5em; } .md-render p:last-child { margin-bottom: 0; }
.md-render ul, .md-render ol { margin: .3em 0 .5em; padding-left: 1.3em; }
.md-render code { font-size: 12px; background: var(--g-main); padding: 0 3px; border-radius: 3px; }
.md-render h1, .md-render h2, .md-render h3 { font-size: 13.5px; margin: .6em 0 .3em; }

/* ---------------------------------------------------------------- resizing + collapsible side panels */
body.resizing { cursor: col-resize; user-select: none; }
body.resizing iframe, body.resizing #pdfScroll, body.resizing .CodeMirror { pointer-events: none; }
.resizer { touch-action: none; }
body.left-min #app { grid-template-columns: 44px 0 minmax(0, 1fr) 4px var(--right-w); }
body.right-min #app { grid-template-columns: var(--left-w) 4px minmax(0, 1fr) 0 44px; }
body.left-min.right-min #app { grid-template-columns: 44px 0 minmax(0, 1fr) 0 44px; }
body.left-min .resizer[data-resize="left"], body.right-min .resizer[data-resize="right"] { visibility: hidden; pointer-events: none; }
.rail { display: none; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; }
body.left-min #left > :not(.rail), body.right-min #right > :not(.rail) { display: none; }
body.left-min #leftRail, body.right-min #rightRail { display: flex; }
body.left-min #left { border-right: 1px solid var(--line); }
body.right-min #right { border-left: 1px solid var(--line); }
.rail-btn { position: relative; width: 32px; height: 32px; border: 0; background: none; border-radius: var(--r-md); color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.rail-btn:hover { background: var(--g-surface); color: var(--ink); }
.rail-sep { width: 20px; height: 1px; background: var(--line); margin: 2px 0; }
.rb-n { position: absolute; top: 0; right: -2px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font: 600 10px/15px var(--font); font-style: normal; }
.rb-n.cm { background: var(--cm); color: #fff; }
.rb-live, .rb-dot { position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.rb-live { animation: pulse 1.2s ease-in-out infinite; }
.rb-dot.ok { background: var(--ok-bar); } .rb-dot.err { background: var(--err); }
@keyframes pulse { 50% { opacity: .3; } }
.tabs { position: relative; }
.tabs .tab-min { margin-left: auto; position: sticky; right: 0; align-self: center; padding: 5px; border-radius: var(--r-sm); background: var(--panel); color: var(--muted); }
.tabs .tab-min:hover { color: var(--ink); background: var(--g-surface); }
.tabs .tab-min::after { display: none; }
#rightTabs { padding: 0 4px; gap: 0; }
#rightTabs button { padding-left: 5px; padding-right: 5px; }
#rightTabs .count { min-width: 16px; height: 16px; font-size: 11px; padding: 0 4px; }

/* ---------------------------------------------------------------- palettes: several dark and light looks (Settings → Appearance) */
:root[data-theme="dark"][data-dark="warm"] { --panel: #1f1e1d; --g-main: #262624; --paper: #30302e; --g-surface: #3d3c39; --ink: #f7f6f2; --muted: #c0beb5; --muted-2: #97958c; --line: rgba(222, 220, 209, 0.1); --line-2: rgba(222, 220, 209, 0.17); --line-3: rgba(222, 220, 209, 0.30); --on-ink: #1f1e1d; --ink-hover: #dedcd3; --btn-hover: #3a3936; --row-hover: #2c2b29; --pdf-bg: #141413; --cm-sel: rgba(217, 119, 87, .24); --syn-bracket: #c0beb5; --syn-comment: #97958c; }
:root[data-code-theme="dark"][data-dark="warm"] .CodeMirror, :root[data-code-theme="dark"][data-dark="warm"] .CodeMirror-hints { --panel: #1f1e1d; --paper: #30302e; --ink: #f7f6f2; --muted: #c0beb5; --muted-2: #97958c; --line: rgba(222, 220, 209, 0.1); --line-2: rgba(222, 220, 209, 0.17); --cm-sel: rgba(217, 119, 87, .24); --syn-bracket: #c0beb5; --syn-comment: #97958c; color-scheme: dark; }
:root[data-theme="dark"][data-dark="slate"] { --panel: #222a35; --g-main: #1b222c; --paper: #262f3c; --g-surface: #2f3a4c; --ink: #edf0f5; --muted: #b5bdc9; --muted-2: #8e98a7; --line: rgba(230, 233, 239, 0.1); --line-2: rgba(230, 233, 239, 0.17); --line-3: rgba(230, 233, 239, 0.30); --on-ink: #151b23; --ink-hover: #cfd5df; --btn-hover: #323d4f; --row-hover: #2a3442; --pdf-bg: #11161d; --cm-sel: rgba(143, 163, 255, .28); --syn-bracket: #b5bdc9; --syn-comment: #8e98a7; }
:root[data-code-theme="dark"][data-dark="slate"] .CodeMirror, :root[data-code-theme="dark"][data-dark="slate"] .CodeMirror-hints { --panel: #222a35; --paper: #262f3c; --ink: #edf0f5; --muted: #b5bdc9; --muted-2: #8e98a7; --line: rgba(230, 233, 239, 0.1); --line-2: rgba(230, 233, 239, 0.17); --cm-sel: rgba(143, 163, 255, .28); --syn-bracket: #b5bdc9; --syn-comment: #8e98a7; color-scheme: dark; }
:root[data-theme="dark"][data-dark="midnight"] { --panel: #0b0c0e; --g-main: #101114; --paper: #17181b; --g-surface: #25272c; --ink: #f0f1f3; --muted: #adb1b9; --muted-2: #80848e; --line: rgba(232, 233, 236, 0.1); --line-2: rgba(232, 233, 236, 0.17); --line-3: rgba(232, 233, 236, 0.30); --on-ink: #101114; --ink-hover: #d6d8dd; --btn-hover: #202226; --row-hover: #191a1d; --pdf-bg: #050506; --cm-sel: rgba(160, 170, 200, .25); --syn-bracket: #adb1b9; --syn-comment: #80848e; }
:root[data-code-theme="dark"][data-dark="midnight"] .CodeMirror, :root[data-code-theme="dark"][data-dark="midnight"] .CodeMirror-hints { --panel: #0b0c0e; --paper: #17181b; --ink: #f0f1f3; --muted: #adb1b9; --muted-2: #80848e; --line: rgba(232, 233, 236, 0.1); --line-2: rgba(232, 233, 236, 0.17); --cm-sel: rgba(160, 170, 200, .25); --syn-bracket: #adb1b9; --syn-comment: #80848e; color-scheme: dark; }
:root[data-theme="dark"][data-dark="dim"] { --panel: #2b2d31; --g-main: #313338; --paper: #383a40; --g-surface: #47494f; --ink: #eceef0; --muted: #c3c7cd; --muted-2: #9a9fa7; --line: rgba(227, 229, 232, 0.1); --line-2: rgba(227, 229, 232, 0.17); --line-3: rgba(227, 229, 232, 0.30); --on-ink: #2b2d31; --ink-hover: #d0d3d8; --btn-hover: #404249; --row-hover: #35373c; --pdf-bg: #1e1f22; --cm-sel: rgba(160, 170, 200, .28); --syn-bracket: #c3c7cd; --syn-comment: #9a9fa7; }
:root[data-code-theme="dark"][data-dark="dim"] .CodeMirror, :root[data-code-theme="dark"][data-dark="dim"] .CodeMirror-hints { --panel: #2b2d31; --paper: #383a40; --ink: #eceef0; --muted: #c3c7cd; --muted-2: #9a9fa7; --line: rgba(227, 229, 232, 0.1); --line-2: rgba(227, 229, 232, 0.17); --cm-sel: rgba(160, 170, 200, .28); --syn-bracket: #c3c7cd; --syn-comment: #9a9fa7; color-scheme: dark; }
:root[data-theme="light"][data-light="cool"] { --panel: #f7f8fa; --g-main: #eef0f3; --paper: #ffffff; --g-surface: #e2e5ea; --ink: #0b0c0e; --muted: #4a505a; --muted-2: #767c86; --line: rgba(11, 12, 14, 0.12); --line-2: rgba(11, 12, 14, 0.19); --line-3: rgba(11, 12, 14, 0.32); --on-ink: #ffffff; --ink-hover: #26282c; --btn-hover: #f1f2f4; --row-hover: #fafbfc; --pdf-bg: #525659; --cm-sel: #dfe3ff; --cm-active: #f4f6fb; --syn-bracket: #4a505a; }
:root[data-code-theme="light"][data-light="cool"] .CodeMirror, :root[data-code-theme="light"][data-light="cool"] .CodeMirror-hints { --panel: #f7f8fa; --paper: #ffffff; --ink: #0b0c0e; --muted: #4a505a; --muted-2: #767c86; --line: rgba(11, 12, 14, 0.12); --line-2: rgba(11, 12, 14, 0.19); --cm-sel: #dfe3ff; --cm-active: #f4f6fb; --syn-bracket: #4a505a; color-scheme: light; }
:root[data-theme="light"][data-light="warm"] { --panel: #f2efe6; --g-main: #e8e4d8; --paper: #fdfbf6; --g-surface: #ddd8c9; --ink: #141413; --muted: #53524e; --muted-2: #7c7a73; --line: rgba(20, 20, 19, 0.12); --line-2: rgba(20, 20, 19, 0.19); --line-3: rgba(20, 20, 19, 0.32); --on-ink: #faf9f5; --ink-hover: #2b2a27; --btn-hover: #e8e4d8; --row-hover: #f6f3eb; --pdf-bg: #5c5a55; --cm-sel: #f3dccf; --cm-active: #f4f0e6; --syn-bracket: #53524e; }
:root[data-code-theme="light"][data-light="warm"] .CodeMirror, :root[data-code-theme="light"][data-light="warm"] .CodeMirror-hints { --panel: #f2efe6; --paper: #fdfbf6; --ink: #141413; --muted: #53524e; --muted-2: #7c7a73; --line: rgba(20, 20, 19, 0.12); --line-2: rgba(20, 20, 19, 0.19); --cm-sel: #f3dccf; --cm-active: #f4f0e6; --syn-bracket: #53524e; color-scheme: light; }
:root[data-accent="clay"] { --accent: #b9583a; --accent-hover: #a24c31; --on-accent: #ffffff; }
:root[data-theme="dark"][data-accent="clay"] { --accent: #d97757; --accent-hover: #e48b6d; --on-accent: #1f1e1d; }
:root[data-theme="dark"][data-dark="warm"] { --hu-bar: #6f6c64; --hu: #cfccc2; --ai-bg: rgba(217, 161, 79, .06); }
:root[data-theme="dark"][data-dark="midnight"] { --hu-bar: #4b5160; }
.pal-group { margin-top: 16px; }
.pal-group > label { margin: 0 0 6px; font: 500 12.5px/1.2 var(--font); color: var(--muted); }
.pal-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pal-card { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid var(--line-2); border-radius: var(--r-md); background: var(--paper); color: var(--ink); cursor: pointer; text-align: left; font: inherit; }
.pal-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.pal-card .pv { display: grid; grid-template-columns: 26% 1fr; grid-template-rows: 9px 1fr; height: 54px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.pal-card .pv i:nth-child(1) { grid-column: 1 / 3; background: var(--p1); } .pal-card .pv i:nth-child(2) { background: var(--p1); }
.pal-card .pv i:nth-child(3) { background: var(--p2); padding: 6px; display: block; }
.pal-card .pv i:nth-child(3)::before { content: ""; display: block; height: 100%; border-radius: 2px; background: var(--p3); box-shadow: inset 0 9px 0 -6px var(--p4); }
.pal-card b { font-weight: 600; font-size: 13px; }
.pal-card .pv i:nth-child(2) { background: linear-gradient(var(--p5, transparent) 0 0) 5px 7px / calc(100% - 10px) 3px no-repeat, var(--p1); }
.pal-sub { margin: 12px 0 6px; font-size: 12px; color: var(--muted-2); }
.swatch.sw-auto { background: radial-gradient(circle, var(--sw) 0 5px, var(--paper) 5.5px 7px, var(--sw) 7.5px); }
.pal-card small { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.tc-prev.dark i:nth-child(1), .tc-prev.dark i:nth-child(2) { background: #1f1e1d; } .tc-prev.dark { background: #262624; } .tc-prev.dark i:nth-child(3) { background: #30302e; }
.tc-prev.system { background: linear-gradient(135deg, #eef0f3 50%, #262624 50%); } .tc-prev.system i:nth-child(1) { background: linear-gradient(90deg, #f7f8fa 50%, #1f1e1d 50%); }
.tc-prev.system i:nth-child(3) { background: linear-gradient(135deg, #fff 50%, #30302e 50%); }

:root[data-theme="light"][data-light="warm"] { --hu-bar: #bdb6a4; --hu: #5b5648; --hu-soft: #ebe6d8; }

/* Carbon: neutral charcoal on #151515 (no tint) */
:root[data-theme="dark"][data-dark="carbon"] { --panel: #111111; --g-main: #151515; --paper: #1c1c1c; --g-surface: #2a2a2a; --ink: #f2f2f2; --muted: #b8b8b8; --muted-2: #8c8c8c;
  --line: rgba(236, 236, 236, .09); --line-2: rgba(236, 236, 236, .16); --line-3: rgba(236, 236, 236, .30); --on-ink: #151515; --ink-hover: #d4d4d4;
  --btn-hover: #232323; --row-hover: #1a1a1a; --pdf-bg: #0a0a0a; --cm-sel: rgba(200, 200, 200, .2); --cm-active: rgba(255, 255, 255, .035);
  --syn-bracket: #b8b8b8; --syn-comment: #8c8c8c; --hu-bar: #5c5c5c; --hu: #c8c8c8; }
:root[data-code-theme="dark"][data-dark="carbon"] .CodeMirror, :root[data-code-theme="dark"][data-dark="carbon"] .CodeMirror-hints { --panel: #111111; --paper: #1c1c1c;
  --ink: #f2f2f2; --muted: #b8b8b8; --muted-2: #8c8c8c; --line: rgba(236, 236, 236, .09); --line-2: rgba(236, 236, 236, .16); --cm-sel: rgba(200, 200, 200, .2);
  --cm-active: rgba(255, 255, 255, .035); --syn-bracket: #b8b8b8; --syn-comment: #8c8c8c; color-scheme: dark; }
.tc-prev.dark i:nth-child(1), .tc-prev.dark i:nth-child(2) { background: #111111; } .tc-prev.dark { background: #151515; } .tc-prev.dark i:nth-child(3) { background: #1c1c1c; }
.tc-prev.system { background: linear-gradient(135deg, #eef0f3 50%, #151515 50%); } .tc-prev.system i:nth-child(1) { background: linear-gradient(90deg, #f7f8fa 50%, #111111 50%); }
.tc-prev.system i:nth-child(3) { background: linear-gradient(135deg, #fff 50%, #1c1c1c 50%); }

/* ---------------------------------------------------------------- full screen: just the document */
body.fs { grid-template-rows: 0 1fr 0; }
body.fs #top, body.fs #status { overflow: hidden; border: 0; padding-top: 0; padding-bottom: 0; visibility: hidden; }
body.fs #app { grid-template-columns: 0 0 minmax(0, 1fr) 0 0; }
body.fs.fs-right #app { grid-template-columns: 0 0 minmax(0, 1fr) 4px var(--right-w); }
body.fs #left, body.fs:not(.fs-right) #right { visibility: hidden; overflow: hidden; }
body.fs .resizer[data-resize="left"], body.fs:not(.fs-right) .resizer[data-resize="right"] { visibility: hidden; pointer-events: none; }
body.fs #visual { padding-top: 18px; }
.btn.fs-exit { gap: 5px; }

/* ---------------------------------------------------------------- find bar + project search */
#center { position: relative; }
.findbar { position: absolute; right: 14px; top: 44px; z-index: 30; width: min(460px, calc(100% - 28px)); background: var(--paper); border: 1px solid var(--line-2); border-radius: var(--r-md); box-shadow: 0 10px 28px var(--shadow); padding: 6px; display: grid; gap: 5px; }
.fb-row { display: flex; align-items: center; gap: 2px; }
.fb-in { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--paper); color: var(--muted); }
.fb-in:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px var(--focus-ring); }
.fb-in input { border: 0; padding: 0; height: 26px; background: none; box-shadow: none !important; font-size: 13px; }
.fb-row .tb { height: 26px; min-width: 26px; justify-content: center; font: 600 12px var(--mono); }
.fb-n { font: 500 11.5px var(--font); color: var(--muted); padding: 0 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fb-n.bad { color: var(--err); }
.fb-sep { width: 1px; height: 16px; background: var(--line-2); margin: 0 2px; }
.fb-hint { color: var(--muted); font-size: 11.5px; padding: 0 2px; }
.cm-find { background: rgba(250, 204, 21, .32); border-radius: 2px; }
.cm-find-cur { background: rgba(249, 115, 22, .55); box-shadow: 0 0 0 1px rgba(249, 115, 22, .9); border-radius: 2px; }
::highlight(find) { background-color: rgba(250, 204, 21, .38); }
::highlight(find-cur) { background-color: rgba(249, 115, 22, .6); }
#pane-search { display: flex; flex-direction: column; }
.ps-box { flex: none; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.ps-opts { display: flex; align-items: center; gap: 2px; margin-top: 5px; }
.ps-opts .tb { height: 24px; min-width: 26px; justify-content: center; font: 600 12px var(--mono); }
.ps-results { flex: 1; overflow-y: auto; min-height: 0; padding: 4px 0 20px; }
.ps-file { margin-bottom: 2px; }
.ps-fh { position: sticky; top: 0; display: flex; align-items: center; gap: 6px; padding: 5px 10px; background: var(--panel); font: 500 12.5px var(--font); cursor: pointer; z-index: 1; }
.ps-fh img { width: 14px; height: 14px; object-fit: contain; }
.ps-fh .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-fh svg { transition: transform var(--m-out); color: var(--muted); }
.ps-file.closed .ps-fh svg { transform: rotate(-90deg); }
.ps-file.closed ul { display: none; }
.ps-file ul { list-style: none; margin: 0; padding: 0; }
.ps-file li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 4px; padding: 3px 10px 3px 6px; cursor: pointer; font: 400 12px/1.45 var(--mono); }
.ps-file li:hover { background: var(--g-surface); }
.ps-file li.on { background: var(--accent-soft); }
.ps-file .ln { color: var(--muted-2); text-align: right; }
.ps-file .tx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ps-file mark { background: rgba(250, 204, 21, .4); color: inherit; border-radius: 2px; }
#btnFs.on { color: var(--accent); }

.findbar { display: flex; align-items: stretch; gap: 3px; padding: 6px 6px 6px 3px; }
.fb-rows { flex: 1; min-width: 0; display: grid; gap: 5px; }
.fb-tog { flex: none; width: 20px; border: 0; background: none; color: var(--muted); border-radius: var(--r-sm); display: grid; place-items: center; cursor: pointer; padding: 0; }
.fb-tog:hover { background: var(--g-surface); color: var(--ink); }
.fb-row .fb-act { font: 500 12px var(--font); padding: 0 8px; border: 1px solid var(--line-2); margin-left: 3px; }
.fb-row .fb-act:hover { border-color: var(--accent); color: var(--accent); }

/* drag-selecting text: nothing else reacts to the pointer */
body.selecting .bk > .tools, body.selecting .sheet .inserter, body.selecting #selPop { display: none !important; }
body.selecting .bk .fold { opacity: 0; transition: none; }
body.selecting #paper *, body.selecting #cmHost * { transition: none !important; animation: none !important; }
/* collapsible assistant suggestions */
.as-sugg { display: block; }
.sugg-tog { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 2px 4px 2px 2px; margin: 0 0 4px -2px; color: var(--muted); font: 500 11.5px var(--font); cursor: pointer; border-radius: var(--r-sm); }
.sugg-tog:hover { color: var(--ink); background: var(--g-surface); }
.sugg-tog .n { min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--g-surface); color: var(--muted); font-size: 10.5px; display: inline-grid; place-items: center; margin-left: 2px; }
.sugg-list { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.as-sugg.closed .sugg-tog { margin-bottom: 2px; }

/* ---------------------------------------------------------------- writing vs review */
/* Writing: your own text carries no approval marks; AI text has a thin amber bar only */
.approved-f, .sw.approved { background: var(--hu-bar); }
.pv-mark.approved { background: var(--hu-bar); opacity: .5; }
.bk.human_edit .sbar, .bk.approved .sbar { background: transparent; }
.bk.ai_draft .txt { background: none; }
.sheet .bk.ai_draft .sbar { width: 2px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--ai); font: 500 11.5px var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.linkbtn:hover { text-decoration: underline; }
.review-btn { color: var(--ai); }
.review-btn svg { color: var(--ai-bar); }
.review-btn .n { margin-left: 4px; min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--ai-soft); color: var(--ai); font-size: 11px; display: inline-grid; place-items: center; }
.review-btn.on { color: var(--ink); }
/* Review mode */
body.reviewing #sheet .bk:not(.ai_draft):not(.heading):not(.raw) .txt { opacity: .42; transition: opacity var(--m-out); }
body.reviewing #sheet .bk.ai_draft .txt { background: var(--ai-bg); }
body.reviewing #sheet .bk.rv-cur .txt { box-shadow: 0 0 0 1.5px var(--ai-bar), 0 0 0 5px var(--ai-soft); border-radius: 3px; }
body.reviewing #sheet .bk > .tools { display: none !important; }
.cm-rv { background: var(--ai-line-bg); }
.reviewbar { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 31; width: min(620px, calc(100% - 28px)); background: var(--paper); border: 1px solid var(--line-2); border-left: 3px solid var(--ai-bar); border-radius: var(--r-md); box-shadow: 0 14px 36px var(--shadow); padding: 8px 10px 9px; display: grid; gap: 6px; }
.rv-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rv-k { display: inline-flex; align-items: center; gap: 5px; font: 600 12.5px var(--font); color: var(--ai); white-space: nowrap; }
.rv-pos { font: 500 11.5px var(--font); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rv-sec { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.rv-sec::before { content: "·"; margin-right: 8px; }
.rv-top .tb { height: 26px; min-width: 26px; justify-content: center; }
.rv-note { font-size: 13px; line-height: 1.45; color: var(--ink); }
.rv-hint { font-size: 12px; color: var(--muted); }
.rv-diff { max-height: 170px; overflow: auto; font: 400 12px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; padding: 6px 8px; border-radius: var(--r-sm); background: var(--g-surface); }
.rv-diff del { color: var(--err); background: color-mix(in srgb, var(--err) 10%, transparent); text-decoration: line-through; }
.rv-diff ins { color: var(--ok); background: var(--ok-soft); text-decoration: none; }
.rv-acts { display: flex; align-items: center; gap: 5px; }
.rv-acts kbd { margin-left: 6px; font: 500 10px var(--mono); padding: 0 4px; border-radius: 3px; border: 1px solid currentColor; opacity: .5; }
.rv-acts .btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.rv-acts .btn.ghost:hover { color: var(--ink); background: var(--g-surface); }
.rv-acts .btn.armed { color: var(--err); background: color-mix(in srgb, var(--err) 10%, transparent); }
.rv-done { display: flex; align-items: center; gap: 8px; font: 500 13px var(--font); color: var(--ok); }
.rv-acts kbd { background: none; color: inherit; }
body.reviewing .CodeMirror .pv-bg-ai { background: var(--ai-line-bg); }

/* =====================================================================================================
   SOFT SHELL: rounded, layered surfaces (desktop-app feel). The window is a canvas; the editor and the
   right panel float on it as rounded cards; the left sidebar sits directly on the canvas. Controls are
   pills and soft rounded rectangles; separators are spacing and tone, not hairlines.
   ===================================================================================================== */
:root {
  --r-xs: 6px; --r-sm: 8px; --r-md: 10px; --r-lg: 14px; --r-xl: 18px; --r-pill: 999px;
  --canvas: var(--g-main); --card: var(--panel); --card-line: var(--line);
  --lift: 0 1px 2px rgba(11, 12, 14, .05), 0 0 0 1px var(--card-line);
  --float: 0 18px 48px -12px rgba(11, 12, 14, .22), 0 2px 6px rgba(11, 12, 14, .06), 0 0 0 1px var(--line);
  --hover: color-mix(in srgb, var(--ink) 6%, transparent); --press: color-mix(in srgb, var(--ink) 10%, transparent);
}
:root[data-theme="dark"] {
  --canvas: color-mix(in srgb, var(--g-main) 72%, #000); --card: var(--g-main); --card-line: rgba(255, 255, 255, .07);
  --lift: 0 0 0 1px var(--card-line), 0 1px 3px rgba(0, 0, 0, .35);
  --float: 0 22px 56px -12px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .09);
  --hover: rgba(255, 255, 255, .06); --press: rgba(255, 255, 255, .1);
}
:root[data-theme="dark"][data-dark="carbon"] { --canvas: #0e0e0e; --card: #151515; --paper: #1b1b1b; }

/* ---- window: canvas + floating cards */
body { background: var(--canvas); grid-template-rows: 42px 1fr 28px; }
#top { background: transparent; border-bottom: 0; padding: 0 12px 0 10px; }
#status { background: transparent; border-top: 0; padding: 0 14px; font-size: 12px; }
#status .s { border-right: 0; padding: 0 7px; height: auto; }
#status .s + .s:not(.push)::before { content: ""; width: 3px; height: 3px; border-radius: 50%; background: var(--muted-2); opacity: .5; margin-right: 7px; }
#status .s:empty { display: none; }
#app { grid-template-columns: var(--left-w) 8px minmax(0, 1fr) 8px var(--right-w); padding: 0 8px 0 0; }
body.left-min #app { grid-template-columns: 52px 0 minmax(0, 1fr) 8px var(--right-w); }
body.right-min #app { grid-template-columns: var(--left-w) 8px minmax(0, 1fr) 0 52px; }
body.left-min.right-min #app { grid-template-columns: 52px 0 minmax(0, 1fr) 0 52px; }
body.fs #app { grid-template-columns: 0 0 minmax(0, 1fr) 0 0; padding: 8px; }
body.fs.fs-right #app { grid-template-columns: 0 0 minmax(0, 1fr) 8px var(--right-w); }
#left { --panel: var(--canvas); background: transparent; }
#center, #right { --panel: var(--card); background: var(--card); border-radius: var(--r-lg); box-shadow: var(--lift); overflow: hidden; }
body.left-min #left, body.right-min #right { border: 0; }
body.right-min #right { background: transparent; box-shadow: none; --panel: var(--canvas); }
/* resizers: an invisible gutter with a pill that appears on hover */
.resizer { background: transparent; position: relative; }
.resizer::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 44px; margin: -22px 0 0 -2px; border-radius: var(--r-pill); background: var(--line-2); opacity: 0; transition: opacity var(--m-in), background var(--m-in), height var(--m-in); }
.resizer:hover::after { opacity: 1; }
.resizer.drag::after, .resizer:active::after { opacity: 1; background: var(--accent); height: 72px; margin-top: -36px; }
.resizer:hover, .resizer.drag { background: transparent; }

/* ---- tabs: pills instead of underlines */
.tabs { gap: 2px; padding: 8px 8px 6px; border-bottom: 0; align-items: center; }
.tabs button { padding: 6px 10px; border-radius: var(--r-pill); transition: background var(--m-out), color var(--m-out); }
.tabs button:hover { background: var(--hover); }
.tabs button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(11, 12, 14, .08), 0 0 0 1px var(--line); }
:root[data-theme="dark"] .tabs button.on { background: var(--press); box-shadow: none; }
.tabs button.on::after { display: none; }
.tabs .tab-min { margin-left: auto; padding: 6px; }
#left .tabs button.on { background: var(--card); }
:root[data-theme="dark"] #left .tabs button.on { background: var(--hover); }

/* ---- controls */
.btn { border-radius: var(--r-sm); border-color: var(--line); background: var(--paper); transition: background var(--m-out), border-color var(--m-out), box-shadow var(--m-out), transform var(--m-press); }
.btn:hover { background: var(--btn-hover); border-color: var(--line-2); }
.btn:active { transform: scale(.98); }
.btn.sm { border-radius: var(--r-sm); }
.btn.icon-only { border-radius: var(--r-sm); }
#top .btn { border-color: transparent; background: transparent; }
#top .btn:hover { background: var(--hover); }
#top .btn.primary { background: var(--accent); color: var(--on-accent); border-radius: var(--r-pill); padding: 0 14px; }
#top .btn.primary:hover { background: var(--accent-hover); }
#top .top-actions .btn:not(.primary) { border-color: var(--line); background: color-mix(in srgb, var(--paper) 60%, transparent); }
:root[data-theme="dark"] #top .top-actions .btn:not(.primary) { background: var(--hover); border-color: transparent; }
#top .top-actions kbd { border-radius: var(--r-xs); }
/* Windows/Linux: "Ctrl+K" in the interface font reads better than a wide monospace label (the Mac's ⌘K is unchanged) */
:root:not([data-mac]) .top-actions kbd { font: 500 11px/1.3 var(--font); letter-spacing: .01em; padding: 1px 5px; }
/* label hidden on a narrower window: the shortcut keeps the same distance from what's before it as on "Ask AI" */
@media (max-width: 1320px) { .top-actions .btn.ai kbd { margin-left: 10px; } }
.btn.primary { border-radius: var(--r-sm); }
.seg { border-radius: var(--r-pill); padding: 3px; background: var(--hover); }
.seg button { border-radius: var(--r-pill); padding: 6px 14px; transition: background var(--m-out), color var(--m-out); }
.seg button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(11, 12, 14, .12), 0 0 0 1px var(--line); }
:root[data-theme="dark"] .seg button.on { background: var(--press); box-shadow: none; }
input, textarea, select { border-radius: var(--r-sm); border-color: var(--line); }
.chip, .chip.sugg { border-radius: var(--r-pill); border-color: var(--line); padding: 4px 11px; }
.chip.sugg { background: var(--paper); }
:root[data-theme="dark"] .chip.sugg { background: var(--hover); border-color: transparent; }
.toggle { border-radius: var(--r-pill); }
kbd { border-radius: var(--r-xs); }
.count, .tabs .count { border-radius: var(--r-pill); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ink) 16%, transparent); border-radius: var(--r-pill); border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--ink) 28%, transparent); }
::-webkit-scrollbar-track { background: transparent; }

/* ---- floating things: popovers, menus, toasts, modals */
.popover { border-radius: var(--r-xl); border: 0; box-shadow: var(--float); padding: 12px; }
.menu-items, .mini-menu { border-radius: var(--r-lg); border: 0; box-shadow: var(--float); padding: 5px; }
.menu-items a, .mini-menu a { border-radius: var(--r-sm); }
.menu-items a:hover, .mini-menu a:hover { background: var(--hover); }
.toast { border-radius: var(--r-pill); padding: 9px 18px; }
#modal { background: rgba(11, 12, 14, .28); backdrop-filter: blur(3px); }
.modal-card { border-radius: var(--r-xl); box-shadow: var(--float); }
.findbar, .reviewbar { border: 0; border-radius: var(--r-lg); box-shadow: var(--float); }
.reviewbar { border-left: 0; padding: 10px 12px 11px; }
.reviewbar::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--ai-bar); }
.fb-in { border-radius: var(--r-sm); border-color: var(--line); }
.CodeMirror-hints { border-radius: var(--r-md); box-shadow: var(--float); border: 0; padding: 4px; }
.CodeMirror-hint { border-radius: var(--r-xs); }

/* ---- left sidebar on the canvas */
.lsec { border-bottom: 0; margin: 0 6px 6px; }
.lsec-head { padding: 4px 4px 2px 2px; }
.lsec-toggle { border-radius: var(--r-sm); color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .01em; }
.lsec-toggle { white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }   /* "Files 24 files" stays on one line in a narrow panel */
.lsec-toggle:hover { background: var(--hover); color: var(--ink); }
.lsec-body { padding: 0 6px 10px; }
.tree li > .row, .otree .orow { border-radius: var(--r-sm); }
.tree li > .row:hover { background: var(--hover); }
.tree li > .row.on { background: var(--card); box-shadow: 0 1px 2px rgba(11, 12, 14, .06), 0 0 0 1px var(--line); }
:root[data-theme="dark"] .tree li > .row.on { background: var(--press); box-shadow: none; }
.tree .tag { border-radius: var(--r-pill); padding: 3px 7px; }
.tree .mini, .ometer, .meter { border-radius: var(--r-pill); }
.tree .acts button { border-radius: var(--r-xs); }
.otree .orow:hover { background: var(--hover); }
.otree .orow.cur { background: var(--hover); box-shadow: none; }
.otree .orow.cur .t { color: var(--ink); font-weight: 500; }
#pane-brief, #pane-search { margin: 0 6px; }
.ps-box { border-bottom: 0; }
.ps-fh { background: var(--canvas); border-radius: var(--r-sm); }
.ps-file li { border-radius: var(--r-sm); margin: 0 4px; }
.rail { gap: 6px; padding: 10px 0; }
.rail-btn { border-radius: var(--r-md); width: 34px; height: 34px; }
.rail-btn:hover { background: var(--hover); }
.rail-tip { position: fixed; z-index: 200; pointer-events: none; padding: 5px 9px; border-radius: var(--r-sm); background: var(--ink); color: var(--g-main); font: 500 12px/1.2 var(--font); white-space: nowrap; box-shadow: 0 4px 14px var(--shadow); }

/* ---- editor card */
.center-bar { border-bottom: 0; background: transparent; height: 44px; padding: 0 12px 0 16px; }
.center-bar .path { font-family: var(--font); font-weight: 600; }
.center-bar .btn { border-color: transparent; background: transparent; }
.center-bar .btn:hover { background: var(--hover); }
.center-bar .btn.on { border-radius: var(--r-sm); }
.center-bar .review-btn { background: var(--ai-bg); border-radius: var(--r-pill); padding: 0 10px; }
.center-bar .review-btn:hover { background: var(--ai-soft); }
.center-bar .toggle { padding: 4px 9px; }
.center-bar .toggle:hover { background: var(--hover); }
#visual { padding: 4px 14px 120px; }
.sheet { border: 0; border-radius: var(--r-lg); box-shadow: 0 1px 2px rgba(11, 12, 14, .05), 0 0 0 1px var(--line); }
:root[data-theme="dark"] .sheet { box-shadow: 0 0 0 1px var(--card-line); }
.sheet .txt { border-radius: var(--r-sm); }
.bk > .tools { border: 0; border-radius: var(--r-md); box-shadow: var(--float); padding: 3px; }
.tb { border-radius: var(--r-sm) !important; }
.bk > .busy-tag { border-radius: var(--r-pill); }
.cbadge { border-radius: var(--r-pill); }
.rawchip { border-radius: var(--r-pill); }
.mcard { border-radius: var(--r-md); border: 0; box-shadow: 0 1px 2px rgba(11, 12, 14, .06), 0 0 0 1px var(--line); }
:root[data-theme="dark"] .mcard { box-shadow: 0 0 0 1px var(--card-line); }
.mcard.active { box-shadow: 0 10px 28px -10px var(--shadow), 0 0 0 1px var(--line-2); }
#code .CodeMirror, #cmHost .CodeMirror { background: transparent; }
#code .CodeMirror-gutters { background: transparent; border-right: 0; }
#viewer { border-radius: 0 0 var(--r-lg) var(--r-lg); }
.pdf-tools { border-radius: var(--r-pill); border: 0; box-shadow: var(--float); }

/* ---- right card: assistant */
.as-head { border-bottom: 0; background: transparent; padding: 2px 10px 4px; }
.as-title { border-radius: var(--r-pill); padding: 5px 10px; }
.as-title:hover, .as-title[aria-expanded="true"] { background: var(--hover); }
.as-scroll { padding: 6px 14px 18px; gap: 10px; }
.as-msg { border-radius: var(--r-lg); border: 0; background: transparent; padding: 4px 2px; }
.as-msg.me { margin-left: 34px; padding: 9px 13px; background: var(--hover); border: 0; border-radius: var(--r-xl) var(--r-xl) var(--r-sm) var(--r-xl); }
.as-msg.failed { background: var(--err-soft); padding: 9px 12px; }
.card { border-radius: var(--r-lg); border: 0; box-shadow: 0 0 0 1px var(--line); }
.as-compose { border-top: 0; background: transparent; padding: 6px 12px 12px; }
.as-box { border-radius: var(--r-xl); border: 0; padding: 9px 10px 8px 12px; box-shadow: 0 4px 16px -6px rgba(11, 12, 14, .14), 0 0 0 1px var(--line-2); }
:root[data-theme="dark"] .as-box { background: var(--paper); box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 8px 24px -10px rgba(0, 0, 0, .6); }
.as-box:focus-within { box-shadow: 0 6px 20px -6px rgba(11, 12, 14, .18), 0 0 0 1px var(--accent); }
.as-box textarea { border: 0; box-shadow: none !important; padding: 2px 0; background: transparent; }
.as-row .btn { border-radius: var(--r-pill); }
#asSend { border-radius: var(--r-pill); }
.as-attach, .as-scope > span > span, .scope-chip { border-radius: var(--r-pill); }
.rail-busy { border-radius: var(--r-md); border: 0; }
.as-job, .jobcard, .as-card { border-radius: var(--r-lg); }
/* ---- projects page + settings */
body.home { background: var(--canvas); }
body.home #top { background: color-mix(in srgb, var(--canvas) 86%, transparent); backdrop-filter: blur(8px); }
.home-nav { align-items: center; gap: 4px; }
.home-nav a { height: 30px; border-radius: var(--r-pill); padding: 0 13px; transition: background var(--m-out), color var(--m-out); }
.home-nav a:hover { background: var(--hover); }
.home-nav a.on { background: var(--paper); box-shadow: 0 1px 2px rgba(11, 12, 14, .08), 0 0 0 1px var(--line); }
:root[data-theme="dark"] .home-nav a.on { background: var(--press); box-shadow: none; }
.home-nav a.on::after { display: none; }
.ptable-wrap { border: 0; box-shadow: var(--lift); border-radius: var(--r-xl); background: var(--card); }
:root:not([data-theme="dark"]) .ptable-wrap { background: var(--paper); }
.ptable th { border-bottom: 0; padding: 14px 16px 8px; }
.ptable td { border-bottom: 0; border-top: 1px solid var(--line); padding: 13px 16px; }
.ptable tbody tr:hover td { background: var(--hover); }
.home-empty { border-radius: var(--r-xl); }
.fmt, .badge, .tag { border-radius: var(--r-pill); padding-left: 8px; padding-right: 8px; }
.settings .set-nav { background: transparent; border-right: 0; }
.set-nav button { border-radius: var(--r-sm); }
.set-nav button.on { border-radius: var(--r-sm); }
.modal-card .settings, .modal-card.wide { border-radius: var(--r-xl); }
.modal-card.wide { background: var(--card); }
.settings > :not(.set-nav) { background: var(--paper); border-radius: var(--r-lg); margin: 8px 8px 8px 0; box-shadow: 0 0 0 1px var(--line); }

/* ---- calmer: rounding only where it helps (cards, popovers, inputs); plain text for tabs and nav */
:root { --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 14px; }
.tabs { padding: 4px 10px 0; gap: 0; }
.tabs button, .tabs button:hover, .tabs button.on, :root[data-theme="dark"] .tabs button.on,
#left .tabs button.on, :root[data-theme="dark"] #left .tabs button.on { background: none; box-shadow: none; border-radius: 0; }
.tabs button { padding: 11px 8px 9px; color: var(--muted); }
.tabs button:hover { color: var(--ink); }
.tabs button.on { color: var(--ink); font-weight: 600; }
.tabs .tab-min { padding: 9px 4px; }
.home-nav a, .home-nav a:hover, .home-nav a.on, :root[data-theme="dark"] .home-nav a.on { background: none; box-shadow: none; border-radius: 0; }
.home-nav a.on { font-weight: 600; }
.seg { border-radius: var(--r-md); }
.seg button { border-radius: var(--r-sm); padding: 6px 12px; }
#top .btn.primary { border-radius: var(--r-md); padding: 0 12px; }
#top .top-actions .btn:not(.primary), :root[data-theme="dark"] #top .top-actions .btn:not(.primary) { background: transparent; border-color: transparent; }
#top .top-actions .btn:not(.primary):hover { background: var(--hover); }
.tree li > .row.on, :root[data-theme="dark"] .tree li > .row.on { background: var(--hover); box-shadow: none; }
.tree li > .row.on .nm { font-weight: 500; }
.tree .tag { border-radius: var(--r-xs); padding: 3px 5px; }
.fmt, .badge, .tag { border-radius: var(--r-xs); padding-left: 6px; padding-right: 6px; }
.chip, .chip.sugg { border-radius: var(--r-md); padding: 4px 9px; }
.center-bar .review-btn { background: none; border-radius: var(--r-sm); padding: 0 8px; }
.center-bar .review-btn:hover { background: var(--hover); }
.as-title { border-radius: var(--r-sm); }
.toast { border-radius: var(--r-md); padding: 9px 14px; }
.as-row .btn, #asSend { border-radius: var(--r-sm); }
.as-attach, .as-scope > span > span, .scope-chip { border-radius: var(--r-sm); }
.bk > .busy-tag, .cbadge, .rawchip { border-radius: var(--r-sm); }
.pdf-tools { border-radius: var(--r-md); }
.as-msg.me { border-radius: var(--r-lg); }
.center-bar .toggle { padding: 0; }
.center-bar .toggle:hover { background: none; }
.center-bar .review-btn.none, .center-bar .review-btn.none svg { color: var(--muted-2); }
.CodeMirror-hint .hk span { display: inline-flex; align-items: baseline; gap: 10px; }
.CodeMirror-hint .hpv { font-style: normal; color: var(--ink); font-size: 13px; min-width: 18px; text-align: center; }
.CodeMirror-hint .hpv .katex { font-size: 1.05em; }
.CodeMirror-hints { min-width: 260px; }
.CodeMirror-hint .hpv { display: inline-block; line-height: 1; max-height: 1.5em; }
.CodeMirror-hint .hpv .katex { font-size: .95em; }
/* ---- scrollbars: one per panel, thin, and only visible while the pointer is over that area */
#pane-files { max-height: none; overflow: visible; }
* { scrollbar-width: thin; scrollbar-color: transparent transparent; }
*:hover { scrollbar-color: color-mix(in srgb, var(--ink) 22%, transparent) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; background: transparent; }
::-webkit-scrollbar-thumb { background: transparent; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
*:hover::-webkit-scrollbar-thumb { background-color: color-mix(in srgb, var(--ink) 20%, transparent); }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--ink) 34%, transparent) !important; }
::-webkit-scrollbar-corner { background: transparent; }
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar { scrollbar-width: thin; }

/* ---- dark mode: softened text. Near-white on near-black (15:1) glares; these sit around 12–13:1 (secondary text
   about 7.5:1): bright enough to read crisply, without the glare. */
:root[data-theme="dark"], :root[data-code-theme="dark"] .CodeMirror, :root[data-code-theme="dark"] .CodeMirror-hints { --ink: #dadde3; --muted: #a5adba; }
:root[data-theme="dark"][data-dark="carbon"], :root[data-code-theme="dark"][data-dark="carbon"] .CodeMirror, :root[data-code-theme="dark"][data-dark="carbon"] .CodeMirror-hints { --ink: #dcdcdc; --muted: #a8a8a8; --syn-bracket: #a8a8a8; --hu: #c2c2c2; }
:root[data-theme="dark"][data-dark="warm"], :root[data-code-theme="dark"][data-dark="warm"] .CodeMirror, :root[data-code-theme="dark"][data-dark="warm"] .CodeMirror-hints { --ink: #e2dfd6; --muted: #b2afa6; --syn-bracket: #b2afa6; }
:root[data-theme="dark"][data-dark="slate"], :root[data-code-theme="dark"][data-dark="slate"] .CodeMirror, :root[data-code-theme="dark"][data-dark="slate"] .CodeMirror-hints { --ink: #dadde3; --muted: #a5adba; --syn-bracket: #a5adba; }
:root[data-theme="dark"][data-dark="midnight"], :root[data-code-theme="dark"][data-dark="midnight"] .CodeMirror, :root[data-code-theme="dark"][data-dark="midnight"] .CodeMirror-hints { --ink: #dcdee2; --muted: #a7aab2; }
:root[data-theme="dark"][data-dark="dim"], :root[data-code-theme="dark"][data-dark="dim"] .CodeMirror, :root[data-code-theme="dark"][data-dark="dim"] .CodeMirror-hints { --ink: #d8dbdf; --muted: #a5aab0; }
/* the bright pastel blue of commands and links, toned down a little */
:root[data-theme="dark"], :root[data-code-theme="dark"] .CodeMirror { --syn-cmd: #8aa3e0; }
:root[data-theme="dark"] .sheet { color: color-mix(in srgb, var(--ink) 93%, var(--paper)); }
:root[data-theme="dark"] .sheet .bk.heading .txt, :root[data-theme="dark"] .titleblock h1 { color: var(--ink); }
:root[data-theme="dark"] body { -webkit-font-smoothing: antialiased; }

/* ---- LaTeX highlighting: what plain stex leaves uncoloured */
:root, :root[data-code-theme="light"] .CodeMirror { --syn-key: #a14a0b; --syn-ref: #6d3fd1; --syn-file: #0e7166; --syn-env: #b0306e; --syn-math: #0b7350; --syn-math-bg: rgba(11, 115, 80, .05); }   /* math green, apart from the blue commands */
:root[data-theme="dark"], :root[data-code-theme="dark"] .CodeMirror { --syn-key: #d9a066; --syn-ref: #b39ae8; --syn-file: #63bfb2; --syn-env: #df8fb5; --syn-math: #93d3a6; --syn-math-bg: rgba(147, 211, 166, .06); }
:root[data-code-theme="light"] .CodeMirror { --syn-math-bg: rgba(11, 115, 80, .05); }
.CodeMirror .cm-tex-key { color: var(--syn-key); }
.CodeMirror .cm-tex-ref { color: var(--syn-ref); }
.CodeMirror .cm-tex-file { color: var(--syn-file); }
.CodeMirror .cm-tex-env { color: var(--syn-env); }
.CodeMirror .cm-tex-sec { color: var(--ink); font-weight: 600; }
.CodeMirror .cm-tex-opt { color: var(--muted); }
.CodeMirror .cm-tex-math { color: var(--syn-math); background: var(--syn-math-bg); }
/* math is one colour, commands included, so it never looks like \\section or \\cite (those keep the command colour) */
.CodeMirror .cm-tex-math.cm-tag, .CodeMirror .cm-tex-math.cm-keyword, .CodeMirror .cm-tex-math.cm-bracket, .CodeMirror .cm-tex-math.cm-atom, .CodeMirror .cm-tex-math.cm-number { color: var(--syn-math); }

/* ---- @file mentions in the Assistant */
.mention-pop { position: fixed; z-index: 90; background: var(--paper); border-radius: var(--r-md); box-shadow: var(--float); padding: 4px; max-height: 320px; overflow-y: auto; }
.mn-h { font: 600 11px var(--font); color: var(--muted); padding: 4px 8px 5px; letter-spacing: .02em; }
.mn-i { display: flex; align-items: center; gap: 7px; padding: 5px 8px; border-radius: var(--r-sm); cursor: pointer; font-size: 12.5px; min-width: 0; }
.mn-i img { width: 14px; height: 14px; object-fit: contain; flex: none; }
.mn-i b { font-weight: 500; white-space: nowrap; }
.mn-i span { color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mn-i i { margin-left: auto; font-style: normal; color: var(--accent); font-size: 11px; }
.mn-i.on, .mn-i:hover { background: var(--hover); }
.as-mention { display: inline-flex; align-items: center; gap: 3px; padding: 0 5px; border-radius: var(--r-xs); background: var(--accent-soft); color: var(--accent); font-weight: 500; cursor: pointer; vertical-align: baseline; }
.as-mention img { width: 12px; height: 12px; object-fit: contain; }

/* ---- compile problems, explained */
.pdf-errs.warn-only summary { color: var(--muted); }
.pdf-errs .errs { max-height: 42vh; overflow-y: auto; }
.prob { padding: 9px 12px 10px; border-top: 1px solid var(--line); cursor: pointer; font-size: 12.5px; line-height: 1.45; }
.prob:hover { background: var(--hover); }
.prob .pt { display: flex; align-items: baseline; gap: 8px; }
.prob .pt b { font-weight: 600; color: var(--err); }
.prob.w .pt b { color: var(--ai); }
.prob .pt code { margin-left: auto; color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.prob .px { color: var(--ink); margin-top: 2px; }
.prob .ph { color: var(--muted); margin-top: 2px; }
.prob .pc { margin-top: 4px; }
.prob .pc code { font-size: 11.5px; background: var(--g-surface); padding: 1px 5px; border-radius: var(--r-xs); color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.prob .pm { margin-top: 3px; }
.prob .pm summary { color: var(--muted-2); font-size: 11px; cursor: pointer; list-style: none; }
.prob .pm summary::-webkit-details-marker { display: none; }
.prob .pm code { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.prob .pa { display: flex; gap: 6px; margin-top: 7px; }
/* ---- PDF ↔ source */
.pdf-page { position: relative; }
.pdf-hit { position: absolute; border-radius: 3px; background: color-mix(in srgb, var(--accent) 22%, transparent); box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, transparent); pointer-events: none; animation: pdfHit 1.8s ease-out forwards; }
@keyframes pdfHit { 0%, 55% { opacity: 1; } 100% { opacity: 0; } }
.pdf-ping { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 2px solid var(--accent); pointer-events: none; animation: pdfPing .7s ease-out forwards; }
@keyframes pdfPing { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
.CodeMirror .cm-jump { background: color-mix(in srgb, var(--accent) 16%, transparent); transition: background .6s; }
#pdfScroll { cursor: default; }

/* PDF toolbar: the page counter stays on one line */
.pdf-tools .pg { white-space: nowrap; font-variant-numeric: tabular-nums; min-width: 46px; text-align: center; padding: 0 4px; flex: none; }
.pdf-tools { white-space: nowrap; }
.pdf-tools .tb { flex: none; }

/* ---------------------------------------------------------------- spell check */
.sp, .cm-spell { text-decoration: underline wavy var(--err); text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-skip-ink: none; }
.spell-pop { width: auto; min-width: 190px; max-width: 280px; padding: 5px; }
.spell-pop .sp-word { padding: 5px 9px 6px; font-size: 12px; color: var(--muted); }
.spell-pop button { display: block; width: 100%; text-align: left; padding: 6px 9px; border: 0; background: none; color: var(--ink); font: inherit; font-size: 13px; border-radius: var(--r-sm); cursor: pointer; }
.spell-pop button[data-sp-rep] { font-weight: 600; }
.spell-pop button:hover { background: var(--row-hover); }
.spell-pop .sp-none { padding: 5px 9px; font-size: 13px; color: var(--muted); }
.spell-pop .sp-sep { height: 1px; background: var(--line); margin: 4px 2px; }
.word-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.word-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 9px; border: 1px solid var(--line-2); border-radius: var(--r-sm); font-size: 13px; }
.word-chip button { border: 0; background: none; color: var(--muted); padding: 2px; cursor: pointer; display: inline-flex; border-radius: var(--r-xs); }
.word-chip button:hover { color: var(--ink); background: var(--row-hover); }

/* ---------------------------------------------------------------- Review tab: filters, AI changes, checks */
.rv-filters { display: flex; gap: 16px; padding: 2px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 13px; }
.rv-filters a { color: var(--muted); cursor: pointer; }
.rv-filters a:hover { color: var(--ink); }
.rv-filters a.on { color: var(--ink); font-weight: 600; }
.rv-filters .n { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 400; }
.pane .card.chk-row { cursor: pointer; padding: 8px 6px; margin: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; }
.pane .card.chk-row:hover { background: var(--row-hover); }
.chk-row .chk-t { display: flex; align-items: baseline; gap: 7px; font-size: 13px; color: var(--ink); line-height: 1.4; }
.chk-row .chk-d { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.chk-row .row { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; }
.chk-row .row a { font-size: 12.5px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.chk-row .row a:hover { color: var(--ink); }
.chk-row .chk-w { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sev-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); transform: translateY(-1px); }
.sev-dot.error { background: var(--err); }
.sev-dot.warn { background: #d08a1d; }
.chk-tg { display: flex; gap: 10px; }
.chk-tg a { cursor: pointer; color: var(--muted); }
.chk-tg a:hover { color: var(--ink); }
.main-m { flex: none; font: 600 10px/1 var(--font); color: var(--muted-2); margin-left: 4px; letter-spacing: 0; }
.row:hover > .main-m, .row.on > .main-m { color: var(--muted); }

/* ---------------------------------------------------------------- citations: web results, hover card, bibliography health */
.CodeMirror-hint.hint-web { border-top: 1px solid var(--line); }
.CodeMirror-hint.hint-web + .CodeMirror-hint.hint-web { border-top: 0; }
.CodeMirror-hint.hint-wait { color: var(--muted); cursor: default; }
.cm-citing { background: var(--ai-bg); }
.cite-card { width: 360px; padding: 10px 12px; font-size: 13px; }
.cite-card .cc-key { font: 500 11.5px var(--mono, monospace); color: var(--muted); margin-bottom: 3px; }
.cite-card .cc-t { font-weight: 600; line-height: 1.35; }
.cite-card .cc-t a { color: var(--ink); text-decoration: none; }
.cite-card .cc-t a:hover { color: var(--accent); }
.cite-card .cc-a { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.cite-card .cc-n { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.cite-card .cc-acts { display: flex; gap: 14px; margin-top: 8px; }
.cite-card .cc-acts a { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); cursor: pointer; font-size: 12.5px; }
.health { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 12.5px; padding: 6px 0 4px; }
.health .hl-h { font-weight: 600; color: var(--ink); }
.health a { color: var(--muted); cursor: pointer; }
.health a:hover, .health a.on { color: var(--ink); }
.health a.on { font-weight: 600; }
.health a.bad { color: var(--err); }
.health [data-bh] { color: var(--accent); margin-left: auto; }
.health-list { border-top: 1px solid var(--line); margin-bottom: 6px; }
.hl-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 2px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.hl-row b { font-weight: 500; }
.hl-acts { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }
.hl-acts a { color: var(--accent); cursor: pointer; }
.related { font-size: 12.5px; padding: 2px 0 8px; }
.related > a { color: var(--accent); cursor: pointer; }
.related .rel-h { display: flex; justify-content: space-between; margin: 4px 0; }
.related .rel-h a { color: var(--muted); cursor: pointer; }
.rel-row { padding: 6px 2px; border-bottom: 1px solid var(--line); }
.rel-row .t a { color: var(--ink); text-decoration: none; font-weight: 500; }
.rel-row .a { color: var(--muted); margin: 1px 0 2px; }
.rel-row [data-rel-add] { color: var(--accent); cursor: pointer; }

/* ---------------------------------------------------------------- rebuttal */
.rv-tools { display: flex; gap: 14px; font-size: 12.5px; margin: 6px 0 2px; }
.rv-tools a { color: var(--accent); cursor: pointer; }
.mcard.rev .who, .cmt-row.rev .who { color: #8a5a00; }
[data-theme="dark"] .mcard.rev .who, [data-theme="dark"] .cmt-row.rev .who { color: #e0b25a; }

/* ---------------------------------------------------------------- usage */
.usage-t { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 6px; }
.usage-t th { text-align: left; font-weight: 500; color: var(--muted); padding: 4px 6px; border-bottom: 1px solid var(--line); }
.usage-t td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
.usage-t .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------------------------------------------------------------- AI real-time review */
.lr-bar { display: flex; align-items: baseline; gap: 12px; font-size: 12.5px; margin: 6px 0 2px; }
.lr-bar a { color: var(--accent); cursor: pointer; }
.lr-bar [data-lr-toggle] { font-weight: 600; color: var(--muted); }
.lr-bar [data-lr-toggle].lr-on { color: var(--accent); }
.lr-bar .lr-set { margin-left: auto; color: var(--muted); }
.lr-err { color: var(--err); }
.cmt-who { display: flex; gap: 12px; font-size: 12.5px; margin: 6px 0 2px; }
.cmt-who a { color: var(--muted); cursor: pointer; }
.cmt-who a.on { color: var(--ink); font-weight: 600; }
.mcard.live .who, .mcard.live .who svg { color: #6d5bd0; }
[data-theme="dark"] .mcard.live .who, [data-theme="dark"] .mcard.live .who svg { color: #a99cf0; }
.lr-focus { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; font-size: 13px; }
.ck-row { display: flex; align-items: center; gap: 6px; }
.eff-sel { margin-top: 4px; min-width: 200px; }
.ar-head { display: flex; flex-direction: column; gap: 10px; padding: 6px 2px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.ar-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ar-t { font-size: 13px; color: var(--ink); }
.ar-d { font-size: 12px; color: var(--muted); margin-top: 1px; }
.ar-opts { display: flex; gap: 12px; font-size: 12.5px; }
.ar-opts a { color: var(--muted); cursor: pointer; }
.ar-opts a:hover { color: var(--ink); }
.ar-opts a.on { color: var(--ink); font-weight: 600; }
.ar-links { display: flex; align-items: baseline; gap: 14px; font-size: 12.5px; }
.ar-links a { color: var(--accent); cursor: pointer; }
.ar-links a:hover { text-decoration: underline; text-underline-offset: 2px; }
.ar-links .ar-set { margin-left: auto; color: var(--muted); }
.ar-busy { color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.ar-err { font-size: 12.5px; color: var(--err); }
.ar-sw { flex: none; position: relative; width: 26px; height: 15px; padding: 0; border: 0; border-radius: 8px; background: var(--line-2); cursor: pointer; transition: background .15s; }
.ar-sw i { position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--paper); transition: transform .15s; }
.ar-sw.on { background: var(--accent); }
.ar-sw.on i { transform: translateX(11px); }
:root[data-theme="dark"] .ar-sw i { background: #e8e8e8; }
.ar-report { font-size: 13px; padding: 4px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.ar-report summary { cursor: pointer; padding: 4px 0; }
.ar-report p { margin: 4px 0 6px; line-height: 1.5; }
.ar-report ol, .ar-report ul { margin: 2px 0 6px; padding-left: 20px; line-height: 1.45; }
.ar-sub { font-weight: 600; font-size: 12px; color: var(--muted); margin-top: 6px; }
.ar-verdict { font-weight: 600; }
.ar-c.resolved { opacity: .65; }
.sect-h a { color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

#right { container-type: inline-size; }
#rightTabs { gap: clamp(9px, 2.8cqi, 18px); padding: 0 8px 0 16px; }   /* left edge lines up with the panel's content */      /* room to breathe, but never spread across a wide panel */
#rightTabs button { padding-left: 0; padding-right: 0; gap: 4px; }
#rightTabs button.on::after { left: 0; right: 0; }
#rightTabs .tab-min { position: sticky; right: 0; margin-left: auto; background: var(--panel); }
.pane .card.ar-c { margin: 0; padding: 8px 6px; border: 0; border-left: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; cursor: pointer; }
.pane .card.ar-c:hover { background: var(--row-hover); }
.pane .card.ar-c .who { font-weight: 500; }
.ar-fixall { color: var(--accent); cursor: pointer; font-size: 12.5px; }
#pane-aireview .cg-h .count { background: none; color: var(--muted); padding: 0; }
.sect-h a.ar-fixall { text-decoration: none; color: var(--accent); }

/* Inbox and Referee lists: flat rows, quiet links (no boxes) */
.pane .card.cmt-row { margin: 0; padding: 8px 6px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; box-shadow: none; }
.pane .card.cmt-row:hover { background: var(--row-hover); }
.pane .cmt-row .who { font-weight: 500; }
.ib-head { align-items: baseline; }
.ib-acts { display: flex; gap: 12px; }
.ib-acts a, .sect-h .ib-acts a { color: var(--accent); cursor: pointer; text-decoration: none; }
.ib-hint { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 6px 0; }
#pane-comments .cg-h .count, #pane-aireview .cg-h .count { background: none; color: var(--muted); padding: 0; font-weight: 400; }
.ib-acts a { white-space: nowrap; }
.ib-row2 { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 12.5px; margin: -2px 0 4px; }
.ib-row2 .cmt-who { margin: 0; }
.ar-head { gap: 8px; padding: 4px 2px 10px; }
.ar-sel { appearance: none; -webkit-appearance: none; border: 0; background: transparent; color: var(--ink); font: 500 12.5px var(--font); padding: 0 14px 0 0; cursor: pointer; text-align: right;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 4px center, right 0 center; background-size: 4px 4px; background-repeat: no-repeat; }
.ar-sel:focus { outline: none; }
.ar-listh { margin-top: 10px; }
#visual { position: relative; }

/* ---- Word mode: .docx edited in place (SuperDoc), laid out like Google Docs: toolbar, grey canvas, white pages, comments in the margin */
#word { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative;
  --sd-font-family: var(--font); --sd-ui-text: var(--ink); --sd-ui-text-muted: var(--muted); --sd-ui-bg: var(--paper);
  --sd-ui-hover-bg: var(--btn-hover); --sd-ui-active-bg: var(--accent-soft); --sd-ui-border: var(--line-2); --sd-ui-action: var(--accent);
  --sd-ui-action-hover: var(--accent-hover); --sd-ui-toolbar-bg: var(--paper); --sd-ui-toolbar-padding-x: 10px; --sd-ui-toolbar-height: 34px;
  --sd-ui-menu-bg: var(--paper); --sd-ui-menu-text: var(--ink); --sd-ui-dropdown-bg: var(--paper); --sd-ui-dropdown-text: var(--ink);
  --sd-ui-comments-card-bg: var(--paper); --sd-ui-comments-card-active-bg: var(--paper); --sd-ui-comments-card-radius: 8px;
  --sd-ui-comments-card-shadow: 0 1px 3px var(--shadow); --sd-ui-comments-input-bg: var(--panel); --sd-ui-comments-body-size: 13px;
  --sd-ui-comments-author-size: 13px; --sd-ui-surface-bg: var(--paper); --sd-ui-menu-header-bg: var(--panel);
  --sd-layout-page-bg: #fff; --sd-surface-page: #fff; --sd-layout-page-shadow: 0 1px 3px rgba(60, 64, 67, .15), 0 1px 2px rgba(60, 64, 67, .1);
  --sd-surface-canvas: transparent; }
.word-tb { flex: none; background: var(--paper); border-bottom: 1px solid var(--line); min-height: 38px; }
.word-tb:empty { display: none; }
.word-doc { flex: 1; min-height: 0; overflow: auto; background: var(--word-canvas, #f0f2f5); padding: 20px 0 120px; }   /* no side padding: fit-to-width measures this box */
:root[data-theme="dark"] .word-doc { --word-canvas: var(--g-main); }
#wordEd { min-height: 100%; }
#wordEd .superdoc { margin: 0 auto; }
.word-msg { color: var(--muted); text-align: center; margin: 90px auto 0; max-width: 420px; line-height: 1.5; }
.word-busy { display: inline-flex; align-items: center; gap: 6px; }

/* ---- Assistant chat: long blocks stay inside the message and can be copied */
.as-msg, .as-text { min-width: 0; max-width: 100%; }
.as-text { overflow-wrap: anywhere; }
.cpy-wrap { position: relative; max-width: 100%; margin: 4px 0 6px; }
.cpy-wrap > pre { margin: 0; max-width: 100%; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 8px 30px 8px 10px;
  background: var(--g-main); border-radius: 6px; font: 12px/1.5 var(--mono); }
.cpy-wrap > pre code { background: none; padding: 0; }
.cpy-wrap > blockquote { margin: 0; padding-right: 28px; }
.cpy-wrap > .eq, .cpy-wrap > .katex-display { margin: 0; padding: 4px 28px 4px 0; overflow-x: auto; overflow-y: hidden; max-width: 100%; }
.cpy-wrap > table { display: block; max-width: 100%; overflow-x: auto; }
.cpy { position: absolute; top: 3px; right: 3px; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px;
  background: transparent; color: var(--muted-2); cursor: pointer; opacity: .6; }
.cpy-wrap:hover .cpy, .cpy:focus-visible { opacity: 1; }
.cpy:hover { color: var(--ink); background: var(--btn-hover); }
.cpy.done { color: var(--ok); opacity: 1; }
#word .imported-tag { display: none; }
/* autocomplete: the description column never runs into the list's right edge */
.CodeMirror-hints { max-width: 540px; }
.CodeMirror-hint { box-sizing: border-box; max-width: none; padding: 4px 12px 4px 10px !important; }   /* show-hint sets padding-right inline (0 with overlay scrollbars) */
.CodeMirror-hint .hk { min-width: 0; }
.CodeMirror-hint .hk b { flex: none; white-space: nowrap; }
.CodeMirror-hint .hk span { min-width: 0; overflow: hidden; text-overflow: ellipsis; justify-content: flex-end; }
/* AI activity: a bare spinner, no pill around it (top bar and the Assistant tab) */
.ai-activity { background: none; padding: 0; margin-left: 4px; gap: 3px; }
.count.live, #rightTabs .count.live { background: none; padding: 0; min-width: 0; gap: 3px; color: var(--accent); }
/* one spinner at a time: the Assistant tab shows AI activity while the right panel is open; the Ask AI button only when it's closed */
body:not(.right-min):not(.fs) #aiActivity, body.fs.fs-right #aiActivity { display: none !important; }
.ometer { width: 26px; }
.orow > span:empty:last-child { display: none; }   /* no AI meter: the title gets the whole row */

/* a paragraph the AI suggests deleting: stays, struck through, until you accept (Delete) or keep it */
.bk.pdel .txt { text-decoration: line-through; text-decoration-color: var(--ai-bar); opacity: .6; }
.cm-pdel { text-decoration: line-through; text-decoration-color: var(--ai-bar); opacity: .6; }

/* Setup tab: two quiet groups, plain labels, hints live in the placeholders */
#pane-brief { padding-bottom: 16px; }
#pane-brief .set-h { font: 600 11px/1 var(--font); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 14px 0 2px; }
#pane-brief .set-h:first-child { margin-top: 6px; }
#pane-brief label { display: flex; align-items: baseline; justify-content: space-between; margin: 10px 0 4px; font-weight: 500; }
#pane-brief label .muted { font-weight: 400; font-size: 12px; }
#pane-brief textarea, #pane-brief input, #pane-brief select { width: 100%; box-sizing: border-box; }
#pane-brief textarea { resize: vertical; line-height: 1.45; }
.voice-box { position: relative; }
.voice-box textarea { padding-right: 30px; }
.voice-up { position: absolute; top: 5px; right: 5px; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--muted); cursor: pointer; }
.voice-up:hover { color: var(--ink); background: var(--btn-hover); }
/* Word mode: the page sits in the middle of the canvas; toolbar icons use the app's text colour (readable in dark mode) */
#wordEd .superdoc { justify-content: safe center; }   /* never push an overflowing page off the left edge */
#word { --sd-ui-toolbar-button-text: var(--ink); --sd-ui-toolbar-button-hover-bg: var(--btn-hover); --sd-ui-toolbar-button-active-bg: var(--accent-soft); }
#wordTb, #wordTb .superdoc-toolbar { color: var(--ink); }
#wordTb svg { color: var(--ink); fill: currentColor; }

/* Word mode: SuperDoc renders its menus at <body>, outside #word, so its theme lives on body too.
   Menus match the app's own dropdowns (.menu-items): paper, hairline border, soft shadow, 13px text, no focus ring. */
body {
  --sd-font-family: var(--font); --sd-ui-font-family: var(--font); --sd-ui-text: var(--ink); --sd-ui-text-muted: var(--muted); --sd-ui-bg: var(--paper);
  --sd-ui-hover-bg: var(--btn-hover); --sd-ui-active-bg: var(--accent-soft); --sd-ui-border: var(--line-2); --sd-ui-action: var(--accent); --sd-ui-action-hover: var(--accent-hover);
  --sd-ui-radius: var(--r-md); --sd-ui-dropdown-bg: var(--paper); --sd-ui-dropdown-text: var(--ink); --sd-ui-dropdown-border: var(--line-2);
  --sd-ui-dropdown-shadow: 0 10px 28px var(--shadow); --sd-ui-dropdown-hover-bg: var(--g-main); --sd-ui-dropdown-hover-text: var(--ink);
  --sd-ui-dropdown-active-bg: var(--g-main); --sd-ui-dropdown-selected-text: var(--ink); --sd-ui-dropdown-option-radius: var(--r-sm);
  --sd-ui-menu-bg: var(--paper); --sd-ui-menu-text: var(--ink); --sd-ui-menu-border: var(--line-2); --sd-ui-menu-shadow: 0 10px 28px var(--shadow);
  --sd-ui-menu-item-hover-bg: var(--g-main); --sd-ui-menu-item-active-bg: var(--g-main); --sd-ui-surface-bg: var(--paper); --sd-ui-tooltip-bg: var(--ink); --sd-ui-tooltip-text: var(--on-ink);
  --sd-ui-font-size-200: 12px; --sd-ui-font-size-400: 13px; --sd-ui-font-size-500: 13px;
}
.sd-toolbar-dropdown-menu { font-family: var(--font) !important; padding: 4px !important; min-width: 120px; }
.sd-toolbar-dropdown-menu .toolbar-dropdown-option { min-height: 30px; }
.sd-toolbar-dropdown-menu .toolbar-dropdown-option.sd-render { padding: 0; }
.sd-toolbar-dropdown-menu :focus, .sd-toolbar-dropdown-menu :focus-visible { outline: none; }
.sd-toolbar-dropdown-menu .document-mode { padding: 0; gap: 0; }
.sd-toolbar-dropdown-menu .document-mode .sd-option-item { padding: 7px 10px; gap: 10px; align-items: center; background: transparent; color: var(--ink); border: 0; box-shadow: none; }
.sd-toolbar-dropdown-menu .document-mode .sd-option-item:hover, .sd-toolbar-dropdown-menu .document-mode .sd-option-item:focus { background: var(--g-main); }
.sd-toolbar-dropdown-menu .document-mode .icon-column { margin: 0; padding: 0; width: 16px; height: auto; flex: none; color: var(--muted); }
.sd-toolbar-dropdown-menu .document-mode .icon-column__icon { width: 16px; height: 16px; color: var(--muted); }
.sd-toolbar-dropdown-menu .document-mode-type { font-weight: 500; line-height: 1.3; }
.sd-toolbar-dropdown-menu .document-mode-description { line-height: 1.3; }
/* Word mode: insert-table grid — picked cells in the accent colour so the size reads at a glance */
.toolbar-table-grid-wrapper .toolbar-table-grid { gap: 3px; padding: 8px 8px 6px; }
.toolbar-table-grid-wrapper .toolbar-table-grid__item[class] { width: 18px; height: 18px; border: 1px solid var(--line-3); border-radius: 3px; background: transparent; transition: background-color 80ms, border-color 80ms; }
body .toolbar-table-grid-wrapper .toolbar-table-grid__item.sd-selected[class] { background: color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
.toolbar-table-grid-wrapper .toolbar-table-grid-value { color: var(--muted); font: 500 12px var(--font); padding: 0 8px 4px; }
/* The top bar's Edit with AI covers every file type; the file bar's copy shows only in focus mode, where the top bar is hidden */
body:not(.fs) #centerBar [data-word-edit], body:not(.fs) #centerBar [data-cmact="edit"] { display: none; }

/* Word comments (Google Docs style, right margin). SuperDoc derives these colours at :root, so they're set directly here. */
body {
  --sd-ui-comments-card-bg: var(--paper); --sd-ui-comments-card-hover-bg: var(--paper); --sd-ui-comments-card-active-bg: var(--paper);
  --sd-ui-comments-card-resolved-bg: var(--panel); --sd-ui-comments-card-active-border: var(--line-2); --sd-ui-comments-card-radius: var(--r-lg);
  --sd-ui-comments-card-padding: 12px; --sd-ui-comments-card-shadow: 0 6px 20px var(--shadow); --sd-ui-comments-separator: var(--line);
  --sd-ui-comments-author-text: var(--ink); --sd-ui-comments-author-size: 13px; --sd-ui-comments-timestamp-text: var(--muted-2); --sd-ui-comments-timestamp-size: 11.5px;
  --sd-ui-comments-body-text: var(--ink); --sd-ui-comments-body-size: 13px; --sd-ui-comments-tag-text: var(--muted); --sd-ui-comments-tag-bg: var(--g-main);
  --sd-ui-comments-input-bg: var(--g-main); --sd-ui-comments-input-border: transparent;
  --sd-ui-comments-dropdown-bg: var(--paper); --sd-ui-comments-dropdown-border: var(--line-2); --sd-ui-comments-dropdown-shadow: 0 10px 28px var(--shadow);
  --sd-ui-comments-option-text: var(--ink); --sd-ui-comments-option-hover-bg: var(--g-main); --sd-ui-comments-option-size: 13px;
  --sd-ui-comments-resolved-text: var(--ok); --sd-ui-comments-insert-text: var(--ok); --sd-ui-comments-delete-text: var(--err);
  --sd-ui-action-text: var(--on-accent); --sd-ui-text-disabled: var(--muted-2); --sd-ui-disabled-bg: var(--g-main);
  --sd-ui-tools-item-size: 32px; --sd-ui-tools-item-radius: 50%; --sd-ui-tools-item-bg: var(--paper); --sd-ui-tools-icon-size: 16px;
}
.comments-dialog { font-family: var(--font) !important; line-height: 1.45; }
.comments-dialog:not(.is-active) { border-color: var(--line) !important; }
.comments-dialog .user-name { font-weight: 600; }
.comments-dialog .new-comment-input-wrapper, .comments-dialog .reply-input-wrapper { border: 1px solid transparent; border-radius: var(--r-md); padding: 7px 10px; }
.comments-dialog .new-comment-input-wrapper:focus-within, .comments-dialog .reply-input-wrapper:focus-within { border-color: var(--accent); background: var(--paper); }
.comments-dialog .superdoc-field, .comments-dialog .superdoc-field .ProseMirror { background: transparent !important; color: var(--ink); font: 13px/1.45 var(--font); }
.comments-dialog .sd-editor-placeholder:before { color: var(--muted-2); }
.comments-dialog .reply-actions { gap: 10px; }
.comments-dialog .reply-btn-cancel { font-size: 12.5px; }
.comments-dialog .reply-btn-primary { border-radius: var(--r-sm); padding: 5px 12px; font-size: 12.5px; }
.comments-dialog .reply-btn-primary.sd-is-disabled { background: var(--g-main); color: var(--muted-2); }
/* the floating "add comment" button beside a selection: a small round button, like Google Docs */
#word .tools .tools-item { border: 1px solid var(--line-2); box-shadow: 0 2px 8px var(--shadow); color: var(--muted); transition: color var(--m-in), background var(--m-in); }
#word .tools .tools-item:hover { background: var(--btn-hover); color: var(--ink); }
#word .tools .tools-item svg, #word .tools .tools-item i { width: 16px; height: 16px; color: inherit; fill: currentColor; opacity: 1; }
/* Inbox: a note for the open Word document, whose comments and suggestions live in its own margin */
.ib-word { display: flex; gap: 7px; align-items: flex-start; padding: 8px 2px 10px; color: var(--muted); font-size: 12.5px; line-height: 1.45; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.ib-word svg { flex: none; margin-top: 2px; }
.ib-word b { color: var(--ink); font-weight: 500; }

/* PDF toolbar in a narrow panel: the less-used buttons step aside, most dispensable first.
   Download and Open in a new tab (both also under Export) → review colours and Wider panel → the PDF↔source arrows
   (double-click and the shortcut still work) → − and + (pinch and Fit still zoom). */
.pdf-wrap { container-type: inline-size; container-name: pdfwrap; }
.pdf-tools { max-width: calc(100% - 16px); white-space: nowrap; }
@container pdfwrap (max-width: 415px) { .pdf-tools .t-x2 { display: none; } }
@container pdfwrap (max-width: 357px) { .pdf-tools .t-x1 { display: none; } }
@container pdfwrap (max-width: 299px) { .pdf-tools .t-nav { display: none; } }
@container pdfwrap (max-width: 231px) { .pdf-tools .t-pm { display: none; } }

/* Backup tab */
.bk-box { font-size: 12.5px; line-height: 1.45; padding: 4px 2px; }
.bk-h { display: flex; align-items: center; gap: 7px; font: 600 13.5px var(--font); margin: 2px 0 8px; }
.bk-h svg { color: var(--muted); }
#leftTabs .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--err); vertical-align: 2px; margin-left: 2px; }
.bk-note { color: var(--muted); margin: 4px 0 8px; }
.bk-row { display: flex; align-items: center; gap: 7px; margin-top: 6px; min-width: 0; }
.bk-where { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.bk-where a { color: var(--ink); }
.bk-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.bk-dot.ok { background: var(--ok); } .bk-dot.bad { background: var(--err); } .bk-dot.wait { background: var(--ai); }
.bk-st { color: var(--muted); margin: 2px 0 0 14px; }
.bk-box > .bk-st { margin-left: 0; } .bk-box > .bk-acts { margin-left: 0; } .bk-st.bad { color: var(--err); }
.bk-st .bk-why { color: var(--muted); }
.bk-acts { display: flex; gap: 12px; margin: 6px 0 0 14px; } .bk-acts a { cursor: pointer; color: var(--accent); }
.bk-form { display: grid; gap: 8px; margin-top: 6px; }
.bk-form > label { font-weight: 500; }
.bk-form input[type=password], .bk-form input:not([type]) { width: 100%; box-sizing: border-box; }
.bk-help, .bk-who { color: var(--muted); font-size: 12.5px; margin: 0; }
.bk-who svg { color: var(--ok); vertical-align: -2px; margin-right: 4px; } .bk-who b { color: var(--ink); } .bk-who a { cursor: pointer; margin-left: 6px; }
.bk-choice { display: grid; gap: 5px; padding-top: 4px; }
.bk-choice label { display: flex; gap: 8px; align-items: center; justify-content: flex-start; font-weight: 500; margin: 0; cursor: pointer; }
.bk-choice label input[type=radio] { width: auto; flex: none; margin: 0; }
.bk-choice input:not([type=radio]) { margin-left: 22px; width: calc(100% - 22px); }
.bk-choice input:disabled { opacity: .5; }
.bk-err { color: var(--err); margin: 2px 0 0; font-size: 12.5px; }

/* four tabs on the left (Project, Setup, Search, Backup) fit the default panel width */
#leftTabs { padding: 0 0 0 4px; container-type: inline-size; }
#leftTabs button { padding-left: clamp(3px, 1.8cqi, 5px); padding-right: clamp(3px, 1.8cqi, 5px); }
@container (max-width: 250px) { #leftTabs button:not(.tab-min) { font-size: 12.5px; } }
/* a narrow panel scrolls the tabs under the hide button: fade them out before it instead of cutting a letter in half */
#leftTabs .tab-min { margin-right: 0; box-shadow: -16px 0 10px -4px var(--panel); }
#leftTabs button.on::after { left: 4px; right: 4px; }

/* ---------------------------------------------------------------- cropped images (figure editor and the visual view) */
.crop { display: inline-block; position: relative; overflow: hidden; vertical-align: top; max-width: 100%; }
.crop > img { position: absolute; max-width: none !important; max-height: none !important; height: auto;
  width: calc(100% / (1 - var(--l) - var(--r))); left: calc(-100% * var(--l) / (1 - var(--l) - var(--r))); top: calc(-100% * var(--t) / (1 - var(--t) - var(--b))); }
.txt figure .crop { width: 60%; }
.txt figure .subfigs { display: flex; flex-wrap: wrap; justify-content: center; column-gap: 2%; row-gap: 12px; align-items: flex-start; }
.txt figure .subfig { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.txt figure .subfig > img, .txt figure .subfig > .crop { width: 100%; max-height: none; }
.txt figure .subcap { font-size: 13px; line-height: 1.35; text-align: center; }

/* the one filled button in the top bar: a touch smaller than its neighbours' 30px, so it doesn't look oversized */
#btnCompile { height: 28px; padding: 0 11px; gap: 6px; }
#btnCompile svg { width: 14px; height: 14px; }
#btnCompile.compiling { pointer-events: none; opacity: .85; }
/* narrower windows: the top bar sheds its shortcut hints, then the labels of Ask AI and Export (their icons and
   tooltips stay), so Compile never slides off the right edge */
@media (max-width: 1120px) { .top-actions kbd { display: none; } .proj-title { max-width: 200px; } }
@media (max-width: 1000px) {
  #btnAsk, #btnZip { font-size: 0; gap: 0; padding: 0 8px; }
  #btnAsk .ai-activity { font-size: 12px; }
  .proj-title { max-width: 140px; }
}
@media (max-width: 760px) { .crumb-sep, .proj-title { display: none; } #btnCompile { font-size: 0; gap: 0; padding: 0 8px; } }
/* "Saved" (and "AI working…") sit beside small buttons in the file bar: give it the same box and line height as a .btn.sm so its text lines up with theirs in any font */
#saveState, .center-bar .word-busy { display: inline-flex; align-items: center; height: 26px; white-space: nowrap; line-height: 13px; border: 1px solid transparent; box-sizing: border-box; }
#btnCompile .spinner { width: 12px; height: 12px; border-color: currentColor; border-right-color: transparent; }

/* ---------------------------------------------------------------- before / after side by side (AI edits) */
.sbs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.sbs-col { min-width: 0; }
.sbs .sbs-b, .sbs .sbs-b p { text-align: left; hyphens: manual; }   /* narrow columns: justified text leaves holes */
.sbs-h { font: 600 11px/1.2 var(--font); color: var(--muted-2); letter-spacing: .02em; margin-bottom: 4px; }
.sbs-col.after .sbs-h { color: var(--ai); }
.sbs-col.before .sbs-b { color: var(--muted); }
.sbs del, .sbs ins { text-decoration: none; color: inherit; border-radius: 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.sbs del { background: color-mix(in srgb, var(--err) 16%, transparent); }
.sbs ins { background: color-mix(in srgb, var(--ok) 20%, transparent); }
.sbs.src .sbs-b { font: 12px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; }
.txt .sbs > .sbs-col > .sbs-b > p:first-child { margin-top: 0; }
.as-cmp { container-type: inline-size; }
@container (max-width: 460px) { .sbs { grid-template-columns: minmax(0, 1fr); gap: 10px; } }
.rv-sbs { max-height: 34vh; overflow-y: auto; padding: 4px 2px; }
/* a long note or diff must not bury the paragraph under review: the note scrolls after ~3 lines, the card after 60% of the pane */
.rv-note { max-height: 4.5em; overflow-y: auto; }
.reviewbar { max-height: 60%; overflow-y: auto; }
/* room to scroll the paragraph under review above the card, even near the end of a short file */
body.reviewing #code .CodeMirror-lines { padding-bottom: 60vh; }
/* "propose only": the AI's version waits beside your text */
.pv-mark.proposal { background: repeating-linear-gradient(to bottom, var(--ai-bar) 0 4px, transparent 4px 7px); }
.bk.has-prop .sbar { background: repeating-linear-gradient(to bottom, var(--ai-bar) 0 5px, transparent 5px 9px); }
.cm-proptag { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; padding: 0 7px; height: 1.45em; vertical-align: 1px; border: 1px dashed var(--ai-bar);
  border-radius: var(--r-pill); background: var(--ai-bg); color: var(--ai); font: 500 calc(var(--code-size) * .85)/1 var(--font); cursor: pointer; }
.cm-proptag:hover { border-style: solid; }
.prop-ins { margin-top: 10px; padding: 6px 10px; border-left: 2px dashed var(--ai-bar); background: var(--ai-bg); border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.prop-ins.src pre { margin: 0; font: 12px/1.55 var(--mono); white-space: pre-wrap; }
.prop-stale { margin-top: 6px; font: 12px/1.4 var(--font); color: var(--warn, var(--ai)); display: flex; gap: 5px; align-items: center; }
.tb.on { color: var(--accent); }

/* ---------------------------------------------------------------- figure editor */
.cm-figtag { position: absolute; z-index: 4; display: inline-flex; align-items: center; gap: .4em; height: 1.6em; padding: 0 .65em; border: 1px solid var(--line-2); border-radius: var(--r-pill);
  background: var(--paper); color: var(--muted); font: 500 var(--code-size)/1 var(--font); cursor: pointer; white-space: nowrap; box-shadow: 0 1px 2px var(--shadow); }
.cm-figtag svg { width: 1.05em; height: 1.05em; flex: none; }
.cm-figtag:hover { color: var(--accent); border-color: var(--accent); }
.CodeMirror-hint.hint-fig b { display: inline-flex; align-items: center; gap: 6px; }
.modal-card.fx-modal { width: min(1120px, 96vw); }
.fx { display: flex; flex-direction: column; width: 100%; min-height: 0; }
.fx-head { display: flex; align-items: baseline; gap: 12px; padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.fx-head h2 { margin: 0; font: 600 16px/1.2 var(--font); }
.fx-hint { color: var(--muted-2); font-size: 12px; }
.fx-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.fx-stage { position: relative; overflow: auto; background: var(--g-main); padding: 28px; display: flex; justify-content: center; align-items: flex-start; }
.fx-stage.drop { outline: 2px dashed var(--accent); outline-offset: -10px; }
.fx-page { width: min(100%, 600px); background: #fff; color: #1b1b1b; border-radius: var(--r-sm); box-shadow: 0 1px 3px rgba(0, 0, 0, .14); padding: 28px 32px 24px; font-family: var(--serif); }
.fx-fig { display: flex; flex-direction: column; gap: 12px; }
.fx-row { display: flex; justify-content: center; align-items: flex-start; }
.fx-panel { position: relative; display: flex; flex-direction: column; gap: 4px; border-radius: 3px; cursor: pointer; outline: 1.5px solid transparent; outline-offset: 3px; min-width: 0; }
.fx-panel:hover { outline-color: rgba(0, 0, 0, .14); }
.fx-panel.on { outline-color: var(--accent); }
.fx-panel.drop { outline: 2px dashed var(--accent); }
.fx-panel.dragging { opacity: .4; }
.fx-img { position: relative; line-height: 0; }
.fx-img .crop { display: block; width: 100%; }
.fx-empty, .fx-noprev, .fx-load { width: 100%; aspect-ratio: 4 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 8px;
  border: 1.5px dashed #c5c8ce; border-radius: 4px; background: #f6f7f9; color: #555b65; font: 500 12.5px/1.3 var(--font); text-align: center; cursor: pointer; }
.fx-empty small, .fx-noprev small { color: #8a9099; font-weight: 400; font-size: 11.5px; }
.fx-noprev span { word-break: break-all; }
.fx-empty:hover { border-color: var(--accent); color: var(--accent); }
.fx-panel.missing .fx-noprev { border-color: var(--err); }
.fx-tools { position: absolute; top: 6px; right: 6px; display: none; gap: 1px; background: rgba(24, 24, 24, .78); border-radius: 6px; padding: 2px; line-height: 0; }
.fx-panel:hover .fx-tools, .fx-panel.on .fx-tools { display: flex; }
.fx-tools button { width: 24px; height: 24px; display: grid; place-items: center; border: 0; background: none; color: #fff; border-radius: 4px; cursor: pointer; }
.fx-tools button:hover { background: rgba(255, 255, 255, .18); }
.fx-sub { display: flex; gap: 4px; align-items: baseline; justify-content: center; font-size: 13px; line-height: 1.35; cursor: text; }
.fx-sub span { flex: none; }
.fx-sub input, .fx-cap textarea { flex: 1; min-width: 0; border: 0; border-bottom: 1px dashed transparent; background: none; font: inherit; color: inherit; padding: 1px 0; outline: none; }
.fx-sub input:hover, .fx-cap textarea:hover { border-bottom-color: #c5c8ce; }
.fx-sub input:focus, .fx-cap textarea:focus { border-bottom-color: var(--accent); }
.fx-sub input::placeholder, .fx-cap textarea::placeholder { color: #9aa0a8; }
.fx label { margin: 0; font-weight: inherit; }
.fx input[type=checkbox], .fx input[type=range] { width: auto; padding: 0; border: 0; box-shadow: none; background: none; }
.fx-sub input, .fx-cap textarea { border-radius: 0; box-shadow: none !important; }
.fx-sub input { flex: 0 1 auto; field-sizing: content; min-width: 7ch; max-width: 100%; }
.fx-cap { display: flex; gap: 6px; align-items: baseline; font-size: 14px; line-height: 1.4; margin-top: 4px; cursor: text; }
.fx-cap span { font-weight: 700; flex: none; }
.fx-cap textarea { resize: none; overflow: hidden; }
.fx-side { border-left: 1px solid var(--line); overflow-y: auto; padding: 0 16px 16px; background: var(--paper); }
.fx-side section { padding: 14px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 9px; }
.fx-side h4 { margin: 0; font: 600 12px/1.2 var(--font); color: var(--muted); }
.fx-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fx-pre { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 4px 6px; border: 1px solid var(--line); border-radius: var(--r-sm); background: none; color: var(--muted); font: 500 11px/1.2 var(--font); cursor: pointer; }
.fx-pre svg { fill: currentColor; opacity: .5; }
.fx-pre:hover { border-color: var(--line-3); color: var(--ink); }
.fx-pre:hover svg { opacity: .8; }
.fx-line { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.fx-line > span:first-child { width: 66px; color: var(--muted); flex: none; }
.fx-line input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
.fx-val { width: 36px; text-align: right; font-weight: 500; }
.fx-step { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: var(--r-sm); }
.fx-step button { width: 26px; height: 24px; border: 0; background: none; color: var(--ink); cursor: pointer; font-size: 14px; }
.fx-step button:hover:not(:disabled) { background: var(--hover); }
.fx-step button:disabled { opacity: .35; cursor: default; }
.fx-step b { min-width: 22px; text-align: center; font-weight: 500; }
.fx-check { display: flex; gap: 8px; align-items: center; font-size: 12.5px; cursor: pointer; }
.fx-check input { accent-color: var(--accent); margin: 0; }
.fx-add { align-self: flex-start; }
.fx-file { display: flex; align-items: center; gap: 6px; font: 12px var(--mono); color: var(--ink); min-width: 0; }
.fx-file img, .fx-file svg { width: 14px; height: 14px; flex: none; }
.fx-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.fx-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.fx-field input, .fx-side select { font: 12.5px var(--mono); padding: 5px 8px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--paper); color: var(--ink); }
.fx-field input:focus, .fx-side select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.fx-side select { font-family: var(--font); width: 100%; }
.fx-chips { display: flex; gap: 4px; }
.fx-chip { min-width: 26px; height: 24px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: none; color: var(--muted); font: 500 12px var(--mono); cursor: pointer; }
.fx-chip:hover { color: var(--ink); border-color: var(--line-3); }
.fx-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.fx-note, .fx-warn { margin: 0; font-size: 12px; line-height: 1.45; color: var(--muted); }
.fx-warn { color: var(--err); }
.fx-note code, .fx-warn code { font: 11.5px var(--mono); }
.fx-code { padding: 14px 0 0; }
.fx-code summary { cursor: pointer; font: 600 12px var(--font); color: var(--muted); }
.fx-code pre { margin: 8px 0; padding: 10px; background: var(--g-main); border-radius: var(--r-sm); font: 11px/1.5 var(--mono); white-space: pre; overflow-x: auto; max-height: 260px; color: var(--ink); }
.fx-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.fx-where-row { display: flex; align-items: center; gap: 14px; margin-right: auto; min-width: 0; }
.fx-where { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.fx-where select { width: auto; max-width: 340px; font: 12.5px var(--font); padding: 5px 8px; }
.fx-over { position: absolute; inset: 0; background: var(--paper); display: flex; flex-direction: column; z-index: 2; }
.fx-over-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.fx-over-head b { font: 600 13px var(--font); }
.fx-over-head .fx-hint, .fx-over-head input[type=search] { margin-right: auto; }
.fx-over-head input[type=search] { width: 200px; font: 12.5px var(--font); padding: 5px 8px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--paper); color: var(--ink); margin-left: 8px; }
.fx-grid { flex: 1; overflow-y: auto; padding: 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; align-content: start; }
.fx-thumb { display: flex; flex-direction: column; gap: 3px; padding: 6px; border: 1px solid var(--line); border-radius: var(--r-md); background: none; cursor: pointer; text-align: left; color: var(--ink); font: 12px var(--font); min-width: 0; }
.fx-thumb:hover { border-color: var(--accent); }
.fx-th { aspect-ratio: 4 / 3; background: #fff; border-radius: 4px; display: grid; place-items: center; overflow: hidden; color: #666; font: 600 11px var(--mono); margin-bottom: 3px; }
.fx-th img { max-width: 100%; max-height: 100%; object-fit: contain; }
.fx-thumb .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.fx-thumb small { color: var(--muted-2); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 1.2em; }
.fx-none { margin: auto; color: var(--muted); font-size: 13px; }
.fx-cropwrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--g-main); }
.fx-cropimg { position: relative; line-height: 0; clip-path: inset(-7px); }
.fx-cropimg img { display: block; max-width: 100%; max-height: calc(88vh - 230px); background: #fff; user-select: none; }
.fx-cropbox { position: absolute; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55); outline: 1.5px solid #fff; cursor: move; touch-action: none; }
.fx-cropbox .h { position: absolute; width: 12px; height: 12px; background: #fff; border: 1px solid rgba(0, 0, 0, .45); border-radius: 2px; }
.fx-cropbox .n { top: -6px; left: calc(50% - 6px); cursor: ns-resize; } .fx-cropbox .s { bottom: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.fx-cropbox .e { right: -6px; top: calc(50% - 6px); cursor: ew-resize; } .fx-cropbox .w { left: -6px; top: calc(50% - 6px); cursor: ew-resize; }
.fx-cropbox .ne { top: -6px; right: -6px; cursor: nesw-resize; } .fx-cropbox .nw { top: -6px; left: -6px; cursor: nwse-resize; }
.fx-cropbox .se { bottom: -6px; right: -6px; cursor: nwse-resize; } .fx-cropbox .sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
@media (max-width: 860px) { .fx-body { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 40%; } .fx-side { border-left: 0; border-top: 1px solid var(--line); } }

/* ==== editor-theme palettes: generated by tools/palettes.py, edit there ==== */
:root[data-theme="dark"][data-dark="claude"] { --g-main: #191919; --g-surface: #303030; --canvas: #1f1f1f; --card: #191919; --panel: #1f1f1f; --paper: #1d1d1d; --ink: #ececec; --muted: #a3a3a3; --muted-2: #7c7c7c; --line: rgba(236, 236, 236, 0.1); --line-2: rgba(236, 236, 236, 0.17); --cm-sel: rgba(236, 236, 236, .14); --cm-active: rgba(236, 236, 236, 0.04); --ai-line-bg: rgba(229, 181, 103, 0.06); --err-soft: rgba(240, 138, 122, 0.12); --syn-cmd: #e39a7a; --syn-comment: #7c7c7c; --syn-num: #79a9eb; --syn-string: #a8cf9a; --syn-builtin: #e5b567; --syn-key: #e5b567; --syn-ref: #b49cdb; --syn-file: #7cc4b4; --syn-env: #79a9eb; --syn-math: #a8cf9a; --syn-bracket: #a3a3a3; --syn-math-bg: rgba(168, 207, 154, 0.06); --line-3: rgba(236, 236, 236, 0.3); --on-ink: #191919; --ink-hover: #cdcdcd; --btn-hover: #2b2b2b; --row-hover: #1f1f1f; --pdf-bg: #111111; --hu: #b9b9b9; --hu-bar: #565656; --hu-soft: rgba(124, 124, 124, 0.16); --ai: #e5b567; --ai-bar: #9f804d; --ai-bg: rgba(229, 181, 103, 0.07); --ai-soft: rgba(229, 181, 103, 0.18); --ok: #9fcf8f; --ok-bar: #6b8861; --ok-soft: rgba(159, 207, 143, 0.16); --err: #f08a7a; --err-line: rgba(240, 138, 122, 0.35); --ins-bg: rgba(159, 207, 143, 0.22); --ins-ink: #bad9b0; --del-bg: rgba(240, 138, 122, 0.18); --del-ink: #efaca2; --warn-bg: rgba(229, 181, 103, 0.1); --warn-line: rgba(229, 181, 103, 0.35); }
:root[data-code-theme="dark"][data-dark="claude"] .CodeMirror, :root[data-code-theme="dark"][data-dark="claude"] .CodeMirror-hints { --panel: #1f1f1f; --paper: #1d1d1d; --ink: #ececec; --muted: #a3a3a3; --muted-2: #7c7c7c; --line: rgba(236, 236, 236, 0.1); --line-2: rgba(236, 236, 236, 0.17); --cm-sel: rgba(236, 236, 236, .14); --cm-active: rgba(236, 236, 236, 0.04); --ai-line-bg: rgba(229, 181, 103, 0.06); --err-soft: rgba(240, 138, 122, 0.12); --syn-cmd: #e39a7a; --syn-comment: #7c7c7c; --syn-num: #79a9eb; --syn-string: #a8cf9a; --syn-builtin: #e5b567; --syn-key: #e5b567; --syn-ref: #b49cdb; --syn-file: #7cc4b4; --syn-env: #79a9eb; --syn-math: #a8cf9a; --syn-bracket: #a3a3a3; --syn-math-bg: rgba(168, 207, 154, 0.06); color-scheme: dark; }
:root[data-theme="dark"][data-dark="claude"][data-accent="auto"] { --accent: #d97757; --accent-hover: #df8b70; --on-accent: #191919; }
:root[data-theme="dark"][data-dark="monokai"] { --g-main: #221f22; --g-surface: #403e41; --canvas: #19181a; --card: #221f22; --panel: #19181a; --paper: #2d2a2e; --ink: #f0efea; --muted: #c1c0c0; --muted-2: #939293; --line: rgba(240, 239, 234, 0.1); --line-2: rgba(240, 239, 234, 0.17); --cm-sel: rgba(193, 192, 192, .22); --cm-active: rgba(240, 239, 234, 0.04); --ai-line-bg: rgba(252, 152, 103, 0.06); --err-soft: rgba(255, 97, 136, 0.12); --syn-cmd: #ff6188; --syn-comment: #797779; --syn-num: #ab9df2; --syn-string: #ffd866; --syn-builtin: #fc9867; --syn-key: #fc9867; --syn-ref: #ab9df2; --syn-file: #a9dc76; --syn-env: #78dce8; --syn-math: #a9dc76; --syn-bracket: #c1c0c0; --syn-math-bg: rgba(169, 220, 118, 0.06); --line-3: rgba(240, 239, 234, 0.3); --on-ink: #221f22; --ink-hover: #d3d1ce; --btn-hover: #3b383b; --row-hover: #282528; --pdf-bg: #0e0d0e; --hu: #cfcecd; --hu-bar: #6a686b; --hu-soft: rgba(147, 146, 147, 0.16); --ai: #fc9867; --ai-bar: #b47253; --ai-bg: rgba(252, 152, 103, 0.07); --ai-soft: rgba(252, 152, 103, 0.18); --ok: #a9dc76; --ok-bar: #779559; --ok-soft: rgba(169, 220, 118, 0.16); --err: #ff6188; --err-line: rgba(255, 97, 136, 0.35); --ins-bg: rgba(169, 220, 118, 0.22); --ins-ink: #c2e39f; --del-bg: rgba(255, 97, 136, 0.18); --del-ink: #fa93aa; --warn-bg: rgba(252, 152, 103, 0.1); --warn-line: rgba(252, 152, 103, 0.35); }
:root[data-code-theme="dark"][data-dark="monokai"] .CodeMirror, :root[data-code-theme="dark"][data-dark="monokai"] .CodeMirror-hints { --panel: #19181a; --paper: #2d2a2e; --ink: #f0efea; --muted: #c1c0c0; --muted-2: #939293; --line: rgba(240, 239, 234, 0.1); --line-2: rgba(240, 239, 234, 0.17); --cm-sel: rgba(193, 192, 192, .22); --cm-active: rgba(240, 239, 234, 0.04); --ai-line-bg: rgba(252, 152, 103, 0.06); --err-soft: rgba(255, 97, 136, 0.12); --syn-cmd: #ff6188; --syn-comment: #797779; --syn-num: #ab9df2; --syn-string: #ffd866; --syn-builtin: #fc9867; --syn-key: #fc9867; --syn-ref: #ab9df2; --syn-file: #a9dc76; --syn-env: #78dce8; --syn-math: #a9dc76; --syn-bracket: #c1c0c0; --syn-math-bg: rgba(169, 220, 118, 0.06); color-scheme: dark; }
:root[data-theme="dark"][data-dark="monokai"][data-accent="auto"] { --accent: #ffd866; --accent-hover: #ffde7d; --on-accent: #2d2a2e; }
:root[data-theme="dark"][data-dark="dracula"] { --g-main: #21222c; --g-surface: #44475a; --canvas: #191a21; --card: #21222c; --panel: #191a21; --paper: #282a36; --ink: #eeeee8; --muted: #b9bcd0; --muted-2: #8a8fac; --line: rgba(238, 238, 232, 0.1); --line-2: rgba(238, 238, 232, 0.17); --cm-sel: #44475a; --cm-active: rgba(238, 238, 232, 0.04); --ai-line-bg: rgba(255, 184, 108, 0.06); --err-soft: rgba(255, 85, 85, 0.12); --syn-cmd: #ff79c6; --syn-comment: #6d7db3; --syn-num: #bd93f9; --syn-string: #f1fa8c; --syn-builtin: #ffb86c; --syn-key: #ffb86c; --syn-ref: #bd93f9; --syn-file: #50fa7b; --syn-env: #8be9fd; --syn-math: #8be9fd; --syn-bracket: #b9bcd0; --syn-math-bg: rgba(139, 233, 253, 0.06); --line-3: rgba(238, 238, 232, 0.3); --on-ink: #21222c; --ink-hover: #d0d1cd; --btn-hover: #363842; --row-hover: #272832; --pdf-bg: #0e0e12; --hu: #c9cbd7; --hu-bar: #63677d; --hu-soft: rgba(138, 143, 172, 0.16); --ai: #ffb86c; --ai-bar: #b48659; --ai-bg: rgba(255, 184, 108, 0.07); --ai-soft: rgba(255, 184, 108, 0.18); --ok: #50fa7b; --ok-bar: #40a75f; --ok-soft: rgba(80, 250, 123, 0.16); --err: #ff5555; --err-line: rgba(255, 85, 85, 0.35); --ins-bg: rgba(80, 250, 123, 0.22); --ins-ink: #87f6a1; --del-bg: rgba(255, 85, 85, 0.18); --del-ink: #f98b88; --warn-bg: rgba(255, 184, 108, 0.1); --warn-line: rgba(255, 184, 108, 0.35); }
:root[data-code-theme="dark"][data-dark="dracula"] .CodeMirror, :root[data-code-theme="dark"][data-dark="dracula"] .CodeMirror-hints { --panel: #191a21; --paper: #282a36; --ink: #eeeee8; --muted: #b9bcd0; --muted-2: #8a8fac; --line: rgba(238, 238, 232, 0.1); --line-2: rgba(238, 238, 232, 0.17); --cm-sel: #44475a; --cm-active: rgba(238, 238, 232, 0.04); --ai-line-bg: rgba(255, 184, 108, 0.06); --err-soft: rgba(255, 85, 85, 0.12); --syn-cmd: #ff79c6; --syn-comment: #6d7db3; --syn-num: #bd93f9; --syn-string: #f1fa8c; --syn-builtin: #ffb86c; --syn-key: #ffb86c; --syn-ref: #bd93f9; --syn-file: #50fa7b; --syn-env: #8be9fd; --syn-math: #8be9fd; --syn-bracket: #b9bcd0; --syn-math-bg: rgba(139, 233, 253, 0.06); color-scheme: dark; }
:root[data-theme="dark"][data-dark="dracula"][data-accent="auto"] { --accent: #bd93f9; --accent-hover: #c7a3fa; --on-accent: #21222c; }
:root[data-theme="dark"][data-dark="nord"] { --g-main: #2e3440; --g-surface: #434c5e; --canvas: #242933; --card: #2e3440; --panel: #242933; --paper: #333a47; --ink: #e5e9f0; --muted: #bcc4d2; --muted-2: #8a94a7; --line: rgba(229, 233, 240, 0.1); --line-2: rgba(229, 233, 240, 0.17); --cm-sel: #434c5e; --cm-active: rgba(229, 233, 240, 0.04); --ai-line-bg: rgba(235, 203, 139, 0.06); --err-soft: rgba(191, 97, 106, 0.12); --syn-cmd: #81a1c1; --syn-comment: #7b88a1; --syn-num: #b48ead; --syn-string: #a3be8c; --syn-builtin: #d08770; --syn-key: #ebcb8b; --syn-ref: #b48ead; --syn-file: #8fbcbb; --syn-env: #88c0d0; --syn-math: #a3be8c; --syn-bracket: #bcc4d2; --syn-math-bg: rgba(163, 190, 140, 0.06); --line-3: rgba(229, 233, 240, 0.3); --on-ink: #2e3440; --ink-hover: #cacfd7; --btn-hover: #3f4653; --row-hover: #333945; --pdf-bg: #14171c; --hu: #c8cfdb; --hu-bar: #677081; --hu-soft: rgba(138, 148, 167, 0.16); --ai: #ebcb8b; --ai-bar: #ab9873; --ai-bg: rgba(235, 203, 139, 0.07); --ai-soft: rgba(235, 203, 139, 0.18); --ok: #a3be8c; --ok-bar: #768970; --ok-soft: rgba(163, 190, 140, 0.16); --err: #bf616a; --err-line: rgba(191, 97, 106, 0.35); --ins-bg: rgba(163, 190, 140, 0.22); --ins-ink: #bacdaf; --del-bg: rgba(191, 97, 106, 0.18); --del-ink: #cc9199; --warn-bg: rgba(235, 203, 139, 0.1); --warn-line: rgba(235, 203, 139, 0.35); }
:root[data-code-theme="dark"][data-dark="nord"] .CodeMirror, :root[data-code-theme="dark"][data-dark="nord"] .CodeMirror-hints { --panel: #242933; --paper: #333a47; --ink: #e5e9f0; --muted: #bcc4d2; --muted-2: #8a94a7; --line: rgba(229, 233, 240, 0.1); --line-2: rgba(229, 233, 240, 0.17); --cm-sel: #434c5e; --cm-active: rgba(229, 233, 240, 0.04); --ai-line-bg: rgba(235, 203, 139, 0.06); --err-soft: rgba(191, 97, 106, 0.12); --syn-cmd: #81a1c1; --syn-comment: #7b88a1; --syn-num: #b48ead; --syn-string: #a3be8c; --syn-builtin: #d08770; --syn-key: #ebcb8b; --syn-ref: #b48ead; --syn-file: #8fbcbb; --syn-env: #88c0d0; --syn-math: #a3be8c; --syn-bracket: #bcc4d2; --syn-math-bg: rgba(163, 190, 140, 0.06); color-scheme: dark; }
:root[data-theme="dark"][data-dark="nord"][data-accent="auto"] { --accent: #88c0d0; --accent-hover: #9ac9d7; --on-accent: #2e3440; }
:root[data-theme="dark"][data-dark="tokyo"] { --g-main: #1a1b26; --g-surface: #292e42; --canvas: #13131a; --card: #1a1b26; --panel: #13131a; --paper: #1f2030; --ink: #cdd5f6; --muted: #a9b1d6; --muted-2: #7880a8; --line: rgba(205, 213, 246, 0.1); --line-2: rgba(205, 213, 246, 0.17); --cm-sel: #2e3c64; --cm-active: rgba(205, 213, 246, 0.04); --ai-line-bg: rgba(224, 175, 104, 0.06); --err-soft: rgba(247, 118, 142, 0.12); --syn-cmd: #bb9af7; --syn-comment: #6a73a0; --syn-num: #ff9e64; --syn-string: #9ece6a; --syn-builtin: #e0af68; --syn-key: #e0af68; --syn-ref: #2ac3de; --syn-file: #73daca; --syn-env: #7dcfff; --syn-math: #9ece6a; --syn-bracket: #a9b1d6; --syn-math-bg: rgba(158, 206, 106, 0.06); --line-3: rgba(205, 213, 246, 0.3); --on-ink: #1a1b26; --ink-hover: #b3bad8; --btn-hover: #2b2d3e; --row-hover: #1f212c; --pdf-bg: #0a0a0e; --hu: #b4bce0; --hu-bar: #545a78; --hu-soft: rgba(120, 128, 168, 0.16); --ai: #e0af68; --ai-bar: #9c7d54; --ai-bg: rgba(224, 175, 104, 0.07); --ai-soft: rgba(224, 175, 104, 0.18); --ok: #9ece6a; --ok-bar: #6b8853; --ok-soft: rgba(158, 206, 106, 0.16); --err: #f7768e; --err-line: rgba(247, 118, 142, 0.35); --ins-bg: rgba(158, 206, 106, 0.22); --ins-ink: #aed09b; --del-bg: rgba(247, 118, 142, 0.18); --del-ink: #e897b2; --warn-bg: rgba(224, 175, 104, 0.1); --warn-line: rgba(224, 175, 104, 0.35); }
:root[data-code-theme="dark"][data-dark="tokyo"] .CodeMirror, :root[data-code-theme="dark"][data-dark="tokyo"] .CodeMirror-hints { --panel: #13131a; --paper: #1f2030; --ink: #cdd5f6; --muted: #a9b1d6; --muted-2: #7880a8; --line: rgba(205, 213, 246, 0.1); --line-2: rgba(205, 213, 246, 0.17); --cm-sel: #2e3c64; --cm-active: rgba(205, 213, 246, 0.04); --ai-line-bg: rgba(224, 175, 104, 0.06); --err-soft: rgba(247, 118, 142, 0.12); --syn-cmd: #bb9af7; --syn-comment: #6a73a0; --syn-num: #ff9e64; --syn-string: #9ece6a; --syn-builtin: #e0af68; --syn-key: #e0af68; --syn-ref: #2ac3de; --syn-file: #73daca; --syn-env: #7dcfff; --syn-math: #9ece6a; --syn-bracket: #a9b1d6; --syn-math-bg: rgba(158, 206, 106, 0.06); color-scheme: dark; }
:root[data-theme="dark"][data-dark="tokyo"][data-accent="auto"] { --accent: #7aa2f7; --accent-hover: #8eb0f8; --on-accent: #1a1b26; }
:root[data-theme="dark"][data-dark="mocha"] { --g-main: #181825; --g-surface: #313244; --canvas: #11111b; --card: #181825; --panel: #11111b; --paper: #1e1e2e; --ink: #cdd6f4; --muted: #bac2de; --muted-2: #9399b2; --line: rgba(205, 214, 244, 0.1); --line-2: rgba(205, 214, 244, 0.17); --cm-sel: rgba(147, 153, 178, .28); --cm-active: rgba(205, 214, 244, 0.04); --ai-line-bg: rgba(249, 226, 175, 0.06); --err-soft: rgba(243, 139, 168, 0.12); --syn-cmd: #cba6f7; --syn-comment: #7f849c; --syn-num: #fab387; --syn-string: #a6e3a1; --syn-builtin: #f9e2af; --syn-key: #fab387; --syn-ref: #f5c2e7; --syn-file: #94e2d5; --syn-env: #89b4fa; --syn-math: #74c7ec; --syn-bracket: #bac2de; --syn-math-bg: rgba(116, 199, 236, 0.06); --line-3: rgba(205, 214, 244, 0.3); --on-ink: #181825; --ink-hover: #b3bad6; --btn-hover: #2a2b3c; --row-hover: #1d1e2b; --pdf-bg: #09090f; --hu: #c0c8e5; --hu-bar: #64687d; --hu-soft: rgba(147, 153, 178, 0.16); --ai: #f9e2af; --ai-bar: #ac9d82; --ai-bg: rgba(249, 226, 175, 0.07); --ai-soft: rgba(249, 226, 175, 0.18); --ok: #a6e3a1; --ok-bar: #709473; --ok-soft: rgba(166, 227, 161, 0.16); --err: #f38ba8; --err-line: rgba(243, 139, 168, 0.35); --ins-bg: rgba(166, 227, 161, 0.22); --ins-ink: #b4debe; --del-bg: rgba(243, 139, 168, 0.18); --del-ink: #e6a5c3; --warn-bg: rgba(249, 226, 175, 0.1); --warn-line: rgba(249, 226, 175, 0.35); }
:root[data-code-theme="dark"][data-dark="mocha"] .CodeMirror, :root[data-code-theme="dark"][data-dark="mocha"] .CodeMirror-hints { --panel: #11111b; --paper: #1e1e2e; --ink: #cdd6f4; --muted: #bac2de; --muted-2: #9399b2; --line: rgba(205, 214, 244, 0.1); --line-2: rgba(205, 214, 244, 0.17); --cm-sel: rgba(147, 153, 178, .28); --cm-active: rgba(205, 214, 244, 0.04); --ai-line-bg: rgba(249, 226, 175, 0.06); --err-soft: rgba(243, 139, 168, 0.12); --syn-cmd: #cba6f7; --syn-comment: #7f849c; --syn-num: #fab387; --syn-string: #a6e3a1; --syn-builtin: #f9e2af; --syn-key: #fab387; --syn-ref: #f5c2e7; --syn-file: #94e2d5; --syn-env: #89b4fa; --syn-math: #74c7ec; --syn-bracket: #bac2de; --syn-math-bg: rgba(116, 199, 236, 0.06); color-scheme: dark; }
:root[data-theme="dark"][data-dark="mocha"][data-accent="auto"] { --accent: #cba6f7; --accent-hover: #d3b3f8; --on-accent: #1e1e2e; }
:root[data-theme="dark"][data-dark="gruvbox"] { --g-main: #282828; --g-surface: #504945; --canvas: #1d2021; --card: #282828; --panel: #1d2021; --paper: #32302f; --ink: #ebdbb2; --muted: #d5c4a1; --muted-2: #a89984; --line: rgba(235, 219, 178, 0.1); --line-2: rgba(235, 219, 178, 0.17); --cm-sel: rgba(146, 131, 116, .35); --cm-active: rgba(235, 219, 178, 0.04); --ai-line-bg: rgba(254, 128, 25, 0.06); --err-soft: rgba(251, 73, 52, 0.12); --syn-cmd: #fb4934; --syn-comment: #928374; --syn-num: #d3869b; --syn-string: #b8bb26; --syn-builtin: #fe8019; --syn-key: #fabd2f; --syn-ref: #d3869b; --syn-file: #8ec07c; --syn-env: #83a598; --syn-math: #8ec07c; --syn-bracket: #d5c4a1; --syn-math-bg: rgba(142, 192, 124, 0.06); --line-3: rgba(235, 219, 178, 0.3); --on-ink: #282828; --ink-hover: #cfc19e; --btn-hover: #3f3c38; --row-hover: #2e2d2c; --pdf-bg: #101212; --hu: #dccba6; --hu-bar: #796f62; --hu-soft: rgba(168, 153, 132, 0.16); --ai: #fe8019; --ai-bar: #b76421; --ai-bg: rgba(254, 128, 25, 0.07); --ai-soft: rgba(254, 128, 25, 0.18); --ok: #b8bb26; --ok-bar: #82832a; --ok-soft: rgba(184, 187, 38, 0.16); --err: #fb4934; --err-line: rgba(251, 73, 52, 0.35); --ins-bg: rgba(184, 187, 38, 0.22); --ins-ink: #cac657; --del-bg: rgba(251, 73, 52, 0.18); --del-ink: #f57c60; --warn-bg: rgba(254, 128, 25, 0.1); --warn-line: rgba(254, 128, 25, 0.35); }
:root[data-code-theme="dark"][data-dark="gruvbox"] .CodeMirror, :root[data-code-theme="dark"][data-dark="gruvbox"] .CodeMirror-hints { --panel: #1d2021; --paper: #32302f; --ink: #ebdbb2; --muted: #d5c4a1; --muted-2: #a89984; --line: rgba(235, 219, 178, 0.1); --line-2: rgba(235, 219, 178, 0.17); --cm-sel: rgba(146, 131, 116, .35); --cm-active: rgba(235, 219, 178, 0.04); --ai-line-bg: rgba(254, 128, 25, 0.06); --err-soft: rgba(251, 73, 52, 0.12); --syn-cmd: #fb4934; --syn-comment: #928374; --syn-num: #d3869b; --syn-string: #b8bb26; --syn-builtin: #fe8019; --syn-key: #fabd2f; --syn-ref: #d3869b; --syn-file: #8ec07c; --syn-env: #83a598; --syn-math: #8ec07c; --syn-bracket: #d5c4a1; --syn-math-bg: rgba(142, 192, 124, 0.06); color-scheme: dark; }
:root[data-theme="dark"][data-dark="gruvbox"][data-accent="auto"] { --accent: #fabd2f; --accent-hover: #fbc74e; --on-accent: #282828; }
:root[data-theme="dark"][data-dark="onedark"] { --g-main: #21252b; --g-surface: #3e4451; --canvas: #1b1d23; --card: #21252b; --panel: #1b1d23; --paper: #282c34; --ink: #d7dae0; --muted: #abb2bf; --muted-2: #7f848e; --line: rgba(215, 218, 224, 0.1); --line-2: rgba(215, 218, 224, 0.17); --cm-sel: #3e4451; --cm-active: rgba(215, 218, 224, 0.04); --ai-line-bg: rgba(229, 192, 123, 0.06); --err-soft: rgba(224, 108, 117, 0.12); --syn-cmd: #c678dd; --syn-comment: #7f848e; --syn-num: #d19a66; --syn-string: #98c379; --syn-builtin: #e5c07b; --syn-key: #d19a66; --syn-ref: #e06c75; --syn-file: #56b6c2; --syn-env: #61afef; --syn-math: #56b6c2; --syn-bracket: #abb2bf; --syn-math-bg: rgba(86, 182, 194, 0.06); --line-3: rgba(215, 218, 224, 0.3); --on-ink: #21252b; --ink-hover: #bdc0c6; --btn-hover: #343840; --row-hover: #262a30; --pdf-bg: #0f1013; --hu: #b8bec9; --hu-bar: #5c616a; --hu-soft: rgba(127, 132, 142, 0.16); --ai: #e5c07b; --ai-bar: #a38c62; --ai-bg: rgba(229, 192, 123, 0.07); --ai-soft: rgba(229, 192, 123, 0.18); --ok: #98c379; --ok-bar: #6b875d; --ok-soft: rgba(152, 195, 121, 0.16); --err: #e06c75; --err-line: rgba(224, 108, 117, 0.35); --ins-bg: rgba(152, 195, 121, 0.22); --ins-ink: #aecb9d; --del-bg: rgba(224, 108, 117, 0.18); --del-ink: #dd929a; --warn-bg: rgba(229, 192, 123, 0.1); --warn-line: rgba(229, 192, 123, 0.35); }
:root[data-code-theme="dark"][data-dark="onedark"] .CodeMirror, :root[data-code-theme="dark"][data-dark="onedark"] .CodeMirror-hints { --panel: #1b1d23; --paper: #282c34; --ink: #d7dae0; --muted: #abb2bf; --muted-2: #7f848e; --line: rgba(215, 218, 224, 0.1); --line-2: rgba(215, 218, 224, 0.17); --cm-sel: #3e4451; --cm-active: rgba(215, 218, 224, 0.04); --ai-line-bg: rgba(229, 192, 123, 0.06); --err-soft: rgba(224, 108, 117, 0.12); --syn-cmd: #c678dd; --syn-comment: #7f848e; --syn-num: #d19a66; --syn-string: #98c379; --syn-builtin: #e5c07b; --syn-key: #d19a66; --syn-ref: #e06c75; --syn-file: #56b6c2; --syn-env: #61afef; --syn-math: #56b6c2; --syn-bracket: #abb2bf; --syn-math-bg: rgba(86, 182, 194, 0.06); color-scheme: dark; }
:root[data-theme="dark"][data-dark="onedark"][data-accent="auto"] { --accent: #61afef; --accent-hover: #79bbf1; --on-accent: #21252b; }
:root[data-theme="dark"][data-dark="solarized"] { --g-main: #00252f; --g-surface: #073642; --canvas: #001b22; --card: #00252f; --panel: #001b22; --paper: #002b36; --ink: #e4e0d0; --muted: #a3b0b0; --muted-2: #6c7f84; --line: rgba(228, 224, 208, 0.1); --line-2: rgba(228, 224, 208, 0.17); --cm-sel: rgba(147, 161, 161, .22); --cm-active: rgba(228, 224, 208, 0.04); --ai-line-bg: rgba(181, 137, 0, 0.06); --err-soft: rgba(220, 50, 47, 0.12); --syn-cmd: #268bd2; --syn-comment: #6c7f84; --syn-num: #d33682; --syn-string: #2aa198; --syn-builtin: #cb4b16; --syn-key: #b58900; --syn-ref: #6c71c4; --syn-file: #2aa198; --syn-env: #cb4b16; --syn-math: #859900; --syn-bracket: #a3b0b0; --syn-math-bg: rgba(133, 153, 0, 0.06); --line-3: rgba(228, 224, 208, 0.3); --on-ink: #00252f; --ink-hover: #c2c5b9; --btn-hover: #103841; --row-hover: #072b34; --pdf-bg: #000f13; --hu: #b6beba; --hu-bar: #415d65; --hu-soft: rgba(108, 127, 132, 0.16); --ai: #b58900; --ai-bar: #766813; --ai-bg: rgba(181, 137, 0, 0.07); --ai-soft: rgba(181, 137, 0, 0.18); --ok: #859900; --ok-bar: #506d16; --ok-soft: rgba(133, 153, 0, 0.16); --err: #dc322f; --err-line: rgba(220, 50, 47, 0.35); --ins-bg: rgba(133, 153, 0, 0.22); --ins-ink: #a6b249; --del-bg: rgba(220, 50, 47, 0.18); --del-ink: #df6f67; --warn-bg: rgba(181, 137, 0, 0.1); --warn-line: rgba(181, 137, 0, 0.35); }
:root[data-code-theme="dark"][data-dark="solarized"] .CodeMirror, :root[data-code-theme="dark"][data-dark="solarized"] .CodeMirror-hints { --panel: #001b22; --paper: #002b36; --ink: #e4e0d0; --muted: #a3b0b0; --muted-2: #6c7f84; --line: rgba(228, 224, 208, 0.1); --line-2: rgba(228, 224, 208, 0.17); --cm-sel: rgba(147, 161, 161, .22); --cm-active: rgba(228, 224, 208, 0.04); --ai-line-bg: rgba(181, 137, 0, 0.06); --err-soft: rgba(220, 50, 47, 0.12); --syn-cmd: #268bd2; --syn-comment: #6c7f84; --syn-num: #d33682; --syn-string: #2aa198; --syn-builtin: #cb4b16; --syn-key: #b58900; --syn-ref: #6c71c4; --syn-file: #2aa198; --syn-env: #cb4b16; --syn-math: #859900; --syn-bracket: #a3b0b0; --syn-math-bg: rgba(133, 153, 0, 0.06); color-scheme: dark; }
:root[data-theme="dark"][data-dark="solarized"][data-accent="auto"] { --accent: #268bd2; --accent-hover: #479cd9; --on-accent: #fdf6e3; }
:root[data-theme="dark"][data-dark="github"] { --g-main: #0d1117; --g-surface: #21262d; --canvas: #010409; --card: #0d1117; --panel: #010409; --paper: #11161d; --ink: #e6edf3; --muted: #9ea6b0; --muted-2: #6e7681; --line: rgba(230, 237, 243, 0.1); --line-2: rgba(230, 237, 243, 0.17); --cm-sel: rgba(56, 139, 253, .3); --cm-active: rgba(230, 237, 243, 0.04); --ai-line-bg: rgba(210, 153, 34, 0.06); --err-soft: rgba(248, 81, 73, 0.12); --syn-cmd: #ff7b72; --syn-comment: #8b949e; --syn-num: #79c0ff; --syn-string: #a5d6ff; --syn-builtin: #ffa657; --syn-key: #ffa657; --syn-ref: #d2a8ff; --syn-file: #7ee787; --syn-env: #d2a8ff; --syn-math: #a5d6ff; --syn-bracket: #9ea6b0; --syn-math-bg: rgba(165, 214, 255, 0.06); --line-3: rgba(230, 237, 243, 0.3); --on-ink: #0d1117; --ink-hover: #c6cdd3; --btn-hover: #20252c; --row-hover: #14181e; --pdf-bg: #010205; --hu: #b4bbc4; --hu-bar: #495059; --hu-soft: rgba(110, 118, 129, 0.16); --ai: #d29922; --ai-bar: #8e6b20; --ai-bg: rgba(210, 153, 34, 0.07); --ai-soft: rgba(210, 153, 34, 0.18); --ok: #3fb950; --ok-bar: #2d783c; --ok-soft: rgba(63, 185, 80, 0.16); --err: #f85149; --err-line: rgba(248, 81, 73, 0.35); --ins-bg: rgba(63, 185, 80, 0.22); --ins-ink: #79cb89; --del-bg: rgba(248, 81, 73, 0.18); --del-ink: #f28884; --warn-bg: rgba(210, 153, 34, 0.1); --warn-line: rgba(210, 153, 34, 0.35); }
:root[data-code-theme="dark"][data-dark="github"] .CodeMirror, :root[data-code-theme="dark"][data-dark="github"] .CodeMirror-hints { --panel: #010409; --paper: #11161d; --ink: #e6edf3; --muted: #9ea6b0; --muted-2: #6e7681; --line: rgba(230, 237, 243, 0.1); --line-2: rgba(230, 237, 243, 0.17); --cm-sel: rgba(56, 139, 253, .3); --cm-active: rgba(230, 237, 243, 0.04); --ai-line-bg: rgba(210, 153, 34, 0.06); --err-soft: rgba(248, 81, 73, 0.12); --syn-cmd: #ff7b72; --syn-comment: #8b949e; --syn-num: #79c0ff; --syn-string: #a5d6ff; --syn-builtin: #ffa657; --syn-key: #ffa657; --syn-ref: #d2a8ff; --syn-file: #7ee787; --syn-env: #d2a8ff; --syn-math: #a5d6ff; --syn-bracket: #9ea6b0; --syn-math-bg: rgba(165, 214, 255, 0.06); color-scheme: dark; }
:root[data-theme="dark"][data-dark="github"][data-accent="auto"] { --accent: #4493f8; --accent-hover: #60a3f9; --on-accent: #0d1117; }
:root[data-theme="dark"][data-dark="rosepine"] { --g-main: #191724; --g-surface: #26233a; --canvas: #12101b; --card: #191724; --panel: #12101b; --paper: #1f1d2e; --ink: #e0def4; --muted: #b5b1cc; --muted-2: #908caa; --line: rgba(224, 222, 244, 0.1); --line-2: rgba(224, 222, 244, 0.17); --cm-sel: rgba(110, 106, 134, .32); --cm-active: rgba(224, 222, 244, 0.04); --ai-line-bg: rgba(246, 193, 119, 0.06); --err-soft: rgba(235, 111, 146, 0.12); --syn-cmd: #ebbcba; --syn-comment: #6e6a86; --syn-num: #f6c177; --syn-string: #f6c177; --syn-builtin: #ebbcba; --syn-key: #f6c177; --syn-ref: #c4a7e7; --syn-file: #9ccfd8; --syn-env: #9ccfd8; --syn-math: #c4a7e7; --syn-bracket: #b5b1cc; --syn-math-bg: rgba(196, 167, 231, 0.06); --line-3: rgba(224, 222, 244, 0.3); --on-ink: #191724; --ink-hover: #c3c1d6; --btn-hover: #2d2b3c; --row-hover: #1f1d2a; --pdf-bg: #0a090f; --hu: #c2bed8; --hu-bar: #636078; --hu-soft: rgba(144, 140, 170, 0.16); --ai: #f6c177; --ai-bar: #ab885d; --ai-bg: rgba(246, 193, 119, 0.07); --ai-soft: rgba(246, 193, 119, 0.18); --ok: #9ccfd8; --ok-bar: #6a8894; --ok-soft: rgba(156, 207, 216, 0.16); --err: #eb6f92; --err-line: rgba(235, 111, 146, 0.35); --ins-bg: rgba(156, 207, 216, 0.22); --ins-ink: #b4d4e2; --del-bg: rgba(235, 111, 146, 0.18); --del-ink: #e796b4; --warn-bg: rgba(246, 193, 119, 0.1); --warn-line: rgba(246, 193, 119, 0.35); }
:root[data-code-theme="dark"][data-dark="rosepine"] .CodeMirror, :root[data-code-theme="dark"][data-dark="rosepine"] .CodeMirror-hints { --panel: #12101b; --paper: #1f1d2e; --ink: #e0def4; --muted: #b5b1cc; --muted-2: #908caa; --line: rgba(224, 222, 244, 0.1); --line-2: rgba(224, 222, 244, 0.17); --cm-sel: rgba(110, 106, 134, .32); --cm-active: rgba(224, 222, 244, 0.04); --ai-line-bg: rgba(246, 193, 119, 0.06); --err-soft: rgba(235, 111, 146, 0.12); --syn-cmd: #ebbcba; --syn-comment: #6e6a86; --syn-num: #f6c177; --syn-string: #f6c177; --syn-builtin: #ebbcba; --syn-key: #f6c177; --syn-ref: #c4a7e7; --syn-file: #9ccfd8; --syn-env: #9ccfd8; --syn-math: #c4a7e7; --syn-bracket: #b5b1cc; --syn-math-bg: rgba(196, 167, 231, 0.06); color-scheme: dark; }
:root[data-theme="dark"][data-dark="rosepine"][data-accent="auto"] { --accent: #c4a7e7; --accent-hover: #cdb4eb; --on-accent: #191724; }
:root[data-theme="light"][data-light="claude"] { --g-main: #f0eee6; --g-surface: #e5e2d7; --panel: #faf9f5; --paper: #ffffff; --ink: #1f1e1d; --muted: #5e5d59; --muted-2: #87867f; --line: rgba(31, 30, 29, 0.12); --line-2: rgba(31, 30, 29, 0.19); --cm-sel: #e6e3da; --cm-active: #f8f8f8; --syn-cmd: #b0502e; --syn-comment: #87867f; --syn-num: #2c6aa8; --syn-string: #4d7a2e; --syn-builtin: #9a6a00; --syn-key: #9a5a12; --syn-ref: #6b4fb0; --syn-file: #2e7d72; --syn-env: #a6416b; --syn-math: #2c5f9e; --syn-bracket: #5e5d59; --syn-math-bg: rgba(44, 95, 158, 0.05); --line-3: rgba(31, 30, 29, 0.32); --on-ink: #ffffff; --ink-hover: #41403f; --btn-hover: #f4f4f4; --row-hover: #fbfafa; --pdf-bg: #504f4c; --hu: #4b4a47; --hu-bar: #b1b0ac; --hu-soft: #e9e9e8; }
:root[data-code-theme="light"][data-light="claude"] .CodeMirror, :root[data-code-theme="light"][data-light="claude"] .CodeMirror-hints { --panel: #faf9f5; --paper: #ffffff; --ink: #1f1e1d; --muted: #5e5d59; --muted-2: #87867f; --line: rgba(31, 30, 29, 0.12); --line-2: rgba(31, 30, 29, 0.19); --cm-sel: #e6e3da; --cm-active: #f8f8f8; --syn-cmd: #b0502e; --syn-comment: #87867f; --syn-num: #2c6aa8; --syn-string: #4d7a2e; --syn-builtin: #9a6a00; --syn-key: #9a5a12; --syn-ref: #6b4fb0; --syn-file: #2e7d72; --syn-env: #a6416b; --syn-math: #2c5f9e; --syn-bracket: #5e5d59; --syn-math-bg: rgba(44, 95, 158, 0.05); color-scheme: light; }
:root[data-theme="light"][data-light="claude"][data-accent="auto"] { --accent: #c96442; --accent-hover: #b1583a; --on-accent: #ffffff; }
:root[data-theme="light"][data-light="github"] { --g-main: #eef1f4; --g-surface: #e1e6eb; --panel: #f6f8fa; --paper: #ffffff; --ink: #1f2328; --muted: #59636e; --muted-2: #818b98; --line: rgba(31, 35, 40, 0.12); --line-2: rgba(31, 35, 40, 0.19); --cm-sel: #d4e6fb; --cm-active: #f8f8f9; --syn-cmd: #cf222e; --syn-comment: #6e7781; --syn-num: #0550ae; --syn-string: #0a3069; --syn-builtin: #953800; --syn-key: #953800; --syn-ref: #bf3989; --syn-file: #116329; --syn-env: #8250df; --syn-math: #0550ae; --syn-bracket: #59636e; --syn-math-bg: rgba(5, 80, 174, 0.05); --line-3: rgba(31, 35, 40, 0.32); --on-ink: #ffffff; --ink-hover: #414448; --btn-hover: #f4f4f4; --row-hover: #fbfbfb; --pdf-bg: #4c545e; --hu: #485059; --hu-bar: #adb4bc; --hu-soft: #e8eaec; }
:root[data-code-theme="light"][data-light="github"] .CodeMirror, :root[data-code-theme="light"][data-light="github"] .CodeMirror-hints { --panel: #f6f8fa; --paper: #ffffff; --ink: #1f2328; --muted: #59636e; --muted-2: #818b98; --line: rgba(31, 35, 40, 0.12); --line-2: rgba(31, 35, 40, 0.19); --cm-sel: #d4e6fb; --cm-active: #f8f8f9; --syn-cmd: #cf222e; --syn-comment: #6e7781; --syn-num: #0550ae; --syn-string: #0a3069; --syn-builtin: #953800; --syn-key: #953800; --syn-ref: #bf3989; --syn-file: #116329; --syn-env: #8250df; --syn-math: #0550ae; --syn-bracket: #59636e; --syn-math-bg: rgba(5, 80, 174, 0.05); color-scheme: light; }
:root[data-theme="light"][data-light="github"][data-accent="auto"] { --accent: #0969da; --accent-hover: #085cc0; --on-accent: #ffffff; }
:root[data-theme="light"][data-light="solarized"] { --g-main: #eee8d5; --g-surface: #e3dcc6; --panel: #f7f0dc; --paper: #fdf6e3; --ink: #073642; --muted: #4f646b; --muted-2: #839496; --line: rgba(7, 54, 66, 0.12); --line-2: rgba(7, 54, 66, 0.19); --cm-sel: #e6ddc2; --cm-active: #f6f0de; --syn-cmd: #268bd2; --syn-comment: #839496; --syn-num: #d33682; --syn-string: #2aa198; --syn-builtin: #cb4b16; --syn-key: #b58900; --syn-ref: #6c71c4; --syn-file: #2aa198; --syn-env: #cb4b16; --syn-math: #859900; --syn-bracket: #4f646b; --syn-math-bg: rgba(133, 153, 0, 0.05); --line-3: rgba(7, 54, 66, 0.32); --on-ink: #fdf6e3; --ink-hover: #2c535a; --btn-hover: #f1ecdb; --row-hover: #f8f2e0; --pdf-bg: #43555b; --hu: #39565f; --hu-bar: #aeb6b1; --hu-soft: #e7e4d5; }
:root[data-code-theme="light"][data-light="solarized"] .CodeMirror, :root[data-code-theme="light"][data-light="solarized"] .CodeMirror-hints { --panel: #f7f0dc; --paper: #fdf6e3; --ink: #073642; --muted: #4f646b; --muted-2: #839496; --line: rgba(7, 54, 66, 0.12); --line-2: rgba(7, 54, 66, 0.19); --cm-sel: #e6ddc2; --cm-active: #f6f0de; --syn-cmd: #268bd2; --syn-comment: #839496; --syn-num: #d33682; --syn-string: #2aa198; --syn-builtin: #cb4b16; --syn-key: #b58900; --syn-ref: #6c71c4; --syn-file: #2aa198; --syn-env: #cb4b16; --syn-math: #859900; --syn-bracket: #4f646b; --syn-math-bg: rgba(133, 153, 0, 0.05); color-scheme: light; }
:root[data-theme="light"][data-light="solarized"][data-accent="auto"] { --accent: #268bd2; --accent-hover: #217ab9; --on-accent: #ffffff; }
:root[data-theme="light"][data-light="latte"] { --g-main: #e6e9ef; --g-surface: #ccd0da; --panel: #eff1f5; --paper: #f8f9fb; --ink: #3f425c; --muted: #5c5f77; --muted-2: #8c8fa1; --line: rgba(63, 66, 92, 0.12); --line-2: rgba(63, 66, 92, 0.19); --cm-sel: #e2d7f8; --cm-active: #f2f4f6; --syn-cmd: #8839ef; --syn-comment: #8c8fa1; --syn-num: #fe640b; --syn-string: #40a02b; --syn-builtin: #df8e1d; --syn-key: #e64553; --syn-ref: #ea76cb; --syn-file: #179299; --syn-env: #1e66f5; --syn-math: #209fb5; --syn-bracket: #5c5f77; --syn-math-bg: rgba(32, 159, 181, 0.05); --line-3: rgba(63, 66, 92, 0.32); --on-ink: #f8f9fb; --ink-hover: #5b5d74; --btn-hover: #eff0f3; --row-hover: #f4f5f8; --pdf-bg: #4e5165; --hu: #53566f; --hu-bar: #b2b4c0; --hu-soft: #e5e6eb; }
:root[data-code-theme="light"][data-light="latte"] .CodeMirror, :root[data-code-theme="light"][data-light="latte"] .CodeMirror-hints { --panel: #eff1f5; --paper: #f8f9fb; --ink: #3f425c; --muted: #5c5f77; --muted-2: #8c8fa1; --line: rgba(63, 66, 92, 0.12); --line-2: rgba(63, 66, 92, 0.19); --cm-sel: #e2d7f8; --cm-active: #f2f4f6; --syn-cmd: #8839ef; --syn-comment: #8c8fa1; --syn-num: #fe640b; --syn-string: #40a02b; --syn-builtin: #df8e1d; --syn-key: #e64553; --syn-ref: #ea76cb; --syn-file: #179299; --syn-env: #1e66f5; --syn-math: #209fb5; --syn-bracket: #5c5f77; --syn-math-bg: rgba(32, 159, 181, 0.05); color-scheme: light; }
:root[data-theme="light"][data-light="latte"][data-accent="auto"] { --accent: #8839ef; --accent-hover: #7832d2; --on-accent: #ffffff; }
:root[data-theme="light"][data-light="gruvbox"] { --g-main: #efe3bf; --g-surface: #ddcfa9; --panel: #f7efd2; --paper: #fbf5e0; --ink: #32302f; --muted: #504945; --muted-2: #7c6f64; --line: rgba(50, 48, 47, 0.12); --line-2: rgba(50, 48, 47, 0.19); --cm-sel: #f0d6b0; --cm-active: #f5efdb; --syn-cmd: #9d0006; --syn-comment: #7c6f64; --syn-num: #8f3f71; --syn-string: #79740e; --syn-builtin: #af3a03; --syn-key: #b57614; --syn-ref: #8f3f71; --syn-file: #427b58; --syn-env: #076678; --syn-math: #427b58; --syn-bracket: #504945; --syn-math-bg: rgba(66, 123, 88, 0.05); --line-3: rgba(50, 48, 47, 0.32); --on-ink: #fbf5e0; --ink-hover: #504e4a; --btn-hover: #f1ebd7; --row-hover: #f7f1dc; --pdf-bg: #443e3b; --hu: #47423e; --hu-bar: #a89e8f; --hu-soft: #e4ddca; }
:root[data-code-theme="light"][data-light="gruvbox"] .CodeMirror, :root[data-code-theme="light"][data-light="gruvbox"] .CodeMirror-hints { --panel: #f7efd2; --paper: #fbf5e0; --ink: #32302f; --muted: #504945; --muted-2: #7c6f64; --line: rgba(50, 48, 47, 0.12); --line-2: rgba(50, 48, 47, 0.19); --cm-sel: #f0d6b0; --cm-active: #f5efdb; --syn-cmd: #9d0006; --syn-comment: #7c6f64; --syn-num: #8f3f71; --syn-string: #79740e; --syn-builtin: #af3a03; --syn-key: #b57614; --syn-ref: #8f3f71; --syn-file: #427b58; --syn-env: #076678; --syn-math: #427b58; --syn-bracket: #504945; --syn-math-bg: rgba(66, 123, 88, 0.05); color-scheme: light; }
:root[data-theme="light"][data-light="gruvbox"][data-accent="auto"] { --accent: #af3a03; --accent-hover: #9a3303; --on-accent: #ffffff; }
:root[data-theme="light"][data-light="dawn"] { --g-main: #f2e9e1; --g-surface: #dfdad9; --panel: #faf4ed; --paper: #fffaf3; --ink: #4a4568; --muted: #6a6588; --muted-2: #9893a5; --line: rgba(74, 69, 104, 0.12); --line-2: rgba(74, 69, 104, 0.19); --cm-sel: #e9dfd7; --cm-active: #faf5ef; --syn-cmd: #b4637a; --syn-comment: #9893a5; --syn-num: #d7827e; --syn-string: #c07d1e; --syn-builtin: #d7827e; --syn-key: #c07d1e; --syn-ref: #907aa9; --syn-file: #56949f; --syn-env: #286983; --syn-math: #907aa9; --syn-bracket: #6a6588; --syn-math-bg: rgba(144, 122, 169, 0.05); --line-3: rgba(74, 69, 104, 0.32); --on-ink: #fffaf3; --ink-hover: #65607d; --btn-hover: #f6f1ec; --row-hover: #fbf6f0; --pdf-bg: #5a5674; --hu: #605b7e; --hu-bar: #bcb7c0; --hu-soft: #ece7e5; }
:root[data-code-theme="light"][data-light="dawn"] .CodeMirror, :root[data-code-theme="light"][data-light="dawn"] .CodeMirror-hints { --panel: #faf4ed; --paper: #fffaf3; --ink: #4a4568; --muted: #6a6588; --muted-2: #9893a5; --line: rgba(74, 69, 104, 0.12); --line-2: rgba(74, 69, 104, 0.19); --cm-sel: #e9dfd7; --cm-active: #faf5ef; --syn-cmd: #b4637a; --syn-comment: #9893a5; --syn-num: #d7827e; --syn-string: #c07d1e; --syn-builtin: #d7827e; --syn-key: #c07d1e; --syn-ref: #907aa9; --syn-file: #56949f; --syn-env: #286983; --syn-math: #907aa9; --syn-bracket: #6a6588; --syn-math-bg: rgba(144, 122, 169, 0.05); color-scheme: light; }
:root[data-theme="light"][data-light="dawn"][data-accent="auto"] { --accent: #286983; --accent-hover: #235c73; --on-accent: #ffffff; }
/* ==== end of generated palettes ==== */

/* Word mode: the comment toggle (shared with Visual mode) hides SuperDoc's comment column and highlights.
   The comments stay in the document and in the Inbox. */
:root[data-comments="off"] #wordDoc .superdoc__right-sidebar,
:root[data-comments="off"] #wordDoc .floating-comments,
:root[data-comments="off"] #wordDoc .comments-layer { display: none !important; }
:root[data-comments="off"] #wordDoc .superdoc-comment-highlight { background: none !important; border-color: transparent !important; box-shadow: none !important; }

/* ---------------------------------------------------------------- select boxes
   One look everywhere: the browser's own arrow sits flush against the edge (and differs by OS), so it is
   replaced by a chevron with room on both sides. Grey works on light and dark themes. */
select:not([multiple]):not([size]) {
  -webkit-appearance: none; appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%238e939c' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 13px 13px;
  text-overflow: ellipsis; cursor: pointer;
}
select:not([multiple]):not([size]):disabled { cursor: not-allowed; opacity: .6; }
select:not([multiple]):not([size]):hover:not(:disabled) { border-color: var(--line-3, var(--line-2)); }
/* a quieter focus ring: a thin accent outline instead of a glowing halo */
select:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent); }

/* ---------------------------------------------------------------- narrow side panels
   When the left panel is squeezed (a narrow window), names matter more than the little progress bars: hide the
   bars so file and section names get the room, and truncate them with an ellipsis. */
#left { container-type: inline-size; container-name: leftpane; }
@container leftpane (max-width: 200px) {
  .tree .mini, #outline .ometer, .tree .main-m { display: none; }
  .tree .nm { min-width: 2.5em; }
}

/* ---------------------------------------------------------------- sharing */
.sh-list { list-style: none; margin: 10px 0 12px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-md); }
.sh-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.sh-row:last-child { border-bottom: 0; }
.sh-av { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 600 11.5px/1 var(--font);
  background: var(--accent-soft); color: var(--accent); }
.sh-who { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sh-who b { font-weight: 600; }
.sh-role { white-space: nowrap; }
.sh-add { display: flex; gap: 6px; align-items: center; }
.sh-add input { flex: 1; }
.pmeta .shared { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); }


/* ---- live collaboration: who else is here, files they have open, the clash dialog */
.live-who { display: inline-flex; align-items: center; margin-right: 2px; }
.live-who .lw-av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 600 10.5px/1 var(--font);
  background: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 2px var(--panel); margin-left: -6px; cursor: default; }
.live-who .lw-av:first-child { margin-left: 0; }
.live-who .lw-av.more { background: var(--accent-soft); color: var(--accent); }
.row .lw-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: auto; margin-right: 4px; box-shadow: 0 0 0 2px var(--accent-soft); }
.clash { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 4px; }
.clash > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.clash pre { margin: 0; max-height: 46vh; overflow: auto; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--ink); font: 12px/1.5 var(--mono); white-space: pre-wrap; word-break: break-word; }
@media (max-width: 720px) { .clash { grid-template-columns: 1fr; } }
.modal-card.clash-card { width: min(880px, 94vw); }
/* capital initials sit ~0.8px high in a line-height-1 box (Inter's ascender is taller than its descender): nudge down */
.lw-av, .sh-av { padding-top: 2px; }
.word-share { margin: 6px 10px 0; padding: 7px 10px; border-radius: 8px; font-size: 12.5px; line-height: 1.4;
  background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--ink); }
/* Word mode with comments shown: page and comment column side by side, never overlapping, with a gap at both ends
   even when a narrow pane scrolls sideways */
#wordDoc .superdoc.superdoc--with-sidebar { width: max-content; min-width: 100%; box-sizing: border-box; padding: 0 20px; }
/* a tight pane: narrower comment column and cards */
#word.word-tight .superdoc__right-sidebar { width: 220px !important; min-width: 0 !important; flex: 0 0 220px !important; }
#word.word-tight .floating-comments, #word.word-tight .floating-comments .section-wrapper,
#word.word-tight .floating-comments .sidebar-container, #word.word-tight .floating-comments .comment-placeholder { width: 208px !important; min-width: 0 !important; }
#word.word-tight .floating-comments .comments-dialog { padding: 10px 12px !important; min-width: 0 !important; max-width: 208px !important; }
#wordDoc .superdoc { justify-content: flex-start !important; }   /* word.js places the page (a little right of the edge) */
