:root {
  color-scheme: light dark;
  --bg: #f4f5f2;
  --card: #ffffff;
  --text: #1a1f1b;
  --muted: #5d665f;
  --line: #d9ddd6;
  --accent: #14532d;
  --accent-text: #ffffff;
  --error: #b42318;
  --ok: #14532d;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.45;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111411;
    --card: #1b201c;
    --text: #e8ebe6;
    --muted: #9aa39c;
    --line: #2f3731;
    --accent: #4ade80;
    --accent-text: #0b1f12;
    --error: #ff8a7a;
    --ok: #4ade80;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1rem 1rem calc(2rem + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  padding-top: calc(0.75rem + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.brand { font-weight: 650; flex: 1; }
.who { color: var(--muted); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem;
  margin-top: 1rem;
}

.center { text-align: center; color: var(--muted); }

h1 { font-size: 1.4rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.1rem; margin: 0 0 0.75rem; }
p { margin: 0 0 0.75rem; }
.small { font-size: 0.85rem; color: var(--muted); }

label {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0.9rem 0 0.3rem;
}

input, select {
  width: 100%;
  min-height: 48px;
  padding: 0.6rem 0.75rem;
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}

/* iPhone gives date fields their own width and centres the text; make them behave like the rest. */
input[type=date] {
  display: block;
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
  max-width: 100%;
}
input[type=date]::-webkit-date-and-time-value { text-align: left; }

input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.code {
  font-size: 1.6rem;
  letter-spacing: 0.4em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

button {
  font: inherit;
  cursor: pointer;
}

button[type=submit] {
  width: 100%;
  min-height: 50px;
  margin-top: 1.25rem;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 650;
}

button[disabled] { opacity: 0.6; cursor: wait; }

button.link {
  background: none;
  border: 0;
  padding: 0.6rem 0.25rem;
  color: var(--accent);
  text-decoration: underline;
}

form > button.link { display: block; margin: 0.5rem auto 0; }

.msg {
  min-height: 1.4em;
  margin: 0.75rem 0 0;
  color: var(--error);
  font-size: 0.95rem;
}

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

.qr {
  display: block;
  margin: 0.5rem auto 1rem;
  background: #ffffff;
  padding: 8px;
  border-radius: 8px;
}

code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  word-break: break-all;
}

.periods { margin: 0 0 0.75rem; }
.periods dt { font-size: 0.85rem; color: var(--muted); margin-top: 0.6rem; }
.periods dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

.members { margin: 0; padding-left: 1.2rem; }

/* ---------------------------------------------------------------- app shell */

#view-login, #view-password, #view-enrol, #view-challenge, #view-unlinked, #view-loading {
  max-width: 26rem;
  margin-left: auto;
  margin-right: auto;
}

.nav {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 0.35rem 0.5rem;
}

.nav a {
  flex: 0 1 8rem;
  text-align: center;
  padding: 0.6rem 0.5rem;
  border-radius: 10px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}

.nav a.active { color: var(--accent); background: var(--bg); }
.nav a.add { color: var(--accent-text); background: var(--accent); }

/* Phones: navigation sits at the thumb, fixed to the bottom. */
@media (max-width: 640px) {
  .nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 10;
    border-bottom: 0;
    border-top: 1px solid var(--line);
    padding-bottom: calc(0.35rem + env(safe-area-inset-bottom));
  }
  .nav a { flex: 1 1 0; }
  main { padding-bottom: calc(6rem + env(safe-area-inset-bottom)); }
}

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

.card-head h1, .card-head h2 { margin: 0; }

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

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

.btn, .btn-small {
  display: block;
  text-align: center;
  text-decoration: none;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 650;
}

.btn { min-height: 50px; line-height: 50px; padding: 0 1rem; margin-top: 0.75rem; width: 100%; }
.btn-small { padding: 0.45rem 1rem; }
.btn.secondary { background: none; color: var(--accent); border: 1px solid var(--line); }

button.icon {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 1.3rem;
  line-height: 1;
}

button.danger { color: var(--error); display: block; margin: 1rem auto 0; }

/* ---------------------------------------------------------------- period bar */

