/* Journey Sync
   Dark is the default; [data-theme=light] swaps the colours. js/theme.js sets the attribute before the page draws.
   Rules of the house: a state is never colour alone (icon shape + words come first), nothing blinks or loops,
   and money columns use tabular figures so the digits line up. */

@font-face { font-family: "Fira Sans"; font-weight: 400; font-display: swap; src: url("../fonts/FiraSans-Regular.woff") format("woff"); }
@font-face { font-family: "Fira Sans"; font-weight: 500; font-display: swap; src: url("../fonts/FiraSans-Medium.woff") format("woff"); }
@font-face { font-family: "Fira Sans"; font-weight: 600; font-display: swap; src: url("../fonts/FiraSans-SemiBold.woff") format("woff"); }
@font-face { font-family: "Fira Sans Condensed"; font-weight: 600; font-display: swap; src: url("../fonts/FiraSansCondensed-SemiBold.woff") format("woff"); }

:root {
  color-scheme: dark;
  --bg: #0e1824;
  --surface: #152333;
  --surface-2: #1c2e43;
  --line: #283b52;
  --line-2: #3d5672;
  --text: #e7eef6;
  --muted: #a5b6c9;
  --accent: #4fc3f7;
  --on-accent: #06202f;
  --ok: #63d6a0;
  --warn: #f5c04e;
  --bad: #ff9182;
  --ok-bg: rgba(99, 214, 160, .09);
  --warn-bg: rgba(245, 192, 78, .09);
  --bad-bg: rgba(255, 145, 130, .1);
  --on-bad: #2b0703;
  --tape-yellow: #f7c531;
  --tape-ink: #191300;
  --tape-red: #a81d16;
  --body: "Fira Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Fira Sans Condensed", "Fira Sans", system-ui, sans-serif;
  --tape-h: 40px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #edf1f5;
  --surface: #ffffff;
  --surface-2: #f2f5f8;
  --line: #d6dee7;
  --line-2: #aebccb;
  --text: #132130;
  --muted: #4f6077;
  --accent: #0b5fa5;
  --on-accent: #ffffff;
  --ok: #0d6a3b;
  --warn: #7d4b00;
  --bad: #b3261e;
  --ok-bg: rgba(13, 106, 59, .07);
  --warn-bg: rgba(170, 110, 0, .09);
  --bad-bg: rgba(179, 38, 30, .07);
  --on-bad: #ffffff;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-y: scroll; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--body); }
[hidden] { display: none !important; }
h1, h2, h3, p, dl, dd, ol, ul { margin: 0; }
h2 { font: 600 20px/1.25 var(--display); }
a { color: inherit; }
strong { font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.quiet { color: var(--muted); }
.icon { display: inline-flex; flex: none; }
.icon svg { display: block; }
.cell-label { display: none; color: var(--muted); font-weight: 400; }

/* ---------- the company banner: striped tape for the test company, a solid band for the real one ---------- */

.tape { position: sticky; top: 0; z-index: 40; display: flex; align-items: stretch; min-height: var(--tape-h); font-size: 14px; line-height: 1.2; }
.tape::before, .tape::after { content: ""; flex: 0 0 72px; }
.tape[data-kind="test"] { background: var(--tape-yellow); color: var(--tape-ink); }
.tape[data-kind="test"]::before, .tape[data-kind="test"]::after { background: repeating-linear-gradient(135deg, var(--tape-ink) 0 11px, var(--tape-yellow) 11px 22px); }
.tape[data-kind="real"] { background: var(--tape-red); color: #fff; box-shadow: inset 0 -4px 0 #fff, inset 0 -6px 0 var(--tape-red); min-height: 46px; }
.tape[data-kind="real"]::before, .tape[data-kind="real"]::after { flex-basis: 8px; }
.tape-in { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 7px 16px; }
.tape-kind { font: 600 18px/1 var(--display); letter-spacing: .06em; white-space: nowrap; }
.tape-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tape-note { margin-left: auto; white-space: nowrap; }

/* ---------- top bar ---------- */

.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1288px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 8px 28px; min-height: 58px; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand img { display: block; border-radius: 22%; }
.brand-name { font: 600 21px/1 var(--display); letter-spacing: .01em; }
.brand-link { text-decoration: none; }
.tabs { display: flex; gap: 2px; align-self: stretch; }
.tab { display: flex; align-items: center; padding: 3px 14px 0; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 500; text-decoration: none; }
.tab:hover { color: var(--text); }
.tab.is-on { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.who { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.who-name { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; color: var(--muted); white-space: nowrap; }
.theme-btn { min-width: 92px; justify-content: flex-start; }

/* ---------- buttons, fields ---------- */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--text); font: 500 15px/1.25 var(--body); text-decoration: none; cursor: pointer; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: .48; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.08); }
.btn-quiet { border-color: transparent; background: none; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: var(--on-bad); font-weight: 600; }
.btn-danger:hover:not(:disabled) { background: var(--bad); filter: brightness(1.08); }
.btn-small { min-height: 32px; padding: 4px 12px; font-size: 14px; }
.btn-wide { width: 100%; min-height: 46px; }
.btn.is-on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); background: var(--surface-2); }
.btn-hint { font-size: 13px; font-weight: 400; color: var(--muted); }
.pick-mark { display: inline-flex; color: var(--muted); }
.is-on > .pick-mark { color: var(--ok); }

