/* Hub Budget — scoped styles.
 *
 * Every selector is prefixed .hub-bud-* (or scoped under .hub-bud) so this file
 * cannot reach anything the rest of the Hub owns. Tokens come from styles.css;
 * shared furniture (.hub-btn, .hub-select, .hub-input, .hub-metric, .hub-bar,
 * .hub-status-banner, .hub-rep-w-*) is reused rather than redrawn.
 *
 * The page follows the redesign's reporting pages (Consultant Hours, the
 * Student Consultant Schedule): no boxed cards, figures between hairline rules,
 * underline tabs, one period on screen at a time.
 *
 * No @import, no remote url(), no inline styles: the live CSP is style-src 'self'.
 */

.hub-bud { color: var(--text); }
.hub-bud > * + * { margin-top: var(--s5); }
.hub-bud-link {
  padding: 0; border: 0; background: none; color: var(--accent-2); font: inherit; font-weight: 600;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}
.hub-bud-link:hover { color: var(--accent); }
.hub-bud-sub { margin: 4px 0 0; font-size: 13px; line-height: 1.5; color: var(--text3); }
.hub-bud-empty { margin: var(--s3) 0 0; font-size: 14px; color: var(--text2); }
.hub-bud-over { color: var(--danger); }
.hub-bud-left { color: var(--accent-2); }
.hub-bud-none { font-family: var(--font); font-size: 20px; font-weight: 600; color: var(--text2); }
.hub-bud-flag {
  display: inline-block; padding: 0 7px; border-radius: var(--r-pill); background: var(--warn-bg); color: var(--warn);
  font-size: 11.5px; font-weight: 700; line-height: 1.6;
}

/* --- controls: fund, month, the one primary action -------------------------- */
.hub-bud-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s5);
  padding-bottom: var(--s4); border-bottom: 1px solid var(--border);
}
.hub-bud-funds { display: inline-flex; padding: 3px; gap: 3px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface2); }
.hub-bud-fund {
  min-height: 40px; padding: 0 14px; border: 0; border-radius: var(--r-sm); background: transparent;
  color: var(--text2); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.hub-bud-fund:hover { color: var(--text); }
.hub-bud-fund.is-on { background: var(--surface); color: var(--accent-2); box-shadow: 0 1px 2px rgba(15, 23, 42, .08), inset 0 0 0 1px var(--border); }
.hub-bud-month { display: flex; align-items: center; gap: var(--s2); margin-right: auto; }
.hub-bud-month-title {
  margin: 0 4px; min-width: 9.5em; text-align: center; font-family: var(--serif); font-size: 24px; font-weight: 600;
  line-height: 1.2; letter-spacing: -.01em; color: var(--ink-900);
}
.hub-bud-nav {
  width: 40px; height: 40px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface);
  color: var(--text); font-size: 20px; line-height: 1; cursor: pointer;
}
.hub-bud-nav:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-2); }
.hub-bud-nav:disabled { opacity: .35; cursor: default; }

/* --- the four figures, between rules ---------------------------------------- */
.hub-bud-metrics {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.hub-bud .hub-bud-metrics > .hub-metric {
  overflow: visible; min-width: 0; padding: 16px 24px 18px; background: none; border: 0; border-radius: 0; box-shadow: none; transition: none;
}
.hub-bud .hub-bud-metrics > .hub-metric::before { content: none; display: none; }
.hub-bud .hub-bud-metrics > .hub-metric:hover { box-shadow: none; }
.hub-bud .hub-bud-metrics > .hub-metric + .hub-metric { border-left: 1px solid var(--border); }
.hub-bud .hub-bud-metrics > .hub-metric:first-child { padding-left: 0; }
.hub-bud .hub-bud-metrics .hub-metric-label { font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--text3); }
.hub-bud .hub-bud-metrics .hub-metric-value { display: block; margin-top: 8px; font-size: 28px; color: var(--ink-900); overflow-wrap: anywhere; }
.hub-bud .hub-bud-metrics .hub-metric-sub { margin-top: 6px; font-size: 13px; color: var(--text3); }
.hub-bud .hub-bud-metrics .hub-metric.is-over .hub-metric-value { color: var(--danger); }
.hub-bud .hub-bar { display: block; }   /* a <span>: inline, it would have no height outside a grid */
.hub-bud .hub-bud-metrics .hub-bar { margin-top: 10px; }
.hub-bud .hub-bar-fill.is-over { background: var(--danger); }