.period-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.period-bar select { flex: 1 1 11rem; background: var(--card); }
.period-nav { display: flex; align-items: center; gap: 0.4rem; flex: 2 1 16rem; }
.period-label { flex: 1; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- totals */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.stat { border: 1px solid var(--line); border-radius: 10px; padding: 0.75rem; }
.stat-label { font-size: 0.85rem; color: var(--muted); }
.stat-value { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-note { font-size: 0.78rem; color: var(--muted); }

/* ---------------------------------------------------------------- rows */

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { border-top: 1px solid var(--line); }
.rows > li:first-child { border-top: 0; }

.row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0;
  color: inherit;
  text-decoration: none;
}

.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { font-size: 0.83rem; color: var(--muted); }
.row-amount { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rows > li.child .row-title { font-weight: 400; }
.rows > li.inactive { opacity: 0.55; }

.badges { margin-top: 0.25rem; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.badge {
  font-size: 0.72rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.badge.paid { border-color: var(--accent); color: var(--accent); }
.badge.biz { background: var(--bg); color: var(--text); }
.badge.warn { border-color: var(--error); color: var(--error); }

.list-total {
  display: flex;
  justify-content: space-between;
  margin: 1rem 0 0.25rem;
  padding-top: 0.75rem;
  border-top: 2px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.filters select { min-height: 42px; font-size: 0.9rem; }

.filter-bar { display: flex; align-items: center; gap: 1rem; margin-top: 0.5rem; }
button.toggle {
  min-height: 42px;
  padding: 0 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
}
button.toggle.on { border-color: var(--accent); color: var(--accent); }

/* ---------------------------------------------------------------- forms */

.field { margin-top: 0.9rem; }
.field > label, .field > .label {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 0.3rem;
}

textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  resize: vertical;
}

.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; align-items: end; }
.two > button, .two > .btn { margin-top: 1.25rem; }
.currency { text-transform: uppercase; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { margin: 0; cursor: pointer; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span {
  display: inline-block;
  padding: 0.6rem 0.9rem;
  min-height: 46px;
  line-height: 1.5;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 650; }
.chip input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

.check { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.9rem; color: var(--text); font-size: 1rem; }
.check input { width: 22px; height: 22px; min-height: 0; }

details { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 0.75rem; }
summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 0.3rem 0; }

.inline-form {
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 1rem;
  margin: 0.75rem 0;
}

/* ---------------------------------------------------------------- receipts */

.receipt .btn {
  margin-top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  padding: 0.4rem 0.5rem;
  font-size: 0.95rem;
}
.receipt .two { margin-top: 0.5rem; }
.receipt-img {
  display: block;
  max-width: 100%;
  max-height: 34vh;
  margin: 0 auto 0.5rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}
.receipt-file { font-weight: 600; margin-bottom: 0.25rem; }
.warn-text { color: var(--error); font-size: 0.9rem; }
details.plain { border-top: 0; margin-top: 0; padding-top: 0; }

/* ---------------------------------------------------------------- slip beside form */

/* Wide screens: the slip stays in view on the left while the fields scroll on the right. */
@media (min-width: 900px) {
  main:has(#page > div > .split) { max-width: 78rem; }
  .split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
  .split-doc { position: sticky; top: 1rem; }
  .split-doc .viewer-pane { max-height: calc(100vh - 13rem); }
}

.viewer-pane {
  overflow: auto;
  max-height: 42vh;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
}
.viewer-img { display: block; width: 100%; max-width: none; }
.viewer-page { display: block; width: 100%; max-width: none; border-bottom: 1px solid var(--line); }
.viewer-note { padding: 1rem; margin: 0; }
.viewer-tools { display: flex; align-items: center; gap: 0.4rem; margin: 0.5rem 0; }
.viewer-tools .link { margin-left: auto; }

.unsure, input.unsure, select.unsure { border-color: #b45309; box-shadow: 0 0 0 2px rgba(180, 83, 9, 0.25); }
details.unsure { border-radius: 10px; padding: 0.75rem; }

.notice-box {
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-size: 0.92rem;
}
.notice-box p { margin: 0 0 0.4rem; }
.notice-box ul { margin: 0 0 0.4rem; padding-left: 1.2rem; }

/* ---------------------------------------------------------------- line items */

.item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6.5rem 44px;
  gap: 0.4rem;
  padding: 0.5rem 0;
  border-top: 1px solid var(--line);
}
.item:first-child { border-top: 0; }
.item input, .item select { min-height: 42px; font-size: 0.92rem; }
.item-amt { text-align: right; font-variant-numeric: tabular-nums; }
.item-cat { grid-column: 1 / 3; }
.item-del { grid-column: 3; grid-row: 1 / 3; align-self: center; }
.items-box .btn { margin-top: 0.5rem; }

/* ---------------------------------------------------------------- review list */

.inbox-row { display: flex; align-items: center; gap: 0.6rem; }
.inbox-row .row { flex: 1; min-width: 0; }
.inbox-check { flex: 0 0 24px; width: 24px; height: 24px; min-height: 0; padding: 0; }

/* ---------------------------------------------------------------- bank lines */

h3 { font-size: 0.95rem; margin: 1.25rem 0 0.25rem; color: var(--muted); }
.group { border-top: 1px solid var(--line); padding: 0.5rem 0 0.75rem; }
.group-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.group-actions select { flex: 1 1 12rem; min-height: 42px; font-size: 0.92rem; }
.group-actions .btn-small { border: 0; min-height: 42px; }
.group-links { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.nav a { font-size: 0.9rem; padding-left: 0.25rem; padding-right: 0.25rem; }

.drop-zone.dropping { border: 2px dashed var(--accent); background: var(--bg); }
.drop-hint { margin-top: 0.75rem; }
/* Touch devices cannot drag files in, so the hint would only be noise there. */
@media (hover: none) { .drop-hint { display: none; } }

.match { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 0.75rem; align-items: start; padding: 0.5rem 0; }
.match .row-title { display: block; white-space: normal; }
@media (max-width: 640px) { .match { grid-template-columns: minmax(0, 1fr); } .match .row-amount { text-align: left; } }

.dup-box {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--error);
  border-radius: 10px;
  font-size: 0.92rem;
}
.dup-box p { margin: 0 0 0.4rem; }
.dup-box ul { margin: 0 0 0.4rem; padding-left: 1.2rem; }

.tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1rem; }
.tabs a {
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  font-size: 0.92rem;
  font-weight: 600;
}
.tabs a.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

.history { list-style: none; margin: 0; padding: 0; }
.history > li { padding: 0.5rem 0; border-top: 1px solid var(--line); }
.history > li:first-child { border-top: 0; }
.history ul { margin: 0.25rem 0 0; padding-left: 1.2rem; font-size: 0.9rem; }

.topbar .link { white-space: nowrap; }
@media (max-width: 640px) {
  .who { display: none; }
}

/* ---------------------------------------------------------------- capture confirmation */

.capture-status:empty { display: none; }
.capture-status {
  margin-bottom: 0.25rem;
  margin-top: 0.9rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.capture-status.ok { border-color: var(--ok); }
.capture-status.bad { border-color: var(--error); }
.capture-status-title { font-weight: 700; font-size: 1.05rem; }
.capture-status.ok .capture-status-title { color: var(--ok); }
.capture-status.bad .capture-status-title { color: var(--error); }

/* ---------------------------------------------------------------- charts */

:root {
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --quiet: #c9cdc6;
  --chart-grid: #e6e9e3;
  --chart-axis: #bfc5bb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --quiet: #4a524c;
    --chart-grid: #29302b;
    --chart-axis: #3a423c;
  }
}

.filter-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }
.filter-row .period-bar { flex: 1 1 22rem; margin-bottom: 0; }
.filter-row > select { flex: 0 1 16rem; }

.stat-value.plain { font-variant-numeric: normal; }

.chart-wrap { margin-top: 0.5rem; min-height: 220px; }
.chart { display: block; overflow: visible; }
.chart-grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart-axis { stroke: var(--chart-axis); stroke-width: 1; }
.chart-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-bar.s1, .chart-swatch.s1, .split-part.s1 { fill: var(--s1); background: var(--s1); }
.chart-bar.s2, .chart-swatch.s2, .split-part.s2 { fill: var(--s2); background: var(--s2); }
.chart-bar.s3, .chart-swatch.s3, .split-part.s3 { fill: var(--s3); background: var(--s3); }
.chart-bar.quiet { fill: var(--quiet); }
.chart-hit { fill: transparent; outline: none; }
.chart-hit.pick { cursor: pointer; }
.chart-hit:hover, .chart-hit:focus-visible { fill: var(--text); fill-opacity: 0.06; }

.chart-tip {
  position: absolute; z-index: 30; pointer-events: none;
  background: var(--text); color: var(--card);
  border-radius: 8px; padding: 0.4rem 0.6rem; font-size: 0.8rem; line-height: 1.3;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); max-width: 16rem;
}
.chart-tip-title { font-weight: 700; }
.chart-tip-line { font-variant-numeric: tabular-nums; }

.chart-legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; margin-top: 0.6rem; font-size: 0.85rem; color: var(--text); }
.chart-key { display: inline-flex; align-items: center; gap: 0.4rem; }
.chart-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.chart-table { margin-top: 0.6rem; }
.chart-table summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; }
.table-scroll { overflow-x: auto; }
.chart-table table { border-collapse: collapse; width: 100%; margin-top: 0.4rem; font-size: 0.85rem; }
.chart-table th, .chart-table td { text-align: left; padding: 0.3rem 0.5rem; border-top: 1px solid var(--line); font-weight: 400; }
.chart-table thead th { border-top: 0; color: var(--muted); font-weight: 600; }
.chart-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Ranked bars: a name, a bar and a figure per row. On a narrow screen the bar drops under the name. */
.bars { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.bars-row {
  display: grid; grid-template-columns: minmax(7rem, 20rem) minmax(4rem, 1fr) auto; column-gap: 0.75rem; row-gap: 0;
  align-items: center; width: 100%; padding: 0.4rem 0; border: 0; border-top: 1px solid var(--line);
  background: none; color: var(--text); font: inherit; text-align: left; min-height: 0; border-radius: 0;
}
.bars li:first-child .bars-row { border-top: 0; }
.bars-row.pick { cursor: pointer; }
.bars-row.pick:hover, .bars-row.pick:focus-visible { background: var(--bg); }
.bars-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars-track { display: block; height: 12px; }
.bars-fill { display: block; height: 100%; background: var(--s1); border-radius: 0 4px 4px 0; }
.bars-value { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.bars-note { grid-column: 3; text-align: right; font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
@media (max-width: 640px) {
  .bars-row { grid-template-columns: minmax(0, 1fr) auto; }
  .bars-track { grid-column: 1 / -1; grid-row: 3; margin-top: 0.25rem; height: 8px; }
  .bars-note { grid-column: 1 / -1; grid-row: 2; text-align: left; }
}

/* One whole split into a few parts. */
.split-bar { display: flex; gap: 2px; height: 28px; margin-top: 0.6rem; }
.split-part {
  flex: 1 1 0; min-width: 2px; border-radius: 4px; color: #ffffff; font-size: 0.8rem; font-weight: 600;
  display: flex; align-items: center; padding-left: 0.4rem; overflow: hidden; white-space: nowrap;
}

.crumbs { font-size: 0.9rem; color: var(--muted); margin: 0 0 0.4rem; }
.crumbs .link { font-size: inherit; }

/* A dashed level across a column chart: an average or a budget. */
.chart-level { stroke: var(--text); stroke-width: 2; stroke-dasharray: 6 4; pointer-events: none; }
.chart-level-plate { fill: var(--card); fill-opacity: 0.92; pointer-events: none; }
.chart-level-text { fill: var(--text); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; }
.chart-dash { width: 18px; height: 0; border-top: 2px dashed var(--text); display: inline-block; }

/* ---------------------------------------------------------------- budget */

.insight-tabs { margin: 0 0 0.75rem; }
.stat-value.bad, .budget-table .bad { color: var(--error); }

.budget-group { margin-top: 1rem; }
.budget-group-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; }
.budget-group-head h3 { margin: 0; font-size: 1rem; }
.budget-rows { list-style: none; margin: 0.25rem 0 0; padding: 0; }
.budget-row {
  /* Fixed outer columns, so every bar starts and ends at the same place and the today marks line up. */
  display: grid; grid-template-columns: 11rem minmax(4rem, 1fr) 13.5rem; column-gap: 0.75rem;
  align-items: center; width: 100%; padding: 0.45rem 0; border: 0; border-top: 1px solid var(--line);
  background: none; color: var(--text); font: inherit; text-align: left; min-height: 0; border-radius: 0;
}
.budget-rows li:first-child .budget-row { border-top: 0; }
.budget-row.pick { cursor: pointer; }
.budget-row.pick:hover, .budget-row.pick:focus-visible { background: var(--bg); }
.budget-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter { position: relative; display: block; height: 12px; background: var(--chart-grid); border-radius: 4px; }
.meter-fill { display: block; height: 100%; background: var(--s1); border-radius: 4px; }
.meter-fill.over { background: var(--error); }
.meter-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); }
.budget-figures { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 0.9rem; }
.budget-standing { grid-column: 3; text-align: right; font-size: 0.8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.budget-left { color: var(--muted); }
.budget-over { color: var(--error); font-weight: 700; }
@media (max-width: 640px) {
  .budget-row { grid-template-columns: minmax(0, 1fr) auto; }
  .meter { grid-column: 1 / -1; grid-row: 3; margin-top: 0.3rem; height: 8px; }
  .budget-standing { grid-column: 1 / -1; grid-row: 2; text-align: left; }
}

button.row-button { width: 100%; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; border-radius: 0; }

.budget-table { border-collapse: collapse; width: 100%; font-size: 0.88rem; margin-top: 0.5rem; }
.budget-table th, .budget-table td { text-align: left; padding: 0.4rem 0.5rem; border-top: 1px solid var(--line); font-weight: 400; }
.budget-table thead th { border-top: 0; color: var(--muted); font-weight: 600; font-size: 0.8rem; }
.budget-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.budget-table tr.group th { font-weight: 700; padding-top: 0.8rem; }
.budget-table tfoot th, .budget-table tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
.budget-table .link { font-size: inherit; text-align: left; }

.budget-edit-group { margin-top: 0.9rem; border-top: 1px solid var(--line); padding-top: 0.6rem; }
.budget-edit-group summary { cursor: pointer; font-weight: 700; }
.budget-edit-row { display: grid; grid-template-columns: minmax(0, 1fr) 7.5rem 7.5rem; gap: 0.5rem; align-items: center; padding: 0.4rem 0; }
.budget-edit-row input, .budget-edit-row select { margin: 0; min-width: 0; }
.budget-edit-row input { text-align: right; }
@media (max-width: 640px) {
  .budget-edit-row { grid-template-columns: 1fr 1fr; }
  .budget-edit-row .row-main { grid-column: 1 / -1; }
}

/* A repayment with the box that says what it was for. */
.refund-row { flex-wrap: wrap; gap: 0.5rem; }
.refund-row select { flex: 1 1 14rem; max-width: 20rem; margin: 0; }

/* The result of "use my averages", shown under the buttons; changed figures are outlined. */
.avg-note:empty { display: none; }
.avg-note { margin-top: 0.9rem; padding: 0.75rem 1rem; border: 1px solid var(--ok); border-radius: 10px; }
.avg-note p { margin: 0 0 0.3rem; }
.avg-note ul { margin: 0.3rem 0 0; padding-left: 1.2rem; }
.budget-edit-row input.changed { border-color: var(--accent); border-width: 2px; }

/* ---------------------------------------------------------------- net worth */
.item-detail { padding: 0.25rem 0 1rem; border-top: 1px dashed var(--line); }
.item-detail h3 { margin: 0.9rem 0 0.2rem; font-size: 1rem; }
.item-detail ul.small { margin: 0.6rem 0 0; padding-left: 1.2rem; }
.inline-form .btn { margin-top: 0.9rem; }
.item-detail .group-links { margin-top: 0.75rem; }

/* ---------------------------------------------------------------- savings and goals */
.goals { list-style: none; margin: 0; padding: 0; }
.goal { padding: 0.7rem 0; border-top: 1px solid var(--line); }
.goals .goal:first-child { border-top: 0; }
.goal-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; margin-bottom: 0.35rem; }
.goal .meter { margin-bottom: 0.35rem; }
.goal .group-links { margin-top: 0.3rem; }

