:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17211f;
  background: #f3f6f5;
  font-synthesis: none;
  letter-spacing: 0;
  --ink: #17211f;
  --muted: #586662;
  --line: #cbd5d2;
  --paper: #ffffff;
  --teal: #0e6358;
  --teal-dark: #08463f;
  --mint: #d9eee8;
  --coral: #d94f3d;
  --coral-soft: #f8dfda;
  --blue-soft: #e2e9fa;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: #f3f6f5;
  color: var(--ink);
}

a { color: inherit; }
button, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.topbar {
  min-height: 64px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--teal-dark);
  color: #fff;
  border-bottom: 4px solid var(--coral);
}

.brand {
  font-size: 22px;
  font-weight: 850;
  text-decoration: none;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 14px;
  font-weight: 700;
}

.topbar nav a { text-decoration: none; }
.topbar nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

main { width: 100%; }

.intro,
.workbench,
.evidence-band,
.next-band,
footer {
  padding-left: max(24px, calc((100vw - 1180px) / 2));
  padding-right: max(24px, calc((100vw - 1180px) / 2));
}

.intro {
  padding-top: 72px;
  padding-bottom: 38px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.intro-copy { max-width: 860px; }
.eyebrow, .section-index, .result-kicker {
  margin: 0 0 14px;
  color: var(--teal);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 850;
  text-transform: uppercase;
}

h1, h2, h3, p { overflow-wrap: anywhere; }
h1 {
  max-width: 880px;
  margin: 0;
  font-size: 72px;
  line-height: 1.02;
  font-weight: 850;
  letter-spacing: 0;
}

.lede {
  max-width: 760px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.65;
}

.contract-strip {
  margin: 42px 0 0;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(120px, 0.7fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.contract-strip div { min-width: 0; padding: 18px 20px 18px 0; }
.contract-strip div + div { padding-left: 20px; border-left: 1px solid var(--line); }
.contract-strip dt { margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.contract-strip dd { margin: 0; min-width: 0; font-size: 15px; font-weight: 750; }
.contract-strip code { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.workbench { padding-top: 58px; padding-bottom: 70px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
h2 { margin: 0; font-size: 30px; line-height: 1.2; font-weight: 820; }
h3 { margin: 0; font-size: 18px; line-height: 1.35; }

.status {
  min-width: 190px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.status.is-valid { border-color: var(--teal); background: var(--mint); color: var(--teal-dark); }
.status.is-invalid { border-color: var(--coral); background: var(--coral-soft); color: #7c261b; }

.input-label { display: block; margin-bottom: 10px; font-size: 14px; font-weight: 800; }
textarea {
  width: 100%;
  min-height: 178px;
  resize: vertical;
  padding: 18px;
  border: 1px solid #aab8b4;
  border-radius: 5px;
  background: var(--paper);
  color: var(--ink);
  font-family: "Cascadia Code", Consolas, ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.55;
  outline: none;
}
textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(14, 99, 88, 0.12); }

.actions { min-height: 46px; margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.primary, .secondary {
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 800;
}
.primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.primary:hover { background: var(--teal-dark); }
.secondary { background: var(--paper); color: var(--ink); border-color: #aab8b4; }
.secondary:hover { border-color: var(--teal); color: var(--teal); }
.task-button { margin-left: auto; }
.message { min-height: 24px; margin: 12px 0 0; color: var(--coral); font-size: 14px; font-weight: 700; }

.result { margin-top: 34px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); overflow: hidden; }
.result-banner { min-height: 108px; padding: 24px; display: flex; align-items: center; justify-content: space-between; gap: 24px; background: var(--mint); border-bottom: 1px solid var(--line); }
.result.is-invalid .result-banner { background: var(--coral-soft); }
.result-mark { width: 48px; height: 48px; flex: 0 0 48px; display: grid; place-items: center; border-radius: 50%; background: var(--teal); color: #fff; font-size: 28px; font-weight: 900; }
.result.is-invalid .result-mark { background: var(--coral); }
.evidence-grid { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.evidence-grid div { min-width: 0; min-height: 96px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.evidence-grid div:not(:nth-child(3n + 1)) { border-left: 1px solid var(--line); }
.evidence-grid dt { margin-bottom: 9px; color: var(--muted); font-size: 11px; font-weight: 850; text-transform: uppercase; }
.evidence-grid dd { margin: 0; font-size: 15px; line-height: 1.45; font-weight: 760; overflow-wrap: anywhere; }
.digest-block { padding: 22px; }
.digest-block p { margin: 0 0 7px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.digest-block p:not(:first-child) { margin-top: 18px; }
.digest-block code { display: block; padding: 12px; background: #edf1f0; border-radius: 4px; font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }

.evidence-band { padding-top: 64px; padding-bottom: 72px; background: #17211f; color: #fff; }
.evidence-band .section-index { color: #74cdbd; }
.boundary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid #48605a; border-bottom: 1px solid #48605a; }
.boundary-grid article { min-width: 0; min-height: 230px; padding: 28px 24px 28px 0; }
.boundary-grid article + article { padding-left: 24px; border-left: 1px solid #48605a; }
.boundary-grid .boundary-warning { background: #2d2523; padding-right: 24px; }
.boundary-code { display: inline-block; margin-bottom: 42px; color: #74cdbd; font-family: ui-monospace, monospace; font-size: 12px; font-weight: 850; }
.boundary-warning .boundary-code { color: #f18878; }
.boundary-grid p { margin: 14px 0 0; color: #c6d0cd; line-height: 1.65; }

.next-band { padding-top: 58px; padding-bottom: 58px; display: flex; align-items: center; justify-content: space-between; gap: 40px; background: var(--blue-soft); border-bottom: 1px solid #c1cbe4; }
.next-band p:not(.section-index) { max-width: 690px; margin: 13px 0 0; color: #4b566f; line-height: 1.6; }
.next-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 20px; }
.text-link { font-size: 14px; font-weight: 800; text-underline-offset: 4px; }

footer { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--paper); color: var(--muted); font-size: 13px; }
footer p { margin: 0; }

@media (max-width: 820px) {
  h1 { font-size: 56px; }
  .contract-strip { grid-template-columns: 1fr; }
  .contract-strip div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .evidence-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .evidence-grid div { border-left: 0 !important; }
  .evidence-grid div:nth-child(even) { border-left: 1px solid var(--line) !important; }
  .boundary-grid { grid-template-columns: 1fr; }
  .boundary-grid article { min-height: 0; padding: 24px 0; }
  .boundary-grid article + article { padding-left: 0; border-left: 0; border-top: 1px solid #48605a; }
  .boundary-grid .boundary-warning { padding-right: 0; background: transparent; }
  .boundary-code { margin-bottom: 18px; }
  .next-band { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
  .topbar { padding: 0 18px; }
  .topbar nav { gap: 14px; font-size: 12px; }
  .intro, .workbench, .evidence-band, .next-band, footer { padding-left: 18px; padding-right: 18px; }
  .intro { padding-top: 48px; }
  h1 { font-size: 40px; }
  .lede { font-size: 16px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .status { width: 100%; }
  .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .task-button { grid-column: 1 / -1; margin-left: 0; }
  .actions button { width: 100%; }
  .evidence-grid { grid-template-columns: 1fr; }
  .evidence-grid div { border-left: 0 !important; }
  .result-banner { align-items: flex-start; }
  .next-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .next-actions .primary { width: 100%; }
  footer { padding-top: 26px; padding-bottom: 26px; align-items: flex-start; flex-direction: column; }
}

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