/* Ledger: ink on paper. Tokens first; components bind only to tokens. System fonts only (self-hosted by the OS). */
:root {
  --paper: #f7f5ef; --sheet: #ffffff; --well: #efece3; --rule: #d9d4c7; --rule-strong: #8a8474;
  --ink: #1b2420; --ink-2: #3d4842; --ink-3: #5a645e; --ink-muted: #6b716c;
  --green: #1d6b47; --green-ink: #ffffff; --green-wash: #e3efe8; --focus: #1d6b47; --warn: #8a4b00;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-data: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --hit: 44px; --row: 36px;
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #141917; --sheet: #1b211e; --well: #101412; --rule: #2e3833; --rule-strong: #6d7a73;
    --ink: #e8ece9; --ink-2: #c5ccc8; --ink-3: #a9b2ad; --ink-muted: #9aa49f;
    --green: #6fcf9b; --green-ink: #0d1a13; --green-wash: #1e2e26; --focus: #6fcf9b; --warn: #f0b46a; }
}
* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--font-ui); }
a { color: var(--green); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -9999px; } .skip:focus { left: var(--s4); top: var(--s4); background: var(--sheet); padding: var(--s3); z-index: 10; }
.skip { display: inline-flex; align-items: center; min-height: 44px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--s4); }
.site-head { border-bottom: 1px solid var(--rule); }
.site-head .wrap { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; min-height: 64px; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; display: inline-flex; align-items: center; min-height: var(--hit); gap: var(--s2); }
.brand-mark { font-family: var(--font-data); color: var(--green); }
.nav { display: flex; gap: var(--s1); margin-left: auto; flex-wrap: wrap; }
.nav a { display: inline-flex; align-items: center; min-height: var(--hit); padding: 0 var(--s3); border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ink); background: var(--well); font-weight: 600; }
.nav a:hover { color: var(--ink); text-decoration: underline; }
.hero { padding-top: var(--s6); padding-bottom: var(--s4); }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.1; letter-spacing: -0.025em; margin: 0 0 var(--s2); text-wrap: balance; }
.sub { color: var(--ink-2); font-size: 1.125rem; margin: 0; max-width: 60ch; text-wrap: pretty; }
.local { display: inline-flex; gap: var(--s2); align-items: center; margin-top: var(--s3); color: var(--green); font-weight: 600; }
h2 { font-size: 1.4rem; letter-spacing: -0.015em; margin: 0 0 var(--s3); text-wrap: balance; }
h3 { font-size: 1.05rem; margin: 0 0 var(--s1); }
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: var(--s4); }
.intake { display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--s4); }
@media (max-width: 760px) { .intake { grid-template-columns: 1fr; } }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--s2);
  min-height: 180px; border: 2px dashed var(--rule-strong); border-radius: var(--r-md); padding: var(--s5); background: var(--well); transition: background-color 150ms var(--ease), border-color 150ms var(--ease); }
.drop.is-over { border-color: var(--green); background: var(--green-wash); }
.drop p { margin: 0; color: var(--ink-2); }
.hint { color: var(--ink-3); font-size: 0.9rem; }
label { font-weight: 600; }
.field { display: flex; flex-direction: column; gap: var(--s1); }
textarea, input[type="search"], input[type="email"], select {
  font: inherit; color: var(--ink); background: var(--well); border: 1px solid var(--rule-strong); border-radius: var(--r-sm); min-height: var(--hit); padding: var(--s2) var(--s3); }
textarea { font-family: var(--font-data); font-size: 0.875rem; min-height: 120px; resize: vertical; width: 100%; }
.btn { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--hit); min-width: var(--hit); padding: 0 var(--s4); border-radius: var(--r-sm); border: 1px solid var(--rule-strong);
  background: var(--sheet); color: var(--ink); cursor: pointer; transition: transform 120ms var(--ease), background-color 120ms var(--ease); }
