/* Finance -> Accounting (public/accounting.js). Every rule here is scoped
   under #staff-accounting, so nothing in it can restyle the rest of GROW,
   and it is drawn with GROW's own tokens and components (styles.css): the
   panels, tiles, chips, sub-tabs, badges, buttons and history tables. Money
   in is GROW's green (#1d6b1d) and money out its danger red; the chart pairs
   GROW blue for income with #B45309 for expenses, the colour-blind-safe pair
   the planner already uses. There is no dark mode, as GROW has none. */

#staff-accounting .acc-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* A wide table or chart scrolls inside its own box; positioned, the box
   also holds the hidden headings in it, which would otherwise sit out at
   the table's far edge and widen the whole page on a phone. */
#staff-accounting .table-wrap, #staff-accounting .acc-chart-wrap { position: relative; }
#staff-accounting .acc-tabs { margin-bottom: 16px; }
#staff-accounting .acc-chips { justify-content: center; margin: 0 0 20px; }
#staff-accounting .acc-select { font-size: 0.9rem; padding-block: 8px; padding-left: 10px; max-width: 100%; }
#staff-accounting textarea { width: 100%; resize: vertical; line-height: 1.45; }
#staff-accounting .acc-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
#staff-accounting .acc-in { color: #1d6b1d; }
#staff-accounting .acc-out { color: var(--danger); }
#staff-accounting .acc-sub {
  display: block; font-weight: 400; color: var(--muted); font-size: 0.8rem; margin-top: 2px;
  text-transform: none; letter-spacing: 0;
}
#staff-accounting .acc-issue { color: #8a3e06; }
#staff-accounting .acc-h3 { font-size: 1rem; margin: 0 0 8px; color: var(--ink); }
#staff-accounting .acc-plain-list { list-style: none; margin: 0; padding: 0; }
#staff-accounting .acc-loading, #staff-accounting .acc-empty { margin: 8px 0; }
#staff-accounting .acc-failed { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin: 8px 0; }
#staff-accounting .acc-failed .error { margin: 0; }
/* Something being fetched again: what is shown fades until it is replaced. */
#staff-accounting .acc-busy { opacity: 0.55; transition: opacity 0.15s; }
#staff-accounting .acc-toast { max-width: min(560px, calc(100% - 32px)); }
#staff-accounting .acc-tip .acc-tip-line { display: block; }
#staff-accounting .acc-code { color: var(--muted); font-size: 0.8rem; font-weight: 400; }
#staff-accounting .acc-row-actions { white-space: nowrap; text-align: right; }
#staff-accounting .acc-archived-row th, #staff-accounting .acc-archived-row td { color: var(--muted); }
#staff-accounting .table-wrap .history-table .acc-wrap { white-space: normal; min-width: 200px; overflow-wrap: anywhere; }
/* A date or an amount never breaks across lines (a "+" left on its own),
   and a column of figures is headed on the right, over its figures. */
#staff-accounting .history-table td.num, #staff-accounting .history-table .acc-date { white-space: nowrap; }
#staff-accounting .history-table th.num { text-align: right; }
/* Selects in a form stand as tall as the inputs beside them. */
#staff-accounting .field .acc-select { font-size: 1rem; padding-block: 10px; padding-left: 12px; }
/* A toggle that has its editor open looks pressed. */
#staff-accounting .btn-ghost[aria-expanded="true"] { background: var(--blue-pale); color: var(--blue-dark); }
#staff-accounting .acc-inline-field { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.9rem; }

/* ---------- Home ---------- */
#staff-accounting .acc-tiles { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
#staff-accounting .acc-tile .stat-value { font-size: 1.45rem; }
#staff-accounting .acc-tile .stat-value.acc-in { color: #1d6b1d; }
#staff-accounting .acc-tile .stat-value.acc-out { color: var(--danger); }
#staff-accounting .acc-feed-status { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; margin: 0 0 6px; }
#staff-accounting .acc-feed .hint { margin: 4px 0 0; }
#staff-accounting .acc-feed .table-wrap { margin-top: 16px; }
#staff-accounting .acc-feed .panel-inset .acc-h3 { margin-bottom: 10px; }
#staff-accounting .acc-awaiting + .acc-awaiting { border-top: 1px solid rgba(9, 106, 211, 0.15); padding-top: 12px; margin-top: 12px; }
#staff-accounting .acc-awaiting p { margin: 0 0 6px; }
#staff-accounting .acc-awaiting .acc-actions { margin-top: 8px; }
#staff-accounting .acc-archived { margin-top: 16px; }
#staff-accounting .acc-archived .hint { margin: 8px 0 0; }
#staff-accounting .acc-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin: 20px 0; }
#staff-accounting .acc-two .panel + .panel { margin-top: 0; }
#staff-accounting .acc-bars { list-style: none; margin: 0 0 8px; padding: 0; }
#staff-accounting .acc-bar-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; width: 100%; border: 0; background: none;
  font: inherit; color: inherit; text-align: left; padding: 8px 8px; border-radius: 10px; cursor: pointer;
}
#staff-accounting .acc-bar-row:hover { background: var(--blue-wash); }
#staff-accounting .acc-bar-row:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
#staff-accounting .acc-bar-name { font-weight: 700; overflow-wrap: anywhere; }
#staff-accounting .acc-bar-figure { font-variant-numeric: tabular-nums; white-space: nowrap; }
#staff-accounting .acc-bar-track { grid-column: 1 / -1; height: 8px; background: var(--blue-pale); border-radius: 999px; overflow: hidden; }
#staff-accounting .acc-bar-track span { display: block; height: 100%; background: var(--blue); border-radius: 999px; }
#staff-accounting .acc-six .acc-actions { margin-top: 8px; }
#staff-accounting .acc-recent-table th .acc-payee { text-align: left; }
#staff-accounting .acc-access .hint { margin: 0 0 12px; }
#staff-accounting .acc-access .table-wrap + .acc-form-row { margin-top: 18px; }
#staff-accounting .acc-access .acc-access-none { margin: 16px 0 0; }
#staff-accounting .acc-year p { margin: 0 0 12px; }

