/* ATH PDF → Excel. No framework, no inline styles: the content-security-policy forbids them. */

:root {
  --bg: #f5f7f6;
  --surface: #ffffff;
  --text: #16201b;
  --muted: #5d6b64;
  --line: #dfe5e1;
  --brand: #107c41;
  --brand-dark: #0b5c30;
  --brand-soft: #e6f4ec;
  --bad: #b42318;
  --bad-soft: #fdeceb;
  --warn: #8a5a00;
  --warn-soft: #fff4d6;
  --star: #e6a100;
  --info: #1d5fa8;
  --info-soft: #e5f0fb;
  --shadow: 0 1px 2px rgba(16, 32, 24, .05), 0 10px 28px rgba(16, 32, 24, .07);
  --radius: 16px;

  /* the Excel sheet colours, shared by the preview and the legend */
  --xl-header: #d9e1f2;
  --xl-banner: #e7e6e6;
  --xl-title: #1f3864;
  --xl-lowconf: #fff2cc;
  --xl-repaired: #ddebf7;
  --xl-fail: #f8cbad;
  --xl-fail-text: #9c0006;
  --xl-total: #f2f2f2;
  --xl-muted: #808080;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1512;
    --surface: #161e19;
    --text: #e7efe9;
    --muted: #9fb0a6;
    --line: #26332b;
    --brand: #2fb36b;
    --brand-dark: #1f9456;
    --brand-soft: #14281d;
    --bad: #ff8a7a;
    --bad-soft: #3a1f1b;
    --warn: #f2c261;
    --warn-soft: #342a10;
    --star: #f5c451;
    --info: #8dbcf0;
    --info-soft: #172a3d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .35);

    --xl-header: #26354a;
    --xl-banner: #2a3430;
    --xl-title: #9ec1ff;
    --xl-lowconf: #4a4020;
    --xl-repaired: #1c3550;
    --xl-fail: #5a2a22;
    --xl-fail-text: #ffb4a8;
    --xl-total: #212b25;
    --xl-muted: #8b9a91;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  accent-color: var(--brand);
}

h1, h2, h3 { line-height: 1.15; letter-spacing: -.015em; margin: 0 0 .5em; }
h1 { font-size: clamp(30px, 4.4vw, 46px); font-weight: 750; }
h2 { font-size: 24px; font-weight: 700; }
h3 { font-size: 18px; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--brand-dark); }
@media (prefers-color-scheme: dark) { a { color: var(--brand); } }

.container { width: 100%; max-width: 1100px; margin-inline: auto; padding-inline: 20px; }
.main { min-height: 62vh; padding-bottom: 24px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pad { padding: 18px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 20; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 6px; }

/* ---- header / footer ---- */
.site-header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 22px; height: 62px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; }
.logo { width: 30px; height: 30px; color: var(--brand); }
.brand-name b { color: var(--brand); }
.brand-sub { color: var(--muted); font-weight: 600; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 8px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; }
.nav a:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
.nav a.active { color: var(--text); background: var(--brand-soft); }
.bar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.lang { display: inline-flex; }
.lang button { border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 4px 10px; font-family: inherit; font-weight: 700; font-size: 12px; line-height: 1.6; cursor: pointer; }
.lang button:first-child { border-radius: 8px 0 0 8px; }
.lang button:last-child { border-radius: 0 8px 8px 0; border-left: 0; }
.lang button.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.account { display: inline-flex; align-items: center; gap: 10px; }
.who { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--muted); }

.site-footer { border-top: 1px solid var(--line); margin-top: 56px; padding: 26px 0 36px; color: var(--muted); font-size: 13px; }
.site-footer p { margin: 0 0 6px; }