/* --- tabs --------------------------------------------------------------------- */
.hub-bud-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.hub-bud-tab {
  min-height: 44px; padding: 0 16px; border: 0; border-bottom: 3px solid transparent;
  background: transparent; color: var(--text2); font: inherit; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.hub-bud-tab:hover { color: var(--text); }
.hub-bud-tab.is-active { color: var(--accent-2); border-bottom-color: var(--accent); }
.hub-bud-tabs + .hub-bud-tabpanel { margin-top: var(--s5); }
.hub-bud-tabpanel > * + * { margin-top: var(--s4); }
.hub-bud button:focus-visible, .hub-bud a:focus-visible, .hub-bud input:focus-visible,
.hub-bud select:focus-visible, .hub-bud textarea:focus-visible, .hub-bud summary:focus-visible {
  outline: 3px solid var(--focus, #145fc5); outline-offset: 2px;
}

/* --- overview ------------------------------------------------------------------ */
.hub-bud-overview { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--s6) var(--s8, 48px); }
.hub-bud-col > * + * { margin-top: var(--s6); }
.hub-bud-sec { min-width: 0; }
.hub-bud-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); }
.hub-bud-h { margin: 0; font-size: 15px; font-weight: 700; color: var(--text); }
.hub-bud-h4 { margin: var(--s4) 0 var(--s2); font-size: 13.5px; font-weight: 700; }
.hub-bud-rows { list-style: none; margin: var(--s3) 0 0; padding: 0; display: grid; gap: 10px; }
.hub-bud-row { display: grid; grid-template-columns: minmax(6rem, 11rem) minmax(4rem, 1fr) auto; align-items: center; gap: var(--s3); }
.hub-bud-rows.is-trend .hub-bud-row { grid-template-columns: 5.5rem minmax(4rem, 1fr) auto; }
.hub-bud-row-label { font-size: 13.5px; font-weight: 600; color: var(--text2); overflow-wrap: anywhere; }
.hub-bud-row.is-current .hub-bud-row-label { color: var(--ink-900); }
.hub-bud-row-val { font-size: 13.5px; font-weight: 700; color: var(--ink-900); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.hub-bud-row-n { font-weight: 500; color: var(--text3); }
.hub-bud-fund-dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); margin: var(--s3) 0 var(--s3); }
.hub-bud-fund-dl dt { font-size: 12.5px; color: var(--text3); }
.hub-bud-fund-dl dd { margin: 2px 0 0; font-size: 20px; font-weight: 700; color: var(--ink-900); font-variant-numeric: tabular-nums; }
.hub-bud-fund-dl dd.hub-bud-over { color: var(--danger); }
.hub-bud-fund-dl dd.hub-bud-left { color: var(--accent-2); }
.hub-bud-recent, .hub-bud-low { list-style: none; margin: var(--s3) 0 0; padding: 0; }
.hub-bud-recent li { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) auto; gap: var(--s3); align-items: baseline; padding: 9px 0; border-top: 1px solid var(--line-2); font-size: 13.5px; }
.hub-bud-recent-date { color: var(--text3); white-space: nowrap; }
.hub-bud-recent-what { min-width: 0; overflow-wrap: anywhere; }
.hub-bud-recent-amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.hub-bud-low li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s2); padding: 9px 0; border-top: 1px solid var(--line-2); }
.hub-bud-low-name { font-weight: 600; font-size: 14px; }
.hub-bud-low-meta { width: 100%; font-size: 12.5px; color: var(--text3); }

