@font-face { font-family: 'Newsreader'; src: url('assets/fonts/newsreader.woff2') format('woff2'); font-weight: 400 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url('assets/fonts/newsreader-italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Plex'; src: url('assets/fonts/plexsans.woff2') format('woff2'); font-weight: 400 600; font-display: swap; }
@font-face { font-family: 'Plex Mono'; src: url('assets/fonts/plexmono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --paper: #f3efe6;
  --paper-2: #e9e3d6;
  --sheet: #fffdf8;
  --ink: #17191f;
  --ink-2: #4a4e58;
  --ink-3: #6a6e78;
  --rule: #d8d1c2;
  --rule-2: #bfb6a3;
  --blue: #2346a0;
  --blue-tint: #e7ecf8;
  --red: #a8261d;
  --red-tint: #fbebe7;
  --hi: #ffe45c;
  --hi-soft: #fff3a8;
  --green: #1d6a44;
  --green-tint: #e4f1e9;
  --amber: #7a4b00;
  --amber-tint: #fbf0d9;
  --serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --sans: 'Plex', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Plex Mono', ui-monospace, Menlo, monospace;
  --r: 10px;
  --gut: clamp(16px, 4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.55 var(--sans); overflow-x: hidden; }
body.sheet-lock { overflow: hidden; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--mono); font-weight: 500; letter-spacing: 0.02em; }
.muted { color: var(--ink-2); }
.red { color: var(--red); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 8px; text-decoration: none; }
.skip:focus { top: 12px; }
.wrap { width: min(1200px, 100%); margin: 0 auto; padding: 0 var(--gut); }
.wrap-wide { width: min(1560px, 100%); margin: 0 auto; padding: 0 clamp(8px, 2vw, 32px); }
.eyebrow { font: 500 12px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.card { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 1.5px solid var(--ink); background: transparent; font-weight: 600; font-size: 15px; line-height: 1.2; cursor: pointer; text-decoration: none; text-align: center; transition: background-color .15s, color .15s; }
.btn-sm { padding: 8px 14px; font-size: 14px; }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: #2c2f38; }
.btn-line:hover { background: var(--paper-2); }
.btn-accept { background: var(--green); border-color: var(--green); color: #fff; }
.btn-accept:hover { background: #155636; }
.btn-red { border-color: var(--red); color: var(--red); background: var(--sheet); }
.btn-red:hover { background: var(--red-tint); }
.btn-stop { background: var(--sheet); color: var(--red); border-color: var(--red); }
.btn-stop::before { content: ''; width: 10px; height: 10px; background: currentColor; border-radius: 2px; }
.btn:disabled { opacity: 1; background: var(--paper-2); border-color: var(--rule-2); color: var(--ink-3); cursor: not-allowed; }
.linkish { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; background: none; border: 0; color: var(--blue); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 14px; }
.icon-btn { width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--rule-2); background: var(--sheet); cursor: pointer; font-size: 16px; }
.pill { display: inline-block; font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.06em; padding: 5px 8px; border-radius: 999px; }
.pill-line { border: 1px solid var(--ink); }

/* top bar */
.topbar { border-bottom: 1px solid var(--rule); }
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 68px; }
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 600 21px/1 var(--serif); letter-spacing: -0.01em; }
.wordmark .mark { width: 30px; height: 30px; color: var(--ink); }
.wordmark u { text-decoration: none; background: linear-gradient(transparent 62%, var(--hi) 62%, var(--hi) 92%, transparent 92%); padding: 0 2px; }
.nav { display: none; gap: 24px; margin-left: auto; }
.nav a { text-decoration: none; font-weight: 500; padding: 10px 0; }
.nav a:hover { text-decoration: underline; }
.case-link { margin-left: auto; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1.5px solid var(--ink); border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; }
.case-link:hover { background: var(--paper-2); }
@media (min-width: 720px) { .nav { display: flex; } .case-link { margin-left: 8px; } }

/* hero */
.hero { padding: clamp(36px, 7vw, 88px) 0 clamp(28px, 4vw, 48px); }
.hero-grid { display: grid; gap: 32px; }
@media (min-width: 980px) { .hero-grid { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); align-items: end; gap: 56px; } }
.hero h1 { font: 400 clamp(2.6rem, 7vw, 5.4rem)/0.98 var(--serif); letter-spacing: -0.025em; margin: 14px 0 22px; }
.hero h1 em { font-style: italic; color: var(--blue); }
.lead { font-size: clamp(1.05rem, 1.6vw, 1.2rem); line-height: 1.6; max-width: 40em; color: var(--ink); }
.honest { margin-top: 20px; font-size: 14px; color: var(--ink-2); max-width: 40em; }
.honest .pill { margin-right: 6px; vertical-align: 1px; }
.try { padding: 22px 22px 18px; }
.try-title { font: 500 1.35rem/1.2 var(--serif); margin-bottom: 12px; }
.try-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: t; }
.try-list li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; font-size: 15px; line-height: 1.45; }
.try-list .tick { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--rule-2); margin-top: 1px; position: relative; }
.try-list li.is-done .tick { background: var(--green); border-color: var(--green); }
.try-list li.is-done .tick::after { content: ''; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.try-list li.is-done > span:last-child { color: var(--ink-2); }
.try-count { margin-top: 14px; font: 500 12px/1 var(--mono); color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; }

/* app shell */
.app-section { padding-bottom: clamp(40px, 6vw, 80px); scroll-margin-top: 8px; }
.app { background: var(--paper-2); border: 1px solid var(--rule); border-radius: 18px; padding: clamp(8px, 1.2vw, 16px); }
.app-bar { display: grid; gap: 16px; background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; padding: 16px clamp(14px, 2vw, 22px); }
@media (min-width: 1180px) { .app-bar { grid-template-columns: auto 1fr; align-items: center; } }
.project-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }
.project-name { font: 600 1.5rem/1.15 var(--serif); }
.project-sub { font-size: 14px; color: var(--ink-2); }
.controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
@media (min-width: 1180px) { .controls { justify-content: flex-end; } }
.seg { border: 0; margin: 0; padding: 0; min-width: 0; }
.seg legend, .field label { font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 0; margin-bottom: 4px; }
.seg-row { display: flex; background: var(--paper); border: 1px solid var(--rule-2); border-radius: 999px; padding: 3px; }
.seg-row label { position: relative; flex: 1 1 auto; }
.seg-row input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-row span { display: flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 14px; border-radius: 999px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.seg-row input:checked + span { background: var(--ink); color: #fff; }
.seg-row input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: 1px; }
.seg-row input:disabled + span { color: var(--ink-3); }
.seg-row input:checked:disabled + span { background: var(--ink-3); color: #fff; }
.field { display: flex; flex-direction: column; }
select { min-height: 44px; border: 1px solid var(--rule-2); background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2317191f' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center; border-radius: 999px; padding: 0 38px 0 16px; appearance: none; font-size: 14px; font-weight: 500; cursor: pointer; }
.bar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 520px) {
  .controls { display: grid; grid-template-columns: 1fr; }
  .seg-row span { padding: 0 8px; font-size: 13px; }
  .bar-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .bar-actions #b-draft { grid-column: 1 / -1; }
}

.app-grid { display: grid; gap: clamp(8px, 1.2vw, 16px); margin-top: clamp(8px, 1.2vw, 16px); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) {
  .app-grid { grid-template-columns: 270px minmax(0, 1fr); grid-template-areas: "files report" "ask report" "history report"; grid-template-rows: auto auto 1fr; align-items: start; }
  .files { grid-area: files; } .report-col { grid-area: report; } .ask { grid-area: ask; } .history { grid-area: history; }
}
@media (min-width: 1180px) {
  .app-grid { grid-template-columns: 280px minmax(0, 1fr) 340px; grid-template-areas: "files report viewer" "ask report viewer" "history report viewer"; }
  .viewer { grid-area: viewer; }
}
@media (min-width: 1500px) { .app-grid { grid-template-columns: 300px minmax(0, 1fr) 380px; } }

.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; padding: 16px; min-width: 0; }
.panel-title { font: 600 1.15rem/1.2 var(--serif); }
.panel-note { font-size: 13px; color: var(--ink-2); margin: 4px 0 12px; }

/* files */
.files details > summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 44px; }
.files details > summary::-webkit-details-marker { display: none; }
.files-count { font-size: 11px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .05em; margin-left: auto; }
.chev { width: 10px; height: 10px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg); margin: -4px 4px 0 2px; transition: transform .2s; }
details[open] > summary .chev { transform: rotate(-135deg); margin-top: 4px; }
@media (min-width: 768px) { .files details > summary { pointer-events: none; } .chev { display: none; } }
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.file { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 8px; padding: 8px 0; border-top: 1px solid var(--rule); position: relative; }
.file:first-child { border-top: 0; }
.file input { position: absolute; opacity: 0; width: 44px; height: 30px; margin: 0; left: 0; top: 8px; cursor: pointer; }
.file-label { display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; font-weight: 600; }
.switch { flex: none; width: 38px; height: 22px; border-radius: 999px; background: var(--rule-2); position: relative; transition: background-color .15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.file input:checked + .file-label .switch { background: var(--ink); }
.file input:checked + .file-label .switch::after { transform: translateX(16px); }
.file input:focus-visible + .file-label .switch { outline: 3px solid var(--blue); outline-offset: 2px; }
.file:not(.is-on) .file-name { color: var(--ink-2); text-decoration: line-through; text-decoration-color: var(--rule-2); }
.file-meta { grid-column: 1 / -1; display: grid; gap: 1px; padding-left: 48px; font-size: 12.5px; color: var(--ink-2); line-height: 1.4; }
.file-meta .mono { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.file-file { overflow-wrap: anywhere; }
.file-open { min-height: 44px; min-width: 44px; padding: 0 10px; border: 0; background: none; color: var(--blue); font-weight: 600; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.flag { display: inline-block; justify-self: start; margin-top: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 4px; }
.flag-bad { background: var(--amber-tint); color: var(--amber); }
.flag-long { background: var(--blue-tint); color: var(--blue); }
.flag-off { background: var(--paper-2); color: var(--ink-2); }

/* steps */
.steps { background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; padding: 12px 16px; margin-bottom: clamp(8px, 1.2vw, 16px); }
.step-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 1000px) { .step-list { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.step { display: grid; grid-template-columns: 14px 1fr; gap: 2px 10px; align-items: start; font-size: 13px; }
.step-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--rule-2); margin-top: 4px; }
.step-active .step-dot { border-color: var(--blue); background: var(--blue-tint); animation: pulse 1s ease-in-out infinite; }
.step-done .step-dot { border-color: var(--ink); background: var(--ink); }
.step-label { font-weight: 600; }
.step-todo .step-label { color: var(--ink-3); }
.step-detail { grid-column: 2; color: var(--ink-2); line-height: 1.4; }
@keyframes pulse { 50% { transform: scale(1.35); } }

/* the report sheet */
.report-col { min-width: 0; }
.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: 6px; padding: clamp(20px, 4vw, 52px) clamp(18px, 4.4vw, 60px); box-shadow: 0 1px 0 var(--rule), 0 14px 30px -18px rgba(23, 25, 31, .28); position: relative; min-height: 420px; }
.sheet::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: repeating-linear-gradient(90deg, var(--blue) 0 22px, transparent 22px 30px); border-radius: 6px 6px 0 0; opacity: .85; }
.sheet-kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-2); }
.sheet-title { font: 500 clamp(1.8rem, 3.6vw, 2.6rem)/1.05 var(--serif); letter-spacing: -0.015em; margin: 6px 0 8px; }
.sheet-meta { font-size: 14px; color: var(--ink-2); }
.progress { margin-top: 14px; display: grid; gap: 6px; }
.progress .bar { height: 6px; background: var(--paper-2); border-radius: 999px; overflow: hidden; }
.progress .bar span { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width .3s; }
.progress-text { font-size: 13px; color: var(--ink-2); }
.progress-text b { color: var(--ink); }
.legend { margin-top: 14px; border-top: 1px solid var(--rule); padding-top: 4px; }
.legend summary { cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; font-weight: 600; font-size: 14px; color: var(--blue); }
.legend-grid { display: grid; gap: 10px; margin: 6px 0 4px; }
@media (min-width: 640px) { .legend-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; } }
.legend-grid div { display: grid; grid-template-columns: 112px 1fr; gap: 10px; align-items: baseline; }
.legend-grid dt { display: flex; gap: 4px; flex-wrap: wrap; }
.legend-grid dd { margin: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.45; }
.lg-inferred { font: 400 16px var(--serif); color: var(--blue); text-decoration: underline dashed; text-underline-offset: 4px; }
.lg-conflict { font: 500 11px var(--mono); text-transform: uppercase; color: var(--red); border-left: 3px solid var(--red); padding: 2px 6px; background: var(--red-tint); }
.lg-blue { font: 400 16px var(--serif); color: var(--blue); }
.lg-ink { font: 400 16px var(--serif); color: var(--ink); }

