/* ACH Viewer: ACH file tools.
   Paper and ink: a warm check-stock ground, navy ink, one cobalt for
   anything clickable. Record lines are set in a fixed-width face because
   the format is literally columns. */

:root {
  --paper: oklch(0.985 0.006 85);
  --paper-2: oklch(0.965 0.01 85);
  --card: oklch(1 0 0);
  --ink: oklch(0.24 0.04 260);
  --ink-2: oklch(0.42 0.03 260);
  --muted: oklch(0.5 0.02 260);
  --rule: oklch(0.9 0.012 85);
  --rule-strong: oklch(0.78 0.015 85);
  --action: oklch(0.5 0.17 262);
  --action-hover: oklch(0.43 0.17 262);
  --action-soft: oklch(0.95 0.03 262);
  --on-action: oklch(0.99 0 0);
  --good: oklch(0.5 0.12 155);
  --good-soft: oklch(0.95 0.04 155);
  --bad: oklch(0.52 0.18 27);
  --bad-soft: oklch(0.96 0.03 27);
  --warn: oklch(0.55 0.12 70);
  --warn-soft: oklch(0.96 0.045 85);
  --night: oklch(0.22 0.045 262);
  --night-2: oklch(0.3 0.06 262);
  --on-night: oklch(0.96 0.01 85);
  --on-night-muted: oklch(0.8 0.02 260);
  --stamp: oklch(0.8 0.12 75);

  /* field bands in the record inspector */
  --band-1: oklch(0.93 0.05 262);
  --band-2: oklch(0.94 0.05 75);
  --band-3: oklch(0.93 0.05 155);
  --band-4: oklch(0.94 0.04 330);
  --band-5: oklch(0.94 0.04 200);
  --band-6: oklch(0.94 0.05 40);

  --font-sans: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --shadow: 0 1px 0 oklch(0.2 0.03 260 / 0.04), 0 10px 30px -12px oklch(0.2 0.04 260 / 0.18);
  --wrap: 1120px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: oklch(0.17 0.02 262);
    --paper-2: oklch(0.2 0.022 262);
    --card: oklch(0.215 0.024 262);
    --ink: oklch(0.94 0.01 85);
    --ink-2: oklch(0.82 0.015 260);
    --muted: oklch(0.72 0.02 260);
    --rule: oklch(0.31 0.025 262);
    --rule-strong: oklch(0.42 0.03 262);
    --action: oklch(0.72 0.13 262);
    --action-hover: oklch(0.8 0.11 262);
    --action-soft: oklch(0.3 0.06 262);
    --on-action: oklch(0.17 0.03 262);
    --good: oklch(0.78 0.12 155);
    --good-soft: oklch(0.28 0.05 155);
    --bad: oklch(0.75 0.14 27);
    --bad-soft: oklch(0.29 0.06 27);
    --warn: oklch(0.82 0.12 80);
    --warn-soft: oklch(0.3 0.05 75);
    --night: oklch(0.13 0.025 262);
    --night-2: oklch(0.2 0.045 262);
    --band-1: oklch(0.34 0.07 262);
    --band-2: oklch(0.35 0.06 75);
    --band-3: oklch(0.33 0.06 155);
    --band-4: oklch(0.34 0.06 330);
    --band-5: oklch(0.34 0.05 200);
    --band-6: oklch(0.35 0.06 40);
    --shadow: 0 1px 0 oklch(0 0 0 / 0.2), 0 12px 30px -12px oklch(0 0 0 / 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: oklch(0.17 0.02 262);
  --paper-2: oklch(0.2 0.022 262);
  --card: oklch(0.215 0.024 262);
  --ink: oklch(0.94 0.01 85);
  --ink-2: oklch(0.82 0.015 260);
  --muted: oklch(0.72 0.02 260);
  --rule: oklch(0.31 0.025 262);
  --rule-strong: oklch(0.42 0.03 262);
  --action: oklch(0.72 0.13 262);
  --action-hover: oklch(0.8 0.11 262);
  --action-soft: oklch(0.3 0.06 262);
  --on-action: oklch(0.17 0.03 262);
  --good: oklch(0.78 0.12 155);
  --good-soft: oklch(0.28 0.05 155);
  --bad: oklch(0.75 0.14 27);
  --bad-soft: oklch(0.29 0.06 27);
  --warn: oklch(0.82 0.12 80);
  --warn-soft: oklch(0.3 0.05 75);
  --night: oklch(0.13 0.025 262);
  --night-2: oklch(0.2 0.045 262);
  --band-1: oklch(0.34 0.07 262);
  --band-2: oklch(0.35 0.06 75);
  --band-3: oklch(0.33 0.06 155);
  --band-4: oklch(0.34 0.06 330);
  --band-5: oklch(0.34 0.05 200);
  --band-6: oklch(0.35 0.06 40);
  --shadow: 0 1px 0 oklch(0 0 0 / 0.2), 0 12px 30px -12px oklch(0 0 0 / 0.5);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--action); text-underline-offset: 3px; }
