:root {
  --ink: #16211d;
  --muted: #64716b;
  --paper: #f4f1e9;
  --panel: #fffdf7;
  --line: #d8d4c9;
  --green: #1f6b4f;
  --green-dark: #164b39;
  --lime: #c9f27b;
  --red: #a33b32;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
.shell { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.nav { height: 82px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 760; letter-spacing: -.03em; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: var(--panel); background: var(--green); font-family: Georgia, serif; }
.api-link { color: var(--green-dark); text-decoration: none; font-size: 14px; font-weight: 700; }
.nav-actions { display: flex; align-items: center; gap: 14px; }
.nav-button { padding: 0; border: 0; background: transparent; }
.nav-primary, .primary-link { padding: 10px 14px; color: white; background: var(--green); text-decoration: none; font-size: 13px; font-weight: 750; }
.nav-primary:hover, .primary-link:hover { background: var(--green-dark); }
.session-user { max-width: 260px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.hero { padding: 88px 0 60px; max-width: 850px; }
.eyebrow { margin: 0 0 18px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
h1 { margin: 0; font: 500 clamp(52px, 7.5vw, 94px)/.94 Georgia, "Times New Roman", serif; letter-spacing: -.055em; }
h1 span { color: var(--green); font-style: italic; }
.lede { max-width: 650px; margin: 30px 0 0; color: var(--muted); font-size: 18px; line-height: 1.65; }
.auth-gate { margin-bottom: 36px; padding: 42px; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 18px 50px rgb(22 33 29 / 7%); }
.auth-gate > p:not(.eyebrow) { max-width: 640px; margin: 8px 0 0; color: var(--muted); line-height: 1.55; }
.auth-actions { display: flex; align-items: center; gap: 10px; margin-top: 24px; }
.auth-actions .secondary { display: inline-flex; align-items: center; text-decoration: none; }
.organization-form { display: grid; grid-template-columns: minmax(220px, 1fr) auto; align-items: end; gap: 12px; max-width: 720px; margin-top: 24px; }
.organization-form label { display: grid; gap: 7px; font-size: 12px; font-weight: 750; }
.organization-form input { width: 100%; height: 48px; padding: 0 13px; border: 1px solid var(--line); background: white; color: var(--ink); font: inherit; }
.organization-form input:focus { outline: 2px solid var(--lime); border-color: var(--green); }
.organization-form .primary { width: auto; min-width: 190px; margin: 0; }
.organization-form .error { grid-column: 1 / -1; }
.workspace-switcher { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(300px, .8fr); align-items: end; gap: 28px; margin-bottom: 24px; padding: 28px 36px; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 18px 50px rgb(22 33 29 / 7%); }
.workspace-switcher p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.workspace-switcher form > label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 750; }
.workspace-switcher form > div { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.workspace-switcher select { min-width: 0; height: 42px; padding: 0 12px; border: 1px solid var(--line); color: var(--ink); background: white; font: inherit; }
.workspace-switcher select:focus { outline: 2px solid var(--lime); border-color: var(--green); }
.workspace-switch-status { grid-column: 1 / -1; min-height: 16px; margin: -12px 0 0 !important; color: var(--green-dark) !important; }
.billing-panel { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(320px, 1.2fr); margin-bottom: 24px; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 18px 50px rgb(22 33 29 / 7%); }
.billing-summary, .billing-purchase { padding: 32px 36px; }
.billing-summary { border-right: 1px solid var(--line); }
.credit-balance { display: flex; align-items: baseline; gap: 9px; margin: 22px 0 8px; }
.credit-balance strong { color: var(--green-dark); font: 500 42px/1 Georgia, serif; }
.credit-balance span, .billing-summary > p:not(.eyebrow), .plan-summary { color: var(--muted); font-size: 12px; line-height: 1.55; }
.billing-purchase label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 750; }
.billing-purchase select { width: 100%; height: 46px; padding: 0 12px; border: 1px solid var(--line); color: var(--ink); background: white; font: inherit; }
.billing-purchase select:focus { outline: 2px solid var(--lime); border-color: var(--green); }
.billing-purchase .primary { margin-top: 16px; }
.billing-status { min-height: 20px; margin: 12px 0 0; color: var(--green-dark); font-size: 12px; line-height: 1.5; }
.text-button { padding: 0; border: 0; color: var(--green); background: transparent; font-size: 12px; font-weight: 750; text-decoration: underline; }
.billing-manage-button { display: block; margin-top: 10px; text-align: left; }
.team-panel { margin-bottom: 24px; padding: 32px 36px; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 18px 50px rgb(22 33 29 / 7%); }
.team-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.team-heading p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.team-invite-form { max-width: 650px; margin-top: 24px; }
.team-invite-form > label { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 750; }
.team-invite-form > div { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.team-invite-form input { min-width: 0; height: 42px; padding: 0 12px; border: 1px solid var(--line); color: var(--ink); background: white; font: inherit; }
.team-invite-form input:focus, .team-role-select:focus { outline: 2px solid var(--lime); border-color: var(--green); }
.team-invite-form small { display: block; margin-top: 6px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.team-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 26px; }
.team-columns h3 { margin: 0 0 10px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.team-list { border-top: 1px solid var(--line); }
.team-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 62px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.team-row > div { min-width: 0; }
.team-row strong, .team-row span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-row strong { font-size: 13px; }
.team-row div span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.team-role { flex: 0 0 auto; padding: 5px 8px; color: var(--green-dark); background: #e8f2dc; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.team-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 6px; }
.team-role-select { height: 34px; padding: 0 7px; border: 1px solid var(--line); color: var(--ink); background: white; font-size: 11px; }
.team-action-button { height: 34px; padding: 0 8px; border: 1px solid var(--line); color: var(--green-dark); background: transparent; font-size: 10px; font-weight: 750; }
.team-action-button:hover { border-color: var(--green); background: #f1f6eb; }
.team-action-button.danger { color: var(--red); }
.team-action-button.danger:hover { border-color: var(--red); background: #fde8e4; }
.team-empty { margin: 0; padding: 19px 0; color: var(--muted); font-size: 12px; }
.team-status { min-height: 18px; margin: 14px 0 0; color: var(--muted); font-size: 11px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .75fr); background: var(--panel); border: 1px solid var(--line); box-shadow: 0 18px 50px rgb(22 33 29 / 7%); }
.upload-panel { padding: 42px; }
.section-heading { display: flex; gap: 16px; margin-bottom: 30px; }
.step { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border: 1px solid var(--green); border-radius: 50%; color: var(--green); font: 700 12px Georgia, serif; }
h2 { margin: 0 0 6px; font: 500 28px/1.1 Georgia, serif; letter-spacing: -.02em; }
.section-heading p, .trust-item p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.drop-zone { min-height: 210px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; border: 1px dashed #a7afa9; background: #faf8f1; cursor: pointer; transition: .2s ease; }
.drop-zone:hover, .drop-zone.dragging, .drop-zone.has-file { border-color: var(--green); background: #f3f7ec; }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone strong { font-size: 15px; }
.drop-zone > span:last-child { color: var(--muted); font-size: 12px; }
.upload-icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 5px; border-radius: 50%; color: var(--green-dark); background: var(--lime); font-size: 24px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 20px; }
.options label > span { display: block; margin-bottom: 7px; font-size: 12px; font-weight: 750; }
.options small { color: var(--muted); font-weight: 500; }
.options input { width: 100%; height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 0; background: white; color: var(--ink); font: inherit; }
.options input:focus { outline: 2px solid var(--lime); border-color: var(--green); }
button { font: inherit; cursor: pointer; }
.primary { width: 100%; height: 52px; margin-top: 22px; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; border: 0; color: white; background: var(--green); font-weight: 750; }
.primary:hover { background: var(--green-dark); }
button:disabled { opacity: .58; cursor: wait; }
.error { margin: 14px 0 0; padding: 12px; color: #7d251d; background: #fde8e4; font-size: 13px; }
.trust-panel { padding: 42px 34px; color: white; background: var(--green-dark); }
.trust-panel .eyebrow { color: var(--lime); }
.trust-item { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 24px 0; border-top: 1px solid rgb(255 255 255 / 16%); }
.trust-item > span { color: var(--lime); }
.trust-item strong { display: block; margin-bottom: 6px; font-family: Georgia, serif; font-size: 16px; font-weight: 500; }
.trust-item p { color: rgb(255 255 255 / 65%); }
.results { scroll-margin-top: 30px; margin-top: 36px; padding: 38px; background: var(--panel); border: 1px solid var(--line); }
.results-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.secondary { height: 42px; padding: 0 16px; border: 1px solid var(--green); color: var(--green); background: transparent; font-weight: 700; }
.secondary:hover { color: white; background: var(--green); }
.quiet-button { height: 42px; padding: 0 13px; border: 1px solid var(--line); color: var(--ink); background: transparent; font-size: 12px; font-weight: 700; }
.quiet-button:hover, .quiet-button.active { border-color: var(--green); color: var(--green); background: #f1f6eb; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); margin: 28px 0; border: 1px solid var(--line); }
.metrics > div { padding: 18px; border-right: 1px solid var(--line); }
.metrics > div:last-child { border-right: 0; }
.metrics span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.metrics strong { font: 500 21px Georgia, serif; }
.warnings { margin: 0 0 20px; padding: 12px 16px; color: #6d5215; background: #fff3ce; font-size: 13px; }
.warnings p { margin: 5px 0; }
.page-diagnostics { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.page-diagnostics span { padding: 6px 9px; color: var(--muted); background: #eeece4; font-size: 11px; }
.page-diagnostics strong { color: var(--ink); }
.review-summary { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; padding: 13px 15px; border-left: 3px solid; font-size: 12px; }
.review-summary strong { font-family: Georgia, serif; font-size: 15px; font-weight: 500; }
.review-summary span { color: var(--muted); }
.review-summary.complete { border-color: var(--green); background: #edf6e7; }
.review-summary.needs-review { border-color: #c3881c; background: #fff3ce; }
.review-summary button { margin-left: auto; border: 0; color: #725111; background: transparent; font-size: 11px; font-weight: 800; text-decoration: underline; }
.vision-proposals { margin: 0 0 24px; padding: 22px; border: 1px solid #a8b9dd; background: #f4f7ff; }
.export-panel { margin: 0 0 24px; padding: 22px; border: 1px solid var(--line); background: #fbfaf6; }
.export-panel-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.export-panel-head h3 { margin: 0; font: 500 22px Georgia, serif; }
.export-panel label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.export-panel input, .export-panel select, .export-panel textarea { padding: 9px 10px; border: 1px solid var(--line); background: white; color: var(--ink); font: 13px/1.35 inherit; }
.export-grid { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 12px; }
.export-grid .field-mapping { grid-column: 1 / -1; }
.field-mapping small { font-weight: 400; letter-spacing: 0; }
.export-preview { margin-top: 14px; }
.export-preview > span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.export-preview pre { max-height: 220px; overflow: auto; padding: 12px; background: #1d2521; color: #eaf0eb; font: 11px/1.45 Consolas, monospace; white-space: pre-wrap; }
.export-panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.action-separator { width: 1px; height: 26px; background: var(--line); }
.storage-note, .export-status { margin: 10px 0 0; color: var(--muted); font-size: 11px; }
.export-status { min-height: 15px; color: var(--green); font-weight: 700; }
.vision-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.vision-heading h3 { margin: 0 0 5px; font: 500 22px Georgia, serif; }
.vision-heading p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 12px; }
.vision-heading > span { padding: 5px 8px; color: #314f87; background: #e2eaff; font-size: 10px; font-weight: 800; }
.proposal-list { display: grid; gap: 12px; }
.proposal-card { padding: 16px; border: 1px solid #cbd5e9; background: white; }
.proposal-card.accepted { border-color: var(--green); background: #f4f9ef; }
.proposal-card.rejected { opacity: .62; }
.proposal-top { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.proposal-top > div:first-child { display: flex; align-items: center; gap: 8px; }
.proposal-top strong { font-size: 12px; }
.proposal-operation { padding: 3px 5px; color: #314f87; background: #e2eaff; font-size: 9px; font-weight: 800; text-transform: uppercase; }
.proposal-valid { color: var(--green); font-size: 10px; font-weight: 800; }
.proposal-errors { display: grid; max-width: 330px; color: var(--red); font-size: 10px; text-align: right; }
.proposal-comparison { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.proposal-comparison > div { padding: 11px; background: #f4f3ee; }
.proposal-comparison > div.proposed-value { background: #eef3ff; }
.proposal-comparison > div > span, .proposal-evidence > span { display: block; margin-bottom: 7px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.proposal-comparison dl { display: grid; gap: 5px; margin: 0; }
.proposal-comparison dl > div { display: grid; grid-template-columns: 76px 1fr; gap: 8px; }
.proposal-comparison dt { color: var(--muted); font-size: 10px; }
.proposal-comparison dd { margin: 0; font-size: 11px; }
.proposal-evidence blockquote { margin: 6px 0; padding: 8px 10px; border-left: 2px solid #7e96c5; color: #33415c; background: #f7f9fe; font: 12px/1.45 Georgia, serif; }
.proposal-evidence blockquote span { display: block; margin-bottom: 3px; color: var(--muted); font: 8px sans-serif; text-transform: uppercase; }
.proposal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.proposal-actions button { height: 34px; padding: 0 11px; border: 1px solid var(--line); background: white; font-size: 10px; font-weight: 800; }
.proposal-actions .accept-proposal { border-color: var(--green); color: white; background: var(--green); }
.proposal-actions > strong { color: var(--green); font-size: 10px; text-transform: uppercase; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 12px 10px; color: var(--muted); border-bottom: 1px solid var(--ink); text-align: left; font-size: 10px; letter-spacing: .09em; text-transform: uppercase; }
td { padding: 14px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td:nth-child(3) { width: 100%; white-space: normal; min-width: 280px; }
.review-issue { background: #fff9e7; }
.review-issue td:first-child { border-left: 3px solid #c3881c; }
.review-ok.edited { background: #f1f6eb; }
.status-cell { min-width: 82px; }
.row-status { display: block; width: fit-content; padding: 3px 6px; color: var(--green-dark); background: #e8f2dc; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.review-issue .row-status { color: #725111; background: #ffe5a3; }
.issue-message { display: block; max-width: 145px; margin-top: 5px; color: #725111; font-size: 9px; line-height: 1.25; white-space: normal; }
.approve-row { margin-top: 5px; padding: 0; border: 0; color: var(--green); background: transparent; font-size: 10px; font-weight: 800; text-decoration: underline; }
.cell-input { width: 100%; min-width: 88px; padding: 7px 6px; border: 1px solid transparent; color: inherit; background: transparent; font: inherit; }
.cell-input:hover { border-color: var(--line); background: white; }
.cell-input:focus { outline: 2px solid var(--lime); border-color: var(--green); background: white; }
.cell-input.has-error { border-color: #d8a13e; background: #fffaf0; }
.date-input { min-width: 112px; }
.description-input { min-width: 270px; }
.money-input { min-width: 96px; text-align: right; }
.credit { color: var(--green); font-weight: 700; }
.debit { color: var(--red); }
.confidence { padding: 4px 7px; color: var(--green-dark); background: #e8f2dc; font-size: 11px; font-weight: 700; }
.confidence.low { color: #725111; background: #ffe5a3; }
.empty { padding: 36px; color: var(--muted); text-align: center; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 34px 0 44px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
footer a { color: inherit; text-underline-offset: 3px; }
footer nav { display: flex; flex-wrap: wrap; gap: 14px; }

.legal-main { width: min(900px, calc(100% - 40px)); margin: 0 auto; padding: 70px 0 20px; }
.legal-heading { margin-bottom: 34px; }
.legal-heading h1 { max-width: 760px; font-size: clamp(46px, 7vw, 72px); }
.legal-heading .lede { max-width: 760px; margin-top: 22px; font-size: 16px; }
.legal-document { padding: 48px; border: 1px solid var(--line); background: var(--panel); box-shadow: 0 18px 50px rgb(22 33 29 / 7%); }
.legal-document h2 { margin: 38px 0 12px; font-size: 24px; }
.legal-document h2:first-child { margin-top: 0; }
.legal-document h3 { margin: 24px 0 8px; font: 600 17px/1.3 Georgia, serif; }
.legal-document p, .legal-document li, .legal-document address { color: #394740; font-size: 14px; line-height: 1.75; }
.legal-document p { margin: 0 0 14px; }
.legal-document ul { margin: 0 0 18px; padding-left: 22px; }
.legal-document li + li { margin-top: 7px; }
.legal-document address { margin-bottom: 20px; font-style: normal; }
.legal-document a, .legal-links a { color: var(--green-dark); text-underline-offset: 3px; }
.legal-meta { color: var(--muted) !important; font-size: 12px !important; }
.legal-links { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 26px; padding-bottom: 24px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; }

@media (max-width: 780px) {
  .shell { width: min(100% - 24px, 1180px); }
  .hero { padding-top: 56px; }
  .nav-actions { gap: 9px; }
  .session-user { max-width: 120px; }
  .organization-form { grid-template-columns: 1fr; }
  .organization-form .primary { width: 100%; }
  .workspace-switcher { grid-template-columns: 1fr; padding: 26px 20px; }
  .workspace-switcher form > div { grid-template-columns: 1fr; }
  .billing-panel { grid-template-columns: 1fr; }
  .billing-summary, .billing-purchase { padding: 26px 20px; }
  .billing-summary { border-right: 0; border-bottom: 1px solid var(--line); }
  .team-panel { padding: 26px 20px; }
  .team-heading { flex-direction: column; }
  .team-invite-form > div { grid-template-columns: 1fr; }
  .team-columns { grid-template-columns: 1fr; }
  .team-row { align-items: flex-start; flex-direction: column; }
  .team-actions { flex-wrap: wrap; }
  .workspace { grid-template-columns: 1fr; }
  .upload-panel, .trust-panel, .results { padding: 26px 20px; }
  .options { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metrics > div:nth-child(2) { border-right: 0; }
  .metrics > div { border-bottom: 1px solid var(--line); }
  .metrics > div:nth-last-child(-n + 2) { border-bottom: 0; }
  .results-head { align-items: stretch; flex-direction: column; }
  .result-actions { justify-content: flex-start; }
  .review-summary { align-items: flex-start; flex-direction: column; }
  .review-summary button { margin-left: 0; }
  .proposal-comparison { grid-template-columns: 1fr; }
  .proposal-top, .vision-heading, .export-panel-head { flex-direction: column; align-items: stretch; }
  .export-grid { grid-template-columns: 1fr 1fr; }
  footer { align-items: flex-start; flex-direction: column; gap: 14px; }
  .legal-main { width: min(100% - 24px, 900px); padding-top: 46px; }
  .legal-document { padding: 28px 20px; }
}
