/* Sundown — same-day pay and its ledger. Brand kit in brand/: Midnight #0B1D3A, Sunrise #FFB400, Sunset #FF6A00,
   Mist #F4F6FA, Inter. Quiet neutrals from Midnight; the orange belongs to the sun mark and to money still owed;
   green means money went out. Light and dark follow the phone. Every amount is set in lined-up figures. */
:root {
  color-scheme: light;
  --bg: #f4f6fa; --surface: #ffffff; --raised: #f8f9fc; --ink: #0f1b2e; --soft: #556074; --muted: #7c8698;
  --line: rgba(15, 27, 46, .1); --line-strong: rgba(15, 27, 46, .18);
  --primary: #0b1d3a; --on-primary: #ffffff;
  --accent: #b8480c;                       /* links and selection: Sunset, darkened to read on white */
  --owed: #b8480c; --owed-soft: #fff3e8;   /* still to pay */
  --green: #1c7a4d; --green-soft: #e8f5ee; --warn: #9a5b00; --warn-soft: #fdf3e1; --red: #b42318; --red-soft: #fdecea;
  --focus: #ff8a00;
  --font: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #08142a; --surface: #0e1d37; --raised: #132544; --ink: #edf1f7; --soft: #a3aec0; --muted: #7d889c;
    --line: rgba(237, 241, 247, .09); --line-strong: rgba(237, 241, 247, .18);
    --primary: #f4f6fa; --on-primary: #0b1d3a;
    --accent: #ffb04d;
    --owed: #ffa34d; --owed-soft: rgba(255, 138, 0, .12);
    --green: #5cc994; --green-soft: rgba(92, 201, 148, .12); --warn: #f2b24c; --warn-soft: rgba(242, 178, 76, .12);
    --red: #f4877c; --red-soft: rgba(244, 135, 124, .12);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
main { max-width: 1040px; margin: 0 auto; padding: 20px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px)); }
.num, .val, .money, td.num, .jline, .weekstrip .m, .paidmark, input[inputmode="decimal"] { font-variant-numeric: tabular-nums; }

/* Header: the sun mark and the name, then five places. Sticky, never wider than the screen. */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 20px;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  padding-top: max(10px, env(safe-area-inset-top, 0px));
  background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none;
  font-weight: 600; font-size: 18px; letter-spacing: -.01em; }
.brand .mark { width: 28px; height: 25px; flex: none; }
.top nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.top nav::-webkit-scrollbar { display: none; }
.top nav a { padding: 6px 10px; border-radius: 8px; color: var(--soft); text-decoration: none; font-weight: 500;
  font-size: 15px; white-space: nowrap; }
.top nav a:hover { color: var(--ink); background: var(--raised); }
.top nav a.here { color: var(--ink); background: var(--raised); box-shadow: inset 0 0 0 1px var(--line); }