/* ---------- the chart ---------- */
#staff-accounting .acc-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 8px; font-size: 0.85rem; }
#staff-accounting .acc-key { display: inline-flex; align-items: center; gap: 6px; }
#staff-accounting .acc-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
#staff-accounting .acc-swatch-income { background: #096AD3; }
#staff-accounting .acc-swatch-expense { background: #B45309; }
#staff-accounting .acc-chart-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
#staff-accounting .acc-chart { display: block; width: 100%; height: auto; }
#staff-accounting .acc-grid line { stroke: var(--line); stroke-width: 1; }
#staff-accounting .acc-grid text, #staff-accounting .acc-axis { fill: var(--muted); font-size: 11px; font-family: inherit; }
#staff-accounting .acc-axis-year { font-size: 10px; }
#staff-accounting .acc-baseline { stroke: #b9c5d6; stroke-width: 1; }
#staff-accounting .acc-bar-income { fill: #096AD3; }
#staff-accounting .acc-bar-expense { fill: #B45309; }
#staff-accounting .acc-partial .acc-bar-income, #staff-accounting .acc-partial .acc-bar-expense { opacity: 0.55; }
#staff-accounting .acc-hit { fill: transparent; }
#staff-accounting .acc-month { outline: none; }
#staff-accounting .acc-month:hover .acc-hit, #staff-accounting .acc-month:focus .acc-hit { fill: var(--blue-wash); }
#staff-accounting .acc-month:focus-visible .acc-hit { stroke: var(--blue); stroke-width: 2; }

/* ---------- Finances: Reconcile ---------- */
#staff-accounting .acc-recon-controls { padding: 20px 22px; }
#staff-accounting .acc-status-chips { margin-bottom: 14px; }
#staff-accounting .acc-chip-count { font-weight: 400; opacity: 0.8; margin-left: 2px; }
#staff-accounting .acc-filters { margin-bottom: 0; }
#staff-accounting .acc-search { flex: 1 1 100%; min-width: 0; }
#staff-accounting .acc-search .search { margin: 0; }
#staff-accounting .acc-bulk .acc-actions { margin-top: 14px; }
#staff-accounting .acc-transfers, #staff-accounting .acc-rule-suggestions { margin: 20px 0; }
#staff-accounting .acc-suggestion { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid rgba(9, 106, 211, 0.15); }
#staff-accounting .acc-suggestion:first-child { border-top: 0; padding-top: 2px; }
#staff-accounting .acc-suggestion-what { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
#staff-accounting .acc-transfer { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 8px 0; }
#staff-accounting .acc-arrow { color: var(--muted); font-size: 0.85rem; }
#staff-accounting .panel + div[data-acc-region] > .panel-inset { margin-top: 20px; }
#staff-accounting .acc-lines { margin-top: 20px; padding: 8px 12px; }
#staff-accounting .acc-lines > div > .acc-empty, #staff-accounting .acc-lines > div > .acc-loading,
#staff-accounting .acc-lines > div > .acc-failed, #staff-accounting .acc-lines > div > .acc-actions { margin: 14px 16px; }
#staff-accounting .acc-more { text-align: center; padding: 16px 0 10px; }
#staff-accounting .acc-more .hint { margin: 0 0 8px; }

/* One bank line: when, who and what, how much, where it stands; then its
   actions on a row of their own, set in under the payee. */
#staff-accounting .acc-line { padding: 14px 12px 14px 16px; border-bottom: 1px solid var(--line); }
#staff-accounting .acc-line:last-child { border-bottom: 0; }
#staff-accounting .acc-suggested { background: var(--blue-wash); box-shadow: inset 4px 0 0 var(--blue); }
#staff-accounting .acc-line-main {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) auto 112px; gap: 4px 16px; align-items: baseline;
}
#staff-accounting .acc-line-date { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.9rem; white-space: nowrap; }
#staff-accounting .acc-line-what { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
#staff-accounting .acc-payee {
  border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--ink); text-align: left; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; overflow-wrap: anywhere;
}
#staff-accounting .acc-payee:hover { color: var(--blue); text-decoration-color: currentColor; }
#staff-accounting .acc-payee:focus-visible, #staff-accounting .acc-crumb:focus-visible, #staff-accounting .acc-sheet-link:focus-visible,
#staff-accounting .acc-flag:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
#staff-accounting .acc-payee-text { font-weight: 700; overflow-wrap: anywhere; }
#staff-accounting .acc-line-meta { color: var(--muted); font-size: 0.85rem; overflow-wrap: anywhere; }
#staff-accounting .acc-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
#staff-accounting .acc-flag {
  display: inline-block; border: 0; border-radius: 999px; padding: 2px 10px; font: inherit; font-size: 0.75rem; font-weight: 700;
  background: var(--blue-pale); color: var(--blue-dark); cursor: pointer; text-align: left;
}
#staff-accounting button.acc-flag:hover { text-decoration: underline; }
#staff-accounting .acc-flag-plain { background: #eef2f7; color: #4b5565; cursor: default; }
#staff-accounting .acc-suggestion-tag { font-size: 0.8rem; color: var(--blue-dark); font-weight: 700; }
#staff-accounting .acc-amount { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
#staff-accounting .acc-line-status { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
#staff-accounting .acc-line-actions { margin: 10px 0 0 108px; display: flex; flex-direction: column; gap: 6px; }
#staff-accounting .acc-actions-main, #staff-accounting .acc-actions-more { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#staff-accounting .acc-actions-more { gap: 2px 4px; }
#staff-accounting .acc-actions-more .btn-ghost { padding: 4px 10px; }
#staff-accounting .acc-actions-main .hint { font-size: 0.85rem; }
#staff-accounting .acc-cat-select { min-width: 240px; }
#staff-accounting .acc-who { color: var(--muted); font-size: 0.8rem; margin-left: auto; }
#staff-accounting .acc-note { margin: 8px 0 0 108px; font-size: 0.9rem; overflow-wrap: anywhere; white-space: pre-line; }
#staff-accounting .acc-note-label {
  display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px; background: var(--blue-pale); color: var(--blue-dark);
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; vertical-align: 1px; white-space: nowrap;
}
#staff-accounting .acc-line-error { margin: 8px 0 0 108px; }

