/* ─── Atlas · Landscaping Reports ──────────────────────────────────
   Editorial / enterprise tone. More whitespace, lighter chrome,
   a single muted forest accent. Reportable & calm.
*/
:root {
  /* Apple-clean palette: cool near-whites, refined ink scale, single subtle accent */
  --bg: #FBFBFD;            /* near-white, slightly cool */
  --bg-2: #F2F2F5;
  --bg-deep: #1D1D1F;       /* signature near-black */
  --surface: #FFFFFF;
  --surface-2: #FFFFFF;
  --ink: #1D1D1F;
  --ink-2: #424245;
  --ink-3: #6E6E73;
  --ink-4: #A1A1A6;
  --line: #E8E8ED;
  --line-2: #D2D2D7;
  --line-3: #B0B0B5;

  --accent: #1D1D1F;        /* primary actions = near-black, like Apple */
  --accent-2: #000000;
  --accent-tint: #ECECEF;
  --accent-tint-2: #D2D2D7;

  --success: #2C7A50;       /* refined green, used sparingly */
  --success-tint: #E4F1EA;
  --success-line: #BFD9CB;

  --warm: #A35E12;
  --warm-tint: #FBEFD8;
  --warm-line: #E5C68C;

  --rose: #94413A;
  --rose-tint: #F2DCDA;

  --ink-on-dark: #F5F5F7;
  --line-on-dark: #2C2C2E;

  --radius: 8px;
  --radius-lg: 14px;

  --shadow-soft: 0 1px 0 rgba(20,17,13,0.03);
  --shadow-lifted: 0 1px 0 rgba(20,17,13,0.04), 0 18px 40px -20px rgba(20,17,13,0.18);

  --serif: "Source Serif 4", "Source Serif Pro", "New York", "Charter", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ─── Dark mode ─────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg: #111113;
  --bg-2: #1C1C1E;
  --bg-deep: #000000;
  --surface: #1C1C1E;
  --surface-2: #2C2C2E;
  --ink: #F5F5F7;
  --ink-2: #C7C7CC;
  --ink-3: #8E8E93;
  --ink-4: #636366;
  --line: #2C2C2E;
  --line-2: #3A3A3C;
  --line-3: #48484A;
  --accent: #F5F5F7;
  --accent-2: #FFFFFF;
  --accent-tint: #2C2C2E;
  --accent-tint-2: #3A3A3C;
  --success: #32D74B;
  --success-tint: #0D2D17;
  --success-line: #1A4D2A;
  --warm: #FF9F0A;
  --warm-tint: #2D1F00;
  --warm-line: #4D3600;
  --rose: #FF453A;
  --rose-tint: #2D0D0B;
  --shadow-soft: 0 1px 0 rgba(0,0,0,0.3);
  --shadow-lifted: 0 1px 0 rgba(0,0,0,0.4), 0 18px 40px -20px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; color: inherit; }
a { color: inherit; }

/* ─── Shell ─────────────────────────────────────────────────────── */
.app { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }

.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 18px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
}
.brand .mark {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  display: grid; place-items: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0;
  flex-shrink: 0;
}
.brand .mark::after {
  content: ""; position: absolute; inset: 4px;
  border: 1px solid rgba(236,231,220,0.4);
  border-radius: 50%;
}
.brand .name {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.brand .org {
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  padding-left: 12px;
  margin-left: 2px;
  border-left: 1px solid var(--line-2);
}

.topbar .spacer { flex: 1; }

.topbar-actions {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px;
  color: var(--ink-3);
}
.topbar-actions .divider { width: 1px; height: 18px; background: var(--line-2); }
.topbar-actions .who {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink-2);
}
.topbar-actions .who .av {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  display: grid; place-items: center;
  font-size: 10px;
  font-weight: 600;
}

/* Document headline — a quiet header, not a big subbar */
.headline {
  padding: 38px 64px 24px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: end;
}
.headline .eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.headline h1 {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.018em;
  margin: 0;
  color: var(--ink);
  line-height: 1.1;
}
.headline .subtitle {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-3);
  font-size: 17px;
  margin-top: 6px;
  font-weight: 400;
}
.headline .doc-meta {
  text-align: right;
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--mono);
  line-height: 1.7;
}
.headline .doc-meta .id { color: var(--ink-2); }

/* Progress strip — minimal, just a thin reading bar */
.progress {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 64px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}
.progress .seg {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  cursor: pointer;
  position: relative;
  flex: 1;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s;
}
.progress .seg .ix {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-4);
}
.progress .seg .ttl {
  font-size: 13px;
  letter-spacing: -0.005em;
  color: var(--ink-3);
}
.progress .seg.done .ix { color: var(--success); }
.progress .seg.done .ttl { color: var(--ink-2); }
.progress .seg.active {
  border-bottom-color: var(--ink);
}
.progress .seg.active .ix { color: var(--ink); }
.progress .seg.active .ttl { color: var(--ink); font-weight: 500; }
.progress .seg.locked { cursor: not-allowed; }
.progress .seg.locked .ttl { color: var(--ink-4); }
.progress .seg .check {
  width: 14px; height: 14px;
  display: grid; place-items: center;
  color: var(--success);
  flex-shrink: 0;
}

/* Canvas */
.canvas {
  flex: 1;
  padding: 40px 64px 64px;
  overflow-y: auto;
}
.canvas-inner { max-width: 1320px; margin: 0 auto; }

