/* Kazakhstan Tennis Federation brand (brandbook "Руководство по применению фирменного стиля"):
   red RGB 188:62:15, green RGB 1:87:57, black, white, grey RGB 157:158:158.
   Fonts: one plain system font (Segoe UI on Windows) for everything, no italics. */
:root {
  color-scheme: light;
  --brand-red: #bc3e0f;
  --brand-red-dark: #9a320c;
  --brand-red-soft: #f8ebe5;
  --brand-green: #015739;
  --brand-green-soft: #e6efe9;
  --brand-grey: #9d9e9e;
  --brand-black: #000000;

  --page: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #f1f1ef;
  --ink: #1a1a1a;
  --ink-2: #4a4a48;
  --muted: #7b7c7c;
  --line: #e2e2df;
  --line-strong: #c4c5c5;

  --accent: var(--brand-red);
  --accent-ink: #ffffff;
  --accent-soft: var(--brand-red-soft);

  /* chart: inflow = brand-green family (lightened one step to pass CVD checks), outflow = brand red */
  --series-in: #1a7a52;
  --series-out: #bc3e0f;

  --good: #1a7a52;
  --good-soft: #e6f2ec;
  --bad: #bc3e0f;
  --bad-soft: #f8ebe5;
  --warn-soft: #fbf3e2;

  --ktf: var(--brand-green);
  --ktf-soft: var(--brand-green-soft);
  --atp: #ffffff;
  --atp-bg: #2b2b2b;

  --radius: 4px;
  --shadow: 0 1px 2px rgba(0,0,0,.06);
  --font-head: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-text: 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-family: var(--font-text);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font-size: 14px; line-height: 1.45; }
