/* #558: the Finances page (staff only). Calm and plain: the numbers are the design. Same palette as the other staff
   page (acquisition-report.css). Phone first for touch: every control is at least 44px tall, text at least 14px. */
:root {
  --ink: #17303e; --muted: #556b77; --line: #dfe8ec; --bg: #f5f8fa; --panel: #fff;
  --brand: #0078a6; --brand-ink: #fff; --good: #1d7a46; --good-bg: #e8f6ee; --bad: #b02a43; --bad-bg: #fdecef;
  --warn: #8a5300; --warn-bg: #fff4e0;
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--panel); padding: 10px 14px; border-radius: 8px; z-index: 20; }
.skip:focus { left: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.site-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px max(16px, calc((100vw - 1200px) / 2)); background: var(--panel); border-bottom: 1px solid var(--line); }
.site-header a { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--ink); text-decoration: none; font-weight: 700; }
.site-header .back { font-weight: 600; color: var(--brand); }

main { max-width: 1200px; margin: 0 auto; padding: 28px 16px 48px; }
.title-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.eyebrow { margin: 0; color: var(--brand); font-size: 14px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
h1 { font-size: clamp(30px, 4vw, 42px); line-height: 1.1; letter-spacing: -.02em; margin: 8px 0 6px; }
.intro, .muted { color: var(--muted); }
.intro { margin: 0; max-width: 60ch; }
.title-actions { display: flex; align-items: flex-end; gap: 10px; }
.year-pick { display: grid; gap: 4px; font-size: 14px; font-weight: 650; }
#status { min-height: 24px; margin: 14px 0 6px; }
#status.error { color: var(--bad); font-weight: 600; }

label { display: grid; gap: 6px; font-size: 14px; font-weight: 650; }
/* 16px, so phones don't zoom into a field when it's tapped. */
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink); background: #fff; border: 1px solid #b9cbd4; border-radius: 8px; padding: 10px 12px; min-height: 44px; max-width: 100%; }
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid #7cc4e4; outline-offset: 2px; }
button { font: inherit; font-size: 15px; font-weight: 650; min-height: 44px; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); cursor: pointer; }
button.secondary { background: #fff; color: var(--brand); }
button.quiet { background: transparent; border-color: transparent; color: var(--brand); padding: 10px 8px; }
button.danger { background: #fff; color: var(--bad); border-color: #e3aab5; }
button:disabled { opacity: .55; cursor: progress; }
.check { display: flex; align-items: center; gap: 6px; font-weight: 500; min-height: 44px; }
/* A 44px target with a 24px box drawn inside it. */
.check input[type="checkbox"], .check input[type="radio"] {
  appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 44px; height: 44px; min-height: 44px; margin: 0 0 0 -10px;
  padding: 0; border: 0; border-radius: 8px; background: transparent; cursor: pointer;
}
.check input::before { content: ""; position: absolute; inset: 10px; border: 2px solid #6f8794; border-radius: 6px; background: #fff; }
.check input[type="radio"]::before { border-radius: 50%; }
.check input:checked::before { border-color: var(--brand); background: var(--brand); }
.check input[type="checkbox"]:checked::after { content: ""; position: absolute; left: 18px; top: 13px; width: 7px; height: 13px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.check input[type="radio"]:checked::after { content: ""; position: absolute; inset: 17px; border-radius: 50%; background: #fff; }
.check input:focus-visible { outline: 3px solid #7cc4e4; outline-offset: -3px; }

.jump { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 12px; margin: 6px 0 4px; scrollbar-width: thin; }
.jump a { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 600; }
.count { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-size: 14px; font-weight: 800; }

.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 12px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 4px; }
.card h3 { margin: 0; font-size: 14px; font-weight: 650; color: var(--muted); }
.card .big { margin: 2px 0; font-size: 30px; font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.card .sub { margin: 0; color: var(--muted); font-size: 14px; }
.card-tax { border-color: #a9d3e6; background: linear-gradient(180deg, #f2fafd, #fff 60%); }
.card .out { margin-top: auto; padding-top: 8px; color: var(--brand); font-weight: 650; min-height: 44px; display: inline-flex; align-items: center; }
.late { margin: 4px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--bad-bg); color: var(--bad); font-size: 14px; font-weight: 600; }
.periods { display: flex; flex-wrap: wrap; gap: 6px 24px; color: var(--muted); }
.periods p { margin: 0; }
.periods strong { color: var(--ink); }
.note { color: var(--warn) !important; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin: 18px 0; scroll-margin-top: 12px; }
.panel h2 { margin: 0 0 6px; font-size: 21px; }
.minor { font-size: 15px; margin: 18px 0 8px; }
.empty { color: var(--muted); font-style: italic; }
.small-print { font-size: 14px; }
.fine { color: var(--muted); font-size: 14px; margin-top: 24px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid #e8eef1; vertical-align: middle; }
th { font-size: 14px; color: var(--muted); font-weight: 650; }
.num, td.amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.amount.in { color: var(--good); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.tag.behind { background: var(--bad-bg); color: var(--bad); }
.tag.covered { background: var(--good-bg); color: var(--good); }
.tag.upcoming { background: #e6f2f8; color: #075e82; }
.tag.late { background: var(--warn-bg); color: var(--warn); }
tr.next td { background: #f4fafd; }

.review-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 10px; }
/* minmax(0, ...): a long bank description or a wide select must never widen the page. */
.review-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.review-list .what { display: grid; gap: 2px; min-width: 0; }
.review-list .what strong { overflow-wrap: anywhere; }
.review-list .meta { color: var(--muted); font-size: 14px; }
.review-list .pick { display: flex; gap: 8px; align-items: center; }

.chart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; align-items: end; height: 150px; padding: 6px 0 0; border-bottom: 1px solid var(--line); }
.chart .col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.chart .bar { width: 100%; max-width: 40px; border-radius: 5px 5px 0 0; background: #4fb3d9; min-height: 2px; }
.chart .bar.down { background: #e58a9c; border-radius: 0 0 5px 5px; }
.chart .m { font-size: 14px; color: var(--muted); }
.chart .m .short { display: none; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; margin: 10px 0 12px; }
.filters .grow { flex: 1 1 180px; }
table.tx td.desc { min-width: 220px; }
table.tx .desc strong { display: block; font-weight: 600; overflow-wrap: anywhere; }
table.tx .desc .meta { display: block; color: var(--muted); font-size: 14px; }
table.tx select { min-width: 150px; }
table.tx tr.excluded td { opacity: .55; }
.row-actions { display: flex; flex-wrap: wrap; gap: 2px; justify-content: flex-end; }
.quiet-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; color: var(--brand); font-weight: 650; }
.row-note td { background: #f8fbfc; }
.row-note form { display: flex; gap: 8px; align-items: center; }
.row-note input { flex: 1; }

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; align-items: end; margin-top: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid > button { justify-self: start; }
.form-msg { grid-column: 1 / -1; margin: 0; min-height: 22px; font-size: 14px; }
.form-msg.error { color: var(--bad); font-weight: 600; }
.paid-from { border: 0; padding: 0; margin: 0; display: grid; gap: 0; }
.paid-from legend { font-size: 14px; font-weight: 650; padding: 0; margin-bottom: 2px; }
.inline-form { margin-top: 12px; }
.inline-form summary { cursor: pointer; color: var(--brand); font-weight: 650; min-height: 44px; display: flex; align-items: center; }

.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.plain-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }

.connections { list-style: none; padding: 0; margin: 8px 0 16px; display: grid; gap: 10px; }
.connections > li { display: grid; grid-template-columns: 190px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid #edf2f4; }
.connections .state { color: var(--muted); }
.connections .state.bad, .connections .bad { color: var(--bad); font-weight: 600; }
.connections .bank { display: grid; gap: 8px; justify-items: start; }
.connections .bank .plain-list { width: 100%; }

.toast { position: fixed; left: 16px; right: 16px; bottom: 20px; margin: 0 auto; width: fit-content; max-width: 560px; padding: 12px 18px; border-radius: 10px; background: #17303e; color: #fff; font-size: 15px; box-shadow: 0 8px 30px #0f2a3640; z-index: 30; }
.toast.error { background: var(--bad); }
.toast-action { margin-left: 8px; background: #fff; color: var(--ink); border-color: #fff; min-height: 44px; padding: 8px 14px; }
table.tx select.tax-year { margin-top: 6px; min-width: 0; }
.plan-actions { display: flex; flex-wrap: wrap; gap: 2px; }
.plan-amount { display: flex; gap: 8px; width: 100%; }
.plan-amount input { flex: 1; }

/* The year-end packet. */
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.checklist { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 6px; color: var(--warn); }
.checklist a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; color: var(--brand); font-weight: 650; }
table.sched tr.sub td { color: var(--muted); }
table.sched tr.sub td:nth-child(2) { padding-left: 28px; }
table.sched tr.total td, table.sched tr.total th { font-weight: 700; border-top: 2px solid var(--line); }
table.sched th[scope="row"] { font-size: 14px; font-weight: 600; color: var(--ink); text-align: left; }
#ye-payments li { justify-content: space-between; }
#ye-payments li.total { font-weight: 700; }
.notes-list { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 6px; color: var(--muted); }
.print-only { display: none; }

@media print {
  /* "Print the packet" prints the packet alone, in black on white. */
  body.print-packet { background: #fff; }
  body.print-packet .site-header, body.print-packet .skip, body.print-packet .title-row, body.print-packet #status,
  body.print-packet .jump, body.print-packet .toast, body.print-packet .fine { display: none !important; }
  body.print-packet #app > *:not(#year-end) { display: none !important; }
  body.print-packet main { padding: 0; max-width: none; }
  body.print-packet #year-end { border: 0; padding: 0; margin: 0; }
  body.print-packet .panel-actions { display: none; }
  body.print-packet .print-only { display: block; }
  body.print-packet .print-head { font-size: 12px; color: #444; margin: 0 0 8px; }
  body.print-packet .checklist, body.print-packet .notes-list, body.print-packet .muted { color: #222; }
  body.print-packet table.sched tr { break-inside: avoid; }
}

@media (max-width: 960px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  main { padding: 20px 16px 40px; }
  .cards { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .title-actions { width: 100%; }
  .title-actions .year-pick { flex: 1; }
  .connections > li { grid-template-columns: 1fr; gap: 2px; }
  .review-list li { grid-template-columns: minmax(0, 1fr); }
  .review-list .pick { min-width: 0; }
  .review-list .pick select { flex: 1; min-width: 0; width: 100%; }
  /* The transactions table becomes one card per row. */
  table.tx thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.tx, table.tx tbody, table.tx tr, table.tx td { display: block; width: 100%; }
  table.tx tr { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
  table.tx td { border: 0; padding: 4px 0; }
  table.tx td.amount { text-align: left; font-size: 16px; font-weight: 700; }
  table.tx td.desc { min-width: 0; }
  table.tx select { width: 100%; }
  .row-actions { justify-content: flex-start; }
  .chart { height: 120px; gap: 3px; }
  .chart .m .long { display: none; }
  .chart .m .short { display: inline; }
}

/* #700 Legal & compliance: each deadline with what to do, the business's facts beside them, and its documents. */
.cp-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 8px 28px; align-items: start; }
.cp-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.cp-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 4px; min-width: 0; }
.cp-item.overdue { border-color: #e3aab5; background: #fffafb; }
.cp-head { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.cp-head .tag { flex: none; margin-top: 1px; }
.cp-title { display: grid; gap: 2px; min-width: 0; }
.cp-title strong { overflow-wrap: anywhere; }
.cp-title .meta, .cp-doc .meta, .cp-domains .meta, .cp-missing .meta { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.tag.later { background: #eef2f4; color: #3d5361; }
.cp-more summary { cursor: pointer; color: var(--brand); font-weight: 650; min-height: 44px; display: inline-flex; align-items: center; }
.cp-what { margin: 2px 0 8px; }
.cp-steps { margin: 0 0 10px; padding-left: 22px; display: grid; gap: 4px; }
.cp-sub { font-size: 14px; margin: 12px 0 6px; color: var(--muted); font-weight: 700; }
.cp-numbers, .cp-facts { margin: 0; display: grid; }
.cp-numbers div { display: grid; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); gap: 2px 12px; align-items: center; border-bottom: 1px solid #edf2f4; }
.cp-numbers dt, .cp-facts dt { color: var(--muted); font-size: 14px; }
.cp-numbers dd, .cp-facts dd { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; min-height: 44px; font-variant-numeric: tabular-nums; }
.cp-numbers dd span, .cp-facts dd span { overflow-wrap: anywhere; min-width: 0; }
.cp-links { list-style: none; padding: 0; margin: 6px 0; }
/* inline-block, so a label that wraps keeps its arrow at the end of the words; 11px + 22.5px + 11px is the 44px target. */
.cp-links a { display: inline-block; padding: 11px 0; color: var(--brand); font-weight: 650; }
.cp-note { margin: 6px 0; }
.cp-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.cp-file { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 18px; border-radius: 8px; background: var(--good); border: 1px solid var(--good); color: #fff; font-weight: 650; text-decoration: none; }
.cp-file:hover { filter: brightness(1.08); }
.cp-file span { margin-left: 6px; }
.cp-head .cp-file { margin-left: auto; flex: none; }
.cp-forms:empty { display: none; }
.cp-inline { margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f9fbfc; }
.cp-date { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-top: 10px; }
.cp-date .form-msg { flex-basis: 100%; margin: 0; }
.cp-business { background: #f8fbfc; border: 1px solid var(--line); border-radius: 12px; padding: 2px 16px 12px; min-width: 0; }
.cp-standing { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 6px; font-weight: 650; }
.cp-standing.bad { color: var(--bad); }
.cp-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #9fb3bd; margin-top: 7px; }
.cp-dot.good { background: var(--good); }
.cp-dot.bad { background: var(--bad); }
.cp-facts div { display: grid; padding: 6px 0 0; border-bottom: 1px solid #e3ebef; }
.cp-facts dd { min-height: 36px; }
.cp-facts dd:not(:has(button)) { min-height: 0; padding-bottom: 6px; }
.cp-domains { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.cp-domains li { display: grid; gap: 2px; }
.cp-docs .cp-doc { display: grid; gap: 2px; min-width: 0; flex: 1 1 260px; }
.cp-missing-box { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: var(--warn-bg); }
.cp-missing-title { margin: 0 0 6px; font-weight: 700; color: var(--warn); }
.cp-missing { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.cp-missing li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; }
.cp-missing li > span { display: grid; gap: 2px; min-width: 0; flex: 1 1 280px; }
#cp-status { margin: 8px 0; }
#cp-status.error { color: var(--bad); font-weight: 600; }
#cp-alert { margin: 8px 0; }
@media (max-width: 960px) {
  .cp-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .cp-numbers div { grid-template-columns: minmax(0, 1fr); padding-top: 6px; }
  .cp-head { flex-direction: column; gap: 6px; }
  .cp-actions > button { flex: 1 1 auto; }
  .cp-head .cp-file { margin-left: 0; }
}
.cp-later { margin-top: 10px; }
.cp-later > summary { cursor: pointer; color: var(--brand); font-weight: 650; min-height: 44px; display: flex; align-items: center; }
.cp-later > .cp-list { margin-top: 6px; }