/* The editor open under a line: the note, the split, the refund. */
#staff-accounting .acc-panel { margin: 12px 0 0 108px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
#staff-accounting .acc-panel-label { display: block; font-weight: 700; margin: 0 0 6px; }
#staff-accounting .acc-panel .hint { margin: 0 0 10px; }
#staff-accounting .acc-panel .acc-actions { margin-top: 12px; }
#staff-accounting .acc-split-row { display: grid; grid-template-columns: 160px minmax(0, 1fr) auto; gap: 10px; align-items: end; margin-bottom: 10px; }
#staff-accounting .acc-split-row label span { display: block; font-weight: 700; font-size: 0.8rem; margin-bottom: 4px; }
#staff-accounting .acc-split-row input, #staff-accounting .acc-split-row select { width: 100%; }
#staff-accounting .acc-split-amount input { text-align: right; font-variant-numeric: tabular-nums; }
#staff-accounting .acc-remainder { font-weight: 700; color: #8a3e06; margin: 12px 0 0; }
#staff-accounting .acc-remainder.acc-balanced { color: #1d6b1d; }
#staff-accounting .acc-refund-search { width: 100%; margin-bottom: 10px; }
#staff-accounting .acc-candidates { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 340px; overflow-y: auto; }
#staff-accounting .acc-candidate { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
#staff-accounting .acc-candidate:has(input:checked) { border-color: var(--blue); background: var(--blue-wash); }
#staff-accounting .acc-candidate input { margin-top: 4px; accent-color: var(--blue); flex-shrink: 0; }
#staff-accounting .acc-candidate-text { display: flex; flex-direction: column; gap: 2px; font-size: 0.9rem; min-width: 0; overflow-wrap: anywhere; }
#staff-accounting .acc-candidate-match { color: var(--blue-dark); font-size: 0.8rem; font-weight: 700; }
#staff-accounting .acc-candidate-off { opacity: 0.6; cursor: not-allowed; }

/* ---------- forms laid out in a row ---------- */
#staff-accounting .acc-form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
#staff-accounting .acc-form-row .field { margin: 0; flex: 1 1 180px; min-width: 0; }
#staff-accounting .acc-form-row .field input, #staff-accounting .acc-form-row .field select { width: 100%; }
#staff-accounting .acc-form-row .btn { flex: 0 0 auto; }
#staff-accounting .acc-form-row .acc-code-field { flex: 0 1 150px; }
#staff-accounting [data-acc-form-error] { margin: 10px 0 0; }

/* ---------- Rules and Categories ---------- */
#staff-accounting .acc-rules-table td, #staff-accounting .acc-rules-table th { vertical-align: top; }
#staff-accounting .acc-rules-table .acc-select { min-width: 200px; max-width: 280px; }
#staff-accounting .acc-rule-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
/* The categories' three tables keep one set of columns, so they line up. */
@media (min-width: 621px) {
  #staff-accounting .acc-cat-table { table-layout: fixed; }
  #staff-accounting .acc-cat-table th:nth-child(1) { width: 27%; }
  #staff-accounting .acc-cat-table th:nth-child(2) { width: 8%; }
  #staff-accounting .acc-cat-table th:nth-child(3) { width: 16%; }
  #staff-accounting .acc-cat-table th:nth-child(4) { width: 13%; }
  #staff-accounting .acc-cat-table th:nth-child(5) { width: 36%; }
  #staff-accounting .acc-cat-table th, #staff-accounting .acc-cat-table td { overflow-wrap: anywhere; }
}
#staff-accounting .acc-cat-table .acc-row-actions { text-align: left; }
#staff-accounting .acc-impact-row > td { background: var(--blue-wash); }
#staff-accounting .acc-impact { margin: 4px 0; }
#staff-accounting .acc-impact .acc-form-row .field { flex: 0 1 380px; }
#staff-accounting .acc-rules-table .acc-impact .acc-select { max-width: none; }
#staff-accounting .table-wrap .history-table .acc-impact-row > td { white-space: normal; }
#staff-accounting .acc-impact-facts { margin: 14px 0 12px; padding-left: 18px; }
#staff-accounting .acc-impact-facts li { margin: 6px 0; }
#staff-accounting .acc-samples { margin: 4px 0 0; padding-left: 16px; color: var(--muted); font-size: 0.85rem; }
#staff-accounting .acc-bulk-details { margin-top: 18px; }
#staff-accounting .acc-bulk-details form { margin-top: 12px; }
#staff-accounting .acc-bulk-preview { margin-top: 16px; }
#staff-accounting .acc-bulk-preview .table-wrap { margin-bottom: 14px; }
#staff-accounting .acc-skipped li { padding: 4px 0; overflow-wrap: anywhere; }