a:hover { color: var(--action-hover); }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; border-radius: 4px; }
code, kbd, .mono { font-family: var(--font-mono); font-size: 0.92em; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

/* ---------------------------------------------------------------- nav */
.nav { background: var(--night); color: var(--on-night); }
.nav-inner { display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--on-night); text-decoration: none; font-weight: 700; letter-spacing: -0.01em; font-size: 1.08rem; }
.brand:hover { color: var(--on-night); }
.brand-mark { width: 30px; height: 30px; }
.nav-links { display: flex; gap: 4px; margin-left: auto; list-style: none; padding: 0; }
.nav-links a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--on-night-muted); text-decoration: none; font-weight: 500; font-size: 0.95rem; }
.nav-links a:hover { color: var(--on-night); background: oklch(1 0 0 / 0.06); }
.nav-links a[aria-current="page"] { color: var(--on-night); box-shadow: inset 0 -2px 0 var(--stamp); border-radius: 8px 8px 0 0; }
.nav :focus-visible { outline-color: var(--stamp); }
@media (max-width: 640px) {
  .nav-inner { height: auto; flex-wrap: wrap; gap: 6px 12px; padding-top: 12px; padding-bottom: 6px; }
  .nav-links { margin-left: 0; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .nav-links a { padding: 8px 10px; white-space: nowrap; }
}

/* ---------------------------------------------------------------- hero */
.hero {
  background:
    radial-gradient(120% 90% at 85% 0%, var(--night-2) 0%, transparent 60%),
    var(--night);
  color: var(--on-night);
  padding: 56px 0 132px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  /* faint 94-column ruler along the bottom edge */
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0; height: 28px;
  background: repeating-linear-gradient(90deg, oklch(1 0 0 / 0.07) 0 1px, transparent 1px 12px);
  mask-image: linear-gradient(to top, black, transparent);
  pointer-events: none;
}
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 0.82rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--stamp); }
.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.1rem, 4.6vw, 3.4rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
  margin: 14px 0 16px;
  max-width: 18ch;
  font-variation-settings: 'opsz' 96;
}
.hero h1 em { font-style: italic; color: var(--stamp); font-weight: 500; }
.hero p.lead { color: var(--on-night-muted); font-size: 1.12rem; max-width: 60ch; }
.hero-points { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 22px; padding: 0; list-style: none; color: var(--on-night-muted); font-size: 0.95rem; }
.hero-points li { display: inline-flex; align-items: center; gap: 8px; }
.hero-points svg { width: 18px; height: 18px; color: var(--stamp); flex: none; }
@media (max-width: 600px) { .hero { padding: 36px 0 112px; } }

/* ---------------------------------------------------------------- main card */
.workbench {
  position: relative;
  margin-top: -96px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 28px;
}
@media (max-width: 600px) { .workbench { padding: 18px; margin-top: -84px; border-radius: var(--r-md); } }

