* { box-sizing: border-box; }

:root {
  --dashboard-max-width: 1100px;
  --dashboard-gutter: 24px;
  --dashboard-content-width: calc(var(--dashboard-max-width) - var(--dashboard-gutter) - var(--dashboard-gutter));
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  padding: var(--dashboard-gutter);
  max-width: var(--dashboard-max-width);
  margin: 0 auto;
  color: #222;
  line-height: 1.5;
}

.dashboard-frame {
  width: calc(100% - var(--dashboard-gutter) - var(--dashboard-gutter));
  max-width: var(--dashboard-content-width);
  margin-inline: auto;
}

header {
  border-bottom: 1px solid #e5e5e5;
  padding-bottom: 12px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.header-body { min-width: 0; flex: 1; }

h1 { word-wrap: break-word; overflow-wrap: break-word; }

.header-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
  padding-top: 4px;
}
.header-nav a {
  font-size: 13px;
  color: #1971c2;
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid #1971c2;
  border-radius: 4px;
  white-space: nowrap;
  text-align: center;
}
.header-nav a:hover {
  background: #1971c2;
  color: white;
}
.header-nav a[aria-current="page"] {
  background: #1971c2;
  color: white;
  pointer-events: none;
}

@media (max-width: 480px) {
  header { flex-direction: column; gap: 10px; }
  .header-nav { flex-direction: row; flex-wrap: wrap; padding-top: 0; }
  .header-nav a { font-size: 12px; padding: 4px 8px; }
}

#date-selector { margin-top: 10px; }

.cal { display: inline-block; font-size: 13px; user-select: none; }