/* ---------- Statements ---------- */
#staff-accounting .acc-file-field input[type="file"] { width: 100%; padding: 12px; border: 1px dashed var(--blue); border-radius: 10px; background: var(--blue-wash); cursor: pointer; }
#staff-accounting .acc-preview { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 18px; }
#staff-accounting .acc-preview .acc-h3 { margin-top: 18px; }
#staff-accounting .acc-preview .acc-file-name { margin-top: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
#staff-accounting .acc-warning { background: #fff4e5; color: #7a3e00; border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; }
#staff-accounting .acc-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 20px; margin: 0 0 6px; }
#staff-accounting .acc-facts div { min-width: 0; }
#staff-accounting .acc-facts dt { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; }
#staff-accounting .acc-facts dd { margin: 2px 0 0; font-weight: 700; overflow-wrap: anywhere; }
#staff-accounting .acc-imported { margin: 18px 0 0; }
#staff-accounting .acc-imported p { margin: 0; }
#staff-accounting .acc-runs-table td { vertical-align: top; }

/* ---------- Reports ---------- */
#staff-accounting .acc-report-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 20px; padding: 18px 22px; }
#staff-accounting .acc-report-filters .field { margin: 0; flex: 1 1 170px; min-width: 0; }
#staff-accounting .acc-report-filters .field input, #staff-accounting .acc-report-filters .field select { width: 100%; }
#staff-accounting .acc-range-problem { flex-basis: 100%; margin: 0; }
#staff-accounting .acc-range-problem:empty { display: none; }

/* The Profit and Loss as a statement: an indented line for each category,
   a rule over each total, and a single and double rule round the bottom
   line. */
#staff-accounting .acc-sheet { max-width: 780px; margin: 0 auto; }
#staff-accounting .acc-sheet-head { text-align: center; margin-bottom: 18px; }
#staff-accounting .acc-sheet-title { font-size: 1.6rem; margin: 0; }
#staff-accounting .acc-sheet-org { font-weight: 700; margin: 6px 0 0; }
#staff-accounting .acc-sheet-period { color: var(--muted); margin: 2px 0 6px; }
#staff-accounting .acc-sheet-head .hint { margin: 0; }
#staff-accounting .acc-sheet-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
#staff-accounting .acc-sheet-table th, #staff-accounting .acc-sheet-table td { padding: 7px 10px; text-align: left; font-weight: 400; vertical-align: baseline; }
#staff-accounting .acc-sheet-table thead th { border-bottom: 2px solid var(--blue); color: var(--blue); font-weight: 700; font-size: 0.85rem; }
#staff-accounting .acc-sheet-table .num { text-align: right; white-space: nowrap; }
#staff-accounting .acc-sheet-section th { font-weight: 700; padding-top: 18px; border-bottom: 1px solid var(--line); }
#staff-accounting .acc-sheet-row th { padding-left: 26px; }
#staff-accounting .acc-sheet-row, #staff-accounting .acc-sheet-total { cursor: pointer; }
#staff-accounting .acc-sheet-row:hover, #staff-accounting .acc-sheet-total:hover { background: var(--blue-wash); }
#staff-accounting .acc-sheet-link { border: 0; background: none; padding: 0; font: inherit; color: var(--blue-dark); text-align: left; cursor: pointer; }
#staff-accounting .acc-sheet-link:hover { text-decoration: underline; }
#staff-accounting .acc-sheet-total th, #staff-accounting .acc-sheet-total td { font-weight: 700; border-top: 1px solid var(--ink); }
#staff-accounting .acc-sheet-total .acc-sheet-link { font-weight: 700; color: var(--ink); }
#staff-accounting .acc-sheet-net th, #staff-accounting .acc-sheet-net td {
  font-weight: 700; padding-top: 12px; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink);
}
#staff-accounting .acc-sheet-net.acc-deficit td { color: var(--danger); }
#staff-accounting .acc-sheet-empty td { color: var(--muted); font-style: italic; padding-left: 26px; }
#staff-accounting .acc-waiting-note { margin: 18px 0 0; }
#staff-accounting .acc-waiting-note .btn { margin-left: 4px; }
#staff-accounting .acc-basis { margin: 8px 0 0; }