.section { padding: 56px 0 0; }
.section h2 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.5rem, 2.6vw, 2rem); letter-spacing: -0.015em; line-height: 1.15; margin-bottom: 12px; }
.section > .wrap > p.sub, .section p.sub { color: var(--ink-2); max-width: 64ch; margin-bottom: 24px; }
.section h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 0.97rem; cursor: pointer; text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--action); color: var(--on-action); box-shadow: 0 1px 0 oklch(1 0 0 / 0.2) inset, 0 6px 16px -8px var(--action); }
.btn-primary:hover { background: var(--action-hover); color: var(--on-action); transform: translateY(-1px); }
.btn-secondary { background: var(--card); color: var(--action); border-color: var(--rule-strong); }
.btn-secondary:hover { border-color: var(--action); background: var(--action-soft); }
.btn-quiet { background: none; border: none; color: var(--action); padding: 6px 8px; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn:active { transform: translateY(1px); }

/* ---------------------------------------------------------------- dropzone */
.dropzone {
  display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center;
  border: 1.5px dashed var(--rule-strong); border-radius: var(--r-md);
  padding: 22px 24px; background: var(--paper);
  transition: border-color .15s ease, background-color .15s ease;
}
.dropzone.is-over { border-color: var(--action); background: var(--action-soft); }
.dropzone h2 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.dropzone p { color: var(--muted); font-size: 0.95rem; }
.dropzone-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.paste-toggle { margin-top: 12px; }
.paste-area { width: 100%; min-height: 160px; margin-top: 10px; padding: 12px 14px; border: 1px solid var(--rule-strong); border-radius: var(--r-sm); background: var(--card); font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.6; resize: vertical; white-space: pre; overflow-x: auto; }
@media (max-width: 760px) {
  .dropzone { grid-template-columns: 1fr; }
  .dropzone-actions { justify-content: stretch; }
  .dropzone-actions .btn { flex: 1 1 auto; }
}

/* ---------------------------------------------------------------- results */
.results { margin-top: 26px; }
.verdict {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 18px; border-radius: var(--r-md);
  background: var(--good-soft); color: var(--ink);
}
.verdict svg { width: 26px; height: 26px; flex: none; color: var(--good); margin-top: 1px; }
.verdict.is-bad { background: var(--bad-soft); }
.verdict.is-bad svg { color: var(--bad); }
.verdict.is-warn { background: var(--warn-soft); }
.verdict.is-warn svg { color: var(--warn); }
.verdict strong { display: block; font-size: 1.05rem; }
.verdict span { color: var(--ink-2); font-size: 0.95rem; }
.file-name { font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin: 20px 0 6px; border: 1px solid var(--rule); border-radius: var(--r-md); overflow: hidden; }
.stat { padding: 14px 16px; border-right: 1px solid var(--rule); }
.stat:last-child { border-right: none; }
.stat dt { font-size: 0.8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat dd { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; margin-top: 2px; }
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat { border-bottom: 1px solid var(--rule); }
  .stat:nth-child(2n) { border-right: none; }
  .stat:last-child { grid-column: 1 / -1; border-bottom: none; }
}

.tabs { display: flex; gap: 4px; margin-top: 22px; border-bottom: 1px solid var(--rule); overflow-x: auto; scrollbar-width: none; }
.tab { padding: 10px 14px; border: none; background: none; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--action); }
.tab .count { display: inline-block; min-width: 1.6em; padding: 1px 6px; margin-left: 6px; border-radius: 999px; background: var(--paper-2); font-size: 0.78rem; color: var(--ink-2); }
.tab .count.is-bad { background: var(--bad-soft); color: var(--bad); }
.panel { padding-top: 18px; }