/* Page heads */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.page-head > div { min-width: 0; }
h1 { margin: 0; font-size: 26px; line-height: 1.2; font-weight: 600; letter-spacing: -.015em; }
h1 .date { color: var(--soft); font-weight: 400; font-size: 17px; margin-left: 6px; letter-spacing: 0; }
h2 { margin: 0; font-size: 17px; line-height: 1.3; font-weight: 600; }
h2 a { color: inherit; text-decoration: none; }
h2 a:hover { text-decoration: underline; }
.sub { margin: 2px 0 0; color: var(--soft); font-size: 14px; }
.nowrap { white-space: nowrap; }
.daynav { display: flex; gap: 8px; flex-wrap: wrap; }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 12px; min-width: 0; }
.card.person.done, .card.done { background: var(--surface); box-shadow: inset 3px 0 0 var(--green); }
.card-head { display: flex; justify-content: space-between; gap: 8px 12px; align-items: baseline; flex-wrap: wrap; }
.card-head > div { min-width: 0; }
.card > .card-head:not(:last-child) { margin-bottom: 14px; }
.paidmark { font-weight: 600; color: var(--green); }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; border: 1px solid transparent; }
.flash.success { background: var(--green-soft); color: var(--green); }
.flash.error { background: var(--red-soft); color: var(--red); }
.flash.note { background: var(--surface); border-color: var(--line); }
.flash.warn { background: var(--warn-soft); color: var(--warn); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.warn-text { color: var(--warn); font-weight: 500; }
.tag { font-size: 12px; font-weight: 500; padding: 1px 7px; border-radius: 999px; background: var(--green-soft); color: var(--green); vertical-align: 1px; }
ul.plain { margin: 6px 0 0; padding-left: 18px; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; }

/* The day's two numbers, side by side even on a phone: what's left to pay, and what went out. */
.moneyhead { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; margin-bottom: 12px; }
.tile { padding: 14px 16px; min-width: 0; }
.tile + .tile { border-left: 1px solid var(--line); }
.tile .lab { color: var(--soft); font-size: 13px; font-weight: 500; }
.tile .val { font-size: 28px; font-weight: 600; line-height: 1.2; letter-spacing: -.02em; }
.tile .foot { color: var(--soft); font-size: 13px; margin-top: 4px; }
.tile.owed .val { color: var(--owed); }
.tile.clear .val { color: var(--ink); }
.tile.done .val { color: var(--green); }
.tile .btn { margin-top: 8px; }

/* Monday to Sunday, with what each day cost. */
.weekstrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; padding: 6px; margin-bottom: 16px; }
.weekstrip a { text-align: center; padding: 6px 2px; border-radius: 8px; text-decoration: none; color: var(--ink); min-width: 0; }
.weekstrip a:hover { background: var(--raised); }
.weekstrip a.on { background: var(--primary); color: var(--on-primary); }
.weekstrip .d { display: block; font-size: 12px; color: inherit; opacity: .7; white-space: nowrap; }
.weekstrip .m { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* No clock-out: CleanSee counts the shift as 0 until you set the hours. */
.openflag { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: 14px;
  margin: 12px 0 0; display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.openflag b { color: var(--ink); font-weight: 600; }

/* Still clocked in today (1.3): a calm note, not a warning. The live dot is the one sign that something's going. */
.live { color: var(--green); font-weight: 500; white-space: nowrap; }
.live::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  margin-right: 6px; vertical-align: 1px; }
.inprog { background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px;
  margin: 12px 0 0; display: grid; gap: 6px; }
.inprog p { margin: 0; }
.inprog p .sub { display: block; margin-top: 2px; }
.inprog b { font-weight: 600; font-variant-numeric: tabular-nums; }
.paynow { margin-top: 12px; }
.paynow > summary { list-style: none; display: inline-flex; cursor: pointer; }
.paynow > summary::-webkit-details-marker { display: none; }
.paynow[open] > summary { margin-bottom: 4px; }

/* One line per clock-in: where it started and ended, the hours to pay, what that line comes to. */
.jobrows { margin: 12px 0 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); overflow: hidden; }
.jobrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 12px; padding: 12px;
  border-bottom: 1px solid var(--line); }
.jobrow .jwhere { grid-column: 1 / -1; font-size: 15px; line-height: 1.35; min-width: 0; }
.jobrow .jwhere b { font-weight: 600; }
.jobrow .jwhere .sub { display: block; font-size: 13px; }
.jobrow .places { display: flex; flex-wrap: wrap; gap: 0 12px; font-size: 13px; color: var(--soft); margin-top: 2px; }
.jobrow .places .bad { color: var(--warn); font-weight: 500; }
.jobrow.away { box-shadow: inset 3px 0 0 var(--warn); }
.jobrow label { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--soft); font-weight: 500; }
.jobrow label input:not([type=hidden]):not([type=checkbox]) { width: 96px; }
.jobrow .math { grid-column: 2; grid-row: 2; align-self: end; padding-bottom: 10px; font-size: 13px; color: var(--soft); }
.jobrow .jline { grid-column: 3; grid-row: 2; align-self: end; padding-bottom: 8px; font-size: 17px; font-weight: 600; text-align: right; }
.jobrow .roundups { grid-column: 1 / -1; grid-row: 3; }
.jobtotal { display: flex; gap: 4px 10px; align-items: baseline; padding: 12px; flex-wrap: wrap; }
.jobtotal b { font-size: 22px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; margin-left: auto; }
.jobtotal .tot-h { font-size: 15px; font-variant-numeric: tabular-nums; }

/* The pay form */
.payform { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.payrow { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; align-items: end; }
.payrow label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--soft); font-weight: 500; min-width: 0; }
.payrow label.grow { grid-column: 1 / -1; }
input:not([type=checkbox]):not([type=hidden]), select { width: 100%; padding: 9px 11px; border: 1px solid var(--line-strong);
  border-radius: 9px; background: var(--surface); color: var(--ink); font-size: 16px; min-width: 0; }
