* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f8;
  color: #1f2937;
}

section.story-section {margin:2em 0;}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: white;
  border-bottom: 1px solid #e5e7eb;
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  gap: 12px;
  align-items: end;
}

.picker-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
}

.picker-group-wide {
  min-width: 320px;
  flex: 1;
}

label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}

select {
  height: 38px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: white;
  padding: 0 10px;
  font-size: 14px;
}

.btn-export {
  height: 38px;
  padding: 0 14px;
  border: 1px solid #00737e;
  border-radius: 5px;
  background: white;
  color: #00737e;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  align-self: flex-end;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.page-header {
  margin-bottom: 18px;
}

.page-header h1 {
  margin: 0 0 4px;
  font-size: 28px;
}

.page-header p {
  margin: 0;
  color: #6b7280;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px;
}

.summary-bullets {
  padding-left:.6em;
}

.summary-bullets li {
  margin-bottom: 6px;
  font-size: 14px;
}
.chart-grid .card~.card, .card-grid .card~.card {
  margin-top: 0px;
}

.card h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.metric-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: .5em;
  margin-top: .5em;
}

.metric-sub {
  margin-top: 6px;
  font-size: 13px;
  color: #6b7280;
}

#permitsChart {
  display: block;
  width: 100%;
  height: 320px !important;
  max-height: 320px;
}

.component-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.component-row,
.component-result-row {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 72px;
  gap: 12px;
  align-items: center;
}

.component-label {
  font-size: 13px;
  color: #6b7280;
}

.component-sublabel {
  font-size: 11px;
  color: #a8abb1;
}

.component-bar-wrap {
  position: relative;
  height: 20px;
  background: #f3f4f6;
  border-radius: 999px;
  overflow: hidden;
}

.component-bar {
  height: 100%;
  border-radius: 999px;
}

.component-bar.positive {
  background: #00737e;
}

.component-bar.negative {
  background: #c08457;
}

.component-value {
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}

