:root {
  /* Rochester Area Community Foundation blues. Swap in exact brand hex codes here. */
  --paper: #F2F5F8;
  --panel: #F8FAFC;
  --card: #FFFFFF;
  --ink: #13293F;
  --muted: #51677C;
  --faint: #8598AB;
  --line: #D5DEE7;
  --line-strong: #ACBECF;
  --green: #14568C;        /* primary blue (grants) */
  --green-mid: #2B7BB9;
  --green-soft: #E3EEF7;
  --gold: #2E86A6;         /* secondary blue (subgrants) */
  --gold-soft: #E0F1F7;
  --red: #9C392B;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --sans: "Archivo", -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

/* Header */
header.site {
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
  position: sticky; top: 0; z-index: 20;
}
header.site .wrap {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; padding-top: 14px; padding-bottom: 12px; flex-wrap: wrap;
}
.brand { cursor: pointer; }
.brand .eyebrow {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.brand h1 { font-size: 22px; font-weight: 800; margin: 0; letter-spacing: -0.01em; }
.asof { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }
.asof .src { color: var(--faint); }

main { padding: 26px 0 60px; }
.crumb {
  font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-bottom: 6px;
}
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--green); }
h2.page { font-size: 30px; font-weight: 800; margin: 0 0 4px; letter-spacing: -0.015em; }
.pagesub { color: var(--muted); margin: 0 0 22px; max-width: 70ch; }

/* Sections */
section.block { margin-bottom: 30px; }
.blockhead {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin-bottom: 14px; gap: 12px; flex-wrap: wrap;
}
.blockhead h3 {
  margin: 0; font-size: 13px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.blockhead .note { font-size: 12px; color: var(--muted); }

/* KPI strip */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .value { font-family: var(--mono); font-size: 24px; font-weight: 600; margin-top: 4px; }
.kpi .sub { font-size: 11.5px; color: var(--faint); margin-top: 2px; font-family: var(--mono); }

/* County ledger (home) */
.ledger { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--card); }
.ledger .lrow {
  display: grid;
  grid-template-columns: minmax(140px, 1.4fr) repeat(4, minmax(105px, 1fr)) 34px;
  gap: 10px; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  cursor: pointer; text-decoration: none; color: inherit;
}
.ledger .lrow:last-child { border-bottom: none; }
.ledger .lrow:hover { background: var(--green-soft); box-shadow: inset 3px 0 0 var(--gold); }
.ledger .lhead {
  cursor: default; background: var(--panel);
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 8px 16px;
}
.ledger .lhead:hover { background: var(--panel); box-shadow: none; }
.lrow .cname { font-weight: 700; font-size: 16px; }
.lrow .fig { font-family: var(--mono); font-size: 13.5px; text-align: right; }
.lrow .fig small { display: block; font-size: 10.5px; color: var(--faint); }
.lrow .go { color: var(--faint); text-align: right; font-size: 16px; }
.sharebar { grid-column: 1 / -1; height: 4px; background: var(--paper); border-radius: 2px; margin-top: 2px; }
.sharebar > div { height: 4px; background: var(--green-mid); border-radius: 2px; }

/* Filter bar */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 12px; margin-bottom: 18px;
}
.filters label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 3px; }
.filters .f { min-width: 150px; flex: 1; }
select, input[type="search"], input[type="text"] {
  width: 100%; font-family: var(--sans); font-size: 13.5px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 4px;
  padding: 7px 9px; outline: none;
}
select:focus, input:focus { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-soft); }
.filters .clear {
  background: none; border: none; color: var(--green); font-size: 12.5px;
  font-weight: 600; cursor: pointer; padding: 6px 4px; white-space: nowrap; align-self: flex-end;
}
.filters .clear:hover { text-decoration: underline; }