select { appearance: none; -webkit-appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--soft) 50%), linear-gradient(135deg, var(--soft) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(255, 138, 0, .18); }
.payrow input[data-amount] { font-weight: 600; }
.amount-derived { display: flex; flex-direction: column; gap: 1px; grid-column: 1 / -1; }
.amount-derived b { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.saved-tick { color: var(--green); font-size: 13px; font-weight: 500; }
.pay-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.pay-actions .sub { margin: 0; }

/* Round the hours: each chip snaps from what was clocked. Signs say the direction; no colour coding needed. */
.roundups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 1.8fr) repeat(3, minmax(0, 1fr)); gap: 5px; }
.payrow .roundups { grid-column: 1 / -1; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 4px 0; text-align: center; white-space: nowrap;
  font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink); font-variant-numeric: tabular-nums; min-height: 32px; }
.chip:hover { background: var(--raised); }
.chip.dn, .chip.up { color: var(--ink); }

/* Buttons: one primary per screen */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); padding: 9px 14px; border-radius: 10px; font-size: 15px; font-weight: 500;
  text-decoration: none; cursor: pointer; min-height: 40px; white-space: nowrap; }
.btn:hover { background: var(--raised); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { opacity: .92; }
.btn.sm { padding: 5px 11px; font-size: 14px; min-height: 34px; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.wrap { gap: 12px; }
.row.wrap label { flex: 1 1 200px; }

/* Tables: quiet headings, figures right-aligned. table.stack turns into one block per row on a phone. */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; color: var(--soft); font-size: 13px; font-weight: 500; padding: 8px 8px 6px; border-bottom: 1px solid var(--line); }
td { padding: 9px 8px; border-top: 1px solid var(--line); vertical-align: top; }
tr:first-child td { border-top: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }

/* History: a ledger. One line per payment; on a phone it folds into two or three lines that keep the amount right. */
.ledger { list-style: none; margin: 0; padding: 0; }
.ledger li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 0; border-top: 1px solid var(--line);
  grid-template-areas: "who amt" "how state" "note note" "remove remove"; }