#staff-accounting .acc-crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0 0 6px; padding: 0; font-size: 0.9rem; color: var(--muted); }
#staff-accounting .acc-crumbs li { overflow-wrap: anywhere; }
#staff-accounting .acc-crumbs li + li::before { content: "\203A"; margin-right: 8px; color: var(--muted); }
#staff-accounting .acc-crumb { border: 0; background: none; padding: 0; font: inherit; color: var(--blue); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
#staff-accounting .acc-back-row { margin: 0 0 12px; }
#staff-accounting .acc-back-row .btn { padding-left: 4px; }
#staff-accounting .acc-ledger-group { margin: 22px 0 6px; }
#staff-accounting .acc-ledger-table td:first-child { white-space: nowrap; }
#staff-accounting .acc-ledger-table td { vertical-align: top; }
#staff-accounting .acc-ledger-table tfoot th, #staff-accounting .acc-ledger-table tfoot td { border-top: 2px solid var(--blue); border-bottom: 0; font-weight: 700; }
#staff-accounting .acc-ledger-table tfoot th, #staff-accounting .acc-ledger-grand th {
  text-transform: none; letter-spacing: 0; font-size: 0.95rem; color: var(--ink); padding: 10px;
}
#staff-accounting .acc-ledger-grand { margin-top: 10px; }
#staff-accounting .acc-ledger-grand tfoot th, #staff-accounting .acc-ledger-grand tfoot td { border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); font-weight: 700; }
#staff-accounting .acc-ie-head h2 { margin-bottom: 2px; }
#staff-accounting .acc-ie-head p { margin: 0 0 16px; }
#staff-accounting .acc-ie-totals { margin-bottom: 16px; }
#staff-accounting .acc-ie > .hint { margin: 8px 0 0; }
#staff-accounting .acc-numbers { margin-top: 16px; }
#staff-accounting .acc-numbers .table-wrap { margin-top: 10px; }
#staff-accounting .acc-numbers-table tfoot th, #staff-accounting .acc-numbers-table tfoot td {
  border-top: 2px solid var(--blue); border-bottom: 0; font-weight: 700; text-transform: none; letter-spacing: 0; font-size: 0.95rem; color: var(--ink);
}

/* ---------- the transaction page ---------- */
#staff-accounting .acc-txn-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
#staff-accounting .acc-txn-head .home-kicker { margin-bottom: 4px; }
#staff-accounting .acc-txn-head h2 { margin: 0; }
#staff-accounting .acc-txn-total { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#staff-accounting .acc-txn-total .acc-amount { font-size: 1.6rem; }
#staff-accounting .acc-txn-section { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 16px; }
#staff-accounting .acc-txn-section p { margin: 0; }
#staff-accounting .acc-txn-section .acc-plain-list li { padding: 3px 0; overflow-wrap: anywhere; }
#staff-accounting .acc-txn-section .table-wrap { margin-top: 10px; }
#staff-accounting .acc-txn-section .acc-note { margin: 8px 0 0; }
/* On its own page a line's date, payee and amount are already above, so
   only its actions and editors show, without the list's indent. */
#staff-accounting .acc-line-detail .acc-line { padding: 0; border: 0; background: none; box-shadow: none; }
#staff-accounting .acc-line-detail .acc-line-main, #staff-accounting .acc-line-detail .acc-line > .acc-note { display: none; }
#staff-accounting .acc-line-detail .acc-line-actions, #staff-accounting .acc-line-detail .acc-panel,
#staff-accounting .acc-line-detail .acc-line-error { margin-left: 0; }
#staff-accounting .acc-line-detail .acc-line-actions { margin-top: 0; }
#staff-accounting .acc-line-detail .acc-who { display: none; }
#staff-accounting .acc-current-row th, #staff-accounting .acc-current-row td { background: var(--blue-wash); }

