/* OCTO PLAN (plan.octo.science) — High-legibility monochrome project & coding plan board.
   Three-voice system:
   1. Agent prose = carbon black (--fg)
   2. Horst inline edits/comments = Signal Vermilion (--horst)
   3. Agent inline reaction + milestone pointer = Cobalt Blue (--reply) */

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url(/static/fonts/jetbrains-mono-latin.woff2) format('woff2');
}

[hidden] { display: none !important; }

:root {
  --scale: 1;
  --code-w: 580px;

  --bg: #F7F7F5;
  --panel: #FFFFFF;
  --panel-subtle: #EFEFEC;
  --fg: #111113;
  --dim: #45454C;
  --faint: #686872;
  --line: rgba(17, 17, 19, 0.11);
  --line-strong: rgba(17, 17, 19, 0.28);

  --horst: #D92600;
  --horst-bg: rgba(217, 38, 0, 0.07);
  --horst-line: rgba(217, 38, 0, 0.40);

  --reply: #0052CC;
  --reply-bg: rgba(0, 82, 204, 0.08);
  --reply-line: rgba(0, 82, 204, 0.38);

  /* Syntax & diff colors (light) */
  --code-bg: #FAFAF8;
  --diff-add-bg: rgba(22, 135, 59, 0.11);
  --diff-add-fg: #0F5E29;
  --diff-del-bg: rgba(209, 36, 47, 0.11);
  --diff-del-fg: #9E1C23;
  --syn-kw: #0550AE;
  --syn-str: #0A3069;
  --syn-com: #6E7781;
  --syn-fn: #6639BA;
  --syn-num: #953800;

  --font-ui: Arial, "Helvetica Neue", Helvetica, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-prose: Arial, "Helvetica Neue", Helvetica, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-code: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --pad: clamp(16px, 2.2vw, 28px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-font="serif"] {
  --font-prose: Georgia, Charter, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
}

:root[data-mode="dark"] {
  --bg: #0C0C0E;
  --panel: #131317;
  --panel-subtle: #1B1B21;
  --fg: #EDEDEB;
  --dim: #B2B2BC;
  --faint: #848490;
  --line: rgba(237, 237, 235, 0.11);
  --line-strong: rgba(237, 237, 235, 0.28);

  --horst: #FF5A36;
  --horst-bg: rgba(255, 90, 54, 0.13);
  --horst-line: rgba(255, 90, 54, 0.50);

  --reply: #58A6FF;
  --reply-bg: rgba(88, 166, 255, 0.13);
  --reply-line: rgba(88, 166, 255, 0.48);

  --code-bg: #0F0F13;
  --diff-add-bg: rgba(46, 160, 67, 0.16);
  --diff-add-fg: #7EE787;
  --diff-del-bg: rgba(248, 81, 73, 0.16);
  --diff-del-fg: #FFA198;
  --syn-kw: #79C0FF;
  --syn-str: #A5D6FF;
  --syn-com: #8B949E;
  --syn-fn: #D2A8FF;
  --syn-num: #FFA657;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: calc(16px * var(--scale, 1));
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  transition: background-color 200ms var(--ease), color 200ms var(--ease);
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@keyframes pulse {
  50% { opacity: 0.35; }
}
@keyframes shake {
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}

/* ---------- Lock Gate: 5 underscores _ _ _ _ _ (from octo_note) ---------- */
.gate { display: none; }
html.locked .shell, html.locked #toast { display: none; }
html.pending .gate, html.pending .shell { visibility: hidden; }
html.locked .gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  margin-top: 22vh;
  width: 100%;
}
.gate-box {
  position: relative;
  display: block;
  padding: 10px 14px;
  cursor: text;
}
.slots { display: flex; gap: 14px; }
.slots i {
  display: block;
  position: relative;
  width: 32px;
  height: 46px;
  border-bottom: 2px solid var(--line-strong);
  transition: border-color 0.2s var(--ease);
}
.slots i.on { border-bottom-color: var(--fg); }
.slots i.on::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  background: var(--fg);
  animation: rise 0.18s var(--ease);
}
.slots i.cur {
  border-bottom-color: var(--fg);
  animation: pulse 1.1s ease-in-out infinite;
}
.gate.bad .slots { animation: shake 0.36s var(--ease); }
.gate.bad .slots i { border-bottom-color: var(--horst); }
#pin {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  padding: 0;
  font-size: 16px;
  color: transparent;
  caret-color: transparent;
  background: transparent;
}
.gate-msg {
  min-height: 18px;
  font-size: calc(14px * var(--scale, 1));
  text-align: center;
  color: var(--horst);
}