/* ─── Primitives ────────────────────────────────────────────────── */
.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  transition: all .12s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-2); }
.btn.primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn.primary:hover { background: #000; }
.btn.accent {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn.accent:hover { background: var(--accent-2); }
.btn.ghost { border-color: var(--line-2); }
.btn.ghost:hover { background: var(--surface); border-color: var(--ink-4); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 5px; }
.btn.lg { height: 44px; padding: 0 22px; font-size: 14px; border-radius: 8px; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  font-weight: 500;
  border: 1px solid transparent;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.green  { background: var(--success-tint);  color: var(--success); border-color: var(--success-line); }
.pill.amber  { background: var(--warm-tint);     color: var(--warm);     border-color: var(--warm-line); }
.pill.gray   { background: var(--bg-2);          color: var(--ink-2);    border-color: var(--line-2); }
.pill.dark   { background: var(--ink);           color: var(--bg);       border-color: var(--ink); }
.pill.outline{ background: transparent;          color: var(--ink-2);    border-color: var(--line-2); }

.kbd {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 10.5px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--ink-2);
}

/* ─── Step 1 · Intake ───────────────────────────────────────────── */
.intake-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 48px;
  align-items: flex-start;
}

.section-h {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin: 0 0 4px;
}
.section-sub {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-3);
  font-size: 15px;
  margin: 0 0 24px;
}

/* report type — quieter cards, no grid frame */
.type-stack {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 36px;
}
.type-card {
  position: relative;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  padding: 16px 18px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  transition: all .12s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.type-card:hover { border-color: var(--line-3); background: var(--surface-2); }
.type-card.selected {
  border-color: var(--ink);
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--ink) inset;
}
.type-card .tc-row {
  display: flex; align-items: center; gap: 10px;
}
.type-card .tc-icon {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--bg-2);
  display: grid; place-items: center;
  color: var(--ink-2);
  flex-shrink: 0;
}
.type-card.selected .tc-icon {
  background: var(--ink); color: var(--bg);
}
.type-card .tc-title {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
}
.type-card .tc-desc {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.5;
}
.outline-understood {
  margin: 12px 0 16px;
}
.outline-understood-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.outline-understood ul {
  margin: 0;
  padding-left: 18px;
}
.outline-understood li {
  font-size: 14px;
  color: var(--ink-2);
  margin-bottom: 4px;
  line-height: 1.5;
}

/* The big brief composer — the centerpiece */
.brief {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 36px;
  overflow: hidden;
  position: relative;
}
.brief-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brief-head .label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.brief-head .word-count {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.brief-toolbar {
  display: flex;
  gap: 2px;
  align-items: center;
  margin-left: 10px;
}
.toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  border: none;
  background: transparent;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 11px;
  color: var(--ink-3);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.toolbar-btn:hover { background: var(--surface-3, #EBEBF0); color: var(--ink); }

.brief-editor {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  padding: 24px 28px 8px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  min-height: 280px;
  display: block;
}
.brief-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--ink-4);
  pointer-events: none;
}
.brief-editor ul, .brief-editor ol {
  padding-left: 1.4em;
}
.brief-editor ul { list-style: disc; }
.brief-editor ol { list-style: decimal; }

.brief-helper {
  padding: 0 28px 16px;
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.55;
}

.brief-foot {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 20px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.brief-foot .attach-row {
  display: flex; gap: 8px;
}
.brief-foot .attach-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--ink-2);
}
.brief-foot .attach-btn:hover { border-color: var(--ink-4); background: var(--surface-2); }

.attached-list {
  display: flex; flex-direction: column; gap: 6px;
}
.attached-file {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px 6px 8px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.attached-file .ic {
  width: 28px; height: 28px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--ink-3);
}
.attached-file .ic.pdf { color: #B23B36; }
.attached-file .ic.docx { color: #2E5B8E; }
.attached-file .ic.url { color: var(--ink-2); }
.attached-file .nm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.attached-file .sz {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
}
.attached-file .x {
  border: none; background: transparent;
  padding: 4px;
  color: var(--ink-3); border-radius: 4px;
  cursor: pointer;
  display: grid; place-items: center;
}
.attached-file .x:hover { color: var(--rose); background: var(--surface-2); }

/* parameters section — light inline form */
.params-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 28px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}
.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 6px;
  letter-spacing: -0.005em;
}
.input, .select, .textarea-sm {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--ink);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, .textarea-sm:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(20,17,13,0.06);
}

.format-row { display: flex; gap: 6px; flex-wrap: wrap; }
.format-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .12s;
}
.format-pill:hover { border-color: var(--ink-4); }
.format-pill .ext {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
}
.format-pill.selected {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}
.format-pill.selected .ext { color: var(--ink-4); }

/* Side rail */
.rail {
  display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 16px;
}
.rail-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
}
.rail-card .h {
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.rail-card .b {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.55;
  margin: 0 0 12px;
}
.rail-card .b:last-child { margin-bottom: 0; }

.tip-card {
  background: var(--bg-deep);
  color: var(--ink-on-dark);
  border-radius: 10px;
  padding: 18px 20px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.005em;
}
.tip-card .by {
  font-family: var(--mono);
  font-style: normal;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(236,231,220,0.55);
  margin-top: 12px;
}

/* Action bar */
.actionbar {
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, transparent 0%, var(--bg) 24%, var(--bg) 100%);
  padding: 24px 0 8px;
  margin-top: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
}
.actionbar .left { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 12.5px; }
.actionbar .right { display: flex; gap: 10px; }

/* ─── Step 2 · Scope review ─────────────────────────────────────── */
.scope-doc {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 36px 44px 32px;
  position: relative;
  margin-bottom: 24px;
}
.scope-doc::before {
  content: "";
  position: absolute;
  left: 0; top: 28px; bottom: 28px;
  width: 2px;
  background: var(--success);
  border-radius: 0 2px 2px 0;
}
.scope-doc .scope-h {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--success);
  margin-bottom: 6px;
}
.scope-doc .scope-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0 0 4px;
}
.scope-doc .scope-italic {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-3);
  font-size: 14px;
  margin-bottom: 28px;
}