@media (max-width: 760px) {
  #staff-accounting .acc-two { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}

/* ---------- phones ----------
   One column; a line's actions full width on rows of their own; inputs at
   16px so iOS does not zoom; every control at least 44px tall; tables
   scroll inside their .table-wrap. */
@media (max-width: 620px) {
  #staff-accounting .btn, #staff-accounting .chip, #staff-accounting .subtab, #staff-accounting .acc-select,
  #staff-accounting input:not([type="radio"]):not([type="checkbox"]), #staff-accounting .acc-bar-row { min-height: 44px; }
  #staff-accounting .acc-select, #staff-accounting input, #staff-accounting textarea { font-size: 16px; }
  #staff-accounting .btn.btn-small { padding: 10px 14px; font-size: 0.85rem; }
  #staff-accounting .acc-payee, #staff-accounting .acc-crumb, #staff-accounting .acc-sheet-link, #staff-accounting button.acc-flag {
    min-height: 44px; display: inline-flex; align-items: center;
  }
  #staff-accounting button.acc-flag { min-height: 36px; padding: 6px 12px; }
  #staff-accounting .acc-tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  #staff-accounting .acc-tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  #staff-accounting .acc-tile { padding: 12px 14px; }
  #staff-accounting .acc-tile .stat-value { font-size: 1.2rem; }
  #staff-accounting .acc-recon-controls, #staff-accounting .acc-report-filters { padding: 16px 14px; }
  #staff-accounting .acc-search, #staff-accounting .acc-inline-field { flex: 1 1 100%; min-width: 0; }
  #staff-accounting .acc-inline-field .acc-select { flex: 1; min-width: 0; width: 100%; }
  #staff-accounting .acc-lines { padding: 4px 4px; }
  #staff-accounting .acc-line { padding: 12px 10px 14px 12px; }
  #staff-accounting .acc-line-main { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  #staff-accounting .acc-line-date { grid-column: 1 / -1; }
  #staff-accounting .acc-line-what { grid-column: 1; grid-row: 2; }
  #staff-accounting .acc-line-main > .acc-amount { grid-column: 2; grid-row: 2; }
  #staff-accounting .acc-line-status { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; align-items: center; gap: 8px; text-align: left; }
  #staff-accounting .acc-line-actions, #staff-accounting .acc-note, #staff-accounting .acc-panel, #staff-accounting .acc-line-error { margin-left: 0; }
  #staff-accounting .acc-actions-main { flex-direction: column; align-items: stretch; }
  #staff-accounting .acc-actions-main .acc-select, #staff-accounting .acc-actions-main .btn { width: 100%; min-width: 0; }
  #staff-accounting .acc-who { margin-left: 0; flex-basis: 100%; }
  #staff-accounting .acc-panel { padding: 12px; }
  #staff-accounting .acc-split-row { grid-template-columns: minmax(0, 1fr); gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  #staff-accounting .acc-form-row { flex-direction: column; align-items: stretch; }
  #staff-accounting .acc-form-row .field, #staff-accounting .acc-form-row .acc-code-field,
  #staff-accounting .acc-impact .acc-form-row .field { flex: 0 0 auto; }
  #staff-accounting .acc-report-filters .field { flex: 1 1 100%; }
  #staff-accounting .acc-report-filters .btn { width: 100%; }
  #staff-accounting .acc-suggestion, #staff-accounting .acc-transfer { flex-direction: column; align-items: stretch; }
  #staff-accounting .acc-suggestion-what { flex: 0 0 auto; }
  #staff-accounting .acc-cat-select, #staff-accounting .acc-rules-table .acc-select { min-width: 0; }
  #staff-accounting .acc-sheet-table th, #staff-accounting .acc-sheet-table td { padding: 6px 6px; }
  #staff-accounting .acc-sheet-row th, #staff-accounting .acc-sheet-empty td { padding-left: 14px; }
  #staff-accounting .acc-sheet-title { font-size: 1.35rem; }
  #staff-accounting .acc-txn-total { align-items: flex-start; }
  #staff-accounting .acc-facts { grid-template-columns: 1fr 1fr; }
  /* Home's recent lines and the access list as one card a row, so the
     amount (or the access) is on screen rather than off to the side. */
  #staff-accounting .table-wrap .acc-recent-table, #staff-accounting .acc-recent-table tbody,
  #staff-accounting .table-wrap .acc-access-table, #staff-accounting .acc-access-table tbody { display: block; width: 100%; min-width: 0; }
  #staff-accounting .acc-recent-table thead, #staff-accounting .acc-access-table thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  #staff-accounting .acc-recent-table tr, #staff-accounting .acc-access-table tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line);
  }
  #staff-accounting .table-wrap .acc-recent-table td, #staff-accounting .table-wrap .acc-recent-table th,
  #staff-accounting .table-wrap .acc-access-table td, #staff-accounting .table-wrap .acc-access-table th {
    display: block; padding: 0; border: 0; white-space: normal; overflow-wrap: anywhere;
  }
  #staff-accounting .acc-recent-table td:nth-child(1) { grid-row: 1; grid-column: 1; color: var(--muted); font-size: 0.85rem; }
  #staff-accounting .acc-recent-table td:nth-child(4) { grid-row: 1; grid-column: 2; }
  #staff-accounting .acc-recent-table th { grid-column: 1 / -1; }
  #staff-accounting .acc-recent-table td:nth-child(3) { grid-column: 1 / -1; }
  #staff-accounting .acc-access-table th { grid-column: 1; }
  #staff-accounting .acc-access-table td:nth-child(2) { grid-column: 1 / -1; grid-row: 2; font-size: 0.9rem; }
  #staff-accounting .acc-access-table td:nth-child(3) { grid-column: 1 / -1; grid-row: 3; }
  #staff-accounting .acc-access-table td:nth-child(4) { grid-column: 2; grid-row: 1; }
  /* Each rule as a card: what it looks for, its category (full width),
     what is waiting, then its buttons, and its preview under it. */
  #staff-accounting .table-wrap .acc-rules-table, #staff-accounting .acc-rules-table tbody { display: block; width: 100%; min-width: 0; }
  #staff-accounting .acc-rules-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #staff-accounting .acc-rules-table tr { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
  #staff-accounting .table-wrap .acc-rules-table td, #staff-accounting .table-wrap .acc-rules-table th {
    display: block; padding: 0; border: 0; white-space: normal; text-align: left; margin-top: 8px;
  }
  #staff-accounting .table-wrap .acc-rules-table tr > :first-child { margin-top: 0; }
  #staff-accounting .acc-rules-table .acc-select { max-width: none; width: 100%; }
  #staff-accounting .acc-rules-table td.num .acc-sub { display: inline; margin-left: 4px; }
  #staff-accounting .acc-rule-actions { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px; }
  #staff-accounting .acc-rules-table .acc-impact-row { padding: 0 0 12px; }
  #staff-accounting .table-wrap .acc-rules-table .acc-impact-row > td { padding: 12px 10px; margin: 0; }
  /* A category as a card: its name and code, what uses it, its buttons. */
  #staff-accounting .table-wrap .acc-cat-table, #staff-accounting .acc-cat-table tbody { display: block; width: 100%; min-width: 0; }
  #staff-accounting .acc-cat-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #staff-accounting .acc-cat-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
  #staff-accounting .table-wrap .acc-cat-table td, #staff-accounting .table-wrap .acc-cat-table th { display: block; padding: 0; border: 0; white-space: normal; }
  #staff-accounting .acc-cat-table td:nth-child(2) { color: var(--muted); font-size: 0.85rem; }
  #staff-accounting .acc-cat-table td:nth-child(3), #staff-accounting .acc-cat-table td:nth-child(4) { grid-column: 1 / -1; color: var(--muted); font-size: 0.85rem; }
  #staff-accounting .acc-cat-table td.acc-row-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0 4px; margin-left: -10px; }
  /* Account Transactions as one card a line: when and how much, who, the
     account, and the running balance, each figure named. */
  #staff-accounting .table-wrap .acc-ledger-table, #staff-accounting .acc-ledger-table tbody, #staff-accounting .acc-ledger-table tfoot { display: block; width: 100%; min-width: 0; }
  #staff-accounting .acc-ledger-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #staff-accounting .acc-ledger-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--line); }
  #staff-accounting .table-wrap .acc-ledger-table td, #staff-accounting .table-wrap .acc-ledger-table th { display: block; padding: 0; border: 0; white-space: normal; min-width: 0; text-align: left; }
  #staff-accounting .acc-ledger-table tbody td:nth-child(1) { grid-row: 1; grid-column: 1; color: var(--muted); font-size: 0.85rem; }
  #staff-accounting .acc-ledger-table tbody td:nth-child(4), #staff-accounting .acc-ledger-table tbody td:nth-child(5) { grid-row: 1; grid-column: 2; text-align: right; font-weight: 700; }
  #staff-accounting .acc-ledger-table tbody td:nth-child(3) { grid-row: 2; grid-column: 1 / -1; }
  #staff-accounting .acc-ledger-table tbody td:nth-child(2) { grid-row: 3; grid-column: 1; color: var(--muted); font-size: 0.85rem; }
  #staff-accounting .acc-ledger-table tbody td:nth-child(6) { grid-row: 3; grid-column: 2; color: var(--muted); font-size: 0.85rem; text-align: right; }
  #staff-accounting .acc-ledger-table td:empty { display: none; }
  #staff-accounting .acc-ledger-table tbody td:nth-child(4)::before { content: "Debit "; font-weight: 400; color: var(--muted); font-size: 0.8rem; }
  #staff-accounting .acc-ledger-table tbody td:nth-child(5)::before { content: "Credit "; font-weight: 400; color: var(--muted); font-size: 0.8rem; }
  #staff-accounting .acc-ledger-table tbody td:nth-child(6)::before { content: "Balance "; }
  #staff-accounting .acc-ledger-table tfoot tr, #staff-accounting .acc-ledger-grand tr { grid-template-columns: minmax(0, 1fr); border-bottom: 0; }
  #staff-accounting .acc-ledger-table tfoot td::before, #staff-accounting .acc-ledger-grand td::before { font-weight: 400; color: var(--muted); font-size: 0.85rem; }
  #staff-accounting .acc-ledger-table tfoot td:nth-of-type(1)::before, #staff-accounting .acc-ledger-grand td:nth-of-type(1)::before { content: "Debit "; }
  #staff-accounting .acc-ledger-table tfoot td:nth-of-type(2)::before, #staff-accounting .acc-ledger-grand td:nth-of-type(2)::before { content: "Credit "; }
  #staff-accounting .acc-ledger-table tfoot td:nth-of-type(3)::before, #staff-accounting .acc-ledger-grand td:nth-of-type(3)::before { content: "Net "; }
  #staff-accounting .acc-ledger-table tfoot th, #staff-accounting .acc-ledger-table tfoot td { border: 0; }
  #staff-accounting .acc-ledger-table tfoot { border-top: 2px solid var(--blue); }
  #staff-accounting .acc-waiting-note .btn { display: block; width: fit-content; margin: 8px 0 0; }
}