/* --- stock status: always a word, never colour alone ---------------------------- */
.hub-bud-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 700; white-space: nowrap; line-height: 1.5;
}
.hub-bud-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.hub-bud-badge.is-now  { background: #fde8e8; color: #9b1c1c; }
.hub-bud-badge.is-soon { background: var(--warn-bg); color: #8a4b08; }
.hub-bud-badge.is-ok   { background: var(--ok-bg); color: var(--accent-2); }
.hub-bud-badge.is-none { background: var(--surface2); color: var(--text2); box-shadow: inset 0 0 0 1px var(--border); }

/* --- lists: filters, tables, cards -------------------------------------------- */
.hub-bud-filters { display: grid; grid-template-columns: repeat(3, minmax(9rem, 12rem)) minmax(12rem, 1fr); gap: var(--s3); align-items: end; }
.hub-bud-field { display: grid; align-content: start; gap: 4px; min-width: 0; font-size: 13px; font-weight: 600; color: var(--text2); }
.hub-bud-field > .hub-select, .hub-bud-field > .hub-input { width: 100%; min-width: 0; font-weight: 400; }
.hub-bud-hint { font-size: 12px; font-weight: 400; color: var(--text3); }
/* position: relative keeps the absolutely positioned .sr-only header labels inside the
   scroller; without it they sit at the far edge of a wide table and widen the page. */
.hub-bud-table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.hub-bud-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.hub-bud-table th, .hub-bud-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
.hub-bud-table thead th { background: var(--surface2); border-bottom: 1px solid var(--border); font-size: 12.5px; font-weight: 700; color: var(--text2); white-space: nowrap; }
.hub-bud-table tbody tr:last-child > * { border-bottom: 0; }
.hub-bud-table tbody th { font-weight: 400; }
.hub-bud-table.is-compact { margin-top: var(--s3); max-width: 40rem; }
.hub-bud-num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hub-bud-nowrap { white-space: nowrap; }
.hub-bud-amt { font-weight: 700; }
.hub-bud-desc { display: block; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.hub-bud-meta { display: block; margin-top: 2px; font-size: 12.5px; color: var(--text3); overflow-wrap: anywhere; }
.hub-bud-void { display: block; margin-top: 3px; font-size: 12.5px; font-weight: 600; color: var(--danger); }
.hub-bud-table tr.is-voided td, .hub-bud-card.is-voided { color: var(--text3); }
.hub-bud-table tr.is-voided .hub-bud-amt, .hub-bud-card.is-voided .hub-bud-amt { text-decoration: line-through; }
.hub-bud-table tr.is-archived > *, .hub-bud-card.is-archived { color: var(--text3); }
.hub-bud-acts { white-space: nowrap; text-align: right; }
.hub-bud-acts > * + * { margin-left: 6px; }
.hub-bud-danger { color: var(--danger) !important; border-color: var(--danger-br, #f5c2c2) !important; }
.hub-bud-danger-solid { background: var(--danger) !important; border-color: var(--danger) !important; color: #fff !important; }
.hub-bud-cards { display: none; list-style: none; margin: 0; padding: 0; }
.hub-bud-card { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.hub-bud-card + .hub-bud-card { margin-top: var(--s2); }
.hub-bud-card-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.hub-bud-card-date { font-size: 13px; color: var(--text3); }
.hub-bud-card .hub-bud-desc { margin: 6px 0 0; }
.hub-bud-card-kv { margin: 4px 0 0; font-size: 12.5px; color: var(--text2); overflow-wrap: anywhere; }
.hub-bud-card-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.hub-bud-inv-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); }
.hub-bud-counts { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin: 0; font-size: 14px; color: var(--text2); }
.hub-bud-counts strong { font-size: 18px; color: var(--ink-900); margin-right: 4px; }
.hub-bud-inv-acts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); }
.hub-bud-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 13.5px; color: var(--text2); cursor: pointer; }

/* --- settings ------------------------------------------------------------------- */
.hub-bud-settings > * + * { margin-top: var(--s6); padding-top: var(--s5); border-top: 1px solid var(--border); }
.hub-bud-form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s3); margin-top: var(--s3); }
.hub-bud-form-row > .hub-bud-field { flex: 0 1 12rem; }
.hub-bud-form-row > .hub-bud-field-grow { flex: 1 1 16rem; }
.hub-bud-form-acts { display: flex; gap: var(--s2); }
.hub-bud-cats { list-style: none; margin: var(--s3) 0 0; padding: 0; display: grid; gap: var(--s2); }
.hub-bud-cat-top { font-weight: 700; font-size: 14px; }
.hub-bud-cats ul { list-style: none; margin: 4px 0 0; padding: 0 0 0 var(--s4); display: grid; gap: 4px; }
.hub-bud-cats ul li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13.5px; }
.hub-bud-cats ul li.is-archived > span { color: var(--text3); }
.hub-bud-cats .hub-input { max-width: 16rem; }

