:root {
  --paper: #fbfcfe;
  --rule: #d6e3f3;
  --ink: #1b2a4a;
  --pencil: #5d6680;
  --margin: #d9454f;
  --stamp: #c8323c;
  --marker: #ffe45c;
  --wash: #eef3fa;
  --field: #ffffff;
  --line: #c9d5e6;
  font-family: "Anuphan", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121a2b; --rule: #24324d; --ink: #e6ecf7; --pencil: #a2adc4; --margin: #f07178;
    --stamp: #ff6b73; --marker: #b49a10; --wash: #19233a; --field: #0f1626; --line: #30405f;
  }
}
:root[data-theme="dark"] {
  --paper: #121a2b; --rule: #24324d; --ink: #e6ecf7; --pencil: #a2adc4; --margin: #f07178;
  --stamp: #ff6b73; --marker: #b49a10; --wash: #19233a; --field: #0f1626; --line: #30405f;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); font-size: 16px; }
a { color: inherit; text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #3b82f6; outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.demo-note { background: var(--wash); color: var(--pencil); font-size: 13px; text-align: center; padding: 6px 16px; }

.top, main, footer { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.top { display: flex; justify-content: space-between; align-items: center; padding-top: 18px; padding-bottom: 18px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; text-decoration: none; }
.brand svg { width: 28px; height: 28px; fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-linecap: round; }
.top nav { display: flex; gap: 18px; font-size: 15px; }
.top nav a { text-decoration: none; color: var(--pencil); }
.top nav a:hover { color: var(--ink); text-decoration: underline; }

.intro { padding: 28px 0 28px; max-width: 46rem; }
.intro h1 { font-size: clamp(40px, 7vw, 76px); line-height: 1.08; margin: 0 0 18px; font-weight: 700; letter-spacing: -0.01em; }
.intro p { font-size: 18px; color: var(--pencil); margin: 0; max-width: 38rem; }

/* the desk: slip on the left, ledger form on the right */
.desk { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 28px; align-items: start; }
.viewer { position: sticky; top: 16px; }
.drop { position: relative; display: grid; place-items: center; text-align: center; gap: 8px; min-height: 420px; padding: 32px 20px;
  border: 2px dashed var(--line); border-radius: 14px; cursor: pointer; background: var(--wash); }
.drop:hover, .drop.over { border-color: var(--ink); }
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop:focus-within { outline: 3px solid #3b82f6; outline-offset: 2px; }
.drop svg { width: 56px; height: 56px; fill: none; stroke: var(--pencil); stroke-width: 2; stroke-linecap: round; }
.drop strong { font-size: 18px; }
.drop span { color: var(--pencil); font-size: 14px; }
.scan { margin: 0; }
.scan-img { position: relative; border-radius: 12px; overflow: hidden; background: var(--wash); }
.scan-img img { display: block; width: 100%; height: auto; max-height: 72vh; object-fit: contain; }
.scan-img svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.scan-img svg .hl { fill: var(--marker); mix-blend-mode: multiply; opacity: .55; }
.scan-img svg .tag rect { fill: #1b2a4a; }
.scan-img svg .tag text { font-family: "Anuphan", sans-serif; font-weight: 600; fill: #ffe45c; }
.scan figcaption { font-size: 14px; color: var(--pencil); padding-top: 8px; display: flex; justify-content: space-between; gap: 10px; }
.scan figcaption button { border: 0; background: none; text-decoration: underline; color: var(--ink); cursor: pointer; padding: 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .scan-img svg .hl { mix-blend-mode: normal; opacity: .4; } }

/* the form looks like a ledger page: blue rules, red margin */
.fields { position: relative; overflow: hidden; background: var(--paper); border: 1px solid var(--line); border-radius: 6px; padding: 22px 22px 22px 46px;
  background-image: linear-gradient(to right, transparent 30px, var(--margin) 30px, var(--margin) 32px, transparent 32px),
    repeating-linear-gradient(to bottom, transparent 0 35px, var(--rule) 35px 36px); }
.fields-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.fields h2 { font-size: 22px; margin: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 13px; padding: 2px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--field); }
.chip.good { border-color: #2f855a; color: #2f855a; }
.chip.bad { border-color: var(--stamp); color: var(--stamp); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.grid label { display: grid; gap: 4px; }
.grid label span { font-size: 13px; color: var(--pencil); }
.grid .wide { grid-column: 1 / -1; }
.grid .f-amount { grid-column: 1 / -1; }
.grid input, .grid select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: var(--field); min-height: 42px; }
.grid .f-amount input { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; padding: 6px 12px; }
.grid input.found { box-shadow: inset 4px 0 0 var(--marker); }
.grid input.missing { border-style: dashed; }
.warn { margin: 14px 0 0; padding: 10px 12px; border-radius: 8px; background: color-mix(in srgb, var(--stamp) 12%, transparent); color: var(--stamp); font-size: 15px; }
.actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
button { border: 1px solid var(--line); background: var(--field); border-radius: 8px; padding: 9px 16px; cursor: pointer; min-height: 42px; }
button:hover:not(:disabled) { border-color: var(--ink); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 600; padding-inline: 26px; }
button.ghost { background: none; color: var(--pencil); }

.stamp { position: absolute; right: 26px; bottom: 22px; font-weight: 700; font-size: 26px; color: var(--stamp);
  border: 4px double var(--stamp); border-radius: 8px; padding: 2px 14px; transform: rotate(-9deg) scale(1.6); opacity: 0; pointer-events: none; }
.stamp.on { animation: stamp 1.4s ease-out forwards; }
@keyframes stamp {
  0% { opacity: 0; transform: rotate(-9deg) scale(1.6); }
  18% { opacity: .9; transform: rotate(-9deg) scale(1); }
  75% { opacity: .9; }
  100% { opacity: 0; transform: rotate(-9deg) scale(1); }
}

.samples { margin-top: 44px; }
.samples h2, .ledger h2, .accuracy h2, .how h2 { font-size: 26px; margin: 0 0 14px; }
.strip { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x proximity; }
.strip button { flex: 0 0 auto; padding: 6px; border-radius: 10px; scroll-snap-align: start; display: grid; gap: 4px; justify-items: center; font-size: 12px; color: var(--pencil); }
.strip img { width: 104px; height: 150px; object-fit: cover; object-position: top; border-radius: 6px; display: block; }
.strip button.more { width: 116px; align-content: center; font-size: 14px; color: var(--ink); }

.ledger { margin-top: 56px; }
.ledger-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.ledger-head h2 { margin: 0; }
.ledger-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.summary { display: grid; grid-template-columns: minmax(180px, 1fr) 3fr; gap: 24px; align-items: center; margin: 14px 0 18px; }
.summary .total b { display: block; font-size: 36px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.summary .total span { color: var(--pencil); font-size: 14px; }
.bars { display: grid; gap: 6px; }
.bar { display: grid; grid-template-columns: 7.5rem 1fr 6.5rem; gap: 10px; align-items: center; font-size: 14px; }
.bar i { display: block; height: 12px; background: var(--ink); border-radius: 0 3px 3px 0; min-width: 2px; }
.bar em { font-style: normal; text-align: right; font-variant-numeric: tabular-nums; }
.page { position: relative; border: 1px solid var(--line); border-radius: 6px; overflow-x: auto;
  background: linear-gradient(to right, transparent 30px, var(--margin) 30px, var(--margin) 32px, transparent 32px); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 7px 12px; border-bottom: 1px solid var(--rule); height: 40px; }
th:first-child, td:first-child { padding-left: 44px; white-space: nowrap; }
th { font-weight: 600; color: var(--pencil); font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .sub { display: block; color: var(--pencil); font-size: 12px; }
td button { min-height: 32px; padding: 2px 10px; font-size: 13px; }
tr.new td { animation: ink 1.6s ease-out; }
@keyframes ink { from { background: color-mix(in srgb, var(--marker) 45%, transparent); } to { background: transparent; } }
.empty { padding: 18px 44px; color: var(--pencil); margin: 0; }
.note { color: var(--pencil); font-size: 14px; }

.accuracy { margin-top: 56px; }
.accuracy > p { color: var(--pencil); max-width: 44rem; }
.acc-table { overflow-x: auto; }
.acc-table table { min-width: 560px; }
.acc-table td.num b { font-weight: 600; }
.acc-table .meter { display: inline-block; width: 64px; height: 6px; background: var(--rule); border-radius: 3px; vertical-align: middle; margin-left: 8px; overflow: hidden; }
.acc-table .meter i { display: block; height: 100%; background: var(--ink); }
.limits { margin-top: 22px; max-width: 46rem; }
.limits h3 { font-size: 18px; margin: 0 0 6px; }
.limits ul { margin: 0; padding-left: 20px; color: var(--pencil); }
.limits li { margin-bottom: 4px; }

.how { margin-top: 56px; max-width: 46rem; }
.how ol { padding-left: 22px; margin: 0; }
.how li { margin-bottom: 8px; }
.how .cta { margin-top: 22px; padding: 16px 18px; border-left: 4px solid var(--stamp); background: var(--wash); border-radius: 0 8px 8px 0; }

footer { margin-top: 64px; padding-top: 22px; padding-bottom: 40px; border-top: 1px solid var(--line); color: var(--pencil); font-size: 14px; }

@media (max-width: 820px) {
  .desk { grid-template-columns: 1fr; }
  .viewer { position: static; }
  .drop { min-height: 220px; }
  .summary { grid-template-columns: 1fr; gap: 12px; }
  .bar { grid-template-columns: 6rem 1fr 5.5rem; }
  .fields { padding: 18px 16px 18px 40px; }
  .top nav { gap: 12px; }
}
@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr; }
  .stamp { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .stamp.on { animation: none; opacity: .9; transform: rotate(-9deg); }
  tr.new td { animation: none; }
}
