/*
 * A calm, modern tool. System fonts (no web fonts: nothing is fetched from
 * anywhere), one trustworthy blue, soft neutral surfaces, generous spacing.
 * Every colour is a token, redefined for dark mode.
 */

:root {
  color-scheme: light dark;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --panel: #f0f3f9;
  --fg: #0e1726;
  --muted: #586379;
  --line: #e1e6ef;
  --line-strong: #cbd3e1;
  --accent: #2456d8;
  --accent-strong: #1a42b0;
  --accent-soft: #e9efff;
  --on-accent: #ffffff;
  --ok: #11774a;
  --ok-soft: #e6f5ed;
  --no: #b2421c;
  --no-soft: #fcefe8;
  --focus: #2456d8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgb(14 23 38 / 0.06);
  --shadow: 0 1px 2px rgb(14 23 38 / 0.05), 0 8px 24px -12px rgb(14 23 38 / 0.18);
  --shadow-lg: 0 2px 4px rgb(14 23 38 / 0.04), 0 24px 48px -24px rgb(36 86 216 / 0.35);
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', 'Noto Sans', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f1c;
    --surface: #111829;
    --panel: #172036;
    --fg: #e8edf7;
    --muted: #9ba6bd;
    --line: #232d45;
    --line-strong: #33405e;
    --accent: #7ea3ff;
    --accent-strong: #a8c0ff;
    --accent-soft: #18234a;
    --on-accent: #0a0f1c;
    --ok: #5bd49b;
    --ok-soft: #10291f;
    --no: #ff9d76;
    --no-soft: #2e1812;
    --focus: #7ea3ff;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px -12px rgb(0 0 0 / 0.6);
    --shadow-lg: 0 2px 4px rgb(0 0 0 / 0.3), 0 24px 48px -24px rgb(0 0 0 / 0.7);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-strong);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

h1,
h2,
h3,
h4 {
  letter-spacing: -0.01em;
  line-height: 1.25;
}

