/* Styles for the financial-health report. The layout keeps dense municipal
   finance ratios readable while staying close to the existing report theme. */

:root {
  --bg: #fbfaf6;
  --fg: #18181b;
  --muted: #666a73;
  --border: #d8d4ca;
  --panel: #ffffff;
  --soft: #f0ede6;
  --good: #0f766e;
  --good-soft: #ccfbf1;
  --warn: #b7791f;
  --warn-soft: #fef3c7;
  --bad: #b42318;
  --bad-soft: #fee4df;
  --neutral: #374151;
  --blue: #1d4ed8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, system-ui, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

header, main, footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 16px;
}

header {
  padding-top: 34px;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--bad);
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  max-width: 880px;
  margin: 0 0 10px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.04;
}

h2 {
  margin: 2.6em 0 .6em;
  padding-top: 1em;
  border-top: 1px solid var(--border);
  font-size: 1.28rem;
}

h3 {
  margin: 1.6em 0 .6em;
  font-size: 1.02rem;
}

p { max-width: 790px; }

a { color: var(--blue); }

.lede {
  max-width: 780px;
  margin: 0;
  color: #303036;
  font-size: 1.06rem;
}

.updated, .note {
  color: var(--muted);
  font-size: .88rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 10px;
}

.metric {
  min-height: 128px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-top: 4px solid var(--neutral);
  border-radius: 8px;
}

.metric.good { border-top-color: var(--good); }
.metric.warn { border-top-color: var(--warn); }
.metric.bad { border-top-color: var(--bad); }
.metric.neutral { border-top-color: var(--neutral); }

.metric .label {
  min-height: 2.2em;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 650;
}

.metric .value {
  margin: 0;
  font-size: clamp(1.35rem, 3.6vw, 2.05rem);
  font-weight: 760;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.metric .sub {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .78rem;
}

.chart-box {
  position: relative;
  width: 100%;
  height: clamp(320px, 48vw, 500px);
  margin: 14px 0 10px;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.chart-box.tall { height: clamp(360px, 54vw, 560px); }
.chart-box.compact { height: clamp(300px, 42vw, 430px); }

.chart-grid, .table-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.table-wrap {
  width: 100%;
  margin-top: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: .88rem;
}

caption {
  padding: 4px 0 8px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 650;
  text-align: left;
}

th, td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--soft);
  color: #303036;
  font-size: .78rem;
  text-transform: uppercase;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.positive { color: var(--good); }
.negative { color: var(--bad); }

footer {
  padding-top: 8px;
  padding-bottom: 36px;
}

@media (max-width: 820px) {
  .metric-grid,
  .chart-grid,
  .table-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  header, main, footer { padding-left: 12px; padding-right: 12px; }
  .metric { min-height: 112px; }
  .chart-box { padding: 8px; }
}