input[type="text"], input[type="email"], input[type="password"] { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
input[type="checkbox"] { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); cursor: pointer; }
input[type="checkbox"]:disabled { cursor: not-allowed; }

.select-wrap { position: relative; display: inline-flex; align-items: center; max-width: 100%; }
.select-wrap select { appearance: none; -webkit-appearance: none; max-width: 100%; min-height: 40px; padding: 8px 38px 8px 14px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--surface); color: var(--text); font: 500 15px/1.25 var(--body); cursor: pointer; text-overflow: ellipsis; }
.select-wrap select:hover:not(:disabled) { background: var(--surface-2); }
.select-wrap select:disabled { opacity: .48; cursor: not-allowed; }
.select-wrap > .icon-down { position: absolute; right: 13px; pointer-events: none; color: var(--muted); }
.select-wrap > .pick-mark { position: absolute; left: 13px; pointer-events: none; }
.select-wrap > .pick-mark + select { padding-left: 39px; }
.select-wrap.is-on select { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); background: var(--surface-2); }

/* ---------- states and notes ---------- */

.state { display: inline-flex; align-items: flex-start; gap: 7px; line-height: 1.35; text-align: left; }
.state > .icon { margin-top: 1px; }
.state-ok > .icon { color: var(--ok); }
.state-warn > .icon { color: var(--warn); }
.state-bad > .icon { color: var(--bad); }
.state-quiet > .icon { color: var(--muted); }
.state-words { font-weight: 500; }
.state-extra { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }

.note { display: flex; gap: 12px; padding: 14px 18px; border: 1px solid var(--line-2); border-left-width: 5px; border-radius: 10px; background: var(--surface); }
.note > .icon { margin-top: 1px; }
.note-body p { margin-top: 4px; max-width: 86ch; }
.note-info { border-left-width: 1px; padding: 10px 14px; font-size: 14px; color: var(--muted); }
.note-info > .icon { color: var(--muted); }
.note-warn { border-color: var(--warn); background: var(--warn-bg); }
.note-warn > .icon { color: var(--warn); }
.note-bad { border-color: var(--bad); background: var(--bad-bg); }
.note-bad > .icon { color: var(--bad); }
.note-ok { border-color: var(--ok); background: var(--ok-bg); }
.note-ok > .icon { color: var(--ok); }

.waiting { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 32px 28px; border: 1px dashed var(--line-2); border-radius: 12px; color: var(--muted); }
.waiting h2 { color: var(--text); }
.waiting .btn { margin-top: 8px; margin-left: -12px; }

.meter { height: 6px; margin-top: 10px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width .25s linear; }

/* ---------- tables: ruled like a ledger ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); font-weight: 400; }
thead th { padding-top: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line-2); color: var(--muted); font-size: 13px; font-weight: 500; white-space: nowrap; vertical-align: bottom; }
th.num, td.num { text-align: right; }
tfoot th, tfoot td { border-top: 2px solid var(--line-2); border-bottom: 0; font-weight: 600; }
tbody tr:last-child > * { border-bottom: 0; }
td:first-child, th:first-child { padding-left: 8px; }
td:last-child, th:last-child { padding-right: 8px; }

/* ---------- settlements: the route on the left, the work on the right ---------- */

