/* Design tokens (--primary-color1, --font-1, --hover, etc.) come from style.css */

/* #hfr IS this page's <main>. Cancel the theme's fixed-header offset from
   style.css (body:not(.wp-admin) main { padding-top: 131px }) — an ID
   selector outranks it on specificity. */
#hfr {
  padding-top: 0;
  overflow: visible; /* style.css sets main{overflow:hidden}, which kills sticky */
}

#hfr a {
  text-decoration: none;
  transition: color 0.3s;
}
#hfr a:hover {
  color: var(--hover);
}

/* ---------- MAIN ---------- */
#hfr .hfr-body {
  max-width: 1240px;
  margin: 0 auto;
  padding: 60px 30px;
}
#hfr .section-label {
  color: var(--secondary-color1);
  font-family: var(--font-3);
  font-weight: 500;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
#hfr .section-title {
  color: var(--primary-color1);
  font-family: var(--font-1);
  font-weight: 700;
  font-size: 36px;
  text-transform: uppercase;
  line-height: 1.1;
  margin-bottom: 8px;
}
#hfr .section-intro {
  color: var(--defaulttext);
  font-size: 17px;
  max-width: 860px;
  margin-bottom: 26px;
}

/* ---------- MODE TOGGLE ---------- */
#hfr .mode-toggle {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  background: #ededf4;
  border: 1px solid var(--color-border);
  border-radius: 100px;
  padding: 6px;
  margin-bottom: 26px;
}
#hfr .mode-btn {
  border: none;
  background: transparent;
  color: var(--primary-color1);
  font-family: var(--font-2);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 11px 22px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.25s;
  white-space: nowrap;
}
#hfr .mode-btn:hover {
  color: var(--hover);
}
#hfr .mode-btn.active {
  background: var(--primary-color1);
  color: #fff;
}

/* ---------- ALLOCATION SUMMARY ---------- */
#hfr .alloc-panel {
  background: #f7f7fb;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 22px 24px;
  margin-bottom: 30px;
  /* Pinned below the theme header; --hfr-sticky-top is measured in hfr.js. */
  position: sticky;
  top: var(--hfr-sticky-top, 0px);
  z-index: 20;
}
#hfr .alloc-top {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px 40px;
  align-items: flex-end;
  margin-bottom: 16px;
}
#hfr .alloc-label {
  font-family: var(--font-3);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary-color1);
  margin-bottom: 6px;
}
#hfr .alloc-figure {
  font-family: var(--font-1);
  font-weight: 700;
  font-size: 30px;
  color: var(--primary-color1);
  line-height: 1;
  transition: color 0.2s;
}
#hfr .alloc-figure span {
  font-size: 16px;
  color: var(--defaulttext2);
  font-family: var(--font-2);
  font-weight: 500;
}

/* Over-allocated: same 0.05pp threshold hfr.js uses for the status line.
   #cc003b is the brand red held (commented out) in style.css as --secondary-color3. */
#hfr .alloc-figure.over,
#hfr .alloc-figure.over span {
  color: #cc003b;
}
#hfr .budget-edit {
  display: flex;
  align-items: center;
  border-bottom: 2px solid var(--secondary-color1);
  padding-bottom: 4px;
}
#hfr .budget-dollar {
  font-family: var(--font-1);
  font-weight: 700;
  font-size: 30px;
  color: var(--primary-color1);
}
#hfr #budgetInput {
  border: none;
  background: transparent;
  font-family: var(--font-1);
  font-weight: 700;
  font-size: 30px;
  color: var(--primary-color1);
  width: 230px;
  padding: 0 2px;
  outline: none;
  font-variant-numeric: tabular-nums;
}
#hfr .alloc-right {
  margin-left: auto;
  text-align: right;
}
#hfr .alloc-bar {
  height: 16px;
  border-radius: 100px;
  background: #e3e3ee;
  overflow: hidden;
  display: flex;
}
#hfr .alloc-bar .seg-cash {
  height: 100%;
  background: var(--secondary-color1);
  transition: width 0.25s;
}
#hfr .alloc-bar .seg-inkind {
  height: 100%;
  background: var(--secondary-color2);
  transition: width 0.25s;
}
#hfr .alloc-legend {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  font-size: 14px;
  color: var(--defaulttext);
}
#hfr .dot {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: middle;
}
#hfr .dot.cash {
  background: var(--secondary-color1);
}
#hfr .dot.inkind {
  background: var(--secondary-color2);
}
#hfr .alloc-status {
  margin-left: auto;
  font-size: 14px;
  color: var(--defaulttext2);
}
#hfr .alloc-status strong {
  color: var(--primary-color1);
}
#hfr .btn-reset {
  padding: 9px 20px;
  border-radius: 100px;
  border: 1px solid var(--primary-color1);
  background: transparent;
  color: var(--primary-color1);
  font-family: var(--font-2);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s;
}
#hfr .btn-reset:hover {
  background: var(--primary-color1);
  color: #fff;
}

