:root {
  color-scheme: light;
  --paper: #f4f6f1;
  --surface: #ffffff;
  --surface-soft: #e8eee8;
  --ink: #112126;
  --muted: #526268;
  --line: #cbd4cf;
  --navy: #0b3545;
  --teal: #087f73;
  --teal-dark: #075e57;
  --rust: #a5412d;
  --amber: #d49b18;
  --acid: #d7e667;
  --danger: #8f2f25;
  --focus: #b36c00;
  --shadow: 0 18px 45px rgba(16, 33, 38, 0.09);
  --radius: 8px;
  --content: 1240px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: Geist, "Avenir Next", "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0;
}

button,
input,
select,
textarea { font: inherit; letter-spacing: 0; }

button,
a { -webkit-tap-highlight-color: transparent; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border: 2px solid var(--ink);
  transform: translateY(-160%);
}

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

.topbar {
  position: sticky;
  z-index: 40;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 0 max(22px, calc((100vw - var(--content)) / 2));
  border-bottom: 1px solid rgba(17, 33, 38, 0.18);
  background: rgba(244, 246, 241, 0.96);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: white;
  font-size: 12px;
}

.topbar nav { display: flex; align-items: center; gap: 24px; }
.topbar nav a {
  color: #34464b;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}
.topbar nav a:hover { color: var(--teal-dark); }

main { width: 100%; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.7fr);
  gap: clamp(36px, 7vw, 100px);
  align-items: end;
  width: min(calc(100% - 44px), var(--content));
  min-height: 560px;
  margin: 0 auto;
  padding: clamp(74px, 10vw, 134px) 0 clamp(80px, 10vw, 132px);
}

.hero-copy { max-width: 1050px; }
.eyebrow {
  margin: 0 0 16px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

h1,
h2,
h3,
p { overflow-wrap: anywhere; }

h1 {
  max-width: 1050px;
  margin: 0;
  color: var(--navy);
  font-size: clamp(2.65rem, 6vw, 5rem);
  line-height: 0.98;
  font-weight: 850;
  letter-spacing: 0;
}

.hero-lede {
  max-width: 760px;
  margin: 28px 0 0;
  color: #3d4f54;
  font-size: clamp(1.05rem, 2vw, 1.32rem);
  line-height: 1.5;
}

.hero-actions,
.form-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.hero-actions { margin-top: 36px; }

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
  line-height: 1.15;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button.primary { background: var(--navy); color: white; }
.button.primary:hover { background: #082b38; }
.button.secondary { border-color: var(--navy); background: var(--surface); color: var(--navy); }
.button.secondary:hover { background: var(--surface-soft); }
.button.ghost { border-color: var(--line); background: transparent; color: var(--ink); }
.button.ghost:hover { border-color: var(--muted); background: var(--surface); }
.button.danger { color: var(--danger); }
.button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.hero-aside {
  position: relative;
  padding: 24px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 12px 12px 0 var(--acid);
}

.signal-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--line);
}