/* issues */
.issues { list-style: none; padding: 0; display: grid; gap: 8px; }
.issue { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 12px 14px; border: 1px solid var(--rule); border-radius: var(--r-sm); background: var(--card); }
.issue-badge { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; border-radius: 6px; margin-top: 1px; }
.issue.is-error .issue-badge { background: var(--bad-soft); color: var(--bad); }
.issue.is-warning .issue-badge { background: var(--warn-soft); color: var(--warn); }
.issue-where { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.issue button.issue-jump { background: none; border: none; color: var(--action); font-weight: 600; cursor: pointer; padding: 0; font-size: 0.9rem; text-decoration: underline; text-underline-offset: 3px; }
.empty-note { color: var(--muted); padding: 10px 0; }

/* entries table */
.table-tools { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.search { flex: 1 1 220px; max-width: 340px; padding: 9px 12px; border: 1px solid var(--rule-strong); border-radius: 10px; background: var(--card); }
.check { display: inline-flex; gap: 8px; align-items: center; color: var(--ink-2); font-size: 0.93rem; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--action); }
.table-scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r-md); }
table.grid { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table.grid th { text-align: left; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 12px; background: var(--paper); border-bottom: 1px solid var(--rule); white-space: nowrap; position: sticky; top: 0; }
table.grid td { padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.grid tr:last-child td { border-bottom: none; }
table.grid tbody tr:hover { background: var(--paper); }
table.grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.grid .mono { white-space: nowrap; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.pill.credit { background: var(--good-soft); color: var(--good); }
.pill.debit { background: var(--action-soft); color: var(--action); }
.pill.ret { background: var(--bad-soft); color: var(--bad); }

/* ---------------------------------------------------------------- inspector */
.inspector { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
@media (max-width: 960px) { .inspector { grid-template-columns: 1fr; } }
.records { border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--paper); overflow: auto; max-height: 560px; }
.ruler, .rec { display: grid; grid-template-columns: 52px max-content; font-family: var(--font-mono); font-size: 13px; line-height: 1.9; }
.ruler { position: sticky; top: 0; z-index: 1; background: var(--paper-2); color: var(--muted); border-bottom: 1px solid var(--rule); font-size: 11px; }
.ruler span:last-child { white-space: pre; padding-right: 14px; }
.rec { cursor: pointer; border-bottom: 1px solid transparent; }
.rec:hover { background: var(--card); }
.rec.is-active { background: var(--card); box-shadow: inset 3px 0 0 var(--action); }
.rec.has-error .ln { color: var(--bad); font-weight: 700; }
.rec.has-warning .ln { color: var(--warn); font-weight: 700; }
.ln { color: var(--muted); text-align: right; padding: 0 12px 0 0; user-select: none; border-right: 1px solid var(--rule); margin-right: 10px; }
.raw { white-space: pre; padding-right: 14px; }
.raw .f { border-radius: 2px; }
.rec.is-active .raw .f:nth-child(6n+1) { background: var(--band-1); }
.rec.is-active .raw .f:nth-child(6n+2) { background: var(--band-2); }
.rec.is-active .raw .f:nth-child(6n+3) { background: var(--band-3); }
.rec.is-active .raw .f:nth-child(6n+4) { background: var(--band-4); }
.rec.is-active .raw .f:nth-child(6n+5) { background: var(--band-5); }
.rec.is-active .raw .f:nth-child(6n) { background: var(--band-6); }
.raw .f.is-hot { outline: 2px solid var(--action); outline-offset: -1px; }
.raw .bad { text-decoration: underline wavy var(--bad); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.rec .t { font-weight: 700; }
.rec[data-type="1"] .t, .rec[data-type="9"] .t { color: var(--action); }
.rec[data-type="5"] .t, .rec[data-type="8"] .t { color: var(--good); }
.rec[data-type="pad"] { color: var(--muted); opacity: .6; }

.fields { border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--card); padding: 16px; position: sticky; top: 16px; max-height: 560px; overflow: auto; }
.fields h3 { font-size: 1rem; margin-bottom: 2px; }
.fields .meta { color: var(--muted); font-size: 0.86rem; margin-bottom: 12px; }
.fields ol { list-style: none; padding: 0; display: grid; gap: 2px; }
.fields li { display: grid; grid-template-columns: 12px 1fr; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: default; }
.fields li:hover, .fields li.is-hot { background: var(--paper); }
.fields .sw { width: 12px; height: 12px; border-radius: 3px; margin-top: 4px; }
.fields li:nth-child(6n+1) .sw { background: var(--band-1); }
.fields li:nth-child(6n+2) .sw { background: var(--band-2); }
.fields li:nth-child(6n+3) .sw { background: var(--band-3); }
.fields li:nth-child(6n+4) .sw { background: var(--band-4); }
.fields li:nth-child(6n+5) .sw { background: var(--band-5); }
.fields li:nth-child(6n) .sw { background: var(--band-6); }
.fields .fname { font-weight: 600; font-size: 0.9rem; }
.fields .fpos { color: var(--muted); font-size: 0.78rem; font-family: var(--font-mono); margin-left: 6px; }
.fields .fval { display: block; font-family: var(--font-mono); font-size: 0.85rem; white-space: pre-wrap; word-break: break-all; color: var(--ink); }
.fields .fval.is-blank { color: var(--muted); font-style: italic; font-family: var(--font-sans); }
.fields .fnote { display: block; color: var(--muted); font-size: 0.8rem; }
.fields .fissue { display: block; color: var(--bad); font-size: 0.82rem; font-weight: 600; }

/* ---------------------------------------------------------------- builder */
.steps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.steps > section { min-width: 0; }
.step-head { display: flex; gap: 12px; align-items: baseline; margin-bottom: 14px; }
.step-num { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--night); color: var(--stamp); font-weight: 700; font-size: 0.9rem; }
.step-head h2 { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.01em; }
.step-head p { color: var(--muted); font-size: 0.93rem; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
@media (max-width: 860px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 5px; }
.field .hint { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 4px; }
.field input, .field select { width: 100%; padding: 10px 12px; border: 1px solid var(--rule-strong); border-radius: 10px; background: var(--card); }
.field input:focus, .field select:focus, .pay input:focus, .pay select:focus { outline: 2px solid var(--action); outline-offset: 0; border-color: transparent; }
.field input[aria-invalid="true"], .pay input[aria-invalid="true"] { border-color: var(--bad); background: var(--bad-soft); }
.field .mono, .pay .mono { font-family: var(--font-mono); font-size: 0.9rem; }

.pay-scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--r-md); }
table.pay { width: 100%; border-collapse: collapse; min-width: 1060px; table-layout: fixed; }
table.pay th:nth-child(1) { width: 18%; }
table.pay th:nth-child(2) { width: 10%; }
table.pay th:nth-child(3) { width: 11.5%; }
table.pay th:nth-child(4) { width: 14%; }
table.pay th:nth-child(5) { width: 10%; }
table.pay th:nth-child(6) { width: 12%; }
table.pay th:nth-child(7) { width: 10%; }
table.pay th:nth-child(8) { width: 16%; }
table.pay th:nth-child(9) { width: 44px; }
table.pay th { text-align: left; font-size: 0.76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 8px; background: var(--paper); border-bottom: 1px solid var(--rule); white-space: nowrap; }
table.pay td { padding: 6px 6px; border-bottom: 1px solid var(--rule); }
table.pay tr:last-child td { border-bottom: none; }
table.pay input, table.pay select { width: 100%; padding: 8px 9px; border: 1px solid var(--rule); border-radius: 8px; background: var(--card); font-size: 0.92rem; }
table.pay td.rm { width: 40px; text-align: center; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: none; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--bad-soft); color: var(--bad); }
.icon-btn svg { width: 16px; height: 16px; }
.pay-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; align-items: center; }
.pay-totals { margin-left: auto; color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.pay-totals strong { color: var(--ink); }

.build-bar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; padding: 18px; border-radius: var(--r-md); background: var(--paper); border: 1px solid var(--rule); }
.build-bar p { color: var(--ink-2); font-size: 0.95rem; max-width: 60ch; }
.build-errors { list-style: none; padding: 0; margin-top: 12px; display: grid; gap: 6px; }
.build-errors li { padding: 9px 12px; border-radius: 8px; background: var(--bad-soft); color: var(--ink); font-size: 0.93rem; }
.note { padding: 14px 16px; border-radius: var(--r-md); background: var(--warn-soft); color: var(--ink); font-size: 0.93rem; }
.note strong { color: var(--ink); }

