/* ══ Budget Management (pages/budgets.js) ═══════════════════════════════════════════════════════════════════
   Built on the shared kits (pr-hero record header, hds-frame workspace + side pane, fnp tiles, hdl tiles, data tables,
   xp banners); only what is particular to budgets lives here: the used-share bar, the lines grid with its twelve month
   columns, the Budget vs Actual drill-down rows and the seasonal pattern's shape. */

/* Used share: a thin bar in the list-tile colours with the share beside it */
.bg-used{display:inline-flex;align-items:center;gap:8px;min-width:104px}
.bg-used-bar{position:relative;flex:1;min-width:48px;height:6px;border-radius:999px;overflow:hidden;background:color-mix(in srgb,var(--text-muted) 16%,transparent)}
.bg-used-bar i{position:absolute;inset-block:0;inset-inline-start:0;border-radius:inherit}
.bg-used b{font-size:12px;font-weight:700;color:var(--text-secondary);min-width:36px;text-align:end}
.bg-used-cell{min-width:150px;white-space:nowrap}

/* The version picker in the record header's sub line */
.bg-ver{display:inline-flex;align-items:center;gap:6px}
.bg-ver span{color:var(--text-muted)}
.bg-ver .ra-fsel{height:28px;padding-block:0;font-size:12.5px}

/* Notes on the page: neutral unless they say otherwise (xp-banner is red by default) */
.bgp .xp-banner{margin:0}
.bgp .xp-banner:not(.is-bad):not(.is-warn){background:color-mix(in srgb,var(--accent) 6%,var(--card-bg));box-shadow:0 0 0 1px color-mix(in srgb,var(--accent) 18%,var(--border))}
.bgp .xp-banner:not(.is-bad):not(.is-warn) svg{color:var(--accent)}
.bgp .xp-banner.is-warn{background:color-mix(in srgb,var(--amber) 9%,var(--card-bg));box-shadow:0 0 0 1px color-mix(in srgb,var(--amber) 30%,var(--border))}
.bgp .xp-banner.is-warn svg{color:var(--amber)}
.bgp > .xp-banner{margin-bottom:14px}
.bgp .pr-body{display:flex;flex-direction:column;gap:16px}
.bgp .pr-body > .fnp-tiles{margin:0}

/* The lines workspace: cost centres on the left, the editor on the right */
.bg-frame{margin-top:0}
.bg-ed .hds-ed-b{gap:14px;padding-bottom:18px}
.bg-ed .hds-ed-b > .fnp-tiles{margin:0}
.bgp .fnp-tile-t b{white-space:nowrap}
.bg-ed-acts{display:flex;align-items:center;gap:8px;flex-shrink:0}
.bg-card{overflow:hidden}
.bg-card-h{display:flex;flex-direction:column;gap:2px;padding:14px 18px;border-bottom:1px solid var(--border)}
.bg-card-h span{font-size:12px;color:var(--text-muted)}

/* The lines grid: twelve narrow month columns that scroll sideways inside the card */
.bg-lines{min-width:100%}
.bg-lines th,.bg-lines td{white-space:nowrap;vertical-align:top}
.bg-lines .bg-c-acc{min-width:260px;max-width:320px;white-space:normal}
.bg-lines .bg-c-spread{min-width:130px}
.bg-lines .bg-c-total{min-width:128px}
.bg-lines .bg-c-m{min-width:84px}
.bg-lines .bg-c-m.is-past{background:color-mix(in srgb,var(--text-muted) 5%,transparent)}
.bg-lines .bg-c-fix{text-align:center;width:52px}
.bg-lines .form-input{height:32px;padding-block:4px;padding-inline:8px;font-size:12.5px}
.bg-lines input[type="number"]{text-align:end;width:100%;min-width:72px}
.bg-lines .bl-acc{width:100%}
.bg-lines .bl-pj{margin-top:6px;width:100%;height:28px;font-size:12px}
.bg-lines .bl-spread{width:100%;height:32px;font-size:12.5px}
.bg-lines .bl-mv,.bg-lines .bl-sum{display:inline-block;padding-top:7px;font-variant-numeric:tabular-nums}
.bg-fig{display:block;margin-top:5px;font-size:11.5px;line-height:1.4;color:var(--text-muted);white-space:normal}
.bg-foot td{background:color-mix(in srgb,var(--text-muted) 6%,transparent);font-variant-numeric:tabular-nums}