.signal-strip span { padding: 10px; background: var(--surface-soft); color: #2d4449; font-size: 12px; font-weight: 850; text-align: center; }
.hero-score { display: flex; gap: 18px; align-items: center; margin: 28px 0; }
.hero-score p { margin: 0; color: var(--muted); }
.score-ring {
  display: grid;
  width: 76px;
  height: 76px;
  flex: 0 0 76px;
  place-items: center;
  border: 8px solid var(--amber);
  border-right-color: var(--surface-soft);
  border-radius: 50%;
  color: var(--navy);
  font-size: 30px;
}

.non-advisory { margin: 0; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

.section-band {
  padding: clamp(78px, 9vw, 126px) max(22px, calc((100vw - var(--content)) / 2));
}

.workspace { background: #e8eee8; }
.results { background: var(--navy); color: white; }
.saved { background: var(--surface); }
.verify { background: #f0d8ca; }

.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  align-items: end;
  margin-bottom: 38px;
}

.section-heading > p { max-width: 560px; margin: 0; color: var(--muted); }
.section-heading h2,
.verify h2 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.04;
}

.results .section-heading h2 { color: white; }
.results .eyebrow { color: #87d9cf; }
.results .button.ghost { border-color: #91aeb7; color: white; }
.results .button.ghost:hover { border-color: white; background: rgba(255, 255, 255, 0.12); }

.form-grid {
  display: grid;
  grid-auto-flow: dense;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 18px;
}

.panel {
  min-width: 0;
  margin: 0;
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

fieldset.panel { padding-top: 20px; }
fieldset.panel legend { padding: 0 8px; color: var(--navy); font-size: 18px; font-weight: 900; }
.current-panel { grid-column: span 7; }
.prior-panel { grid-column: span 5; }

.field-grid { display: grid; gap: 16px; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field.wide { grid-column: 1 / -1; }
.field { display: grid; gap: 7px; min-width: 0; color: #304247; font-size: 13px; font-weight: 800; }

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #aebcb6;
  border-radius: 5px;
  background: #fbfcfa;
  color: var(--ink);
}

input,
select { min-height: 45px; padding: 9px 11px; }
textarea { min-height: 76px; padding: 11px; resize: vertical; }
input:hover,
select:hover,
textarea:hover { border-color: #778b84; }
input:focus,
select:focus,
textarea:focus { border-color: var(--teal); outline: 3px solid rgba(8, 127, 115, 0.22); }
input[aria-invalid="true"] { border-color: var(--danger); background: #fff4f1; }

.money-input { display: flex; align-items: center; min-height: 45px; border: 1px solid #aebcb6; border-radius: 5px; background: #fbfcfa; }
.money-input > span { padding-left: 11px; color: var(--muted); }
.money-input input { border: 0; background: transparent; }
.money-input:focus-within { border-color: var(--teal); outline: 3px solid rgba(8, 127, 115, 0.22); }

.helper-block { margin-top: 22px; padding: 15px; border-left: 4px solid var(--amber); background: #f8f3e3; color: #3f4b4c; font-size: 13px; }
.helper-block p { margin: 5px 0 0; }

.evidence-panel { margin-top: 18px; }
.legend-note { max-width: 760px; margin: 0 0 22px; color: var(--muted); }
.check-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.check { display: flex; gap: 12px; min-height: 86px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfa; cursor: pointer; }
.check:hover { border-color: var(--teal); }
.check:has(input:checked) { border-color: var(--teal); background: #e4f3ef; box-shadow: inset 0 0 0 1px var(--teal); }
.check input { width: 19px; min-height: 19px; flex: 0 0 19px; margin: 2px 0 0; accent-color: var(--teal); }
.check span { display: grid; gap: 4px; }
.check strong { color: var(--ink); font-size: 13px; }
.check small { color: var(--muted); font-size: 12px; line-height: 1.4; }

.form-actions { margin-top: 20px; }
.form-status { min-height: 24px; color: var(--danger); font-size: 13px; font-weight: 750; }

.result-grid { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 18px; }
.classification-card,
.metrics-card {
  min-width: 0;
  padding: clamp(24px, 4vw, 40px);
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
}
.classification-card { border-top: 7px solid var(--amber); }
.classification-card[data-class="new"] { border-top-color: var(--teal); }
.classification-card[data-class="amendment"] { border-top-color: var(--rust); }
.classification-card[data-class="continuation"] { border-top-color: #5567a8; }
.classification-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px; }
.classification-label { padding: 6px 9px; border: 1px solid currentColor; border-radius: 4px; color: var(--teal-dark); font-size: 12px; font-weight: 900; text-transform: uppercase; }
.confidence-value { color: var(--muted); font-size: 13px; font-weight: 800; }
.classification-card h3 { max-width: 720px; margin: 24px 0 12px; color: var(--navy); font-size: clamp(1.7rem, 4vw, 3rem); line-height: 1.04; }
.classification-card > p { max-width: 800px; color: var(--muted); }
.meter { height: 11px; margin-top: 27px; overflow: hidden; border-radius: 2px; background: var(--surface-soft); }
.meter span { display: block; width: 0; height: 100%; background: var(--teal); transition: width 500ms ease; }
.confidence-caption { margin-bottom: 0; font-size: 12px; }

.metrics-card h3,
.panel h3 { margin: 0; color: var(--navy); font-size: 20px; }
.metrics-list { display: grid; margin: 20px 0 0; }
.metrics-list div { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-top: 1px solid var(--line); }
.metrics-list dt { color: var(--muted); }
.metrics-list dd { margin: 0; color: var(--navy); font-weight: 900; text-align: right; }

.analysis-grid { display: grid; grid-template-columns: 1.45fr 0.55fr; gap: 18px; margin-top: 18px; }
.card-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px; align-items: center; }
.signal { padding: 5px 8px; border-radius: 4px; background: var(--surface-soft); color: #33484d; font-size: 11px; font-weight: 900; text-transform: uppercase; }
.table-wrap { overflow-x: auto; margin-top: 20px; }
table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 13px; }
th,
td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
td:first-child { color: var(--navy); font-weight: 850; }
.comparison-card,
.reasoning-card,
.timeline-card { color: var(--ink); }
.reasoning-list { display: grid; gap: 13px; margin: 22px 0 0; padding-left: 21px; color: #3e5156; }
.reasoning-list li::marker { color: var(--teal); font-weight: 900; }
.timeline-card { margin-top: 18px; }
.timeline { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin-top: 30px; }
.timeline-item { position: relative; min-width: 0; padding: 24px 20px 0 0; border-top: 3px solid var(--line); }
.timeline-item::before { position: absolute; top: -8px; left: 0; width: 13px; height: 13px; border: 2px solid white; border-radius: 50%; background: var(--teal); content: ""; box-shadow: 0 0 0 1px var(--teal); }
.timeline-item strong { display: block; color: var(--navy); }
.timeline-item span { color: var(--muted); font-size: 13px; }

.saved-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.saved-card { display: grid; min-width: 0; gap: 16px; padding: 20px; border: 1px solid var(--line); border-top: 5px solid var(--teal); border-radius: var(--radius); background: var(--paper); }
.saved-card h3 { margin: 0; color: var(--navy); font-size: 18px; }
.saved-card p { margin: 0; color: var(--muted); font-size: 13px; }
.saved-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.saved-meta span { padding: 4px 7px; border-radius: 3px; background: var(--surface-soft); color: var(--muted); font-size: 11px; font-weight: 800; }
.saved-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.saved-actions button { min-height: 39px; }
.empty-state { margin: 0; padding: 28px; border: 1px dashed #91a19b; color: var(--muted); text-align: center; }

.verify { display: grid; grid-template-columns: minmax(260px, 0.68fr) minmax(0, 1.32fr); gap: clamp(42px, 8vw, 110px); }
.verify-intro { align-self: start; }
.verify-intro > p:last-child { max-width: 580px; color: #5b4540; font-size: 18px; }
.verify-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; border: 1px solid #c5a89a; background: #c5a89a; }
.verify-steps article { position: relative; min-height: 230px; padding: 27px; background: #fff8f4; }
.verify-steps span { position: absolute; top: 20px; right: 22px; color: #bd9c8c; font-size: 42px; font-weight: 900; }
.verify-steps h3 { max-width: 220px; margin: 0 0 18px; color: var(--navy); font-size: 20px; }
.verify-steps p { margin: 0; color: #5b514e; }
.verify details { grid-column: 1 / -1; border-top: 1px solid #b89482; border-bottom: 1px solid #b89482; }
.verify summary { padding: 22px 0; cursor: pointer; color: var(--navy); font-weight: 900; }
.details-copy { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 30px; padding-bottom: 24px; color: #564742; }

footer { display: flex; justify-content: space-between; gap: 24px; padding: 28px max(22px, calc((100vw - var(--content)) / 2)); background: var(--ink); color: #d9e1dd; font-size: 12px; }
footer p { margin: 0; }

.toast {
  position: fixed;
  z-index: 80;
  right: 20px;
  bottom: 20px;
  max-width: min(380px, calc(100vw - 40px));
  padding: 13px 16px;
  border-radius: 5px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

[hidden] { display: none !important; }

@media (max-width: 1040px) {
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .hero-aside { max-width: 660px; }
  .current-panel,
  .prior-panel { grid-column: 1 / -1; }
  .check-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .analysis-grid { grid-template-columns: 1fr; }
  .saved-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  html { scroll-padding-top: 66px; }
  .topbar { min-height: 60px; padding-inline: 16px; }
  .topbar nav { gap: 14px; }
  .topbar nav a { flex: 0 0 auto; font-size: 12px; }
  .topbar nav a[href="#saved"] { display: none; }
  .brand > span:last-child { display: none; }
  .hero { width: min(calc(100% - 32px), var(--content)); padding: 68px 0 82px; }
  h1 { font-size: clamp(2.2rem, 9.5vw, 3rem); line-height: 1; }
  .hero-lede { font-size: 1.05rem; }
  .section-band { padding-inline: 16px; }
  .section-heading { display: grid; align-items: start; }
  .field-grid.two { grid-template-columns: 1fr; }
  .field.wide { grid-column: auto; }
  .check-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: 1fr; gap: 0; }
  .timeline-item { padding: 14px 0 25px 24px; border-top: 0; border-left: 3px solid var(--line); }
  .timeline-item::before { top: 17px; left: -8px; }
  .saved-list { grid-template-columns: 1fr; }
  .verify { grid-template-columns: 1fr; }
  .verify-steps { grid-template-columns: 1fr; }
  .details-copy { grid-template-columns: 1fr; }
  footer { display: grid; }
}

@media (max-width: 430px) {
  .hero-actions .button,
  .form-actions .button,
  .result-actions .button { width: 100%; }
  .hero-aside { padding: 18px; box-shadow: 7px 7px 0 var(--acid); }
  .panel { padding: 18px; }
  .classification-card,
  .metrics-card { padding: 22px 18px; }
  .metrics-list div { display: grid; gap: 4px; }
  .metrics-list dd { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