.scope-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 36px;
  margin-bottom: 26px;
}
.scope-fields .scope-row {
  display: flex; flex-direction: column; gap: 4px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.scope-fields .scope-row.span2 { grid-column: 1 / -1; }
.scope-fields .scope-row .k {
  font-family: var(--mono);
  font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500;
}
.scope-fields .scope-row .v {
  font-size: 14px; color: var(--ink); font-weight: 400;
  line-height: 1.55;
}

.scope-doc h3.parsed-h {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 8px 0 12px;
}
.scope-doc ol.parsed-q,
.scope-doc ul.parsed-q {
  margin: 0; padding: 0 0 0 20px;
}
.scope-doc ul.parsed-q { list-style: disc; }
.scope-doc ol.parsed-q li,
.scope-doc ul.parsed-q li {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-2);
  margin-bottom: 8px;
  padding-left: 4px;
}
.scope-doc ul.parsed-fields {
  margin: 0; padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 24px;
}
.scope-doc ul.parsed-fields li {
  font-size: 13px;
  color: var(--ink-2);
  padding: 6px 0;
  border-top: 1px dashed var(--line);
}

/* Stage 2 — editable scope groups */
.scope-section-label {
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.scope-group {
  border-left: 2px solid var(--line-2);
  padding-left: 14px;
  margin-bottom: 20px;
}
.scope-theme-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 2px 4px;
  border-radius: 4px;
  margin-left: -4px;
}
.scope-theme-header:hover { background: var(--line); border-left: 2px solid var(--line-2); margin-left: -6px; padding-left: 2px; }
.scope-theme-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  border-bottom: 1px dashed transparent;
}
.scope-theme-label:hover { border-bottom-color: var(--line-2); }
.scope-theme-input {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line-2);
  outline: none;
  font-family: inherit;
  width: 160px;
}
.scope-theme-del {
  opacity: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-4);
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  transition: opacity 0.1s;
}
.scope-theme-header:hover .scope-theme-del { opacity: 1; }
.scope-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 4px;
  padding: 2px 4px;
  border-radius: 4px;
  margin-left: -4px;
}
.scope-row:hover { background: var(--bg-2); border-left: 3px solid var(--accent); margin-left: -7px; padding-left: 1px; }
.scope-row-num {
  font-size: 13px;
  color: var(--ink-4);
  min-width: 22px;
  padding-top: 2px;
  text-align: right;
  flex-shrink: 0;
  font-family: var(--mono);
}
.scope-input {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  padding: 1px 0;
  width: 100%;
  font-family: inherit;
  resize: none;
  outline: none;
  overflow: hidden;
  transition: border-color 0.15s;
}
.scope-input:focus { border-bottom-color: var(--line-2); }
.scope-row-del {
  flex-shrink: 0;
  opacity: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-4);
  font-size: 17px;
  line-height: 1;
  padding: 2px 2px;
  margin-top: 1px;
  transition: opacity 0.1s;
}
.scope-row:hover .scope-row-del { opacity: 1; }
.scope-add-btn {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--ink-4);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0;
  margin-top: 2px;
  transition: color 0.1s;
}
.scope-add-btn:hover { color: var(--ink-2); }

