.under { color: #21694e; font-weight: 700; }
.over { color: #9b3b28; font-weight: 700; }
tfoot th {
  background: #dbe7ef;
  color: #183b55;
  border-top: 2px solid #9eb4c4;
  font-size: 15px;
}
tfoot th:nth-child(2), tfoot th:nth-child(3) {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
[hidden] { display: none !important; }
.building-link {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: #1f5f8d;
  font: inherit;
  font-weight: 700;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.building-link:hover { color: #123f61; }
.building-link:focus-visible,
.sub-building-link:focus-visible,
.detail-heading button:focus-visible {
  outline: 3px solid #b35f00;
  outline-offset: 4px;
}
.sub-building-links {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 8px;
}
.sub-building-link {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: #48677e;
  font: inherit;
  font-size: 13px;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.sub-building-link:hover { color: #123f61; }
.building-table td:last-child {
  max-width: none;
  color: inherit;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.building-table tfoot th {
  padding: 14px 16px;
  vertical-align: middle;
}
.building-table tfoot th:nth-child(n+2) {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.history-panel {
  margin: 20px 0 22px;
  padding: 22px;
  background: white;
  border: 1px solid #d5e0e8;
  border-top: 4px solid #235780;
  border-radius: 6px;
}
.history-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}
.history-heading h3,
.trend-card h4 { margin: 0; }
.trend-card h4 { color: #254d6c; font-size: 17px; }
.trend-card > .muted { margin: 2px 0 10px; }
.trend-card {
  min-width: 0;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #d9e2e9;
  border-radius: 5px;
}
.combined-trend-card { padding: 18px 20px 12px; }
.trend-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  margin-bottom: 4px;
  color: #40596e;
  font-size: 14px;
  font-weight: 700;
}
.trend-legend span { display: inline-flex; align-items: center; gap: 8px; }
.trend-legend i { display: inline-block; width: 26px; height: 3px; background: #c87516; position: relative; }
.trend-legend .cost-key i::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 7px;
  left: 10px;
  top: -2px;
  border: 2px solid #c87516;
  border-radius: 50%;
  background: white;
}
.trend-legend .use-key i { background: #235780; }
.trend-legend .use-key i::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 7px;
  left: 10px;
  top: -2px;
  border: 2px solid #235780;
  background: white;
}
.trend-chart { min-height: 290px; }
.trend-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.trend-gridline { stroke: #d7e1e8; stroke-width: 1; }
.trend-axis { stroke: #8398a8; stroke-width: 1; }
.trend-line { fill: none; stroke: #235780; stroke-width: 3; }
.trend-line.cost { stroke: #c87516; }
.trend-line.ytd { stroke-dasharray: 6 5; }
.trend-point { fill: white; stroke: #235780; stroke-width: 2.5; }
.trend-point.cost { stroke: #c87516; }
.trend-point.ytd { stroke-width: 3; }
.trend-label { fill: #536b80; font: 13px Arial, Helvetica, sans-serif; }
.trend-value { fill: #314b5f; font: 12px Arial, Helvetica, sans-serif; }
.trend-axis-title { fill: #40596e; font: 700 13px Arial, Helvetica, sans-serif; }
.cost-axis { fill: #9a5912; }
.use-axis { fill: #235780; }
.history-note {
  margin: 14px 0 0;
  color: #536b80;
  font-size: 14px;
}
.history-values { margin-top: 14px; }
.history-values .table-wrap { margin-top: 12px; }
.history-table td:nth-child(2),
.history-table td:nth-child(3) {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.history-table td:last-child { max-width: none; }
.building-detail {
  margin-top: 20px;
  padding: 22px;
  background: #e7eef4;
  border: 1px solid #c6d5df;
  border-left: 4px solid #2d638c;
  border-radius: 6px;
  scroll-margin-top: 20px;
}
.detail-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}
.detail-heading h3 { margin-bottom: 2px; }
.detail-heading p { margin: 0; }
.detail-heading button {
  border: 1px solid #7892a5;
  border-radius: 5px;
  background: white;
  color: #183b55;
  padding: 8px 14px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.detail-table td:first-child { min-width: 100px; }
.detail-table td:nth-child(2) { min-width: 190px; }
.detail-table td:nth-child(3),
.detail-table td:nth-child(4) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.detail-table td:last-child { min-width: 210px; }
.detail-table tfoot th { vertical-align: top; }
.detail-table tfoot small { font-weight: 400; }
@media(max-width:760px){
  .building-detail { padding: 16px; }
  .detail-heading { gap: 12px; }
  .history-panel { padding: 16px; }
  .history-heading { flex-direction: column; gap: 10px; }
  .combined-trend-card { padding: 14px 10px 8px; }
  .trend-chart { min-height: 235px; }
}

.site-nav {
  flex-wrap: wrap;
  margin-top: 24px;
  gap: 8px;
  padding: 5px;
  width: fit-content;
  border: 1px solid #c9d5de;
  border-radius: 7px;
  background: #e5edf3;
}
.site-nav a {
  padding: 8px 16px;
  border-radius: 5px;
  text-decoration: none;
}
.site-nav a[aria-current="page"] {
  color: white;
  background: #235780;
}
.solar-hero h1 { max-width: 820px; }
.solar-summary .metric { border-top-color: #d58b25; }
.solar-period-note { max-width: 900px; }
.system-profile {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, .8fr);
  gap: 32px;
  padding: 24px 26px;
  border: 1px solid #d5e0e8;
  border-left: 5px solid #d58b25;
  border-radius: 7px;
  background: white;
}
.system-profile h3 { font-size: 24px; }
.system-profile p { margin-bottom: 0; }
.system-profile dl,
.recovery-panel dl,
.investment-card dl { margin: 0; }
.system-profile dd { color: #9a5912; font-weight: 700; }
.solar-chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  margin-top: 22px;
}
.solar-panel {
  min-width: 0;
  padding: 23px 24px;
  border: 1px solid #d5e0e8;
  border-radius: 7px;
  background: white;
}
.panel-heading { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.panel-heading h3 { margin: 0; }
.panel-heading > strong { color: #9a5912; font-size: 22px; white-space: nowrap; }
.bar-plot {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 195px;
  padding: 22px 4px 25px;
  margin-top: 10px;
  border-bottom: 1px solid #bfccd5;
}
.bar-slot { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 150px; position: relative; }
.bar-slot span { position: absolute; top: 157px; color: #536b80; font-size: 11px; }
.solar-bar { width: min(30px, 72%); min-height: 3px; border-radius: 3px 3px 0 0; background: #d58b25; }
.grid-bars .solar-bar { background: #235780; }
.solar-bar.negative { background: #21694e; }
.solar-values { margin-top: 16px; padding: 12px 14px; }
.solar-values .table-wrap { margin-top: 12px; }
.solar-values td:nth-child(2) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.solar-values td:nth-child(3) { color: #9a5912; font-weight: 700; }
.solar-values td:nth-child(3) small { display: block; color: #536b80; font-weight: 400; }
.solar-values tfoot th { border-top: 2px solid #9fb2c1; font-variant-numeric: tabular-nums; }
.solar-values tfoot th:nth-child(n+2) { color: #182c40; text-align: left; }
.value-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.value-grid article {
  position: relative;
  padding: 24px 24px 20px;
  border: 1px solid #d5e0e8;
  border-radius: 7px;
  background: white;
}
.value-number {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-bottom: 15px;
  border-radius: 50%;
  color: white;
  background: #235780;
  font-weight: 700;
}
.value-grid p { margin-bottom: 0; color: #536b80; font-size: 15px; }
.recovery-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: 20px;
  padding: 25px 27px;
  border-radius: 7px;
  color: white;
  background: #102e46;
}
.recovery-panel .muted, .recovery-panel dt { color: #c8d9e5; }
.recovery-panel dd { color: #ffcf83; }
.recovery-total { margin: 2px 0 7px; font-size: 28px; font-weight: 700; }
.investment-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 22px; }
.investment-grid.roof-only { grid-template-columns: 1fr; }
.investment-card, .roof-context { padding: 24px 26px; border: 1px solid #d5e0e8; border-radius: 7px; background: white; }
.investment-card { border-top: 4px solid #235780; }
.investment-status { color: #9a5912; font-size: 24px; font-weight: 700; }
.investment-card dd { color: #9a5912; font-weight: 700; }
.quality-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.quality-grid article { padding: 20px; border: 1px solid #d5e0e8; border-radius: 6px; background: white; }
.quality-grid h3 { margin: 10px 0 7px; }
.quality-grid p { margin: 0; color: #536b80; font-size: 14px; }
.quality-dot { display: block; width: 11px; height: 11px; border-radius: 50%; }
.quality-dot.good { background: #25805c; }
.quality-dot.pending { background: #d58b25; }

@media(max-width:900px){
  .solar-chart-grid, .system-profile, .investment-grid { grid-template-columns: 1fr; }
  .quality-grid { grid-template-columns: 1fr 1fr; }
}
@media(max-width:760px){
  .site-nav { width: 100%; }
  .site-nav a { flex: 1 1 calc(50% - 8px); box-sizing: border-box; text-align: center; }
  .solar-chart-grid, .value-grid, .recovery-panel, .quality-grid { grid-template-columns: 1fr; }
  .solar-panel, .system-profile, .investment-card, .roof-context { padding: 18px; }
  .panel-heading { display: block; }
  .panel-heading > strong { display: block; margin-top: 8px; }
  .bar-plot { gap: 4px; }
  .bar-slot span { font-size: 10px; }
}
/* PSB historical demand view shares the established chart scales and colors. */
#psb-history-view-label:not([hidden]) { display: flex; align-items: center; gap: 12px; margin: 12px 0; font-size: 16px; }
#psb-history-view { font: inherit; padding: 8px 12px; border: 1px solid #b7c6c8; border-radius: 6px; background: white; color: #173f47; }
.history-table th, .history-table td { min-width: 110px; }
.usage-section { padding: 20px 0 4px; }
.usage-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.usage-card { background: white; border: 1px solid #d5e0e8; border-top: 4px solid #235780; border-radius: 6px; padding: 21px; min-width: 0; }
.usage-card h3 { margin: 0; font-size: 20px; }
.usage-change { font-size: 17px; font-weight: 700; color: #173f5e; margin: 8px 0 18px; }
.usage-bar-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 115px; gap: 9px; align-items: center; margin: 11px 0; font-size: 14px; }
.usage-bar-row strong { text-align: right; font-variant-numeric: tabular-nums; }
.usage-track { display: flex; height: 23px; background: #e9eef2; border-radius: 3px; overflow: hidden; }
.usage-track i { display: block; height: 100%; }
.grid-part,.grid-swatch { background: #235780; }
.solar-part,.solar-swatch { background: #d58b25; }
.usage-legend { display: flex; flex-wrap: wrap; gap: 6px 15px; margin: 14px 0 18px; color: #40596e; font-size: 14px; }
.usage-legend span { display: inline-flex; align-items: center; gap: 6px; }
.usage-legend i { display: inline-block; width: 13px; height: 13px; }
.usage-numbers { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; font-size: 14px; border-top: 1px solid #e2e9ee; padding-top: 13px; }
.usage-numbers strong { font-variant-numeric: tabular-nums; text-align: right; }
.usage-cost { font-size: 15px; margin: 17px 0 4px; }
.usage-caveat,.usage-method { color: #536b80; font-size: 14px; line-height: 1.5; }
.usage-caveat { margin: 0; }
.usage-method { margin: 13px 0 0; max-width: 950px; }
@media(max-width:850px){.usage-grid { grid-template-columns: 1fr; }}
@media(max-width:420px){.usage-bar-row { grid-template-columns: 38px minmax(0,1fr) 95px; font-size: 13px; gap: 5px; }.usage-card { padding: 16px; }}
