:root {
  color-scheme: light dark;
  --paper: #ffffff;
  --surface: #ffffff;
  --ink: #171717;
  --muted: #656565;
  --line: #dddddd;
  --soft: #f4f4f4;
  --soft-strong: #e9e9e9;
  --stamp: #C4302B;
  --yellow: #fff6c7;
  --max: 1180px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--paper); color: var(--ink); word-break: keep-all; overflow-wrap: anywhere; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

.test-ribbon {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 28px;
  display: grid;
  place-items: center;
  padding: 5px 16px;
  background: #171717;
  color: #ffffff;
  font-size: 12px;
  letter-spacing: .02em;
}

.site-header {
  width: min(var(--max), calc(100% - 48px));
  height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.wordmark { border: 0; background: none; padding: 0; font-size: 19px; font-weight: 780; letter-spacing: -.035em; }
.wordmark span { color: var(--muted); font-weight: 520; }
.quiet-button, .text-button { border: 0; background: none; color: var(--muted); padding: 7px 0; text-decoration: underline; text-underline-offset: 4px; }
.quiet-button:hover, .text-button:hover { color: var(--ink); }

#app { width: min(var(--max), calc(100% - 48px)); margin: 0 auto; }
.site-footer { width: min(var(--max), calc(100% - 48px)); margin: 0 auto; border-top: 1px solid var(--line); padding: 24px 0 38px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 10px 24px; color: var(--muted); font-size: 13px; }
.site-footer a { text-underline-offset: 3px; }
.home-shell { padding: 70px 0 56px; }
.hero { max-width: 800px; margin: 0 auto; }
.hero h1 { margin: 0 0 30px; max-width: 720px; font-size: clamp(34px, 5vw, 58px); font-weight: 690; line-height: 1.06; letter-spacing: -.05em; }
.intent-form { position: relative; border: 1px solid var(--ink); border-radius: 8px; background: var(--surface); }
.intent-label { display: block; padding: 18px 112px 0 22px; font-size: 14px; font-weight: 750; }
.intent-input { width: 100%; min-height: 128px; resize: vertical; border: 0; outline: 0; background: transparent; padding: 12px 112px 24px 22px; font-size: 20px; line-height: 1.5; }
.intent-input::placeholder, textarea::placeholder, input::placeholder { color: #8a8a8a; }
.intent-submit { position: absolute; right: 18px; bottom: 18px; border: 0; border-radius: 6px; background: var(--ink); color: var(--paper); padding: 9px 14px; font-weight: 730; }
.outreach-extras { margin-top: 12px; border-bottom: 1px solid var(--line); }
.outreach-extras summary { width: max-content; padding: 8px 0 12px; color: var(--muted); cursor: pointer; font-size: 13px; }
.outreach-extras summary { list-style: none; }
.outreach-extras summary::-webkit-details-marker { display: none; }
.list-input { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 12px; }
.evidence-chips, .fixed-purposes { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0 14px; }
.choice-chip { position: relative; }
.choice-chip input { position: absolute; opacity: 0; pointer-events: none; }
.choice-chip span, .setting-chip { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; color: var(--muted); font-size: 12px; }
.choice-chip input:checked + span { border-color: var(--ink); color: var(--ink); background: var(--soft); }
.examples { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 16px; }
.example-button { border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); padding: 7px 11px; font-size: 13px; }
.example-button:hover { border-color: var(--ink); color: var(--ink); }
.home-notice { margin-top: 20px; border-left: 3px solid var(--ink); padding: 8px 14px; }
.privacy-note { margin: 10px 2px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.trial-ribbon { width: max-content; max-width: 100%; margin-bottom: 18px; border: 1px solid var(--ink); border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 760; }
.profile-gap-form { width: 100%; display: grid; gap: 12px; margin-top: 22px; }
.list-gap-form { width: 100%; display: grid; gap: 10px; margin-top: 22px; }
.form-label { color: var(--muted); font-size: 13px; font-weight: 700; }
.working-elapsed { font-variant-numeric: tabular-nums; }
.mailto-link { display: inline-block; margin-top: 14px; color: var(--ink); text-decoration: none; }
.profile-settings-form { display: grid; gap: 12px; }

.inbox { max-width: 920px; margin: 86px auto 0; }
.recent-results { max-width: 920px; margin: 54px auto 0; }
.recent-list { margin: 0; padding: 0; list-style: none; }
.recent-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; border-bottom: 1px solid var(--line); }
.recent-open { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; border: 0; background: none; padding: 17px 0; text-align: left; }
.recent-open strong { overflow: hidden; max-width: 100%; text-overflow: ellipsis; white-space: nowrap; }
.recent-open small { color: var(--muted); }
.undo-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; }
.section-head { display: flex; align-items: end; justify-content: space-between; padding-bottom: 13px; border-bottom: 2px solid var(--ink); }
.section-head h2 { margin: 0; font-size: 22px; }
.section-head p { margin: 0; color: var(--muted); font-size: 13px; }
.inbox-list { margin: 0; padding: 0; list-style: none; }
.inbox-line { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 22px; border-bottom: 1px solid var(--line); }
.inbox-copy { display: grid; grid-template-columns: 66px minmax(0, 1fr); align-items: baseline; flex: 1; min-width: 0; }
.inbox-copy strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inbox-copy small { grid-column: 2; color: var(--muted); margin-top: 6px; }
.inbox-kind { color: var(--muted); font-size: 13px; }
.reply-paste-form { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 18px 0; align-items: end; }
.reply-paste { min-height: 92px; resize: vertical; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 13px; }
.line-action, .secondary-button, .summary-button, .neutral-primary, .cancel-button, .mail-ready {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 10px 14px;
  border-radius: 6px;
  white-space: nowrap;
  font-weight: 650;
}
.line-action:hover, .secondary-button:hover, .summary-button:hover, .neutral-primary:hover, .cancel-button:hover, .mail-ready:hover { border-color: var(--ink); }
.mail-ready { display: block; margin: 34px auto 0; border-color: var(--ink); }