/* Stage 2 context banner */
.scope-context {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 20px;
  margin-bottom: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.scope-context-icon {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--surface);
  display: grid; place-items: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.scope-context-h {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 6px;
}
.scope-context-body {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
}

.review-stamp {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 16px;
  padding: 14px 18px;
  background: var(--success-tint);
  border: 1px solid var(--success-line);
  border-radius: 10px;
}
.review-stamp.rejected {
  background: var(--rose-tint, #FFF1F1);
  border-color: var(--rose-line, #FFCDD2);
}
.review-stamp .ic {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--success);
  color: white;
  display: grid; place-items: center;
}
.review-stamp.rejected .ic { background: var(--rose, #E0002A); }
.review-stamp .text {
  flex: 1;
  font-size: 13px;
  color: var(--success);
  line-height: 1.5;
}
.review-stamp.rejected .text { color: var(--rose, #E0002A); }
.review-stamp .text strong { color: var(--success); font-weight: 600; }
.review-stamp.rejected .text strong { color: var(--rose, #E0002A); }
.review-stamp .meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--success);
  opacity: 0.7;
}
.review-stamp.rejected .meta { color: var(--rose, #E0002A); }

/* ─── Step 3 · Outline (Apple-clean: summary + simple list) ─────── */
.outline-clean {
  max-width: 760px;
  margin: 0 auto;
}
.outline-intro {
  font-size: 14px;
  color: var(--ink-2);
  margin: 0 0 24px;
  line-height: 1.6;
}

/* Outline chat — closer to top, before the list */
.outline-chat-top {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 22px;
}
.outline-chat-top .av {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.outline-chat-top .body { flex: 1; min-width: 0; }
.outline-chat-top .h {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}
.outline-chat-top .s {
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 8px;
  line-height: 1.45;
}
.outline-chat-top textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  resize: none;
  padding: 10px 12px;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  min-height: 56px;
}
.outline-chat-top textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(29,29,31,0.06); }
.outline-capabilities {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-2);
}
.outline-capabilities summary {
  cursor: pointer;
  color: var(--ink-3);
  user-select: none;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.outline-capabilities summary::-webkit-details-marker { display: none; }
.outline-capabilities summary::before {
  content: "▸";
  font-size: 10px;
  transition: transform 0.15s;
}
.outline-capabilities[open] summary::before { transform: rotate(90deg); }
.outline-capabilities ul {
  margin: 6px 0 0 0;
  padding-left: 16px;
  line-height: 1.7;
}
.outline-chat-top .row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: var(--ink-3);
}

/* Brief fact-check card */
.outline-factcheck {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 12px;
  overflow: hidden;
}
.outline-factcheck .header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-1);
}
.outline-factcheck .header .label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.factcheck-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.factcheck-row:last-child { border-bottom: none; }
.factcheck-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}
.factcheck-badge.supported { background: #dcfce7; color: #166534; }
.factcheck-badge.notfound  { background: #fef9c3; color: #854d0e; }
[data-theme="dark"] .factcheck-badge.supported { background: #14532d; color: #86efac; }
[data-theme="dark"] .factcheck-badge.notfound  { background: #422006; color: #fde68a; }
.factcheck-claim { flex: 1; color: var(--ink-1); }
.factcheck-meta  { flex-shrink: 0; font-size: 11px; color: var(--ink-4); }

/* Clean numbered outline list */
.outline-list {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.outline-list .header {
  display: flex; align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.outline-list .header .label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.outline-list .header .right {
  margin-left: auto;
  display: flex; gap: 6px;
}
.outline-row {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 18px;
  padding: 18px 22px;
  align-items: flex-start;
  border-top: 1px solid var(--line);
  cursor: default;
}
.outline-row:first-child { border-top: none; }
.outline-row:hover { background: var(--bg); }
.outline-row .num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.04em;
  padding-top: 4px;
}
.outline-row .body { min-width: 0; }
.outline-row .ttl {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 4px;
  line-height: 1.3;
}
.outline-row .desc {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.55;
  margin: 0;
}
.outline-row .meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  white-space: nowrap;
  padding-top: 6px;
}

/* ─── Outline flag banners ──────────────────────────────────────── */
.outline-flag {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 12.5px;
  line-height: 1.5;
}
.outline-flag span { flex: 1; }
.outline-flag-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.outline-flag-undo {
  background: none;
  border: none;
  padding: 0 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.outline-flag-dismiss {
  background: none;
  border: none;
  padding: 0 4px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.5;
}
.outline-flag-dismiss:hover { opacity: 1; }

/* COVERAGE_GAP + OUT_OF_SCOPE — amber */
.outline-flag--coverage_gap,
.outline-flag--out_of_scope {
  background: var(--warm-tint);
  border: 1px solid var(--warm-line);
  color: var(--warm);
}
.outline-flag--coverage_gap .outline-flag-undo,
.outline-flag--out_of_scope .outline-flag-undo { color: var(--warm); }

/* SCOPE_DRIFT — blue/info (reuse success palette at lower opacity) */
.outline-flag--scope_drift {
  background: #EBF3FB;
  border: 1px solid #BDDAF5;
  color: #1A5C8A;
}
.outline-flag--scope_drift .outline-flag-undo { color: #1A5C8A; }

/* STRUCTURAL_WARNING — subtle gray */
.outline-flag--structural_warning {
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--ink-3);
}
.outline-flag--structural_warning .outline-flag-undo { color: var(--ink-2); }

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .outline-flag--scope_drift {
    background: #0D2A3D;
    border-color: #1E4E72;
    color: #7FC2F0;
  }
  .outline-flag--scope_drift .outline-flag-undo { color: #7FC2F0; }
}

/* ─── Home / Reports archive ────────────────────────────────────── */
.home-page {
  max-width: 1100px;
  margin: 0 auto;
}
.home-hero {
  display: flex; align-items: center; gap: 18px;
  padding: 6px 0 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
.home-hero .body { flex: 1; min-width: 0; }
.home-hero h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin: 0 0 4px;
}
.home-hero p {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-3);
  line-height: 1.5;
}

.home-h {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  margin: 0 0 12px;
  display: flex; align-items: center;
  gap: 10px;
}
.home-h .count {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10.5px;
  color: var(--ink-2);
  letter-spacing: 0;
}

.report-list {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.report-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 130px 130px auto;
  gap: 22px;
  padding: 18px 22px;
  align-items: center;
  border-top: 1px solid var(--line);
  transition: background .12s;
}
.report-row:first-child { border-top: none; }
.report-row:hover { background: var(--bg); }
.report-row .ttl {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--ink);
  line-height: 1.3;
  margin: 0 0 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.report-row .sub {
  font-size: 12px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.report-row .col {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}
.report-row .col .k {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
  display: block;
  margin-bottom: 2px;
}
.report-row .actions {
  display: flex; gap: 6px;
}

.empty-card {
  background: var(--surface-2);
  border: 1px dashed var(--line-2);
  border-radius: 14px;
  padding: 32px;
  text-align: center;
}
.empty-card h3 {
  font-family: var(--serif);
  font-size: 18px; font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  color: var(--ink);
}
.empty-card p {
  font-size: 13px;
  color: var(--ink-3);
  margin: 0 0 14px;
  line-height: 1.5;
}

.refresh-banner {
  background: var(--accent-tint);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--ink);
}
.refresh-banner .ic {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.refresh-banner .body { flex: 1; line-height: 1.5; }
.refresh-banner .body strong { color: var(--ink); font-weight: 600; }
.outline-page {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 48px;
  align-items: flex-start;
}
.outline-spine {
  position: sticky; top: 16px;
  display: flex; flex-direction: column;
  gap: 0;
}
.outline-spine .spine-h {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 14px;
  font-weight: 500;
}
.spine-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 10px 8px;
  align-items: flex-start;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
}
.spine-item:hover { background: var(--bg-2); }
.spine-item.active { background: var(--ink); color: var(--bg); }
.spine-item.active .ix { color: rgba(236,231,220,0.6); }
.spine-item .ix {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  padding-top: 2px;
}
.spine-item .nm {
  font-size: 13px;
  letter-spacing: -0.005em;
  line-height: 1.4;
}

.outline-stack { display: flex; flex-direction: column; gap: 14px; }

.outline-toolbar {
  display: flex; align-items: center; gap: 14px;
  padding: 6px 0 14px;
}
.outline-toolbar .stat {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink-3);
}
.outline-toolbar .stat strong { color: var(--ink); font-weight: 500; }

.chapter {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px 28px;
  position: relative;
  transition: border-color .15s;
}
.chapter:hover { border-color: var(--line-3); }
.chapter.editing { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; }
.chapter.approved {
  background: linear-gradient(0deg, var(--success-tint) 0%, var(--surface-2) 28%);
}
.chapter-head {
  display: flex; align-items: baseline; gap: 14px;
  margin-bottom: 8px;
}
.chapter-head .ix {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  font-weight: 500;
  flex-shrink: 0;
  width: 32px;
}
.chapter-head h3 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin: 0;
  flex: 1;
  line-height: 1.2;
}
.chapter-head .actions {
  display: flex; gap: 6px;
}
.chapter-head .actions .icbtn {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  display: grid; place-items: center;
  color: var(--ink-3);
  cursor: pointer;
  transition: all .12s;
}
.chapter-head .actions .icbtn:hover {
  background: var(--bg-2);
  color: var(--ink);
  border-color: var(--ink-4);
}
.chapter-head .actions .icbtn.approved {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.chapter-blurb {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-2);
  margin: 0 0 16px;
  padding-left: 46px;
}
.chapter-blurb em { color: var(--ink); font-style: italic; }

.chapter-meta {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-left: 46px;
  font-size: 11.5px;
  color: var(--ink-3);
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.chapter-meta .meta-item {
  display: inline-flex; align-items: center; gap: 6px;
}
.chapter-meta .meta-item .v { color: var(--ink-2); font-weight: 500; }
.chapter-meta .pill { font-family: var(--sans); letter-spacing: 0.04em; }

.chapter-edit {
  padding-left: 46px;
}
.chapter-edit .input-h {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--line-2);
  outline: none;
  background: transparent;
  padding: 0 0 6px;
  margin-bottom: 12px;
  letter-spacing: -0.012em;
  color: var(--ink);
}
.chapter-edit .input-h:focus { border-bottom-color: var(--ink); }
.chapter-edit textarea {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-2);
  resize: vertical;
  min-height: 80px;
  outline: none;
  background: var(--surface);
}
.chapter-edit textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(20,17,13,0.06); }
.chapter-edit .row {
  display: flex; gap: 8px; margin-top: 10px;
}

/* Outline chat — bottom dock */
.outline-dock {
  margin-top: 22px;
  background: var(--bg-deep);
  color: var(--ink-on-dark);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.outline-dock .av {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(236,231,220,0.08);
  border: 1px solid rgba(236,231,220,0.15);
  display: grid; place-items: center;
  color: var(--ink-on-dark);
  flex-shrink: 0;
}
.outline-dock textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink-on-dark);
  resize: none;
  font-size: 13.5px;
  font-family: var(--sans);
  min-height: 36px;
  padding: 4px 0;
  line-height: 1.5;
}
.outline-dock textarea::placeholder { color: rgba(236,231,220,0.5); }
.outline-dock .send {
  background: var(--ink-on-dark);
  color: var(--ink);
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
}
.outline-dock .send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Step 4 · Research console ─────────────────────────────────── */
.console-page {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 28px;
  align-items: flex-start;
}
.console-side {
  position: sticky; top: 16px;
  display: flex; flex-direction: column; gap: 18px;
}

.run-summary {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
}
.run-summary h3 {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}
.progress-ring {
  display: flex; align-items: center; gap: 14px;
}
.progress-ring .num {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.progress-ring .num .pct { font-size: 16px; color: var(--ink-3); margin-left: 2px; }
.progress-ring .text {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.5;
}
.progress-ring .text strong { color: var(--ink); font-weight: 500; }
.progress-bar-thin {
  height: 4px;
  background: var(--bg-2);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 14px;
}
.progress-bar-thin .fill {
  height: 100%;
  background: var(--success);
  transition: width .3s ease;
}

.agent-list { display: flex; flex-direction: column; gap: 6px; }
.agent-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 10px;
  padding: 10px 12px;
  align-items: center;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.agent-row .ic {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--ink-3);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.agent-row.running .ic { background: var(--ink); color: var(--bg); }
.agent-row.done .ic { background: var(--success); color: white; }
.agent-row.queued { opacity: 0.55; }
.agent-row .nm { font-size: 13px; font-weight: 500; line-height: 1.3; letter-spacing: -0.005em; }
.agent-row .sub { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.agent-row .pct {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.agent-row.done .pct { color: var(--success); }

.console {
  background: #0E1A14;
  color: #C5BDA8;
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.75;
  padding: 22px 24px;
  height: 600px;
  overflow-y: auto;
  border: 1px solid #1E2E24;
  position: relative;
}
.console-head {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px;
  border-radius: 12px 12px 0 0;
  background: #121D17;
  border: 1px solid #1E2E24;
  border-bottom: none;
  font-family: var(--mono);
  font-size: 11px;
  color: #7A8E82;
}
.console-head .live {
  display: inline-flex; align-items: center; gap: 6px;
  color: #C9A660;
}
.console-head .live .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #B08A3E;
  box-shadow: 0 0 0 0 rgba(176,138,62,0.6);
  animation: pulseRing 1.4s ease-out infinite;
}
@keyframes pulseRing {
  0%   { box-shadow: 0 0 0 0 rgba(176,138,62,0.5); }
  100% { box-shadow: 0 0 0 8px rgba(176,138,62,0); }
}
.console-wrap .console { border-radius: 0 0 12px 12px; }

.console .line { white-space: pre-wrap; }
.console .agent-name { color: #6BAD84; font-weight: 600; letter-spacing: 0.04em; }
.console .ok { color: #6BAD84; }
.console .info { color: #8A9E90; }
.console .warn { color: #B08A3E; }
.console .heavy { color: #EFE7D6; font-weight: 600; }
.console .rule { color: #1C2E22; letter-spacing: 0.04em; }
.console .cursor::after { content: "▍"; color: #B08A3E; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.console::-webkit-scrollbar { width: 8px; }
.console::-webkit-scrollbar-thumb { background: #1E3028; border-radius: 4px; }
.console::-webkit-scrollbar-track { background: transparent; }

/* ─── Step 5 · Draft review ─────────────────────────────────────── */
.draft-grid {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 320px;
  gap: 36px;
  align-items: flex-start;
}
.toc-side {
  position: sticky; top: 16px;
}
.toc-side .toc-title {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 14px;
  font-weight: 500;
}
.toc-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--ink-2);
  border-radius: 6px;
  cursor: pointer;
  align-items: center;
}
.toc-item:hover { background: var(--bg-2); }
.toc-item.active { background: var(--ink); color: var(--bg); }
.toc-item.active .tn { color: rgba(236,231,220,0.5); }
.toc-item .tn { font-family: var(--mono); font-size: 11px; color: var(--ink-4); }
.toc-item .tdot { width: 6px; height: 6px; border-radius: 50%; background: var(--warm); }

.doc {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 56px 64px 64px;
  min-height: 700px;
  font-family: var(--serif);
  color: var(--ink);
  line-height: 1.7;
  font-size: 16px;
}
.doc .doc-meta {
  font-family: var(--mono);
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.doc h1 {
  font-family: var(--serif);
  font-size: 34px; font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 4px;
  line-height: 1.1;
}
.doc .subtitle {
  font-style: italic;
  color: var(--ink-3);
  font-size: 16px;
  margin-bottom: 36px;
  font-weight: 400;
}
.doc h2 {
  font-family: var(--serif);
  font-size: 22px; font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin: 36px 0 12px;
  display: flex; align-items: baseline; gap: 14px;
}
.doc h2 .hnum {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 500;
  letter-spacing: 0.14em;
}
.doc h3 {
  font-family: var(--serif);
  font-size: 17px; font-weight: 500;
  color: var(--ink);
  margin: 24px 0 6px;
  letter-spacing: -0.005em;
}
.doc p { margin: 0 0 14px; }
.doc ul, .doc ol { margin: 0 0 14px; padding-left: 22px; }
.doc li { margin-bottom: 6px; }

.doc-section { position: relative; padding: 8px 14px; margin: 0 -14px; border-radius: 6px; transition: background .15s; cursor: text; }
.doc-section.commented { background: var(--warm-tint); }
.doc-section:hover .add-comment { opacity: 1; }
.doc-section .add-comment {
  position: absolute; right: -36px; top: 8px;
  opacity: 0;
  background: var(--ink); color: var(--bg);
  border: none; border-radius: 50%;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  transition: opacity .15s;
  cursor: pointer;
}

/* Draft content typography */
.draft-content h1 {
  font-family: var(--serif);
  font-size: 32px; font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 8px;
  line-height: 1.15;
  scroll-margin-top: 88px;
}
.draft-content h2 {
  font-family: var(--serif);
  font-size: 22px; font-weight: 500;
  letter-spacing: -0.012em;
  color: var(--ink);
  margin: 40px 0 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
  scroll-margin-top: 88px;
}
.draft-content h3 {
  font-family: var(--serif);
  font-size: 17px; font-weight: 500;
  color: var(--ink);
  margin: 24px 0 6px;
  letter-spacing: -0.005em;
  scroll-margin-top: 88px;
}
.draft-content p { margin: 0 0 14px; }
.draft-content ul, .draft-content ol { margin: 0 0 14px; padding-left: 22px; }
.draft-content li { margin-bottom: 6px; }
.draft-content table {
  border-collapse: collapse;
  font-size: 14px;
  display: block;
  overflow-x: auto;
}
.draft-content th, .draft-content td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
  word-break: normal;
}
.draft-content th {
  background: var(--bg-2);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.report-preview table { width: 100%; }
.report-preview th { text-transform: uppercase; letter-spacing: 0.04em; font-size: 12px; }

.cite {
  display: inline-flex; align-items: center;
  background: var(--bg-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 3px;
  margin: 0 1px;
  vertical-align: 1px;
  border: 1px solid var(--line-2);
  cursor: pointer;
}
.doc-link {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line-2);
}

/* Comments rail */
.comments-rail {
  position: sticky; top: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.comment-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 12.5px;
  position: relative;
}
.comment-card.user { border-left: 3px solid var(--warm); }
.comment-card.agent { border-left: 3px solid var(--success); }
.comment-card .author {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 12.5px;
  margin-bottom: 4px;
  color: var(--ink);
}
.comment-card .author .av {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  display: grid; place-items: center;
  font-size: 10px;
  font-weight: 600;
}
.comment-card .author .av.agent { background: var(--success); }
.comment-card .author .time { color: var(--ink-4); font-weight: 400; font-size: 11px; margin-left: auto; }
.comment-card .target {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  background: var(--bg-2);
  border-radius: 4px;
  padding: 2px 6px;
  display: inline-block;
  margin-bottom: 6px;
}
.comment-card p { margin: 0 0 6px; line-height: 1.55; color: var(--ink-2); }
.comment-card .row { display: flex; gap: 6px; margin-top: 8px; }
.comment-card .status-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ink-3); margin-top: 6px; }

.comment-input {
  background: var(--bg-deep);
  color: var(--ink-on-dark);
  border-radius: 10px;
  padding: 10px 12px;
}
.comment-input textarea {
  width: 100%; border: none; background: transparent; outline: none;
  resize: none; min-height: 56px;
  font-size: 13px;
  font-family: var(--sans);
  color: var(--ink-on-dark);
}
.comment-input textarea::placeholder { color: rgba(236,231,220,0.5); }
.comment-input .row { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.comment-input .targeting { font-family: var(--mono); font-size: 10.5px; color: rgba(236,231,220,0.6); }
.comment-input .send {
  background: var(--ink-on-dark); color: var(--ink);
  border: none; padding: 5px 10px; border-radius: 5px;
  font-size: 11.5px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
}
.comment-input .send:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Step 6 · Delivery ─────────────────────────────────────────── */
.delivery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  max-width: 640px;
}
.delivery .preview-pane {
  background: var(--bg-deep);
  border-radius: 14px;
  padding: 48px;
  display: grid;
  place-items: center;
  min-height: 520px;
}
.doc-preview-card {
  width: 380px;
  aspect-ratio: 8.5 / 11;
  background: white;
  box-shadow: var(--shadow-lifted);
  border-radius: 4px;
  padding: 36px 40px;
  font-family: var(--serif);
  font-size: 9px;
  line-height: 1.55;
  color: var(--ink);
  position: relative;
  overflow: hidden;
}
.doc-preview-card .pp-eye { font-family: var(--mono); font-size: 7.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3); }
.doc-preview-card .pp-h { font-size: 16px; font-weight: 500; color: var(--ink); letter-spacing: -0.015em; line-height: 1.15; margin-top: 6px; }
.doc-preview-card .pp-it { font-style: italic; color: var(--ink-3); font-size: 9px; margin-top: 4px; }
.doc-preview-card .pp-line { height: 4px; background: var(--bg-2); border-radius: 2px; margin: 4px 0; }
.doc-preview-card .pp-line.short { width: 40%; }
.doc-preview-card .pp-line.med { width: 70%; }
.doc-preview-card .pp-h2 { font-size: 11px; font-weight: 600; color: var(--ink); margin: 14px 0 6px; }
.doc-preview-card .pp-foot {
  position: absolute; bottom: 14px; left: 40px; right: 40px;
  font-family: var(--mono); font-size: 7px; color: var(--ink-3);
  letter-spacing: 0.16em; display: flex; justify-content: space-between;
}

.delivery-files { display: flex; flex-direction: column; gap: 10px; }
.file-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color .12s;
}
.file-row:hover { border-color: var(--line-3); }
.file-row .ic {
  width: 38px; height: 38px;
  border-radius: 7px;
  background: var(--bg-2);
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.04em;
}
.file-row .ic.pptx { background: #F4E2D0; color: #A35718; }
.file-row .ic.pdf  { background: #F2D4D2; color: #973531; }
.file-row .ic.docx { background: #D5E0EE; color: #2A557F; }
.file-row .ic.md   { background: #E5E1D5; color: var(--ink-2); }
.file-row .meta { flex: 1; min-width: 0; }
.file-row .meta .nm {
  font-weight: 500; font-size: 13.5px; color: var(--ink);
  letter-spacing: -0.005em;
  display: flex; align-items: center; gap: 8px;
}
.file-row .meta .sz {
  font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-top: 2px;
}

.summary-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px 22px;
  margin-top: 14px;
}
.summary-card h3 {
  font-family: var(--serif);
  font-size: 16px; font-weight: 500; margin: 0 0 14px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.summary-row {
  display: flex; justify-content: space-between;
  padding: 8px 0;
  font-size: 12.5px;
  border-top: 1px solid var(--line);
}
.summary-row:first-of-type { border-top: none; padding-top: 0; }
.summary-row .k { color: var(--ink-3); font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; }
.summary-row .v { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ─── Topbar user dropdown ──────────────────────────────────────── */
.user-menu { position: relative; }
.user-menu-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: none; cursor: pointer;
  color: var(--ink-2); font-size: 12.5px; padding: 4px 6px;
  border-radius: var(--radius); transition: background 0.15s;
}
.user-menu-btn:hover { background: var(--accent-tint); }
.user-menu-btn .av {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--ink); color: var(--bg);
  display: grid; place-items: center;
  font-size: 10px; font-weight: 600; flex-shrink: 0;
}
.user-menu-btn .chevron { color: var(--ink-4); transition: transform 0.2s; }
.user-menu-btn.open .chevron { transform: rotate(180deg); }
.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 220px; background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lifted); z-index: 500;
  overflow: hidden; animation: dropIn 0.15s ease;
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.user-dropdown-header {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
}
.user-dropdown-header .name { font-weight: 600; font-size: 13px; color: var(--ink); }
.user-dropdown-header .email { font-size: 11px; color: var(--ink-4); margin-top: 1px; font-family: var(--mono); }
.user-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; font-size: 13px; color: var(--ink-2);
  cursor: pointer; transition: background 0.12s; background: none; border: none; width: 100%; text-align: left;
}
.user-dropdown-item:hover { background: var(--accent-tint); }
.user-dropdown-item.danger { color: var(--rose); }
.user-dropdown-divider { height: 1px; background: var(--line); margin: 4px 0; }

/* ─── Settings modal ────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 800; backdrop-filter: blur(3px);
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lifted);
  width: 640px; max-width: calc(100vw - 48px);
  max-height: calc(100vh - 80px); display: flex; flex-direction: column;
  animation: slideUp 0.18s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 0; flex-shrink: 0;
}
.modal-header h2 { font-family: var(--serif); font-size: 18px; font-weight: 500; margin: 0; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--ink-4); padding: 4px; border-radius: 6px; display: flex; }
.modal-close:hover { color: var(--ink); background: var(--accent-tint); }
.modal-tabs {
  display: flex; gap: 0; padding: 16px 24px 0; border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.modal-tab {
  padding: 8px 14px; font-size: 12.5px; color: var(--ink-3);
  border: none; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color 0.15s;
}
.modal-tab:hover { color: var(--ink); }
.modal-tab.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 10px; flex-shrink: 0;
}

/* settings rows */
.setting-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 24px; padding: 14px 0; border-bottom: 1px solid var(--line);
}
.setting-row:last-child { border-bottom: none; }
.setting-row .lbl { font-size: 13.5px; color: var(--ink); font-weight: 500; }
.setting-row .sub { font-size: 12px; color: var(--ink-4); margin-top: 2px; }
.setting-section-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-4); margin: 20px 0 8px;
}
.setting-section-label:first-child { margin-top: 0; }

/* theme toggle pills */
.theme-pills { display: flex; gap: 6px; }
.theme-pill {
  padding: 5px 12px; font-size: 12px; border-radius: 20px;
  border: 1px solid var(--line-2); background: var(--bg-2);
  color: var(--ink-3); cursor: pointer; transition: all 0.15s;
}
.theme-pill.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: 8px; }
.toggle {
  width: 36px; height: 20px; border-radius: 10px;
  background: var(--line-2); border: none; cursor: pointer;
  position: relative; transition: background 0.2s; flex-shrink: 0;
}
.toggle.on { background: var(--ink); }
.toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: white; transition: transform 0.2s;
}
.toggle.on::after { transform: translateX(16px); }

/* ─── Onboarding ────────────────────────────────────────────────── */
.onboard-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 40px 24px;
}
.onboard-card {
  width: 480px; max-width: 100%;
}
.onboard-logo { margin-bottom: 32px; }
.onboard-step-label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-4); margin-bottom: 6px;
}
.onboard-title { font-family: var(--serif); font-size: 26px; font-weight: 500; color: var(--ink); margin: 0 0 6px; letter-spacing: -0.015em; }
.onboard-sub { font-size: 13.5px; color: var(--ink-3); margin: 0 0 32px; line-height: 1.55; }
.onboard-field { margin-bottom: 18px; }
.onboard-field label { display: block; font-size: 12px; font-weight: 500; color: var(--ink-3); margin-bottom: 5px; letter-spacing: 0.02em; }
.onboard-field input, .onboard-field select {
  width: 100%; padding: 9px 12px; font-size: 14px;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  outline: none; transition: border-color 0.15s;
}
.onboard-field input:focus, .onboard-field select:focus { border-color: var(--ink); }
.onboard-field .hint { font-size: 11.5px; color: var(--ink-4); margin-top: 4px; }
.onboard-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.onboard-progress { display: flex; gap: 6px; margin-bottom: 28px; }
.onboard-progress-dot {
  height: 3px; flex: 1; border-radius: 2px; background: var(--line-2);
  transition: background 0.3s;
}
.onboard-progress-dot.done { background: var(--ink); }