.flow { max-width: 1288px; margin: 0 auto; padding: 32px 24px 0; display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 48px; align-items: start; }
.route { position: sticky; top: calc(var(--tape-h) + 24px); }
.route-now { display: none; }
.stops { list-style: none; padding: 0; }
.stop { position: relative; padding-bottom: 12px; }
.stop:not(:last-child)::after { content: ""; position: absolute; left: 17px; top: 36px; bottom: 0; border-left: 2px dotted var(--line-2); }
.stop.is-done:not(:last-child)::after { border-left: 2px solid var(--line-2); }
.stop-btn { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 4px 6px 4px 4px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.stop-btn:disabled { cursor: default; }
.stop-btn:hover:not(:disabled) { background: var(--surface); }
.stop-mark { flex: 0 0 28px; height: 28px; display: grid; place-items: center; }
.stop-mark .icon { margin: -1px; }
.stop-num { border: 2px solid var(--line-2); border-radius: 50%; color: var(--muted); font: 600 14px/1 var(--display); }
.stop.is-now .stop-num { border-color: var(--text); background: var(--text); color: var(--bg); }
.stop.is-done .stop-mark { color: var(--ok); }
.stop-label { display: flex; flex-direction: column; padding-top: 3px; color: var(--muted); font-weight: 500; line-height: 1.35; }
.stop.is-now .stop-label { color: var(--text); font-weight: 600; }
.stop.is-done .stop-label { color: var(--text); }
.stop-sub { min-height: 17px; font-size: 12.5px; font-weight: 400; color: var(--muted); }

.stage { min-width: 0; }
.stage > * + * { margin-top: 24px; }
.stage-head h1 { font: 600 32px/1.15 var(--display); letter-spacing: .005em; }
.lead { margin-top: 6px; color: var(--muted); max-width: 64ch; }
.block > * + * { margin-top: 12px; }
.stage > .block { margin-top: 40px; }
.block-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }

.actionbar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; margin-top: 32px; padding: 14px 0 18px; border-top: 1px solid var(--line-2); background: var(--bg); }
.actionbar-text { min-width: 0; }
.actionbar-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; flex: none; }
.busy { min-width: min(360px, 60vw); }