.purpose-line { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 13px; }
.purpose-name { color: var(--ink); font-weight: 730; }
.purpose-select { max-width: 260px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); padding: 5px; }
.working, .error-panel, .search-progress { max-width: 650px; min-height: 520px; margin: 0 auto; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.working h1, .error-panel h1, .search-progress h1 { font-size: clamp(32px, 5vw, 52px); font-weight: 700; margin: 16px 0 8px; letter-spacing: -.04em; }
.working p, .error-panel p { color: var(--muted); }
.spinner { width: 32px; height: 32px; border: 2px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; margin-top: 50px; }
@keyframes spin { to { transform: rotate(360deg); } }

.count-strip { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.count-strip span { border-radius: 999px; background: var(--soft); color: var(--muted); padding: 5px 9px; font-size: 11px; }
.count-strip .count-required { background: var(--ink); color: var(--paper); }
.count-strip .count-defect { border: 1px solid var(--ink); background: transparent; color: var(--ink); }

.review-board { padding: 34px 0 50px; }
.delivery-gate { margin-bottom: 16px; border: 1px solid var(--ink); border-radius: 6px; background: var(--soft); padding: 13px 15px; }
.delivery-gate p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.review-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; padding-bottom: 22px; border-bottom: 2px solid var(--ink); }
.review-title { min-width: 0; }
.review-title h1 { margin: 8px 0 0; font-size: clamp(23px, 3vw, 34px); letter-spacing: -.035em; }
.review-actions { display: flex; align-items: center; gap: 9px; }
.primary-button { min-height: 48px; padding: 13px 19px; border-radius: 6px; font-weight: 760; white-space: nowrap; }
.stamp-button { border: 1px solid var(--stamp); background: var(--stamp); color: #ffffff; }
.stamp-button:hover:not(:disabled) { border-color: var(--stamp); background: var(--stamp); }
.primary-button:disabled, .summary-button:disabled { border: 1px solid #bcbcbc; background: transparent; color: #888888; }
.neutral-primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.risk-warning { margin: 12px 0 0; color: var(--muted); font-size: 12px; font-weight: 650; }
.risk-warning.persistent { border-left: 3px solid var(--ink); padding: 8px 11px; }

.summary-panel { margin-top: 18px; border: 1px solid var(--ink); border-radius: 8px; background: var(--surface); padding: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 28px; }
.summary-eyebrow { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; }
.summary-item { min-width: 0; }
.summary-item strong { font-size: 12px; }
.summary-item p { margin: 6px 0 0; white-space: pre-wrap; color: var(--muted); font-size: 13px; line-height: 1.5; max-height: 150px; overflow: auto; }
.summary-approval { grid-column: 1 / -1; margin: 0; border-top: 1px solid var(--line); padding-top: 15px; font-weight: 760; }
.summary-panel .risk-warning { grid-column: 1 / -1; }

.review-work { min-height: 560px; display: grid; grid-template-columns: minmax(0, 1.18fr) minmax(0, .82fr); border-bottom: 1px solid var(--line); }
.review-work.single { grid-template-columns: minmax(0, 760px); }
.target-list { border-right: 1px solid var(--line); }
.list-heading { padding: 16px 18px 10px 0; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }
.target-row { min-height: 126px; display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 18px; padding: 20px 18px 18px 0; border-bottom: 1px solid var(--line); outline: 0; cursor: pointer; animation: appear .3s ease both; }
@keyframes appear { from { opacity: 0; transform: translateY(6px); } }
.target-row.selected { box-shadow: inset 3px 0 0 var(--ink); padding-left: 16px; }
.target-main { min-width: 0; }
.target-main strong { font-size: 17px; }
.target-main span { display: block; color: var(--muted); font-size: 13px; margin-top: 5px; }
.target-main p { margin: 15px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.target-side { display: flex; flex-direction: column; align-items: flex-end; gap: 9px; }
.status { color: var(--muted); font-size: 12px; }
.email-input, .evidence-input, .gap-input, .plain-input { width: 100%; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); outline: 0; padding: 9px 8px; }
.gap-input { background: var(--yellow); color: #171717; border-color: #c9a227; }
.draft-pane { position: relative; padding: 18px 0 30px 30px; background: var(--surface); }
.draft-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.draft-pane h2 { font-size: 18px; margin: 22px 0 18px; }
.draft-pane h3 { margin: 30px 0 10px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 14px; }
.draft-body { white-space: pre-wrap; font-family: inherit; font-size: 14px; line-height: 1.65; }
.translation { color: var(--muted); font-size: 14px; line-height: 1.65; }
.sheet-close { display: none; border: 0; background: none; color: var(--muted); }
.questions { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; padding: 15px; background: var(--yellow); color: #171717; }
.gap-defect p { font-size: 12px; }

.done-shell { padding: 34px 0 50px; }
.done-panel { min-height: 520px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.done-panel h2 { margin: 20px 0 4px; font-size: clamp(28px, 4vw, 46px); letter-spacing: -.04em; }
.done-panel p { color: var(--muted); }
.done-mark { min-width: 58px; height: 58px; padding: 0 12px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 999px; font-size: 17px; font-weight: 760; }
.cancel-button { min-height: 48px; border-color: var(--ink); }
.summary-placeholder { display: none; }
.neutral-note { color: var(--muted); font-size: 12px; }
.copy-fallback, .stored-result { max-width: 920px; margin: 42px auto 72px; }
.copy-fallback h1 { font-size: clamp(30px, 5vw, 48px); letter-spacing: -.04em; }
.copy-fallback-text { width: 100%; margin: 18px 0; resize: vertical; border: 2px solid var(--ink); border-radius: 6px; background: var(--surface); padding: 14px; line-height: 1.6; }
.stored-blocks { display: grid; gap: 14px; margin-top: 22px; }
.stored-text { white-space: pre-wrap; font: inherit; line-height: 1.6; }

.finding-list { width: 100%; margin-top: 28px; border-top: 2px solid var(--ink); }
.finding-row { padding: 18px 0; border-bottom: 1px solid var(--line); animation: appear .35s ease both; }
.search-progress .secondary-button { margin-top: 28px; }
.search-gap-form { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin-top: 24px; }
.search-gap-form .secondary-button { margin-top: 0; }
.find-review { max-width: 920px; margin: 34px auto 70px; }
.find-review > h1 { margin: 16px 0 8px; font-size: clamp(30px, 5vw, 48px); letter-spacing: -.04em; }
.find-results-form { display: grid; gap: 0; margin-top: 26px; border-top: 2px solid var(--ink); }
.found-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .45fr); gap: 24px; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--line); }
.found-copy { min-width: 0; }
.found-copy > p { margin: 6px 0 12px; color: var(--muted); font-size: 13px; }
.finding-evidence { display: flex; flex-wrap: wrap; gap: 5px 9px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.evidence-link, .contact-link { color: var(--ink); overflow-wrap: anywhere; text-underline-offset: 3px; }
.found-copy .contact-link { display: inline-block; margin-top: 10px; font-size: 13px; }
.find-results-form > .form-label { margin-top: 22px; }
.find-results-form > .secondary-button { justify-self: start; margin-top: 4px; }
.official-card .contact-link { display: inline-block; margin-top: 10px; text-decoration: none; }

.official-channels { padding: 34px 0 70px; }
.outside-total { border: 1px solid var(--line); border-radius: 6px; padding: 10px 13px; color: var(--muted); font-size: 13px; }
.channel-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.channel-card { border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.channel-copy { white-space: pre-wrap; line-height: 1.6; }
.outside-count { color: var(--muted); font-size: 12px; }
.channel-url { display: block; margin-top: 12px; overflow-wrap: anywhere; color: var(--muted); }

.settings { max-width: 780px; margin: 52px auto 80px; }
.settings-head { padding-bottom: 24px; border-bottom: 2px solid var(--ink); }
.settings-head h1 { margin: 0; font-size: 48px; font-weight: 700; letter-spacing: -.045em; }
.settings-head p { color: var(--muted); margin-bottom: 0; }
.setting-section { padding: 27px 0; border-bottom: 1px solid var(--line); }
.setting-section h2 { margin: 0 0 18px; font-size: 18px; }
.field { display: grid; grid-template-columns: 160px 1fr; align-items: start; margin-top: 16px; }
.field span { color: var(--muted); font-size: 13px; padding-top: 8px; }
.setting-row, .toggle { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.toggle { border-top: 1px solid var(--soft-strong); }
.toggle input { width: 36px; height: 20px; accent-color: var(--ink); }
.risk-setting { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 18px; }
.risk-setting-status { margin: 0; color: var(--muted); font-size: 13px; }
.optout-form { display: flex; gap: 12px; }
.optout-list { color: var(--muted); font-size: 13px; margin-top: 14px; }

.test-meter { position: fixed; z-index: 60; right: 14px; bottom: 12px; background: #171717; color: #ffffff; padding: 7px 10px; font-size: 11px; opacity: .9; border-radius: 4px; }

.legal-shell { width: min(880px, calc(100% - 48px)); margin: 38px auto 72px; }
.legal-head { padding-bottom: 24px; border-bottom: 2px solid var(--ink); }
.legal-head h1 { margin: 8px 0 10px; font-size: clamp(32px, 6vw, 52px); letter-spacing: -.045em; }
.legal-meta, .legal-summary { color: var(--muted); }
.legal-summary { border-left: 3px solid var(--ink); padding: 10px 14px; }
.legal-toc { margin: 28px 0 12px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); }
.legal-toc h2 { margin: 0 0 10px; font-size: 17px; }
.legal-toc ol { columns: 2; margin: 0; padding-left: 22px; }
.legal-section { padding-top: 30px; }
.legal-section h2 { margin: 0 0 12px; font-size: 21px; }
.legal-section li + li { margin-top: 7px; }
.legal-table-wrap { overflow-x: auto; }
.legal-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.legal-table th, .legal-table td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; vertical-align: top; }
.legal-table th { background: var(--soft); white-space: nowrap; }
.legal-links { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 38px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }

@media (max-width: 760px) {
  .site-header, #app, .site-footer { width: min(100% - 28px, var(--max)); }
  .site-header { height: 58px; }
  .home-shell { padding-top: 40px; }
  .hero h1 { margin-bottom: 22px; font-size: 38px; }
  .intent-label { padding-left: 14px; }
  .intent-input { min-height: 150px; padding: 10px 14px 58px; font-size: 17px; }
  .intent-submit { right: 12px; bottom: 12px; }
  .examples { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
  .example-button { text-align: left; }
  .inbox { margin-top: 58px; }
  .section-head { align-items: start; }
  .section-head p { text-align: right; max-width: 130px; }
  .reply-paste-form { grid-template-columns: 1fr; }
  .inbox-line { min-height: 92px; }
  .inbox-copy { grid-template-columns: 52px minmax(0, 1fr); }
  .line-action { padding: 8px 10px; }
  .review-board, .official-channels, .done-shell { padding-top: 22px; }
  .review-top { align-items: flex-start; gap: 14px; }
  .review-title h1 { font-size: 20px; }
  .primary-button, .summary-button { max-width: 180px; padding: 11px 12px; white-space: normal; }
  .count-strip { gap: 5px; }
  .count-strip span { width: max-content; max-width: 100%; }
  .summary-panel { grid-template-columns: 1fr; }
  .summary-eyebrow, .summary-approval, .summary-panel .risk-warning { grid-column: auto; }
  .review-work { min-height: 620px; display: block; border: 0; }
  .target-list { border-right: 0; }
  .target-row { grid-template-columns: 1fr; gap: 12px; padding-right: 0; }
  .target-side { align-items: stretch; }
  .draft-pane { position: fixed; z-index: 50; left: 0; right: 0; bottom: 0; max-height: 74vh; overflow: auto; padding: 18px 20px 32px; border-top: 2px solid var(--ink); transform: translateY(105%); transition: transform .25s ease; }
  .draft-pane.open { transform: translateY(0); }
  .review-work.single .draft-pane { position: static; transform: none; max-height: none; border-top: 0; padding: 8px 0 24px; }
  .review-work.single .sheet-close { display: none; }
  .sheet-close { display: block; }
  .sheet-open::after { content: ""; position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, .28); pointer-events: none; }
  .done-panel { min-height: 590px; }
  .channel-list { grid-template-columns: 1fr; }
  .search-gap-form { grid-template-columns: 1fr; }
  .found-card { grid-template-columns: 1fr; gap: 12px; }
  .outside-total { max-width: 145px; text-align: right; }
  .field { grid-template-columns: 1fr; gap: 4px; }
  .optout-form { flex-direction: column; }
  .legal-shell { width: min(100% - 28px, 880px); margin-top: 24px; }
  .legal-toc ol { columns: 1; }
}

@media (max-width: 760px) {
  .review-board, .done-shell { padding-bottom: 96px; }
  .review-top { display: block; }
  .mobile-action-bar {
    position: fixed;
    z-index: 55;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    border-top: 1px solid var(--line);
    background: var(--paper);
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  }
  .review-actions.mobile-action-bar { min-width: 0; }
  .review-actions.mobile-action-bar .primary-button,
  .review-actions.mobile-action-bar .summary-button,
  .review-actions.mobile-action-bar .cancel-button {
    width: 100%;
    max-width: none;
    white-space: nowrap;
  }
  .done-actions.mobile-action-bar { grid-template-columns: 1fr; }
  .done-actions .summary-placeholder { display: none; }
  .debug-mode .test-meter { bottom: 82px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111111;
    --surface: #161616;
    --ink: #f3f3f3;
    --muted: #a5a5a5;
    --line: #3a3a3a;
    --soft: #202020;
    --soft-strong: #2a2a2a;
    --yellow: #26241c;
  }
  .test-meter { background: #f3f3f3; color: #111111; }
  .gap-input, .questions { color: #f3f3f3; }
  .intent-submit { background: #f3f3f3; color: #111111; }
  .count-strip .count-required { background: #f3f3f3; color: #111111; }
}
