:root {
  --ink: #20211e;
  --muted: #6d6e67;
  --subtle: #8b8c84;
  --line: #d6d4cb;
  --line-strong: #aaa89d;
  --paper: #f3f2ed;
  --surface: #fbfaf6;
  --surface-alt: #eeede6;
  --accent: #245647;
  --accent-dark: #173c32;
  --accent-soft: #e1ebe5;
  --amber: #8b5b17;
  --red: #963f3a;
  --radius: 3px;
  font-family: "Aptos", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.45; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 54px;
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #20211e;
  color: #f7f5ef;
  border-bottom: 1px solid #11120f;
}
.wordmark { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.wordmark-mark { display: inline-grid; place-items: center; width: 34px; height: 28px; border: 1px solid #77786f; font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.wordmark-name { font-family: Georgia, "Times New Roman", serif; font-size: 16px; letter-spacing: .01em; }
.local-status { display: flex; gap: 9px; align-items: center; color: #c9c7bd; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.status-dot { width: 6px; height: 6px; background: #85b39e; }

.shell { max-width: 1240px; margin: 0 auto; padding: 34px 24px 48px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 52px; align-items: end; margin-bottom: 28px; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.hero h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(30px, 4vw, 42px); font-weight: 500; line-height: 1.08; letter-spacing: -.025em; }
.lede { max-width: 720px; margin: 10px 0 0; color: var(--muted); font-size: 15px; }
.privacy-note { padding: 13px 15px; background: var(--surface-alt); border: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.privacy-note strong, .privacy-note span { display: block; }
.privacy-note strong { margin: 3px 0 2px; color: var(--ink); font-family: Georgia, "Times New Roman", serif; font-size: 16px; font-weight: 500; }
.privacy-kicker { color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }

.stepper { display: grid; grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; border: 1px solid var(--line-strong); background: var(--surface); }
.step { padding: 10px 13px; border-right: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.step:last-child { border-right: 0; }
.step b { margin-right: 9px; color: var(--subtle); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.step.current { color: #f7f5ef; background: var(--accent); }
.step.current b { color: #bcd2c8; }

.setup-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(310px, .8fr); gap: 14px; align-items: stretch; }
.panel { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.panel + .panel { margin-top: 14px; }
.setup-grid > .panel { margin-top: 0; }
.panel-heading, .results-heading, .table-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.panel-heading.compact { margin-bottom: 14px; }
.panel h2, .results h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 21px; font-weight: 500; letter-spacing: -.015em; }
.panel h3 { margin: 0; font-size: 15px; }

.button { min-height: 36px; padding: 8px 13px; border: 1px solid transparent; border-radius: 2px; font-size: 12px; font-weight: 700; transition: background-color .14s ease, border-color .14s ease; }
.button-primary { color: #fff; background: var(--accent); border-color: var(--accent-dark); }
.button-primary:hover { background: var(--accent-dark); }
.button-secondary { color: var(--ink); background: transparent; border-color: var(--line-strong); }
.button-secondary:hover { background: var(--surface-alt); border-color: #77776f; }
.button:disabled { cursor: not-allowed; opacity: .42; }

.upload-grid { margin-top: 18px; border-top: 1px solid var(--line); }
.upload-card { min-height: 74px; padding: 12px 0; display: grid; grid-template-columns: 34px minmax(160px, 1fr) minmax(160px, .9fr) 92px; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); transition: background-color .14s ease; }
.upload-card:hover { background: #f5f4ef; }
.upload-card.ready { background: var(--accent-soft); }
.file-number { color: var(--subtle); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.file-copy { display: block; }
.file-copy strong { display: block; font-size: 13px; }
.file-copy small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; font-weight: 400; }
.upload-card input { min-width: 0; width: 100%; font-size: 11px; }
.upload-card em { color: var(--accent); font-style: normal; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 700; text-align: right; }
.quiet { margin: 12px 0 0; color: var(--muted); font-size: 11px; }

.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 13px 10px; }
.field-grid label, .email-label { color: #4e4f49; font-size: 11px; font-weight: 700; }
.field-grid input, .mapping-row select, textarea { width: 100%; display: block; margin-top: 5px; padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: 2px; color: var(--ink); background: #fff; }
.field-grid input:focus, .mapping-row select:focus, textarea:focus { outline: 2px solid #b9d0c5; outline-offset: 1px; border-color: var(--accent); }

.mapping-panel { margin-top: 14px; }
.mapping-state { padding: 5px 7px; border: 1px solid #a9bdb4; color: var(--accent); background: var(--accent-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 700; }
.mapping-source { margin-top: 20px; border-top: 1px solid var(--line-strong); padding-top: 14px; }
.mapping-source h3 { margin: 0 0 10px; font-size: 14px; }
.mapping-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.mapping-row { padding: 8px; border: 1px solid var(--line); background: #f7f6f1; font-size: 11px; }
.mapping-row label { display: flex; justify-content: space-between; gap: 8px; color: #464741; font-weight: 700; }
.required { color: var(--red); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; letter-spacing: .04em; text-transform: uppercase; }
.mapping-row select { margin-top: 6px; padding: 7px; font-size: 11px; }

.run-bar { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin: 14px 0 36px; padding: 11px 12px 11px 15px; color: #4e514b; background: #e6e4dc; border: 1px solid var(--line); font-size: 12px; }
.results { margin-top: 0; }
.result-state { margin: 4px 0 0; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); margin: 16px 0 14px; border: 1px solid var(--line); background: var(--surface); }
.metric { min-height: 92px; padding: 14px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric span { display: block; min-height: 32px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.metric strong { display: block; margin-top: 5px; font-family: Georgia, "Times New Roman", serif; font-size: 25px; font-weight: 500; color: var(--ink); }
.metric.high strong { color: var(--red); }
.metric.review strong { color: var(--amber); }

.result-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 14px; }
.findings-panel, .exceptions-panel { min-width: 0; margin: 0 !important; }
.table-heading { margin-bottom: 13px; }
.table-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.table-heading > span { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.table-wrap { max-width: 100%; overflow-x: auto; border-top: 1px solid var(--line-strong); }
table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 12px; }
th { padding: 9px 8px; text-align: left; color: var(--muted); background: #efeee8; border-bottom: 1px solid var(--line); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
td { padding: 11px 8px; vertical-align: top; border-bottom: 1px solid var(--line); }
tbody tr:hover { background: #f3f2ec; }
tr:last-child td { border-bottom: 0; }
.finding-name { display: block; font-weight: 700; text-transform: capitalize; }
.finding-note { display: block; max-width: 250px; margin-top: 4px; color: var(--muted); font-size: 10px; }
.confidence { display: inline-block; margin-top: 5px; padding: 2px 4px; border: 1px solid currentColor; border-radius: 1px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; font-weight: 700; text-transform: uppercase; }
.confidence.high { color: var(--red); background: #f9eeeb; }
.confidence.review_required, .confidence.blocked_by_data { color: var(--amber); background: #f6f0e3; }
.evidence { display: block; margin-top: 5px; color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; }
.money-negative { color: var(--red); font-weight: 700; }
.exceptions-panel { background: #eeede6; }
.exceptions-panel h3 { margin-bottom: 12px; font-family: Georgia, "Times New Roman", serif; font-size: 17px; font-weight: 500; }
.exception { padding: 11px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.exception:last-child { border: 0; }
.exception strong { display: block; margin-bottom: 3px; color: var(--ink); }
.empty-state { padding: 10px 0; color: var(--muted); font-size: 12px; }

.export-panel { margin-top: 14px; }
.export-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.email-label { display: block; margin-top: 18px; }
textarea { resize: vertical; color: #30312d; line-height: 1.55; font-size: 12px; font-weight: 400; }
footer { max-width: 1240px; margin: 0 auto; padding: 20px 24px 36px; display: flex; justify-content: space-between; color: var(--muted); border-top: 1px solid var(--line); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; }
footer nav { display: flex; gap: 16px; }
footer a { color: inherit; }

@media (max-width: 920px) {
  .setup-grid, .hero, .result-layout { grid-template-columns: 1fr; gap: 14px; }
  .upload-card { grid-template-columns: 28px minmax(150px, 1fr) minmax(130px, .8fr) 80px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 640px) {
  .topbar { padding: 0 14px; }
  .wordmark-name { display: none; }
  .local-status { font-size: 9px; }
  .shell { padding: 24px 14px 36px; }
  .hero { margin-bottom: 20px; }
  .hero h1 { font-size: 31px; }
  .stepper { grid-template-columns: repeat(4, minmax(120px, 1fr)); overflow-x: auto; }
  .step { white-space: nowrap; }
  .panel { padding: 16px; }
  .panel-heading { align-items: stretch; flex-direction: column; }
  .panel-heading .button { width: 100%; }
  .upload-card { grid-template-columns: 24px 1fr; gap: 8px; }
  .upload-card input, .upload-card em { grid-column: 2; text-align: left; }
  .field-grid, .mapping-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric:last-child { border-bottom: 0; }
  .run-bar, footer { align-items: stretch; flex-direction: column; }
  .run-bar .button { width: 100%; }
}

@media print {
  .topbar, .hero, .stepper, .setup-grid, .mapping-panel, .run-bar, .export-actions, footer { display: none !important; }
  body, :root { background: #fff; }
  .shell { max-width: none; padding: 0; }
  .results, .export-panel { display: block !important; }
  .panel, .metric-grid { border-color: #bbb; }
}

/* Public landing page */
.landing-body { background: #f3f2ed; }
.landing-topbar { position: sticky; top: 0; z-index: 20; }
.landing-nav { display: flex; align-items: center; gap: 22px; font-size: 12px; }
.landing-nav a { color: #d7d5cc; text-decoration: none; }
.landing-nav a:hover { color: #fff; }
.landing-nav .nav-cta { padding: 7px 10px; color: #fff; border: 1px solid #77786f; }
.landing-hero { max-width: 1240px; margin: 0 auto; padding: 78px 24px 52px; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, .7fr); gap: 72px; align-items: center; }
.landing-hero h1 { max-width: 780px; margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(42px, 6vw, 68px); font-weight: 500; line-height: 1.02; letter-spacing: -.04em; }
.landing-lede { max-width: 690px; margin: 20px 0 0; color: var(--muted); font-size: 18px; line-height: 1.55; }
.landing-actions { margin-top: 28px; display: flex; align-items: center; gap: 20px; }
.landing-actions .button, .landing-cta .button { display: inline-flex; align-items: center; text-decoration: none; }
.text-link { color: var(--accent); font-size: 13px; font-weight: 700; text-underline-offset: 4px; }
.landing-boundary { max-width: 660px; margin: 22px 0 0; padding-top: 15px; color: var(--muted); border-top: 1px solid var(--line); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; line-height: 1.6; }
.ledger-card { background: var(--surface); border: 1px solid var(--line-strong); box-shadow: 9px 9px 0 #dedcd2; }
.ledger-title, .ledger-output { padding: 15px 17px; display: flex; justify-content: space-between; gap: 15px; background: #e9e7df; border-bottom: 1px solid var(--line); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.ledger-card dl { margin: 0; padding: 0 17px; }
.ledger-card dl > div { padding: 16px 0; display: grid; grid-template-columns: 34px 1fr; gap: 10px; border-bottom: 1px solid var(--line); }
.ledger-card dt { color: var(--subtle); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.ledger-card dd { margin: 0; }
.ledger-card dd strong, .ledger-card dd span { display: block; }
.ledger-card dd strong { font-size: 13px; }
.ledger-card dd span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.ledger-output { border: 0; background: var(--accent); color: #d8e6df; }
.ledger-output strong { color: #fff; }
.proof-strip { max-width: 1240px; margin: 0 auto 34px; display: grid; grid-template-columns: repeat(3, 1fr); background: #20211e; color: #fff; border: 1px solid #11120f; }
.proof-strip div { padding: 17px 20px; border-right: 1px solid #4b4c46; }
.proof-strip div:last-child { border-right: 0; }
.proof-strip span, .proof-strip strong { display: block; }
.proof-strip span { color: #9fa098; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.proof-strip strong { margin-top: 4px; font-family: Georgia, "Times New Roman", serif; font-size: 17px; font-weight: 500; }
.landing-section { max-width: 1240px; margin: 0 auto; padding: 70px 24px; }
.section-intro { max-width: 680px; margin-bottom: 34px; }
.section-intro h2, .guardrail-section h2, .landing-cta h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(29px, 4vw, 42px); font-weight: 500; line-height: 1.12; letter-spacing: -.025em; }
.section-intro > p:last-child { margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.workflow-grid { margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); list-style: none; border: 1px solid var(--line-strong); background: var(--surface); }
.workflow-grid li { min-height: 220px; padding: 22px; border-right: 1px solid var(--line); }
.workflow-grid li:last-child { border: 0; }
.workflow-grid li > span { color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 700; }
.workflow-grid h3 { margin: 48px 0 8px; font-family: Georgia, "Times New Roman", serif; font-size: 20px; font-weight: 500; }
.workflow-grid p, .check-grid p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.checks-section { max-width: none; padding-left: max(24px, calc((100vw - 1192px) / 2)); padding-right: max(24px, calc((100vw - 1192px) / 2)); background: #e9e7df; border-block: 1px solid var(--line); }
.check-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line-strong); border-left: 1px solid var(--line); }
.check-grid article { min-height: 150px; padding: 22px; background: var(--surface); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.check-grid h3 { margin: 0 0 9px; font-size: 14px; }
.guardrail-section { max-width: 1192px; margin: 70px auto; padding: 34px; display: grid; grid-template-columns: .9fr 1.1fr; gap: 60px; color: #f5f2e8; background: var(--accent-dark); }
.guardrail-section .eyebrow { color: #9dc1b1; }
.guardrail-section ul { margin: 0; padding-left: 20px; color: #d2ddd7; font-size: 13px; line-height: 1.7; }
.guardrail-section li + li { margin-top: 10px; }
.faq-grid { border-top: 1px solid var(--line-strong); }
.faq-grid details { padding: 17px 0; border-bottom: 1px solid var(--line); }
.faq-grid summary { cursor: pointer; font-family: Georgia, "Times New Roman", serif; font-size: 18px; }
.faq-grid p { max-width: 780px; margin: 10px 0 0; color: var(--muted); font-size: 13px; }
.landing-cta { max-width: 1192px; margin: 0 auto 70px; padding: 30px 34px; display: flex; align-items: center; justify-content: space-between; gap: 30px; background: var(--surface); border: 1px solid var(--line-strong); }
.landing-cta h2 { max-width: 700px; font-size: 30px; }
.landing-footer { max-width: 1192px; }

@media (max-width: 920px) {
  .landing-hero { grid-template-columns: 1fr; gap: 40px; padding-top: 54px; }
  .workflow-grid { grid-template-columns: repeat(2, 1fr); }
  .workflow-grid li:nth-child(2) { border-right: 0; }
  .workflow-grid li:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .check-grid { grid-template-columns: repeat(2, 1fr); }
  .guardrail-section { margin-inline: 24px; grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 640px) {
  .landing-nav a:not(.nav-cta) { display: none; }
  .landing-hero { padding: 42px 14px 34px; }
  .landing-hero h1 { font-size: 40px; }
  .landing-lede { font-size: 16px; }
  .landing-actions { align-items: flex-start; flex-direction: column; }
  .proof-strip { margin-inline: 14px; grid-template-columns: 1fr; }
  .proof-strip div { border-right: 0; border-bottom: 1px solid #4b4c46; }
  .proof-strip div:last-child { border-bottom: 0; }
  .landing-section { padding: 52px 14px; }
  .workflow-grid, .check-grid { grid-template-columns: 1fr; }
  .workflow-grid li { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .workflow-grid li:last-child { border-bottom: 0; }
  .workflow-grid h3 { margin-top: 24px; }
  .guardrail-section { margin: 52px 14px; padding: 25px 20px; }
  .landing-cta { margin: 0 14px 52px; padding: 24px 20px; align-items: flex-start; flex-direction: column; }
}
