.hist-wrap {
  display: grid;
  gap: 20px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.hist-wrap h2, .hist-wrap h3, .hist-wrap dl, .hist-wrap dd, .hist-wrap p {
  margin: 0;
}
.hist-wrap h2 {
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -.042em;
}
.hist-wrap h3 {
  font-weight: 580;
  font-size: .99rem;
  letter-spacing: -.018em;
}
.hist-sr, .hist-case input, .hist-budget input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hist-cases {
  border: 0;
  margin: 0;
  min-width: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.hist-case { display: flex; min-width: 0; cursor: pointer; }
.hist-case-body {
  width: 100%;
  display: grid;
  align-content: start;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 19px;
}
.hist-case:hover .hist-case-body { border-color: #9eb4a3; }
.hist-case input:checked + .hist-case-body {
  border-color: #438061;
  background: #e7f0e5;
  box-shadow: inset 0 0 0 1px #438061;
}
.hist-case input:focus-visible + .hist-case-body, .hist-budget input:focus-visible + span {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}
.hist-case-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
  font-size: .8rem;
  font-weight: 550;
  color: #46664f;
}
.hist-case-meta i {
  width: 16px;
  height: 16px;
  border: 1px solid #aebbb0;
  border-radius: 50%;
}
.hist-case input:checked + .hist-case-body i {
  border: 4px solid var(--green);
  background: white;
}
.hist-case-body strong { font-size: clamp(1.02rem, 1.5vw, 1.38rem); line-height: 1.2; letter-spacing: -.04em; font-weight: 600; }
.hist-case-caption { font-size: .86rem; line-height: 1.45; color: var(--muted); }
.hist-facts-grid { display: grid; grid-template-columns: minmax(0, .87fr) minmax(0, 1.13fr); gap: 18px; align-items: stretch; }
.hist-contract, .hist-prices, .hist-comparison, .hist-provenance {
  min-width: 0;
  padding: clamp(19px, 2.45vw, 34px);
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
}
.hist-contract { color: #f0f7ef; background: var(--forest); border-color: var(--forest); }
.hist-contract h2 { font-size: clamp(1.1rem, 1.5vw, 1.35rem); }
.hist-contract-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; padding: 24px 0 20px; }
.hist-contract-stats dt, .hist-extra > span, .hist-extra small { font-size: .86rem; color: #c4dece; }
.hist-contract-stats dd { font-size: clamp(1.18rem, 1.85vw, 1.7rem); font-weight: 560; line-height: 1.25; letter-spacing: -.05em; margin-top: 5px; }
.hist-extra { display: grid; gap: 5px; border-top: 1px solid #48705c; padding-top: 17px; }
.hist-extra strong { font-size: 1.27rem; font-weight: 570; line-height: 1.2; letter-spacing: -.03em; }
.hist-edit { margin-top: 14px; }
.hist-edit summary { width: fit-content; color: #ecf8e6; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: .89rem; }
.hist-edit summary:focus-visible { outline-color: #b6d5bd; }
.hist-edit form { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px 12px; margin-top: 14px; }
.hist-edit label { display: grid; gap: 5px; color: #e6f4e5; font-size: .84rem; }
.hist-edit input { padding: 8px; min-width: 0; width: 100%; background: #fff; color: var(--ink); border: 1px solid #93b2a1; border-radius: 6px; font-size: 1rem; }
.hist-edit .hist-all-cases { display: flex; align-items: center; grid-column: 1/-1; gap: 8px; }
.hist-all-cases input { width: 1rem; height: 1rem; accent-color: var(--green); }
.hist-edit small { color: #c4dece; grid-column: 1/-1; font-size: .8rem; line-height: 1.45; }
.hist-edit button { grid-column: 1/-1; justify-self: start; color: var(--forest); background: #e2efde; border-radius: 6px; padding: 9px 14px; font-size: .89rem; font-weight: 550; }
.hist-edit button:hover { background: white; }
.hist-prices h2 { font-size: clamp(1.15rem, 1.8vw, 1.55rem); }
.hist-growth { font-size: clamp(2.3rem, 3.2vw, 3.2rem); font-weight: 560; color: var(--green); line-height: 1.04; letter-spacing: -.06em; margin: 10px 0 6px; }
.hist-prices p, .hist-comparison-head p, .hist-provenance p, .hist-conclusion p { color: var(--muted); font-size: .92rem; line-height: 1.5; }
.hist-annual { margin-top: 17px; }
.hist-annual summary { color: var(--green); font-size: .92rem; font-weight: 550; cursor: pointer; }
.hist-growth-bars { list-style: none; margin: 9px 0 0; padding: 0; display: grid; gap: 7px; }
.hist-growth-bars li {
  display: grid; grid-template-columns: minmax(135px, auto) minmax(30px, 1fr) 64px;
  align-items: center; gap: 14px; font-size: .81rem; color: var(--muted);
}
.hist-track { display: block; height: 7px; border-radius: 2px; overflow: hidden; background: #eff2ea; }
.hist-track i { display: block; height: 100%; background: #b87d49; }
.hist-growth-bars b { text-align: right; color: var(--ink); font-size: .86rem; font-weight: 560; }
.hist-comparison-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.hist-comparison-head p { margin-top: 6px; max-width: 69ch; }
.hist-budget { display: inline-flex; border: 1px solid var(--line); background: var(--paper); border-radius: 9px; padding: 3px; margin: 0; min-width: max-content; }
.hist-budget label { display: flex; cursor: pointer; }
.hist-budget span { display: grid; place-items: center; padding: 8px 12px; border-radius: 6px; color: var(--muted); font-size: .87rem; font-weight: 500; text-align: center; }
.hist-budget label:hover span { color: var(--ink); }
.hist-budget input:checked + span { background: var(--green); color: white; }
.hist-frequency {justify-self:start;margin:1px 0 6px;border-color:#587d69;background:#214c3c}
.hist-frequency span {color:#dae9dd;padding:7px 13px}
.hist-frequency label:hover span {color:white}
.hist-frequency input:checked + span {background:#e2efde;color:var(--forest)}
.hist-frequency input:focus-visible + span {outline-color:#b6d5bd}
.hist-results { border-collapse: collapse; table-layout: fixed; width: 100%; margin-top: 21px; }
.hist-results th, .hist-results td { padding: 11px 9px; text-align: right; border-bottom: 1px solid var(--line); font-size: .93rem; }
.hist-results thead th { color: var(--green); font-weight: 580; }
.hist-results tr > th:first-child { width: 36%; text-align: left; color: var(--muted); font-weight: 500; }
.hist-results td { font-weight: 550; letter-spacing: -.025em; }
.hist-results tbody tr:last-child > * { background: #edf4e9; color: #23573d; font-weight: 600; }
.hist-results .hist-table-section th:first-child { width: auto; padding-block: 12px 8px; font-weight: 600; color: var(--green); background: var(--paper); }
.hist-conclusion { margin-top: 16px; padding-left: 12px; border-left: 3px solid #7b9f82; }
.hist-conclusion strong { font-size: 1rem; font-weight: 580; }
.hist-conclusion p { margin-top: 4px; max-width: 88ch; }
.hist-provenance h2 { font-size: 1.28rem; }
.hist-sources { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 34px; margin-top: 17px; }
.hist-sources p { margin: 5px 0; }
.hist-sources a { color: var(--green); text-decoration: underline; text-underline-offset: 3px; font-size: .9rem; }
.hist-provenance .hist-assumption { padding-top: 13px; margin-top: 16px; border-top: 1px solid var(--line); font-size: .85rem; }
@media (max-width: 900px) {
  .hist-contract-stats { gap: 12px 17px; }
  .hist-growth-bars li { grid-template-columns: auto minmax(16px,1fr) 54px; gap: 8px; }
  .hist-results tr > th:first-child { width: 32%; }
  .hist-comparison-head { flex-wrap: wrap; }
}
@media (max-width: 690px) {
  .hist-wrap { gap: 14px; }
  .hist-facts-grid, .hist-sources { grid-template-columns: 1fr; gap: 14px; }
  .hist-cases { grid-template-columns: 1fr; gap: 6px; }
  .hist-case-body { grid-template-columns: 1fr auto; gap: 3px 8px; padding: 10px 12px; }
  .hist-case-meta { grid-column: 2; grid-row: 1/3; justify-content: end; gap: 8px; margin: 0; align-self: center; }
  .hist-case-caption { font-size: .8rem; }
  .hist-contract-stats { padding: 17px 0; gap: 12px 25px; }
  .hist-contract, .hist-prices, .hist-comparison, .hist-provenance { padding: 18px; border-radius: 13px; }
  .hist-comparison-head { gap: 11px; }
  .hist-results thead th, .hist-results td, .hist-results th { padding: 8px 5px; font-size: .84rem; }
}
@media (max-width: 550px) {
  .hist-results, .hist-results thead, .hist-results tbody { display: block; }
  .hist-results tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; border-bottom: 1px solid var(--line); padding: 8px 2px; }
  .hist-results thead th, .hist-results th, .hist-results td { border: 0; text-align: left; padding: 0; align-self: end; }
  .hist-results thead tr > .hist-metric-heading { display: none; }
  .hist-results tbody tr > th:first-child { width: auto; grid-column: 1/-1; font-size: .79rem; }
  .hist-results td { font-size: clamp(.74rem,3.35vw,.96rem); }
  .hist-results tbody tr:last-child { background: #edf4e9; }
  .hist-conclusion { margin-top: 13px; }
}
@media (max-width: 370px) {
  .hist-case-body { padding: 9px; }
  .hist-case-meta { font-size: .72rem; gap: 4px; }
  .hist-contract, .hist-prices, .hist-comparison, .hist-provenance { padding: 14px; }
  .hist-budget span { padding-inline: 8px; }
}
.hist-pattern-compare { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.hist-pattern-compare summary { width: fit-content; color: var(--green); font-size: .93rem; font-weight: 550; cursor: pointer; }
.hist-pattern-strategy { display:flex; flex-wrap:wrap; align-items:center; gap:5px 10px; margin-top:14px; color:var(--muted); font-size:.84rem; }
.hist-pattern-strategy select { padding:5px 8px; border:1px solid var(--line); border-radius:6px; background:white; color:var(--ink); }
.hist-pattern-table { width: 100%; max-width: 48rem; table-layout: fixed; border-collapse: collapse; margin-top: 11px; }
.hist-pattern-table caption { color: var(--muted); font-size: .84rem; text-align: left; padding-bottom: 5px; }
.hist-pattern-table th, .hist-pattern-table td { padding: 8px 7px; text-align: right; vertical-align: top; font-size: .9rem; }
.hist-pattern-table tr > th:first-child { width: 40%; padding-left: 0; color: var(--muted); font-weight: 450; text-align: left; }
.hist-pattern-table thead th { color: var(--green); font-weight: 600; }
.hist-pattern-table tbody tr { border-top: 1px solid var(--line); }
.hist-pattern-table td { font-weight: 550; }
.hist-pattern-table small { display: block; margin-top: 3px; color: var(--muted); font-size: .8rem; font-weight: 450; }
@media (max-width: 550px) {
  .hist-pattern-table, .hist-pattern-table caption, .hist-pattern-table thead, .hist-pattern-table tbody { display: block; }
  .hist-pattern-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 8px; padding: 7px 0; }
  .hist-pattern-table th, .hist-pattern-table td { padding: 0; text-align: left; }
  .hist-pattern-table thead tr > th:first-child { display: none; }
  .hist-pattern-table tbody tr > th:first-child { grid-column: 1 / -1; width: auto; font-size: .79rem; }
}