/* ---------- Shell & Header (Flush to Bottom, No Extra Bottom Margin) ---------- */
.shell {
  height: 100svh;
  max-width: 1800px;
  margin: 0 auto;
  padding: 0 var(--pad);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  min-height: 50px;
  padding: 4px 0;
  border-bottom: 1px solid var(--line-strong);
  gap: 8px 14px;
  flex-shrink: 0;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.brand-cur {
  font-size: calc(15px * var(--scale, 1));
  color: var(--fg);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  opacity: 0.45;
  transition: background-color 200ms var(--ease), transform 200ms var(--ease);
}
.live-dot.connected { background: var(--fg); opacity: 0.85; }
.live-dot.pulse { background: var(--horst); opacity: 1; transform: scale(1.4); }

.save-ind {
  font-size: calc(13px * var(--scale, 1));
  color: var(--faint);
  margin-left: 6px;
}
.save-ind.horst { color: var(--horst); font-weight: 600; }

.zoom-group {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  background: var(--panel);
}
.zoom-btn {
  min-width: 30px;
  padding: 4px 8px !important;
  font-weight: 700;
}

.top-btn {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  color: var(--dim);
  font-family: var(--font-ui);
  font-size: calc(13.5px * var(--scale, 1));
  min-height: 30px;
  padding: 4px 10px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: color 140ms var(--ease), border-color 140ms var(--ease), background-color 140ms var(--ease);
}
.top-btn:hover, .top-btn:focus-visible {
  color: var(--fg);
  border-color: var(--line-strong);
  background: var(--panel);
  outline: none;
}
.top-btn.danger-text:hover {
  color: var(--horst);
  border-color: var(--horst-line);
}

/* ---------- 2-Column / 3-Column Resizable Board ---------- */
.board {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.board.with-code {
  grid-template-columns: 250px minmax(320px, 1fr) 7px var(--code-w, 580px);
}

/* ---------- Draggable Vertical Divider ---------- */
.col-resizer {
  width: 7px;
  cursor: col-resize;
  background: var(--bg);
  border-left: 1px solid var(--line-strong);
  border-right: 1px solid var(--line);
  position: relative;
  user-select: none;
  touch-action: none;
  transition: background-color 140ms var(--ease);
}
.col-resizer::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 32px;
  transform: translate(-50%, -50%);
  background: var(--line-strong);
}
.col-resizer:hover,
.col-resizer.dragging {
  background: var(--horst-bg);
  border-left-color: var(--horst);
}
.col-resizer:hover::after,
.col-resizer.dragging::after {
  background: var(--horst);
}

/* ---------- Column 1: Projects ---------- */
.col-left {
  border-right: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-height: 0;
  overflow-y: auto;
}

.col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  font-size: calc(13px * var(--scale, 1));
  color: var(--faint);
  font-weight: 600;
}

.proj-list {
  display: flex;
  flex-direction: column;
}

.proj-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px 16px 20px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-align: left;
  background: transparent;
  transition: background-color 160ms var(--ease);
}
.proj-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--fg);
  transform: scaleY(0);
  transition: transform 200ms var(--ease), background-color 200ms var(--ease);
}
.proj-item:hover { background: var(--panel-subtle); }
.proj-item.active { background: var(--panel); }
.proj-item.active::before { transform: scaleY(1); }
.proj-item.has-horst::before { background: var(--horst); }

.proj-item-title {
  font-size: calc(16px * var(--scale, 1));
  font-weight: 700;
  color: var(--fg);
  line-height: 1.3;
  margin: 0;
}