.notices { display: grid; gap: 10px; margin-top: 18px; }
.notices:empty { display: none; }
.notice { border-radius: 8px; padding: 12px 14px; font-size: 14px; line-height: 1.5; border-left: 4px solid; }
.notice p + p { margin-top: 2px; }
.notice-title { font-weight: 600; }
.notice-bad { background: var(--amber-tint); border-color: #b07a1f; }
.notice-long { background: var(--blue-tint); border-color: var(--blue); }
.notice-red { background: var(--red-tint); border-color: var(--red); }
.notice details { margin-top: 4px; }
.notice summary { cursor: pointer; font-weight: 600; color: var(--blue); min-height: 44px; display: inline-flex; align-items: center; }
.leftout { margin: 4px 0 8px; padding-left: 18px; }
.leftout li { margin: 2px 0; }

.sheet-body { margin-top: 22px; font-family: var(--serif); font-size: clamp(17px, 1.3vw, 18.5px); line-height: 1.6; }
.opener { font-size: 1.12em; font-style: italic; color: var(--ink-2); margin-bottom: 8px; }
.empty { border: 1.5px dashed var(--rule-2); border-radius: 10px; padding: 28px 22px; text-align: center; font-family: var(--sans); font-size: 15px; color: var(--ink-2); max-width: 520px; margin: 24px auto; }
.empty-title { font: 500 1.4rem/1.2 var(--serif); color: var(--ink); margin-bottom: 6px; }

.rsec { border-top: 1px solid var(--rule); margin-top: 22px; padding-top: 18px; }
.rsec-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 8px; }
.rsec-title { font: 600 1.3rem/1.2 var(--serif); }
.rsec-title:focus { outline: none; }
.rsec-title:focus-visible { outline: 3px solid var(--blue); }
.status { font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; padding: 5px 8px; border-radius: 999px; border: 1px solid; }
.status-draft { color: var(--blue); border-color: #9fb0dc; background: var(--blue-tint); }
.status-accepted, .status-edited { color: var(--green); border-color: #8fc0a5; background: var(--green-tint); }
.status-rejected { color: var(--ink-2); border-color: var(--rule-2); }
.status-changed { color: var(--amber); border-color: #d7b46d; background: var(--amber-tint); }
.changed-note { font: 14px/1.5 var(--sans); color: var(--amber); background: var(--amber-tint); padding: 8px 12px; border-radius: 6px; margin-bottom: 8px; }
.rejected-note { font: 14px/1.5 var(--sans); color: var(--ink-2); }

.claims { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.claim { position: relative; padding-left: 20px; overflow-wrap: anywhere; }
.claim::before { content: ''; position: absolute; left: 2px; top: .7em; width: 7px; height: 7px; background: currentColor; opacity: .55; }
.claims-lead .claim { padding-left: 0; font-size: 1.1em; }
.claims-lead .claim::before { display: none; }
.st-draft .claim, .st-changed .claim { color: var(--blue); }
.st-accepted .claim, .st-edited .claim, .claim.is-edited { color: var(--ink); }
.conf-inferred .ctext { text-decoration: underline dashed; text-decoration-thickness: 1px; text-underline-offset: 5px; text-decoration-color: currentColor; }
.conf-caveat .ctext { font-style: italic; }
.ctext.typing::after { content: ''; display: inline-block; width: 2px; height: 1em; background: var(--blue); margin-left: 2px; vertical-align: -2px; animation: blink .8s steps(1) infinite; }
.ctext.cut { text-decoration: line-through; text-decoration-color: var(--red); }
@keyframes blink { 50% { opacity: 0; } }
.cites { display: inline-flex; flex-wrap: wrap; gap: 6px; vertical-align: 2px; }
.cites.is-hidden, .rsec-actions.is-hidden { visibility: hidden; }
.chip { position: relative; display: inline-flex; align-items: center; height: 24px; padding: 0 8px; border: 1px solid var(--rule-2); border-radius: 5px; background: var(--paper); color: var(--ink); font: 500 11.5px/1 var(--mono); letter-spacing: .02em; cursor: pointer; white-space: nowrap; }
.chip::after { content: ''; position: absolute; inset: -10px -3px; }
.chip:hover, .chip:focus-visible, .chip.is-active { background: var(--hi); border-color: var(--ink); }
.chip-demo { cursor: default; }
.tag { display: inline-block; font: 500 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; padding: 4px 6px; border-radius: 4px; vertical-align: 3px; margin-right: 4px; }
.tag-inferred { background: var(--blue-tint); color: var(--blue); border: 1px dashed var(--blue); }
.tag-caveat { background: var(--amber-tint); color: var(--amber); }
.tag-resolved { background: var(--red-tint); color: var(--red); margin-left: 6px; }
.tag-edited { background: var(--green-tint); color: var(--green); margin-left: 6px; white-space: normal; line-height: 1.3; }
.claim .linkish { font-family: var(--sans); }
.flash { animation: flash 1.8s ease-out; }
@keyframes flash { 0%, 30% { background: var(--hi-soft); box-shadow: 0 0 0 4px var(--hi-soft); } 100% { background: transparent; box-shadow: 0 0 0 4px transparent; } }

.conflict { border: 1.5px solid var(--red); border-left-width: 5px; background: var(--red-tint); border-radius: 8px; padding: 14px 16px; font-family: var(--sans); font-size: 15px; color: var(--ink); }
.conflict.appear { animation: rise .35s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.conflict-kicker { display: flex; align-items: center; gap: 8px; font: 500 11px/1.2 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--red); }
.conflict-kicker .x { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--red); position: relative; flex: none; }
.conflict-q { font: 600 1.15rem/1.3 var(--serif); margin: 6px 0 10px; }
.sides { display: grid; gap: 8px; }
@media (min-width: 560px) { .sides { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; } }
.side { background: var(--sheet); border: 1px solid #e5c1ba; border-radius: 6px; padding: 10px 12px; display: grid; gap: 6px; align-content: start; justify-items: start; }
.side-says { font-weight: 600; }
.side blockquote { margin: 0; font: italic 400 15px/1.45 var(--serif); color: var(--ink-2); }
.vs { align-self: center; justify-self: center; font-size: 11px; color: var(--red); text-transform: uppercase; }
.conflict-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.rsec-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; font-family: var(--sans); }
.why { font-size: 13px; color: var(--red); }
.edit-form { font-family: var(--sans); display: grid; gap: 8px; }
.edit-note { font-size: 13.5px; color: var(--ink-2); }
.edit-form textarea { width: 100%; border: 1px solid var(--rule-2); border-radius: 6px; padding: 10px 12px; font: 400 16px/1.5 var(--serif); background: #fff; resize: vertical; }

.sheet-foot { margin-top: 26px; display: grid; gap: 12px; font-size: 14px; }
.sheet-foot:empty { display: none; }
.foot-block { border-top: 1px dashed var(--rule-2); padding-top: 12px; color: var(--ink-2); }
.foot-block ul { margin: 4px 0 0; padding-left: 18px; }
.foot-title { font-weight: 600; color: var(--ink); }
.stopped { border: 1.5px solid var(--red); border-radius: 8px; padding: 14px 16px; background: var(--red-tint); }
.stopped p + p { margin-top: 4px; }

/* ask */
.ask-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.ask-form input { min-width: 0; min-height: 44px; border: 1px solid var(--rule-2); border-radius: 999px; padding: 0 16px; background: #fff; font-size: 15px; }
.suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.sugg { min-height: 44px; padding: 6px 12px; border: 1px solid var(--rule-2); background: var(--paper); border-radius: 12px; font-size: 13px; text-align: left; cursor: pointer; line-height: 1.3; }
.sugg:hover { background: var(--paper-2); }
.answers { display: grid; gap: 10px; margin-top: 12px; }
.answers:empty { display: none; }
.qa { border: 1px solid var(--rule); border-radius: 8px; padding: 10px 12px; background: #fff; font-size: 14px; display: grid; gap: 4px; }
.qa-q { font-weight: 600; }
.qa-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--green); }
.qa-a { font: 400 16px/1.5 var(--serif); }
.qa-a .cites, .qa-who .cites { vertical-align: 1px; margin-left: 2px; }
.qa-notfound { background: var(--paper); border-style: dashed; border-color: var(--rule-2); }
.qa-notfound .qa-label { color: var(--ink); }
.qa-notfound .qa-a { font-weight: 600; }
.qa-partial .qa-label { color: var(--amber); }
.qa-inferred .qa-label { color: var(--blue); }
.qa-inferred .qa-a { text-decoration: underline dashed 1px; text-underline-offset: 5px; }
.qa-conflict { border-color: var(--red); background: var(--red-tint); }
.qa-conflict .qa-label { color: var(--red); }
.qa-searched, .qa-who { color: var(--ink-2); font-size: 13px; }

/* history */
.history-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 0; max-height: 300px; overflow: auto; }
.history-empty { font-size: 13px; color: var(--ink-2); }
.history-item { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; font-size: 13.5px; border-top: 1px solid var(--rule); line-height: 1.35; }
.history-item:first-child { border-top: 0; }
.h-n { font-size: 11px; color: var(--ink-3); }
.history-item .linkish { font-size: 13px; }

/* viewer */
.viewer { background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; display: flex; flex-direction: column; min-width: 0; }
.viewer:focus { outline: none; }
.viewer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 8px; border-bottom: 1px solid var(--rule); }
.viewer-close { display: none; }
.viewer-body { position: relative; overflow: auto; padding: 14px 16px 18px; font-size: 14.5px; line-height: 1.55; overscroll-behavior: contain; }
.viewer-empty { color: var(--ink-2); font-size: 14px; }
.vfile-name { font: 600 1.25rem/1.2 var(--serif); }
.vfile-meta { font-size: 11px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; overflow-wrap: anywhere; }
.cited-for { margin: 12px 0 4px; font: italic 400 15px/1.45 var(--serif); color: var(--ink-2); }
.cited-for .mono { font-style: normal; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; display: block; color: var(--ink-3); }
.vdoc { margin-top: 12px; border-top: 1px dashed var(--rule-2); padding-top: 10px; display: grid; gap: 8px; }
.vhead { font-size: 11px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; margin-top: 6px; }
mark.pass { background: linear-gradient(100deg, transparent 0 2px, var(--hi) 2px calc(100% - 3px), transparent calc(100% - 3px)); color: var(--ink); padding: 1px 2px; box-decoration-break: clone; -webkit-box-decoration-break: clone; font-weight: 500; }
.vbad { margin-top: 14px; display: grid; gap: 6px; font-size: 14px; }
.scan { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.scan i { aspect-ratio: 3/4; background: repeating-linear-gradient(0deg, #d9d2c4 0 2px, transparent 2px 7px), #ece6da; border-radius: 3px; filter: blur(.6px); opacity: .9; }

@media (min-width: 1180px) {
  .viewer { position: sticky; top: 12px; max-height: calc(100vh - 24px); }
}
@media (max-width: 1179px) {
  .viewer { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; max-height: 78vh; border-radius: 16px 16px 0 0; box-shadow: 0 -12px 40px rgba(23, 25, 31, .3); transform: translateY(105%); visibility: hidden; transition: transform .25s ease, visibility 0s .25s; }
  .viewer.is-open { transform: none; visibility: visible; transition: transform .25s ease; }
  .viewer-close { display: inline-flex; align-items: center; justify-content: center; }
  .viewer-head { padding: 10px 12px 8px 16px; }
}
@media (min-width: 768px) and (max-width: 1179px) {
  .viewer { left: auto; top: 0; width: min(420px, 92vw); max-height: none; border-radius: 16px 0 0 16px; transform: translateX(105%); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .ctext.typing::after { display: none; }
}

/* toast */
.toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); z-index: 60; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; max-width: min(560px, calc(100vw - 32px)); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* dialogs */
.dialog { border: 0; padding: 0; border-radius: 14px; background: var(--sheet); color: var(--ink); width: min(600px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 30px 80px rgba(0,0,0,.35); }
.dialog::backdrop { background: rgba(23, 25, 31, .55); }
.dialog-inner { padding: clamp(18px, 4vw, 30px); display: grid; gap: 12px; }
.dialog-title { font: 500 1.6rem/1.15 var(--serif); }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.checklist { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.nothing-sent { background: var(--green-tint); border-left: 4px solid var(--green); padding: 10px 12px; border-radius: 6px; font-size: 14.5px; }
.email-meta { margin: 0; display: grid; gap: 4px; font-size: 14px; }
.email-meta div { display: grid; grid-template-columns: 70px 1fr; gap: 8px; }
.email-meta dt { color: var(--ink-2); font-weight: 600; }
.email-meta dd { margin: 0; overflow-wrap: anywhere; }
.email-body { width: 100%; border: 1px solid var(--rule-2); border-radius: 8px; padding: 12px; font: 400 13.5px/1.5 var(--mono); background: #fff; resize: vertical; min-height: 220px; }

/* rules */
.behaves { border-top: 1px solid var(--rule); padding: clamp(44px, 7vw, 88px) 0; }
.behaves h2 { font: 400 clamp(2rem, 4.6vw, 3.4rem)/1.05 var(--serif); letter-spacing: -0.02em; margin: 10px 0 28px; }
.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
@media (min-width: 680px) { .rules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .rules { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.rules li { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r); padding: 20px; }
.rule-n { font-size: 12px; color: var(--blue); }
.rules h3 { font: 500 1.35rem/1.2 var(--serif); margin: 10px 0 8px; }
.rules p { color: var(--ink-2); font-size: 15px; }

/* footer */
.footer { border-top: 1px solid var(--rule); padding: 26px 0 34px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; }
.footer-brand { font-size: 14px; color: var(--ink-2); }
.footer-brand b { color: var(--ink); letter-spacing: .06em; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.footer-links a { font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; min-height: 44px; }
.chip-n { margin-left: 4px; color: var(--ink-2); font-size: 10px; }
.file-open { grid-column: 2; grid-row: 1; }
.step { align-content: start; }