/* Tabs */
.tabs { display: flex; gap: 22px; border-bottom: 2px solid var(--ink); margin-bottom: 18px; }
.tabs button {
  background: none; border: none; font-family: var(--sans); font-size: 14px; font-weight: 700;
  color: var(--muted); padding: 8px 2px 10px; cursor: pointer;
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tabs button.on { color: var(--ink); border-bottom-color: var(--green); }
.tabs .count { font-family: var(--mono); font-weight: 400; font-size: 12px; color: var(--faint); }

/* Rank panels */
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }
.rank .rrow { margin-bottom: 10px; font-size: 13px; }
.rank .rtop { display: flex; justify-content: space-between; gap: 10px; }
.rank .rname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank .rval { font-family: var(--mono); white-space: nowrap; }
.rank .rbar { height: 6px; background: var(--paper); border: 1px solid var(--line); border-radius: 3px; margin-top: 3px; }
.rank .rbar > div { height: 100%; background: var(--green-mid); border-radius: 3px; }
.rank.alt .rbar > div { background: var(--gold); }
.ranktoggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden; }
.ranktoggle button {
  background: var(--card); border: none; font-size: 11.5px; font-weight: 600;
  padding: 5px 10px; cursor: pointer; color: var(--muted); font-family: var(--sans);
}
.ranktoggle button.on { background: var(--green); color: #fff; }

/* Data table */
.tablewrap { border: 1px solid var(--line); border-radius: 6px; background: var(--card); overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 900px; }
table.data th {
  text-align: left; font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 9px 10px;
  border-bottom: 2px solid var(--line-strong); background: var(--panel);
  cursor: pointer; user-select: none; white-space: nowrap; position: sticky; top: 0;
}
table.data th.num, table.data td.num { text-align: right; }
table.data th .dir { color: var(--green); }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:hover td { background: var(--green-soft); }
td.num, td.mono { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
td .org { font-weight: 600; }
td .meta { font-size: 11.5px; color: var(--muted); }
td .desc { font-size: 11.5px; color: var(--muted); max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.neg { color: var(--red); }
.pill {
  display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em;
  padding: 1px 7px; border-radius: 9px; background: var(--paper); border: 1px solid var(--line-strong);
  color: var(--muted); white-space: nowrap;
}
.pill.fy { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }
a.plink { color: var(--green); font-size: 12px; white-space: nowrap; }
.tablefoot { font-size: 12px; color: var(--muted); padding: 10px 4px; }
.showmore {
  display: block; width: 100%; background: var(--panel); border: none; border-top: 1px solid var(--line);
  font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--green);
  padding: 10px; cursor: pointer;
}
.showmore:hover { background: var(--green-soft); }

/* Aggregate panel */
.aggr { background: var(--panel); border: 1px dashed var(--line-strong); border-radius: 6px; padding: 14px 16px; }
.aggr h4 { margin: 0 0 2px; font-size: 13.5px; }
.aggr .expl { font-size: 12px; color: var(--muted); margin: 0 0 10px; }
.aggr table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.aggr td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.aggr td.num { font-family: var(--mono); text-align: right; white-space: nowrap; }
.aggr tr:last-child td { border-bottom: none; }

/* States */
.loading, .empty { text-align: center; color: var(--muted); padding: 70px 20px; }
.loading .spin {
  width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--green);
  border-radius: 50%; margin: 0 auto 14px; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loading .spin { animation: none; } }

footer.site { border-top: 1px solid var(--line-strong); padding: 18px 0 40px; }
footer.site .wrap { font-size: 12px; color: var(--muted); line-height: 1.7; }

@media (max-width: 760px) {
  .ledger .lrow { grid-template-columns: 1fr 1fr 1fr; }
  .ledger .lrow .fig:nth-child(4), .ledger .lrow .fig:nth-child(5), .ledger .lrow .go { display: none; }
  .ledger .lhead span:nth-child(4), .ledger .lhead span:nth-child(5), .ledger .lhead .go { display: none; }
  h2.page { font-size: 24px; }
}

/* Monthly obligation chart */
.mchart { display: flex; gap: 8px; align-items: stretch; border: 1px solid var(--line); border-radius: 6px; background: var(--card); padding: 16px 14px 10px; }
.mcol { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mval { font-family: var(--mono); font-size: 10px; color: var(--muted); text-align: center; height: 15px; white-space: nowrap; overflow: visible; }
.mbarwrap { height: 110px; display: flex; align-items: flex-end; justify-content: center; border-bottom: 2px solid var(--line-strong); }
.mbar { width: 70%; max-width: 34px; background: var(--gold); border-radius: 2px 2px 0 0; }
.mbar.negbar { background: var(--red); }
.mlabel { font-family: var(--mono); font-size: 10.5px; color: var(--muted); text-align: center; margin-top: 4px; }
@media (max-width: 620px) { .mval { display: none; } }

/* Treemap */
.treemap { position: relative; height: 320px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--card); }
.tmcell { position: absolute; overflow: hidden; padding: 5px 7px; box-sizing: border-box; border: 1px solid var(--paper); color: #fff; display: flex; flex-direction: column; }
.tmcell.light { color: var(--ink); }
.tmcell .tn { font-size: 11px; font-weight: 700; line-height: 1.25; overflow: hidden; }
.tmcell .tv { font-family: var(--mono); font-size: 10px; opacity: 0.9; }
@media (max-width: 620px) { .treemap { height: 240px; } }

/* Dual bars (obligated vs outlayed) */
.rank .rbar.out { margin-top: 2px; }
.rank .rbar.out > div { background: #9CC7E4; }
.rank.alt .rbar.out > div { background: #B4DBEA; }
.rank .rval .out { color: var(--faint); font-size: 11px; }


/* Page-level update stamp */
.stamp { font-family: var(--mono); font-size: 12px; color: var(--muted); margin: 0 0 16px; }
.stamp .dot { color: var(--faint); }

/* Full-wrap description cell (subgrants) */
td.descfull { font-size: 12px; color: var(--ink); max-width: 300px; white-space: normal; line-height: 1.45; }

/* Per-type FY2026 action lines in the grants table */
.fyline { font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.fyline.total { color: var(--muted); border-top: 1px solid var(--line); margin-top: 2px; padding-top: 2px; }

/* Treemap index chips and legend */
.tmnum { font-family: var(--mono); font-size: 10px; font-weight: 600; opacity: 0.95; }
.tmnum.inl { position: absolute; top: 4px; right: 6px; opacity: 0.65; }
.tmcell { position: absolute; }
.tmlegend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12px; }
.tml { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.tmk { display: inline-flex; align-items: center; justify-content: center; width: 17px; height: 17px; border-radius: 3px; color: #fff; font-family: var(--mono); font-size: 10px; font-weight: 600; }
.tml .tmv { font-family: var(--mono); color: var(--muted); }
.tmk[style*="#C9CFC4"], .tmk[style*="#B4DBEA"], .tmk[style*="#D3EAF3"], .tmk[style*="#E5F3F8"], .tmk[style*="#9CC7E4"], .tmk[style*="#C3DDEF"], .tmk[style*="#DCEBF6"], .tmk[style*="#EAF3FA"], .tmk[style*="#8FC8DE"] { color: var(--ink); }

/* Primary-blue month chart (grants) */
.mchart.primary .mbar { background: var(--green-mid); }
.mchart.primary .mbar.negbar { background: var(--red); }