/* ---- buttons, chips, forms ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 10px; border: 1px solid transparent;
  font-family: inherit; font-weight: 600; font-size: 15px; line-height: 1.2; text-decoration: none; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-lg { padding: 14px 24px; font-size: 16px; border-radius: 12px; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn[disabled]:hover { background: var(--brand); }
.icon { width: 18px; height: 18px; flex: none; }
.icon-lg { width: 40px; height: 40px; flex: none; color: var(--brand); }

.error { color: var(--bad); background: var(--bad-soft); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); border-radius: 10px; padding: 10px 12px; margin: 12px 0; font-size: 14px; }
.error[hidden] { display: none; }

.chip { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 650; white-space: nowrap; background: var(--line); color: var(--text); }
.chip.queued { background: var(--warn-soft); color: var(--warn); }
.chip.running { background: var(--info-soft); color: var(--info); }
.chip.succeeded { background: var(--brand-soft); color: var(--brand-dark); }
.chip.failed { background: var(--bad-soft); color: var(--bad); }
@media (prefers-color-scheme: dark) { .chip.succeeded { color: var(--brand); } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }

/* ---- landing ---- */
.hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 44px; align-items: center; padding: 54px 0 34px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 12.5px; font-weight: 700; color: var(--brand-dark); margin-bottom: 10px; }
@media (prefers-color-scheme: dark) { .eyebrow { color: var(--brand); } }
.lead { font-size: 18px; color: var(--muted); max-width: 52ch; }
.ticks { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 8px; }
.ticks li { padding-left: 26px; position: relative; }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--brand); font-weight: 800; }

.hero-card { padding: 22px; }
/* minmax(0,1fr): an implicit grid column is as wide as its content, so a long file name widened the whole form past the card on a phone */
.upload { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 38px 18px; border: 2px dashed color-mix(in srgb, var(--brand) 45%, var(--line)); border-radius: 14px;
  background: color-mix(in srgb, var(--brand-soft) 55%, transparent); cursor: pointer; transition: background .15s, border-color .15s; }
.dropzone:hover, .dropzone.over { background: var(--brand-soft); border-color: var(--brand); }
.dropzone[hidden] { display: none; }
.drop-title { font-weight: 700; font-size: 17px; }
.drop-hint { font-size: 13.5px; }
.picked { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.picked[hidden] { display: none; }
.picked-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.picked-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter[hidden] { display: none; }
.meter-fill { height: 100%; width: 0; background: var(--brand); transition: width .15s linear; }
.signin-prompt { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 18px 8px; }
.sample-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px; margin-top: 16px; font-size: 14px; }
.sample-cta form.inline { display: inline; margin: 0; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-dark); text-decoration: underline; cursor: pointer; }
.linkish:hover { color: var(--text); }
@media (prefers-color-scheme: dark) { .linkish { color: var(--brand); } }

.section { padding: 28px 0 8px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 14px; }
.step { padding: 20px; }
.step p { color: var(--muted); margin: 0; }
.step-no { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; margin-bottom: 12px; }
@media (prefers-color-scheme: dark) { .step-no { color: var(--brand); } }

.sample { padding: 0; overflow: hidden; margin-top: 10px; }
.sample .legend { padding: 12px 18px 16px; }

/* ---- the free tools: a card per tool on the landing page and on /tools, one page per tool ---- */
/* five tools sit 3 + 2 rather than 4 + 1, which leaves no lone card at the end of the row */
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 14px; }
.tool { display: flex; flex-direction: column; gap: 8px; padding: 20px; color: var(--text); text-decoration: none; }
.tool h3 { margin: 0; font-size: 17px; }
.tool p { margin: 0; color: var(--muted); font-size: 14px; flex: 1; }
.tool .icon-lg { width: 32px; height: 32px; }
a.tool:hover { border-color: var(--brand); box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 14%, transparent); }
.tool-go { font-weight: 650; color: var(--brand-dark); }
a.tool:hover .tool-go { text-decoration: underline; }
.tool.featured { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); background: color-mix(in srgb, var(--brand-soft) 45%, var(--surface)); }
.nowrap { white-space: nowrap; }
.tool-star { width: 1em; height: 1em; margin-left: 6px; vertical-align: -.1em; color: var(--star); }
.tool-star + .tool-star { margin-left: 1px; }
.tool.soon { opacity: .72; }
.tool.soon .icon-lg { color: var(--muted); }
.tool.soon .chip { align-self: flex-start; }
.tool-page .dropzone { padding: 28px 18px; }
/* the drop zone and, on a touch screen, the "take a photo" button beside it; hidden together once a photo is chosen */
.source { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.source[hidden], [data-camera][hidden] { display: none; }
.pick-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.scan-editor { margin-bottom: 14px; }
.scan-editor[hidden] { display: none; }
/* touch-action: none, or dragging a corner scrolls the page instead on a phone */
.scan-canvas { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); touch-action: none; cursor: crosshair; }
.scan-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
/* the three example pictures: what the tool does, in order */
.scan-how { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 16px; }
.scan-how h2 { font-size: 17px; margin: 0 0 10px; }
.scan-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 10px; }
/* the three pictures are not the same shape (the straightened one is a page), so each figure fills the row and its
   caption sits at the bottom: the captions line up instead of stepping down */
