:root {
  --paper: #f3efe6;
  --card: #fffef9;
  --ink: #17211f;
  --muted: #5c625f;
  --line: #c9c5ba;
  --green: #175f50;
  --green-soft: #d8e9df;
  --orange: #b55325;
  --yellow: #f1d36b;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", Helvetica, Arial, sans-serif;
}
a { color: inherit; }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }
:focus-visible { outline: 3px solid rgba(23,95,80,.42); outline-offset: 3px; }
.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.skip-link { position: fixed; top: 12px; left: 16px; z-index: 20; transform: translateY(-220%); background: var(--ink); color: white; padding: 12px; }
.skip-link:focus-visible { transform: translateY(0); }

.workbench-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 20px;
  font-size: .86rem;
  font-weight: 750;
}
.workbench-nav > a:last-child { color: var(--muted); text-underline-offset: 4px; }
.workbench-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.workbench-brand span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: var(--ink);
  color: white;
  font-size: .75rem;
  letter-spacing: .06em;
}

.workbench-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(290px, .65fr);
  gap: clamp(30px, 8vw, 100px);
  align-items: end;
  padding: clamp(70px, 10vw, 132px) 0 54px;
}
.eyebrow, .step {
  margin: 0 0 12px;
  color: var(--green);
  font-size: .69rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
h1, h2, h3, h4 { margin: 0; }
h1, h2 {
  font-family: Charter, "Iowan Old Style", Georgia, serif;
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: .98;
  text-wrap: balance;
}
h1 { max-width: 820px; font-size: clamp(3.2rem, 7vw, 6.7rem); }
h2 { font-size: clamp(2.3rem, 4.5vw, 4.5rem); }
.lede { max-width: 730px; margin: 22px 0 0; color: var(--muted); font-size: clamp(1rem, 1.6vw, 1.2rem); line-height: 1.55; }
.trust-note {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  border-top: 3px solid var(--green);
  padding-top: 18px;
}
.trust-icon { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--green); color: var(--green); font-size: 1.4rem; }
.trust-note p { margin: 7px 0 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }

.situation-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--ink);
  background: var(--ink);
  gap: 1px;
}
.situation-strip a {
  display: grid;
  min-height: 178px;
  align-content: space-between;
  gap: 14px;
  padding: 20px;
  background: var(--card);
  text-decoration: none;
  transition: background .18s ease, color .18s ease;
}
.situation-strip a:hover { background: var(--green); color: white; }
.situation-strip span { color: var(--orange); font-family: Georgia, serif; font-size: .82rem; font-weight: 800; }
.situation-strip a:hover span, .situation-strip a:hover small { color: white; }
.situation-strip strong { max-width: 180px; font-family: Charter, Georgia, serif; font-size: 1.35rem; line-height: 1.08; }
.situation-strip small { color: var(--muted); font-weight: 750; }