.ledger .who { grid-area: who; font-weight: 500; min-width: 0; }
.ledger .amt { grid-area: amt; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.ledger .how { grid-area: how; color: var(--soft); font-size: 14px; font-variant-numeric: tabular-nums; min-width: 0; }
.ledger .state { grid-area: state; color: var(--soft); font-size: 14px; text-align: right; white-space: nowrap; }
.ledger .note { grid-area: note; color: var(--soft); font-size: 14px; }
.ledger .state.sent { color: var(--green); }
.ledger .state.unsent { color: var(--warn); }
.ledger .remove { grid-area: remove; }
.ledger form { margin: 4px 0 0; }

/* Forms on Settings, Account, sign-in */
.settings label, .card.signin label { display: block; margin: 0 0 14px; font-weight: 500; font-size: 15px; }
.settings label input, .card.signin label input { margin-top: 6px; }
.settings .help { display: block; font-weight: 400; margin-top: 6px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
.card.signin { max-width: 420px; margin: 32px auto; padding: 24px 20px; }
.card.signin h1 { margin-bottom: 14px; }
.card.signin p.sub { margin-bottom: 14px; }
.signin-mark { display: block; width: 56px; height: 56px; margin: 0 0 14px; border-radius: 12px; }
.qr { display: flex; justify-content: center; margin: 6px 0 10px; padding: 12px; background: #fff; border-radius: 12px; }
.qr svg { max-width: 220px; height: auto; }
code.key { font-size: 13px; word-break: break-all; background: var(--raised); padding: 2px 6px; border-radius: 6px; }
input.copy { margin-top: 6px; font-size: 14px; }
.help-list { margin: 8px 0 0; padding-left: 20px; color: var(--soft); font-size: 15px; }
.help-list li + li { margin-top: 6px; }

/* Which business pays, once CleanSee has two */
.biz { font-size: 13px; font-weight: 500; color: var(--soft); white-space: nowrap; }

/* Footer: the versions and sign-out, quietly at the end of the page */
footer.version { max-width: 1040px; margin: 0 auto; padding: 0 16px 32px; padding-bottom: max(32px, env(safe-area-inset-bottom, 0px));
  color: var(--muted); font-size: 13px; text-align: center; }
footer.version form.inline { display: inline; margin: 0; }
button.linkish { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-size: inherit; }

@media (min-width: 720px) {
  .ledger li { grid-template-columns: minmax(150px, 1.1fr) minmax(0, 2.4fr) 110px 150px; align-items: baseline;
    grid-template-areas: "who how amt state" ". note . remove"; }
  .ledger .remove { text-align: right; }
  .pay-actions { flex-direction: row; justify-content: space-between; align-items: center; }
  .pay-actions .btn { flex: none; }
  .jobrow { grid-template-columns: minmax(200px, 1.5fr) auto auto minmax(60px, 1fr) auto; align-items: end; }
  .jobrow .jwhere { grid-column: 1; grid-row: 1; align-self: start; }
  .jobrow label { grid-column: 2; grid-row: 1; }
  .jobrow .roundups { grid-column: 3; grid-row: 1; padding-bottom: 4px; grid-template-columns: repeat(6, auto); }
  .jobrow .chip, .payrow .chip { padding: 4px 10px; }
  .payrow .roundups { grid-template-columns: repeat(6, auto); justify-content: start; }
  .jobrow .math { grid-column: 4; grid-row: 1; }
  .jobrow .jline { grid-column: 5; grid-row: 1; }
}
@media (max-width: 719px) {
  .top nav { width: 100%; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 2px; }
  .top nav.few { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top nav a { padding: 6px 1px; text-align: center; font-size: 13px; }
  .top nav .count { display: none; }
  .top nav a { position: relative; }
  .pay-actions .btn { width: 100%; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { padding: 10px 0; border-top: 1px solid var(--line); }
  table.stack tr:first-child { border-top: 0; }
  table.stack td { border: 0; padding: 1px 0; text-align: left; }
  table.stack td.sub { font-size: 14px; }
  table.stack .check { padding: 2px 0; }
  h1 { font-size: 24px; }
  .tile .val { font-size: 24px; }
}


/* ===== Sundown Books (2.0) ================================================================================
   The same quiet chrome: Midnight neutrals, one accent (Sunset, for what needs you), green for money in or done.
   Statements are set like paper: hairlines, figures right-aligned in lined-up numbers, totals ruled above. */
.count { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: var(--owed);
  color: #fff; font-size: 12px; line-height: 18px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 719px) { .top nav a .count { display: inline-block; position: absolute; top: -2px; right: 0; min-width: 16px; line-height: 16px; font-size: 11px; padding: 0 4px; margin: 0; } }

.bookbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin: -4px 0 16px; flex-wrap: wrap; }
.subnav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1 1 auto;
  -webkit-mask-image: linear-gradient(to right, #000 92%, transparent); mask-image: linear-gradient(to right, #000 92%, transparent); padding-right: 24px; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { padding: 6px 10px; border-radius: 8px; color: var(--soft); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; }
.subnav a:hover { color: var(--ink); background: var(--raised); }
.subnav a[aria-current] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* A segmented switch: which business, which basis, which year */
.seg { display: inline-flex; background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 2px; gap: 2px; flex: none; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg a { padding: 4px 12px; border-radius: 8px; color: var(--soft); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; }
.seg a[aria-current] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 27, 46, .12); }
.seg.wide { display: flex; margin-bottom: 12px; }

.toolbar { display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: center; margin: -4px 0 14px; }
.range { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0; }
.range select, .range input { width: auto; padding: 6px 10px; font-size: 15px; }
.range select { padding-right: 32px; }
.range .custom { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.range .custom[hidden] { display: none; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: -4px 0 12px; }
.filters input[type=search] { flex: 1 1 200px; width: auto; }
.filters select, .filters input[type=month] { width: auto; flex: 0 1 auto; }

/* Figures */
.money.neg, .neg { color: inherit; }
.money.in { color: var(--green); }
.money.strong, .strong { font-weight: 600; }
.ok { color: var(--green); }
.bad, .num.bad { color: var(--red); }
.good, .num.good { color: var(--green); }
.muted { color: var(--soft); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
.block { display: block; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mt { margin-top: 20px; }
.note { margin-top: 4px; }

/* Four numbers across (two on a phone): the owner's view, reconcile, a pay run */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: 14px; overflow: hidden; margin-bottom: 12px; }
.stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { background: var(--surface); padding: 14px 16px; min-width: 0; }
.stat .lab { color: var(--soft); font-size: 13px; font-weight: 500; }
.stat .val { font-size: 24px; font-weight: 600; line-height: 1.25; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat .foot { color: var(--soft); font-size: 13px; margin-top: 2px; }
.stat .foot a { color: var(--accent); }
.stat.good .val { color: var(--green); }
.stat.bad .val { color: var(--red); }

/* Statements: profit and loss, balance sheet, ledgers */
table.fin { font-size: 15px; }
table.fin td, table.fin th { padding: 7px 8px; }
table.fin td.num, table.fin th.num { font-variant-numeric: tabular-nums; }
table.fin tr.sect th { padding-top: 16px; color: var(--ink); font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--line); }
table.fin tbody:first-child tr.sect th { padding-top: 4px; }
table.fin tr.sub-total td { font-weight: 500; border-top: 1px solid var(--line-strong); }
table.fin tr.sub-total.strong td { font-weight: 600; }
table.fin tr.total td { font-weight: 600; border-top: 2px solid var(--ink); font-size: 16px; }
table.fin a { color: var(--ink); text-decoration: none; }
table.fin a:hover { color: var(--accent); text-decoration: underline; }
table.fin tr.off td { background: var(--red-soft); }
table.fin.compare td.num { width: 30%; }
.statement { overflow-x: auto; }
.statement .flash { margin: 12px 0 0; }
.sbs { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 900px) { .sbs { grid-template-columns: 1fr 1fr; } .sbs .card { margin: 0; } }

/* Lists of entries and lines: date · what · amount, folding cleanly on a phone */
.entries { list-style: none; margin: 0; padding: 0; }
.entries li { border-top: 1px solid var(--line); }
.entries li:first-child { border-top: 0; }
.entries li > a, .entries .rowlink { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 0;
  color: var(--ink); text-decoration: none; align-items: baseline; }
.entries li > a:hover .m { color: var(--accent); }
.entries .d { color: var(--soft); font-size: 14px; font-variant-numeric: tabular-nums; }
.entries .d .sub { display: block; font-size: 12px; margin: 0; }
.entries .m { min-width: 0; overflow-wrap: anywhere; }
.entries .m .sub { display: block; font-size: 13px; }
.entries .a { font-weight: 600; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.entries li.reversed .m, .entries li.reversed .a { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 1px; }
.entries li.reversed .m .sub { text-decoration: none; }
.pager { display: flex; gap: 8px; justify-content: space-between; margin-top: 10px; }
.plainlist { list-style: none; margin: 0; padding: 0; }
.plainlist li { padding: 10px 0; border-top: 1px solid var(--line); }
.plainlist li:first-child { border-top: 0; }

/* Status words */
.badge { display: inline-block; font-size: 12px; font-weight: 500; padding: 1px 8px; border-radius: 999px; background: var(--raised);
  color: var(--soft); box-shadow: inset 0 0 0 1px var(--line); vertical-align: 1px; white-space: nowrap; }
.badge.waiting, .badge.draft, .badge.error { background: var(--owed-soft); color: var(--owed); box-shadow: none; }
.badge.matched, .badge.posted, .badge.approved, .badge.closed { background: var(--green-soft); color: var(--green); box-shadow: none; }
.badge.reversed, .badge.voided, .badge.ignored { text-decoration: none; color: var(--muted); }
.pills { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.pill { font-size: 13px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink); text-decoration: none; white-space: nowrap; }
.pill:hover { background: var(--raised); }
.pill.warn { border-color: transparent; background: var(--owed-soft); color: var(--owed); font-weight: 500; }

/* A banner that is one big link */
a.linkcard { text-decoration: none; display: flex; justify-content: space-between; gap: 10px; align-items: center; }
a.linkcard .btn { flex: none; }

/* Getting started */
.steps { list-style: none; margin: 4px 0 0; padding: 0; counter-reset: s; }
.steps li a { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none; align-items: flex-start; }
.steps li:first-child a { border-top: 0; }
.steps .tick { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); margin-top: 1px; }
.steps li.done .tick { background: var(--green); border-color: var(--green); box-shadow: inset 0 0 0 4px var(--surface); }
.steps li.done b { color: var(--soft); font-weight: 500; }
.steps b { font-weight: 600; display: block; }
.steps .sub { display: block; }
.steps li a:hover b { color: var(--accent); }

/* Forms on the Books pages: two columns on a computer, one on a phone */
.formgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 16px; align-items: start; }
.formgrid > label, .decide > label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 15px; min-width: 0; }
/* The label's words and its "optional" share one line, so every field in a row starts at the same height. */
.formgrid > label:not(.check), .decide > label:not(.check) { display: grid; grid-template-columns: auto 1fr; align-content: start;
  column-gap: 8px; row-gap: 6px; align-items: baseline; }
.formgrid > label:not(.check) > :not(.opt), .decide > label:not(.check) > :not(.opt) { grid-column: 1 / -1; }
.formgrid > label:not(.check) > .opt, .decide > label:not(.check) > .opt { justify-self: start; }
.formgrid .span, .decide .span { grid-column: 1 / -1; }
.formgrid .span2 { grid-column: span 2; }
@media (max-width: 560px) { .formgrid .span2 { grid-column: 1 / -1; } }
.formgrid .check, .decide .check { flex-direction: row; font-weight: 400; }
.help { color: var(--soft); font-size: 13px; font-weight: 400; }
.opt { color: var(--muted); font-weight: 400; font-size: 13px; }
textarea { width: 100%; }
input[type=date], input[type=month] { min-height: 40px; }
.inline-form { margin: 0; }
.inline-form select { min-width: 180px; }
.check.big { align-items: flex-start; font-size: 16px; }
.check.big b { display: block; font-weight: 600; }
.check.big + .formgrid { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.actions-bar { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.actions-bar .sub { margin: 0 auto 0 0; }
.actions-bar.sticky { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0 max(12px, env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); z-index: 3; }
@media (max-width: 719px) { .actions-bar .btn.primary { width: 100%; } }

/* File uploads: a button, never a raw file box */
.upload { margin: 0; }
.file { position: relative; display: inline-flex; cursor: pointer; }
.file input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file input[type=file]:focus-visible + .btn { outline: 2px solid var(--focus); outline-offset: 2px; }
.bankcard .card-head { margin-bottom: 12px; }
.bal { text-align: right; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bal .lab { display: block; color: var(--soft); font-size: 12px; font-weight: 500; }

/* The Inbox */
.inboxitem h2 { overflow-wrap: anywhere; }
.decide { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.decide .row { justify-content: flex-start; }
input.inline { display: inline-block; width: auto; min-width: 140px; padding: 2px 8px; margin-left: 6px; font-size: 15px; }
input.inline[hidden] { display: none; }
.matchrow { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 10px 12px; margin-top: 12px;
  border-radius: 10px; background: var(--green-soft); }
.card.empty { text-align: center; padding: 32px 16px; }

/* Reconcile: tick what the statement shows */
.ticklist { list-style: none; margin: 0; padding: 0; }
.ticklist li { display: grid; grid-template-columns: 34px 56px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.ticklist li:first-child { border-top: 0; }
.ticklist form { margin: 0; }
.ticklist .d { color: var(--soft); font-size: 14px; }
.ticklist .m { min-width: 0; overflow-wrap: anywhere; }
.ticklist .a { font-weight: 600; text-align: right; }
.ticklist .m a { color: var(--ink); }
button.tick, span.tick { width: 26px; height: 26px; border-radius: 7px; border: 1.5px solid var(--line-strong); background: var(--surface); cursor: pointer; display: inline-block; padding: 0; }
button.tick:hover { border-color: var(--green); }
.tick.on { background: var(--green); border-color: var(--green); box-shadow: inset 0 0 0 5px var(--surface); }
.tick.locked { cursor: default; opacity: .7; }
.undo-recon { margin: 12px 0; text-align: right; }

/* Close: the months as a strip of tiles, and the checklist */
.monthgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-bottom: 12px; }
.monthgrid a { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; line-height: 1.25; }
.monthgrid a span { color: var(--soft); font-size: 12px; }
.monthgrid a .st { margin-top: 4px; font-weight: 500; color: var(--owed); }
.monthgrid a.closed .st { color: var(--green); }
.monthgrid a[aria-current] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.checks { list-style: none; margin: 0 0 12px; padding: 0; }
.checks li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; }
.checks .mark { flex: none; width: 18px; height: 18px; border-radius: 50%; margin-top: 3px; border: 1.5px solid var(--owed); }
.checks li.ok .mark { background: var(--green); border-color: var(--green); box-shadow: inset 0 0 0 3.5px var(--surface); }
.checks li.ok { color: var(--soft); }
.closeforms { display: grid; gap: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.closeforms form { margin: 0; }
.closeforms p { margin: 0 0 8px; }
details.early, details.void { margin-top: 4px; }
details > summary { list-style: none; cursor: pointer; display: inline-flex; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 10px; }
details.early label { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; font-weight: 500; }

/* Reports index */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.tilelink { display: flex; flex-direction: column; gap: 4px; padding: 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; }
.tilelink b { font-weight: 600; }
.tilelink:hover { border-color: var(--line-strong); background: var(--raised); }

/* A journal entry by hand */
.elines { display: grid; gap: 8px; margin: 16px 0 10px; }
.ehead, .eline { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(90px, 1fr) minmax(90px, 1fr) minmax(0, 1.6fr); gap: 8px; }
.ehead span { color: var(--soft); font-size: 13px; font-weight: 500; }
@media (max-width: 719px) {
  .ehead { display: none; }
  .eline { grid-template-columns: 1fr 1fr; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .eline select, .eline input[name=line_memo] { grid-column: 1 / -1; }
}
.balance { margin: 0; color: var(--soft); font-variant-numeric: tabular-nums; }
.balance.even { color: var(--green); }
.balance.uneven { color: var(--owed); font-weight: 500; }

/* Budgets */
.budgetlist { list-style: none; margin: 0; padding: 0; }
.budgetlist li { padding: 12px 0; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.budgetlist li:first-child { border-top: 0; }
.budgetlist label { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--soft); }
.budgetlist label input { width: 130px; }
.months { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.months label input { width: 100%; }

/* Payroll */
.figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px 12px; margin-bottom: 8px; }
.figs label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--soft); font-weight: 500; }
.figs label.byhand input { border-color: var(--owed); }
.figs input[readonly] { background: var(--raised); }
.deposit { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.paystub .right { text-align: right; }
.paystub h1 { font-size: 22px; }
table.accts tr.off td { color: var(--muted); }
tr.needs td:first-child b { color: var(--owed); }

@media (max-width: 719px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats.three { grid-template-columns: 1fr 1fr 1fr; }
  .stats.three .stat .val { font-size: 18px; }
  .stat .val { font-size: 20px; }
  .bookbar { flex-direction: column-reverse; align-items: stretch; }
  .bookbar .seg { align-self: flex-start; }
  table.fin { font-size: 14px; }
  table.fin td, table.fin th { padding: 6px 4px; }
  .ticklist li { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .ticklist .d { display: none; }
  a.linkcard { flex-direction: column; align-items: flex-start; }
}

@media print {
  .top, footer.version, .noprint, .bookbar { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 0; box-shadow: none; padding: 0; }
}

/* The live bank connection */
.plaiditem { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.plaiditem:first-of-type { border-top: 0; margin-top: 4px; }
.tierow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 280px); gap: 6px 12px; align-items: center; }
.tierow .opening { grid-column: 2; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--soft); }
@media (max-width: 719px) { .tierow { grid-template-columns: 1fr; } .tierow .opening { grid-column: 1; } }

/* The public policies: set for reading, a comfortable line length, plain hierarchy */
.legal { max-width: 720px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px 24px 20px; }
.legal-head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 8px; }
.legal-head h1 { font-size: 30px; margin: 4px 0; }
.legal-links { display: flex; gap: 6px 16px; flex-wrap: wrap; margin-top: 10px; font-size: 15px; }
.legal-links a[aria-current] { color: var(--ink); font-weight: 600; text-decoration: none; }
.legal .lede { font-size: 17px; color: var(--ink); }
.legal h2 { font-size: 19px; margin: 26px 0 8px; scroll-margin-top: 90px; }
.legal p, .legal li { line-height: 1.6; }
.legal ul, .legal ol { padding-left: 20px; }
.legal li + li { margin-top: 6px; }
.legal-foot { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 12px; color: var(--soft); font-size: 15px; }
.footlinks { margin-bottom: 6px; }
.footlinks a { color: var(--soft); }
@media (max-width: 719px) { .legal { padding: 20px 16px 12px; border-radius: 12px; } .legal-head h1 { font-size: 26px; } }