/* --- the side panel: a sheet on the right; the whole screen on a phone ---------- */
.hub-bud-scrim { position: fixed; inset: 0; z-index: 1000; background: rgba(15, 23, 42, .42); }
.hub-bud-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 1001; width: min(540px, 100vw);
  display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: -18px 0 48px rgba(15, 23, 42, .22);
}
.hub-bud-panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.hub-bud-panel-head h3 { margin: 0; font-family: var(--serif); font-size: 21px; font-weight: 600; color: var(--ink-900); overflow-wrap: anywhere; }
.hub-bud-x {
  flex: 0 0 auto; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--surface); color: var(--text2); font-size: 22px; line-height: 1; cursor: pointer;
}
.hub-bud-x:hover { border-color: var(--accent); color: var(--accent-2); }
.hub-bud-panel-body { flex: 1 1 auto; overflow-y: auto; padding: 18px 20px; }
.hub-bud-panel-body > * + * { margin-top: var(--s4); }
.hub-bud-panel-foot { display: flex; gap: var(--s2); padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface2); }
.hub-bud-panel-note { margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--info-bg, #eef4fb); font-size: 13.5px; line-height: 1.5; color: var(--text); }
.hub-bud-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.hub-bud-span2 { grid-column: span 2; }
.hub-bud-block { display: grid; }
.hub-bud-fs { margin-inline: 0; padding: 12px 14px 14px; border: 1px solid var(--border); border-radius: var(--r); }
.hub-bud-fs legend { padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--text); }
.hub-bud-fs > * + * { margin-top: var(--s3); }
.hub-bud-more > summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--accent-2); min-height: 32px; display: flex; align-items: center; }
.hub-bud-more[open] > summary { margin-bottom: var(--s3); }
.hub-bud-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.hub-bud-chips li { display: inline-flex; align-items: center; gap: 2px; padding: 2px 4px 2px 10px; border-radius: var(--r-pill); background: var(--ok-bg); font-size: 13px; font-weight: 600; }
.hub-bud-chip-x { width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--text2); font-size: 16px; cursor: pointer; }
.hub-bud-chip-x:hover { background: rgba(15, 23, 42, .08); }
.hub-bud-results { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.hub-bud-results li + li { border-top: 1px solid var(--line-2); }
.hub-bud-results button { width: 100%; min-height: 44px; padding: 8px 12px; border: 0; background: var(--surface); text-align: left; font: inherit; font-size: 13.5px; cursor: pointer; }
.hub-bud-results button:hover { background: var(--surface2); }
.hub-bud-form-error { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--danger); }
.hub-bud-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.hub-bud-dl > div { display: contents; }
.hub-bud-dl dt { color: var(--text3); }
.hub-bud-dl dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.hub-bud-moves { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.hub-bud-moves li { display: grid; grid-template-columns: 6.5rem 1fr auto; gap: 4px var(--s2); padding: 6px 0; border-top: 1px solid var(--line-2); }
.hub-bud-moves li > :last-child { grid-column: 1 / -1; }

/* --- widths ---------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .hub-bud-overview { grid-template-columns: minmax(0, 1fr); }
  .hub-bud-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hub-bud-filters .hub-bud-field-grow { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .hub-bud-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hub-bud .hub-bud-metrics > .hub-metric { padding: 14px 16px; }
  .hub-bud .hub-bud-metrics > .hub-metric:nth-child(odd) { padding-left: 0; border-left: 0; }
  .hub-bud .hub-bud-metrics > .hub-metric:nth-child(n + 3) { border-top: 1px solid var(--border); }
}
@media (max-width: 760px) {
  .hub-bud-table-wrap { display: none; }
  .hub-bud-cards { display: block; }
  .hub-bud-controls { gap: var(--s3); }
  .hub-bud-funds { width: 100%; }
  .hub-bud-fund { flex: 1 1 0; min-height: 44px; }
  .hub-bud-month { width: 100%; margin-right: 0; justify-content: space-between; }
  .hub-bud-month-title { min-width: 0; font-size: 21px; }
  .hub-bud-nav { width: 44px; height: 44px; }
  .hub-bud-controls > .hub-btn-primary { width: 100%; min-height: 44px; }
  .hub-bud-filters { grid-template-columns: minmax(0, 1fr); }
  .hub-bud-filters .hub-select, .hub-bud-filters .hub-input,
  .hub-bud-panel .hub-input, .hub-bud-panel .hub-select, .hub-bud-form-row .hub-input, .hub-bud-form-row .hub-select { min-height: 44px; font-size: 16px; }
  .hub-bud-form-row > .hub-bud-field, .hub-bud-form-row > .hub-bud-field-grow { flex: 1 1 100%; }
  .hub-bud-panel { width: 100vw; border-left: 0; }
  .hub-bud-grid { grid-template-columns: minmax(0, 1fr); }
  .hub-bud-span2 { grid-column: auto; }
  .hub-bud-card-acts .hub-btn, .hub-bud-panel-foot .hub-btn { min-height: 44px; }
  .hub-bud-panel-foot .hub-btn { flex: 1 1 0; }
  .hub-bud-row, .hub-bud-rows.is-trend .hub-bud-row { grid-template-columns: minmax(0, 1fr) auto; }
  .hub-bud-row .hub-bar { grid-column: 1 / -1; order: 3; }
  .hub-bud-fund-dl dd { font-size: 17px; }
  .hub-bud-recent li { grid-template-columns: minmax(0, 1fr) auto; }
  .hub-bud-recent-date { grid-column: 1 / -1; }
  .hub-bud .hub-bud-metrics .hub-metric-value { font-size: 22px; }
}
