:root {
  --bg: #f6f7f4; --card: #ffffff; --ink: #1e2a22; --muted: #5d6b62; --line: #d9dfd9;
  --accent: #1f6b45; --accent-ink: #ffffff; --danger: #a3261b; --warn-bg: #fff5d6; --ok-bg: #e3f3e8;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121614; --card: #1b201d; --ink: #e6ece7; --muted: #9aa79e; --line: #2e3631;
    --accent: #4fae7d; --accent-ink: #0d1510; --danger: #ef7d71; --warn-bg: #3a3218; --ok-bg: #173323; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 880px; margin: 0 auto; padding: 24px 16px 64px; }
main.wide { max-width: 1280px; }
h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 24px 0 8px; }
p.sub { color: var(--muted); margin: 0 0 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.92rem; }
.field.wide { grid-column: 1 / -1; }
.field span { font-weight: 600; }
.field small { color: var(--muted); }
input, select, textarea { font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button { font: inherit; border-radius: 6px; padding: 9px 16px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--danger); border-color: var(--danger); }
button:disabled { opacity: 0.6; cursor: wait; }
.consent { display: flex; gap: 10px; align-items: flex-start; margin: 18px 0; font-size: 0.92rem; }
.consent input { width: auto; margin-top: 4px; }
.msg { border-radius: 8px; padding: 12px 14px; margin: 14px 0; }
.msg.error { background: var(--warn-bg); color: var(--ink); border-left: 4px solid var(--danger); }
.msg.ok { background: var(--ok-bg); border-left: 4px solid var(--accent); }
.hidden { display: none !important; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0; }
.toolbar input[type=search] { max-width: 280px; }
.tabs button[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--bg); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 0.8rem; border: 1px solid var(--line); }
.badge.pending { background: var(--warn-bg); }
.badge.approved { background: var(--ok-bg); }
dialog { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 32px); border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); padding: 0; }
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog form { padding: 20px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; margin-top: 18px; }
.admin-fields { border: 1px dashed var(--line); border-radius: 8px; padding: 14px; margin-bottom: 16px; }
.muted { color: var(--muted); font-size: 0.85rem; }
.pagenav { margin-top: 6px; font-size: 0.92rem; }
.pagenav a { color: var(--accent); }
input.amount { width: 9em; text-align: right; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.greyed { color: var(--muted); }
td.strong { font-weight: 600; }
.period { margin-top: 16px; }
.period h3 { font-size: 1rem; margin: 18px 0 6px; }
tr.household td { background: var(--bg); padding-top: 12px; }
.inline { display: inline-flex; gap: 6px; align-items: center; }
.captcha { margin: 12px 0; min-height: 65px; }

/* Larger, easier form for members (index.html, profile.html). */
body.friendly { font-size: 19px; line-height: 1.5; }
body.friendly main { max-width: 760px; }
body.friendly h1 { font-size: 1.8rem; }
body.friendly .field { font-size: 1rem; gap: 6px; }
body.friendly .field span { font-size: 1.05rem; }
body.friendly .field small { font-size: 0.9rem; }
body.friendly input, body.friendly select, body.friendly textarea { font-size: 1.1rem; padding: 12px 14px; min-height: 52px; border-width: 2px; }
body.friendly button { font-size: 1.1rem; padding: 14px 22px; min-height: 52px; }
body.friendly .grid { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 18px 22px; }
body.friendly .consent { font-size: 1rem; }
body.friendly .consent input { width: 26px; height: 26px; min-height: 0; }
.form-section { border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px 20px; margin: 0 0 18px; }
.form-section legend { font-weight: 700; font-size: 1.15rem; padding: 0 8px; color: var(--accent); }
body.friendly .muted { font-size: 0.95rem; }
.badge.incomplete { background: var(--warn-bg); border-color: var(--danger); }
.diff-old { color: var(--muted); text-decoration: line-through; }
.diff-new { font-weight: 600; }
.code-step { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
input.code-input { font-size: 1.6rem; letter-spacing: 0.3em; max-width: 12em; text-align: center; }
.consent.keep { margin: 10px 0 14px; }
/* Clear secondary action: outlined in the accent colour, so it reads as a button, not a label. */
button.secondary { background: transparent; color: var(--accent); border: 2px solid var(--accent); font-weight: 600; }
button.secondary:hover, button.secondary:focus-visible { background: var(--accent); color: var(--accent-ink); }

/* Page header: title on the left, a small Sign out button pinned to the top-right corner. */
main > .toolbar:first-child { flex-wrap: nowrap; align-items: flex-start; justify-content: space-between; }
main > .toolbar:first-child > div { min-width: 0; }
#signout, body.friendly #signout { flex-shrink: 0; margin-left: auto; padding: 6px 12px; min-height: 0; font-size: 0.9rem; }
