/* SwiftPipe VAT — self-contained stylesheet (no CDN, no build step). */
:root {
  color-scheme: light;
  --bg: #f4f5f7; --panel: #ffffff; --panel-2: #f8f9fb; --ink: #1a1f2b; --ink-2: #3f4756; --muted: #667085;
  --line: #e4e7ec; --line-2: #cfd4dc;
  --accent: #1f5fbf; --accent-ink: #164a99; --accent-soft: #e8f0fc; --accent-line: #b9d0f5;
  --warn: #8a5300; --warn-soft: #fff3df; --bad: #b42318; --bad-soft: #fdecea; --good: #067647; --good-soft: #e5f5ec;
  --brand: #f2c200; --brand-soft: #fff6cc;
  --chart-1: #2a78d6; --chart-2: #b9bcc4; --chart-3: #1baf7a; --grid: #e4e7ec; --axis: #c3c7cf;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --btn-ink: #ffffff;
  --radius: 10px; --header-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101317; --panel: #181c23; --panel-2: #1e232b; --ink: #e8ebf0; --ink-2: #c3c9d3; --muted: #97a1b2;
    --line: #2a303a; --line-2: #3a4250;
    --accent: #7fb0ff; --accent-ink: #a9c8ff; --accent-soft: #1b2a43; --accent-line: #2f4a78;
    --warn: #f3b74c; --warn-soft: #3a2b10; --bad: #f8796f; --bad-soft: #3d1c19; --good: #55d193; --good-soft: #143121;
    --brand-soft: #3b3410;
    --chart-1: #3987e5; --chart-2: #5b6473; --chart-3: #199e70; --grid: #2a303a; --axis: #3a4250;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --btn-ink: #0b1220;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101317; --panel: #181c23; --panel-2: #1e232b; --ink: #e8ebf0; --ink-2: #c3c9d3; --muted: #97a1b2;
  --line: #2a303a; --line-2: #3a4250;
  --accent: #7fb0ff; --accent-ink: #a9c8ff; --accent-soft: #1b2a43; --accent-line: #2f4a78;
  --warn: #f3b74c; --warn-soft: #3a2b10; --bad: #f8796f; --bad-soft: #3d1c19; --good: #55d193; --good-soft: #143121;
  --brand-soft: #3b3410;
  --chart-1: #3987e5; --chart-2: #5b6473; --chart-3: #199e70; --grid: #2a303a; --axis: #3a4250;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --btn-ink: #0b1220;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 24px; line-height: 1.2; margin: 0 0 4px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 32px 0 10px; font-weight: 650; }
h2:first-child, .panel h2:first-child { margin-top: 0; }
h3 { font-size: 14px; margin: 16px 0 6px; font-weight: 650; }
p { margin: 0 0 10px; }
code { background: var(--panel-2); border: 1px solid var(--line); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.pos { color: var(--good); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.hide-phone { }
.skip { position: absolute; left: -999px; top: 8px; background: var(--panel); padding: 8px 12px; border-radius: 6px; z-index: 50; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* ---------- header / nav ---------- */
header.top { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
header.top .wrap { display: flex; align-items: center; gap: 20px; height: var(--header-h); }
.brand { font-weight: 600; display: flex; align-items: center; gap: 9px; color: var(--ink); white-space: nowrap; font-size: 15px; }
.brand:hover { text-decoration: none; }
.brand .mark { width: 14px; height: 14px; background: var(--brand); border-radius: 4px; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.brand b { font-weight: 800; }
nav.main { display: flex; gap: 2px; overflow-x: auto; flex: 1; scrollbar-width: none; -ms-overflow-style: none; }
nav.main::-webkit-scrollbar { display: none; }
nav.main a { padding: 7px 11px; border-radius: 7px; color: var(--ink-2); white-space: nowrap; font-weight: 500; }
nav.main a:hover { background: var(--panel-2); text-decoration: none; color: var(--ink); }
nav.main a.on { background: var(--accent-soft); color: var(--accent-ink); }
.icon-btn { background: transparent; border: 1px solid var(--line); color: var(--muted); width: 32px; height: 32px; border-radius: 8px; padding: 0; cursor: pointer; font-size: 15px; line-height: 1; flex: none; }
.icon-btn:hover { color: var(--ink); background: var(--panel-2); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; }
footer.foot { color: var(--muted); font-size: 12px; padding: 12px 20px 32px; border-top: 1px solid var(--line); }

/* ---------- page head ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 20px; margin-bottom: 18px; }
.page-head .sub { margin: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sub { color: var(--muted); margin: 0 0 18px; }
.crumb { font-size: 12px; margin-bottom: 8px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--accent); }

/* ---------- panels, tiles ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.panel.tight { padding: 12px 14px; }
.panel.brand-edge { border-left: 4px solid var(--brand); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; align-items: start; }
.grid2 > .panel { margin-bottom: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; display: block; color: inherit; }
a.tile:hover { text-decoration: none; border-color: var(--accent-line); }
.tile .k { color: var(--muted); font-size: 12px; font-weight: 500; }
.tile .v { font-size: 24px; font-weight: 650; margin-top: 2px; line-height: 1.2; letter-spacing: -.01em; }
.tile .v.small { font-size: 16px; overflow-wrap: anywhere; }
.tile .n { color: var(--muted); font-size: 12px; margin-top: 4px; }
.tile.accent { border-top: 3px solid var(--brand); }
.hero { font-size: 40px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }

/* ---------- attention list ---------- */
.attention { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.attention li { background: var(--panel); border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; padding: 10px 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.attention li.bad { border-left-color: var(--bad); }
.attention li.warn { border-left-color: var(--warn); }
.attention li.info { border-left-color: var(--accent); }
.attention li span { flex: 1; min-width: 200px; }
.attention li.good { border-left-color: var(--good); }

/* ---------- steps (prepare this return) ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; counter-reset: step; }
.steps li { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; grid-template-columns: 24px 1fr; gap: 4px 10px; align-items: start; min-width: 0; }
.steps li a { color: inherit; }
.steps li a:hover { text-decoration: none; }
.steps .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-2); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--muted); grid-row: span 2; margin-top: 1px; }
.steps li.done .dot { background: var(--good); border-color: var(--good); color: #fff; }
.steps li.now { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--brand-soft); }
.steps li.now .dot { border-color: var(--brand); color: var(--ink); }
.steps .t { font-weight: 600; font-size: 13px; line-height: 1.3; }
.steps .d { color: var(--muted); font-size: 12px; line-height: 1.3; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--panel-2); white-space: nowrap; }
table.data thead th { border-bottom: 1px solid var(--line-2); }
table.data tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--panel-2) 55%, var(--panel)); }
table.data tbody tr:hover td { background: var(--accent-soft); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tr.total td { font-weight: 650; border-top: 2px solid var(--line-2); background: var(--panel-2); }
table.data tr.is-blocked td { color: var(--ink-2); }
table.data tr.group td { background: var(--panel-2); font-weight: 600; color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
table.data td.empty-row { color: var(--muted); text-align: center; padding: 28px; }
table.data td.actions, table.data td.payer { white-space: nowrap; }
table.data .sub-row { font-size: 12px; color: var(--muted); }
table.compact th, table.compact td { padding: 6px 8px; font-size: 13px; }
/* Wide month-by-month tables: keep the first and last columns in view while the months scroll between them. */
table.pinned th:first-child, table.pinned td:first-child { position: sticky; left: 0; z-index: 1; }
table.pinned th:last-child, table.pinned td:last-child { position: sticky; right: 0; z-index: 1; }
table.pinned td:first-child, table.pinned td:last-child { background: var(--panel); }
table.pinned th:first-child, table.pinned th:last-child { background: var(--panel-2); }
table.pinned tbody tr:nth-child(even) td:first-child, table.pinned tbody tr:nth-child(even) td:last-child { background: color-mix(in srgb, var(--panel-2) 55%, var(--panel)); }
table.pinned tbody tr:hover td:first-child, table.pinned tbody tr:hover td:last-child { background: var(--accent-soft); }
table.pinned tr.total td:first-child, table.pinned tr.total td:last-child { background: var(--panel-2); }
table.pinned th:first-child, table.pinned td:first-child { box-shadow: 1px 0 0 var(--line-2); }
table.pinned th:last-child, table.pinned td:last-child { box-shadow: -1px 0 0 var(--line-2); }
@media (min-width: 900px) {
  .table-wrap:not(.wide) { overflow: visible; }
  .table-wrap:not(.wide) table.data thead th { position: sticky; top: var(--header-h); z-index: 2; }
  table.data thead th:first-child { border-top-left-radius: var(--radius); }
  table.data thead th:last-child { border-top-right-radius: var(--radius); }
}

/* ---------- pills, flags ---------- */
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; white-space: nowrap; line-height: 18px; font-weight: 500; vertical-align: middle; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.info { background: var(--accent-soft); color: var(--accent-ink); }
.pill.muted { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.pill.brand { background: var(--brand-soft); color: var(--ink); }
.pill.dot::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; }
.status-repaid { background: var(--good-soft); color: var(--good); }
.status-filed { background: var(--accent-soft); color: var(--accent-ink); }
.status-overdue { background: var(--bad-soft); color: var(--bad); }
.status-due { background: var(--warn-soft); color: var(--warn); }
.status-open { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.diff-bad { color: var(--bad); font-weight: 600; }
.diff-ok { color: var(--good); }
.flaglist { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 6px; }
.flaglist li { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: start; font-size: 12px; }
.flaglist li .pill { margin-top: 1px; }

/* ---------- forms, buttons ---------- */
form.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
form.filters input[type="search"], form.filters input[type="text"] { min-width: 220px; flex: 1; }
input, select, textarea, button { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line-2); border-radius: 7px; padding: 6px 9px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
input.num { width: 96px; text-align: right; }
input[type="date"] { min-width: 150px; }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; accent-color: var(--accent); vertical-align: -3px; margin-right: 6px; }
label { cursor: pointer; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field .help { font-size: 12px; color: var(--muted); font-weight: 400; }
.btn, button.btn { background: var(--accent); color: var(--btn-ink); border: 1px solid transparent; padding: 7px 14px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 500; line-height: 1.3; white-space: nowrap; }
.btn:hover { text-decoration: none; background: var(--accent-ink); color: var(--btn-ink); }
.btn.ghost { background: var(--panel); color: var(--accent-ink); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.brand { background: var(--brand); color: #1a1f2b; }
.btn.brand:hover { background: #e0b400; color: #1a1f2b; }
.btn.danger { background: var(--panel); color: var(--bad); border-color: var(--line-2); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.tiny { padding: 2px 8px; font-size: 12px; border-radius: 6px; }
.btn[disabled] { opacity: .5; cursor: default; }
form.quick { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; margin: 0; }
form.quick select, form.quick input { padding: 2px 6px; font-size: 12px; border-radius: 6px; }
form.quick input[type="date"] { min-width: 132px; }
form.quick.tag input { width: 110px; }
form.quick.tag input.num { width: 70px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; }
.inline-form .field { margin: 0; }
.tabs { display: flex; gap: 6px; margin: 12px 0; flex-wrap: wrap; }
.tabs a { padding: 5px 12px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--ink-2); background: var(--panel); font-size: 13px; }
.tabs a:hover { text-decoration: none; border-color: var(--accent); color: var(--accent-ink); }
.tabs a.on { background: var(--accent); border-color: var(--accent); color: var(--btn-ink); }
.tabs a .n { opacity: .75; font-size: 12px; margin-left: 4px; }
.note { background: var(--warn-soft); color: var(--ink); border-left: 4px solid var(--warn); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.note.info { background: var(--accent-soft); border-left-color: var(--accent); }
.note.good { background: var(--good-soft); border-left-color: var(--good); }
.note.bad { background: var(--bad-soft); border-left-color: var(--bad); }
.drop { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 34px 20px; text-align: center; background: var(--panel-2); display: block; cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop b { font-size: 15px; }
.pager { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 10px 0 18px; font-size: 13px; }
.pager a, .pager span.cur { padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--panel); }
.pager span.cur { background: var(--accent); color: var(--btn-ink); border-color: var(--accent); }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; border: 1px dashed var(--line-2); border-radius: var(--radius); margin-bottom: 18px; }
.empty b { color: var(--ink); display: block; margin-bottom: 4px; }
details.group { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; box-shadow: var(--shadow); }
details.group > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; list-style: none; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary::before { content: "▸"; color: var(--muted); font-size: 12px; width: 12px; }
details.group[open] > summary::before { content: "▾"; }
details.group > summary .hint { font-weight: 400; color: var(--muted); font-size: 12px; flex-basis: 100%; padding-left: 22px; }
details.group > summary .count { margin-left: auto; color: var(--muted); font-weight: 500; font-size: 13px; white-space: nowrap; }
details.group > .body { padding: 0 16px 14px; }
details.group > .body .table-wrap { margin-bottom: 8px; }
details.group.block > summary::before { color: var(--bad); }
details.group.warn > summary::before { color: var(--warn); }

/* ---------- ROS-style VAT3 form ---------- */
.ros { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.ros .col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.ros .col h3 { margin: 0; padding: 10px 16px; background: var(--panel-2); border-bottom: 1px solid var(--line); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ros .row { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 8px 12px 8px 16px; border-bottom: 1px solid var(--line); }
.ros .row:last-child { border-bottom: 0; }
.ros .row.key { background: var(--brand-soft); }
.ros .code { font-weight: 800; font-size: 14px; color: var(--ink); }
.ros .desc { font-size: 12px; color: var(--muted); line-height: 1.3; }
.ros .desc b { display: block; color: var(--ink); font-size: 13px; font-weight: 600; }
.ros .val { display: inline-flex; align-items: center; gap: 6px; }
.ros .box { font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 650; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 5px 10px; min-width: 116px; text-align: right; }
.ros .row.key .box { background: var(--panel); border-color: var(--brand); }
.copy { background: transparent; border: 1px solid var(--line-2); color: var(--muted); border-radius: 6px; padding: 3px 7px; font-size: 12px; cursor: pointer; }
.copy:hover { color: var(--accent-ink); border-color: var(--accent); }

/* ---------- receipts ---------- */
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb { width: 132px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel-2); display: flex; flex-direction: column; }
.thumb a.img { display: block; height: 132px; background: var(--panel-2); text-align: center; }
.thumb a.img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb a.img.pdf { display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); font-size: 18px; }
.thumb .cap { font-size: 11px; color: var(--muted); padding: 4px 6px; display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.thumb .cap form { margin: 0; }
.thumb .cap button { border: 0; background: transparent; color: var(--muted); padding: 0 2px; cursor: pointer; font-size: 12px; }
.thumb .cap button:hover { color: var(--bad); }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .82); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 24px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 6px; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
.lightbox .lb-close { position: absolute; top: 12px; right: 16px; background: transparent; color: #fff; border: 0; font-size: 32px; cursor: pointer; line-height: 1; }
.lightbox .lb-open { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); color: #fff; background: rgba(255,255,255,.15); padding: 6px 14px; border-radius: 999px; }

/* ---------- line editor cards (transaction page) ---------- */
.line-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; background: var(--panel-2); }
.line-card .head { display: flex; justify-content: space-between; align-items: center; gap: 8px 12px; margin-bottom: 10px; flex-wrap: wrap; }
.line-card .head .pills { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex: 1; }
.line-card .head .del { font-size: 12px; color: var(--muted); white-space: nowrap; }
.line-card .head b { font-size: 13px; }
.line-card .fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 14px; }
.line-card .fields .wide { grid-column: span 2; }
.line-card .field { margin: 0; }
.line-card input:not([type=checkbox]), .line-card select { width: 100%; }

/* ---------- charts ---------- */
.chart { width: 100%; overflow: visible; }
.chart svg { width: 100%; height: auto; display: block; font: 11px system-ui, sans-serif; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart text { fill: var(--muted); }
.chart .s1 { fill: var(--chart-1); }
.chart .s2 { fill: var(--chart-2); }
.chart .s3 { fill: var(--chart-3); }
.chart .lbl { fill: var(--ink-2); font-size: 11px; }
.chart rect:hover { opacity: .8; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin: 4px 0 8px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend i.s1 { background: var(--chart-1); }
.legend i.s2 { background: var(--chart-2); }
.legend i.s3 { background: var(--chart-3); }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; box-shadow: 0 6px 24px rgba(0,0,0,.25); z-index: 60; font-weight: 500; max-width: 90vw; }
.toast[hidden] { display: none; }

/* ---------- phone ---------- */
@media (max-width: 640px) {
  .wrap { padding: 0 14px; }
  main.wrap { padding-top: 16px; }
  h1 { font-size: 21px; }
  .brand span:not(.mark) { display: none; }
  header.top .wrap { gap: 10px; }
  .grid2 { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 10px 12px; }
  .tile .v { font-size: 19px; }
  .hero { font-size: 30px; }
  .panel { padding: 14px; }
  .steps { grid-template-columns: 1fr 1fr; }
  .hide-phone { display: none !important; }
  .ros .row { grid-template-columns: 38px 1fr; }
  .ros .val { grid-column: 2; justify-self: end; }
  table.data th, table.data td { padding: 7px 8px; }
  .line-card .fields .wide { grid-column: auto; }
  .page-head .actions .btn { padding: 6px 10px; font-size: 13px; }
}
@media print {
  header.top, .actions, form.quick, .btn, .copy, .tabs, footer.foot { display: none !important; }
  .panel, .table-wrap { box-shadow: none; }
}

/* ---------- receipt suggestions ---------- */
.sugg-grid { display: grid; gap: 14px; }
.sugg { display: grid; grid-template-columns: 180px 1fr; gap: 16px; }
.sugg-photo img { width: 180px; max-height: 260px; object-fit: cover; object-position: top; border-radius: 8px; border: 1px solid var(--line); }
.sugg-read { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.sugg-match { margin: 8px 0; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.sugg-fields { display: grid; grid-template-columns: 2fr 2fr 90px 90px; gap: 6px; margin: 6px 0; }
.sugg-actions { display: flex; gap: 8px; margin-top: 8px; }
@media (max-width: 640px) { .sugg { grid-template-columns: 1fr; } .sugg-fields { grid-template-columns: 1fr 1fr; } .sugg-photo img { width: 100%; max-height: 220px; } }
.sugg-fields.split { grid-template-columns: 2fr 2fr 90px 90px auto; align-items: center; }
.sugg { scroll-margin-top: 72px; }
.sugg:target { outline: 2px solid var(--accent); outline-offset: 2px; }
tr[id]:target td { background: var(--accent-soft) !important; box-shadow: inset 3px 0 0 var(--accent); }
tr[id] { scroll-margin-top: 110px; }
.sugg-existing { margin: 6px 0 4px; }
.print-only { display: none; }
@media print { .print-only { display: block; } a { color: inherit; text-decoration: none; } .page-head .actions { display: none; } }

/* Viewer accounts: every form that would change something loses its buttons and its inputs (the server refuses the POST anyway). */
body.readonly form[method="post"]:not(.allow) button,
body.readonly form[method="post"]:not(.allow) input[type="submit"] { display: none !important; }
body.readonly form[method="post"]:not(.allow) input:not([type="hidden"]),
body.readonly form[method="post"]:not(.allow) select,
body.readonly form[method="post"]:not(.allow) textarea { pointer-events: none; opacity: .7; }

/* Green action button: the "Send receipt" shortcut, distinct from the yellow return button beside it. */
.btn.good { background: #4fd18f; border-color: #4fd18f; color: #1a1f2b; font-weight: 600; white-space: nowrap; }
.btn.good:hover { background: #3fc27f; color: #1a1f2b; }