.component-result-row {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.component-result-label {
  font-weight: 600;
  color: #1f2937;
}

.component-result-wrap {
  height: 24px;
}

.component-result-bar {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
}

.component-result-value {
  font-size: 15px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 14px;
}

th {
  color: #6b7280;
  font-weight: 600;
}

.trend-card {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.trend-title {
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.trend-row {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(90px, auto) minmax(80px, auto);
  gap: 10px;
  align-items: baseline;
  margin-bottom: 4px;
}

.metric-label~.trend-note {margin-bottom:1em;}
.trend-row.two-col {
  grid-template-columns: minmax(120px, 160px) minmax(90px, auto);
}

.trend-period {
  font-size: 0.95rem;
  color: #6b7280;
}

.detail-card .trend-note {
margin-top: 2em;
padding-top: 1em;
border-top: 1px solid #00000010;}

.trend-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
  text-align: right;
}

.trend-step {
  font-size: 0.85rem;
  color: #6b7280;
  text-align: right;
  white-space: nowrap;
}

.trend-period.small, .trend-step.small, .trend-value.small {
  font-size:.75em;
}

.trend-note {
  margin-top: 10px;
  font-size: 0.85rem;
  color: #6b7280;
  line-height: 1.35;
}



    .vacancy-mix-head {
      margin-bottom: 8px;
    }

    .vacancy-mix-head .trend-value,
    .vacancy-mix-head .trend-step {
      font-size: 0.78rem;
      font-weight: 600;
      color: #6b7280;
      text-transform: uppercase;
      letter-spacing: 0.03em;
    }

    .vacancy-mix-secondary .trend-period,
    .vacancy-mix-secondary .trend-value,
    .vacancy-mix-secondary .trend-step {
      color: #6b7280;
    }

    .county-table-scroll {
      overflow-x: auto;
      margin-top: 12px;
    }

    .county-table {
      width: 100%;
      border-collapse: collapse;
      min-width: 640px;
    }

    .county-table th,
    .county-table td {
      padding: 10px 0;
      border-bottom: 1px solid #e5e7eb;
      text-align: left;
      vertical-align: top;
      font-size: 0.95rem;
    }

    .county-table th {
      font-size: 0.78rem;
      font-weight: 600;
      color: #6b7280;
      text-transform: uppercase;
      letter-spacing: 0.03em;
      padding-top: 0;
    }

    .county-driver-chip-wrap {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
    }

    .county-driver-chip {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 4px 8px;
      border-radius: 999px;
      font-size: 0.78rem;
      font-weight: 600;
      background: #f3f4f6;
      color: #374151;
      line-height: 1;
    }

    .county-driver-arrow {
      font-size: 0.72rem;
      line-height: 1;
    }

    .county-driver-text {
      line-height: 1;
    }

    .county-driver-chip.positive {
      background: rgba(0, 115, 126, 0.14);
      color: #00737e;
    }

    .county-driver-chip.negative {
      background: rgba(107, 114, 128, 0.12);
      color: #6b7280;
    }

    .county-driver-empty {
      color: #9ca3af;
      font-size: 0.9rem;
    }
    .component-formula {
      margin-top: 14px;
      padding-top: 12px;
      border-top: 1px solid #e5e7eb;
      font-size: 0.95rem;
      line-height: 1.5;
      color: #374151;
    }

    .formula-label {
      font-weight: 600;
      color: #111827;
      margin-right: 6px;
    }

    .formula-plus {
      color: #00737e;
    }

    .formula-minus {
      color: #c08457;
    }

    .formula-operator {
      color: #6b7280;
      margin: 0 4px;
    }

    .formula-total {
      color: #111827;
    }

@media (max-width: 640px) {
  .trend-row {
    grid-template-columns: 1fr auto;
  }

  .trend-step {
    grid-column: 2;
  }
}

@media (max-width: 900px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .component-row,
  .component-result-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .component-value {
    text-align: left;
  }
}

.story-grid-three {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
}

.story-grid-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: stretch;
}

.story-grid-three .story-card, .story-grid-two .story-card {
  height: 100%;
}

#growthHeadlineCard,
#growthTrendSection,
#driversCard {
  display: flex;
  flex-direction: column;
}

.story-card {
  position: relative;
}

.story-card .metric-label {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
}

.driver-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.driver-list-item {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: baseline;
  margin-bottom: 4px;
  padding-bottom: 0;
  border-bottom: 0;
}

.driver-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
}

.driver-direction {
  grid-column: 2 / span 2;
  font-size: 0.85rem;
  color: #6b7280;
  text-align: right;
  white-space: nowrap;
}

.driver-list-empty {
  font-size: 0.95rem;
  color: #6b7280;
}

@media (max-width: 1100px) {
  .story-grid-three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .driver-list-item {
    grid-template-columns: 1fr auto;
    gap: 6px;
  }

  .driver-direction {
    grid-column: 2;
    text-align: right;
    white-space: normal;
  }
}

hr {
  border: none;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    #e5e7eb 20%,
    #e5e7eb 80%,
    transparent
  );
  margin: 3em 0;
}