.btn:hover { background: var(--well); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--green); color: var(--green-ink); border-color: var(--green); }
.btn-primary:hover { background: var(--green); filter: brightness(1.08); }
.btn:disabled { cursor: not-allowed; opacity: 1; background: var(--well); color: var(--ink-muted); border-color: var(--rule); filter: none; transform: none; }
.file-btn { position: relative; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-btn:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.row { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; }
.check { display: inline-flex; align-items: center; gap: var(--s2); min-height: var(--hit); font-weight: 500; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--green); margin: 0; }
.tool { margin-top: var(--s4); }
.toolbar { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: end; padding-bottom: var(--s3); border-bottom: 1px solid var(--rule); }
.toolbar .grow { flex: 1 1 220px; }
.toolbar input[type="search"] { width: 100%; }
.meta { display: flex; gap: var(--s5); flex-wrap: wrap; padding: var(--s3) 0; color: var(--ink-2); font-size: 0.95rem; }
.meta b { font-variant-numeric: tabular-nums; color: var(--ink); font-family: var(--font-data); }
.grid-scroll { max-height: 70vh; overflow: auto; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--sheet); }
.grid { border-collapse: separate; border-spacing: 0; font-family: var(--font-data); font-size: 0.85rem; min-width: 100%; }
.grid th { position: sticky; top: 0; z-index: 1; background: var(--well); border-bottom: 1px solid var(--rule-strong); text-align: left; padding: 0; }
.grid th:not(:last-child), .grid td:not(:last-child) { border-right: 1px solid var(--rule); }
.sort { font: 600 0.85rem var(--font-ui); color: var(--ink); background: none; border: 0; width: 100%; min-height: var(--hit); padding: 0 var(--s3);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s2); cursor: pointer; text-align: left; white-space: nowrap; }
.sort:hover { background: var(--green-wash); }
.sort-ind { color: var(--ink-3); font-size: 0.75rem; }
th[aria-sort="ascending"] .sort-ind, th[aria-sort="descending"] .sort-ind { color: var(--green); }
.grid td { height: var(--row); max-width: 28ch; padding: 0 var(--s3); border-bottom: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.grid tr.spacer { border: 0; } .grid tr.spacer td { border: 0; }
.empty { padding: var(--s5); color: var(--ink-3); }
.section { padding-top: var(--s7); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s4); padding: 0; margin: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--r-md); padding: var(--s4); }
.steps li::before { content: counter(s); font-family: var(--font-data); color: var(--green); font-weight: 700; display: block; margin-bottom: var(--s1); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; min-height: var(--hit); display: flex; align-items: center; font-weight: 600; padding: var(--s2) 0; }
.faq details p { margin: 0 0 var(--s4); color: var(--ink-2); max-width: 65ch; }
.waitlist { margin-top: var(--s7); margin-bottom: var(--s7); }
.waitlist form { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: end; }
.waitlist .field { flex: 1 1 260px; }
.badge { display: inline-block; font-size: 0.8rem; font-weight: 700; color: var(--warn); border: 1px solid currentColor; border-radius: 999px; padding: 2px var(--s2); margin-left: var(--s2); vertical-align: middle; }
.fine { color: var(--ink-3); font-size: 0.875rem; margin: var(--s2) 0 0; }
.tables { list-style: none; padding: 0; margin: 0 0 var(--s3); display: flex; gap: var(--s2); flex-wrap: wrap; }
.table-pick { font: inherit; min-height: var(--hit); padding: 0 var(--s3); border-radius: var(--r-sm); border: 1px solid var(--rule-strong); background: var(--sheet); color: var(--ink); cursor: pointer; }
.table-pick[aria-pressed="true"] { background: var(--green-wash); border-color: var(--green); font-weight: 600; }
.preview { max-height: 420px; overflow: auto; border: 1px solid var(--rule); border-radius: var(--r-md); }
.preview table { border-collapse: collapse; font: 0.85rem var(--font-data); min-width: 100%; }
.preview caption { text-align: left; padding: var(--s2) var(--s3); color: var(--ink-3); font-family: var(--font-ui); }
.preview td { border: 1px solid var(--rule); padding: var(--s1) var(--s3); white-space: pre-wrap; vertical-align: top; }
.prose { max-width: 70ch; padding-bottom: var(--s7); } .prose h2 { margin-top: var(--s6); }
.site-foot { border-top: 1px solid var(--rule); margin-top: var(--s7); padding: var(--s5) 0; color: var(--ink-3); font-size: 0.9rem; }
.site-foot a { display: inline-flex; min-height: var(--hit); align-items: center; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; } .btn:active { transform: none; } }
/* Fixed-height cell so virtualization math holds; raw whitespace kept (pre), extra lines clipped. */
.cell { display: block; height: calc(var(--row) - 1px); line-height: calc(var(--row) - 1px); white-space: pre; overflow: hidden; text-overflow: ellipsis; }