/* ---------- sub-categories and budgets ----------
   The picker on a line: the category, which sub-category (which event),
   and the budget. A sub-category in a table is set in under its parent. */
#staff-accounting .acc-sub-select { min-width: 200px; }
#staff-accounting .acc-tag-select { min-width: 150px; }
#staff-accounting .acc-subcat-slot:empty { display: none; }
#staff-accounting .acc-flag-budget { background: #e8f5ec; color: #1d5a2a; cursor: default; }
#staff-accounting .acc-flag-vat { background: #fff4e5; color: #7a3e00; cursor: default; }
#staff-accounting .acc-vat-select { min-width: 110px; }
#staff-accounting .acc-cat-vat { min-width: 110px; max-width: 160px; }
#staff-accounting .acc-cat-sub th { padding-left: 28px; font-weight: 400; }
#staff-accounting .acc-cat-arrow { color: var(--muted); margin-right: 2px; }
#staff-accounting .acc-cat-tag { min-width: 150px; max-width: 220px; }
#staff-accounting .acc-cat-table .badge { margin-left: 6px; }
#staff-accounting .acc-parents-panel .hint { margin: 10px 0 0; }
#staff-accounting .acc-parents { margin-bottom: 4px; }
#staff-accounting .acc-split-row { grid-template-columns: 140px minmax(0, 1fr) minmax(140px, 0.6fr) auto; }

/* The Profit and Loss: a category with sub-categories opens to them. */
#staff-accounting .acc-sheet-toggle {
  border: 0; background: none; padding: 0 6px 0 0; margin-left: -18px; width: 18px; font: inherit; color: var(--blue-dark); cursor: pointer;
}
#staff-accounting .acc-sheet-toggle:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; border-radius: 4px; }
#staff-accounting .acc-sheet-sub th { padding-left: 48px; color: var(--muted); }
#staff-accounting .acc-sheet-sub td { color: var(--muted); }
#staff-accounting .acc-sheet-sub .acc-sheet-link { color: var(--muted); }
#staff-accounting .acc-sheet-sub .acc-sheet-link:hover { color: var(--blue-dark); }

