:root {
  color-scheme: light;
  --ink: #14232b;
  --muted: #607077;
  --paper: #f5f2ea;
  --card: #fffefa;
  --line: #d9ded9;
  --navy: #173b46;
  --navy-2: #0f2d36;
  --amber: #eca72c;
  --amber-soft: #fff0c9;
  --green: #26745f;
  --green-soft: #dff2e9;
  --red: #a64a3e;
  --red-soft: #fae5df;
  --blue-soft: #e5eef0;
  --radius: 18px;
  --shadow: 0 22px 60px rgba(22, 45, 51, 0.1);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 18%, rgba(236, 167, 44, 0.1), transparent 24rem),
    linear-gradient(180deg, #f9f7f1 0, var(--paper) 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

button, input, textarea { font: inherit; }

button { cursor: pointer; }

a { color: var(--navy); }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 14px;
  color: white;
  background: var(--navy-2);
  border-radius: 8px;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(20, 35, 43, 0.12);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 27px;
  display: grid;
  place-items: center;
  background: var(--navy);
  clip-path: polygon(0 13%, 100% 0, 76% 49%, 96% 100%, 48% 72%, 0 90%, 18% 50%);
}

.brand-mark span {
  width: 7px;
  height: 7px;
  background: var(--amber);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.78);
}

.header-proof {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
}

.header-proof span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #35a67e;
  box-shadow: 0 0 0 4px rgba(53, 166, 126, 0.15);
}

main {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
  min-height: calc(100vh - 170px);
}

.stepper { padding: 22px 0 12px; }

.stepper ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  position: relative;
}

.stepper ol::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 15px;
  left: 10%;
  right: 10%;
  height: 1px;
  background: var(--line);
}