/* ---------------------------------------------------------------- features / content */
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px; }
@media (max-width: 860px) { .features { grid-template-columns: 1fr; gap: 22px; } }
.feature svg { width: 28px; height: 28px; color: var(--action); margin-bottom: 10px; }
.feature p { color: var(--ink-2); }

.split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; gap: 24px; } }

.record-map { display: grid; gap: 6px; padding: 0; list-style: none; counter-reset: none; }
.record-map li { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; border: 1px solid var(--rule); border-radius: 10px; background: var(--card); }
.record-map li.indent { margin-left: 22px; }
.record-map li.indent2 { margin-left: 44px; }
.record-map .rt { font-family: var(--font-mono); font-weight: 700; color: var(--action); font-size: 1.05rem; text-align: center; }
.record-map .rn { font-weight: 600; }
.record-map .rr { color: var(--muted); font-size: 0.85rem; }
.record-map li.pad .rt { color: var(--muted); }

.faq { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.faq details { border-bottom: 1px solid var(--rule); padding: 16px 0; }
.faq summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ''; flex: none; width: 10px; height: 10px; margin-top: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s ease; }
.faq details[open] summary::after { transform: rotate(-135deg); margin-top: 11px; }
.faq details p { margin-top: 10px; color: var(--ink-2); max-width: 70ch; }