/* auth page split */
.auth-page {
  min-height: 100vh; display: flex;
}
.auth-left {
  width: 440px; flex-shrink: 0; background: var(--bg-deep);
  display: flex; flex-direction: column; align-items: flex-start;
  justify-content: space-between; padding: 48px;
  color: var(--ink-on-dark);
}
.auth-left .quote {
  font-family: var(--serif); font-size: 22px; font-weight: 400;
  line-height: 1.5; color: rgba(245,245,247,0.85); margin-top: auto; margin-bottom: 24px;
}
.auth-left .quote-attr { font-size: 12px; color: rgba(245,245,247,0.4); font-family: var(--mono); }
.auth-right {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 48px;
  background: var(--bg);
}
.auth-tabs { display: flex; gap: 0; margin-bottom: 32px; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; }
.auth-tab {
  flex: 1; padding: 8px 20px; font-size: 13px; font-weight: 500;
  border: none; background: none; cursor: pointer; color: var(--ink-3);
  transition: all 0.15s;
}
.auth-tab.active { background: var(--ink); color: var(--bg); }
.auth-card { width: 360px; max-width: 100%; }
.auth-title { font-family: var(--serif); font-size: 26px; font-weight: 500; margin: 0 0 6px; letter-spacing: -0.015em; }
.auth-sub { font-size: 13.5px; color: var(--ink-3); margin: 0 0 28px; line-height: 1.55; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-divider span { font-size: 11px; color: var(--ink-4); font-family: var(--mono); }
.auth-google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 10px 20px; font-size: 14px; font-weight: 500;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); cursor: pointer;
  text-decoration: none; transition: background 0.15s, border-color 0.15s;
}
.auth-google-btn:hover { background: var(--bg-2); border-color: var(--line-3); }
.auth-field { margin-bottom: 20px; }
.auth-field label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); margin-bottom: 8px; }
.auth-field input { width: 100%; padding: 10px 14px; font-size: 14px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--bg); color: var(--ink); transition: border-color 0.15s; }
.auth-field input:focus { outline: none; border-color: var(--ink-2); }
.auth-submit-btn { width: 100%; padding: 10px 20px; font-size: 14px; font-weight: 600; border: none; border-radius: var(--radius); background: var(--ink); color: var(--bg); cursor: pointer; transition: opacity 0.15s; }
.auth-submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-error { font-size: 12px; color: #E03E3E; margin-bottom: 16px; line-height: 1.4; }
.auth-back-btn { display: block; width: 100%; margin-top: 16px; background: none; border: none; font-size: 12px; color: var(--ink-4); cursor: pointer; text-decoration: underline; }

/* ── Undo toast ─────────────────────────────────────────────────────────── */
.undo-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--surface);
  padding: 10px 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  z-index: 1000;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  white-space: nowrap;
  animation: toast-in 0.18s ease;
}
.undo-toast button {
  background: none;
  border: 1px solid rgba(128,128,128,0.4);
  color: inherit;
  cursor: pointer;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--mono);
  transition: background 0.1s;
}
.undo-toast button:hover { background: rgba(128,128,128,0.2); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