.scan-steps figure { margin: 0; display: flex; flex-direction: column; height: 100%; }
.scan-steps img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.scan-steps figcaption { display: flex; align-items: center; gap: 8px; margin-top: auto; padding-top: 6px; font-size: 13px; color: var(--muted); }
.scan-steps .step-no { width: 22px; height: 22px; margin: 0; font-size: 12px; flex: none; }

.scan-result { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.scan-result[hidden] { display: none; }
/* a document is tall; the preview keeps its shape and stays inside the card */
.scan-preview { display: block; max-width: 100%; max-height: 70vh; margin-inline: auto; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.choices { border: 0; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.choice { display: flex; align-items: center; gap: 8px; }
.choice input { accent-color: var(--brand); width: 16px; height: 16px; }
.choice.tidy { margin-bottom: 12px; }
.merge-list[hidden] { display: none; }
/* minmax(0,1fr): an implicit grid column is as wide as its content, which a long file name would push past the card */
.merge-items { list-style: decimal; margin: 6px 0 10px; padding-left: 22px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.merge-item::marker { color: var(--muted); font-weight: 700; }
.merge-row { display: flex; align-items: center; gap: 8px; }
.merge-row .picked-text { flex: 1; min-width: 0; }
.merge-row .row-actions { flex: none; flex-wrap: nowrap; gap: 4px; }
.merge-row .btn-sm { padding: 4px 8px; line-height: 1.2; }
.tool-page h1 { font-size: 26px; margin-bottom: 4px; }
.tool-notes { margin: 18px 0 0; color: var(--muted); }
.ok-line { color: var(--brand-dark); background: var(--brand-soft); border-radius: 10px; padding: 10px 12px; margin: 12px 0; font-size: 14px; }
@media (prefers-color-scheme: dark) { .tool-go, .ok-line { color: var(--brand); } }
@media (max-width: 860px) { .tool-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .tool-grid { grid-template-columns: 1fr; } }

/* ---- page heads ---- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 28px 0 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 30px; margin: 0; }
.crumbs { margin-top: 22px; font-size: 14px; }
.crumbs a { text-decoration: none; color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.job-head { margin-top: 10px; }
.file-title { display: flex; align-items: center; gap: 14px; min-width: 0; }
.file-name { font-size: 24px; margin: 0; overflow-wrap: anywhere; }
.file-title p { margin: 2px 0 0; font-size: 14px; }

.narrow { max-width: 640px; margin: 56px auto; }
.login h1 { font-size: 30px; }
.login .google { gap: 10px; }
.empty { display: grid; justify-items: start; gap: 6px; }

.prose h1 { font-size: 34px; }
.prose h2 { font-size: 20px; margin-top: 1.6em; }
.prose li { margin-bottom: .4em; }

/* ---- list of conversions ---- */
.list { padding: 0; }
.rows { width: 100%; border-collapse: collapse; }
.rows th, .rows td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rows th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.rows tr:last-child td { border-bottom: 0; }
.rows .num { text-align: right; font-variant-numeric: tabular-nums; }
.rows .file { font-weight: 650; text-decoration: none; overflow-wrap: anywhere; }
.rows .file:hover { text-decoration: underline; }

/* ---- one conversion ---- */
.progress-card { display: grid; gap: 16px; }
.progress-top { display: flex; align-items: center; gap: 16px; }
.progress-title { font-weight: 700; font-size: 18px; margin: 0; }
.progress-text p { margin: 0; }
.progress-actions { margin: 0; justify-self: start; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
progress { width: 100%; height: 8px; border: 0; border-radius: 999px; overflow: hidden; background: var(--line); accent-color: var(--brand); }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--brand); transition: width .4s; }
progress::-moz-progress-bar { background: var(--brand); }

.error-card { display: flex; gap: 18px; align-items: flex-start; border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.error-card .icon-lg { color: var(--bad); }
.error-card h2 { margin-bottom: 6px; }
.error-card .actions { margin-bottom: 0; }

.notice { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 18px; border-color: color-mix(in srgb, var(--info) 40%, var(--line)); }
.notice .icon-lg { color: var(--info); }
.notice h2 { margin-bottom: 6px; }
.notice p { margin: 0; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 8px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; }
.kpi-v { font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums; }
.kpi-l { color: var(--muted); font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 18px 0; }
.actions form { margin: 0; }

.table-cards { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 10px; }
.table-card { padding: 14px 18px; box-shadow: none; display: grid; gap: 8px; }
.table-card-head { display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { font-size: 12.5px; font-weight: 650; padding: 3px 10px; border-radius: 999px; background: var(--line); color: var(--text); }
.badge.ok { background: var(--brand-soft); color: var(--brand-dark); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.soft { background: var(--warn-soft); color: var(--warn); }
.badge.neutral { color: var(--muted); }
@media (prefers-color-scheme: dark) { .badge.ok { color: var(--brand); } }

/* ---- the sheet preview ---- */
.preview { padding: 0; overflow: hidden; }
.sheet-tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--bg); }
.tab { border: 0; background: transparent; padding: 12px 14px; font-family: inherit; font-weight: 650; font-size: 14px; line-height: 1; color: var(--muted); border-bottom: 2px solid transparent; cursor: pointer; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--brand); }
.scroll { overflow: auto; max-height: 72vh; }
.scroll[hidden] { display: none; }
.cut { padding: 10px 16px; margin: 0; border-top: 1px solid var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; list-style: none; margin: 0; padding: 12px 18px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 13px; height: 13px; border-radius: 3px; border: 1px solid color-mix(in srgb, var(--text) 18%, transparent); }

table.xl { border-collapse: collapse; table-layout: fixed; font: 12.5px/1.35 ui-sans-serif, system-ui, "Segoe UI", sans-serif; background: var(--surface); }
table.xl td, table.xl th { border: 1px solid var(--line); padding: 2px 6px; height: 22px; overflow: hidden; white-space: pre; text-overflow: clip; vertical-align: top; }
table.xl td.wrap { white-space: normal; }
table.xl td.r { text-align: right; font-variant-numeric: tabular-nums; }
table.xl th.c { background: var(--bg); color: var(--muted); font-weight: 500; font-size: 11px; text-align: center; padding: 1px 4px; }
table.xl thead th { position: sticky; top: 0; z-index: 1; }
.Header { background: var(--xl-header); font-weight: 700; text-align: center; vertical-align: middle; white-space: normal; }
.Banner { background: var(--xl-banner); font-weight: 700; }
.Title { font-weight: 700; color: var(--xl-title); }
.Muted { color: var(--xl-muted); font-style: italic; }
.LowConf { background: var(--xl-lowconf); }
.Repaired { background: var(--xl-repaired); }
.ReconFail { background: var(--xl-fail); color: var(--xl-fail-text); }
.Note { color: var(--xl-muted); font-style: italic; }
.Total { background: var(--xl-total); font-weight: 700; }
table.sample-table { width: 100%; table-layout: auto; font-size: 14px; }
table.sample-table td, table.sample-table th { padding: 8px 14px; height: auto; white-space: nowrap; }
table.sample-table td.r { font-variant-numeric: tabular-nums; }

/* ---- small screens ---- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 28px; }
  .steps { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .brand-sub, .who { display: none; }
  .bar { gap: 12px; }
}
.brand-name { white-space: nowrap; }
.nav a { white-space: nowrap; }
@media (max-width: 640px) {
  /* brand and language switch on the first row, the menu on a row of its own */
  .bar { flex-wrap: wrap; height: auto; padding-block: 8px; gap: 4px 12px; }
  .nav { order: 3; width: 100%; flex-wrap: wrap; }
  .nav a { padding: 6px 10px; font-size: 14px; }
}
@media (max-width: 520px) {
  .nav a { padding: 6px 10px; }
  .page-head h1, .file-name { font-size: 22px; }
  .rows.jobs th:nth-child(3), .rows.jobs td:nth-child(3), .rows.jobs th:nth-child(4), .rows.jobs td:nth-child(4) { display: none; }
}
/* ---- pages, requests and the admin console ---- */
.pill { display: inline-block; min-width: 1.7em; padding: 0 7px; margin-left: 4px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; line-height: 1.7; text-align: center; font-variant-numeric: tabular-nums; }

.chip.pending { background: var(--warn-soft); color: var(--warn); }
.chip.approved, .chip.active { background: var(--brand-soft); color: var(--brand-dark); }
.chip.rejected, .chip.blocked { background: var(--bad-soft); color: var(--bad); }
.chip.cancelled { background: var(--line); color: var(--muted); }
@media (prefers-color-scheme: dark) { .chip.approved, .chip.active { color: var(--brand); } }

input[type="text"], input[type="number"], input[type="search"], input[type="email"], input[type="tel"], input[type="url"], input[type="date"], textarea, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-width: 0; }
input[type="text"]:hover, input[type="number"]:hover, input[type="search"]:hover, input[type="email"]:hover, input[type="tel"]:hover, input[type="url"]:hover, input[type="date"]:hover, textarea:hover, select:hover { border-color: var(--muted); }
textarea { width: 100%; resize: vertical; line-height: 1.5; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field-label { display: block; font-size: 13px; font-weight: 650; color: var(--muted); margin-bottom: 4px; }
.field .field-label { margin-bottom: 0; }
.field-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.field-row input { flex: 1 1 140px; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 0 0 16px; }
.filters .field { margin: 0; }
.filters .grow { flex: 1 1 220px; }
.filters .grow input { width: 100%; }
.filters input[type="date"] { width: 160px; }
.flash { margin: 0 0 16px; padding: 10px 14px; border-radius: 10px; font-size: 14px; background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); }

.credit-top { display: grid; grid-template-columns: 1fr 1.6fr; gap: 16px; align-items: start; }
.balance-card { display: grid; gap: 2px; }
.balance-card p { margin: 6px 0 0; }
.balance-v { font-size: 44px; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.facts { display: grid; gap: 10px; margin: 0 0 14px; }
.facts > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
.facts dt { min-width: 150px; font-size: 13px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 650; }
.facts dd.balance-v { font-size: 26px; }
.code { font: 700 14px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; letter-spacing: .04em; }
.active-card .code { font-size: 22px; }
.active-card form { margin: 0; }
.credit-hint { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin-top: 14px; padding: 10px 14px; border-radius: 12px; background: var(--brand-soft); font-size: 14px; }
.credit-hint p { margin: 0; }
.credit-hint.empty { background: var(--warn-soft); }
.qr, .qr-preview { margin: 14px 0 0; }
.qr img, .qr-preview img { width: 200px; height: auto; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.qr-preview img { width: 160px; }
.qr figcaption, .qr-preview figcaption { margin-top: 6px; max-width: 280px; }
.rows td.wrap { max-width: 260px; overflow-wrap: anywhere; }
.rows td.note { max-width: 200px; }
/* addresses, amounts, dates and codes are never broken across lines: a wide table scrolls sideways instead */
.rows td.num, .rows .code, .rows .person { white-space: nowrap; }
.rows.dense th, .rows.dense td { padding: 10px 12px; }
.rows .person { font-weight: 650; text-decoration: none; }
.rows .person:hover { text-decoration: underline; }
.rows td.decision { min-width: 250px; }
.card.list .scroll { max-height: none; }
.pos { color: var(--brand-dark); }
.neg { color: var(--bad); }
@media (prefers-color-scheme: dark) { .pos { color: var(--brand); } }

.subnav { display: flex; flex-wrap: wrap; gap: 2px; margin: 0 0 20px; border-bottom: 1px solid var(--line); }
.subnav a { margin-bottom: -1px; padding: 10px 14px; color: var(--muted); font-weight: 650; text-decoration: none; border-bottom: 2px solid transparent; }
.subnav a:hover { color: var(--text); }
.subnav a.on { color: var(--text); border-bottom-color: var(--brand); }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row-actions form { display: flex; align-items: center; gap: 6px; margin: 0; }
.row-actions input[type="text"] { width: 170px; padding: 6px 10px; font-size: 13px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.pager-links { display: flex; gap: 8px; }
.user-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.user-email { margin: 0; font-size: 22px; overflow-wrap: anywhere; }
.user-head p { margin: 2px 0 0; }
.admin-forms { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.admin-forms form { margin: 0; }
.settings-form { max-width: 640px; margin-bottom: 20px; }
.settings-form h2 { font-size: 20px; margin-bottom: 14px; }
.settings-form .field { margin-bottom: 24px; }
.settings-form input[type="number"] { max-width: 260px; }
.settings-form input[type="email"], .settings-form input[type="tel"], .settings-form input[type="text"], .settings-form input[type="url"] { width: 100%; }
.settings-form p { margin: 0 0 14px; }
.settings-form .field p { margin: 0; }
.contact-list { margin-bottom: 18px; }
.contact-list dt { min-width: 120px; }
.help { margin: 14px 0 0; }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }

/* ---- advertisements: a row of cards for visitors who are not signed in, scrolling sideways (no script needed) ---- */
/* a card is 252 px wide: four of them and their gaps fit exactly in the 1060 px a page offers, so up to four cards need no scrolling on a desktop */
.ads, .ad-admin { --ad-w: 252px; }
.ads { margin-top: 40px; }
.ads-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.ads-title { margin: 0; font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ads-nav { display: flex; gap: 6px; }
.ads-nav[hidden] { display: none; }
.ads-nav .btn-sm { min-width: 36px; padding: 2px 10px; font-size: 22px; line-height: 1.2; }
/* the padding leaves room for the shadow, the lift on hover and the focus ring, which the scrolling box would otherwise clip (a clipped
   shadow shows as a faint rectangle round the row) */
.ads-track { list-style: none; margin: 0 -12px; padding: 8px 12px 24px; display: flex; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 12px; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.ads-item { flex: 0 0 min(var(--ad-w), 78%); display: flex; scroll-snap-align: start; }
/* position: relative keeps the visually hidden "opens in a new tab" text inside its card: left alone it would sit where the page puts it,
   far to the right of a card that has scrolled out of view, and give the whole page a sideways scrollbar */
.ad { position: relative; display: flex; flex-direction: column; width: 100%; min-width: 0; color: var(--text); text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 4px 10px rgba(0, 0, 0, .07); overflow: hidden; transition: border-color .15s, transform .15s; }
a.ad[href]:hover { border-color: var(--brand); transform: translateY(-2px); }
/* the picture is shown whole, whatever its shape: a banner fills the frame, an icon or a phone screenshot sits inside it */
.ad-media { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: color-mix(in srgb, var(--text) 4%, var(--surface)); }
.ad-body { display: flex; flex: 1; flex-direction: column; gap: 10px; padding: 14px 16px 16px; }
.ad-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; overflow-wrap: anywhere; font-weight: 600; line-height: 1.4; }
.ad-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; font-size: 13px; }
.ad-host { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.ad-go { flex: none; font-weight: 650; color: var(--brand-dark); }
@media (prefers-color-scheme: dark) { .ad-go { color: var(--brand); } }
/* the editor: the card as visitors see it, with its form beside it */
.ad-admin { display: grid; grid-template-columns: var(--ad-w) minmax(0, 1fr); gap: 24px; align-items: start; margin-bottom: 16px; }
.ad-admin-intro { margin: 14px 0 20px; }
.ad-admin.is-hidden .ad { opacity: .6; }
.ad-admin-preview p { margin: 10px 0 0; }
.ad-admin-edit form { margin: 0 0 12px; }
.ad-admin-edit .field { margin-bottom: 14px; }
.ad-admin-edit .field p { margin: 0; }
.ad-admin-edit input[type="text"], .ad-admin-edit input[type="url"] { width: 100%; }
.ad-admin-edit input[type="number"] { max-width: 120px; }

/* ---- the Excel column mapper: templates, their editor, a finished mapping ---- */
.mapper { max-width: 860px; margin: 40px auto; }
.mapper-wide { max-width: 980px; }
.mapper .mapper-step { font-size: 17px; margin: 22px 0 10px; }
.mapper .upload { margin-top: 4px; }
.mapper-head { margin: 28px 0 12px; align-items: center; }
.mapper-head h2 { margin: 0; font-size: 20px; }
.mapper-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.mapper-card { padding: 18px; min-width: 0; }
.mapper-card.example { border-style: dashed; }
.mapper-card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 6px; }
.mapper-card h3 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.mapper-card .actions { margin: 12px 0 0; }
.mapper-rows-wrap { margin: 8px 0 0; max-height: 380px; }
.mapper-rows td, .mapper-rows th { padding: 7px 10px; overflow-wrap: anywhere; }
.mapper-rows .arrow, .mapper-table .arrow { width: 26px; padding-inline: 0; text-align: center; color: var(--muted); }
.mapper-found { overflow-wrap: anywhere; margin: 0; }
.tool .tool-lock { align-self: flex-start; justify-self: start; grid-column: 2; font-size: 12px; padding: 2px 10px; background: var(--brand-soft); color: var(--brand-dark); }
@media (prefers-color-scheme: dark) { .tool .tool-lock { color: var(--brand); } }
.notice-line { margin: 10px 0; padding: 10px 12px; border-radius: 10px; font-size: 14px; background: var(--info-soft); border: 1px solid color-mix(in srgb, var(--info) 30%, transparent); overflow-wrap: anywhere; }

.mapper-start { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px 10px; margin: 0 0 16px; min-width: 0; }
.mapper-start legend { padding: 0 6px; }
.mapper-start p { margin: 0 0 10px; }
.mapper-match-files { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 8px; }
.match-file { display: grid; gap: 4px; flex: 1 1 240px; min-width: 0; }
.match-file input[type="file"] { max-width: 100%; }
/* the columns of the person's own file: chips to drag onto a line */
.mapper-pool-panel { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0 0 16px; background: var(--bg); }
.mapper-pool-panel.drop { border-color: var(--brand); outline: 2px dashed var(--brand); outline-offset: 2px; }
.mapper-pool-panel p { margin: 0 0 8px; }
.mapper-pool { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.src-chip { max-width: 100%; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 14px; overflow-wrap: anywhere; }
.script-on .src-chip { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.src-chip:hover { border-color: var(--brand); }
.src-chip.used { opacity: .45; }
.drag-ghost { position: fixed; z-index: 100; max-width: 280px; padding: 6px 12px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 14px; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none; }
.mapper-row.drop td { background: var(--brand-soft); }
.match-hint { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.mapper-row.edited .match-hint { display: none; }
.mapper-table td.has-grip { position: relative; padding-left: 32px; }
.grip { position: absolute; left: 8px; top: 13px; width: 20px; text-align: center; font-size: 18px; line-height: 1; color: var(--muted); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.grip:hover { color: var(--brand); }
.mapper-hint { margin: 0 0 10px; }
.mapper-edit-wrap { max-height: none; }
.mapper-table { width: 100%; border-collapse: collapse; }
.mapper-table th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 0 6px 6px; white-space: nowrap; }
.mapper-table td { padding: 4px 6px; vertical-align: middle; }
.mapper-table input[type="text"] { width: 100%; }
.mapper-table td:nth-child(1), .mapper-table td:nth-child(3) { width: 32%; }
.mapper-table td:nth-child(4) { width: 20%; }
.mapper-table input:disabled { background: var(--bg); color: var(--muted); }
.mapper-row.bad input { border-color: var(--bad); }
.mapper-row .row-actions { white-space: nowrap; text-align: right; }
.mapper-row .row-actions .btn-sm { padding: 4px 8px; line-height: 1.2; }
.mapper-tools { display: flex; gap: 8px; margin: 10px 0 6px; }
.mapper-tools [hidden] { display: none; }
.mapper-summary { min-height: 1.5em; margin: 6px 0 0; overflow-wrap: anywhere; }
.bank-admin-intro { margin: 14px 0 20px; max-width: 760px; }
.bank-admin { max-width: 760px; margin-bottom: 10px; padding: 14px 18px; }
.bank-admin.is-hidden { opacity: .75; }
.bank-admin summary { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; cursor: pointer; list-style: none; }
.bank-admin summary::-webkit-details-marker { display: none; }
.bank-admin summary h3 { margin: 0; font-size: 17px; overflow-wrap: anywhere; }
.bank-admin summary h3::before { content: "▸"; display: inline-block; width: 1.1em; color: var(--muted); }
.bank-admin details[open] summary { margin-bottom: 14px; }
.bank-admin details[open] summary h3::before { content: "▾"; }
.bank-admin .field { margin-bottom: 14px; }
.bank-admin .field p { margin: 0; }
.bank-admin input[type="text"], .bank-admin textarea { width: 100%; }
.bank-admin input[type="number"] { max-width: 120px; }
.bank-admin textarea { min-height: 130px; }
.bank-admin form { margin: 0 0 12px; }
.settings-form textarea { min-height: 150px; }
.admin-templates-form .field-row { align-items: flex-end; }
.admin-templates-form input[type="number"] { width: 120px; flex: 0 0 auto; }

@media (max-width: 860px) {
  .mapper-cards { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .mapper { margin: 10px auto 20px; }
  .mapper-card { padding: 14px; }
  /* a line of the editor is a small block of its own: the three boxes one over the other, the buttons under them */
  .mapper-table thead { display: none; }
  .mapper-table, .mapper-table tbody { display: block; }
  .mapper-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .mapper-row td { display: block; width: auto !important; padding: 0; }
  .mapper-row .arrow { display: none; }
  .mapper-table td.has-grip { padding-left: 0; }
  .mapper-row .grip { display: none; }
  .mapper-row td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 12px; font-weight: 650; color: var(--muted); }
  .mapper-row .row-actions { text-align: left; }
}

@media (max-width: 860px) {
  .credit-top, .admin-forms { grid-template-columns: 1fr; }
  .ad-admin { grid-template-columns: 1fr; }
  .ad-admin-preview { max-width: var(--ad-w); }
}
@media (max-width: 520px) {
  .balance-v { font-size: 36px; }
  .row-actions input[type="text"] { width: 130px; }
}
/* ---- phones: less to scroll ---- */
@media (max-width: 640px) {
  .container { padding-inline: 16px; }
  h1 { font-size: 26px; }
  h2 { font-size: 20px; }
  /* the menu is two rows here: let it scroll away instead of covering a sixth of the screen */
  .site-header { position: static; }
  .site-footer { margin-top: 24px; padding: 18px 0 24px; }
  .section { padding: 18px 0 4px; }
  .section p { margin-bottom: .6em; }
  .ads { margin-top: 24px; }

  /* landing: the heading and the lead, then the upload card; the three ticks come after it */
  .hero { gap: 6px; padding: 14px 0 4px; }
  .hero-copy { display: contents; }
  .hero-copy > * { margin: 0; }
  .eyebrow { font-size: 12px; }
  .lead { font-size: 16px; margin-bottom: 8px; }
  .hero-card { order: 1; margin-top: 4px; padding: 14px; }
  .ticks { order: 2; margin-top: 8px; gap: 4px; font-size: 14px; }
  .upload { gap: 12px; }
  .dropzone, .tool-page .dropzone { padding: 20px 14px; }
  .dropzone .icon-lg { width: 32px; height: 32px; }
  .credit-hint { margin-top: 12px; padding: 8px 12px; }
  .sample-cta { margin-top: 12px; }

  .steps { gap: 8px; margin-top: 10px; }
  .step { display: grid; grid-template-columns: 32px minmax(0, 1fr); column-gap: 12px; align-items: start; padding: 12px 14px; }
  .step-no { grid-row: 1 / span 2; margin: 0; }
  .step h3 { margin: 0 0 2px; font-size: 16px; }
  .step p { font-size: 14px; }
  .sample { margin-top: 6px; }
  table.sample-table td, table.sample-table th { padding: 6px 10px; }

  /* the tools: a row each (picture, name, what it does, an arrow) instead of a tall card */
  .tool-grid { gap: 8px; margin-top: 10px; }
  .tool { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; column-gap: 12px; row-gap: 2px; align-items: center; padding: 12px 14px; }
  .tool .icon-lg { grid-row: 1 / span 2; width: 28px; height: 28px; }
  .tool h3 { font-size: 16px; }
  .tool p { grid-column: 2; font-size: 13px; line-height: 1.4; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
  .tool-go, .tool.soon .chip { grid-column: 3; grid-row: 1 / span 2; }
  .tool-go { font-size: 0; }
  .tool-go::after { content: "›"; font-size: 26px; line-height: 1; }
  /* on the landing page just the names, two to a row: /tools is one tap away for the rest */
  .tools-home .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tools-home .tool { display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 12px; }
  .tools-home .tool h3 { font-size: 15px; }
  .tools-home .tool p, .tools-home .tool-go, .tools-home .tool .chip { display: none; }
  .tools-home .tool .icon-lg { width: 24px; height: 24px; }

  .page-head { margin: 14px 0 8px; }
  .page-head h1 { font-size: 24px; }
  .page-head p { margin: 4px 0 0; }

  /* a tool's own page: the card starts under the crumbs */
  .crumbs { margin-top: 12px; }
  .narrow { margin: 10px auto 20px; }
  .tool-page .card { padding: 16px; }
  .tool-page h1 { font-size: 22px; }
  .tool-notes { margin-top: 12px; }
  .scan-how { margin-top: 16px; padding-top: 12px; }
  /* the three example pictures swipe sideways instead of standing in a column */
  .scan-steps { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px; overscroll-behavior-x: contain; }
  .scan-steps figure { flex: 0 0 68%; scroll-snap-align: start; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