.proj-item-hash {
  font-family: var(--font-code);
  font-size: calc(13px * var(--scale, 1));
  color: var(--faint);
}

.proj-item-desc {
  font-size: calc(14px * var(--scale, 1));
  line-height: 1.48;
  color: var(--dim);
  margin: 2px 0 4px;
}

.proj-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: calc(13px * var(--scale, 1));
  color: var(--faint);
}
.proj-mini-track {
  flex: 1;
  height: 2px;
  background: var(--line);
  overflow: hidden;
}
.proj-mini-fill {
  height: 100%;
  width: 100%;
  background: var(--fg);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 320ms var(--ease);
}
.horst-badge { color: var(--horst); font-weight: 600; }

/* ---------- Column 2: Document View ---------- */
.col-doc {
  background: var(--panel);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.stage {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.doc-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  font-size: calc(13px * var(--scale, 1));
  color: var(--faint);
  flex-shrink: 0;
}
.doc-bar-left, .doc-bar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.voice-key {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: calc(13px * var(--scale, 1));
}
.key-agent { color: var(--fg); font-weight: 500; }
.key-horst { color: var(--horst); font-weight: 600; }
.key-reply { color: var(--reply); font-weight: 600; }

.view-switch {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  background: var(--bg);
}
.view-tab {
  appearance: none;
  background: transparent;
  border: 0;
  font-family: var(--font-ui);
  font-size: calc(13px * var(--scale, 1));
  min-height: 28px;
  padding: 4px 11px;
  cursor: pointer;
  color: var(--faint);
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.view-tab.active {
  background: var(--fg);
  color: var(--bg);
  font-weight: 600;
}

.doc-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 28px clamp(24px, 3.5vw, 48px) 36px;
}

.doc-article {
  max-width: 780px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.doc-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.p-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: calc(26px * var(--scale, 1));
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.22;
  color: var(--fg);
  cursor: text;
}

.p-desc {
  margin: 0;
  font-family: var(--font-prose);
  font-size: calc(17px * var(--scale, 1));
  line-height: 1.62;
  color: var(--dim);
  cursor: text;
}

/* ---------- Document Sections (Plan & Execution) ---------- */
.doc-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-strong);
}

.sec-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: calc(18px * var(--scale, 1));
  font-weight: 700;
  color: var(--fg);
}

.exec-counter {
  font-size: calc(13.5px * var(--scale, 1));
  font-weight: 600;
  color: var(--dim);
}

.progress-bar-track {
  width: 100%;
  height: 2px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 2px;
}
.progress-bar-fill {
  width: 100%;
  height: 100%;
  background: var(--fg);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 380ms var(--ease);
}

/* ---------- Readable Paragraph Items ---------- */
.para-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@keyframes execPulse {
  0% { background-color: var(--reply-bg); }
  100% { background-color: transparent; }
}

