/* RFP Desk — one stylesheet, no build step. Colors are tokens; dark mode re-steps them. */
:root {
  color-scheme: light;
  --bg: #f5f6f8; --surface: #ffffff; --surface-2: #f0f2f5; --border: #dfe3e8; --border-strong: #c5ccd5;
  --text: #0f1720; --text-2: #4b5563; --text-3: #6b7280;
  --navy: #0b1f3a; --accent: #1454b8; --accent-soft: #e6eefb; --accent-text: #ffffff;
  --good: #0a7d0a; --good-soft: #e5f4e5; --warn: #9a6200; --warn-soft: #fdf3dc; --bad: #c0302f; --bad-soft: #fbe6e6;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4; --series-6: #008300;
  --grid: #e9ecf0; --shadow: 0 1px 2px rgba(15,23,32,.06), 0 1px 1px rgba(15,23,32,.04);
  --radius: 8px; --sidebar: 232px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121416; --surface: #1a1c1f; --surface-2: #23262a; --border: #2e3237; --border-strong: #41464d;
    --text: #eef0f2; --text-2: #b7bcc3; --text-3: #8d939b;
    --navy: #0b1f3a; --accent: #5b9bf0; --accent-soft: #1c2a40; --accent-text: #0b1220;
    --good: #4cc24c; --good-soft: #17301a; --warn: #f2b84b; --warn-soft: #33290f; --bad: #f07a79; --bad-soft: #3a1c1c;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; --series-6: #008300;
    --grid: #2a2e33; --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121416; --surface: #1a1c1f; --surface-2: #23262a; --border: #2e3237; --border-strong: #41464d;
  --text: #eef0f2; --text-2: #b7bcc3; --text-3: #8d939b;
  --accent: #5b9bf0; --accent-soft: #1c2a40; --accent-text: #0b1220;
  --good: #4cc24c; --good-soft: #17301a; --warn: #f2b84b; --warn-soft: #33290f; --bad: #f07a79; --bad-soft: #3a1c1c;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; --series-6: #008300;
  --grid: #2a2e33; --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; line-height: 1.25; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; }
p { margin: 0 0 10px; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

/* Shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); flex: none; background: var(--navy); color: #c9d4e5; padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 15px; padding: 4px 8px 16px; }
.brand-mark { width: 30px; height: 30px; border-radius: 7px; background: #1454b8; display: grid; place-items: center; }
.brand small { display: block; font-weight: 400; color: #8ea3c4; font-size: 11px; }
.nav-group { margin-top: 14px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #7f93b4; padding: 0 10px 4px; }
.nav a { display: flex; align-items: center; gap: 9px; color: #d6deea; padding: 7px 10px; border-radius: 6px; font-size: 13.5px; }
.nav a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.13); color: #fff; }
.nav svg { width: 16px; height: 16px; flex: none; opacity: .85; }
.nav .count { margin-left: auto; font-size: 11px; background: rgba(255,255,255,.14); padding: 0 6px; border-radius: 9px; }
.main { flex: 1; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.topbar form.search { flex: 1; max-width: 520px; }
.topbar input[type=search] { width: 100%; }
.topbar .who { margin-left: auto; color: var(--text-2); font-size: 13px; display: flex; gap: 12px; align-items: center; }
.menu-btn { display: none; }
.content { padding: 22px 24px 60px; max-width: 1400px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-2); margin-top: 4px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: 12.5px; color: var(--text-3); margin-bottom: 4px; }

/* Cards & grids */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .grid > * + .card { margin-top: 0; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.builder-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.layout-side { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.stack > * + * { margin-top: 16px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Stat tiles */
.stat { padding: 14px 16px; }
.stat .label { color: var(--text-2); font-size: 12.5px; }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .hint { color: var(--text-3); font-size: 12px; }

/* Forms */
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
label .opt { font-weight: 400; color: var(--text-3); }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=date],
input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 7px 10px; min-height: 36px;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
textarea.long { min-height: 220px; }
textarea.editor { min-height: 260px; font-size: 14.5px; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.field { margin-bottom: 14px; }
.field .help { color: var(--text-3); font-size: 12px; margin-top: 3px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.check input { width: 16px; height: 16px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 2px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; }
.errors { background: var(--bad-soft); color: var(--bad); border-radius: 6px; padding: 10px 14px; margin-bottom: 14px; }
.errors ul { margin: 0; padding-left: 18px; }
.flash { background: var(--good-soft); color: var(--good); border-radius: 6px; padding: 10px 14px; margin-bottom: 16px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 600; font-size: 13.5px; border-radius: 6px;
  padding: 7px 13px; min-height: 34px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 3px 9px; min-height: 28px; font-size: 12.5px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn svg { width: 15px; height: 15px; }
.inline { display: inline; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.linkish.danger { color: var(--bad); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em;
  padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Pills & badges */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.pill.blue { background: var(--accent-soft); color: var(--accent); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill svg { width: 12px; height: 12px; }
.tag { display: inline-block; font-size: 11.5px; padding: 0 7px; border-radius: 4px; background: var(--surface-2); color: var(--text-2); margin: 1px 2px 1px 0; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--text-2); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* Key/value lists */
dl.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 7px 14px; margin: 0; }
dl.kv dt { color: var(--text-2); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Progress */
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; background: var(--series-1); border-radius: 3px; }

/* Deadlines list */
.deadline { display: flex; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); }
.deadline:last-child { border-bottom: 0; }
.datebox { width: 46px; flex: none; text-align: center; border: 1px solid var(--border); border-radius: 6px; padding: 2px 0; background: var(--surface); }
.datebox .m { font-size: 10.5px; text-transform: uppercase; color: var(--bad); font-weight: 700; }
.datebox .d { font-size: 18px; font-weight: 700; line-height: 1.1; }
.deadline .what { min-width: 0; flex: 1; }
.deadline .what .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Drop zone */
.dropzone { border: 2px dashed var(--border-strong); border-radius: 12px; padding: 34px 20px; text-align: center; background: var(--surface);
  transition: border-color .15s, background .15s; cursor: pointer; }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 40px; height: 40px; color: var(--accent); }
.dropzone .big { font-size: 17px; font-weight: 700; margin: 8px 0 4px; }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.mode-pick label { display: flex; gap: 10px; border: 1px solid var(--border-strong); border-radius: 10px; padding: 14px; cursor: pointer; font-weight: 400; background: var(--surface); }
.mode-pick label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); background: var(--accent-soft); }
.mode-pick strong { display: block; }

/* Build next: drop a document on an idea; fields the AI filled stay marked until edited */
.dropzone:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.idea-drop { margin-bottom: 14px; }
.idea-drop .dropzone { padding: 16px; }
.read-status { display: flex; gap: 8px; align-items: flex-start; border-radius: 6px; padding: 10px 14px; margin-bottom: 16px; background: var(--accent-soft); color: var(--text); }
.read-status svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; color: var(--accent); }
.read-status.busy svg { animation: read-pulse 1.4s ease-in-out infinite; }
.read-status.warn { background: var(--warn-soft); color: var(--warn); }
.read-status.bad { background: var(--bad-soft); color: var(--bad); }
.read-status.warn svg, .read-status.bad svg { color: currentColor; }
.read-status .more { display: block; color: var(--text-2); font-size: 12.5px; margin-top: 2px; }
@keyframes read-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .read-status.busy svg { animation: none; } }
.field.ai-filled input, .field.ai-filled textarea, .field.ai-filled select { border-color: var(--accent); background: var(--accent-soft); }
.field.ai-filled > label::after { content: 'AI'; margin-left: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .03em; color: var(--accent);
  background: var(--accent-soft); border-radius: 8px; padding: 1px 6px; vertical-align: 1px; }

/* Flow diagram (how dropping a file works) */
.flow { display: flex; align-items: stretch; gap: 0; flex-wrap: wrap; }
.flow .step { flex: 1; min-width: 140px; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; }
.flow .step b { display: block; font-size: 13px; }
.flow .arrow { display: grid; place-items: center; width: 26px; color: var(--text-3); }

/* Builder */
.section-card { scroll-margin-top: 70px; }
.section-card .head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.section-card .ref { font-family: var(--mono); font-size: 12px; color: var(--text-3); }
.section-card .ask { background: var(--surface-2); border-left: 3px solid var(--border-strong); padding: 8px 12px; border-radius: 0 6px 6px 0; margin: 10px 0; color: var(--text-2); white-space: pre-wrap; }
.section-card .meta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
.toc a { display: flex; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 5px; color: var(--text); font-size: 13px; }
.toc a:hover { background: var(--surface-2); text-decoration: none; }
.toc .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--border-strong); }
.toc .dot.drafting { background: var(--series-4); } .toc .dot.review { background: var(--series-1); } .toc .dot.final { background: var(--good); }
.panel { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow-y: auto; }
.match { border: 1px solid var(--border); border-radius: 6px; padding: 9px 11px; margin-bottom: 8px; background: var(--surface); }
.match .t { font-weight: 600; font-size: 13px; }
.match .x { font-size: 12.5px; color: var(--text-2); max-height: 4.6em; overflow: hidden; }
.verify { background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: 8px 12px; font-size: 13px; margin-top: 8px; }
.verify ul { margin: 4px 0 0; padding-left: 18px; }
.saving { font-size: 12px; color: var(--text-3); }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.cal .dow { font-size: 11.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; padding: 6px 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal .day { min-height: 108px; padding: 4px 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); }
.cal .day.out { background: var(--surface-2); color: var(--text-3); }
.cal .day.today .n { background: var(--accent); color: var(--accent-text); border-radius: 10px; padding: 0 6px; }
.cal .n { font-size: 12px; font-weight: 700; display: inline-block; }
.cal .ev { display: block; font-size: 11.5px; line-height: 1.35; padding: 2px 5px; border-radius: 4px; margin-top: 3px; background: var(--accent-soft); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .ev.due_at { background: var(--bad-soft); }
.cal .ev.questions_due_at, .cal .ev.prebid_at { background: var(--warn-soft); }
.cal .ev.award_expected_at, .cal .ev.renewal_at { background: var(--good-soft); }
.cal .ev.document { background: var(--surface-2); }
.cal .ev.task, .cal .ev.meeting { background: var(--accent-soft); outline: 1px dashed var(--accent); outline-offset: -1px; }

/* Charts (server-rendered HTML/SVG) */
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--text-2); margin-bottom: 10px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.hbars { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; gap: 8px 12px; align-items: center; font-size: 13px; }
.hbars .lbl { color: var(--text-2); white-space: nowrap; }
.hbars .val { font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.hbars .track { height: 14px; display: flex; gap: 2px; }
.hbars .seg { height: 100%; min-width: 2px; }
.hbars .seg:first-child { border-radius: 0; }
.hbars .seg:last-child { border-radius: 0 4px 4px 0; }
.vchart { position: relative; }
.vchart svg { width: 100%; height: auto; display: block; overflow: visible; }
.vchart text { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.vchart .gridline { stroke: var(--grid); stroke-width: 1; }
.vchart .axis { stroke: var(--border-strong); stroke-width: 1; }
.vchart rect.hit { fill: transparent; }
.vchart g.col:hover rect.mark { filter: brightness(1.08); }
.vchart g.col:hover rect.hit { fill: var(--surface-2); opacity: .5; }
.c1 { background: var(--series-1); fill: var(--series-1); }
.c2 { background: var(--series-2); fill: var(--series-2); }
.c3 { background: var(--series-3); fill: var(--series-3); }
.c4 { background: var(--series-4); fill: var(--series-4); }
.c5 { background: var(--series-5); fill: var(--series-5); }
.c6 { background: var(--series-6); fill: var(--series-6); }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 7px 10px; font-size: 12.5px; box-shadow: 0 4px 14px rgba(0,0,0,.14); max-width: 280px; white-space: pre-line; display: none; }
details.table-view summary { cursor: pointer; color: var(--text-2); font-size: 12.5px; margin-top: 10px; }
details.table-view table { margin-top: 8px; font-size: 12.5px; }

/* Assistant chat */
.chat { max-height: 520px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 2px; }
.msg .who { font-size: 11.5px; color: var(--text-3); margin-bottom: 2px; }
.msg .bubble { border-radius: 10px; padding: 8px 11px; font-size: 13.5px; }
.msg.me { align-self: flex-end; max-width: 92%; text-align: right; }
.msg.me .bubble { background: var(--accent); color: var(--accent-text); text-align: left; }
.msg.ai { align-self: flex-start; max-width: 100%; }
.msg.ai .bubble { background: var(--surface-2); }
.msg.ai .bubble.failed { background: var(--bad-soft); color: var(--bad); }
.changes { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.change { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: 13px; padding: 3px 0; }
.change input { margin-top: 3px; flex: none; }
.changes-done { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 6px; font-size: 12.5px; }
.typing i { display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite both; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* Lead board */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.board-col { background: var(--surface-2); border-radius: var(--radius); padding: 8px; min-height: 260px; display: flex; flex-direction: column; }
.board-col.over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.board-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; padding: 2px 4px 8px; font-size: 13px; }
.board-cards { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.board-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 7px; padding: 9px 10px; color: var(--text); box-shadow: var(--shadow); cursor: grab; font-size: 13px; }
.board-card:hover { text-decoration: none; border-color: var(--border-strong); }
.board-card .t { font-weight: 600; }
.board-card.dragging { opacity: .5; }

/* Proposal editor */
.toolbar { position: sticky; top: 56px; z-index: 6; display: flex; flex-wrap: wrap; gap: 2px; align-items: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 5px 6px; margin-bottom: 12px; box-shadow: var(--shadow); }
.toolbar button, .toolbar select { font: inherit; font-size: 13px; background: none; border: 1px solid transparent; border-radius: 5px; padding: 3px 8px; min-height: 30px; color: var(--text); cursor: pointer; width: auto; }
.toolbar select { border-color: var(--border); }
.toolbar button:hover { background: var(--surface-2); }
.toolbar button.on { background: var(--accent-soft); color: var(--accent); }
.toolbar button.ai { color: var(--accent); font-weight: 600; }
.toolbar .sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }
.dropdown { position: relative; }
.dropdown .menu { display: none; position: absolute; top: 100%; left: 0; z-index: 20; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 4px; min-width: 260px; }
.dropdown .menu.open { display: block; }
.dropdown .menu button { display: block; width: 100%; text-align: left; }
.menu-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); padding: 6px 8px 2px; }
.editor-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.outline a { display: flex; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 5px; color: var(--text); font-size: 13px; }
.outline a.active { background: var(--accent-soft); }
.outline a:hover { text-decoration: none; background: var(--surface-2); }
.outline .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--border-strong); }
.outline .dot.drafting { background: var(--series-4); } .outline .dot.review { background: var(--series-1); } .outline .dot.final { background: var(--good); }
.side.panel { top: 110px; }
.paper-wrap { min-width: 0; }
.paper { background: #fff; color: #1a1a1a; max-width: 8.5in; margin: 0 auto; padding: .9in 1in 1in; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 8px 28px rgba(0,0,0,.08);
  border-radius: 2px; font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif; font-size: 11pt; line-height: 1.45; color-scheme: light; }