/* --- UX fixes (Xavier review) --- */
::placeholder { color: #4f554f; opacity: 1; }
@media (prefers-color-scheme: dark) { ::placeholder { color: #b3bab5; } }
.alert { margin: var(--s3) 0 0; padding: var(--s3) var(--s4); border: 1px solid #a3302a; border-left-width: 4px; background: #fbeeec; color: #6e1d18; border-radius: 4px; }
.warning { margin: 0 0 var(--s3); padding: var(--s3) var(--s4); border: 1px solid #c9a35a; background: #fdf5e3; color: #4d3300; border-radius: 4px; }
@media (prefers-color-scheme: dark) {
  .alert { background: #3a1714; color: #ffd9d4; border-color: #e0786f; }
  .warning { background: #33270d; color: #ffe7b0; border-color: #d9a640; }
}
.loaded-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); border: 1px solid var(--rule-strong); border-radius: 6px; background: var(--well); scroll-margin-top: var(--s3); }
.loaded-bar[hidden] { display: none; }
.bar-summary { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.bar-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.btn, .sort, button, select, input[type="text"], input[type="search"], input[type="file"] { min-height: 44px; }
p a, li a, .fine a, dd a { display: inline-flex; align-items: center; min-height: 44px; vertical-align: middle; }
.site-foot a { display: inline-flex; align-items: center; min-height: 44px; vertical-align: middle; }
/* Sticky row numbers + first column */
.grid .rownum { position: sticky; left: 0; z-index: 2; width: 64px; min-width: 64px; max-width: 64px; text-align: right; padding: 0 var(--s2); color: var(--ink-3); font-weight: 400; font-variant-numeric: tabular-nums; background: var(--well); border-right: 1px solid var(--rule); }
.grid tbody th.rownum { top: auto; height: var(--row); border-bottom: 1px solid var(--rule); }
.grid thead th.rownum { z-index: 4; }
.grid .first { position: sticky; left: 64px; z-index: 1; background: var(--sheet); box-shadow: 1px 0 0 var(--rule-strong); }
.grid thead th.first { z-index: 3; background: var(--well); }
.grid td.missing .cell { color: #8a5a00; font-style: italic; }
.grid td.missing { background: repeating-linear-gradient(45deg, transparent 0 6px, rgba(138,90,0,.08) 6px 12px); }
@media (prefers-color-scheme: dark) { .grid td.missing .cell { color: #e6b660; } }
/* After a load, the explainer sections step back */
.has-data .hero p { display: none; }
.has-data .seo { font-size: 0.9rem; color: var(--ink-2); border-top: 1px solid var(--rule); }
.has-data .seo h2 { font-size: 1.05rem; }

.alert { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.alert[hidden], .warning[hidden] { display: none; }
.alert .btn { margin-left: auto; }
.linkbtn { font: inherit; color: inherit; background: none; border: 0; padding: 0 4px; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-weight: 600; }
.warning .linkbtn { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; vertical-align: middle; }
.warn-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.warn-actions .btn { min-height: 44px; }
.grid tr:focus { outline: 3px solid var(--focus); outline-offset: -3px; }
#parse-warning-text { margin: 0; } .warn-jump { margin: var(--s2) 0 0; }

.sample-btn { color: var(--green); margin-top: var(--s1); }

/* Waitlist (Pro) */
.wl-offer { margin: 0 0 var(--s3); color: var(--ink-2); }
.wl-interests { flex: 1 1 100%; border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 var(--s4); }
.wl-interests legend { font-weight: 600; padding: 0; margin-bottom: var(--s1); }
.wl-interests .opt { font-weight: 400; color: var(--ink-3); }
.wl-interests .check { align-items: center; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.wl-ts:empty { display: none; }
.wl-msg:empty { display: none; }
mark.todo { background: #fdf0c4; color: #4d3300; padding: 0 4px; border-radius: 3px; }