@media print {
  .card {
    page-break-inside: avoid;
    border: 1px solid #dddddd;
  }
  .hide-print {display:none;}
  body {background: transparent;margin: .75 in}
  .page-break {break-before: page!important;}
  .page-header {margin:.25in 0;}
  .method {color: #333333;}
  .trend-row {
      grid-template-columns: repeat(3, min(.85in));
  }
  .extra-margin {padding-top:.25in;}
}

/* ── Print styles for housing dashboard ─────────────────────────── */




@media print {

  /* ── Global resets ─────────────────────────────────────────────── */

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body {
    margin: 0;
    padding: 0;
    font-size: 10pt;
    color: #111827;
    background: white;
  }

  /* ── Hide interactive / screen-only elements ───────────────────── */

  .hide-print,
  .topbar,
  #geoType,
  #geoPicker,
  hr {
    display: none !important;
  }

  canvas#permitsChart {
    display: block !important;
    width: 100% !important;
    height: 220px !important;
    max-height: 220px;
  }

  /* ── Page structure ────────────────────────────────────────────── */

  .page {
    width: 100%;
    max-width: none;
    padding: 0;
    margin: 0;
  }

  .page-header {
    margin-bottom: 1.5em;
    padding-bottom: 0.5em;
    border-bottom: 2px solid #00737e;
  }

  .page-header h1 {
    font-size: 18pt;
    margin: 0 0 0.15em;
  }

  .page-header p {
    font-size: 9pt;
    color: #6b7280;
    margin: 0;
  }

  /* ── Cards ─────────────────────────────────────────────────────── */

  .card,
  .story-card {
    box-shadow: none;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 12pt;
    background: white;
    break-inside: avoid;
  }

  /* ── Sections and grids ────────────────────────────────────────── */

  .story-section {
    margin-bottom: 12pt;
  }

  /* Two-column grids: keep side by side if they fit, else stack */
  .story-grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10pt;
  }

  /* Three-column detail section: stack to two on print */
  .story-grid-three {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8pt;
  }

  /* Force section breaks where it makes sense */
  #growthSection,
  #vacancySection,
  #lossSection,
  #countyBreakdownSection {
    break-before: auto;
  }

  /* Keep the hero total-need card from orphaning */
  #totalNeedSection {
    break-after: avoid;
  }

  /* The detailed breakdown three-up can break before if needed */
  #detailedBreakdownSection {
    break-before: auto;
    break-inside: avoid;
  }

  /* County table: allow it to break across pages normally */
  #countyBreakdownSection {
    break-before: page;
  }

  /* ── Typography ────────────────────────────────────────────────── */

  .metric-label {
    font-size: 7.5pt;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4pt;
  }

  .metric-value {
    font-size: 22pt;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 4pt;
  }

  .trend-note {
    font-size: 9pt;
    color: #374151;
    line-height: 1.4;
  }

  .component-sublabel {
    font-size: 8pt;
    color: #6b7280;
  }

  .driver-name, .driver-direction, .trend-value, .trend-period, .component-formula, .component-row-copy, .component-result-value, .component-value {
    font-size: 9pt;
  }
  /* ── Trend rows (five-year growth, vacancy mix, etc.) ──────────── */

  .trend-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 1pt 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 9.5pt;
    gap: 1pt;
  }

  .trend-row:last-of-type {
    border-bottom: none;
  }

  .trend-period {
    color: #374151;
    flex: 1 0 30%;
  }

  .trend-value {
    font-weight: 600;
    text-align: right;
    min-width: 60pt;
  }

  .trend-step {
    color: #6b7280;
    font-size: 8.5pt;
    text-align: right;
    min-width: 48pt;
  }

  .small {
    font-size: 7pt !important;
  }

  /* ── Owner supply bar chart (SVG-based) ────────────────────────── */

  #ownerComponentsChart svg {
    max-width: 100%;
    height: auto;
  }

  .component-formula {
    font-size: 9pt;
    margin-top: 8pt;
    padding-top: 8pt;
    border-top: 1px solid #e5e7eb;
    color: #374151;
    line-height: 1.5;
  }

  /* ── Construction summary ──────────────────────────────────────── */

  #constructionSummary {
    font-size: 10pt;
  }

  /* ── Driver list ────────────────────────────────────────────────── */

  .driver-list {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .driver-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4pt 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 9.5pt;
  }

  .driver-list li:last-child {
    border-bottom: none;
  }

  /* ── County breakdown table ─────────────────────────────────────── */

  .county-table-scroll {
    overflow: visible;
  }

  .county-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 8pt;
  }

  .county-table th {
    font-size: 7pt;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 4pt 0;
    border-bottom: 2px solid #e5e7eb;
  }

  .county-table td {
    padding: 5pt 0;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: top;
  }

  .county-driver-chip {
    font-size: 7pt;
    padding: 2pt 5pt;
  }

  /* ── HR dividers ────────────────────────────────────────────────── */

  hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 10pt 0;
  }

  /* ── Vacancy mix secondary rows ─────────────────────────────────── */

  .vacancy-mix-secondary .trend-period,
  .vacancy-mix-secondary .trend-value,
  .vacancy-mix-secondary .trend-step {
    color: #9ca3af;
    font-size: 8pt;
  }

}