/* ---------- TABLE ---------- */
#hfr .table-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: 4px;
}
#hfr table.accounts {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}
#hfr table.accounts thead th {
  background: var(--primary-color1);
  color: #fff;
  font-family: var(--font-2);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: left;
  padding: 16px 18px;
  vertical-align: bottom;
}
#hfr table.accounts thead th.num {
  text-align: right;
}
#hfr table.accounts thead th small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--defaulttext3);
  margin-top: 3px;
}
#hfr tr.cat-row td {
  background: var(--bg-darkblue);
  color: #fff;
  font-family: var(--font-1);
  font-weight: 700;
  font-size: 19px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 13px 18px;
}
#hfr tr.cat-row td .cat-sub {
  float: right;
  font-size: 15px;
  font-family: var(--font-2);
  font-weight: 600;
  color: var(--secondary-color1);
  text-transform: none;
}
#hfr tbody td {
  padding: 11px 18px;
  border-bottom: 1px solid var(--color-border);
  font-size: 15px;
  color: var(--defaulttext);
  vertical-align: middle;
}
#hfr tbody tr.item-row:hover {
  background: #eef6fd;
}
#hfr td.item {
  font-weight: 600;
  color: var(--primary-color1);
  width: 31%;
}
#hfr td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
#hfr td.centef {
  width: 14%;
}
#hfr td.memo {
  width: 15%;
}
#hfr td.reset {
  width: 6%;
  text-align: center;
}
#hfr .row-reset {
  border: none;
  background: transparent;
  color: var(--primary-color1);
  padding: 5px;
  border-radius: 100px;
  cursor: pointer;
  line-height: 0;
  transition:
    color 0.2s,
    background 0.2s,
    opacity 0.2s;
}
#hfr .row-reset svg {
  display: block;
}
#hfr .row-reset:hover:not(:disabled) {
  color: var(--hover);
  background: #eef1fa;
}
#hfr .row-reset:focus-visible {
  outline: 2px solid var(--secondary-color1);
  outline-offset: 1px;
}
#hfr .row-reset:disabled {
  opacity: 0.22;
  cursor: default;
}

/* Visually hidden but announced by screen readers (the Reset column header). */
#hfr .hfr-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

#hfr td.table-status {
  padding: 40px 18px;
  text-align: center;
  color: var(--defaulttext2);
  font-style: italic;
}
#hfr td.table-status.error {
  color: var(--primary-color1);
  font-style: normal;
  font-weight: 600;
}

/* interactive cell */
#hfr td.interactive {
  width: 37%;
  min-width: 250px;
}
#hfr .slider-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
#hfr input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 100px;
  background: #dde0ec;
  outline: none;
  flex: 1;
  cursor: pointer;
}
#hfr input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--secondary-color1);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--secondary-color1);
  cursor: pointer;
}
#hfr input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--secondary-color1);
  border: 2px solid #fff;
  cursor: pointer;
}
#hfr .pct-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 5px 8px;
}
#hfr .pct-wrap:focus-within {
  border-color: var(--secondary-color1);
}
#hfr .pct-input {
  width: 56px;
  text-align: right;
  border: none;
  background: transparent;
  font-family: var(--font-2);
  font-size: 14px;
  color: var(--primary-color1);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  outline: none;
}
#hfr .pct-sign {
  font-size: 13px;
  color: var(--primary-color1);
  font-weight: 600;
}
#hfr .row-cash {
  flex: 0 0 auto;
  width: 104px;
  font-size: 13px;
  font-family: var(--font-2);
  font-weight: 600;
  color: var(--defaulttext);
  text-align: right;
  font-variant-numeric: tabular-nums;
  /* Editable: reads as text until hovered or focused. */
  border: none;
  border-bottom: 1px solid transparent;
  background: transparent;
  padding: 2px 0;
  outline: none;
  transition: border-color 0.2s;
}
#hfr .row-cash:hover,
#hfr .row-cash:focus {
  border-bottom-color: var(--secondary-color1);
}

#hfr .report-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-2);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--a);
}
#hfr .report-link.pending {
  color: var(--defaulttext2);
  font-style: italic;
  text-transform: none;
  font-weight: 400;
}
#hfr .report-link .arrow {
  transition: transform 0.2s;
}
#hfr .report-link:hover .arrow {
  transform: translateX(3px);
}

#hfr tfoot td {
  padding: 18px;
  background: var(--primary-color1);
  color: #fff;
  font-family: var(--font-1);
  font-weight: 700;
  font-size: 20px;
  text-transform: uppercase;
}
#hfr tfoot td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
#hfr .placeholder-note {
  margin-top: 14px;
  font-size: 14px;
  color: var(--defaulttext2);
  font-style: italic;
}

@media (max-width: 820px) {
  #hfr .hero h1 {
    font-size: 44px;
  }
  #hfr .section-title {
    font-size: 28px;
  }
  #hfr .alloc-status {
    margin-left: 0;
  }

  /* The toggle is an inline-flex pill, so an auto margin has no block box to act
     on. Switching to flex with fit-content keeps it hugging its three buttons
     while letting the margin centre it; justify-content centres the buttons too
     once they wrap onto a second line.

     The 100px pill radius reads as a lozenge once the box is two rows tall, so it
     drops to the 6px the alloc panel below it already uses. */
  #hfr .mode-toggle {
    display: flex;
    width: fit-content;
    justify-content: center;
    margin-inline: auto;
    border-radius: 6px;
  }

  /* Budget and allocation readout are pushed to opposite edges on desktop. Once
     they wrap onto separate lines there are no opposite edges to push to, so
     centre them instead -- .alloc-right has to drop its auto margin and its right
     alignment or it stays hard right, and .budget-edit is itself a flex row. */
  #hfr .alloc-top {
    justify-content: center;
    text-align: center;
  }
  #hfr .alloc-right {
    margin-left: 0;
    text-align: center;
  }
  #hfr .budget-edit {
    justify-content: center;
  }

  /* Panel is tall on narrow screens — pinning it would eat the viewport. */
  #hfr .alloc-panel {
    position: static;
  }
}
