/* Site + invoice view. Tokens first; dark mode swaps tokens only. Print shows the invoice alone. */
:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #eef2ef;
  --text: #17201d;
  --muted: #5b6863;
  --line: #dde3df;
  --brand: #0f5c4d;
  --brand-ink: #ffffff;
  --brand-soft: #e1efea;
  --accent: #f2b33d;
  --warn-bg: #fff4dc;
  --warn-line: #f0c46a;
  --warn-ink: #6b4a00;
  --info-bg: #eef2f6;
  --info-ink: #3d4a57;
  --bad-bg: #fde8e6;
  --bad-ink: #8a1f14;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 6px 24px rgb(0 0 0 / .06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1412;
    --surface: #161d1a;
    --surface-2: #1d2622;
    --text: #e6ece9;
    --muted: #9aa8a2;
    --line: #2a3530;
    --brand: #4fb89f;
    --brand-ink: #06231c;
    --brand-soft: #173029;
    --warn-bg: #2e2510;
    --warn-line: #6b5420;
    --warn-ink: #f3d48f;
    --info-bg: #1b232b;
    --info-ink: #b8c6d4;
    --bad-bg: #351a17;
    --bad-ink: #f4b1a8;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); }
a { color: var(--brand); }
code { font-family: var(--mono); font-size: .92em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; }
main { max-width: 1040px; margin: 0 auto; padding: 0 16px 48px; }

/* Header / footer */
.site-head { max-width: 1040px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none; }
.site-head nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.site-head nav a { color: var(--muted); text-decoration: none; font-size: .95rem; white-space: nowrap; }
.brand span { white-space: nowrap; }
.site-head nav a:hover { color: var(--text); }
.site-head .nav-cta { color: var(--brand); font-weight: 600; }
.site-foot { border-top: 1px solid var(--line); margin-top: 48px; padding: 28px 16px; color: var(--muted); font-size: .92rem; }
.foot-cols { max-width: 1040px; margin: 0 auto; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
.foot-cols a { display: block; color: var(--muted); text-decoration: none; padding: 2px 0; }
.foot-cols a:hover { color: var(--text); }
.foot-cols p { margin: 6px 0 0; }
.fine { font-size: .85rem; color: var(--muted); }
.site-foot .fine { max-width: 1040px; margin: 20px auto 0; }

/* Hero, features, prose, band */
.hero { text-align: center; padding: 32px 0 20px; }
.hero h1 { font-size: clamp(1.7rem, 4.5vw, 2.6rem); margin: 0 0 12px; }
.lead { font-size: 1.12rem; color: var(--muted); max-width: 680px; margin: 0 auto; }
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 40px 0; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.feature h3 { margin: 0 0 6px; font-size: 1.02rem; }
.feature p { margin: 0; color: var(--muted); font-size: .95rem; }
.prose { max-width: 720px; margin: 40px auto; }
.prose h2 { margin-top: 32px; font-size: 1.35rem; }
.prose.center { text-align: center; padding: 60px 0; }
.band { background: var(--brand-soft); border-radius: var(--radius); margin: 48px 0 0; }
.band-inner { max-width: 640px; margin: 0 auto; padding: 32px 20px; text-align: center; }
.band h2 { margin-top: 0; }
.waitlist { display: flex; gap: 8px; max-width: 460px; margin: 18px auto 8px; }
.waitlist input { flex: 1; min-width: 0; }

/* Controls */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:focus-visible, .drop:focus-visible, .link:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }
input[type=email] { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; }