.para-item {
  position: relative;
  padding: 12px 16px;
  border-left: 2px solid var(--line-strong);
  background: transparent;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.para-item:hover {
  background: var(--bg);
}
.para-item.has-horst-edit {
  border-left-color: var(--horst);
  border-left-width: 3px;
}
.para-item.exec-linked-highlight {
  border-left-color: var(--reply);
  border-left-width: 3px;
  animation: execPulse 1.4s var(--ease);
}

/* Execution row adds read-only status indicator on the left */
.exec-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.exec-status-box {
  width: 20px;
  height: 20px;
  margin-top: 4px;
  border: 1.5px solid var(--line-strong);
  background: var(--panel);
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  cursor: default;
}
.exec-item.state-done .exec-status-box {
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}
.exec-item.state-doing .exec-status-box {
  border-color: var(--fg);
}

.para-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.para-text {
  margin: 0;
  font-family: var(--font-prose);
  font-size: calc(17px * var(--scale, 1));
  line-height: 1.68;
  color: var(--fg);
  cursor: text;
  overflow-wrap: break-word;
}

/* Three-Voice Spans:
   1. Agent = --fg (black)
   2. Horst = --horst (bright vermilion)
   3. Agent reply = --reply (cobalt blue) */
.seg-agent {
  color: var(--fg);
}
.seg-horst {
  color: var(--horst);
  background: var(--horst-bg);
  padding: 1px 4px;
  border-radius: 2px;
  font-weight: 500;
}

.agent-reply-inline {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 10px;
  border-left: 2px solid var(--reply);
  background: var(--reply-bg);
  color: var(--reply);
  font-family: var(--font-prose);
  font-size: calc(15.5px * var(--scale, 1));
  line-height: 1.55;
}
.agent-reply-link {
  appearance: none;
  border: 1px solid var(--reply-line);
  background: var(--panel);
  color: var(--reply);
  font-family: var(--font-ui);
  font-size: calc(12.5px * var(--scale, 1));
  font-weight: 600;
  padding: 1px 8px;
  cursor: pointer;
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}
.agent-reply-link:hover {
  background: var(--reply);
  color: var(--panel);
}

.inline-code {
  font-family: var(--font-code);
  font-size: 0.85em;
  padding: 1px 5px;
  border: 1px solid var(--line);
  background: var(--panel-subtle);
  overflow-wrap: anywhere;
}

/* Inline Paragraph Editor */
.para-editor-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.para-inline-editor {
  width: 100%;
  font-family: var(--font-prose);
  font-size: calc(17px * var(--scale, 1));
  line-height: 1.65;
  color: var(--fg);
  background: var(--panel);
  border: 1.5px solid var(--horst);
  padding: 10px 12px;
  resize: vertical;
  outline: none;
}
.para-editor-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-family: var(--font-ui);
  font-size: calc(13px * var(--scale, 1));
  color: var(--faint);
}
.para-editor-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.mini-btn {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--dim);
  font-family: var(--font-ui);
  font-size: calc(13px * var(--scale, 1));
  min-height: 28px;
  padding: 3px 10px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
}
.mini-btn:hover {
  color: var(--fg);
  border-color: var(--fg);
}

/* ---------- File Attachment Pills ---------- */
.file-attachments {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.file-pill {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--fg);
  font-family: var(--font-code);
  font-size: calc(13px * var(--scale, 1));
  min-height: 30px;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 140ms var(--ease), background-color 140ms var(--ease);
}
.file-pill:hover {
  border-color: var(--fg);
  background: var(--panel-subtle);
}
.file-pill.active {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}
.file-pill-badge {
  font-family: var(--font-ui);
  font-size: calc(12px * var(--scale, 1));
  opacity: 0.72;
}

.add-para-btn {
  appearance: none;
  background: transparent;
  border: 1px dashed var(--line-strong);
  color: var(--faint);
  font-family: var(--font-ui);
  font-size: calc(14px * var(--scale, 1));
  min-height: 38px;
  padding: 8px 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 150ms var(--ease), color 150ms var(--ease), background-color 150ms var(--ease);
}
.add-para-btn:hover {
  border-style: solid;
  border-color: var(--horst);
  color: var(--horst);
  background: var(--horst-bg);
}

/* ---------- Column 3: Code & Diff Inspector (Flush to Bottom) ---------- */
@keyframes codePaneIn {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

.col-code {
  height: 100%;
  min-height: 0;
  background: var(--code-bg);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  animation: codePaneIn 200ms var(--ease) both;
}

.code-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--bg);
  flex-shrink: 0;
}
.code-top-left, .code-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.code-path {
  font-family: var(--font-code);
  font-size: calc(13.5px * var(--scale, 1));
  font-weight: 600;
  color: var(--fg);
}
.code-lang {
  font-size: calc(12.5px * var(--scale, 1));
  color: var(--faint);
  border: 1px solid var(--line);
  padding: 1px 6px;
  background: var(--panel);
}