/* Budget vs Actual: a cost centre opens onto its lines */
.bg-caret{display:inline-block;width:14px;margin-inline-end:4px;color:var(--text-muted);transition:transform .15s}
.bg-caret.on{transform:rotate(90deg)}
.bg-sub td{font-size:12.5px;background:color-mix(in srgb,var(--text-muted) 4%,transparent)}
.bg-indent{display:inline-block;padding-inline-start:22px}
.bg-up{color:var(--red)}
.bg-down{color:var(--green)}

/* Seasonal pattern editor: twelve weights and the year's shape */
.bg-weights{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:10px;margin-top:16px}
.bg-weights label{display:flex;flex-direction:column;gap:4px;font-size:12px;color:var(--text-muted)}
.bg-shape{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));align-items:end;gap:6px;height:120px;margin-top:18px;padding-top:6px}
.bg-shape span{display:flex;flex-direction:column;align-items:center;justify-content:flex-end;height:100%;gap:4px}
.bg-shape i{display:block;width:100%;max-width:34px;min-height:2px;border-radius:6px 6px 2px 2px;background:color-mix(in srgb,var(--accent) 55%,var(--card-bg))}
.bg-shape b{font-size:11px;font-weight:600;color:var(--text-muted)}

@media (max-width:767px){
  .bg-weights{grid-template-columns:repeat(3,minmax(0,1fr))}
  .bgp .fnp-tiles{grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* ══ Planning (pages/budget_plans.js) ══════════════════════════════════════════════════════════════════════════ */
/* A card header with its own buttons: the title on the start side, the buttons on the end */
.bp-card-h{flex-direction:row;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap}
.bp-card-h > div:first-child{display:flex;flex-direction:column;gap:2px;min-width:0}
/* The four drivers: a percentage each with what it moves */
.bp-drivers{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;padding:16px 18px 18px}
.bp-drivers label{display:flex;flex-direction:column;gap:5px;font-size:12px;font-weight:600;color:var(--text-secondary)}
.bp-drivers small{font-size:11.5px;font-weight:400;color:var(--text-muted);line-height:1.4}
.bp-drivers .form-input{text-align:end}
/* Month by month: a label column, then the months */
.bp-months td:first-child{white-space:nowrap;min-width:180px}
/* Rows left out of the plan stay visible, faded */
.bpp tr.is-off td{opacity:.5}
.bpp tr.is-off td.bg-c-fix{opacity:1}
.bpp .party-row.is-on td{background:color-mix(in srgb,var(--accent) 5%,transparent)}
.bpp .bp-cap td,.bpp .bp-people td{vertical-align:middle}
/* Hires & Leavers and Planned Purchases fit the page: narrow pickers, the role / item takes what is left */
.bpp .bp-people .bg-c-acc,.bpp .bp-cap .bg-c-acc{min-width:150px;max-width:none}
.bpp .bp-people .ra-fsel,.bpp .bp-cap .ra-fsel{max-width:170px}
.bpp .bp-people .bpp-grade{max-width:110px}
.bpp .bp-people .bpp-count{width:72px;min-width:72px}
.bpp .bp-people .bpp-amount,.bpp .bp-cap .bpc-amount{width:120px;min-width:110px}
.bpp .bp-cap .bpc-life{white-space:normal;min-width:120px;font-size:12.5px;color:var(--text-muted)}
/* Revenue months hold seven-digit amounts */
.bpp .bp-rev .bg-c-m{min-width:104px}
.bpp .bp-rev input[type="number"]{min-width:92px}

@media (max-width:767px){
  .bp-drivers{grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* ══ Dashboard & cash forecast (pages/budget_dashboard.js) ═════════════════════════════════════════════════════ */
.bd{display:flex;flex-direction:column;gap:16px}
.bd > .fnp-tiles{margin:0}
.bd-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px}
.bd .xp-banner{margin:0}
/* Budget used by cost centre: name · used bar · used of budget */
.bd-ccs{display:flex;flex-direction:column;padding:6px 10px 12px}
.bd-cc{display:grid;grid-template-columns:minmax(0,1.3fr) minmax(130px,1fr) auto;align-items:center;gap:12px;padding:9px 8px;border:0;border-radius:8px;
  background:none;text-align:start;cursor:pointer;color:inherit;font:inherit}
.bd-cc:hover{background:color-mix(in srgb,var(--accent) 5%,transparent)}
.bd-cc-n{font-size:13px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bd-cc-v{font-size:12px;color:var(--text-muted);font-variant-numeric:tabular-nums;white-space:nowrap}
/* Charts: the accent for the figure, a quiet grey for the budget, red only below zero */
.bd-chart{padding:10px 16px 14px}
.bd-svg{display:block;width:100%;height:auto;overflow:visible}
.bd-svg .bd-line{fill:none;stroke:var(--accent);stroke-width:2;stroke-linejoin:round;vector-effect:non-scaling-stroke}
.bd-svg .bd-area{fill:color-mix(in srgb,var(--accent) 10%,transparent)}
.bd-svg .bd-zero,.bd-svg .bd-base{stroke:color-mix(in srgb,var(--text-muted) 45%,transparent);stroke-width:1;stroke-dasharray:3 3;vector-effect:non-scaling-stroke}
.bd-svg .bd-base{stroke-dasharray:none}
.bd-svg .bd-dot{fill:var(--accent);stroke:var(--card-bg);stroke-width:2;vector-effect:non-scaling-stroke}
.bd-svg .bd-dot.is-neg{fill:var(--red)}
.bd-svg .bd-tick{font-size:11px;fill:var(--text-muted)}
.bd-svg .bd-hit{fill:transparent;cursor:default}
.bd-svg .bd-hit:hover{fill:color-mix(in srgb,var(--text-muted) 7%,transparent)}
.bd-svg .bd-bud{fill:color-mix(in srgb,var(--text-muted) 32%,transparent)}
.bd-svg .bd-act{fill:var(--accent)}
.bd-keys{display:flex;gap:16px;padding-top:6px;font-size:12px;color:var(--text-secondary)}
.bd-keys span{display:inline-flex;align-items:center;gap:6px}
.bd-keys i{width:10px;height:10px;border-radius:3px;display:inline-block}
.bd-k-bud{background:color-mix(in srgb,var(--text-muted) 32%,transparent)}
.bd-k-act{background:var(--accent)}
/* Cash card facts */
.bd-cash-facts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;padding:14px 18px 0}
.bd-cash-facts div{display:flex;flex-direction:column;gap:3px}
.bd-cash-facts span{font-size:12px;color:var(--text-muted)}
.bd-cash-facts b{font-size:17px;font-variant-numeric:tabular-nums}
.bd-cash-t .bg-c-m{min-width:96px}
/* Home dashboard widgets */
.bd-w{display:flex;flex-direction:column;gap:10px;width:100%;padding:4px 2px;border:0;background:none;text-align:start;color:inherit;font:inherit;cursor:pointer}
.bd-w-top{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.bd-w-top b{font-size:24px;font-weight:700;font-variant-numeric:tabular-nums}
.bd-w-top span{font-size:12.5px;color:var(--text-muted)}
.bd-w .bg-used{width:100%}
.bd-w-list{display:flex;flex-direction:column;gap:6px}
.bd-w-list div{display:grid;grid-template-columns:minmax(0,1fr) 120px;gap:10px;align-items:center;font-size:12.5px}
.bd-w-list div > span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.bd-w-facts{display:flex;gap:18px;font-size:12.5px;color:var(--text-muted)}
.bd-w-facts b{color:var(--text-primary);font-variant-numeric:tabular-nums}

@media (max-width:1023px){
  .bd-grid{grid-template-columns:minmax(0,1fr)}
}