/* Drop zone */
.drop { background: var(--surface); border: 2px dashed var(--line); border-radius: 20px; padding: 36px 20px; text-align: center; transition: border-color .15s, background .15s; box-shadow: var(--shadow); }
.drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop-icon { width: 48px; height: 48px; fill: none; stroke: var(--brand); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.drop-title { font-size: 1.3rem; font-weight: 700; margin: 8px 0 4px; }
.drop-sub { color: var(--muted); margin: 0 0 14px; }
.drop-samples { margin: 16px 0 0; color: var(--muted); font-size: .95rem; }
.drop-privacy { margin: 10px 0 0; color: var(--muted); font-size: .88rem; display: inline-flex; align-items: center; gap: 6px; }
.drop-privacy svg { width: 16px; height: 16px; fill: none; stroke: var(--brand); stroke-width: 2; }
.viewer.has-result .drop { display: none; }
.status { margin: 16px 0; padding: 14px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.status.error { background: var(--bad-bg); border-color: transparent; color: var(--bad-ink); }
.status.error strong { display: block; margin-bottom: 4px; }
.status .actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Toolbar above the invoice */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; align-items: center; }
.toolbar .spacer { flex: 1; }
.toolbar .file-name { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }

/* Invoice */
.inv { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.inv-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.inv-title { margin: 0; font-size: 1.6rem; }
.inv-number { color: var(--muted); margin: 2px 0 8px; overflow-wrap: anywhere; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: .78rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.badge.info { background: var(--brand-soft); color: var(--brand); }
.badge.warn { background: var(--warn-bg); color: var(--warn-ink); }
.due { text-align: right; background: var(--brand-soft); border-radius: 12px; padding: 12px 16px; min-width: 210px; }
.due-label { font-size: .85rem; color: var(--muted); }
.due-amount { font-size: 1.75rem; font-weight: 750; color: var(--text); font-variant-numeric: tabular-nums; }
.due-date { font-size: .9rem; color: var(--muted); }
.findings { margin: 20px 0 0; padding: 12px 16px; border-radius: 12px; background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-ink); }
.findings.only-info { background: var(--info-bg); border-color: transparent; color: var(--info-ink); }
.findings h3 { margin: 0 0 6px; font-size: .95rem; }
.findings ul { margin: 0; padding-left: 20px; }
.findings.ok { background: var(--brand-soft); border-color: transparent; color: var(--brand); font-weight: 600; }
.inv h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 28px 0 10px; }
.parties { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 24px; }
.party { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.party h2 { margin: 0 0 6px; }
.party-name { font-weight: 700; overflow-wrap: anywhere; }
.party address { font-style: normal; color: var(--text); margin: 2px 0 8px; }
dl.rows { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: .93rem; }
dl.rows dt { color: var(--muted); }
dl.rows dd { margin: 0; overflow-wrap: anywhere; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 20px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: .8rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 8px 8px; border-bottom: 1px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.num { text-align: right; white-space: nowrap; }
.lines .pos { color: var(--muted); width: 3em; }
.lines .item-name { font-weight: 600; }
.lines .details { color: var(--muted); font-size: .88rem; margin-top: 2px; }
.lines tr.sub td.item { padding-left: calc(8px + var(--depth, 0) * 18px); }
.sums { display: grid; grid-template-columns: 1fr minmax(260px, 380px); gap: 24px; align-items: start; }
.sums > * { min-width: 0; }
.totals td { border: 0; padding: 4px 8px; }
.totals tr.strong td { font-weight: 750; font-size: 1.1rem; border-top: 2px solid var(--text); padding-top: 8px; }
.vat td { font-size: .93rem; }
.pay { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.pay dl { flex: 1; min-width: 240px; }
.qr { text-align: center; }
.qr svg { width: 148px; height: 148px; background: #fff; padding: 6px; border-radius: 8px; }
.qr p { margin: 4px auto 0; max-width: 160px; font-size: .8rem; color: var(--muted); }
.notes p { white-space: pre-wrap; margin: 0 0 8px; }
.attachments { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.attachments li { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.attachments .meta { color: var(--muted); font-size: .88rem; }
details.more { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 12px; }
details.more summary { cursor: pointer; color: var(--muted); font-weight: 600; }
pre.xml { max-height: 420px; overflow: auto; background: var(--surface-2); padding: 12px; border-radius: 10px; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Phones */
@media (max-width: 760px) {
  .features { grid-template-columns: 1fr 1fr; }
  .foot-cols { grid-template-columns: 1fr; }
  .inv { padding: 18px 14px; border-radius: 0; margin: 0 -16px; border-left: 0; border-right: 0; }
  .due { text-align: left; width: 100%; }
  .sums { grid-template-columns: 1fr; }
  table.vat th { white-space: normal; hyphens: auto; letter-spacing: 0; font-size: .7rem; }
  .waitlist { flex-direction: column; }
  .site-head nav a:not(.nav-cta) { display: none; }
  table.lines thead { display: none; }
  table.lines tr { display: grid; grid-template-columns: 1fr auto; padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.lines td { border: 0; padding: 2px 4px; }
  table.lines td.pos { display: none; }
  table.lines td.item { grid-column: 1 / -1; }
  table.lines td.qty, table.lines td.price { text-align: left; color: var(--muted); font-size: .9rem; }
  table.lines td.vatc { display: none; }
  table.lines td.net { grid-column: 2; grid-row: 2 / span 2; align-self: center; font-weight: 600; }
}
@media (max-width: 420px) { .features { grid-template-columns: 1fr; } }

/* Print: the invoice only, black on white */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #f3f3f3; --text: #000; --muted: #555; --line: #ccc; --brand: #000; --brand-soft: #f3f3f3; }
  body { font-size: 11pt; }
  .no-print, .toolbar, details.more, .attachments button { display: none !important; }
  main { padding: 0; max-width: none; }
  .inv { border: 0; box-shadow: none; padding: 0; margin: 0; }
  .findings { break-inside: avoid; }
  tr, .party, .pay { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