/* 1. run the reports */
.todo { list-style: none; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.todo > li { padding: 20px 24px; border-top: 1px solid var(--line); }
.todo > li:first-child { border-top: 0; }
.todo h2 + * { margin-top: 12px; }
.todo h2 + .quiet { margin-top: 4px; }
.open-row { display: flex; flex-wrap: wrap; gap: 14px 22px; }
.open-item { display: flex; flex-direction: column; gap: 6px; max-width: 320px; }
.open-item .quiet { font-size: 14px; }
/* step 1: the two QuickManage reports, as a pair */
.report-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 340px)); gap: 16px; margin-top: 14px; }
.report-tile { display: flex; flex-direction: column; padding: 16px 18px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.report-tile h3 { font: 600 17px/1.25 var(--display); }
.report-tile p { flex: 1; margin-top: 6px; max-width: 40ch; font-size: 14px; line-height: 1.45; color: var(--muted); }
.report-tile .btn-open { align-self: flex-start; margin-top: 14px; min-height: 44px; }
.report-tile .tile-last { flex: none; display: flex; align-items: center; gap: 6px; margin-top: 10px; min-height: 20px; font-size: 13px; color: var(--muted); }
.report-tile .tile-last time { color: var(--text); font-weight: 600; }
.pair-note { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 14px; color: var(--muted); }
.pair-note > .icon { flex: none; }
.btn-open { min-height: 48px; padding: 8px 18px; border-color: var(--accent); }
.btn-open > .icon { color: var(--accent); }
.settings-list { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 6px 16px; }
.settings-list dt { color: var(--muted); }
.settings-list dd { font-weight: 500; }

/* 2. reports found */
.pairs { display: grid; gap: 14px; }
.pair { padding: 18px 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.pair-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.pair-list { list-style: none; padding: 0; margin-top: 12px; display: grid; gap: 8px; }
.pair-list li { display: grid; grid-template-columns: 18px 160px minmax(0, 1fr); gap: 10px; align-items: start; }
.pair-list .icon { margin-top: 2px; }
.pair-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.run-tag { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border: 1px solid var(--line-2); border-radius: 999px; font: 600 13px/1.5 var(--body); color: var(--muted); }
.run-tag .icon { align-self: center; }
.run-tag-fresh { border-color: var(--accent); color: var(--text); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.run-tag-fresh .icon { color: var(--accent); }
.pair-pick { cursor: pointer; }
.pair-pick:hover { border-color: var(--line-2); }
.pair-pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.pair-selected, .pair-selected:hover { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.pick-mark { display: inline-flex; align-self: center; color: var(--muted); }
.pair-selected .pick-mark { color: var(--accent); }
.pick-word { font: 600 13px/1.5 var(--body); color: var(--text); }
.pair-disabled { background: transparent; }
.pair-disabled h2 { color: var(--muted); }
.pair-by time { font-weight: 600; color: var(--text); }
.pair-ago { color: var(--muted); }
.pair-list .icon-check { color: var(--ok); }
.pair-list .icon-triangle { color: var(--warn); }
.pair-name { font-weight: 500; }
.pair-by { color: var(--muted); }

/* 3. pick the weeks */
.picks { display: flex; flex-wrap: wrap; gap: 8px; }
.stage > .pick-note { min-height: 22px; margin-top: 10px; display: flex; gap: 8px; }
.pick-note .icon { color: var(--warn); margin-top: 1px; }
.stage > .pick-note + .table-wrap { margin-top: 10px; }
.weeks .wk-check { width: 44px; padding-right: 0; }
.weeks td { vertical-align: middle; }
.wk-range label { font-weight: 500; cursor: pointer; white-space: nowrap; }
.wk-check input { display: block; }
.wk.is-off .wk-range label { cursor: default; color: var(--muted); }
.wk-id { margin-left: 10px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.weeks .state { vertical-align: middle; }
.wk.is-picked { background: var(--surface); box-shadow: inset 4px 0 0 var(--accent); }
.wk-action { width: 132px; text-align: right; }

/* 4. prepare */
.job { list-style: none; padding: 6px 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.job-step { display: flex; gap: 14px; padding: 16px 0; border-top: 1px solid var(--line); color: var(--muted); }
.job-step:first-child { border-top: 0; }
.job-step.is-now, .job-step.is-done { color: var(--text); }
.job-step.is-done > .icon { color: var(--ok); }
.job-step.is-now > .icon { color: var(--accent); }
.job-text { flex: 1; min-width: 0; }
.job-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 16px; }
.job-label { font-weight: 500; }
.job-count { color: var(--muted); min-height: 22px; }
.job-step.is-done .meter-fill { background: var(--ok); }

/* 5. preview */
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.facts.tally { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.fact { padding: 14px 18px 16px; border-left: 1px solid var(--line); min-width: 0; }
.fact:first-child { border-left: 0; }
.fact dt { font-size: 13px; line-height: 1.3; color: var(--muted); }
.fact dd { margin-top: 4px; font: 600 23px/1.2 var(--display); font-variant-numeric: tabular-nums; }
.fact dd .state { align-items: center; gap: 8px; line-height: 1.2; }
.fact dd .state-words { font-weight: 600; }
.fact dd .state > .icon { margin-top: 0; }
.fact-extra { display: block; margin-top: 2px; font: 400 13px/1.3 var(--body); color: var(--muted); }

.lock-line { padding: 12px 16px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface); }
.question-group > * + * { margin-top: 12px; }
.group-title { font: 600 16px/1.3 var(--body); padding-top: 8px; }
.question { padding: 18px 22px 16px; border: 1px solid var(--line-2); border-left: 5px solid var(--warn); border-radius: 10px; background: var(--surface); }
.question.is-answered { border-left-color: var(--ok); }
.question-top { display: flex; justify-content: space-between; gap: 16px; }
.question h3 { font: 600 17px/1.3 var(--body); }
.question-line { margin-top: 2px; color: var(--muted); }
.question-amount { font: 600 21px/1.3 var(--display); }
.question-ask { margin-top: 14px; font-size: 16px; max-width: 72ch; }
.question-why { margin-top: 6px; color: var(--muted); max-width: 78ch; }
.question-why strong { color: var(--text); font-weight: 500; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.choice { justify-content: flex-start; text-align: left; }
.question-status { margin-top: 14px; min-height: 38px; }

.week-picker { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); }
.money-table .cat-name { font-weight: 500; }
.money-table .cat-account { display: none; font-size: 13px; color: var(--muted); }
.money-table .col-account { color: var(--muted); }
.weeks-sum td:first-child { font-weight: 500; }

.bill-grid { display: grid; grid-template-columns: 18px minmax(170px, 1.25fr) minmax(170px, 1fr) 116px 124px; gap: 12px; align-items: start; padding: 11px 8px; }
.bills-head { padding-top: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line-2); color: var(--muted); font-size: 13px; font-weight: 500; }
.bills { list-style: none; padding: 0; margin-top: 0; }
.bill { border-bottom: 1px solid var(--line); }
.bill.is-open { background: var(--surface); }
.bill-row { width: 100%; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.bill-row:hover { background: var(--surface); }
.bill-row > .icon { margin-top: 2px; color: var(--muted); }
.bill-name { font-weight: 500; min-width: 0; }
.bill-role { display: block; font-size: 13px; font-weight: 400; color: var(--muted); }
.bill-flags { display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.bill-flags .state-words { font-weight: 400; }
.bill-earned, .bill-payout { font-variant-numeric: tabular-nums; }
.bill-payout { font-weight: 500; }
.bills-total { margin-top: 0; border-top: 2px solid var(--line-2); font-weight: 600; }
.bills-total .bill-name, .bills-total .bill-payout { font-weight: 600; }
.block > .bills, .block > .bills-total { margin-top: 0; }
.bill-lines { padding: 2px 14px 18px 38px; }
.bill-meta { display: flex; flex-wrap: wrap; gap: 2px 20px; margin-bottom: 6px; font-size: 13.5px; color: var(--muted); }
.bill-note { display: flex; gap: 8px; margin-bottom: 8px; font-size: 14px; }
.bill-note .icon { color: var(--warn); margin-top: 2px; }
.lines-table { font-size: 14px; }
.lines-table th, .lines-table td { padding-top: 7px; padding-bottom: 7px; }
.line-type { display: block; font-size: 12.5px; color: var(--muted); }
.line-cat { display: none; font-size: 13px; color: var(--muted); }
.lines-table .col-unit { width: 64px; color: var(--muted); }
.lines-table .col-cat { width: 36%; }

/* 6. add to QuickBooks */
.target { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border: 2px solid var(--tape-yellow); border-radius: 10px; }
.target-test { background: repeating-linear-gradient(135deg, rgba(247, 197, 49, .13) 0 11px, transparent 11px 22px); }
.target-real { border-color: var(--tape-red); border-width: 3px; background: var(--bad-bg); }
.target-label { display: block; font-size: 13px; color: var(--muted); }
.target-kind { margin-right: 10px; font: 600 19px/1.3 var(--display); letter-spacing: .06em; }
.target-name { font-weight: 500; }
.imp-weeks { list-style: none; padding: 0; border-top: 1px solid var(--line-2); }
.imp-week { border-bottom: 1px solid var(--line); }
.imp-week.is-open { padding-bottom: 14px; }
.imp-week-row { display: grid; grid-template-columns: minmax(210px, 1.2fr) minmax(190px, 1fr) 236px; gap: 12px; align-items: center; padding: 8px; }
.imp-toggle { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.imp-toggle > .icon { margin-top: 2px; color: var(--muted); }
.imp-week-name { font-weight: 500; }
.imp-week-action { display: flex; justify-content: flex-end; min-height: 32px; }
.imp-hint { padding: 0 8px 8px 36px; color: var(--muted); font-size: 14px; }
.imp-week > .table-wrap { padding-left: 28px; }
.imp-bills { font-size: 14px; }
.imp-bills td { vertical-align: middle; padding-top: 6px; padding-bottom: 6px; height: 46px; }
.imp-bills .col-doc { color: var(--muted); font-variant-numeric: tabular-nums; }
.imp-bills .imp-result { width: 32%; }
.imp-bills .state { vertical-align: middle; }
.imp-bills .imp-action { width: 132px; text-align: right; }
.doc-small { display: none; font-size: 13px; color: var(--muted); }
.doc-small.always { display: block; }

/* 7. done */
.done-head { display: flex; align-items: center; gap: 16px; }
.done-head > .icon { color: var(--ok); }
.done-head.is-partial > .icon { color: var(--warn); }
.downloads { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- sign-in ---------- */

.signin { min-height: calc(100vh - var(--tape-h)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px 16px 48px; }
.signin-card { width: 392px; max-width: 100%; display: flex; flex-direction: column; padding: 32px 32px 28px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.signin-title { font-size: inherit; }
.signin-title .brand-name { font-size: 30px; }
.signin-title .brand { gap: 14px; }
.signin-lead { margin: 14px 0 6px; color: var(--muted); }
.signin-card label { margin: 14px 0 6px; font-weight: 500; }
.form-error { display: flex; gap: 8px; min-height: 22px; margin: 14px 0; }
.form-error .icon { color: var(--bad); margin-top: 1px; }
.signin-sample { margin-top: 16px; font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- settings ---------- */

.settings { max-width: 1100px; margin: 0 auto; padding: 32px 24px 72px; }
.settings > * + * { margin-top: 24px; }
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-2); }
.settings > .subtabs { margin-top: 18px; }
.subtab { margin-bottom: -1px; padding: 10px 16px; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 500; text-decoration: none; }
.subtab:hover { color: var(--text); }
.subtab.is-on { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.people td { vertical-align: middle; }
.people .col-saved { width: 280px; font-size: 14px; }
.people select { min-width: 150px; }
.p-name { font-weight: 500; }
.p-mail { display: block; font-size: 13px; color: var(--muted); }
.tag { margin-left: 8px; padding: 1px 8px; border: 1px solid var(--line-2); border-radius: 10px; font-size: 12px; font-weight: 400; }
.col-rw { color: var(--muted); }
.block > .levels { margin-top: 24px; }
.levels { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 4px 16px; font-size: 14px; color: var(--muted); }
.levels dt { color: var(--text); font-weight: 500; }
.co { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 5px; font: 600 13px/1.3 var(--display); letter-spacing: .06em; vertical-align: baseline; white-space: nowrap; }
.co-test { background: var(--tape-yellow); color: var(--tape-ink); }
.co-real { background: var(--tape-red); color: #fff; }
.activity .state { justify-content: flex-end; }
.block > .note + .table-wrap { margin-top: 20px; }
.activity .undo-cell .state { justify-content: flex-start; }
.activity .undo-open { width: 1%; white-space: nowrap; padding-top: 6px; padding-bottom: 6px; text-align: right; }
.activity tr.is-open > * { border-bottom-color: transparent; }
.activity tr.is-undo .state-words { font-weight: 500; }
.undo-row > td { padding: 0 8px 16px; }
.undo-box { padding: 16px 20px 18px; border: 1px solid var(--line-2); border-left: 5px solid var(--bad); border-radius: 10px; background: var(--surface); }
.undo-box h3 { font: 600 18px/1.3 var(--display); }
.undo-where { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; }
.undo-total { font-weight: 600; font-variant-numeric: tabular-nums; }
.undo-box > .quiet { margin-top: 6px; font-size: 14px; }
.undo-list { margin-top: 10px; font-size: 14px; }
.undo-list > summary { cursor: pointer; color: var(--accent); width: max-content; }
.undo-bills { list-style: none; padding: 0; margin-top: 8px; max-height: 260px; overflow-y: auto; border-top: 1px solid var(--line); }
.undo-bills li { display: grid; grid-template-columns: 11.5em minmax(0, 1fr) 7.5em; gap: 2px 14px; padding: 5px 2px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.undo-bills .num { text-align: right; }
.undo-doc { color: var(--muted); }
.undo-why { grid-column: 2 / -1; color: var(--muted); font-size: 13px; }
.undo-keep { margin-top: 12px; font-size: 14px; }
.undo-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.conn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.conn { padding: 22px 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.conn-state { margin-top: 10px; }
.conn-list { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 12px; margin-top: 16px; }
.conn-list dt { color: var(--muted); }
.conn-list .co { margin-right: 8px; }
.conn-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 20px; }

/* ---------- narrow laptop window ---------- */

@media (max-width: 1120px) {
  .flow { grid-template-columns: 184px minmax(0, 1fr); gap: 32px; }
  .tape::before, .tape::after { flex-basis: 48px; }
  .who-name span:last-child { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
  .imp-week-row { grid-template-columns: minmax(200px, 1.2fr) minmax(170px, 1fr) 216px; }
  .lines-table .col-cat { width: 40%; }
  .people .col-saved { width: 200px; }
  .facts:not(.tally) .fact dt { min-height: 34px; }
  .wk-id { display: block; margin-left: 0; }
}

/* ---------- phone ---------- */

@media (max-width: 760px) {
  body { font-size: 15px; }
  .cell-label { display: inline; }
  .tape::before, .tape::after { flex-basis: 20px; }
  .tape-in { padding: 6px 10px; gap: 8px; }
  .tape-note { display: none; }
  .tape-kind { font-size: 16px; }
  .top-in { flex-wrap: wrap; padding: 8px 16px 0; gap: 4px 12px; }
  .tabs { order: 3; flex: 0 0 100%; min-height: 42px; }
  .tab { padding: 3px 12px 0; }
  .tab:first-child { margin-left: -12px; }
  .who-name { display: none; }
  .theme-btn { min-width: 0; }
  .btn-quiet { padding-left: 10px; padding-right: 10px; }

  .flow { display: block; padding: 16px 16px 0; }
  .route { position: static; margin-bottom: 20px; }
  .route-now { display: block; margin-bottom: 8px; color: var(--muted); }
  .route-now strong { color: var(--text); }
  .stops { display: flex; }
  .stop { flex: 1 1 0; padding: 0; }
  .stop:last-child { flex: 0 0 36px; }
  .stop:not(:last-child)::after { left: 36px; right: 0; top: 17px; bottom: auto; border-left: 0; border-top: 2px dotted var(--line-2); }
  .stop.is-done:not(:last-child)::after { border-left: 0; border-top: 2px solid var(--line-2); }
  .stop-btn { width: 36px; padding: 4px; }
  .stop-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .stage-head h1 { font-size: 26px; }
  .stage > .block { margin-top: 32px; }

  .actionbar { flex-direction: column; align-items: stretch; padding: 12px 0 14px; }
  .actionbar-buttons { justify-content: stretch; }
  .actionbar-buttons .btn { flex: 1 1 auto; }
  .actionbar-text:empty, .actionbar-text > span:empty { display: none; }

  .todo > li { padding: 16px; }
  .open-row .btn { width: 100%; justify-content: flex-start; }
  .report-pair { grid-template-columns: 1fr; }
  .report-tile .btn-open { align-self: stretch; justify-content: flex-start; }
  .pair { padding: 16px; }
  .pair-list li { grid-template-columns: 18px minmax(0, 1fr); }
  .pair-by { grid-column: 2; }

  .picks { display: grid; grid-template-columns: 1fr 1fr; }
  .picks .btn { justify-content: flex-start; padding-left: 12px; padding-right: 8px; }
  .weeks thead { display: none; }
  .weeks, .weeks tbody { display: block; }
  .weeks tr { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; grid-template-areas: "check range payout" "check state drivers" "check action action"; gap: 4px 8px; padding: 12px 8px; border-bottom: 1px solid var(--line); }
  .weeks td { display: block; padding: 0; border: 0; }
  .weeks .wk-check { grid-area: check; width: auto; padding-top: 1px; }
  .weeks .wk-range { grid-area: range; }
  .weeks .wk-payout { grid-area: payout; }
  .weeks .wk-drivers { grid-area: drivers; font-size: 13px; color: var(--muted); }
  .weeks .wk-state { grid-area: state; }
  .weeks .wk-action { grid-area: action; width: auto; text-align: left; }
  .weeks .wk-action:empty { display: none; }
  .weeks .wk-action .btn { margin-top: 6px; }
  .wk-payout .cell-label { display: none; }
  .wk-id { display: none; }

  .job { padding: 2px 16px; }
  .facts, .facts.tally { grid-template-columns: 1fr 1fr; }
  .fact { border-left: 0; border-top: 1px solid var(--line); padding: 12px 14px; }
  .fact:nth-child(-n+2) { border-top: 0; }
  .fact:nth-child(even) { border-left: 1px solid var(--line); }
  .fact dt { min-height: 34px; }
  .fact dd { font-size: 20px; }
  .tally .fact:last-child { grid-column: 1 / -1; }

  .question { padding: 16px 14px 14px; }
  .choices { flex-direction: column; align-items: stretch; }
  .choices .select-wrap, .choices select { width: 100%; }
  .choice { white-space: normal; }

  .col-account, .lines-table .col-unit, .lines-table .col-cat, .col-doc, .col-rw { display: none; }
  .money-table .cat-account, .line-cat { display: block; }
  .doc-small { display: block; }
  th, td { padding-left: 8px; padding-right: 8px; }

  .bill-grid { grid-template-columns: 18px minmax(0, 1fr) auto; gap: 4px 10px; }
  .bills-head { display: none; }
  .bill-row .bill-name, .bills-total .bill-name { grid-column: 2; }
  .bill-row .bill-payout, .bills-total .bill-payout { grid-column: 3; grid-row: 1; }
  .bill-row .bill-flags { grid-column: 2; grid-row: 2; }
  .bill-row .bill-earned, .bills-total .bill-earned { grid-column: 3; grid-row: 2; font-size: 13px; color: var(--muted); font-weight: 400; }
  .line-cat::before { content: "Category: "; }
  .bills-total .bill-flags { display: none; }
  .bill-payout .cell-label { display: none; }
  .bill-lines { padding: 0 8px 14px; }

  .target { padding: 12px 14px; }
  .target-kind { display: block; }
  .imp-week-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .imp-week-state { padding-left: 28px; }
  .imp-week-action { justify-content: flex-start; padding-left: 28px; min-height: 0; }
  .imp-week > .table-wrap { padding-left: 0; }
  .imp-bills thead { display: none; }
  .imp-bills, .imp-bills tbody { display: block; }
  .imp-bills tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--line); }
  .imp-bills td { display: block; height: auto; padding: 0; border: 0; }
  .imp-bills td.col-doc, .imp-bills .imp-action:empty { display: none; }
  .imp-bills .imp-result, .imp-bills .imp-action { width: auto; }

  .settings { padding: 20px 16px 56px; }
  .people .col-saved { width: auto; }
  .people thead { display: none; }
  .people, .people tbody { display: block; }
  .people tr { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .people td { display: block; padding: 0 4px; border: 0; }
  .people td:empty { display: none; }

  /* wide tables turn into one small block per row, each number with its label */
  .stack thead { display: none; }
  .stack, .stack tbody, .stack tfoot { display: block; }
  .stack tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .stack tbody tr:last-child { border-bottom: 0; }
  .stack td, .stack tfoot th { display: block; padding: 0; border: 0; text-align: left; white-space: normal; }
  .stack td:empty { display: none; }
  .stack tr > :first-child { grid-column: 1 / -1; font-weight: 600; }
  .stack tfoot tr { border-top: 2px solid var(--line-2); border-bottom: 0; }
  .stack .state { justify-content: flex-start; }
  .activity tr > :last-child { grid-column: 1 / -1; }
  .stack tr.undo-row { display: block; padding: 0 0 12px; }
  .stack .undo-row > td { padding: 0; }
  .activity .undo-open { width: auto; padding: 0; text-align: left; }
  .activity .undo-cell { grid-column: 1 / -1; }
  .undo-bills li { grid-template-columns: minmax(0, 1fr) auto; }
  .undo-doc, .undo-why { grid-column: 1 / -1; }
  .conn-grid { grid-template-columns: 1fr; }
  .conn-list { grid-template-columns: 130px minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .meter-fill { transition: none; }
}

@media print {
  .tape { position: static; }
  .top, .route, .actionbar { display: none; }
  .flow { display: block; }
}

/* QuickManage screenshots on step 1 */
.shots { display: flex; flex-wrap: wrap; gap: 24px; margin-top: 14px; align-items: flex-start; }
.shots figure { margin: 0; }
.shots figcaption { font-weight: 600; margin-bottom: 8px; }
.shots img { display: block; width: 290px; max-width: 100%; height: auto; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; }

/* step 0: start. The one picture on the page: QuickManage, the sync, QuickBooks */
.sync-hero { display: grid; grid-template-columns: auto minmax(120px, 260px) auto; align-items: center; gap: 0 18px; width: max-content; max-width: 100%; margin: 4px 0 30px; }
.sync-app { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 0; }
.sync-app img { display: block; box-sizing: content-box; width: 64px; height: 56px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 18px; background: #fff; object-fit: contain; }
.sync-app figcaption { display: flex; flex-direction: column; align-items: center; font: 600 17px/1.2 var(--display); }
.sync-app small { font: 400 13px/1.3 var(--body); color: var(--muted); }
.sync-link { display: flex; align-items: center; margin-bottom: 44px; }
.sync-line { flex: 1; height: 0; border-top: 2px dashed var(--line-2); }
.sync-line-end { position: relative; }
.sync-line-end::after { content: ""; position: absolute; right: -2px; top: -7px; border: 6px solid transparent; border-left: 9px solid var(--line-2); border-right: 0; }
.sync-badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--accent); border-radius: 999px; background: var(--surface); color: var(--text); font: 600 14px/1 var(--body); white-space: nowrap; }
.sync-badge > .icon { color: var(--accent); }
.start-points { list-style: none; counter-reset: pt; display: grid; gap: 12px; max-width: 62ch; margin-top: 24px; padding: 0; font-size: 16px; }
.start-points li { counter-increment: pt; position: relative; min-height: 30px; padding: 3px 0 0 46px; }
.start-points li::before { content: counter(pt); position: absolute; left: 0; top: -2px; display: grid; place-items: center; width: 30px; height: 30px; border: 1.5px solid var(--line-2); border-radius: 50%; font: 600 15px/1 var(--display); color: var(--text); }
@media (max-width: 760px) {
  .sync-hero { grid-template-columns: auto minmax(60px, 1fr) auto; gap: 0 10px; width: 100%; }
  .sync-app img { width: 44px; height: 40px; padding: 12px; }
  .sync-badge { padding: 5px 9px; font-size: 13px; }
  .sync-badge > .icon { display: none; }
}