.builder { margin: 92px 0 72px; }
.builder-intro { display: grid; grid-template-columns: 1fr minmax(260px, 410px); gap: 30px; align-items: end; margin-bottom: 32px; }
.builder-intro .eyebrow { grid-column: 1 / -1; margin-bottom: -16px; }
.builder-intro > p:last-child { margin: 0; color: var(--muted); line-height: 1.55; }
.tool-tabs { display: flex; gap: 0; overflow-x: auto; border-bottom: 1px solid var(--ink); }
.tool-tabs button {
  min-height: 52px;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: transparent;
  padding: 0 21px;
  color: var(--muted);
  font-weight: 800;
}
.tool-tabs button + button { border-left: 0; }
.tool-tabs button.active { background: var(--ink); border-color: var(--ink); color: white; }
.noscript-note { margin: 16px 0; border: 1px solid var(--orange); padding: 16px; }
.no-js .workspace { display: none; }

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  min-height: 670px;
  border: 1px solid var(--ink);
  border-top: 0;
  background: var(--card);
}
.input-column, .output-column { min-width: 0; padding: clamp(22px, 3vw, 38px); }
.input-column { border-right: 1px solid var(--ink); }
.tool-heading, .output-toolbar { display: flex; justify-content: space-between; gap: 20px; align-items: start; }
.tool-heading h3, .output-toolbar h3 { font-family: Charter, Georgia, serif; font-size: clamp(1.6rem, 2.4vw, 2.35rem); line-height: 1.05; }
.sample-button {
  flex: 0 0 auto;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: none;
  padding: 4px 0;
  color: var(--green);
  font-size: .78rem;
  font-weight: 850;
}
.field-help { min-height: 48px; margin: 18px 0; color: var(--muted); font-size: .86rem; line-height: 1.5; }
code { border: 1px solid var(--line); background: var(--paper); padding: 1px 4px; color: var(--ink); }
label { display: grid; gap: 8px; color: var(--ink); font-size: .76rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 0;
  background: white;
  padding: 15px;
  color: var(--ink);
  font-size: .95rem;
  line-height: 1.55;
}
textarea:focus-visible { border-color: var(--green); }
.version-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.make-button {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  border: 1px solid var(--ink);
  background: var(--ink);
  padding: 0 18px;
  color: white;
  font-weight: 850;
}
.make-button:hover { background: var(--green); border-color: var(--green); }
.output-column { display: grid; grid-template-rows: auto 1fr auto auto; background: #e9e5db; }
#output-state {
  max-width: 165px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: right;
}
#output-state.ready { color: var(--green); }
.result { margin: 24px 0; }
.empty-output { display: grid; min-height: 300px; place-items: center; align-content: center; gap: 12px; border: 1px dashed var(--line); color: var(--muted); text-align: center; }
.empty-output span { font-family: Georgia, serif; font-size: 3rem; color: var(--green); }
.empty-output p { max-width: 290px; margin: 0; line-height: 1.5; }
.result-section { border-top: 1px solid var(--line); padding: 16px 0; }
.result-section h4 { display: flex; justify-content: space-between; font-size: .86rem; text-transform: uppercase; letter-spacing: .06em; }
.result-section h4 span { display: grid; place-items: center; width: 23px; height: 23px; background: var(--ink); color: white; font-size: .68rem; }
.result-section ul { display: grid; gap: 12px; margin: 14px 0 0; padding: 0; list-style: none; }
.result-section li { display: grid; grid-template-columns: auto 1fr; gap: 2px 9px; line-height: 1.4; }
.result-section li > span { grid-column: 1 / -1; }
.result-section li strong { color: var(--green); }
.result-section li small { grid-column: 1 / -1; color: var(--muted); font-size: .72rem; }
.missing-value { margin: 11px 0 0; color: var(--orange); font-size: .82rem; }
.needs-review { border-left: 3px solid var(--orange); padding-left: 12px; }
.change-totals { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); }
.change-totals span { display: grid; gap: 2px; padding: 12px; border-right: 1px solid var(--line); color: var(--muted); font-size: .7rem; }
.change-totals span:last-child { border: 0; }
.change-totals strong { color: var(--ink); font-family: Georgia, serif; font-size: 1.5rem; }
.change-removed li strong { color: var(--orange); }
.output-actions { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 16px; }
.output-actions button { min-height: 38px; border: 1px solid var(--ink); background: var(--card); padding: 0 13px; font-weight: 800; }
.output-actions button:not(:disabled):hover { background: var(--ink); color: white; }
.output-actions .quiet-button { margin-left: auto; border-color: transparent; background: transparent; color: var(--muted); }
.review-reminder { margin: 18px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.45; }

.proof-section { display: grid; grid-template-columns: 1fr 1.2fr; gap: 70px; border-top: 1px solid var(--ink); padding: 58px 0 80px; }
.proof-section dl { margin: 0; }
.proof-section dl div { display: grid; grid-template-columns: 150px 1fr; gap: 20px; border-top: 1px solid var(--line); padding: 14px 0; }
.proof-section dt { font-size: .72rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.proof-section dd { margin: 0; color: var(--muted); line-height: 1.45; }
footer { display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); padding: 24px 0 42px; color: var(--muted); font-size: .78rem; font-weight: 700; }
footer p { margin: 0; }

@media (max-width: 820px) {
  .workbench-hero, .builder-intro, .workspace, .proof-section { grid-template-columns: 1fr; }
  .workbench-hero { padding-top: 72px; }
  .situation-strip { grid-template-columns: 1fr 1fr; }
  .input-column { border-right: 0; border-bottom: 1px solid var(--ink); }
  .builder-intro .eyebrow { grid-column: auto; margin-bottom: 0; }
  .workspace { min-height: 0; }
}

@media (max-width: 520px) {
  .workbench-nav > a:last-child { max-width: 120px; text-align: right; }
  .situation-strip { grid-template-columns: 1fr; }
  .situation-strip a { min-height: 132px; }
  .version-grid { grid-template-columns: 1fr; }
  .tool-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }
  .tool-tabs button { min-width: 0; padding: 0 8px; font-size: .78rem; line-height: 1.15; }
  .tool-heading, .output-toolbar { align-items: start; }
  .sample-button { max-width: 74px; text-align: right; }
  .proof-section dl div { grid-template-columns: 1fr; gap: 5px; }
  footer { display: grid; }
}

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

@media print {
  .workbench-nav, .workbench-hero, .situation-strip, .builder-intro, .tool-tabs, .input-column, .output-actions, .proof-section, footer { display: none !important; }
  .workspace { display: block; border: 0; }
  .output-column { background: white; padding: 0; }
}