a { color: var(--brand-green); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
h1, h2, h3, .head-font { font-family: var(--font-head); }
h1 { font-style: normal; font-size: 24px; margin: 0; font-weight: 600; color: var(--brand-red); line-height: 1.2; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 700; color: var(--brand-green); }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 700; }
.eyebrow { font-family: var(--font-head); font-style: normal; font-weight: 700; font-size: 12px; color: var(--brand-green); letter-spacing: .02em; margin-bottom: 2px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hidden { display: none !important; }
code { background: var(--surface-2); padding: 0 4px; border-radius: 3px; }

/* ---------- top bar (letterhead style: logo + red/green rule) ---------- */
.topbar { background: var(--surface); position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 var(--line); }
.topbar::after { content: ''; display: block; height: 4px; background: linear-gradient(90deg, var(--brand-red) 0 78%, var(--brand-green) 78% 100%); }
.topbar-inner { max-width: 1400px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: flex; align-items: center; gap: 14px; color: var(--ink); white-space: nowrap; text-decoration: none !important; }
.brand img { height: 40px; width: auto; display: block; }
.brand .app-name { font-family: var(--font-head); font-style: normal; font-weight: 700; font-size: 17px; color: var(--brand-red); padding-left: 14px; border-left: 1px solid var(--line-strong); line-height: 28px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; overflow-y: hidden; align-self: stretch; scrollbar-width: none; }
.nav a { display: flex; align-items: center; padding: 0 12px; color: var(--ink-2); white-space: nowrap; font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.nav a:hover { color: var(--brand-red); text-decoration: none; }
.nav a.active { color: var(--brand-red); border-bottom-color: var(--brand-red); }
.navmore { position: relative; align-self: stretch; display: flex; }
.navmore summary { list-style: none; display: flex; align-items: center; padding: 0 12px; color: var(--ink-2); font-weight: 500; cursor: pointer; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.navmore summary::-webkit-details-marker { display: none; }
.navmore summary::after { content: '▾'; margin-left: 6px; font-size: 11px; }
.navmore summary.active { color: var(--brand-red); border-bottom-color: var(--brand-red); }
.navmore .menu { position: absolute; top: 100%; right: 0; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--brand-red); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: 6px; display: grid; z-index: 30; }
.navmore .menu a { padding: 8px 12px; color: var(--ink); border-radius: 3px; white-space: nowrap; }
.navmore .menu a:hover, .navmore .menu a.active { background: var(--brand-green-soft); color: var(--brand-green); text-decoration: none; }
.userbox { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.userbox a { color: var(--ink); }
.role-chip { font-family: var(--font-head); font-style: normal; font-weight: 700; font-size: 10.5px; padding: 3px 9px; border-radius: 2px; background: var(--brand-green); color: #fff; letter-spacing: .04em; text-transform: uppercase; }
.role-chip.reader { background: var(--brand-grey); }
@media (max-width: 1240px) {
  .topbar-inner { flex-wrap: wrap; height: auto; padding-top: 10px; gap: 8px 20px; }
  .brand { flex: 1; }
  .nav { order: 3; flex-basis: 100%; height: 42px; }
}
@media (max-width: 560px) {
  .brand .app-name, .userbox .uname { display: none; }
  .page { padding: 16px; }
}

/* ---------- layout ---------- */
.page { max-width: 1400px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); margin-top: 6px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- controls ---------- */
button, .btn { font: inherit; font-weight: 500; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: var(--radius); padding: 7px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--ink-2); text-decoration: none; }
button.primary, .btn.primary { background: var(--brand-red); border-color: var(--brand-red); color: #fff; font-family: var(--font-head); font-style: normal; font-weight: 700; }
button.primary:hover, .btn.primary:hover { background: var(--brand-red-dark); border-color: var(--brand-red-dark); }
button.danger { color: var(--bad); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--surface-2); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.sm, .btn.sm { padding: 3px 9px; font-size: 12px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 7px 10px; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--brand-green); outline-offset: 1px; }
input[type="checkbox"] { accent-color: var(--brand-green); }
label.field { display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); }
label.field > span { font-weight: 500; }
label.field > input, label.field > select, label.field > textarea { width: 100%; min-width: 0; }
.form-grid > * { min-width: 0; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { border: 0; border-radius: 0; padding: 7px 13px; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.on { background: var(--brand-green); color: #fff; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--brand-green); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.kpi .label { font-size: 12px; color: var(--ink-2); }
.kpi .value { font-family: var(--font-head); font-weight: 600; font-size: 22px; margin-top: 2px; white-space: nowrap; }
.kpi .note { font-size: 11px; color: var(--muted); margin-top: 2px; }
.kpi.hero { border-top-color: var(--brand-red); }
.kpi.alert { border-color: var(--brand-red); border-top-color: var(--brand-red); background: var(--brand-red-soft); }
.kpi.alert .value { color: var(--brand-red); }

/* ---------- statement table ---------- */
table { border-collapse: collapse; width: 100%; }
.cf { font-size: 13px; }
.cf th, .cf td { padding: 5px 10px; border-bottom: 1px solid var(--line); }
.cf thead th { position: sticky; top: 0; background: var(--brand-green); color: #fff; font-family: var(--font-head); font-style: normal; font-weight: 700; font-size: 12px; text-align: right; z-index: 2; border-bottom: 0; }
.cf thead th:first-child { text-align: left; }
.cf td:first-child { min-width: 220px; }
.cf tr.section td { font-family: var(--font-head); font-style: normal; font-weight: 700; color: var(--brand-green); background: var(--brand-green-soft); padding-top: 10px; letter-spacing: .02em; border-bottom-color: #cddcd3; }
.cf tr.group td { font-weight: 700; }
.cf tr.line td:first-child { padding-left: 22px; }
.cf tr.line.ind2 td:first-child { padding-left: 36px; }
.cf tr.line.inactive td:first-child { color: var(--muted); font-style: normal; }
.cf tr.total td, .cf tr.net td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.cf tr.net td { background: var(--surface-2); }
.cf tr.grand td { font-family: var(--font-head); font-weight: 700; font-style: normal; border-top: 2px solid var(--brand-red); border-bottom: 2px solid var(--brand-red); }
.cf tr.balance td { font-weight: 700; }
.cf tr.unclassified td { color: var(--bad); font-style: normal; }
.cf tr.unclassified td:first-child { padding-left: 22px; }
.cf tr.spacer td { border: 0; height: 14px; }
.cf td.zero { color: var(--muted); }
.cf a.drill { color: inherit; font-weight: inherit; }
.cf a.drill:hover { color: var(--brand-red); }
.cf td.tot { background: rgba(1, 87, 57, .045); font-weight: 700; }
.table-wrap { overflow-x: auto; }
/* forecast by month */
.cf th .mkind { display: block; font-size: 10px; font-weight: 500; opacity: .85; text-transform: lowercase; }
.cf thead th.plan { background: #3d7d63; }
.cf td.plan { background: #f7f8f6; color: var(--ink-2); }
.cf tr.hl td { background: #fff3cf !important; }
.cf td.plan-edit { cursor: text; }
.cf td.plan-edit:hover, .cf td.plan-edit:focus { outline: 1px dashed var(--green, #015739); outline-offset: -2px; }
.cf td.plan-manual, .cf td.manual-mark { position: relative; color: var(--ink); font-weight: 600; }
.cf td.plan-manual::after, .legend-mark::before { content: ''; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 7px 7px 0; border-color: transparent #BC3E0F transparent transparent; }
.cf td.plan-contract { color: var(--brand-green); font-weight: 600; }
.legend-mark { position: relative; display: inline-block; width: 14px; height: 12px; margin-right: 6px; vertical-align: -1px; background: #f7f8f6; }
.cf td input.plan-input { width: 100%; min-width: 80px; box-sizing: border-box; text-align: right; font: inherit; padding: 2px 4px; border: 1px solid var(--green, #015739); border-radius: 3px; }
.cf tr.section td.num { font-family: var(--font-text); font-weight: 700; color: var(--brand-green); }
/* ◷ switch on the statement */
.unconf-btn { border: 0; background: none; padding: 0 4px; font: inherit; font-size: 11px; cursor: pointer; }
.unconf-btn.on { color: #a5450f; background: #fdf0e6; border-radius: 2px; padding: 0 6px; font-weight: 500; }
.unconf-btn.add { color: var(--muted); opacity: 0; }
tr:hover .unconf-btn.add, .unconf-btn.add:focus-visible { opacity: 1; }
/* not-yet-confirmed lines */
.unconf { display: inline-block; font-size: 10.5px; font-weight: 500; font-style: normal; color: #a5450f; background: #fdf0e6; border-radius: 2px; padding: 0 6px; margin-left: 4px; white-space: nowrap; }
.unconf-toggle { border: 0; background: none; padding: 0 6px 0 0; font-size: 13px; color: var(--line-strong); cursor: pointer; }
.unconf-toggle.on, .unconf-toggle:hover { color: #a5450f; }
/* budget comparison */
.cf input.amt { width: 150px; text-align: right; padding: 4px 8px; }
.cf thead tr.grp th { border-bottom: 0; }
.cf thead tr.sub th { background: #0b6a48; font-size: 10.5px; font-weight: 600; font-style: normal; color: rgba(255,255,255,.85); padding-top: 2px; }
.cf thead th.vgrp { text-align: center; border-left: 1px solid rgba(255,255,255,.25); }
.cf td.cmt { text-align: left; font-size: 11.5px; color: var(--ink-2); min-width: 130px; max-width: 220px; white-space: normal; }
.cf td.cmt[data-comment] { cursor: pointer; }
.cf td.cmt .cmt-txt { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cf td.cmt[data-comment]:hover { background: var(--brand-green-soft); }
.cf .auto-comment { color: var(--muted); font-style: normal; }
.cf .add-comment { color: var(--brand-red); }
.cf td.dev { white-space: nowrap; font-weight: 600; }
.cf td.dev .arr { font-size: 10px; }
.cf td.dev { padding-right: 4px; }
.cf td.pct-c { font-size: 11px; font-weight: 500; padding-left: 2px; white-space: nowrap; color: var(--muted); }
.cf td.pct-c.good { color: var(--good); }
.cf td.pct-c.bad { color: var(--bad); }
.cf td.pct-c.imm { opacity: .55; }
.cf td.dev.good { color: var(--good); }
.cf thead th[colspan] { text-align: center; }
.cf td.dev.bad { color: var(--bad); }
.cf td.dev.imm { opacity: .55; font-weight: 500; }
.cf thead th[title] { cursor: help; }
.cf .tip-mark { font-size: 10px; opacity: .7; font-style: normal; }
.cf td.fc { font-weight: 600; }
.cf td.act { color: var(--ink-2); }
/* ДДС comparison: compact enough to fit the screen; the line column stays in place when scrolling sideways */
.table-wrap:has(> .cf.cmp) { padding: 8px; }
.cf.cmp td.num { padding: 4px 6px; white-space: nowrap; }
.cf.cmp td:first-child { min-width: 160px; max-width: 240px; white-space: normal; position: sticky; left: 0; z-index: 1; background: var(--surface); }
.cf.cmp thead th:first-child { left: 0; z-index: 3; }
.cf.cmp tr.section td:first-child { background: var(--brand-green-soft); }
.cf.cmp tr.net td:first-child { background: var(--surface-2); }
.cf.cmp tr.hl td:first-child { background: #fff3cf; }
.cf.cmp thead th { padding: 6px 7px; line-height: 1.2; }
.lc-notes { display: grid; gap: 1px; margin-top: 2px; font-size: 11px; font-weight: 400; color: var(--ink-2); line-height: 1.3; }
.lc-note { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lc-note b { font-weight: 600; color: var(--brand-green); }
.lc-note[data-comment] { cursor: pointer; }
.lc-note[data-comment]:hover { color: var(--ink); }
.cf td.editable { cursor: pointer; }
.cf td.editable:hover { background: var(--brand-green-soft); }
.cf td.need-cmt { position: relative; }
.cf td.need-cmt::after { content: ''; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 7px 7px 0; border-color: transparent #BC3E0F transparent transparent; }
/* KTF | ATP | Total under Budget, Forecast and Actual */
.cf thead th.grp { text-align: center; padding-bottom: 2px; }
.cf thead tr.sub th { font-size: 11px; font-weight: 600; padding-top: 3px; padding-bottom: 5px; background: #0d6446; text-align: right; }
.cf.split td.segc { font-weight: 400; color: var(--ink-2); }
.cf.split td.fc.segc { font-weight: 500; }
.cf.split td.totc { font-weight: 600; color: var(--ink); }
.cf.split tr.section td.segc, .cf.split tr.section td.totc { color: inherit; }
.cf.split { font-size: 12.5px; }
.cf.split td.num { padding: 4px 5px; }
.cf.split td.segc { font-size: 11.5px; }
.cf.split td.pct-c { padding-left: 1px; }
.cf button.exp { border: 0; background: none; padding: 0; width: 16px; margin-left: -16px; font-size: 11px; color: var(--muted); cursor: pointer; }
.cf button.exp:hover { color: var(--brand-red); }
.cf tr.cp-row td { font-size: 12px; color: var(--ink-2); background: #fafaf7; }
.cf tr.cp-row td:first-child { padding-left: 40px; }
.cf tr.cp-row.ind3 td:first-child { padding-left: 54px; }
.segbtn.split { background: #fff; color: var(--ink-2); border: 1px dashed var(--line-strong); font-style: normal; }
.split-parts { font-size: 11.5px; color: var(--ink-2); }
.split-parts div + div { margin-top: 2px; }
.filter-chip { display: inline-flex; gap: 8px; align-items: center; background: var(--brand-green-soft); color: var(--brand-green); border-radius: 2px; padding: 4px 10px; font-size: 12.5px; font-weight: 500; }
.filter-chip button { border: 0; background: none; padding: 0; color: inherit; font-size: 12px; }
.hide-zero tr.line.allzero, .hide-zero tr.group.allzero { display: none; }
/* KTF / ATP tag after a sponsor's name (monthly page) */
.seg-tag { display: inline-block; font-size: 9.5px; font-weight: 700; letter-spacing: .03em; line-height: 1; padding: 3px 5px; border-radius: 5px; margin-left: 4px; vertical-align: 1px; }
.seg-tag.KTF { background: var(--brand-green-soft); color: var(--brand-green); }
.seg-tag.ATP { background: #2b2b2b; color: #fff; }
.seg-tag + .seg-tag { margin-left: 2px; }
/* a whole section with nothing in it (e.g. financing for ATP) goes too, with its zero subtotals */
.hide-zero tr.section.allzero, .hide-zero tr.net.allzero, .hide-zero tr.total.allzero { display: none; }

/* ---------- transactions table ---------- */
.tx { font-size: 12.5px; }
.tx th, .tx td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.tx thead th { background: var(--brand-green); color: #fff; position: sticky; top: 0; z-index: 2; font-family: var(--font-head); font-style: normal; font-weight: 700; white-space: nowrap; }
.tx thead th.num { text-align: right; }
.tx thead th.sortable { cursor: pointer; }
.tx tbody tr:hover { background: #fafaf8; }
.tx tr.sel { background: var(--brand-green-soft); }
.tx .desc { max-width: 320px; }
.tx td.cmt1c { min-width: 240px; max-width: 380px; font-size: 12px; color: var(--ink); }
.badge.changed1c { background: #fdf0e6; color: #a5450f; margin-top: 3px; cursor: help; }
.simple.chg td.kind { white-space: nowrap; font-weight: 600; }
.simple.chg tr.chg-deleted td.kind { color: var(--bad); }
.simple.chg tr.chg-changed td.kind { color: #a5450f; }
.simple.chg tr.chg-added td.kind { color: var(--good); }
.simple.chg .old { text-decoration: line-through; color: var(--muted); }
.simple.chg .new { font-weight: 600; }
.chg-details summary { cursor: pointer; color: var(--brand-green); font-weight: 500; margin: 6px 0; }
.tx .desc .c1 { color: var(--ink); font-weight: 500; }
.tx .desc a.cp-link { display: block; text-decoration: none; }
.tx .desc a.cp-link:hover { color: var(--brand-green); text-decoration: underline; }
.tx .desc .c2 { color: var(--muted); font-size: 11.5px; }
.tx select.line-sel { max-width: 300px; font-size: 12px; padding: 3px 6px; }
.badge.transit { background: #eef2f7; color: #3b5b80; cursor: help; }
.tx td.amt-in, #sums .amt-in { color: var(--good); }
.tx td.amt-out, #sums .amt-out { color: var(--bad); }
.badge { display: inline-block; padding: 1px 7px; border-radius: 2px; font-size: 11px; font-weight: 500; white-space: nowrap; }
.badge.manual { background: var(--warn-soft); color: var(--ink-2); }
.badge.dir-internal, .badge.dir-fx, .badge.dir-none { background: var(--surface-2); color: var(--ink-2); }
/* Classify page */
.badge.dir-in { background: var(--good-soft); color: var(--good); }
.badge.dir-out { background: var(--bad-soft); color: var(--bad); }
.badge.conf-hi { background: var(--brand-green); color: #fff; }
.badge.conf-lo { background: var(--warn-soft); color: #8a5a00; }
.badge.conf-none, .badge.conf-own { background: var(--surface-2); color: var(--ink-2); }
.sg td { vertical-align: top; }
.sg .desc { max-width: 420px; }
.sg .sample { font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.sg select.line-sel { max-width: 340px; width: 100%; }
.sg .sg-why { margin-top: 4px; line-height: 1.5; max-width: 380px; }
button.linkish { background: none; border: 0; padding: 0; color: var(--brand-green); text-decoration: underline; cursor: pointer; font: inherit; }
#bulk button:disabled { opacity: .5; }
.segbtn { font-family: var(--font-head); font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 2px; border: 1px solid transparent; letter-spacing: .04em; display: inline-block; }
.segbtn.KTF { background: var(--ktf-soft); color: var(--ktf); border-color: rgba(1, 87, 57, .35); }
.segbtn.ATP { background: var(--atp-bg); color: var(--atp); border-color: var(--atp-bg); }
button.segbtn:hover { filter: brightness(.95); }
.bulkbar { position: sticky; bottom: 0; background: var(--surface); border: 1px solid var(--brand-green); border-top: 3px solid var(--brand-green); border-radius: var(--radius); padding: 10px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; box-shadow: 0 -4px 16px rgba(0,0,0,.08); margin-top: 12px; z-index: 10; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.sum-strip { display: flex; gap: 24px; flex-wrap: wrap; font-size: 13px; margin-bottom: 10px; color: var(--ink-2); }
.sum-strip b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- notices ---------- */
.notice { padding: 10px 14px; border-radius: var(--radius); background: var(--warn-soft); border-left: 4px solid #c98500; margin-bottom: 16px; }
.notice.err { background: var(--bad-soft); border-left-color: var(--brand-red); }
.notice.ok { background: var(--good-soft); border-left-color: var(--brand-green); }
.notice.sc-note { background: var(--surface-2); border-left-color: var(--brand-grey); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--brand-green); color: #fff; padding: 10px 18px; border-radius: var(--radius); z-index: 100; box-shadow: 0 6px 24px rgba(0,0,0,.2); }
.toast.err { background: var(--brand-red); }

/* ---------- chart ---------- */
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--ink-2); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.chart-legend i.line { height: 2px; width: 14px; border-radius: 1px; vertical-align: 3px; }
.chart-box { position: relative; }
.chart-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 8px 10px; font-size: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.12); white-space: nowrap; z-index: 5; }
.chart-tip .k { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* ---------- forms / dialogs ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
dialog { border: 0; border-top: 4px solid var(--brand-red); border-radius: var(--radius); padding: 0; background: var(--surface); color: var(--ink); width: min(720px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog.wide { width: min(940px, calc(100vw - 32px)); }
dialog .simple select { max-width: 100%; }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog .dlg-head { padding: 14px 18px; border-bottom: 1px solid var(--line); font-family: var(--font-head); font-style: normal; font-weight: 700; font-size: 16px; color: var(--brand-red); }
dialog .dlg-body { padding: 18px; display: grid; gap: 12px; }
dialog .dlg-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-strong); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 10px 14px; color: var(--ink-2); margin-bottom: -1px; }
.tabs button.on { border-bottom-color: var(--brand-red); color: var(--brand-red); font-weight: 700; }
.simple th, .simple td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.simple thead th { background: var(--surface-2); font-size: 12px; color: var(--ink-2); font-weight: 700; }
.drop { display: block; border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 40px; text-align: center; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--brand-green); background: var(--brand-green-soft); }
.drop .drop-title { font-family: var(--font-head); font-style: normal; font-weight: 700; font-size: 17px; color: var(--brand-green); }

/* ---------- court-line pattern (after the brandbook pattern: court markings + ball) ---------- */
.pattern {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cg fill='none' stroke='%23fff' stroke-opacity='.16' stroke-width='1.2'%3E%3Crect x='24' y='20' width='64' height='110'/%3E%3Cpath d='M32 20v110M80 20v110M32 47h48M32 103h48M56 47v56M24 75h64'/%3E%3Cpath d='M118 96l30-17 30 17-30 17zM118 96v40l30 17 30-17V96M148 113v40'/%3E%3Ccircle cx='140' cy='38' r='8'/%3E%3Cpath d='M133 34c4 2 10 2 14 0M133 42c4-2 10-2 14 0'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 180px 180px;
}

/* ---------- auth pages ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--surface); }
.auth-brand { background-color: var(--brand-red); color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 48px; position: relative; overflow: hidden; }
.auth-brand img { width: 190px; height: auto; }
.auth-brand .claim { font-family: var(--font-head); font-style: normal; font-weight: 700; font-size: 34px; line-height: 1.1; max-width: 420px; }
.auth-brand .claim small { display: block; font-size: 15px; font-weight: 700; opacity: .85; margin-top: 10px; }
.auth-brand .foot { font-size: 12px; opacity: .8; }
.auth-form { display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: min(380px, 100%); display: grid; gap: 14px; }
.auth-card input { width: 100%; }
.auth-card .mobile-logo { display: none; height: 44px; width: auto; }
@media (max-width: 820px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-card .mobile-logo { display: block; }
}

/* ---------- language switch, footer, notes ---------- */
.lang-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.lang-switch button { border: 0; border-radius: 0; padding: 3px 8px; font-size: 11.5px; font-weight: 700; background: var(--surface); color: var(--ink-2); }
.lang-switch button + button { border-left: 1px solid var(--line-strong); }
.lang-switch button.on { background: var(--brand-green); color: #fff; }
.site-footer { max-width: 1400px; margin: 8px auto 0; padding: 18px 24px 24px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.site-footer a { color: var(--ink-2); }
body:has(.auth-wrap) .site-footer { position: fixed; bottom: 0; left: 50%; right: 0; border: 0; margin: 0; padding: 12px 24px; text-align: center; }
@media (max-width: 820px) { body:has(.auth-wrap) .site-footer { left: 0; } }
.auth-form { position: relative; }
.auth-lang { position: absolute; top: 20px; right: 24px; }
.rates-note { font-size: 11.5px; color: var(--muted); margin: 10px 0 0; }
.rates-note:empty { display: none; }

/* ---------- reconciliation ---------- */
.recon-card + .recon-card { margin-top: 16px; }
.status { font-family: var(--font-head); font-style: normal; font-weight: 700; font-size: 12px; padding: 3px 10px; border-radius: 2px; }
.status.ok { background: var(--good-soft); color: var(--good); }
.status.bad { background: var(--bad-soft); color: var(--bad); }
.status.warn { background: var(--warn-soft); color: var(--ink-2); }
.recon td.num, .recon th.num { white-space: nowrap; }
.recon .acc-name { display: block; max-width: 230px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recon .ok-cell { color: var(--good); text-align: center; }
.recon .bad-cell { color: var(--bad); font-weight: 700; background: var(--bad-soft); }
.recon tr.tot-row td { font-weight: 700; border-top: 2px solid var(--brand-green); }
.recon-close { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 10px; color: var(--ink-2); }
.bad-text { color: var(--bad); }
.ok-text { color: var(--good); }

/* ---------- dashboard ---------- */
.dash-tiles { grid-template-columns: repeat(auto-fit, minmax(max(190px, 22%), 1fr)); }
a.kpi { color: inherit; display: block; }
a.kpi:hover { text-decoration: none; border-color: var(--line-strong); }
.dash-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 16px; margin-bottom: 16px; }
.dash-row > .card { min-width: 0; margin: 0; }
.dash-row > .card + .card { margin-top: 0; }
.dash-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.dash-h h2 { margin: 0; font-size: 15px; color: var(--brand-green); font-style: normal; }
.pill { display: inline-block; font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 99px; white-space: nowrap; }
.pill.ok { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: #8a5a00; }
.pill.crit { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--surface-2); color: var(--ink-2); }
.attn { display: grid; gap: 10px; }
.attn-item { border-left: 4px solid var(--line-strong); background: var(--surface-2); border-radius: var(--radius); padding: 9px 12px; display: grid; gap: 6px; }
.attn-item.crit { border-left-color: var(--brand-red); background: var(--bad-soft); }
.attn-item.warn { border-left-color: #c98500; background: var(--warn-soft); }
.attn-item.info { border-left-color: var(--brand-green); background: var(--brand-green-soft); }
.attn-title { font-weight: 700; color: var(--ink); }
.attn-body { display: grid; gap: 4px; font-size: 13px; }
.attn-line { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.dash-var td:first-child { min-width: 180px; }
@media print { .dash-row { grid-template-columns: 1fr 1fr; } .dash-row > .card { break-inside: avoid; } }

/* ---------- budget phasing ---------- */
.cf.phasing { font-size: 12px; }
.cf.phasing td, .cf.phasing th { padding: 3px 4px; }
.cf.phasing input.mcell { width: 78px; text-align: right; font: inherit; padding: 2px 4px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); font-variant-numeric: tabular-nums; }
.cf.phasing input.mcell::placeholder { color: var(--muted); opacity: .7; }
.cf.phasing input.mcell:focus { border-color: var(--brand-green); outline: none; }

/* ---------- contracts, payment calendar ---------- */
.progress { height: 8px; background: var(--brand-green-soft); border-radius: 4px; overflow: hidden; margin: 4px 0 3px; }
.progress span { display: block; height: 100%; background: var(--brand-green); }
.ct-detail > td { background: var(--surface-2); padding: 10px 14px 12px 36px; }
.ct-detail table.simple { width: auto; min-width: 520px; background: var(--surface); }
.sched { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 8px; }
.sched table input { width: 100%; }
.cf.weeks th { text-align: right; }
.cf.weeks th.now { background: var(--brand-red); }
.cf.weeks td.low-cash { background: var(--warn-soft); color: #8a5a00; }
.cf.weeks td.neg-cash { background: var(--bad-soft); color: var(--bad); }
.tx.cal tr.done { opacity: .55; }
table.num-right td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.simple td.num, table.simple th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- debts ---------- */
.aging { display: flex; gap: 3px; margin: 4px 0 14px; border-radius: var(--radius); overflow: hidden; }
.age-seg { padding: 8px 10px; display: grid; gap: 2px; font-size: 12px; min-width: 0; color: #fff; }
.age-seg span { font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.age-0-30 { background: var(--brand-green); }
.age-31-60 { background: #6b8f3a; }
.age-61-90 { background: #c98500; }
.age-90p { background: var(--brand-red); }
.age-unknown { background: var(--brand-grey); }
tr.overdue-row td { background: var(--bad-soft); }
.tfa-key { font-family: ui-monospace, Consolas, monospace; font-size: 17px; letter-spacing: .08em; background: var(--surface-2); padding: 8px 12px; border-radius: var(--radius); margin: 6px 0; user-select: all; word-break: break-all; }
.tfa-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; }
.tfa-codes code { background: var(--surface); padding: 4px 8px; border-radius: 3px; font-size: 14px; text-align: center; }

/* ---------- budget requests ---------- */
.cf.rq td { vertical-align: top; }
.cf.rq input.rq-amt { width: 120px; text-align: right; font: inherit; padding: 3px 6px; border: 1px solid var(--line-strong); border-radius: 3px; background: var(--surface); }
.cf.rq input.rq-new { width: 100%; min-width: 200px; }
.cf.rq textarea.rq-just { width: 100%; min-width: 220px; font: inherit; font-size: 12.5px; resize: vertical; }
.rq-fin { color: var(--brand-green); margin-top: 3px; }
.rq-mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; padding: 4px 0 6px 18px; }
.rq-mgrid label { display: grid; gap: 2px; font-size: 11px; color: var(--muted); }
.rq-mgrid input { width: 100%; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- board pack ---------- */
.bp-page { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 20px; }
.bp-letterhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 10px; border-bottom: 3px solid var(--brand-red); position: relative; }
.bp-letterhead::after { content: ''; position: absolute; right: 0; bottom: -3px; width: 22%; height: 3px; background: var(--brand-green); }
.bp-letterhead img { height: 54px; width: auto; }
.bp-org { font-size: 12px; color: var(--ink-2); text-align: right; }
.bp-title { font-family: var(--font-head); font-style: normal; font-weight: 700; font-size: 30px; color: var(--brand-red); margin-top: 22px; line-height: 1.15; }
.bp-subtitle { color: var(--ink-2); margin: 6px 0 18px; }
.bp-kpis { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kpi.warn { border-top-color: #c98500; }
.kpi .note.good { color: var(--good); }
.kpi .note.bad { color: var(--bad); }
.bp-h2 { font-size: 16px; color: var(--brand-green); margin: 4px 0 10px; font-style: normal; }
.bp-h2-sub { font-family: var(--font-body, inherit); font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 8px; }
.bp-note { margin: -4px 0 8px; }
.bp-dev td.cmt { max-width: 420px; white-space: normal; }
.bp-printed { margin-top: 14px; font-size: 11px; color: var(--muted); }
.bp-chart { margin-bottom: 14px; }
.bp-chart svg { max-width: 100%; height: auto; }
.bp-chart .chart-legend { justify-content: flex-start; gap: 16px; margin-bottom: 6px; }

/* ==========================================================================
   Modern theme: soft neutral page, rounded cards with gentle shadows, light table headers,
   pill-style navigation and selectors. Brand green = main actions and structure; brand red = brand and alerts.
   (Placed after the base rules so it wins; print rules below are unchanged.)
   ========================================================================== */
:root {
  --page: #f3f5f2;
  --surface-2: #f6f7f5;
  --line: #e6e9e4;
  --line-strong: #d3d8d1;
  --ink: #16211b;
  --ink-2: #4b5650;
  --muted: #7d8681;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(22, 33, 27, .04), 0 2px 10px rgba(22, 33, 27, .04);
  --shadow-lg: 0 12px 40px rgba(22, 33, 27, .14);
  --ring: 0 0 0 3px rgba(1, 87, 57, .16);
  --chart-area-top: rgba(1, 87, 57, .14);
  --chart-area-bottom: rgba(1, 87, 57, 0);
  --font-mono: var(--font-head);
}
body { font-size: 14px; -webkit-font-smoothing: antialiased; }

/* top bar: white, hairline, pill navigation */
.topbar { background: rgba(255, 255, 255, .97); backdrop-filter: saturate(1.4) blur(12px); box-shadow: 0 1px 0 var(--line); }
.topbar::after { height: 2px; background: linear-gradient(90deg, var(--brand-red), var(--brand-red) 70%, var(--brand-green) 70%); opacity: .9; }
.topbar-inner { height: 62px; gap: 22px; }
.brand img { height: 36px; }
.brand .app-name { font-size: 16px; font-weight: 600; color: var(--ink); border-left-color: var(--line); }
.nav { align-self: center; gap: 2px; }
.nav a { padding: 7px 12px; border-radius: 999px; border-bottom: 0; margin: 0; color: var(--ink-2); font-weight: 500; font-size: 13.5px; transition: background .15s, color .15s; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active { background: var(--brand-green-soft); color: var(--brand-green); font-weight: 600; }
.navmore { align-self: center; }
.navmore summary { padding: 7px 12px; border-radius: 999px; border-bottom: 0; margin: 0; font-size: 13.5px; }
.navmore summary:hover { background: var(--surface-2); }
.navmore summary.active { background: var(--brand-green-soft); color: var(--brand-green); }
.navmore .menu { top: calc(100% + 8px); border: 1px solid var(--line); border-top: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; }
.navmore .menu a { border-radius: 8px; font-size: 13.5px; }
.role-chip { border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: .03em; padding: 4px 10px; background: var(--brand-green-soft); color: var(--brand-green); }
.role-chip.reader { background: #eef0ee; color: var(--ink-2); }
.role-chip.holder { background: #fdf0e6; color: #a5450f; }
.userbox { gap: 12px; font-size: 13.5px; }

/* page header */
.page { padding: 28px 28px 32px; }
.page-head { margin-bottom: 20px; }
.eyebrow { color: var(--muted); font-weight: 600; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
h1 { color: var(--ink); font-size: 26px; font-weight: 650; letter-spacing: -.015em; }
.page-head .sub { color: var(--muted); font-size: 13.5px; }
h2 { color: var(--ink); font-weight: 650; font-size: 15px; }
.bp-h2, .dash-h h2 { color: var(--ink); font-weight: 650; }

/* cards */
.card { border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 20px; }
.card + .card { margin-top: 18px; }

/* controls */
button, .btn { border-radius: var(--radius-sm); border-color: var(--line-strong); padding: 7px 14px; font-weight: 500; transition: background .15s, border-color .15s, box-shadow .15s, color .15s; }
button:hover, .btn:hover { border-color: #b9c0b7; background: #fbfcfb; }
button.primary, .btn.primary { background: var(--brand-green); border-color: var(--brand-green); color: #fff; font-weight: 600; box-shadow: 0 1px 2px rgba(1, 87, 57, .25); }
button.primary:hover, .btn.primary:hover { background: #014530; border-color: #014530; }
button.danger { color: var(--bad); }
button.danger:hover { background: var(--bad-soft); border-color: #e8c3b4; }
button.ghost { border-color: transparent; }
button.sm, .btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
input, select, textarea { border-radius: var(--radius-sm); border-color: var(--line-strong); padding: 7px 10px; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: #b9c0b7; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-green); box-shadow: var(--ring); }
button:focus-visible, a:focus-visible { outline: none; box-shadow: var(--ring); }
label.field > span { color: var(--ink-2); font-size: 12px; }
/* segmented control: grey track, the chosen option a raised white chip */
.seg { background: #eceeea; border: 0; border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0 !important; border-radius: 999px; padding: 5px 13px; background: transparent; color: var(--ink-2); font-size: 13px; }
.seg button:hover { background: rgba(255, 255, 255, .6); }
.seg button.on { background: #fff; color: var(--brand-green); font-weight: 600; box-shadow: 0 1px 3px rgba(22, 33, 27, .14); }
.lang-switch { border: 0; background: #eceeea; border-radius: 999px; padding: 2px; }
.lang-switch button { border: 0 !important; border-radius: 999px; background: transparent; padding: 3px 9px; }
.lang-switch button.on { background: #fff; color: var(--brand-green); box-shadow: 0 1px 3px rgba(22, 33, 27, .14); }
.tabs { border-bottom: 1px solid var(--line); gap: 6px; }
.tabs button { border-radius: 0; padding: 10px 4px; margin-right: 14px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500; }
.tabs button:hover { background: none; color: var(--ink); }
.tabs button.on { border-bottom-color: var(--brand-green); color: var(--ink); font-weight: 600; }

/* KPI tiles */
.kpis { gap: 14px; margin-bottom: 18px; }
.kpi { border: 1px solid var(--line); border-top: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi .value { font-size: 24px; font-weight: 650; letter-spacing: -.01em; margin-top: 4px; color: var(--ink); }
.kpi .note { font-size: 12px; margin-top: 4px; }
.kpi.hero { background: linear-gradient(135deg, #015739, #0b6d4a); border-color: transparent; }
.kpi.hero .label, .kpi.hero .note { color: rgba(255, 255, 255, .78); }
.kpi.hero .value { color: #fff; }
.kpi.hero .note.good, .kpi.hero .note.bad, .kpi.hero .pill { color: #fff; }
.kpi.hero .pill { background: rgba(255, 255, 255, .18); }
.kpi.alert { background: #fff; border-color: #efc9ba; box-shadow: inset 3px 0 0 var(--brand-red), var(--shadow); }
.kpi.alert .value { color: var(--brand-red); }
.kpi.warn { border-color: #f0dfb5; box-shadow: inset 3px 0 0 #c98500, var(--shadow); }
a.kpi { transition: transform .15s, box-shadow .15s; }
a.kpi:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(22, 33, 27, .08); }

/* tables: light header, hairline rows, soft section bands */
.table-wrap.card { padding: 6px; }
.cf { font-size: 13px; }
.cf th, .cf td { border-bottom: 1px solid #eef0ec; }
.cf thead th { background: #f6f7f5; color: var(--ink-2); font-weight: 600; font-size: 11.5px; letter-spacing: .02em; border-bottom: 1px solid var(--line); }
.cf thead th:first-child { border-top-left-radius: 10px; }
.cf thead tr:first-child th:last-child { border-top-right-radius: 10px; }
.cf thead tr.sub th { background: #f6f7f5; color: var(--muted); font-size: 10.5px; }
.cf thead th.grp { color: var(--ink); }
.cf thead th.plan { background: #edf3ef; color: var(--brand-green); }
.cf th .mkind { opacity: 1; color: var(--muted); }
.cf thead th.plan .mkind { color: var(--brand-green); }
.cf tbody tr:hover td { background: #fafbf9; }
.cf tr.section td { background: #f1f6f2; color: var(--brand-green); font-weight: 650; font-size: 12px; letter-spacing: .03em; padding-top: 9px; padding-bottom: 9px; border-bottom: 1px solid #e2ece5; }
.cf tr.section:hover td { background: #f1f6f2; }
.cf.cmp tr.section td:first-child { background: #f1f6f2; }
.cf tr.group td { font-weight: 600; color: var(--ink); }
.cf tr.net td { background: #f8f9f7; }
.cf tr.grand td { font-weight: 650; border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); }
.cf td.tot { background: rgba(1, 87, 57, .035); }
.cf td.plan { background: #fafcfa; }
.cf.cmp td:first-child { background: #fff; }
.cf.cmp tbody tr:hover td:first-child { background: #fafbf9; }
.tx thead th { background: #f6f7f5; color: var(--ink-2); font-weight: 600; font-size: 11.5px; border-bottom: 1px solid var(--line); }
.tx th, .tx td { border-bottom: 1px solid #eef0ec; }
.tx tbody tr:hover { background: #fafbf9; }
.simple thead th { background: #f6f7f5; color: var(--ink-2); font-weight: 600; }
.simple th, .simple td { border-bottom: 1px solid #eef0ec; }
.cf.weeks th.now { background: var(--brand-red-soft); color: var(--brand-red); }

/* badges, pills, chips */
.badge, .status, .segbtn, .filter-chip, .unconf { border-radius: 999px; }
.badge { padding: 2px 8px; }
.segbtn { font-weight: 600; letter-spacing: .02em; }

/* notices and toasts */
.notice { border-radius: 12px; border-left-width: 3px; padding: 11px 14px; }
.toast { background: #16211b; border-radius: 12px; padding: 11px 18px; box-shadow: var(--shadow-lg); }
.toast.err { background: var(--brand-red); }

/* dialogs */
dialog { border-top: 0; border-radius: 16px; box-shadow: 0 24px 70px rgba(22, 33, 27, .28); }
dialog::backdrop { background: rgba(22, 33, 27, .38); backdrop-filter: blur(2px); }
dialog .dlg-head { color: var(--ink); font-weight: 650; font-size: 16px; padding: 16px 20px; }
dialog .dlg-body { padding: 18px 20px; }
dialog .dlg-foot { padding: 12px 20px; background: #fafbf9; border-bottom-left-radius: 16px; border-bottom-right-radius: 16px; }

/* misc */
.bulkbar { border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 -6px 24px rgba(22, 33, 27, .1); }
.drop { border-radius: 14px; }
.sched { border-radius: 12px; }
.attn-item { border-radius: 10px; border-left-width: 3px; }
.chart-tip { border-radius: 10px; border-color: var(--line); box-shadow: var(--shadow-lg); }
.site-footer { border-top: 1px solid var(--line); }
.auth-card { gap: 16px; }
.auth-card h1 { font-size: 28px; }
.auth-card button.primary { padding: 10px 14px; font-size: 15px; justify-content: center; }
.navmore .menu a.active { font-weight: 600; }
.progress { border-radius: 999px; }
.progress span { border-radius: 999px; }
@media (max-width: 1240px) {
  .topbar-inner { height: auto; padding-top: 10px; padding-bottom: 8px; }
  .nav { align-self: stretch; height: auto; padding-bottom: 2px; }
}
@media (max-width: 560px) { .page { padding: 18px 16px 24px; } }

/* ==========================================================================
   Clean look (the reference the Finance Manager chose): near-white page, white cards with a hairline
   border and large rounded corners, no coloured tiles, big confident numbers with quiet grey labels,
   light-grey table headers, rounded-rectangle selectors. Neutral greys; brand green for actions and
   positive values, brand red for alerts and the brand stripe.
   ========================================================================== */
:root {
  --page: #f8f8f6;
  --surface: #ffffff;
  --surface-2: #f4f4f1;
  --line: #ebebe7;
  --line-strong: #dcdcd7;
  --ink: #141414;
  --ink-2: #4d4d49;
  --muted: #8b8b85;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: none;
  --shadow-lg: 0 16px 48px rgba(20, 20, 20, .12);
  --ring: 0 0 0 3px rgba(1, 87, 57, .14);
  --font-head: 'Segoe UI Variable Display', 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-text: 'Segoe UI Variable Text', 'Segoe UI', system-ui, -apple-system, Roboto, 'Helvetica Neue', Arial, sans-serif;
}
body { background: var(--page); color: var(--ink); }

/* top bar: white and quiet */
.topbar { background: rgba(255, 255, 255, .96); box-shadow: 0 1px 0 var(--line); }
.topbar::after { height: 2px; opacity: 1; }
.nav a { color: var(--ink-2); }
.nav a:hover, .navmore summary:hover { background: var(--surface-2); color: var(--ink); }
.nav a.active, .navmore summary.active { background: var(--surface-2); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--line); }
.role-chip { background: var(--surface-2); color: var(--ink-2); }
.role-chip.finance { background: var(--brand-green-soft); color: var(--brand-green); }

/* page header: plain labels, big title */
.page { padding: 32px 32px 40px; }
.page-head { margin-bottom: 24px; }
.eyebrow { color: var(--muted); font-weight: 500; font-size: 13px; letter-spacing: 0; text-transform: none; margin-bottom: 6px; }
h1 { color: var(--ink); font-size: 30px; font-weight: 600; letter-spacing: -.02em; }
h2, .bp-h2, .dash-h h2 { color: var(--ink); font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.page-head .sub { font-size: 13.5px; }

/* cards: white, hairline border, 20px corners, generous padding */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: none; padding: 24px; }
.card + .card { margin-top: 20px; }
.dash-h { margin-bottom: 16px; }

/* controls */
button, .btn { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 8px 15px; color: var(--ink); font-weight: 500; }
button:hover, .btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
button.primary, .btn.primary { background: var(--brand-green); border-color: var(--brand-green); color: #fff; box-shadow: none; }
button.primary:hover, .btn.primary:hover { background: #014530; border-color: #014530; }
button.ghost { background: transparent; border-color: transparent; }
button.sm, .btn.sm { padding: 5px 11px; border-radius: 9px; }
input, select, textarea { border-radius: 12px; border-color: var(--line-strong); padding: 8px 12px; background: #fff; }
/* selectors: grey rounded track, the chosen option a white chip */
.seg { background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 2px; }
.seg button { border-radius: 9px; padding: 6px 14px; color: var(--muted); font-weight: 500; }
.seg button:hover { background: rgba(255, 255, 255, .7); color: var(--ink); }
.seg button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(20, 20, 20, .08), 0 0 0 1px var(--line); }
.lang-switch { background: var(--surface-2); border-radius: 10px; padding: 3px; }
.lang-switch button { border-radius: 7px; color: var(--muted); }
.lang-switch button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(20, 20, 20, .08), 0 0 0 1px var(--line); }
.tabs button.on { border-bottom-color: var(--ink); }

/* KPI tiles: white, label on top, big number, quiet note; colour only in the numbers */
.kpis { gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px 22px; box-shadow: none; }
.kpi .label { color: var(--ink); font-size: 14px; font-weight: 500; }
.kpi .value { font-family: var(--font-head); font-size: 30px; font-weight: 600; letter-spacing: -.025em; margin-top: 14px; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.15; }
.kpi .note { color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.kpi.hero { background: var(--surface); border-color: var(--line); }
.kpi.hero .label { color: var(--ink); }
.kpi.hero .note { color: var(--muted); }
.kpi.hero .value { color: var(--brand-green); }
.kpi.hero .note.good { color: var(--good); }
.kpi.hero .note.bad { color: var(--bad); }
.kpi.hero .pill { background: var(--good-soft); color: var(--good); }
.kpi.alert, .kpi.warn { background: var(--surface); border-color: var(--line); box-shadow: none; }
.kpi.alert .value { color: var(--brand-red); }
.kpi.alert .label::before, .kpi.warn .label::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; background: var(--brand-red); }
.kpi.warn .label::before { background: #d99a1e; }
a.kpi:hover { transform: none; box-shadow: none; border-color: var(--line-strong); }
/* every tile: label (room for two lines) → number on the same line in all tiles → note.
   The number shrinks with the tile so it never spills over the edge. */
.kpi { container-type: inline-size; display: flex; flex-direction: column; min-width: 0; padding: 20px 18px; }
.kpi .label { line-height: 1.3; min-height: 2.6em; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.kpi .value { margin-top: 10px; font-size: clamp(18px, 17.5cqi, 30px); white-space: nowrap; }

/* tables: light-grey rounded header, hairline rows */
.table-wrap.card { padding: 8px; }
.cf th, .cf td, .tx th, .tx td, .simple th, .simple td { border-bottom: 1px solid #f0f0ec; }
.cf thead th, .tx thead th, .simple thead th { background: #f5f5f2; color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: 0; border-bottom: 0; }
.cf thead tr.sub th { background: #f5f5f2; color: var(--muted); }
.cf thead th.grp { color: var(--ink-2); font-weight: 600; }
.cf thead th.plan { background: #eff4f0; color: var(--brand-green); }
.cf thead tr:first-child th:first-child, .tx thead th:first-child, .simple thead th:first-child { border-top-left-radius: 12px; }
.cf thead tr:first-child th:last-child, .tx thead th:last-child, .simple thead th:last-child { border-top-right-radius: 12px; }
.cf tbody tr:hover td, .tx tbody tr:hover, .cf.cmp tbody tr:hover td:first-child { background: #fafaf8; }
.cf tr.section td, .cf.cmp tr.section td:first-child, .cf tr.section:hover td { background: #fafaf8; color: var(--brand-green); font-weight: 600; font-size: 12px; letter-spacing: .02em; border-bottom: 1px solid var(--line); }
.cf tr.net td, .cf.cmp tr.net td:first-child { background: #f8f8f6; }
.cf tr.grand td { border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); }
.cf td.tot { background: #fbfbf9; }
.cf td.plan { background: #fcfcfa; }

/* notices and "needs attention" items: soft cards instead of coloured bars */
.notice { border-radius: 14px; border-left: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04); padding: 12px 16px; }
.attn { gap: 12px; }
.attn-item, .attn-item.crit, .attn-item.warn, .attn-item.info { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.attn-item .attn-title::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; background: var(--brand-green); }
.attn-item.crit .attn-title::before { background: var(--brand-red); }
.attn-item.warn .attn-title::before { background: #d99a1e; }
.attn-title { font-weight: 600; }
.pill { padding: 2px 9px; font-weight: 500; }

/* top bar icons: "more" as three lines, settings as a gear next to the language switch; name on two lines */
.navmore summary { padding: 7px 9px; color: var(--ink-2); }
.navmore summary::after { content: none; }
.navmore summary svg, .icon-btn svg { display: block; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 10px; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.icon-btn.active { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
button.icon-btn { border: 0; background: transparent; padding: 0; }
button.icon-btn:hover { background: var(--surface-2); }
.userbox .icon-btn + .icon-btn { margin-left: -6px; }
.userbox .uname { display: inline-block; line-height: 1.2; font-size: 12.5px; text-align: right; white-space: nowrap; }
@media (max-width: 560px) { .userbox .uname { display: none; } .userbox { flex-wrap: wrap; white-space: normal; } }
/* desktop: room for the whole menu in one row (the role is in the tooltip on the name) */
@media (min-width: 1241px) {
  .topbar-inner { gap: 16px; }
  .nav a { padding: 7px 10px; }
  .userbox .role-chip { display: none; }
}

/* loading animation: tennis ball bouncing on the court line (first load: centred; later: a pill in the corner) */
.page-loader { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--page); opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; pointer-events: none; }
.page-loader.show { opacity: 1; visibility: visible; }
.page-loader.gone { opacity: 0; visibility: hidden; }
.pl-stage { position: relative; width: 120px; height: 96px; }
.pl-ball { position: absolute; left: 41px; bottom: 14px; width: 38px; height: 38px; animation: pl-bounce .9s cubic-bezier(.5, 0, .5, 1) infinite; transform-origin: 50% 100%; }
.pl-spin { width: 100%; height: 100%; animation: pl-spin 1.8s linear infinite; }
.pl-spin svg { display: block; width: 100%; height: 100%; }
.pl-shadow { position: absolute; left: 44px; bottom: 9px; width: 32px; height: 7px; border-radius: 50%; background: rgba(20, 20, 20, .16); animation: pl-shadow .9s cubic-bezier(.5, 0, .5, 1) infinite; }
.pl-court { position: absolute; left: 0; right: 0; bottom: 12px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--brand-green) 20%, var(--brand-green) 80%, transparent); opacity: .5; }
.pl-text { color: var(--muted); font-size: 13px; letter-spacing: .02em; }
@keyframes pl-bounce {
  0%, 100% { transform: translateY(0) scale(1.12, .86); }
  12% { transform: translateY(-6px) scale(.96, 1.05); }
  50% { transform: translateY(-54px) scale(1, 1); }
  88% { transform: translateY(-6px) scale(.96, 1.05); }
}
@keyframes pl-shadow { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.45); opacity: .35; } }
@keyframes pl-spin { to { transform: rotate(360deg); } }
.page-loader.mini { inset: auto 24px 24px auto; flex-direction: row; gap: 10px; padding: 8px 16px 8px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.page-loader.mini .pl-stage { width: 30px; height: 30px; }
.page-loader.mini .pl-ball { left: 6px; bottom: 4px; width: 18px; height: 18px; animation-name: pl-bounce-mini; }
.page-loader.mini .pl-shadow, .page-loader.mini .pl-court { display: none; }
@keyframes pl-bounce-mini { 0%, 100% { transform: translateY(0) scale(1.1, .9); } 50% { transform: translateY(-9px); } }
@media (prefers-reduced-motion: reduce) { .pl-ball, .pl-spin, .pl-shadow { animation-duration: 3s; } }
@media print { .page-loader { display: none !important; } }

/* date fields: DD/MM/YYYY text box + calendar button; the browser's own date box stays out of sight */
.dmy { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.dmy-text { width: 118px; font-variant-numeric: tabular-nums; }
label.field .dmy { display: flex; }
label.field .dmy-text { flex: 1; width: auto; }
.dmy-text.bad { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.dmy-pick { padding: 4px 6px; line-height: 1; }
.dmy-native { position: absolute; right: 0; bottom: 0; width: 1px !important; height: 1px; padding: 0 !important; border: 0 !important; opacity: 0; pointer-events: none; }
.dmy:has(> .dmy-native.hidden) { display: none; }
@media print { .dmy-pick { display: none; } }

/* dialogs and menus */
dialog { border-radius: 20px; }
dialog .dlg-foot { background: #fafaf8; border-bottom-left-radius: 20px; border-bottom-right-radius: 20px; }
.navmore .menu { border-radius: 14px; }
.toast { background: #141414; border-radius: 14px; }

/* dashboard: KPIs on top, main chart (8 of 12 columns) with "needs attention" on the right (4 columns) */
@media screen and (min-width: 1100px) {
  main.dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 20px; grid-auto-flow: row dense; align-items: start; }
  main.dash > * { grid-column: 1 / -1; }
  main.dash > .dash-row { display: contents; }
  main.dash > .dash-row > .card { margin: 0 0 20px; }
  main.dash > #notices:empty { display: none; }
  main.dash .dc-month, main.dash .dc-weeks { grid-column: 1 / span 8; }
  main.dash .dc-attn { grid-column: 9 / span 4; grid-row: span 2; align-self: stretch; }
  main.dash .dc-var { grid-column: 1 / -1; }
}

/* department budgets: a card per department (spent and budget, a bar for how much is used, the forecast) */
.dept-section + .dept-section { margin-top: 28px; }
.dept-section .bp-h2 .muted { font-weight: 400; margin-left: 8px; }
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 16px; }
.dept-card { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px 20px; color: var(--ink); }
.dept-card:hover { border-color: var(--line-strong); text-decoration: none; background: #fdfdfc; }
.dept-card .dc-name { font-weight: 600; font-size: 15px; line-height: 1.3; }
.dept-card .dc-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.dept-card .dc-nums { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.dept-card .dc-nums .r { text-align: right; }
.dept-card .lbl { color: var(--muted); font-size: 12px; }
.dept-card .big { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.dept-card .mid { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.dc-bar { position: relative; height: 8px; border-radius: 99px; background: var(--surface-2); }
.dc-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; background: var(--brand-green); }
.dc-bar.warn i { background: #d99a1e; }
.dc-bar.bad i { background: var(--brand-red); }
.dc-bar b { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 2px; opacity: .55; }
.dept-card .dc-foot { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.bad-text { color: var(--bad); }
.ok-text { color: var(--good); }
.crumbs { margin: -8px 0 14px; font-size: 13px; }
.crumbs:empty { display: none; }
.budget-items td:first-child, .cf.budget-items tr.line td:first-child { min-width: 0; width: 1%; white-space: nowrap; padding-left: 10px; }
.budget-items td:nth-child(2) { min-width: 280px; }
.budget-items td:nth-child(3) { max-width: 220px; }
.budget-items thead th:nth-child(2), .budget-items thead th:nth-child(3) { text-align: left; }
.budget-items .exp { margin-right: 4px; }
.budget-items tr.event-row td { font-size: 12.5px; background: #fcfcfa; }
/* budget item code: a small grey chip; a temporary code is dashed */
.item-code { display: inline-block; font-size: 11px; font-variant-numeric: tabular-nums; line-height: 1; padding: 3px 6px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.item-code.temp { background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); }
/* transactions: the budget item cell is a button that opens the picker */
.tx td.item-cell { min-width: 190px; max-width: 260px; }
.tx select.line-sel { max-width: 250px; }
.item-btn { display: block; width: 100%; max-width: 260px; text-align: left; padding: 5px 8px; border-radius: 10px; font-weight: 400; font-size: 12.5px; line-height: 1.35; white-space: normal; }
.item-btn .c2 { color: var(--muted); font-size: 11.5px; }
.item-btn.empty { color: var(--muted); border-style: dashed; }
.item-btn.auto { border-color: transparent; background: transparent; }
.item-btn.auto:hover { border-color: var(--line-strong); background: var(--surface); }
/* budget item picker */
dialog.item-picker { width: min(760px, 96vw); }
.item-picker .dlg-body { gap: 10px; }
.item-picker .ip-q { width: 100%; font-size: 15px; padding: 10px 14px; }
.ip-list { height: min(60vh, 520px); overflow-y: auto; border: 1px solid var(--line); border-radius: 14px; padding: 6px; }
.ip-dept { position: sticky; top: -6px; background: #fff; padding: 10px 8px 4px; font-size: 12px; font-weight: 600; color: var(--brand-green); z-index: 1; }
.ip-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 10px; cursor: pointer; }
.ip-row:hover, .ip-row.active { background: var(--surface-2); }
.ip-row.current { box-shadow: inset 0 0 0 1px var(--brand-green); }
.ip-row.child { padding-left: 34px; font-size: 13px; }
.ip-name { flex: 1; min-width: 0; }
.ip-meta { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 38%; }
.ip-more { padding: 2px 8px; font-size: 12px; color: var(--muted); }
/* settings: departments and their items */
.dept-tbl tr.dept-head td { background: #fafaf8; font-weight: 600; border-top: 1px solid var(--line); }
.dept-tbl tr.dept-head td .muted { font-weight: 400; }
.dept-tbl tr.inactive td { opacity: .5; }
.dept-tbl tr.event-row td { font-size: 12.5px; }
.dept-tbl tr.event-row td:nth-child(2) { padding-left: 28px; }
/* air tickets: a card per agency (tickets, paid, how much is split by tickets) */
.tk-agencies { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 16px; margin-bottom: 16px; }
.tk-agencies:empty { display: none; }
.tk-agency { margin: 0 !important; }
.tk-agency .tk-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.tk-agency .tk-nums { display: grid; grid-template-columns: .8fr 1fr 1fr .9fr; gap: 12px; }
.tk-agency .lbl { color: var(--muted); font-size: 12px; }
.tk-agency .big { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tk-agency .mid { font-size: 15px; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .tk-agency .tk-nums { grid-template-columns: 1fr 1fr; } }
.pill.tk-how { margin-top: 3px; font-size: 10.5px; }
/* upload page: month-by-month reconciliation, a month opens into its accounts */
.rc-months tr.rc-month { cursor: pointer; }
.rc-months tr.rc-month:hover td { background: var(--surface-2); }
.rc-months tr.rc-month .exp { display: inline-block; width: 1em; color: var(--muted); }
.rc-months tr.rc-month.open td { font-weight: 600; }
.rc-months tr.rc-detail > td { background: #fbfbf9; padding: 12px 10px 14px; }
.rc-months tr.rc-detail table { margin: 0; }
/* department heads: explanations owed on a department card; people in the department dialog */
.dc-owe { margin-top: 8px; }
.sd-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 12px; max-height: 180px; overflow: auto; padding: 4px 0; }
.budget-items td.cmt { min-width: 160px; max-width: 280px; cursor: default; }
.budget-items td.cmt[data-cmt] { cursor: pointer; }
.tk-groups td:first-child { max-width: 340px; }
/* cash flow: a line opened by department */
.cf tr.dept-row td { font-size: 12.5px; color: var(--ink-2); background: #fcfcfa; }
.cf tr.dept-row td:first-child { padding-left: 40px; }
button.exp.dept-exp { margin-right: 4px; }

/* ---------- print (A4) — letterhead look: logo, title, red/green rule ---------- */
.print-head { display: none; }
@page { size: A4 portrait; margin: 12mm 10mm 14mm; }
@page landscape { size: A4 landscape; margin: 10mm; }
@media print {
  :root { --page: #fff; --surface: #fff; --line: #d6d6d6; --line-strong: #999; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body { background: #fff; font-size: 10pt; }
  .topbar, .toolbar, .no-print, .bulkbar, .pager, .notice, button, .chart-tip, .tabs, .site-footer { display: none !important; }
  .page { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .print-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding-bottom: 8px; margin-bottom: 12px; border-bottom: 3px solid var(--brand-red); position: relative; }
  .print-head::after { content: ''; position: absolute; right: 0; bottom: -3px; width: 22%; height: 3px; background: var(--brand-green); }
  .print-head img { height: 13mm; width: auto; }
  .print-head .t { font-family: var(--font-head); font-style: normal; font-weight: 700; font-size: 15pt; color: var(--brand-red); }
  .print-head .s { font-size: 8.5pt; color: #333; }
  .print-head .meta { text-align: right; }
  .page-head { display: none; }
  .kpis { grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 10px; }
  .kpi { padding: 5px 8px; box-shadow: none; border-color: #ccc; break-inside: avoid; border-radius: 6px; }
  .kpi.hero { background: #fff; border-color: var(--brand-green); }
  .kpi.hero .label, .kpi.hero .note { color: var(--muted); }
  .kpi.hero .value { color: var(--brand-green); }
  .card, .bp-page { border-radius: 0; }
  .topbar, .seg, .lang-switch { box-shadow: none; }
  .kpi .value { font-size: 11.5pt; }
  .cf { font-size: 8.5pt; }
  .cf th, .cf td { padding: 2.5px 6px; }
  .cf thead th, .tx thead th { position: static; }
  .cf thead { display: table-header-group; }
  .cf tr { break-inside: avoid; }
  .cf td:first-child { min-width: 0; }
  .tx { font-size: 7.5pt; }
  .tx select { border: 0; padding: 0; appearance: none; font-size: 7.5pt; background: transparent; }
  .landscape-print { page: landscape; }
  a { color: inherit; text-decoration: none; }
  .table-wrap { overflow: visible; }
  .chart-card { break-inside: avoid; }
  .cf td.cmt .cmt-txt, .lc-note { display: block; -webkit-line-clamp: none; line-clamp: none; overflow: visible; }
  .cf.cmp td:first-child { position: static; max-width: 200px; }
  .cf.cmp { zoom: 1 !important; }
  .cf td.need-cmt::after { display: none; }
  .cf.split { font-size: 7.5pt; }
  .cf.split th, .cf.split td { padding: 2px 4px; }
  .cf.split thead tr.sub th { top: auto !important; }
  .bp-page { border: 0; box-shadow: none; padding: 0; margin: 0; break-after: page; }
  .bp-page:last-child { break-after: auto; }
  .bp-letterhead img { height: 15mm; }
  .bp-title { font-size: 20pt; margin-top: 8mm; }
  .bp-subtitle { font-size: 10pt; margin-bottom: 6mm; }
  .bp-kpis { grid-template-columns: repeat(5, 1fr); }
  .bp-kpis .kpi .value { font-size: 14pt; }
  .bp-h2 { font-size: 12pt; }
  .bp-chart svg { width: 100%; }
  .bp .cf td.cmt { font-size: 7.5pt; }
  /* department budgets: three cards a row; the budget item stays visible in the transactions list */
  .dept-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .dept-card { break-inside: avoid; border-color: #ccc; border-radius: 6px; padding: 6px 8px; gap: 4px; }
  .dept-card .big { font-size: 12pt; }
  .dept-section + .dept-section { margin-top: 10px; }
  .tx button.item-btn { display: block !important; border: 0; padding: 0; background: transparent; font-size: 7.5pt; }
}