/* ---------- header ---------- */

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.top__name {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-right: auto;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.top__name:hover {
  color: var(--fg);
}

.top__mark {
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: var(--on-accent);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
}

.top__mark svg {
  width: 1.15rem;
  height: 1.15rem;
}

.sitenav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sitenav a {
  display: block;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
}

.sitenav a:hover {
  color: var(--fg);
  background: var(--panel);
}

.sitenav [aria-current] {
  color: var(--fg);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* Languages: a menu that works without script (<details>). */
.lang-menu {
  position: relative;
}

.lang-menu summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  font-size: 0.9rem;
  font-weight: 500;
}

.lang-menu summary::-webkit-details-marker {
  display: none;
}

.lang-menu summary::after {
  content: '';
  width: 0.4rem;
  height: 0.4rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  opacity: 0.6;
}

.lang-menu[open] summary {
  border-color: var(--line-strong);
}

.langs {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  z-index: 20;
  min-width: 11rem;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  /* 25 languages: the list scrolls rather than running off a short screen. */
  max-height: min(70vh, 32rem);
  overflow-y: auto;
}

.langs a {
  display: block;
  padding: 0.4rem 0.65rem;
  border-radius: 7px;
  color: var(--fg);
  text-decoration: none;
  font-size: 0.95rem;
}

.langs a:hover {
  background: var(--panel);
}

.langs [aria-current] {
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- hero ---------- */

.hero {
  padding: 3rem 0 1rem;
  text-align: center;
}

.hero__eyebrow {
  display: inline-block;
  margin: 0 0 1rem;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

h1 {
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 1.75rem 0 0.5rem;
}

.hero h1 {
  max-width: 40rem;
  margin: 0 auto 0.75rem;
}

.privacy {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 1.1rem;
}

.trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.25rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
  color: var(--fg);
  font-size: 0.92rem;
  font-weight: 500;
}

.trust li {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.trust svg {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--ok);
  flex: none;
}

/* The drop zone is a label for the hidden-in-plain-sight file input, so a
   click or Enter anywhere on it opens the picker. */
.drop {
  display: block;
  max-width: 44rem;
  margin: 0 auto;
  border: 2px dashed var(--line-strong);
  border-radius: calc(var(--radius) + 4px);
  padding: 2.5rem 1.25rem;
  text-align: center;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.drop:hover {
  border-color: var(--accent);
}

.drop--over {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-soft);
  transform: scale(1.01);
}

.drop__icon {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.drop__icon svg {
  width: 1.6rem;
  height: 1.6rem;
}

.drop__prompt {
  display: block;
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.drop__hint {
  display: block;
  color: var(--muted);
  margin-top: 0.35rem;
}

.drop__button {
  display: inline-block;
  margin-top: 1.25rem;
  padding: 0.65rem 1.4rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  box-shadow: 0 6px 16px -8px var(--accent);
}

.drop:hover .drop__button {
  background: var(--accent-strong);
}

.drop input[type='file'] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.drop:focus-within {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.paste {
  max-width: 44rem;
  margin: 1rem auto;
  text-align: left;
}

.paste summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.95rem;
  text-align: center;
}

.paste textarea {
  display: block;
  width: 100%;
  min-height: 10rem;
  margin: 0.5rem 0;
  font: 0.85rem/1.45 var(--mono);
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}

/* ---------- buttons ---------- */

button {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

button:hover {
  background: var(--panel);
  border-color: var(--accent);
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ---------- results ---------- */

.results {
  margin-top: 2.5rem;
}

.results__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.results__bar h2 {
  margin: 0;
  font-size: 1.35rem;
}

.results__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.results__item {
  margin: 0 0 1.25rem;
}

.result {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem 1rem 1.5rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* A coloured edge says "readable" or "not readable" at a glance. */
.result::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--line-strong);
}

.result--ok::before {
  background: var(--ok);
}

.result--no::before {
  background: var(--no);
}

.result h3,
.result h4 {
  margin: 0;
}

.result h4 {
  font-size: 0.95rem;
  margin-top: 0.85rem;
}

.result__file {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.result__verdict {
  display: inline-block;
  font-weight: 600;
  font-size: 0.92rem;
  margin: 0.6rem 0 0.4rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
}

.result--ok .result__verdict {
  color: var(--ok);
  background: var(--ok-soft);
}

.result--no .result__verdict {
  color: var(--no);
  background: var(--no-soft);
}

.result__facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1rem;
  margin: 0.5rem 0;
  font-size: 0.95rem;
}

.result__facts dt {
  color: var(--muted);
}

.result__facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.result__notes ul {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}

.result__pending {
  color: var(--muted);
}

/* ---------- footer ---------- */

.boundary {
  margin-top: 4rem;
  padding: 1.75rem 0 2.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

.boundary p {
  margin: 0 0 0.4rem;
  max-width: 48rem;
}

.boundary__operator {
  color: var(--fg);
}

.boundary p:nth-child(2) {
  color: var(--fg);
  font-weight: 600;
}

.noscript {
  padding: 1rem;
  border: 1px solid var(--no);
  background: var(--no-soft);
  border-radius: var(--radius-sm);
}

@media (max-width: 40rem) {
  .top {
    gap: 0.6rem 0.75rem;
  }
  .top__langs {
    order: 2;
  }
  .sitenav {
    order: 3;
    width: 100%;
  }
  .hero__eyebrow {
    font-size: 0.72rem;
  }
}

@media (max-width: 30rem) {
  .result__facts {
    grid-template-columns: 1fr;
  }
  .result__facts dd {
    margin-bottom: 0.5rem;
  }
  .hero {
    padding-top: 2rem;
  }
  .drop {
    padding: 2rem 1rem;
  }
}

/* ---------- invoice view (F1) ---------- */

.results__invoice {
  margin-top: 0.75rem;
}

.inv {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: relative;
  box-shadow: var(--shadow);
}

.inv h2 {
  font-size: 1.55rem;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
}

.inv h3 {
  font-size: 0.8rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.inv h4 {
  font-size: 0.95rem;
  margin: 0 0 0.35rem;
}

.inv__tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.inv__tools p {
  margin: 0;
}

.inv__notice {
  background: var(--panel);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.inv__section {
  margin-top: 2rem;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  /* URLs, identifiers and paths have no spaces; let them break on a phone. */
  overflow-wrap: anywhere;
}

.pre {
  white-space: pre-wrap;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* A value with provenance: discoverable but quiet. */
.v {
  cursor: help;
  border-radius: 2px;
}

.v:hover {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.v--active {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.bt {
  display: none;
  margin-left: 0.35em;
  font: 600 0.7rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: 3px;
  padding: 1px 3px;
  vertical-align: 1px;
  white-space: nowrap;
}

.inv--codes .bt {
  display: inline-block;
}

.facts {
  display: grid;
  grid-template-columns: minmax(10rem, max-content) 1fr;
  gap: 0.2rem 1rem;
  margin: 0.25rem 0 0.75rem;
}

.facts > div {
  display: contents;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.facts--compact {
  /* Party cards are narrow: label above value, never a squeezed second column. */
  grid-template-columns: 1fr;
  gap: 0;
  font-size: 0.9rem;
}

.facts--inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 1rem;
  font-size: 0.85rem;
  margin: 0.35rem 0 0;
}

.facts--inline > div {
  display: block;
  min-width: 0;
}

.facts--inline dt,
.facts--inline dd {
  display: inline;
}

.facts--inline dd {
  margin-left: 0.3rem;
}

.facts--inline dt::after {
  content: ':';
}

.small {
  font-size: 0.82rem;
}

.facts--compact dt {
  font-size: 0.82rem;
  margin-top: 0.35rem;
}

.facts--totals {
  max-width: 34rem;
  margin-left: auto;
}

.facts--totals dd {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.facts--due {
  margin-top: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: 1.2rem;
  font-weight: 700;
}

.facts--due dt {
  color: var(--fg);
}

.parties {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
}

.party {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 1rem;
  min-width: 0;
}

.party__name {
  font-weight: 700;
  margin: 0 0 0.25rem;
}

.party p {
  margin: 0 0 0.25rem;
}

.party address {
  font-style: normal;
  margin-bottom: 0.5rem;
}

.table-wrap {
  overflow-x: auto;
}

.inv table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.inv th,
.inv td {
  padding: 0.6rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

.inv th {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
  border-bottom-color: var(--line-strong);
}

.inv tbody tr:hover td {
  background: var(--panel);
}

.inv td.num,
.inv th:nth-child(3),
.inv th:nth-child(4),
.inv th:last-child {
  text-align: right;
}

.inv table.vat th:nth-child(2) {
  text-align: right;
}

.line__name {
  font-weight: 600;
}

.line__desc,
.line__note {
  color: var(--muted);
}

.line__ac {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.88rem;
}

.account {
  margin-top: 0.5rem;
}

.note p {
  margin: 0 0 0.5rem;
}

.docs {
  list-style: none;
  padding: 0;
  margin: 0;
}

.docs li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--line);
}

.download {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.download:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.more {
  margin-top: 0.75rem;
}

.unmapped {
  margin-top: 1.5rem;
}

.unmapped summary {
  cursor: pointer;
  font-weight: 600;
}

.path {
  font-size: 0.8rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* Provenance panel: a fixed sheet, so it works the same with a mouse and a thumb. */
.prov {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: min(30rem, calc(100vw - 2rem));
  max-height: 60vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-lg), var(--shadow);
  z-index: 10;
}

.prov dl {
  margin: 0.25rem 0 0.75rem;
}

.prov dt {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.4rem;
}

.prov dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Lines and VAT tables stack on narrow screens: each cell labels itself. */
@media (max-width: 40rem) {
  .inv {
    padding: 0.75rem;
  }
  .inv table.lines thead,
  .inv table.vat thead {
    display: none;
  }
  .inv table.lines tr,
  .inv table.vat tr {
    display: block;
    border-bottom: 1px solid var(--line);
    padding: 0.5rem 0;
  }
  .inv table.lines td,
  .inv table.vat td {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 0.5rem;
    border: 0;
    padding: 0.15rem 0;
    text-align: left;
  }
  .inv table.lines td::before,
  .inv table.vat td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.85rem;
  }
  .inv table.lines td.line__item {
    grid-template-columns: 1fr;
  }
  .inv table.lines td.line__item::before {
    display: none;
  }
  .cell {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .inv td.num {
    text-align: left;
  }
  .facts,
  .facts--compact {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .facts dd {
    margin-bottom: 0.4rem;
  }
}

/* ---------- hybrid PDF (F2) ---------- */

.hybrid {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.hybrid h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.hybrid__notes {
  margin: 0.25rem 0 0.5rem;
  padding-left: 1.25rem;
}

/* ---------- page vs data (F2 discrepancy check) ---------- */

.compare {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.compare--ok {
  border-color: color-mix(in srgb, var(--ok) 45%, var(--line));
}

.compare--warn {
  border-color: color-mix(in srgb, var(--no) 45%, var(--line));
}

.compare h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.compare__headline {
  font-weight: 650;
  margin: 0.75rem 0;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--panel);
}

.compare--ok .compare__headline {
  background: var(--ok-soft);
}

.compare--warn .compare__headline {
  background: var(--no-soft);
}

.compare--ok .compare__headline {
  color: var(--ok);
}

.compare--warn .compare__headline {
  color: var(--no);
}

.compare__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.compare__table th,
.compare__table td {
  text-align: left;
  padding: 0.3rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.compare__table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.compare__table .is-found td:last-child {
  color: var(--ok);
}

.compare__table .is-missing td {
  color: var(--no);
  font-weight: 600;
}

.compare__table .is-info td:last-child {
  color: var(--muted);
}

/* ---------- content pages ---------- */

.page {
  max-width: 44rem;
  margin: 0 auto;
  font-size: 1.05rem;
}

.page h1 {
  margin-top: 2.5rem;
}

.page h2 {
  font-size: 1.35rem;
  margin: 2.25rem 0 0.6rem;
}

.page li {
  margin-bottom: 0.35rem;
}

.page h3 {
  font-size: 1.05rem;
  margin: 1.25rem 0 0.4rem;
}

.lede {
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--muted);
}

.note-box {
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  background: var(--accent-soft);
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-sm);
}

.sources {
  margin-top: 2.5rem;
  padding: 0.25rem 1.25rem 0.75rem;
  font-size: 0.9rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.sources h2 {
  font-size: 1rem;
}

/* End of a guide: back to the reader, then the other guides. */
aside.more {
  max-width: 44rem;
  margin: 2.5rem auto 0;
}

.more__tool a {
  display: block;
  padding: 1.1rem 1.4rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-lg);
}

.more__tool a:hover {
  color: var(--on-accent);
  filter: brightness(1.05);
}

.more h2 {
  font-size: 1rem;
}

.draft-banner {
  background: var(--no);
  color: var(--bg);
  font-weight: 700;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-top: 1rem;
}

.explain {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin-top: 3rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.explain p {
  margin: 0;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* Guides on the home page: a grid of cards, the whole card is the link. */
.guides {
  margin-top: 3rem;
}

.guides h2 {
  font-size: 1.35rem;
  margin: 0 0 1rem;
}

.guides ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guides li {
  display: flex;
}

.guide-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: var(--fg);
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.guide-card:hover {
  color: var(--fg);
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.guide-card strong {
  font-size: 1rem;
  line-height: 1.35;
  color: var(--accent);
}

.guide-card span {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- export and print (F4) ---------- */

.inv__export {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.inv__export .download {
  margin-top: 0;
}

@media print {
  :root {
    color-scheme: light;
    --fg: #000;
    --muted: #444;
    --bg: #fff;
    --panel: #fff;
    --line: #999;
  }
  body * {
    visibility: hidden;
  }
  .print-target,
  .print-target * {
    visibility: visible;
  }
  .print-target {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    border: 0;
    padding: 0;
  }
  .print-target .inv__tools,
  .print-target .inv__export,
  .print-target .prov,
  .print-target .unmapped,
  .print-target .more,
  .print-target .download,
  .print-target .summary__actions {
    display: none !important;
  }
  .print-target .linklike {
    text-decoration: none;
  }
  .print-target .unmapped[open] {
    display: block !important;
  }
  .inv table {
    font-size: 9pt;
  }
  .inv tr {
    break-inside: avoid;
  }
}

/* ---------- validation report (F3) ---------- */

.validate {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1rem 0;
}

.vlayer {
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.vlayer {
  margin-top: 0.75rem;
}

.validate__run {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.validate__run:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.vlayer h4 {
  margin: 0 0 0.35rem;
}

.vlayer h5 {
  margin: 0.5rem 0 0.25rem;
  font-size: 0.9rem;
}

.findings {
  margin: 0;
  padding-left: 1.1rem;
}

.finding {
  margin-bottom: 0.5rem;
}

.finding--error strong {
  color: var(--no);
}

.infile summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.9rem;
}

.xml-excerpt {
  margin: 0.25rem 0 0;
  padding: 0.5rem 0;
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre;
}

.xml-excerpt__line {
  display: block;
  padding-right: 0.5rem;
}

.xml-excerpt__line--hit {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

.xml-excerpt__n {
  display: inline-block;
  min-width: 3.5em;
  padding-right: 0.75em;
  color: var(--muted);
  text-align: right;
  user-select: none;
}

.xml-excerpt mark {
  /* System colours: readable in light and dark without our own tokens. */
  background: Mark;
  color: MarkText;
}

.results__item--nested {
  margin-left: 1.25rem;
}

.result__archive ul {
  margin: 0.25rem 0;
  padding-left: 1.1rem;
}

.inv--codes .v[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.sample {
  margin: 1.25rem 0 0;
  text-align: center;
}

.sample button {
  background: transparent;
  box-shadow: none;
  border-color: var(--line-strong);
  color: var(--muted);
}

.sample button:hover {
  color: var(--fg);
}

/* Overview of several invoices (summary-view.mjs). */
.summary {
  margin: 0 0 1.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.summary h3 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
}

.summary__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.summary__table th,
.summary__table td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.summary__table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom-color: var(--line-strong);
}

.summary__table .num {
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 40rem) {
  .summary__table thead {
    display: none;
  }
  .summary__table tr {
    display: block;
    border-bottom: 1px solid var(--line);
    padding: 0.5rem 0;
  }
  .summary__table td,
  .summary__table .num {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 0.5rem;
    border: 0;
    padding: 0.15rem 0;
    text-align: left;
    white-space: normal;
  }
  .summary__table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.85rem;
  }
}

.check--ok {
  color: var(--ok);
}

.check--warn {
  color: var(--no);
}

.summary__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.linklike {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  text-align: left;
  overflow-wrap: anywhere;
}