/* Budgets: the amount for the year, what is spent, and a bar of it. */
#staff-accounting .acc-budgets-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 20px; align-items: flex-start; margin-bottom: 12px; }
#staff-accounting .acc-budgets-head h2 { margin-bottom: 2px; }
#staff-accounting .acc-budgets-head .hint { margin: 0; }
#staff-accounting .acc-budget-totals { margin-bottom: 16px; }
#staff-accounting .acc-budget-form { display: inline-flex; gap: 6px; align-items: center; }
#staff-accounting .acc-budget-form input { width: 120px; text-align: right; font-variant-numeric: tabular-nums; padding: 6px 8px; }
#staff-accounting .acc-budget-cell { min-width: 150px; }
#staff-accounting .acc-budget-track { display: block; height: 8px; background: var(--blue-pale); border-radius: 999px; overflow: hidden; margin-bottom: 3px; }
#staff-accounting .acc-budget-track span { display: block; height: 100%; background: var(--blue); border-radius: 999px; }
#staff-accounting .acc-budget-over span { background: var(--danger); }
#staff-accounting .acc-budgets + .panel { margin-top: 20px; }

/* The Visualisation: three donuts, each with its legend beside it (under
   it on a phone), and every slice a mark with the chart's tooltip. The
   slice colours are told apart by their legend, never by colour alone. */
#staff-accounting .acc-viz-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; margin-top: 16px; }
#staff-accounting .acc-pie-figure { margin: 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 10px; align-content: start; background: #fff; }
#staff-accounting .acc-pie-figure figcaption .acc-h3 { margin-bottom: 4px; }
#staff-accounting .acc-pie-figure figcaption .hint { margin: 0; font-size: 0.85rem; }
#staff-accounting .acc-pie-layout { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
#staff-accounting .acc-pie { flex: 0 0 auto; max-width: 100%; height: auto; font-family: inherit; }
#staff-accounting .acc-pie-slice { stroke: #fff; stroke-width: 2; cursor: pointer; transition: opacity 0.15s ease; outline: none; }
#staff-accounting .acc-pie-slice:hover { opacity: 0.82; }
#staff-accounting .acc-pie-slice:focus-visible { stroke: var(--ink); stroke-width: 3; }
#staff-accounting .acc-pie-empty { fill: none; stroke: var(--blue-pale); }
#staff-accounting .acc-pie-centre-value { fill: var(--ink); font-size: 22px; font-weight: 700; pointer-events: none; }
#staff-accounting .acc-pie-centre-label { fill: var(--muted); font-size: 12px; pointer-events: none; }
#staff-accounting .acc-pie-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; flex: 1 1 200px; min-width: 0; font-size: 0.9rem; }
#staff-accounting .acc-pie-legend li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
#staff-accounting .acc-pie-legend .acc-pie-none { color: var(--muted); }
#staff-accounting .acc-pie-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; flex: 0 0 auto; background: var(--line); }
#staff-accounting .acc-pie-name { min-width: 0; overflow-wrap: anywhere; }
#staff-accounting .acc-pie-amount { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
#staff-accounting .acc-pie-share { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 3.2em; text-align: right; }
#staff-accounting .acc-slot-1 { fill: #096AD3; background: #096AD3; }
#staff-accounting .acc-slot-2 { fill: #B45309; background: #B45309; }
#staff-accounting .acc-slot-3 { fill: #1d8a5a; background: #1d8a5a; }
#staff-accounting .acc-slot-4 { fill: #6b4fd6; background: #6b4fd6; }
#staff-accounting .acc-slot-5 { fill: #c2185b; background: #c2185b; }
#staff-accounting .acc-slot-6 { fill: #0e7c86; background: #0e7c86; }
#staff-accounting .acc-slot-7 { fill: #d4a017; background: #d4a017; }
#staff-accounting .acc-slot-8 { fill: #7a5230; background: #7a5230; }
#staff-accounting .acc-slot-other { fill: #8a8f8c; background: #8a8f8c; }
#staff-accounting .acc-slot-none { fill: var(--line); background: var(--line); }
#staff-accounting .acc-viz .acc-numbers { margin-top: 4px; }

@media (max-width: 640px) {
  #staff-accounting .acc-sub-select, #staff-accounting .acc-tag-select, #staff-accounting .acc-vat-select, #staff-accounting .acc-cat-tag, #staff-accounting .acc-cat-vat { min-width: 0; width: 100%; }
  #staff-accounting .acc-split-row { grid-template-columns: minmax(0, 1fr); }
  #staff-accounting .acc-viz-charts { grid-template-columns: 1fr; }
  #staff-accounting .acc-pie-layout { justify-content: center; }
  #staff-accounting .acc-sheet-sub th { padding-left: 28px; }
  #staff-accounting .acc-sheet-toggle { margin-left: -14px; width: 14px; }
}

/* A line that pays an invoice, and the invoice offered for money in. */
#staff-accounting .acc-flag-invoice { background: #fff1e0; color: #7a3e00; cursor: default; }
#staff-accounting .acc-invoice-guess { flex-basis: 100%; }

/* The paid expense offered for money out, and the one a line pays. */
#staff-accounting .acc-expense-guess, #staff-accounting .acc-expense-link { flex-basis: 100%; }