/* One line of where things stand, on Home. */
.glance { display: block; padding: 0.6rem 0; border-top: 1px solid var(--line); color: inherit; text-decoration: none; }
.glance:first-child { border-top: 0; padding-top: 0; }
.glance:last-child { padding-bottom: 0; }
.glance-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; }
.glance .meter { margin: 0.35rem 0 0.25rem; }
.glance .small { display: block; }

/* Forecast: the plain-language results. */
.findings { margin: 0.9rem 0 0.6rem; padding-left: 1.2rem; }
.findings li { margin-bottom: 0.3rem; }

/* ================================================================ layout by screen
   Three sizes. A computer (1000px and wider) has a fixed side menu and a wide page laid out in
   two columns. In between, the same menu slides in from a Menu button. A phone (700px and
   narrower) is for capturing only and shows just those links, as a bar at the thumb. */

.nav-brand, .nav-title, .menu-button, .nav-shade { display: none; }
.nav-group { display: contents; }

/* ---- the side menu, shared by the computer and in-between sizes */
@media (min-width: 701px) {
  .nav {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 20;
    width: 16.5rem; display: flex; flex-direction: column; justify-content: flex-start; gap: 0;
    padding: 1rem 0.75rem 1.5rem; overflow-y: auto;
    background: var(--card); border-right: 1px solid var(--line); border-bottom: 0;
  }
  .nav-brand { display: block; font-weight: 700; font-size: 1.05rem; padding: 0.25rem 0.6rem 1rem; }
  .nav-group { display: block; margin-top: 1rem; }
  .nav-title {
    display: block; padding: 0 0.6rem 0.3rem; font-size: 0.72rem; font-weight: 700;
    letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  }
  .nav a {
    display: block; flex: none; text-align: left; padding: 0.5rem 0.6rem; border-radius: 8px;
    font-size: 0.95rem; font-weight: 500; color: var(--text);
  }
  .nav a:hover { background: var(--bg); }
  .nav a.active { background: var(--bg); color: var(--accent); font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
  .nav a.add { text-align: center; font-weight: 650; color: var(--accent-text); background: var(--accent); padding: 0.6rem; }
  .nav a.add:hover, .nav a.add.active { background: var(--accent); color: var(--accent-text); box-shadow: none; }
}

/* ---- in between: the menu is a drawer */
@media (min-width: 701px) and (max-width: 999px) {
  .nav { transform: translateX(-100%); transition: transform 0.15s ease; box-shadow: 0 0 30px rgba(0, 0, 0, 0.25); }
  body.nav-open .nav { transform: none; }
  .nav-shade { display: block; position: fixed; inset: 0; z-index: 15; background: rgba(0, 0, 0, 0.35); }
  .menu-button {
    display: inline-block; min-height: 40px; padding: 0 0.9rem; border: 1px solid var(--line);
    border-radius: 8px; background: var(--card); color: var(--text); font-weight: 600;
  }
  main { max-width: 52rem; }
}
@media (prefers-reduced-motion: reduce) { .nav { transition: none; } }

/* ---- a computer */
@media (min-width: 1000px) {
  :root { font-size: 15px; }
  body:has(#nav:not([hidden])) .topbar, body:has(#nav:not([hidden])) main { margin-left: 16.5rem; }
  .topbar { padding: 0.6rem 2rem; position: sticky; top: 0; z-index: 10; }
  main { max-width: none; padding: 1.5rem 2rem 3rem; }
  #view-app { max-width: 84rem; margin: 0 auto; }

  /* The page: two balanced columns. Headline figures, tables and filters run the full width;
     everything else fills the columns, so a short card never leaves a hole beside a tall one. */
  #page > div { columns: 2; column-gap: 1.25rem; }
  #page > div > * { column-span: all; margin: 0 0 1.25rem; min-width: 0; }
  #page > div > .card { column-span: none; break-inside: avoid; }
  #page > div > .card:has(> .stats), #page > div > .card:has(> div > .stats),
  #page > div > .card:has(> .table-scroll), #page > div > .card.notice { column-span: all; }
  /* A page that is one card, such as Capture, sits in the middle at a comfortable width. */
  #page > div > .card:only-child { column-span: all; max-width: 46rem; margin-left: auto; margin-right: auto; }

  /* Setup wraps its cards in a plain block: the same two columns apply inside it. */
  #page > div > div:not([class]) { columns: 2; column-gap: 1.25rem; }
  #page > div > div:not([class]) > .card { break-inside: avoid; margin: 0 0 1.25rem; }
  #page > div > div:not([class]) > .card:only-child { column-span: all; max-width: 52rem; }
  /* The expenses list is the page: it takes the full width. */
  body[data-page="expenses"] #page > div > .card { column-span: all; }
  /* In a column a ranked bar stacks its figures, as it does on a narrow screen. */
  #page > div > .card:not(:has(> .stats)) .bars-row { grid-template-columns: minmax(0, 1fr) auto; }
  #page > div > .card:not(:has(> .stats)) .bars-track { grid-column: 1 / -1; grid-row: 3; margin-top: 0.25rem; height: 8px; }
  #page > div > .card:not(:has(> .stats)) .bars-note { grid-column: 1 / -1; grid-row: 2; text-align: left; white-space: normal; }

  .card { padding: 1.4rem 1.5rem; border-radius: 12px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); }
  h1 { font-size: 1.35rem; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; }
  .stat { padding: 1rem; }
  .stat-value { font-size: 1.6rem; }

  /* Controls sized for a mouse, not a thumb. */
  input, select { min-height: 40px; padding: 0.45rem 0.7rem; border-radius: 8px; }
  .btn { display: inline-block; width: auto; min-height: 40px; line-height: 40px; padding: 0 1.25rem; margin-right: 0.5rem; border-radius: 8px; }
  button[type=submit] { width: auto; min-height: 40px; padding: 0 1.5rem; border-radius: 8px; }
  button.icon { min-width: 40px; min-height: 40px; }
  .filter-row, .period-bar { margin-top: 0; }
  .period-bar { max-width: 46rem; }

  /* These are in the side menu on a computer. */
  .card > a.btn[href="#/capture"], .card > a.btn[href="#/meters"], .card > a.btn[href="#/cash"] { display: none; }
  .budget-row { grid-template-columns: 10rem minmax(4rem, 1fr) 12.5rem; }
}

/* ---- a phone: capture only */
@media (max-width: 700px) {
  .nav a:not(.phone) { display: none; }
  .nav a.phone { flex: 1 1 0; text-align: center; }
  .nav a.phone.active { color: var(--accent); background: var(--bg); }
  .nav a.add.phone, .nav a.add.phone.active { color: var(--accent-text); background: var(--accent); }
  /* Reviewing slips is done on a computer. */
  body.phone a[href="#/expenses"] { display: none; }
}

/* ---------------------------------------------------------------- what changed (Home) */
.move-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 0.5rem; }
.move-head-change { display: flex; align-items: center; gap: 0.6rem; }
.move-head-arrow { font-size: 1.5rem; line-height: 1; }
.move-title { font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 1.1rem 0 0.2rem; }
.moves { list-style: none; margin: 0; padding: 0; }
.moves > li { border-top: 1px solid var(--line); }
.moves > li:first-child { border-top: 0; }
.move {
  display: grid; grid-template-columns: 1.4rem minmax(0, 1fr) auto; column-gap: 0.5rem; row-gap: 0.1rem; align-items: baseline;
  width: 100%; padding: 0.55rem 0.25rem; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.move:hover, .move:focus-visible { background: var(--bg); }
.move-arrow { grid-row: 1 / span 2; align-self: center; font-size: 0.95rem; text-align: center; }
.move-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.move-now { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.move-change { grid-column: 2; font-size: 0.88rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.move-note { grid-column: 3; text-align: right; font-size: 0.8rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.move-meter { grid-column: 2 / -1; height: 6px; margin-top: 0.35rem; }
/* More spending is shown in the warning colour and less in the good one; the arrow and words say the same. */
.move-arrow.up, .move-change.up, .move-head-change.up .move-head-arrow { color: var(--error); }
.move-arrow.down, .move-change.down, .move-head-change.down .move-head-arrow { color: var(--ok); }
.move-arrow.flat, .move-change.flat, .move-head-change.flat .move-head-arrow { color: var(--muted); }
@media (max-width: 480px) { .move-note { grid-column: 2 / -1; text-align: left; } }

/* ---------------------------------------------------------------- capture: who paid, then the photo */
.label.step { display: block; font-size: 1rem; font-weight: 700; color: var(--text); margin: 0 0 0.5rem; }
/* The choices as equal blocks across the width, so three fit on a phone without one dropping to a second row. */
.chips.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(4.8rem, 1fr)); gap: 0.5rem; padding: 2px; border-radius: 14px; }
.chips.choice .chip span {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 60px; padding: 0.5rem 0.4rem;
  border-radius: 12px; border-width: 2px; text-align: center; line-height: 1.25; font-weight: 600; background: var(--card);
}
.chips.choice .chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
/* Tried to take a photo before choosing: the choices are outlined and the message says why. */
.chips.choice.needed { outline: 3px solid var(--error); outline-offset: 3px; }
.chips.choice.needed .chip span { border-color: var(--error); }
.pick-msg:empty { display: none; }
.pick-msg { margin: 0.6rem 0 0; font-weight: 700; }
.capture-actions { margin-top: 1.1rem; }
.capture-actions .btn:first-of-type { margin-top: 0; }
/* Until who paid is chosen the buttons look held back. They still respond, to say what is missing. */
.capture-actions.waiting .btn { opacity: 0.45; }

/* ---------------------------------------------------------------- meter readings */
/* The reading in two boxes with the comma between them, as the meter shows it. */
.meter-digits { display: grid; grid-template-columns: minmax(0, 3fr) auto minmax(0, 2fr); column-gap: 0.4rem; align-items: end; }
.meter-digits input { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.04em; text-align: right; }
.meter-digits .field:last-child input { text-align: left; color: var(--error); }
.meter-comma { font-size: 2rem; font-weight: 700; line-height: 48px; }
.facts-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.75rem; margin-bottom: 0.75rem; }

/* The meter reading as one box that places its own comma, with what it reads as underneath. */
#m-reading { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.05em; }
.meter-preview:empty { display: none; }
.meter-preview { margin: 0.4rem 0 0.2rem; font-weight: 700; color: var(--ok); }
.small-check { font-size: 0.88rem; color: var(--muted); }

/* ---------------------------------------------------------------- side menu: headings against pages
   A heading is small, grey, set off by a rule and cannot be clicked. A page has an icon, sits
   indented under its heading, and reacts to the pointer. */
.nav-icon { display: none; }
.nav-label-phone { display: none; }
@media (min-width: 701px) {
  .nav-group { margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px solid var(--line); }
  .nav-title {
    padding: 0 0.6rem 0.45rem; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.09em;
    color: var(--muted); cursor: default; user-select: none;
  }
  .nav a { display: flex; align-items: center; gap: 0.65rem; padding: 0.5rem 0.6rem; margin: 1px 0; cursor: pointer; }
  .nav-group a { margin-left: 0.25rem; }
  .nav-icon {
    display: block; flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor;
    stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; color: var(--muted);
  }
  .nav a:hover .nav-icon, .nav a.active .nav-icon { color: var(--accent); }
  .nav a.active { box-shadow: none; background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
  .nav a.add { justify-content: center; margin-bottom: 0.25rem; }
  .nav a.add .nav-icon, .nav a.add:hover .nav-icon, .nav a.add.active .nav-icon { color: var(--accent-text); }
  .nav a.add.active { background: var(--accent); }
}
@media (max-width: 700px) {
  /* The phone bar says "Meter readings": that is what the page is there. */
  .nav a.phone:has(.nav-label-phone) .nav-label { display: none; }
  .nav-label-phone { display: inline; }
}

/* ---------------------------------------------------------------- review fixes, computer layout */
@media (min-width: 1000px) {
  /* The month's budget is one long list: it runs the full width with its groups in two columns. */
  #page > div > .card:has(> .budget-group) { column-span: all; columns: 2; column-gap: 2.5rem; }
  #page > div > .card:has(> .budget-group) > h2, #page > div > .card:has(> .budget-group) > p { column-span: all; }
  #page > div > .card:has(> .budget-group) > .budget-group { break-inside: avoid; margin: 0 0 1.25rem; }
  /* Water and electricity sit side by side. */
  body[data-page="meters"] #page > div > .card { column-span: none; }
  /* The expense form keeps its own two panes; the page cap for it must not catch other pages. */
  body[data-page="expense"] main, body[data-page="review"] main { max-width: 78rem; }
}
@media (min-width: 701px) { .nav a { white-space: nowrap; } .nav-label { overflow: hidden; text-overflow: ellipsis; } }
/* Figures inside a half-width card are a size smaller, so a long reading stays on one line. */
.facts-row .stat-value { font-size: 1.2rem; white-space: nowrap; }
.facts-row { grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); }

/* A newer version has been fetched in the background. */
.update-bar {
  position: fixed; left: 50%; bottom: calc(5.5rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 0.9rem; padding: 0.6rem 0.75rem 0.6rem 1rem; max-width: calc(100vw - 2rem);
  background: var(--text); color: var(--card); border-radius: 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); font-size: 0.92rem;
}
@media (min-width: 701px) { .update-bar { bottom: 1.5rem; } }
.loading-note { text-align: center; padding: 0.5rem 0; }

/* ---------------------------------------------------------------- statement import: one block per file */
.job { margin-top: 1rem; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: 10px; }
.job .card-head { margin-bottom: 0.4rem; }
.job-name { overflow-wrap: anywhere; }
.job .periods { display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.9rem; }
.job .periods dt { margin-top: 0; }
.job .two { align-items: center; }
.job .two > .btn, .job .two > button { margin-top: 0; }

/* The accounts still to load this month. */
.due-list { list-style: none; margin: 0 0 0.75rem; padding: 0; columns: 2; column-gap: 2rem; }
.due-list li { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.3rem 0; border-bottom: 1px solid var(--line); break-inside: avoid; }
@media (max-width: 900px) { .due-list { columns: 1; } }

/* ---------------------------------------------------------------- search on Spending */
.search-row { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }
.search-row input { flex: 1; background: var(--card); }
.search-row .btn-small { flex: none; min-height: 40px; }

/* Stacked columns: the fourth part ("Other") is grey, and months outside the chosen period are faint. */
.chart-swatch.quiet { background: var(--quiet); }
.chart-bar.faded { opacity: 0.38; }

/* A household with no business has no loan accounts page. */
body.no-business #nav a[href="#/loan"] { display: none; }

/* ---------------------------------------------------------------- last three captured slips */
.recent-slips { list-style: none; margin: 0; padding: 0; }
.recent-slips li + li { border-top: 1px solid var(--line, #e3e6e1); }
.recent-slip { display: flex; gap: 0.75rem; align-items: center; padding: 0.6rem 0; color: inherit; text-decoration: none; }
.recent-thumb { flex: none; width: 56px; height: 72px; border-radius: 6px; overflow: hidden; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; color: var(--muted, #667); }
.recent-thumb img { width: 100%; height: 100%; object-fit: cover; }
.recent-main { flex: 1; min-width: 0; }
.recent-main .row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-main .badge { margin-top: 0.3rem; display: inline-block; }
.quiet-text { color: var(--muted, #667); font-weight: 500; }
.badge.state-approved { border-color: var(--ok); color: var(--ok); }
.badge.state-rejected { border-color: var(--error); color: var(--error); }
.badge.state-pending { border-color: var(--muted); color: var(--text); }
.badge.state-reading { border-style: dashed; }

/* ---------------------------------------------------------------- income page */
table.chart-table { width: 100%; border-collapse: collapse; }
table.chart-table th, table.chart-table td { padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); text-align: left; }
table.chart-table th.num, table.chart-table td.num { text-align: right; }
table.chart-table tbody tr:last-child th, table.chart-table tbody tr:last-child td { border-bottom: 0; font-weight: 600; }
table.income-entries tbody tr:last-child td { font-weight: 400; }
.income-entries select { min-height: 36px; padding: 0.2rem 0.4rem; max-width: 12rem; }

/* The income page reads top to bottom: every card takes the full width. */
body[data-page="income"] #page > div > .card { column-span: all; }

/* ---------------------------------------------------------------- meter capture, step by step */
.meter-form .field { margin-bottom: 1.35rem; }
.meter-form .chips + p { margin-top: 0.5rem; }
.meter-form #m-reading { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.05em; text-align: center; min-height: 60px; }
.meter-preview strong, .meter-preview span { display: block; }
.meter-preview span { font-weight: 500; color: var(--text); font-size: 0.95rem; margin-top: 0.15rem; }
.meter-preview span.warn-text { color: var(--error); }
.meter-form .receipt .btn { width: 100%; }
.meter-choose { display: block; margin: 0.6rem auto 0.2rem; }
.meter-stamp-note { margin: 0.5rem 0 0.6rem; font-size: 0.9rem; color: var(--muted); }
.meter-more { margin: 0 0 1rem; }
.meter-more summary { padding: 0.4rem 0; }
.meter-saved { margin-top: 0; }

/* ---------------------------------------------------------------- a drop-down you can type in */
.picker { position: relative; min-width: 0; }
.picker-input { width: 100%; }
.picker-input.unsure { border-color: var(--error); }
.picker-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 0.25rem 0; list-style: none;
  max-height: 17rem; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}
.picker-option { display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.6rem 0.9rem; cursor: pointer; min-height: 44px; align-items: center; }
.picker-option.active, .picker-option:hover { background: var(--bg); }
.picker-option[aria-selected="true"] { font-weight: 700; }
.picker-in { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
.picker-group { padding: 0.5rem 0.9rem 0.2rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.picker-none { padding: 0.6rem 0.9rem; color: var(--muted); font-size: 0.9rem; }
.group-actions .picker { flex: 1 1 14rem; }

/* ---------------------------------------------------------------- administration and first-time setup */
#nav a.admin-only { display: none; }
body.is-admin:not(.phone) #nav a.admin-only { display: flex; }
.admin-table td { vertical-align: top; }
#view-onboard .check { margin: 1rem 0 0.25rem; }

/* ---------------------------------------------------------------- bank lines: two piles */
.pile { margin-top: 1.25rem; padding-top: 0.25rem; }
.pile h3 { margin-bottom: 0.25rem; }
.pile .btn { margin: 0.5rem 0 0.75rem; }
.suggest-status:empty { display: none; }
.suggest-status { padding: 0.6rem 0.9rem; border: 1px dashed var(--line); border-radius: 10px; }

/* Administration reads top to bottom: every card takes the full width. */
body[data-page="admin"] #page > div > .card { column-span: all; }

/* ---------------------------------------------------------------- help, support and leaving */
body[data-page="help"] #page > div > .card { column-span: all; }
.support-text { margin: 0.4rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.support-reply { margin-top: 0.6rem; padding: 0.5rem 0.75rem; border-left: 3px solid var(--ok); background: var(--bg); border-radius: 0 8px 8px 0; }
.support-answer { margin-top: 0.6rem; }
.support-answer textarea, #hp-message { width: 100%; }
.support-list .row { align-items: flex-start; }
.danger-zone { border-color: var(--error); }
.btn.danger { background: var(--error); border-color: var(--error); color: #fff; margin-top: 0.75rem; }

/* ---------------------------------------------------------------- the guide, and first steps */
.guide-link { margin-left: auto; margin-right: 1rem; white-space: nowrap; }
body[data-page="guide"] #page > div > .card { column-span: all; }
body[data-page="guide"] main { max-width: 60rem; }
.guide-section { scroll-margin-top: 4.5rem; }
.start-steps { list-style: none; padding: 0; margin: 0.5rem 0 0.9rem; }
.start-steps li { display: grid; grid-template-columns: 1.6rem 1fr auto; gap: 0.5rem; align-items: center; padding: 0.45rem 0; border-top: 1px solid var(--line); }
.start-steps li.done > span:nth-child(2) { color: var(--muted); }
.start-mark { width: 1.3rem; height: 1.3rem; border: 2px solid var(--line); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; }
.start-steps li.done .start-mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.start-card .btn { margin-right: 0.5rem; }

/* ---------------------------------------------------------------- administration: allowances and the alert */
#nav a.admin-only.has-alert .nav-label::after { content: ''; display: inline-block; width: 8px; height: 8px; margin-left: 0.5rem; border-radius: 50%; background: var(--error); vertical-align: middle; }
.allowance-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.6rem; margin: 0.5rem 0; }
.allowance-form label { display: grid; gap: 0.2rem; }
.allowance-form input { min-height: 38px; }
@media (max-width: 700px) { .topbar .who { display: none; } }

/* ---------------------------------------------------------------- the guide: tiles, icons and call-outs */
.guide-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.guide-badge { flex: none; width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--accent) 12%, var(--card)); color: var(--accent); }
.guide-top > p { max-width: 46rem; line-height: 1.55; }
.guide-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; margin: 0.25rem 0 1rem; font-size: 0.9rem; color: var(--muted); }
.guide-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.guide-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr)); gap: 0.6rem; }
.guide-tile { display: flex; align-items: center; gap: 0.75rem; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none; background: var(--card); }
.guide-tile:hover, .guide-tile:focus-visible { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--card)); }
.guide-tile-text { display: grid; gap: 0.1rem; min-width: 0; }
.guide-tile-text span { font-size: 0.85rem; color: var(--muted); line-height: 1.3; }
.guide-head { display: flex; align-items: center; gap: 0.9rem; padding-bottom: 0.9rem; margin-bottom: 0.9rem; border-bottom: 1px solid var(--line); }
.guide-head h2 { margin: 0; }
.guide-head p { margin: 0.1rem 0 0; }
.guide-up { margin-left: auto; white-space: nowrap; font-size: 0.9rem; }
.guide-section > p, .guide-section li, .guide-note p { line-height: 1.6; }
.guide-section > p { max-width: 46rem; }
.guide-section h3 { margin: 1.4rem 0 0.4rem; font-size: 1.02rem; }
.guide-points { padding-left: 0; list-style: none; max-width: 46rem; }
.guide-points li { position: relative; padding-left: 1.4rem; margin-bottom: 0.45rem; }
.guide-points li::before { content: ''; position: absolute; left: 0.25rem; top: 0.6em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.guide-steps { list-style: none; padding-left: 0; counter-reset: step; max-width: 46rem; }
.guide-steps li { position: relative; counter-increment: step; padding: 0.15rem 0 0.15rem 2.6rem; margin-bottom: 0.55rem; min-height: 1.9rem; }
.guide-steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 700; font-size: 0.9rem; display: flex; align-items: center; justify-content: center; }
.guide-note { display: flex; gap: 0.8rem; align-items: flex-start; max-width: 46rem; margin: 1rem 0; padding: 0.85rem 1rem; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
.guide-note.ai { border-color: color-mix(in srgb, var(--s1) 45%, var(--line)); background: color-mix(in srgb, var(--s1) 7%, var(--card)); }
.guide-note.key { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); background: color-mix(in srgb, var(--ok) 6%, var(--card)); }
.guide-note p { margin: 0.2rem 0 0; }
.guide-note-title { font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.guide-note-icon { flex: none; width: 22px; height: 22px; margin-top: 0.1rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.guide-note.ai .guide-note-icon, .guide-note-icon.ai { color: var(--s1); }
.guide-note.key .guide-note-icon, .guide-note-icon.key { color: var(--ok); }
.guide-legend .guide-note-icon { margin-top: 0; width: 18px; height: 18px; }
.guide-tag { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 0.1rem 0.45rem; border-radius: 999px; background: var(--s1); color: #fff; }
@media (max-width: 700px) { .guide-up { display: none; } .guide-tiles { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- add expense: have the attached file read */
.read-offer { margin: 0.75rem 0; padding: 0.85rem 1rem; border: 1px solid var(--accent); border-radius: 12px; background: color-mix(in srgb, var(--accent) 5%, var(--card)); }
.read-offer .btn { width: 100%; }
.read-offer p { margin: 0.5rem 0 0; }

/* ---------------------------------------------------------------- nothing to review */
.review-empty-body { display: flex; align-items: center; gap: 0.9rem; margin: 0.25rem 0 0.25rem; }
.review-empty-body p { margin: 0; }
.review-empty-body p + p { margin-top: 0.2rem; }
.review-empty-mark { flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--card)); }

/* ---------------------------------------------------------------- the name and its line */
.nav-tagline { display: block; margin-top: 0.15rem; font-size: 0.74rem; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.login-brand { display: grid; gap: 0.15rem; margin-bottom: 1.1rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--line); }
.login-name { font-size: 1.7rem; font-weight: 750; letter-spacing: -0.01em; color: var(--accent); }
.login-tagline { color: var(--muted); }

/* ---------------------------------------------------------------- the logo mark beside the name */
.brand-mark { flex: none; width: 40px; height: 40px; border-radius: 10px; background: #fff; border: 1px solid var(--line); object-fit: cover; }
.brand-mark.big { width: 56px; height: 56px; border-radius: 14px; }
.brand-text { display: grid; min-width: 0; }
.login-brand { display: flex; align-items: center; gap: 0.85rem; }
.login-brand .brand-text { gap: 0.1rem; }
@media (min-width: 701px) { .nav-brand { display: flex; align-items: center; gap: 0.7rem; } }
