:root {
  --bg: #f3f6fa;
  --card: #ffffff;
  --ink: #0f1b2d;
  --muted: #56637a;
  --line: #dde3ec;
  --brand: #1e3a5f;
  --brand-ink: #ffffff;
  --brand-soft: #e6edf6;
  --navy: #0b1730;
  --up: #b4331f;
  --up-soft: #fbe9e5;
  --warn-soft: #fff5d9;
  --warn-line: #e7c766;
  --field-bg: #ffffff;
  --field-line: #8592a6;
  --suggest: #8a6500;
  --down: #1d6b3f;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1730;
    --card: #12213d;
    --ink: #e6edf7;
    --muted: #9fb0c8;
    --line: #23345a;
    --brand: #8fb3e0;
    --brand-ink: #0b1730;
    --brand-soft: #1a2c4a;
    --up: #ff8a73;
    --up-soft: #3a1f1a;
    --warn-soft: #352c12;
    --warn-line: #7d6a2a;
    --field-bg: #18294a;
    --field-line: #4b5f85;
    --suggest: #e0b94a;
    --down: #6fd39a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); }
h1 { font-size: 1.6rem; margin: 0 0 0.25rem; line-height: 1.2; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.down { color: var(--down); font-weight: 600; }
.small { font-size: 0.85rem; }

/* The header is the logo's navy in both themes so it runs on from the iPhone app's navy status bar. */
header.top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem;
  padding: 0.75rem 16px; padding-top: max(0.75rem, env(safe-area-inset-top)); background: var(--navy, #0b1730); color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; color: #fff; text-decoration: none; font-size: 1.1rem; letter-spacing: -0.01em; }
.brand img { width: 30px; height: 30px; display: block; }
.brand-accent { color: #22d3ee; }
.brand-hero { display: block; width: 96px; height: 96px; margin: 0 auto 0.75rem; border-radius: 22px; }
header.top .who { color: #b8c7de; }
header.top button.link { color: #fff; }
header nav a { color: #b8c7de !important; }
header nav a.on { background: rgba(255, 255, 255, 0.16) !important; color: #fff !important; }
header nav { display: flex; gap: 0.25rem; overflow-x: auto; flex: 1 1 auto; }
header nav a { padding: 0.35rem 0.6rem; border-radius: 6px; text-decoration: none; color: var(--muted); white-space: nowrap; }
header nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.logout { display: flex; gap: 0.5rem; align-items: center; margin: 0; }
.who { color: var(--muted); font-size: 0.85rem; }
@media (max-width: 720px) {
  /* On phones the bottom tab bar replaces the top menu; log out lives under More > Account. */
  .signed-in header nav, .signed-in header .logout { display: none; }
  .signed-in footer { display: none; }
  .signed-in main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  /* Moving to the next field (the keyboard's arrows) scrolls it clear of the tab bar and the sticky Save bar. */
  html:has(.signed-in) { scroll-padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
}

.tabbar { display: none; }
@media (max-width: 720px) {
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--card); border-top: 1px solid var(--line);
    padding: 4px 4px env(safe-area-inset-bottom);
  }
  .tabbar a {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; padding-top: 6px;
    color: var(--muted); text-decoration: none; font-size: 0.7rem; font-weight: 600; -webkit-tap-highlight-color: transparent;
  }
  .tabbar a.on { color: var(--brand); }
  .tab-icon { position: relative; display: block; width: 26px; height: 26px; }
  .tab-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .tabbar a[href="/more"] svg { stroke-width: 3.2; }
  .tabbar a.snap .tab-icon {
    width: 50px; height: 50px; margin-top: -18px; border-radius: 50%; background: var(--brand); color: var(--brand-ink);
    display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  }
  .tabbar a.snap { color: var(--ink); }
  .tab-badge {
    position: absolute; top: -4px; inset-inline-end: -10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: #d93a22; color: #fff; font-size: 0.7rem; line-height: 18px; text-align: center;
  }
  .snap-button { display: none !important; }
}

.menu { list-style: none; padding: 0; }
.menu li + li { border-top: 1px solid var(--line); }
.menu a { display: flex; flex-direction: column; padding: 0.8rem 0.25rem; min-height: 52px; justify-content: center; color: var(--ink); text-decoration: none; font-weight: 600; }
.menu a .muted { font-weight: 400; }
.menu-group h2 { margin: 1.25rem 0 0.4rem; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.menu-group .menu { margin: 0; }
.menu-legal { text-align: center; margin: 1.5rem 0 0; }
.menu-legal a { color: var(--muted); display: inline-block; padding: 0.6rem 0.25rem; }
.steps { margin: 0; padding-inline-start: 1.3rem; display: flex; flex-direction: column; gap: 0.6rem; }
.tile.todo { border-color: var(--warn-line); background: var(--warn-soft); }

main { max-width: 1200px; margin: 0 auto; padding: 1.25rem 16px 3rem; }
footer { text-align: center; padding: 1.5rem 16px; font-size: 0.85rem; }
footer a { color: var(--muted); display: inline-block; padding: 0.5rem 0.25rem; }
footer .legal { display: block; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 1rem 0; }
.card.narrow { max-width: 460px; margin: 1.5rem auto; }
.prose { max-width: 720px; }
.empty { color: var(--muted); padding: 1.25rem; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--card); }

.flash { background: var(--brand-soft); color: var(--brand); padding: 0.6rem 0.9rem; border-radius: 8px; font-weight: 500; }
.error { background: var(--up-soft); color: var(--up); padding: 0.6rem 0.9rem; border-radius: 8px; }
.warn { background: var(--warn-soft); border: 1px solid var(--warn-line); padding: 0.6rem 0.9rem; border-radius: 8px; }
.note { color: var(--muted); font-style: italic; }
.error ul, .warn ul { margin: 0.3rem 0 0; padding-inline-start: 1.2rem; }

label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 0.6rem; font-weight: 400; font-size: 1rem; }
input, select, button, .button { font: inherit; }
/* 16px or more, or iPhone zooms the page in when a field is tapped. */
input, select, textarea { font-size: 16px; }
input, select {
  border: 1px solid var(--field-line); border-radius: 8px; padding: 0.55rem 0.7rem; background: var(--field-bg); color: var(--ink);
  min-width: 0; width: 100%; min-height: 44px;
}
input[type="checkbox"] { width: 24px; height: 24px; min-height: 0; flex: none; accent-color: var(--brand); }
input[type="file"] { border: none; background: none; padding: 0; min-height: 0; }
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.stack { display: flex; flex-direction: column; gap: 0.9rem; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.75rem; align-items: end; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem; min-height: 44px;
  padding: 0.5rem 1rem; border-radius: 10px; border: 1px solid var(--field-line); background: var(--card); color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap; -webkit-tap-highlight-color: transparent;
}
/* On a phone a long label (French, Tagalog, Urdu...) wraps onto two lines rather than running off the screen. */
@media (max-width: 720px) { button, .button { white-space: normal; text-align: center; } }
button:active, .button:active { opacity: 0.7; }
button[disabled] { opacity: 0.6; }
button.primary, .button.primary { background: var(--brand); color: var(--brand-ink); border-color: transparent; font-weight: 600; }
.button.big { padding: 0.8rem 1.3rem; font-size: 1.05rem; }
.button.small, button.small { padding: 0.3rem 0.8rem; font-size: 0.9rem; min-height: 38px; }
button.link { background: none; border: none; padding: 0 0.25rem; min-height: 44px; color: var(--brand); text-decoration: underline; }
.danger-button { background: var(--up); border-color: var(--up); color: #fff; font-weight: 600; }
.danger-card { border-color: var(--up); }
.narrow-form { max-width: 420px; }
button.link.danger, .danger { color: var(--up); }

.hero { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; }
.row-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem; margin: 1.25rem 0; }
.tile {
  display: flex; flex-direction: column; gap: 0.15rem; padding: 1rem; border-radius: var(--radius);
  background: var(--card); border: 1px solid var(--line); text-decoration: none; color: var(--ink);
}
.tile .label { color: var(--muted); font-size: 0.85rem; }
.tile .value { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .hint { color: var(--muted); font-size: 0.8rem; }
.tile.money { background: var(--brand); border-color: transparent; color: var(--brand-ink); }
.tile.money .label, .tile.money .hint { color: inherit; opacity: 0.85; }
.tile.wide { margin: 0.5rem 0 1rem; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 0.5rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }
.num { text-align: end; font-variant-numeric: tabular-nums; }
.up { color: var(--up); font-weight: 600; }
table.list { background: var(--card); border-radius: var(--radius); }
.card table.list { background: none; }

.badge { display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 99px; background: var(--brand-soft); color: var(--brand); margin-inline-end: 0.25rem; }
.badge.draft, .badge.s-open { background: var(--warn-soft); color: inherit; border: 1px solid var(--warn-line); }
.badge.alert { background: var(--up-soft); color: var(--up); }
.badge.s-dismissed { background: var(--line); color: var(--ink); }

.scroll { overflow-x: auto; }
.grid-table th[scope], .grid-table tbody th { text-transform: none; font-size: 0.95rem; color: var(--ink); font-weight: 500; white-space: nowrap; }
.grid-table tr.total th, .grid-table tr.total td { font-weight: 700; border-top: 2px solid var(--line); }

/* Review screen */
.review { display: grid; gap: 1rem; }
.review.has-file { grid-template-columns: minmax(260px, 2fr) 5fr; align-items: start; }
.original { position: sticky; top: 1rem; display: flex; flex-direction: column; gap: 0.4rem; }
.original img { width: 100%; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
.original object { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: var(--radius); }
.invoice-form { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
table.lines { table-layout: fixed; }
table.lines td { padding: 0.35rem 0.25rem; }
table.lines th:nth-child(1) { width: 26%; }
table.lines th:nth-child(2) { width: 22%; }
table.lines th:nth-child(3) { width: 14%; }
table.lines th:nth-child(4), table.lines th:nth-child(5) { width: 8%; }
table.lines th:nth-child(6), table.lines th:nth-child(7) { width: 10%; }
table.lines th:nth-child(8) { width: 2rem; }
table.lines input.n { text-align: end; }
tr.has-issue td { background: var(--up-soft); }
.issue { color: var(--up); font-weight: 600; }
.match { display: block; color: var(--muted); }
.match.suggested { color: var(--suggest); }
.totals { display: grid; grid-template-columns: repeat(3, minmax(0, 160px)); gap: 0.75rem; justify-content: end; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: flex-end; }
.danger-zone { margin-top: 1rem; text-align: end; }

.drop {
  align-items: center; text-align: center; gap: 0.35rem; padding: 2rem 1rem; border: 2px dashed var(--field-line);
  border-radius: var(--radius); cursor: pointer; font-weight: 600; min-height: 180px; justify-content: center;
}
.drop:hover { border-color: var(--brand); }
.drop input { margin-top: 0.75rem; }
.big-icon { font-size: 2.5rem; }

.alert-actions { margin-top: 0.35rem; }
.alert-actions summary { cursor: pointer; color: var(--brand); font-weight: 600; padding: 0.6rem 0; min-height: 44px; }
.alert-actions form.inline { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.money-form select, .money-form input { width: auto; flex: 1 1 8rem; }

.chart { margin-left: 0; margin-right: 0; }
.chart figcaption { margin-bottom: 0.5rem; }
.chart-now { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-inline-end: 0.4rem; }
.chart svg { width: 100%; max-width: 560px; height: auto; display: block; }
.chart .grid { stroke: var(--line); }
.chart .axis { fill: var(--muted); font-size: 12px; }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2.5; }
.chart .dot { fill: var(--card); stroke: var(--brand); stroke-width: 2.5; }

/* Phones: tables become stacked cards. */
@media (max-width: 720px) {
  .review.has-file { grid-template-columns: 1fr; }
  .original { position: static; }
  .original object { height: 50vh; }
  table.list thead, table.lines thead { display: none; }
  table.list tr, table.lines tr { display: block; border-bottom: 1px solid var(--line); padding: 0.5rem 0; }
  table.list td, table.lines td { display: flex; justify-content: space-between; gap: 1rem; border: none; padding: 0.2rem 0; text-align: end; }
  table.list td::before, table.lines td::before { content: attr(data-label); color: var(--muted); font-size: 0.85rem; text-align: start; flex: none; }
  /* The status cell holds a badge and the "Update" panel: stack them full width. */
  table.list td.status-cell { flex-wrap: wrap; align-items: center; }
  table.list td.status-cell .alert-actions { flex-basis: 100%; text-align: start; }
  table.list td.status-cell .badge { align-self: center; }
  .money-form select, .money-form input, .money-form button { flex-basis: 100%; }
  table.list td a { display: inline-block; padding: 0.35rem 0; }
  table.lines { table-layout: auto; }
  table.lines td { flex-direction: column; text-align: start; gap: 0.15rem; }
  table.lines td.num { text-align: start; }
  table.lines input.n { text-align: start; }
  .totals { grid-template-columns: 1fr 1fr 1fr; }

  /* Home: tiles two across, money found full width. */
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile.money, .tile.todo { grid-column: span 2; }
  .tile .value { font-size: 1.5rem; }

  /* Review: the whole photo, shrunk to fit; tap it for full size. */
  .original img { max-height: 320px; object-fit: contain; }

  /* Review: each invoice line is a compact card, quantity, unit and price on one row. */
  table.lines tr.line {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.4rem 0.5rem; padding: 0.75rem; margin-bottom: 0.6rem;
    border: 1px solid var(--line); border-radius: var(--radius);
  }
  table.lines tr.line td { padding: 0; }
  table.lines tr.line td:nth-child(1), table.lines tr.line td:nth-child(2), table.lines tr.line td:nth-child(3) { grid-column: span 3; }
  table.lines tr.line td:nth-child(7) { grid-column: span 2; }
  table.lines tr.line td:nth-child(8) { justify-content: flex-end; align-items: flex-end; }
  tr.has-issue { border-color: var(--up) !important; }
  .form-actions {
    position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 5; background: var(--card);
    margin: 0 -1rem -1rem; padding: 0.75rem 1rem; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius);
  }
  .form-actions button { flex: 1 1 0; }
}
.remove-line { color: var(--up) !important; }
.pack-note { display: block; font-size: 0.85rem; font-weight: 500; color: var(--ink); margin-top: 0.2rem; }
textarea { width: 100%; border: 1px solid var(--field-line); border-radius: 8px; padding: 0.6rem 0.7rem; background: var(--field-bg); color: var(--ink); font: inherit; font-size: 16px; line-height: 1.45; }

/* Where your money goes: top items by spend */
.grid3 .span3 { grid-column: 1 / -1; }
.top-items { list-style: none; margin: 0 0 0.5rem; padding: 0; }
.top-items li + li { border-top: 1px solid var(--line); }
.top-items a { display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 0.75rem; padding: 0.6rem 0; color: inherit; text-decoration: none; }
.top-items .top-name { font-weight: 600; overflow-wrap: anywhere; }
.top-items .top-amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.top-items .top-bar { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--brand-soft); overflow: hidden; }
.top-items .top-bar span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.top-items .muted { grid-column: 1 / -1; }

/* Compare suppliers */
.saving { margin: 0 0 0.5rem; padding: 0.5rem 0.75rem; border-radius: var(--radius); background: var(--brand-soft); }
.compare tr.cheapest td { font-weight: 600; }

/* Inventory count: name, on hand, par. On a phone the name gets its own line. */
.count-head, .count-row { display: grid; grid-template-columns: 1fr 7rem 7rem; gap: 0.5rem; align-items: center; }
.count-row { padding: 0.5rem 0; border-top: 1px solid var(--line); }
.count-name { font-weight: 600; overflow-wrap: anywhere; }
.count-name .muted { font-weight: 400; display: block; }
@media (max-width: 640px) {
  .count-head { grid-template-columns: 1fr 1fr; }
  .count-head span:first-child { display: none; }
  .count-row { grid-template-columns: 1fr 1fr; }
  .count-name { grid-column: 1 / -1; }
}

/* Taps answer straight away: no grey flash or double-tap-zoom wait, and a press state. */
html { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a, button, .button { transition: transform 0.08s ease, background-color 0.08s ease, opacity 0.08s ease; }
.button:active, button:active { transform: scale(0.97); }
.menu a:active, .top-items a:active, table.list tr:has(a):active { background: var(--brand-soft); }
.tabbar a:active .tab-icon { transform: scale(0.9); }
.tab-icon { transition: transform 0.08s ease; }

/* Thin bar at the top while a page takes more than a moment. */
#nav-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--brand); z-index: 100; opacity: 0; pointer-events: none; }
#nav-progress.on { opacity: 1; width: 80%; transition: width 2s cubic-bezier(0.1, 0.7, 0.3, 1); }

/* Quick cross-fade between pages; the tab bar stays still. */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.12s; }
.tabbar { view-transition-name: tabbar; }

/* Language menu in the footer. */
.language { display: inline-flex; margin: 0; }
.language select { width: auto; min-height: 36px; padding: 0.2rem 0.5rem; font-size: 0.85rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Right-to-left languages: the progress bar grows from the right, and numbers stay left-to-right.
   The ‹ › chevrons turn round by themselves (Unicode mirrors them); ← doesn't, so it's flipped here.
   A price with its unit reads "$29.98/case", not "case/$29.98", and the chart's dates stay inside it. */
[dir="rtl"] #nav-progress { left: auto; right: 0; }
.num, .value, .top-amount { unicode-bidi: plaintext; }
.inv-total, .chart-now { unicode-bidi: isolate; direction: ltr; }
.chart svg { direction: ltr; }
.arrow-back { display: inline-block; }
[dir="rtl"] .arrow-back { transform: scaleX(-1); }

/* Inside the iPhone app: behave like an app, not a web page. No long-press link
   previews or text selection on buttons and labels (typing still works), and a
   header that reads like an iOS navigation bar. */
.in-app body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
.in-app input, .in-app textarea, .in-app select { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
.in-app header.top { justify-content: center; position: relative; min-height: 44px; padding-bottom: 0.6rem; }
.in-app .brand { font-size: 1.0625rem; font-weight: 600; pointer-events: none; }
.nav-back {
  position: absolute; inset-inline-start: 4px; bottom: 0.25rem; display: flex; align-items: center; gap: 0.15rem;
  min-height: 44px; padding: 0 12px 0 8px; background: none; border: 0; color: #fff; font: inherit; font-size: 1.0625rem; cursor: pointer;
}
.nav-back span { font-size: 1.9rem; line-height: 1; margin-top: -0.2rem; }
.nav-back:active { opacity: 0.5; }

/* Shown while a snapped photo uploads and is read. */
.snap-busy {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 1.1rem;
}
.snap-busy[hidden] { display: none; }
.snap-busy .spinner {
  width: 44px; height: 44px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, 0.3); border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.drop:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }

/* Invoice list: "Needs review" first, then one group per month, each invoice a tappable row. */
.inv-group { margin-top: 1.25rem; }
.inv-group h2 { display: flex; align-items: baseline; gap: 0.5rem; margin: 0 0 0.4rem; font-size: 1rem; }
.inv-group h2 .count { background: var(--warn-soft); border: 1px solid var(--warn-line); border-radius: 99px; padding: 0 0.5rem; font-size: 0.8rem; }
.inv-month-total { margin-inline-start: auto; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.inv-group > p { margin: 0 0 0.5rem; }
.inv-list { list-style: none; padding: 0; margin: 0; overflow: hidden; }
.inv-list li + li { border-top: 1px solid var(--line); }
.inv-row {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 1rem; min-height: 64px;
  color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.inv-row:active { background: var(--brand-soft); }
.inv-row.draft { border-inline-start: 4px solid var(--warn-line); padding-inline-start: calc(1rem - 4px); }
.inv-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.inv-supplier { font-weight: 600; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-details { color: var(--muted); font-size: 0.85rem; }
.inv-badges { margin-top: 0.2rem; }
.inv-total { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.inv-chevron { color: var(--muted); font-size: 1.4rem; line-height: 1; }
.inv-exports { margin-top: 1.5rem; text-align: center; }
.list-search { width: 100%; margin: 0.25rem 0 0.25rem; }
.per-unit { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.inv-list li[hidden], .inv-group[hidden] { display: none; }

/* Lists on phones read like the Invoices list: the name and the number that matters on top,
   details underneath in grey, no column of labels. Cells opt in with r-* classes:
   r-title / r-end (top line), r-sub / r-sub-end (second line), r-left / r-right (a pair of
   labelled values), r-full (full width, last). r-il puts the label before the value, r-lab
   under it. Rows with a.row-link open that link from anywhere on the row. */
td.phone-only { display: none; }
/* Browser placeholder grey is too faint on the dark fields; this one passes contrast in both themes. */
::placeholder { color: var(--muted); opacity: 1; }
.row-head h2 { margin: 0; }
@media (max-width: 720px) {
  table.rows tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.15rem 1rem; align-items: baseline;
    position: relative; padding: 0.8rem 0;
  }
  table.rows tr:last-child { border-bottom: none; }
  table.rows td { grid-column: 1 / -1; order: 7; font-size: 0.9rem; }
  table.rows td.r-title, table.rows td.r-sub, table.rows td.r-full, table.rows td.phone-only { display: block; text-align: start; }
  table.rows td.r-end, table.rows td.r-sub-end { display: block; text-align: end; }
  table.rows td:is(.r-title, .r-end, .r-sub, .r-sub-end, .r-full, .phone-only, .r-split)::before { content: none; }
  table.rows td.r-phone-hide { display: none; }
  table.rows .r-title { grid-column: 1; order: 1; font-size: 1.05rem; font-weight: 600; overflow-wrap: anywhere; }
  table.rows .r-title a { text-decoration: none; padding: 0; }
  table.rows .r-end { grid-column: 2; order: 2; font-size: 1.05rem; font-weight: 700; text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
  table.rows .r-sub { grid-column: 1; order: 3; color: var(--muted); font-size: 0.85rem; }
  table.rows .r-sub-end { grid-column: 2; order: 4; color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
  table.rows td.r-left, table.rows td.r-right {
    grid-column: 1; order: 5; flex-direction: column; justify-content: flex-start; align-items: flex-start; gap: 0;
    text-align: start; margin-top: 0.35rem;
  }
  table.rows td.r-right { grid-column: 2; order: 6; align-items: flex-end; text-align: end; }
  table.rows td.r-left::before, table.rows td.r-right::before { font-size: 0.75rem; }
  table.rows td.r-full { order: 8; margin-top: 0.35rem; }
  table.rows td.r-il::before { content: attr(data-label); color: var(--muted); font-size: 0.85rem; font-weight: 400; margin-inline-end: 0.35em; }
  table.rows .r-lab::after { content: attr(data-label); display: block; color: var(--muted); font-size: 0.75rem; font-weight: 400; }
  /* A cell whose parts go to different places: its number on top, its note full width. */
  table.rows td.r-split { display: contents; }
  table.rows td.r-split .pack-note { grid-column: 1 / -1; order: 7; font-size: 0.85rem; }
  table.rows .badge { vertical-align: 0.1em; }
  table.rows td.status-cell { display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.75rem; }
  table.rows td.status-cell .alert-actions { flex: 1 1 auto; margin-top: 0; text-align: end; }
  table.rows td.status-cell .alert-actions[open] { flex-basis: 100%; text-align: start; }
  table.rows td.status-cell .alert-actions summary { padding: 0.5rem 0; min-height: 0; }
  table.rows button.link { min-height: 36px; }

  /* Tappable rows: the whole row opens the link, with a chevron like the Invoices list. */
  table.rows tr.tap { padding-inline-end: 1.6rem; }
  table.rows tr.tap::after {
    content: "›"; position: absolute; inset-inline-end: 0.15rem; top: 50%; transform: translateY(-50%);
    color: var(--muted); font-size: 1.4rem; line-height: 1;
  }
  [dir="rtl"] table.rows tr.tap::after { transform: translateY(-50%) scaleX(-1); }
  table.rows tr.tap a.row-link { color: inherit; }
  table.rows tr.tap .r-title a.row-link { color: var(--ink); }
  table.rows tr.tap .r-sub a.row-link { color: var(--brand); }
  table.rows tr.tap a.row-link::after { content: ""; position: absolute; inset: 0; }
  table.rows tr.tap :is(button, form, details, a:not(.row-link)) { position: relative; z-index: 1; }

  table.rows td:empty { display: none; }
  table.rows td.r-actions { margin-top: 0; }
  table.rows td form:has(> button.link:only-child) { display: flex; justify-content: flex-end; }

  /* Review: each line a card set a little into the form. What it says and your item on top,
     then quantity and unit side by side, unit price and line total under them. */
  table.lines tr.line {
    position: relative; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.6rem 0.75rem;
    padding: 0.85rem; background: var(--bg);
  }
  table.lines tr.line td:nth-child(1), table.lines tr.line td:nth-child(2), table.lines tr.line td:nth-child(3) { grid-column: 1 / -1; }
  table.lines tr.line td:nth-child(n+4):nth-child(-n+7) { grid-column: auto; }
  table.lines tr.line td:nth-child(8) { position: absolute; top: 0.35rem; inset-inline-end: 0.6rem; }
  table.lines tr.line td::before { font-weight: 500; }
  table.lines .remove-line { min-height: 36px; font-size: 0.9rem; }
  table.lines input.n { text-align: end; }
  table.lines input[name="lineTotal"] { font-weight: 600; }
  table.lines .match { margin-top: 0.15rem; }
  table.lines .issue { margin-top: 0.15rem; }
  table.lines tr.line.has-issue { background: var(--up-soft); }
  table.lines tr.line.has-issue td { background: none; }
  .totals input { text-align: end; }
  .totals input[name="total"] { font-weight: 600; }

  /* Tiles: two across; one left on its own takes the whole row instead of leaving a gap. */
  .tiles { display: flex; flex-wrap: wrap; }
  .tiles .tile { flex: 1 1 calc(50% - 0.75rem); min-width: 0; }
  .tiles .tile.money, .tiles .tile.todo { flex-basis: 100%; }
}

/* ===== Desktop app: begin =====
   Laptops and desktops (1024px and wider, signed in): a fixed navy sidebar in place of
   the top header, wider pages, the Home dashboard and the Settings page. Phones and
   tablets never see the sidebar or the dashboard (.home-desk); Home keeps its tiles there. */
.sidebar, .home-desk { display: none; }
.top-items .rank-row { display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 0.75rem; padding: 0.6rem 0; }
.settings-sub { font-size: 0.95rem; margin: 1.25rem 0 0; }
.dash-chart { width: 100%; height: auto; display: block; direction: ltr; }
.dash-chart .grid { stroke: var(--line); }
.dash-chart .base { stroke: var(--field-line); }
.dash-chart .axis { fill: var(--muted); font-size: 12px; }
.dash-chart .val { fill: var(--ink); font-size: 13px; font-weight: 700; }
.dash-chart .bar path { fill: var(--brand); opacity: 0.45; }
.dash-chart .bar.now path, .dash-chart .bar:hover path { opacity: 1; }
.dash-chart .hit { fill: transparent; }
@media (min-width: 1024px) {
  body.signed-in { padding-inline-start: 248px; }
  .signed-in header.top { display: none; }
  .signed-in main { max-width: 1280px; padding: 2rem 40px 3rem; }
  .sidebar {
    display: flex; flex-direction: column; position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 30; width: 248px;
    padding: 1.25rem 0.75rem 1rem; overflow-y: auto; background: var(--navy, #0b1730); color: #fff;
    border-inline-end: 1px solid rgba(255, 255, 255, 0.08);
    view-transition-name: sidebar;
  }
  .sidebar .brand { padding: 0 0.6rem 1.25rem; font-size: 1.2rem; }
  .sidebar nav { display: flex; flex-direction: column; gap: 2px; }
  .sidebar nav a {
    display: flex; align-items: center; gap: 0.75rem; min-height: 40px; padding: 0.45rem 0.7rem; border-radius: 8px;
    color: #c3d0e4; text-decoration: none; font-size: 0.95rem; font-weight: 500;
  }
  .sidebar nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
  .sidebar nav a.on { background: rgba(255, 255, 255, 0.1); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 #8fb3e0; }
  [dir="rtl"] .sidebar nav a.on { box-shadow: inset -3px 0 0 #8fb3e0; }
  .sidebar nav a:focus-visible { outline: 2px solid #22d3ee; outline-offset: -2px; }
  .sidebar svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .side-badge {
    margin-inline-start: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px;
    background: #d93a22; color: #fff; font-size: 0.75rem; font-weight: 700; line-height: 20px; text-align: center;
  }
  .side-foot { margin: auto 0 0; padding: 1rem 0.7rem 0; border-top: 1px solid rgba(255, 255, 255, 0.12); display: flex; flex-direction: column; align-items: flex-start; }
  .side-who { color: #fff; font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }
  .side-foot button.link { color: #c3d0e4; padding: 0; min-height: 32px; }
  .side-foot button.link:hover { color: #fff; }

  /* Home: key numbers across the top, then the charts and lists in one grid. */
  main:has(> .home-desk) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
  main:has(> .home-desk) > * { grid-column: 1 / -1; }
  .home-desk, .dash-grid, .home-shared { display: contents; }
  .home-phone { display: none; }
  main:has(> .home-desk) :is(.dash-grid, .home-shared) > * { margin: 0; grid-column: auto; }
  main:has(> .home-desk) .dash-wide, main:has(> .home-desk) .home-shared > * { grid-column: 1 / -1; }
  .kpis { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; }
  .kpis .tile { padding: 1.1rem 1.2rem; gap: 0.2rem; }
  .kpis a.tile:hover { border-color: var(--brand); }
  .kpis .tile .value { font-size: 1.7rem; line-height: 1.2; }
  .kpis .tile.alerting .value { color: var(--up); }
  .kpis .budget-bar { height: 8px; margin: 0.35rem 0 0.1rem; }
  .kpis .hint { font-size: 0.8rem; }
  .kpis .hint.b-ok, .kpis .hint.b-close, .kpis .hint.b-over { font-weight: 600; }
  main:has(> .home-desk) .card h2 { margin-bottom: 0.25rem; }
  main:has(> .home-desk) .mv-home h2 { margin: 0 0 0.4rem; }
  .dash-grid .muted.small { margin: 0 0 0.75rem; }
  .dash-grid .top-items { margin: 0; }

  /* Settings: two columns of cards. */
  .settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; margin-top: 1rem; }
  .settings-grid .card { margin: 0; }
  .settings-grid > div { display: flex; flex-direction: column; gap: 1rem; }
  .settings-grid .narrow-form { max-width: none; }
  .settings-grid .stack > button { align-self: flex-start; }
  .settings-grid .actions { align-items: center; }
  .signed-in main .budget-form label, .signed-in main .mp-target label { flex: 0 1 18rem; }
  .signed-in .inv-row:hover, .signed-in .menu a:hover { background: var(--brand-soft); }
}
@media (min-width: 1280px) {
  /* Three columns: the month chart beside the suppliers, price increases beside the top items. */
  main:has(> .home-desk) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  main:has(> .home-desk) .dash-wide { grid-column: span 2; }
  main:has(> .home-desk) .home-shared > .card { grid-column: span 2; }
}
/* ===== Desktop app: end ===== */

/* Spend tables scroll sideways on a phone; the supplier or category stays in view. */
.grid-table th:first-child { position: sticky; inset-inline-start: 0; background: var(--card); z-index: 1; }

/* Purchase budget (weekly or monthly): the Home card and the Spend page periods. Green under 80%, amber 80-100%, red over. */
:root { --b-ok: #1d6b3f; --b-close: #8a5a00; --b-over: #b4331f; }
@media (prefers-color-scheme: dark) { :root { --b-ok: #6fd39a; --b-close: #e8b54a; --b-over: #ff8a73; } }
.b-ok { color: var(--b-ok); } .b-close { color: var(--b-close); } .b-over { color: var(--b-over); }
.budget-unset { margin: 0.75rem 0 0; }
a.budget-card { display: block; color: var(--ink); text-decoration: none; }
a.budget-card .row-head { margin-bottom: 0.4rem; }
.budget-bar { position: relative; height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; }
.budget-bar .fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 99px; background: currentColor; }
.budget-bar .mark { position: absolute; inset-block: -2px; width: 2px; background: var(--ink); }
.budget-hint { display: block; margin-top: 0.4rem; font-weight: 600; font-size: 0.9rem; }
/* One grid for all rows, so the bars line up whatever the dates' length. */
.budget-weeks { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; grid-template-columns: minmax(6.5rem, auto) 1fr auto; align-items: center; gap: 0.6rem 0.75rem; }
.budget-weeks li { display: contents; }
.budget-dates { display: block; }
.budget-weeks .num { font-variant-numeric: tabular-nums; font-weight: 600; text-align: end; }
.budget-weeks .budget-bar { overflow: visible; }
.budget-form { display: flex; flex-wrap: wrap; align-items: end; gap: 0.75rem; }
.budget-form label { flex: 1 1 12rem; }
.budget-home > .card { margin-bottom: 0.4rem; }
.budget-drafts { margin: 0 0 1rem; }
.budget-drafts a { display: inline-flex; align-items: center; min-height: 44px; }

/* Price movers (/movers and the Home card): ups in the "up" colour, downs in green. */
.mv-range { display: inline-flex; border: 1px solid var(--line); border-radius: 99px; background: var(--card); padding: 3px; margin: 0.5rem 0 0.25rem; }
.mv-range a { padding: 0.4rem 0.9rem; min-height: 36px; display: inline-flex; align-items: center; border-radius: 99px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.mv-range a.on { background: var(--brand); color: var(--brand-ink); }
.mv-row.up-row { border-inline-start: 4px solid var(--up); padding-inline-start: calc(1rem - 4px); }
.mv-row.down-row { border-inline-start: 4px solid var(--down); padding-inline-start: calc(1rem - 4px); }
.mv-prices { white-space: nowrap; font-variant-numeric: tabular-nums; }
.mv-end { display: flex; flex-direction: column; align-items: flex-end; gap: 0.1rem; flex: 0 0 auto; text-align: end; }
.mv-pct { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap; unicode-bidi: isolate; direction: ltr; }
.mv-month { color: var(--muted); font-size: 0.8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mv-home .mv-all { margin-inline-start: auto; font-size: 0.9rem; font-weight: 400; }

/* Menu price helper (Dish costs): "Menu prices to check", one row per dish with
   the costs on top and the suggested price with "Use this price" underneath. */
.mp-row { padding: 0.85rem 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.mp-main { display: flex; flex-direction: column; gap: 0.15rem; color: inherit; text-decoration: none; min-width: 0; -webkit-tap-highlight-color: transparent; }
.mp-main:active { opacity: 0.7; }
.mp-name { font-weight: 600; font-size: 1.05rem; }
.mp-detail { color: var(--muted); font-size: 0.85rem; }
.mp-detail .up { font-weight: 600; }
.mp-use { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.mp-suggest { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.mp-suggest strong { font-size: 1.1rem; }
.mp-target { display: flex; align-items: flex-end; gap: 0.75rem; flex-wrap: wrap; }
.mp-target label { flex: 0 1 12rem; }
.mp-target .error { flex-basis: 100%; margin: 0; }

/* Order list: one group per supplier, each item a row with a tick and the amount to order. */
.order-form .inv-list.card { margin: 0; }
.order-form > .card { margin-top: 0.6rem; }
.order-row { padding-block: 0.5rem; min-height: 60px; }
.order-row:active { background: none; }
.order-pick { flex: 1 1 auto; min-width: 0; min-height: 44px; margin: 0; cursor: pointer; }
.order-qty { display: flex; align-items: center; gap: 0.4rem; flex: none; }
.order-qty input { width: 4.5rem; text-align: end; font-variant-numeric: tabular-nums; }
.order-qty .muted { min-width: 2.2rem; }
.order-row.off .inv-main, .order-row.off .order-qty { opacity: 0.5; }
.order-form textarea { font-size: 1rem; }

/* ==== Public front page (src/views/landing.tsx). Everything for it is in this block, classes start with l-. ==== */
.top-actions { display: flex; align-items: center; gap: 0.75rem; margin-inline-start: auto; }
.top-actions a:not(.button) { color: #fff; text-decoration: none; font-weight: 600; padding: 0.5rem 0.25rem; }
.landing header.top { position: sticky; top: 0; z-index: 10; }
.landing header.top { padding-inline: max(16px, calc((100% - 1068px) / 2)); }
.landing main { max-width: none; padding: 0; }
/* On the navy, main buttons are plain white in both themes. */
.top-actions .button.primary, .l-hero .button.primary { background: #fff; color: #0b1730; }
.l-wrap { max-width: 1100px; margin: 0 auto; padding-inline: 16px; }
.l-center { text-align: center; }
.l-section { padding: 4rem 0; }
.l-section h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.2; margin: 0 0 1rem; letter-spacing: -0.01em; }
.l-section h3 { font-size: 1.1rem; margin: 0.6rem 0 0.3rem; }
.l-section p { margin: 0; color: var(--muted); }
.l-alt { background: var(--card); border-block: 1px solid var(--line); }
.l-icon { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.l-hero {
  color: #fff; padding: 4.5rem 0 5rem; overflow: hidden;
  /* A faint line so the hero ends clearly in dark mode too. */
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--navy, #0b1730);
}
.l-hero-logo { display: none; }
.l-hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 3rem; align-items: center; }
.l-hero h1 {
  font-size: clamp(2.2rem, 5.5vw, 3.6rem); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 1.1rem;
  color: #fff;
}
.l-lead { font-size: clamp(1.05rem, 1.8vw, 1.25rem); color: #c9d6ea; max-width: 34em; margin: 0 0 1.75rem; }
.l-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.l-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.45); }
.l-note { color: #9fb0c8; font-size: 0.9rem; margin: 1.25rem 0 0; }
.l-hero-art { position: relative; justify-self: center; padding: 1.5rem 3rem; }
.l-hero-art img { display: block; width: 220px; height: 220px; border-radius: 48px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35); }
.l-ping {
  position: absolute; display: flex; flex-direction: column; gap: 0.1rem; padding: 0.65rem 0.9rem; border-radius: 12px; min-width: 15rem;
  background: #fff; color: #0f1b2d; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3); font-size: 0.9rem; border-inline-start: 4px solid #1e3a5f;
}
.l-ping span { color: #56637a; font-size: 0.8rem; }
.l-ping-1 { top: 0; inset-inline-end: -2rem; }
.l-ping-2 { bottom: 0; inset-inline-start: -2.5rem; }
.l-ping-3 { bottom: -4.5rem; inset-inline-end: -2rem; }

/* Invoice vault: the original copy and its data, side by side. */
.l-kicker { color: var(--brand) !important; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; margin-bottom: 0.5rem !important; }
.l-vault { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 3rem; align-items: center; }
.l-vault > div > p { font-size: 1.1rem; }
.l-vault-list { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 1.1rem; }
.l-vault-list li { display: flex; gap: 0.9rem; align-items: flex-start; }
.l-vault-list .l-icon { flex: none; margin-top: 0.2rem; }
.l-vault-list h3 { margin: 0 0 0.15rem; }
.l-vault-art { position: relative; display: grid; grid-template-columns: 1fr 1.25fr; gap: 1rem; align-items: center; }
.l-paper {
  position: relative; background: #fbfaf6; color: #333; border-radius: 6px; padding: 1rem 0.9rem 1.6rem; transform: rotate(-3deg);
  box-shadow: 0 14px 34px rgba(11, 23, 48, 0.25); font-size: 0.75rem;
}
.l-paper-head { display: flex; flex-direction: column; margin-bottom: 0.7rem; }
.l-paper-head span { color: #888; }
.l-paper i { display: block; height: 6px; border-radius: 3px; background: #d9d6cc; margin: 0.45rem 0; }
.l-paper i.short { width: 60%; }
.l-data { position: relative; background: var(--navy, #0b1730); color: #e6edf7; border-radius: 14px; padding: 1.4rem 1rem 1rem; box-shadow: 0 14px 34px rgba(11, 23, 48, 0.25); }
.l-data table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.l-data td { padding: 0.4rem 0.2rem; border-bottom: 1px solid #23345a; color: #e6edf7; }
.l-data td:last-child { text-align: end; color: #8fb3e0; font-weight: 600; }
.l-data tr:last-child td { border-bottom: 0; color: #9fb0c8; }
.l-paper-tag {
  position: absolute; top: -0.7rem; inset-inline-start: 0.8rem; background: #1e3a5f; color: #fff;
  font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 99px;
}

.l-problem { display: grid; grid-template-columns: 1.2fr 1fr; gap: 3rem; align-items: center; }
.l-problem p { font-size: 1.1rem; }
.l-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; }
.l-facts li { display: flex; align-items: center; gap: 1.1rem; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.2rem; }
.l-facts strong {
  flex: none; min-width: 5.5rem; font-size: 2rem; line-height: 1; color: var(--brand);
}
.l-facts span { color: var(--muted); }

.l-steps { list-style: none; margin: 2rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; counter-reset: none; }
.l-steps li { position: relative; padding: 1.5rem 1.4rem; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); }
.l-steps .l-icon { color: var(--brand); width: 34px; height: 34px; }
.l-step-num {
  position: absolute; top: 1.2rem; inset-inline-end: 1.2rem; width: 2rem; height: 2rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 700; background: var(--brand); color: var(--brand-ink);
}

.l-features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 2rem; }
.l-feature { padding: 1.3rem 1.2rem; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.l-feature .l-icon {
  box-sizing: content-box; padding: 0.55rem; border-radius: 10px; background: var(--brand-soft); color: var(--brand); width: 24px; height: 24px;
}
.l-feature p { font-size: 0.95rem; }

.l-pledge { display: flex; align-items: center; gap: 1.5rem; max-width: 860px; }
.l-pledge > .l-icon { flex: none; width: 64px; height: 64px; color: var(--brand); stroke-width: 1.4; }
.l-pledge h2 { font-size: clamp(1.3rem, 2.6vw, 1.75rem); margin-bottom: 0.5rem; }
.l-pledge a { font-weight: 600; }

.l-offer {
  text-align: center; padding: 3rem 1.5rem; border-radius: 20px; color: #fff; max-width: 860px; margin: 0 auto;
  background: var(--navy, #0b1730);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.l-offer p { color: #c9d6ea; max-width: 36em; margin: 0 auto 1.6rem; font-size: 1.05rem; }
.l-offer .button.primary { background: #fff; color: #0b1730; }

.l-foot { background: var(--navy, #0b1730); color: #c9d6ea; text-align: start; padding: 2.5rem 0 1.5rem; font-size: 0.95rem; }
.l-foot a { color: #c9d6ea; padding: 0; }
.l-foot-grid { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1.5rem; }
.l-foot-grid p { margin: 0.75rem 0 0; }
.l-foot-grid nav { display: flex; gap: 1.25rem; }
.l-foot-grid nav a { padding: 0.5rem 0; }
.l-foot .language select { background: #12213d; color: #fff; border-color: #4b5f85; width: auto; }
.l-copy { color: #8092ad; font-size: 0.85rem; margin-top: 2rem; }

@media (max-width: 900px) {
  .l-features { grid-template-columns: repeat(2, 1fr); }
  .l-hero-grid, .l-problem, .l-vault { grid-template-columns: 1fr; gap: 2rem; }
  .l-vault-art { max-width: 460px; }
  .l-hero-art { display: none; }
  .l-hero-logo { display: block; width: 72px; height: 72px; border-radius: 16px; margin-bottom: 1.25rem; }
}
@media (max-width: 720px) {
  .l-section { padding: 2.75rem 0; }
  .l-hero { padding: 2.75rem 0 3rem; }
  .l-steps, .l-features { grid-template-columns: 1fr; }
  /* Icon beside the text keeps the eight features short to scroll past on a phone. */
  .l-feature { display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.9rem; padding: 1rem; }
  .l-feature .l-icon { grid-row: span 2; }
  .l-feature h3 { margin: 0; align-self: end; }
  .l-actions .button { flex: 1 1 100%; }
  .l-pledge { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .l-pledge > .l-icon { width: 48px; height: 48px; }
  .l-foot-grid { flex-direction: column; }
}
/* ==== End of the public front page ==== */

/* Staff: people on the account, and who did what on an invoice. */
.staff-list { list-style: none; padding: 0; margin: 0; }
.staff-list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.6rem 1rem; padding: 0.8rem 0; }
.staff-list li + li { border-top: 1px solid var(--line); }
.staff-who { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; overflow-wrap: anywhere; }
.staff-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.staff-role select { width: auto; }
.role-pick { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.role-pick legend { font-size: 0.9rem; font-weight: 500; margin-bottom: 0.4rem; }
.role-pick label.check { align-items: flex-start; }
.role-hint { display: block; }
.invite-ready { border-color: var(--brand); }
.invite-ready input { margin: 0.25rem 0; }
p.who-did { margin: -0.25rem 0 0.75rem; }
span.who-did { display: block; }
.staff-actions form { margin: 0; }
.role-pick input[type="radio"] { width: 22px; height: 22px; min-height: 0; flex: none; margin: 0.15rem 0 0; accent-color: var(--brand); }

/* Supplier statements (/statements): quick periods as chips that wrap on phones, totals rows in bold. */
.st-range { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.9rem; }
.st-range a { padding: 0.4rem 0.9rem; min-height: 36px; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; background: var(--card); }
.st-range a.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.st-head { margin-top: 1.25rem; }
.st-head h2 { margin: 0; }
.st-head p { margin: 0.15rem 0 0; }
.st-tiles { margin-top: 0.75rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.st-tiles .value { font-size: 1.5rem; }
table.list tr.st-total td { font-weight: 700; border-top: 2px solid var(--line); }
@media (max-width: 720px) {
  table.list tr.st-total { border-top: 2px solid var(--line); }
  table.list tr.st-total td { border-top: none; }
  .st-tiles { grid-template-columns: 1fr 1fr; }
  .st-tiles .tile.money { grid-column: 1 / -1; }
  .st-head .actions, .st-head .actions .button { width: 100%; }
}

/* Check a supplier statement: review rows, then problems grouped by kind. */
/* A soft green for "all clear", like --up-soft for problems. */
:root { --ok-soft: #e3f4ea; --ok-line: #9fd3b4; }
@media (prefers-color-scheme: dark) { :root { --ok-soft: #12352a; --ok-line: #2f6b4d; } }
.badge.ok { background: var(--ok-soft); color: var(--down); }
.st-past { margin: 1.75rem 0 0; font-size: 1.15rem; }
table.st-rows { table-layout: fixed; }
table.st-rows td { padding: 0.35rem 0.25rem; }
table.st-rows th:nth-child(1) { width: 9.5rem; }
table.st-rows th:nth-child(2) { width: 22%; }
table.st-rows th:nth-child(3) { width: 7.5rem; }
table.st-rows th:nth-child(4) { width: 7rem; }
table.st-rows th:nth-child(6) { width: 2rem; }
table.st-rows input.n { text-align: end; }
.st-clear { background: var(--ok-soft); border: 1px solid var(--ok-line); border-radius: var(--radius); padding: 0.75rem 1rem; }
.st-clear strong { color: var(--down); }
.st-all h2 { margin: 0 0 0.5rem; font-size: 1.05rem; }
.st-message textarea { width: 100%; }
.st-list > li { padding: 0.85rem 1rem; }
.st-problem .st-head { display: flex; align-items: flex-start; gap: 0.75rem; }
.st-what { flex: 1 1 auto; min-width: 0; font-weight: 600; display: flex; flex-direction: column; gap: 0.15rem; }
.st-what .badge { align-self: flex-start; margin-top: 0.2rem; }
.st-sub { font-weight: 400; }
.st-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-amount.up { color: var(--up); }
.st-act { margin: 0.35rem 0 0; }
.st-details { margin-top: 0.5rem; }
.st-details summary, .st-matched summary { cursor: pointer; color: var(--brand); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.st-details[open] summary { margin-bottom: 0.5rem; }
.st-matched { margin-top: 1.25rem; }
.st-foot { margin-top: 1.5rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
@media (max-width: 720px) {
  table.st-rows thead { display: none; }
  table.st-rows, table.st-rows tbody { display: block; }
  table.st-rows tr.st-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 0.6rem; position: relative;
    border: 1px solid var(--line); border-radius: var(--radius); padding: 2.2rem 0.6rem 0.6rem; margin-bottom: 0.6rem; background: var(--card);
  }
  table.st-rows tr.st-row td { display: flex; flex-direction: column; gap: 0.15rem; padding: 0; border: none; text-align: start; }
  table.st-rows tr.st-row td::before { content: attr(data-label); color: var(--muted); font-size: 0.85rem; font-weight: 500; }
  table.st-rows tr.st-row td:nth-child(5) { grid-column: 1 / -1; }
  table.st-rows tr.st-row td:nth-child(6) { position: absolute; top: 0.35rem; inset-inline-end: 0.6rem; }
  table.st-rows tr.st-row td:nth-child(6)::before { content: none; }
  table.st-rows input.n { text-align: end; }
  table.st-rows input, table.st-rows select { width: 100%; min-width: 0; }
}

/* Invoices search: the box stays in view; supplier, status and dates fold under "Filters". */
.inv-search { margin: 0.5rem 0 0.25rem; }
.inv-search-bar { display: flex; gap: 0.5rem; }
.inv-search-bar input { flex: 1 1 auto; }
.inv-search-bar button { flex: none; width: 48px; padding: 0; }
.inv-filters summary { cursor: pointer; color: var(--brand); font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.inv-filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; align-items: end; padding-bottom: 0.25rem; }
.inv-filter-grid > button { grid-column: 1 / -1; }
.inv-found { display: flex; align-items: center; gap: 1rem; margin: 0.25rem 0 0; }
.inv-found a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
@media (min-width: 1024px) {
  .inv-search { max-width: 60rem; }
  .inv-filter-grid { grid-template-columns: 2fr 1.4fr 1fr 1fr auto; }
  .inv-filter-grid > button { grid-column: auto; }
}

/* Suppliers page */
.supplier-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.supplier-list > li { margin: 0; }
.supplier-list h2 { font-size: 1.05rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: flex-end; margin-top: 0.75rem; }
.inline-form label { flex: 1 1 12rem; margin: 0; }
.supplier-field select + input { margin-top: 0.4rem; }
.supplier-field select:not(:has(option[value=""]:checked)) + input { display: none; }
.supplier-rep { margin: 0 0 0.25rem; }