.stepper li {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: #8b9698;
  font-size: 0.73rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stepper li span {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  color: #778486;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-weight: 800;
}

.stepper li.active, .stepper li.complete { color: var(--navy); }
.stepper li.active span { color: white; background: var(--navy); border-color: var(--navy); }
.stepper li.complete span { color: var(--navy); background: var(--amber-soft); border-color: var(--amber); }

.message, .synthetic-banner {
  margin: 10px 0 18px;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 650;
}

.message { color: #7e3028; background: var(--red-soft); border: 1px solid #ebbbb3; }
.synthetic-banner { color: #66450a; background: var(--amber-soft); border: 1px solid #e8c36e; }

.step-panel { padding: 36px 0 78px; }

.upload-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.7fr);
  gap: clamp(48px, 8vw, 112px);
  align-items: center;
  padding-top: 54px;
}

.eyebrow, .card-kicker {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1, h2, h3, p { text-wrap: pretty; }

.hero-copy h1, .section-heading h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.04;
}

.hero-copy h1 { max-width: 730px; font-size: clamp(3rem, 5.5vw, 5.3rem); }
.hero-copy h1 em { color: var(--green); font-weight: inherit; }

.lede {
  max-width: 670px;
  margin: 25px 0 32px;
  color: var(--muted);
  font-size: 1.07rem;
  line-height: 1.75;
}

.trust-list {
  list-style: none;
  margin: 0;
  padding: 23px 0 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  border-top: 1px solid var(--line);
}

.trust-list li { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; align-items: baseline; }
.trust-list span { color: var(--amber); font-family: Georgia, serif; font-size: 0.88rem; }
.trust-list strong { font-size: 0.84rem; }
.trust-list small { grid-column: 2; margin-top: 5px; color: var(--muted); font-size: 0.73rem; line-height: 1.5; }

.upload-card, .facts-card, .document-card, .results-card, .letter-card, .grounding-card {
  background: var(--card);
  border: 1px solid rgba(20, 35, 43, 0.1);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.upload-card { padding: clamp(26px, 3vw, 38px); position: relative; overflow: hidden; }
.upload-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: linear-gradient(90deg, var(--amber), #f1c866); }
.upload-card h2 { margin: 0; font-family: Georgia, serif; font-size: 1.75rem; font-weight: 500; letter-spacing: -0.025em; }
.upload-card > p:not(.privacy) { margin: 8px 0 22px; color: var(--muted); font-size: 0.9rem; }

.button {
  min-height: 45px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 760;
  text-decoration: none;
}

.button:focus-visible, input:focus-visible, textarea:focus-visible, .file-target:focus-within {
  outline: 3px solid rgba(236, 167, 44, 0.48);
  outline-offset: 2px;
}

.button[disabled] { cursor: wait; opacity: 0.65; }
.button.primary { color: white; background: var(--green); border-color: var(--green); }
.button.primary:hover { background: #1d6653; }
.button.dark { color: white; background: var(--navy-2); border-color: var(--navy-2); }
.button.secondary { color: var(--navy); background: white; border-color: #bdc9c9; }
.button.text { color: var(--navy); background: transparent; border-color: transparent; }
.button.wide { width: 100%; margin-top: 10px; }

.or { display: flex; align-items: center; gap: 12px; margin: 22px 0 13px; color: #899496; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.09em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.file-target {
  min-height: 110px;
  padding: 18px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 13px;
  align-items: center;
  border: 1px dashed #9eafae;
  border-radius: 12px;
  background: #f8faf7;
  cursor: pointer;
}

.file-target input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-icon { grid-row: 1 / 3; width: 43px; height: 52px; display: grid; place-items: center; color: var(--green); background: var(--green-soft); border-radius: 7px 14px 7px 7px; font-size: 0.68rem; font-weight: 900; }
.file-target strong { align-self: end; }
.file-target small { align-self: start; color: var(--muted); }
.privacy { margin: 16px 0 0; color: var(--muted); font-size: 0.72rem; line-height: 1.55; }

.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 36px; margin: 22px 0 26px; }
.section-heading h1 { font-size: clamp(2.35rem, 4vw, 4rem); }
.section-heading > p { width: min(100%, 440px); margin: 0 0 5px; color: var(--muted); line-height: 1.7; }

.review-layout { display: grid; grid-template-columns: minmax(310px, 0.67fr) minmax(0, 1.33fr); gap: 22px; align-items: start; }
.document-card { position: sticky; top: 18px; overflow: hidden; box-shadow: none; background: #e8e7e1; }
.document-header { padding: 15px 18px; display: flex; justify-content: space-between; color: white; background: var(--navy-2); font-size: 0.82rem; }
.document-header span { color: #b8cacc; }
#pdf-preview { width: 100%; height: 700px; border: 0; background: #dfe2df; }
.synthetic-preview { min-height: 580px; padding: 44px; display: flex; flex-direction: column; justify-content: center; text-align: center; }
.synthetic-preview > span { width: 84px; height: 84px; margin: 0 auto 18px; display: grid; place-items: center; color: #765414; background: var(--amber-soft); border: 1px solid #dec171; border-radius: 50%; font-family: Georgia, serif; font-size: 2.6rem; }
.synthetic-preview h3 { margin: 0; font-family: Georgia, serif; font-size: 1.7rem; }
.synthetic-preview p { color: var(--muted); }

.facts-card { padding: 25px; box-shadow: none; }
.facts-header, .results-header { display: flex; justify-content: space-between; gap: 20px; align-items: center; margin-bottom: 20px; }
.facts-header h2, .results-header h2 { margin: 0; font-family: Georgia, serif; font-size: 1.6rem; font-weight: 500; }
.facts-header .card-kicker, .results-header .card-kicker { margin-bottom: 4px; }
.fact-count { padding: 5px 9px; color: var(--green); background: var(--green-soft); border-radius: 999px; font-size: 0.72rem; font-weight: 800; }
.fact-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.fact-field { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.fact-field label { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; color: var(--muted); font-size: 0.72rem; font-weight: 750; }
.evidence-type { color: var(--green); text-transform: uppercase; font-size: 0.62rem; letter-spacing: 0.08em; }
.evidence-type.inferred { color: #8b610c; }
.fact-field input, .letter-card input, .letter-card textarea {
  width: 100%;
  padding: 9px 10px;
  color: var(--ink);
  background: #fbfcf9;
  border: 1px solid #bdc8c7;
  border-radius: 8px;
}
.fact-field details { margin-top: 8px; color: var(--muted); font-size: 0.7rem; }
.fact-field summary { cursor: pointer; }
.fact-field blockquote { margin: 6px 0 0; padding-left: 8px; border-left: 2px solid var(--amber); }
.charge-review { margin-top: 25px; }
.charge-review h3 { margin: 0 0 10px; font-size: 0.88rem; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
th { padding: 10px 9px; color: #738083; text-align: left; border-bottom: 1px solid var(--line); font-size: 0.65rem; letter-spacing: 0.07em; text-transform: uppercase; }
td { padding: 11px 9px; vertical-align: top; border-bottom: 1px solid #e8ebe7; }
td input { width: 82px; padding: 7px; border: 1px solid #c7d0cf; border-radius: 7px; }
.charge-label { min-width: 150px; font-weight: 720; }
.source-button { color: var(--green); background: none; border: 0; text-decoration: underline; font-size: 0.72rem; }

.form-actions { margin-top: 25px; display: flex; justify-content: space-between; align-items: center; }

.verdict-card {
  min-height: 152px;
  margin-bottom: 17px;
  padding: 28px 31px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  color: white;
  background: var(--green);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.verdict-card.discrepancy { background: #96503e; }
.verdict-card::after { content: ""; width: 210px; height: 210px; position: absolute; right: -55px; border: 45px solid rgba(255,255,255,0.09); border-radius: 50%; }
.verdict-icon { flex: 0 0 66px; width: 66px; height: 66px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,0.45); border-radius: 50%; font-family: Georgia, serif; font-size: 2.2rem; }
.verdict-copy { flex: 1; position: relative; z-index: 1; }
.verdict-copy span { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.82; }
.verdict-copy h2 { margin: 4px 0; font-family: Georgia, serif; font-size: clamp(1.7rem, 3vw, 2.6rem); font-weight: 500; }
.verdict-copy p { margin: 0; opacity: 0.84; }

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 17px; }
.metric { padding: 17px 18px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.metric span { display: block; color: var(--muted); font-size: 0.67rem; letter-spacing: 0.06em; text-transform: uppercase; }
.metric strong { display: block; margin-top: 5px; font-family: Georgia, serif; font-size: 1.5rem; font-weight: 500; }

.results-card { padding: 24px; box-shadow: none; }
.audit-table th:nth-child(2) { min-width: 180px; }
.audit-table th:last-child { min-width: 330px; }
.status-pill { display: inline-flex; padding: 4px 7px; border-radius: 999px; font-size: 0.61rem; font-weight: 850; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; }
.status-pill.verified { color: #155844; background: var(--green-soft); }
.status-pill.discrepancy { color: #843a30; background: var(--red-soft); }
.status-pill.cannot_verify { color: #6e530d; background: var(--amber-soft); }
.trace { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: #324e55; font-size: 0.72rem; }
.evidence-line { margin-top: 5px; color: var(--muted); font-size: 0.7rem; }
.citation-links { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 8px; }
.citation-links a { color: var(--green); font-size: 0.68rem; }
.audit-table tr.optional-line[hidden] { display: none; }

.comparison-card { min-height: 390px; padding: clamp(30px, 5vw, 60px); display: grid; grid-template-columns: 120px 1fr 0.85fr; gap: 42px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.insufficiency-mark { width: 106px; height: 106px; display: grid; place-items: center; background: var(--amber-soft); border-radius: 50%; }
.insufficiency-mark span { width: 46px; height: 46px; display: grid; place-items: center; color: #77520b; border: 4px solid #9b7119; border-top-color: transparent; border-radius: 50%; font-family: Georgia, serif; font-size: 1.3rem; }
.comparison-card h2 { margin: 13px 0 12px; font-family: Georgia, serif; font-size: clamp(2rem, 3.5vw, 3.2rem); font-weight: 500; line-height: 1.08; }
.comparison-card p { color: var(--muted); line-height: 1.7; }
.needed-data { padding: 23px; background: #f2f5f1; border-radius: 13px; }
.needed-data h3 { margin-top: 0; }
.needed-data ul { padding-left: 19px; }
.needed-data li { margin: 9px 0; }
.needed-data p { margin-bottom: 0; font-size: 0.78rem; }
.principle-strip { margin-top: 14px; padding: 18px 22px; display: flex; justify-content: space-between; gap: 30px; color: #d8e5e5; background: var(--navy-2); border-radius: 12px; }
.principle-strip span { font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; }

.action-layout { display: grid; grid-template-columns: 1.25fr 0.75fr; gap: 20px; align-items: start; }
.letter-card { padding: 28px; box-shadow: none; }
.letter-card label { display: block; margin: 0 0 7px; color: var(--muted); font-size: 0.75rem; font-weight: 800; }
.letter-card textarea { margin-bottom: 16px; resize: vertical; line-height: 1.6; }
.letter-card input { margin-bottom: 16px; }
.letter-actions { display: flex; gap: 10px; }
.review-note { margin: 20px 0 0; padding: 13px; display: flex; gap: 9px; color: #694d10; background: var(--amber-soft); border-radius: 9px; font-size: 0.77rem; }
.review-note span { flex: 0 0 21px; width: 21px; height: 21px; display: grid; place-items: center; color: white; background: #9c7219; border-radius: 50%; font-weight: 900; }
.grounding-card { padding: 28px; box-shadow: none; background: var(--navy-2); color: white; }
.grounding-card .card-kicker { color: #84c8b3; }
.grounding-card h2 { margin: 0; font-family: Georgia, serif; font-size: 1.8rem; font-weight: 500; }
.grounding-card ul { padding-left: 20px; color: #c5d3d4; }
.grounding-card li { margin: 13px 0; }
.grounded-claim { margin-top: 20px; padding: 14px; color: var(--ink); background: #eef3ed; border-radius: 9px; font-size: 0.78rem; }

footer { width: min(1200px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0 30px; display: flex; justify-content: space-between; gap: 20px; color: var(--muted); border-top: 1px solid var(--line); font-size: 0.74rem; }

@media (max-width: 900px) {
  .upload-panel, .review-layout, .action-layout { grid-template-columns: 1fr; }
  .upload-panel { gap: 42px; padding-top: 32px; }
  .document-card { position: static; }
  #pdf-preview { height: 520px; }
  .comparison-card { grid-template-columns: 90px 1fr; }
  .needed-data { grid-column: 1 / -1; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .site-header, main, footer { width: min(100% - 24px, 1200px); }
  .header-proof { display: none; }
  .stepper li b { display: none; }
  .stepper { padding-bottom: 0; }
  .step-panel { padding-top: 25px; }
  .hero-copy h1 { font-size: 2.75rem; }
  .trust-list { grid-template-columns: 1fr; }
  .section-heading { align-items: start; flex-direction: column; gap: 14px; }
  .fact-fields, .metric-grid { grid-template-columns: 1fr; }
  .facts-card, .results-card, .letter-card, .grounding-card { padding: 18px; }
  .comparison-card { padding: 25px; grid-template-columns: 1fr; }
  .insufficiency-mark { width: 80px; height: 80px; }
  .form-actions, .letter-actions, footer { align-items: stretch; flex-direction: column; }
  .form-actions .button, .letter-actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