.cta-band { margin-top: 64px; background: var(--night); color: var(--on-night); border-radius: var(--r-lg); padding: 36px; display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; }
.cta-band h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.7rem; letter-spacing: -0.015em; }
.cta-band p { color: var(--on-night-muted); }
.cta-band .btn-primary { background: var(--stamp); color: var(--night); box-shadow: none; }
.cta-band .btn-primary:hover { background: oklch(0.86 0.11 75); color: var(--night); }
.cta-band :focus-visible { outline-color: var(--stamp); }

/* ---------------------------------------------------------------- guide (format page) */
.doc { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 44px; align-items: start; }
@media (max-width: 960px) { .doc { grid-template-columns: minmax(0, 1fr); } .toc { display: none; } }
.toc { position: sticky; top: 20px; font-size: 0.92rem; }
.toc p { font-weight: 700; font-size: 0.78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.toc ol { list-style: none; padding: 0; display: grid; gap: 2px; border-left: 1px solid var(--rule); }
.toc a { display: block; padding: 5px 0 5px 14px; color: var(--ink-2); text-decoration: none; margin-left: -1px; border-left: 2px solid transparent; }
.toc a:hover { color: var(--action); border-left-color: var(--action); }
.doc-body h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.65rem; letter-spacing: -0.015em; margin: 44px 0 10px; scroll-margin-top: 20px; }
.doc-body h2:first-child { margin-top: 0; }
.doc-body h3 { font-size: 1.08rem; margin: 26px 0 8px; }
.doc-body p, .doc-body li { color: var(--ink-2); max-width: 72ch; }
.doc-body p + p { margin-top: 12px; }
.doc-body ul { padding-left: 20px; margin-top: 8px; display: grid; gap: 4px; }
.doc-body .table-scroll { margin: 14px 0 6px; }
.doc-body table.grid td:first-child { white-space: nowrap; font-family: var(--font-mono); color: var(--muted); }
.example { margin-top: 14px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--paper); overflow-x: auto; padding: 14px 16px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.8; white-space: pre; }

/* ---------------------------------------------------------------- footer */
.footer { margin-top: 80px; padding: 34px 0 44px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.9rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 16px 32px; justify-content: space-between; }
.footer ul { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; padding: 0; }
.footer a { color: var(--ink-2); text-decoration: none; }
.footer a:hover { color: var(--action); }
.footer .fine { flex-basis: 100%; max-width: 80ch; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--night); color: var(--on-night); padding: 10px 16px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 20; }
.toast.is-on { opacity: 1; transform: translateX(-50%) translateY(0); }

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

/* Scroll boxes must contain their absolutely positioned visually-hidden
   labels, or those stretch the page sideways on phones. */
.pay-scroll, .table-scroll, .records, .example { position: relative; }