.letterhead { text-align: center; margin: -.4in 0 .3in; } .letterhead img { max-width: 2.4in; height: auto; }
.doc-section { scroll-margin-top: 120px; padding-top: 14px; margin-top: 18px; border-top: 1px dashed #d9dde3; }
.doc-section:first-of-type { border-top: 0; margin-top: 0; }
.doc-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.doc-head .ref { font-family: var(--mono); font-size: 12px; color: #6b7280; }
.doc-title { flex: 1; min-width: 200px; border: 0 !important; padding: 2px 0 !important; font: 600 16pt/1.25 Calibri, Carlito, "Segoe UI", sans-serif !important; color: #2F5496 !important; background: none !important; }
.doc-head select { width: auto; min-height: 28px; padding: 2px 6px; font-size: 12px; background: #fff; color: #333; border-color: #d0d5dc; }
.paper .ask { background: #f3f5f8; border-left: 3px solid #c5ccd5; color: #4b5563; padding: 6px 10px; border-radius: 0 5px 5px 0; margin: 8px 0; font-size: 10pt; white-space: pre-wrap; }
.paper .pending { background: #e6eefb; border-radius: 6px; padding: 8px 10px; margin: 8px 0; font-size: 10pt; }
.doc-body .ProseMirror { outline: none; min-height: 60px; padding: 4px 0; }
.doc-body .ProseMirror:focus-within { box-shadow: -10px 0 0 -8px #2a78d6; }
.doc-body h2 { font-size: 14pt; color: #2F5496; margin: 14px 0 6px; } .doc-body h3 { font-size: 12.5pt; color: #2F5496; margin: 12px 0 4px; } .doc-body h4 { font-size: 11pt; margin: 10px 0 4px; }
.doc-body p { margin: 0 0 8px; } .doc-body ul, .doc-body ol { margin: 0 0 8px; padding-left: 26px; } .doc-body li p { margin: 0 0 2px; }
.doc-body blockquote { border-left: 3px solid #c5ccd5; margin: 0 0 8px; padding-left: 12px; color: #4b5563; font-style: italic; }
.doc-body table { border-collapse: collapse; width: 100%; margin: 6px 0 10px; table-layout: fixed; }
.doc-body td, .doc-body th { border: 1px solid #a6a6a6; padding: 4px 6px; vertical-align: top; }
.doc-body th { background: #e8eef8; font-weight: 600; text-align: left; text-transform: none; letter-spacing: normal; font-size: inherit; color: inherit; white-space: normal; }
.doc-body tbody tr:hover td { background: none; }
.doc-body td p, .doc-body th p { margin: 0; } .doc-body .selectedCell { background: #dbe7fb; }
.doc-body img { max-width: 100%; height: auto; } .doc-body img.ProseMirror-selectednode { outline: 2px solid #2a78d6; }
.doc-body hr { border: 0; border-top: 2px dashed #c5ccd5; margin: 16px 0; position: relative; }
.doc-body hr::after { content: 'page break'; position: absolute; left: 50%; top: -9px; transform: translateX(-50%); background: #fff; color: #9aa3ad; font-size: 10px; padding: 0 6px; }
.doc-body p.is-editor-empty:first-child::before { content: attr(data-placeholder); color: #9aa3ad; float: left; height: 0; pointer-events: none; }
.collaboration-cursor__caret { border-left: 1px solid; border-right: 1px solid; margin: 0 -1px; position: relative; word-break: normal; pointer-events: none; }
.collaboration-cursor__label { position: absolute; top: -1.35em; left: -1px; font: 600 11px/1 var(--font); color: #fff; padding: 2px 5px; border-radius: 3px 3px 3px 0; white-space: nowrap; user-select: none; }
.doc-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: #6b7280; margin-top: 6px; }
.doc-foot .btn { color: #374151; background: #fff; border-color: #d0d5dc; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #eef2f7; color: #374151; border-radius: 12px; padding: 1px 4px 1px 9px; font-size: 12px; }
.chip button { border: 0; background: none; cursor: pointer; color: #6b7280; font-size: 14px; line-height: 1; }
.doc-body.drop-over { outline: 2px dashed #2a78d6; outline-offset: 4px; border-radius: 4px; }
.shot-drop { border: 1px dashed var(--border-strong); border-radius: 8px; padding: 10px 8px; cursor: pointer; }
.people { display: flex; } .avatar { width: 28px; height: 28px; border-radius: 50%; color: #fff; display: grid; place-items: center; font: 700 11px var(--font); margin-left: -6px; border: 2px solid var(--surface); }
.ai-busy { position: fixed; right: 16px; bottom: 16px; z-index: 60; background: var(--accent); color: var(--accent-text); padding: 8px 14px; border-radius: 20px; font-weight: 600; }
dialog.card { border: 1px solid var(--border-strong); color: var(--text); } dialog::backdrop { background: rgba(15,23,32,.35); }
dialog.suggestion { max-width: 720px; width: 100%; } .suggestion-body { max-height: 55vh; overflow: auto; background: #fff; color: #1a1a1a; border: 1px solid var(--border); border-radius: 6px; padding: 10px 14px; }
.suggestion-body table { border-collapse: collapse; } .suggestion-body td, .suggestion-body th { border: 1px solid #ccc; padding: 3px 6px; }
.comment blockquote { margin: 4px 0; padding-left: 8px; border-left: 3px solid var(--series-4); color: var(--text-2); font-size: 12.5px; }
.comment.resolved { opacity: .55; } .comment .reply { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 4px; }
@media (max-width: 1200px) { .editor-grid { grid-template-columns: minmax(0, 1fr); } .outline.panel, .side.panel { position: static; max-height: none; } .paper { padding: .5in .45in; } }

/* Theme switch */
.theme-toggle { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 7px; overflow: hidden; background: var(--surface); }
.theme-toggle button { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 28px; border: 0; background: transparent;
  color: var(--text-3); cursor: pointer; }
.theme-toggle button + button { border-left: 1px solid var(--border); }
.theme-toggle button:hover { color: var(--text); background: var(--surface-2); }
.theme-toggle button[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.theme-toggle svg { width: 15px; height: 15px; }

/* Auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--navy); }
.auth .card { width: 100%; max-width: 400px; padding: 28px; }
.auth .brand { color: var(--text); padding: 0 0 18px; }
.qr { background: #fff; padding: 10px; border-radius: 8px; display: inline-block; }
.qr svg { display: block; }

.empty { text-align: center; padding: 30px 16px; color: var(--text-2); }
.empty svg { width: 36px; height: 36px; color: var(--text-3); }
.pagination { margin-top: 14px; }
.pagination nav { display: flex; gap: 6px; flex-wrap: wrap; }
.pagination svg { width: 16px; height: 16px; }

@media (max-width: 1100px) {
  .layout-side, .builder-grid { grid-template-columns: 1fr; }
  .layout-side > .side-first { order: -1; }
  .panel { position: static; max-height: none; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .g2, .g3, .g4, .form-grid, .mode-pick { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  dl.kv { grid-template-columns: 1fr; gap: 2px; }
  dl.kv dd { margin-bottom: 8px; }
  .topbar .who span { display: none; }
}
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  body { background: #fff; }
}