.cal-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 5px;
}
.cal-title {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  color: #222;
}
.cal-btn {
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  padding: 1px 6px;
  font-size: 13px;
  color: #555;
  line-height: 1.4;
}
.cal-btn:hover:not(:disabled) { background: #f0f0f0; }
.cal-btn:disabled { opacity: 0.25; cursor: default; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 28px);
  gap: 2px;
}
.cal-dow {
  text-align: center;
  font-size: 11px;
  color: #aaa;
  padding: 2px 0;
  font-weight: 500;
}
.cal-day {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid transparent;
}
.cal-has {
  border-color: #1971c2;
  color: #1971c2;
  cursor: pointer;
  font-weight: 500;
  background: none;
}
.cal-has:hover { background: #e8f0fe; }
.cal-cur {
  background: #1971c2 !important;
  color: white !important;
  border-color: #1971c2 !important;
}
.cal-none { color: #ccc; }
.cal-empty { border: none; }

h1 { margin: 0 0 4px; font-size: 28px; }
h2 { margin: 0 0 12px; font-size: 18px; }
section { margin-top: 32px; }

.muted {
  color: #6b6b6b;
  font-size: 13px;
}
.defn {
  margin-top: 0;
  margin-bottom: 8px;
  line-height: 1.6;
}
.defn + .defn { margin-top: 4px; }
.defn code {
  background: #eef2f7;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 12px;
}
.sub-h {
  margin-top: 24px;
  margin-bottom: 4px;
  font-size: 14px;
  color: #444;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.small-cards .card .val { font-size: 20px; }
.small-cards .card { padding: 10px 12px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.card {
  border: 1px solid #e5e5e5;
  border-radius: 6px;
  padding: 14px 16px;
  background: #fafafa;
}
.card .label {
  font-size: 11px;
  color: inherit;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.card .val {
  font-size: 26px;
  font-weight: 600;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
th, td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid #eee;
}
th {
  background: #f4f4f4;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.sorted-asc::after  { content: " ▲"; opacity: 0.5; }
th.sorted-desc::after { content: " ▼"; opacity: 0.5; }
tbody tr:hover { background: #fafafa; }

.route-badge {
  display: inline-block;
  min-width: 36px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 13px;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.route-n {
  margin-left: 6px;
  color: #888;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

tr.route-row { cursor: pointer; }
tr.route-row:hover { background: #f4f8fc; }
tr.route-row.is-open { background: #eef4fa; }
tr.route-row.is-open td { border-bottom-color: transparent; }

.expand-cell, .expand-th {
  width: 24px;
  text-align: center;
  color: #888;
  user-select: none;
}

tr.route-detail > td {
  position: relative;
  padding: 8px 16px 14px;
  background: #f6f9fc;
  border-bottom: 1px solid #e5e5e5;
}
tr.route-detail[hidden] { display: none; }

.route-week-btn {
  position: absolute;
  top: 8px;
  right: 16px;
  font-size: 12px;
  font-weight: 600;
  color: #1971c2;
  text-decoration: none;
  white-space: nowrap;
  padding: 4px 10px;
  border: 1px solid #1971c2;
  border-radius: 4px;
  background: #fff;
}
.route-week-btn:hover { background: #1971c2; color: #fff; }

.route-detail-list {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.route-detail-list > div {
  display: flex;
  gap: 12px;
  align-items: baseline;
}
.route-detail-list dt {
  margin: 0;
  flex: 0 0 200px;
  color: #555;
  font-size: 13px;
}
.route-detail-list dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
@media (max-width: 600px) {
  .route-detail-list dt { flex-basis: 140px; font-size: 12px; }
}

.route-controls {
  margin: 8px 0 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.route-controls button {
  font-family: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid #c8c8c8;
  border-radius: 4px;
  background: #fafafa;
  color: #444;
  cursor: pointer;
}
.route-controls button:hover { background: #f0f0f0; border-color: #b0b0b0; }
.route-controls button:active { background: #e6e6e6; }
.route-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #444;
  font-size: 12px;
  cursor: pointer;
}
.route-checkbox input { margin: 0; }
#route-filter {
  font-family: inherit;
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid #c8c8c8;
  border-radius: 4px;
  width: 140px;
}
#route-filter:focus { outline: none; border-color: #1971c2; }

.limited-route-tag {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 5px;
  border: 1px solid #b38b52;
  border-radius: 999px;
  background: #fff8e8;
  color: #7a5524;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}
.limited-route-status { font-size: 12px; }

.boxplot {
  display: block;
  vertical-align: middle;
}

canvas { max-width: 100%; height: auto !important; }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-wrap table { min-width: 700px; }
.bounded-table-wrap {
  max-height: 390px;
  margin-top: 8px;
  overflow: auto;
  border: 1px solid #e2e8ee;
  border-radius: 8px;
}
.bounded-table-wrap table { margin-top: 0; }
.bounded-table-wrap thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: inset 0 -1px #dedede;
}

/* Weekly: heatmap controls (also reused for line-chart toggle) */
.hm-controls {
  margin: 8px 0 12px;
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: #444;
}
.hm-controls label { cursor: pointer; }
.hm-controls input { vertical-align: middle; margin-right: 4px; }

/* Weekly: day × hour heatmap */
.hm-grid {
  display: grid;
  grid-template-columns: 50px repeat(24, 1fr);
  gap: 1px;
  background: #ddd;
  border: 1px solid #ddd;
  font-variant-numeric: tabular-nums;
}
.hm-corner, .hm-hcol, .hm-row, .hm-cell { background: white; }
.hm-hcol {
  font-size: 10px;
  text-align: center;
  padding: 4px 0;
  color: #666;
}
.hm-row {
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 6px 0;
  cursor: pointer;
}
.hm-row:hover { background: #eef4fa; }
.hm-cell {
  min-height: 26px;
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  text-align: center;
  line-height: 26px;
  position: relative;
  transition: transform 0.08s ease, box-shadow 0.08s ease, font-size 0.08s ease;
}
.hm-cell:hover {
  transform: scale(1.6);
  z-index: 10;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  font-size: 13px;
  cursor: default;
}
.hm-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  font-size: 12px;
  color: #555;
}
.hm-legend-cell {
  width: 28px;
  height: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Weekly: per-route line-chart selection */
.route-select { margin: 12px 0 0; }
.route-select-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.route-select-controls input {
  font-family: inherit;
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid #c8c8c8;
  border-radius: 4px;
  min-width: 180px;
}
.route-select-controls button {
  font-family: inherit;
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid #c8c8c8;
  border-radius: 4px;
  background: #fafafa;
  color: #444;
  cursor: pointer;
}
.route-select-controls button:hover {
  background: #f0f0f0;
  border-color: #b0b0b0;
}
.route-select-count { font-size: 12px; }
.route-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  background: #fafafa;
}
.route-chip {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--route-color, #c8c8c8);
  background: white;
  color: var(--route-color, #555);
  cursor: pointer;
  user-select: none;
  min-width: 36px;
  text-align: center;
}
.route-chip:hover {
  box-shadow: 0 0 0 1px var(--route-color, #888);
}
.route-chip.is-selected {
  background: var(--route-color, #888);
  color: var(--route-text, white);
}
.route-chip.hidden { display: none; }

/* Weekly: route × day On Time Service Delivered grid */
.rdgrid {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) repeat(7, 1fr);
  gap: 2px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.rdgrid-corner { background: transparent; }
.rdgrid-hcol {
  font-size: 12px;
  text-align: center;
  font-weight: 600;
  padding: 6px 4px;
  background: #f4f4f4;
  cursor: pointer;
  border-radius: 3px;
}
.rdgrid-hcol:hover { background: #e6eef7; }
.rdgrid-hcol small { color: #888; font-weight: 400; }
.rdgrid-rlabel {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
}
.rdgrid-p50 {
  font-size: 11px;
  color: #888;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.15s, max-width 0.15s;
  max-width: 200px;
  opacity: 1;
}
.rdgrid-rlabel:hover .rdgrid-p50 {
  opacity: 0;
  max-width: 0;
  pointer-events: none;
}
.rdgrid-cell {
  text-align: center;
  padding: 6px 2px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 3px;
  cursor: pointer;
}
.rdgrid-empty {
  background: #f8f8f8;
  color: #999;
  cursor: default;
}
.rdgrid-hidden { display: none; }
.rdgrid-map-btn {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: #1971c2;
  text-decoration: none;
  flex-shrink: 0;
  white-space: nowrap;
  padding: 3px 0;
  border: 1px solid #1971c2;
  border-radius: 3px;
  background: #fff;
  text-align: center;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, max-width 0.15s, padding 0.15s;
}
.rdgrid-rlabel:hover .rdgrid-map-btn {
  max-width: 120px;
  padding: 3px 8px;
  opacity: 1;
  pointer-events: auto;
}
.rdgrid-map-btn:hover { background: #1971c2; color: #fff; }

footer {
  margin-top: 60px;
  padding-top: 18px;
  border-top: 1px solid #e5e5e5;
  text-align: center;
  font-size: 13px;
  color: #6b6b6b;
}
footer a {
  color: inherit;
  text-decoration: none;
}
footer a:hover {
  color: #1971c2;
  text-decoration: underline;
}

/* ---- report card ---- */
.agency-hero { margin-bottom: 28px; }
.agency-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 26px;
  padding: 24px 28px;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f3f7fb 100%);
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 34px rgba(20, 50, 90, 0.10);
}
.agency-grade {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 158px;
  padding: 20px 26px;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.agency-grade-letter {
  font-size: 68px;
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.02em;
}
.agency-grade-score {
  font-size: 20px;
  font-weight: 700;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}
.agency-grade-score span { font-size: 13px; font-weight: 600; opacity: 0.85; }
.agency-body { flex: 1; min-width: 280px; }
.agency-title { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.agency-sub { color: #5a6b7b; font-size: 13px; margin: 4px 0 16px; max-width: 60ch; }
.grade-data-warning {
  margin: -5px 0 14px;
  padding: 9px 11px;
  border: 1px solid #efbf55;
  border-radius: 8px;
  background: #fff7db;
  color: #6d4c07;
  font-size: 12px;
  line-height: 1.45;
}
.agency-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 10px;
}
.agency-stat {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e7eef5;
  border-radius: 9px;
}
.as-val { font-size: 21px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.as-label {
  font-size: 10.5px;
  color: #6b7b8b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 3px;
}
.as-sub { font-size: 11px; color: #9aa7b3; margin-top: 1px; }

.report-intro {
  margin-bottom: 24px;
}
.report-intro p { margin-top: 0; }
.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.report-action {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  background: #1971c2;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #1971c2;
  white-space: nowrap;
}
.report-action:hover { background: #145a9e; }

.bunching-section {
  padding: 24px;
  border: 1px solid #d8e4ee;
  border-radius: 16px;
  background:
    radial-gradient(circle at 100% 0%, rgba(25, 113, 194, 0.10), transparent 34%),
    linear-gradient(180deg, #fbfdff 0%, #f7fafc 100%);
}
.bunching-dashboard-section { margin-top: 24px; }
.bunching-dashboard-section > .bunching-chart-card { margin-top: 18px; }
.bunching-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}
.bunching-heading h2 { margin: 2px 0 8px; }
.bunching-kicker {
  margin: 0;
  color: #1971c2;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.bunching-benchmark {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 220px;
  padding: 12px 14px;
  border: 1px solid #d4dde5;
  border-radius: 12px;
  background: #f5f7f9;
  color: #445565;
}
.bunching-benchmark span,
.bunching-benchmark small { font-size: 10px; line-height: 1.45; }
.bunching-benchmark span { text-transform: uppercase; letter-spacing: 0.04em; }
.bunching-benchmark strong { margin: 3px 0; font-size: 22px; }
.bunching-benchmark a { color: #285f8f; }
.bunching-cards { margin-top: 4px; }
.bunching-cards .card { background: #fff; }
.bunching-tail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 18px;
}
.bunching-tail-grid article {
  display: flex;
  flex-direction: column;
  padding: 13px 15px;
  border: 1px solid #dbe5ed;
  border-radius: 9px;
  background: #f7fafc;
}
.bunching-tail-grid span {
  color: #627385;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.bunching-tail-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  margin: 8px 0 3px;
  color: #607b91;
}
.bunching-tail-visual svg {
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
}
.bunching-tail-visual b {
  color: #263f56;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bunching-tail-visual-short,
.bunching-tail-visual-long { gap: 8px; }
.bunching-tail-formula b { font-size: 18px; }
.bunching-tail-formula i {
  display: inline-block;
  margin: 0 7px;
  color: #1971c2;
  font-size: 22px;
  font-style: normal;
}
.bunching-tail-grid strong {
  margin: 4px 0 2px;
  color: #263f56;
  font-size: 21px;
}
.bunching-tail-grid small {
  color: #788897;
  font-size: 11px;
  line-height: 1.35;
}
.bunching-wait-callout {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto minmax(150px, 1fr) minmax(190px, 1.2fr);
  align-items: center;
  gap: 18px;
  margin: 18px 0;
  padding: 17px 20px;
  border: 1px solid #dbe5ed;
  border-radius: 12px;
  background: #fff;
}
.bunching-wait-callout > div {
  display: flex;
  flex-direction: column;
}
.bunching-callout-label,
.bunching-callout-tax span {
  color: #627385;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.bunching-wait-callout strong { margin: 2px 0; font-size: 25px; }
.bunching-wait-callout small { color: #788897; font-size: 11px; }
.bunching-callout-arrow { color: #8ca2b4; font-size: 24px; }
.bunching-callout-tax {
  padding: 11px 14px;
  border-radius: 9px;
  background: #fff1e8;
  color: #8c3b0a;
}
.bunching-callout-tax strong { color: #c44d08; }
.bunching-scheduled-wait {
  grid-column: 1 / -1;
  flex-direction: row !important;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid #e4ebf1;
  color: #627385;
}
.bunching-scheduled-wait span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.bunching-scheduled-wait strong { margin: 0; color: #34495e; font-size: 17px; }
.bunching-scheduled-wait small { font-size: 11px; }
.bunching-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.bunching-chart-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid #dfe8ef;
  border-radius: 12px;
  background: #fff;
}
.bunching-chart-card h3 { margin: 0; font-size: 16px; }
.bunching-chart-card p { min-height: 36px; margin: 4px 0 10px; }
.bunching-progress-highlight {
  display: block;
  margin-top: 3px;
  color: #1971c2;
  font-weight: 700;
}
.bunching-chart-canvas { position: relative; height: 300px; }
.bunching-cv-canvas { height: 330px; }
.bunching-methodology { margin: 14px 0 0; line-height: 1.55; }
.bunching-methodology a { color: #1971c2; }
.bunching-data-warning {
  margin: 10px 0 14px;
  padding: 11px 13px;
  border: 1px solid #efbf55;
  border-radius: 8px;
  background: #fff7db;
  color: #6d4c07;
  font-size: 12px;
  line-height: 1.5;
}
.bunching-data-warning[hidden] { display: none; }
.bunching-inline-status {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.bunching-inline-status.is-available {
  background: #e8f5e9;
  color: #256531;
}
.bunching-inline-status.is-unavailable {
  background: #fff3cd;
  color: #72510a;
}
.bunching-metric-table th[data-key] { cursor: pointer; }
.bunching-metric-table td { font-variant-numeric: tabular-nums; }
.route-metric-link { color: inherit; text-decoration: none; }
.route-metric-link:hover { text-decoration: underline; }

.route-detail-list > .route-grade-warning {
  align-items: flex-start;
  margin: 3px 0 5px;
  padding: 8px 10px;
  border: 1px solid #efbf55;
  border-radius: 7px;
  background: #fff7db;
  color: #6d4c07;
  line-height: 1.4;
}
.route-detail-list > .route-grade-warning dt { color: inherit; font-weight: 800; }

@media (max-width: 800px) {
  .bunching-chart-grid { grid-template-columns: 1fr; }
  .bunching-tail-grid { grid-template-columns: 1fr; }
  .bunching-wait-callout { grid-template-columns: 1fr 1fr; }
  .bunching-callout-arrow { display: none; }
  .bunching-callout-tax { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .bunching-section { padding: 18px 12px; }
  .bunching-heading { flex-direction: column; }
  .bunching-benchmark { align-items: flex-start; }
  .bunching-wait-callout { grid-template-columns: 1fr; }
  .bunching-callout-tax { grid-column: auto; }
}

.grade-history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 14px;
}
.grade-history-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 5px 20px rgba(20, 50, 90, 0.07);
}
.grade-history-card h3 {
  margin: 0;
  font-size: 16px;
}
.grade-history-meta {
  min-height: 40px;
  margin: 4px 0 10px;
}
.grade-history-canvas {
  position: relative;
  height: 330px;
}
.component-history-heading { margin-top: 28px; }
.component-history-heading h3 { margin: 0; font-size: 18px; }
.component-history-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.component-history-card h4 { margin: 0; font-size: 15px; }
.component-history-description {
  min-height: 60px;
  margin: 4px 0 10px;
  font-size: 12px;
  line-height: 1.45;
}
.component-history-canvas {
  position: relative;
  height: 240px;
}

@media (max-width: 900px) {
  .component-history-grid { grid-template-columns: 1fr; }
  .component-history-description { min-height: 0; }
}

@media (max-width: 800px) {
  .grade-history-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .grade-history-card { padding: 14px 10px; }
  .grade-history-canvas { height: 310px; }
  .component-history-canvas { height: 230px; }
}

.grade-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.grade-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
  padding: 4px 8px;
  border-radius: 5px;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.grade-chip small {
  font-weight: 500;
  font-size: 10px;
  opacity: 0.85;
}

.grade-badge {
  display: inline-block;
  min-width: 32px;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 14px;
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.grade-data-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  margin-left: 5px;
  border: 1px solid #d79b22;
  border-radius: 50%;
  background: #fff2c4;
  color: #704d05;
  font-size: 11px;
  font-weight: 900;
  vertical-align: middle;
}

.metric-pill {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.5;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.route-page-btn {
  font-size: 12px;
  font-weight: 600;
  color: #1971c2;
  text-decoration: none;
  white-space: nowrap;
  padding: 3px 8px;
  border: 1px solid #1971c2;
  border-radius: 4px;
}
.route-page-btn:hover { background: #1971c2; color: #fff; }