/* ---------- Code Reference Preview Card inside Plan Items ---------- */
.code-ref-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  background: var(--code-bg);
  cursor: pointer;
  margin-bottom: 4px;
  transition: border-color 140ms var(--ease);
}
.code-ref-card:hover {
  border-color: var(--horst);
}
.code-ref-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-subtle);
  font-family: var(--font-code);
  font-size: calc(12.5px * var(--scale, 1));
  color: var(--fg);
}
.code-ref-jump {
  font-family: var(--font-ui);
  font-size: calc(12px * var(--scale, 1));
  color: var(--horst);
  font-weight: 600;
}
.code-ref-pre {
  margin: 0;
  padding: 8px 12px;
  font-family: var(--font-code);
  font-size: calc(12.5px * var(--scale, 1));
  line-height: 1.5;
  overflow-x: auto;
  max-height: 140px;
  white-space: pre;
  color: var(--fg);
}

/* ---------- Floating Selection Context Menu in 3rd-Column File Viewer ---------- */
.code-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 0 0;
}
.code-sel-menu {
  position: sticky;
  top: 8px;
  left: 16px;
  z-index: 30;
  appearance: none;
  background: var(--horst);
  color: #FFFFFF;
  border: 0;
  font-family: var(--font-ui);
  font-size: calc(13px * var(--scale, 1));
  font-weight: 600;
  min-height: 32px;
  padding: 6px 14px;
  margin: 0 0 8px 16px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  transition: transform 140ms var(--ease);
}
.code-sel-menu:hover {
  transform: translateY(-1px);
}

.code-row-target {
  background: var(--horst-bg) !important;
}
.code-row-target .code-ln {
  color: var(--horst);
  font-weight: 700;
  opacity: 1;
  border-left: 3px solid var(--horst);
}

.code-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-code);
  font-size: calc(13px * var(--scale, 1));
  line-height: 1.55;
}
.code-table tr:hover {
  background: var(--panel-subtle);
}
.code-ln {
  width: 46px;
  padding: 0 12px 0 14px;
  text-align: right;
  color: var(--faint);
  user-select: none;
  vertical-align: top;
  opacity: 0.65;
}
.code-line {
  padding: 0 18px 0 8px;
  white-space: pre;
  color: var(--fg);
}

/* Diff line coloring */
.code-row-add { background: var(--diff-add-bg); }
.code-row-add .code-line,
.code-row-add .code-ln { color: var(--diff-add-fg); }

.code-row-del { background: var(--diff-del-bg); }
.code-row-del .code-line,
.code-row-del .code-ln { color: var(--diff-del-fg); }

.code-row-hunk { background: var(--panel-subtle); }
.code-row-hunk .code-line { color: var(--faint); font-weight: 600; }

/* Language syntax token coloring */
.tok-kw  { color: var(--syn-kw); font-weight: 600; }
.tok-str { color: var(--syn-str); }
.tok-com { color: var(--syn-com); font-style: italic; }
.tok-fn  { color: var(--syn-fn); }
.tok-num { color: var(--syn-num); }

.inline-field-input {
  width: 100%;
  background: var(--bg);
  color: var(--fg);
  border: 1.5px solid var(--fg);
  padding: 6px 10px;
  font: inherit;
  outline: none;
}

.empty-stage {
  padding: 48px 24px;
  text-align: center;
  color: var(--faint);
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .col-resizer { display: none !important; }
  .board.with-code {
    grid-template-columns: 230px minmax(0, 1fr);
  }
  .board.with-code .col-code {
    grid-column: 2;
    border-top: 2px solid var(--line-strong);
  }
}

@media (max-width: 820px) {
  .shell {
    height: auto;
    min-height: 100svh;
    overflow: visible;
  }
  .board, .board.with-code {
    grid-template-columns: 1fr;
  }
  .col-left { border-right: 0; }
  .board.mobile-detail .col-left { display: none; }
  .board:not(.mobile-detail) .col-doc,
  .board:not(.mobile-detail) .col-code { display: none; }
  .board.with-code .col-code { grid-column: 1; height: 70svh; }
  .mobile-back {
    display: flex !important;
    padding: 10px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
  }
  .doc-scroll, .doc-bar {
    padding-left: 18px;
    padding-right: 18px;
  }
}
