:root {
  --bg: #f7f2ea;
  --bg-accent: rgba(15, 118, 110, 0.06);
  --surface: rgba(255, 255, 255, 0.86);
  --ink: #1f2b24;
  --muted: #617066;
  --accent: #0f766e;
  --accent-strong: #0b5c56;
  --line: rgba(31, 43, 36, 0.12);
  --line-strong: rgba(31, 43, 36, 0.22);
  --warning-soft: rgba(180, 83, 9, 0.1);
  --warning-ink: #8a3a00;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.08), transparent 28%),
    linear-gradient(180deg, #fbf7f0 0%, #f4ede2 100%);
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", serif;
  line-height: 1.04;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

h2 {
  font-size: clamp(1.35rem, 2.5vw, 1.7rem);
}

h3 {
  font-size: 1.18rem;
}

p {
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell {
  width: min(1140px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 52px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(250px, 0.95fr);
  gap: 22px 28px;
  padding: 4px 0 22px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line-strong);
}

.hero-station {
  padding-top: 6px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  font-weight: 700;
}

.hero-copy,
.section-head p,
.muted,
.station-address,
.station-meta,
.helper-text,
.detail-note,
.chart-summary,
.legend-card-meta,
dd {
  color: var(--muted);
}

.hero-copy {
  margin-top: 12px;
  max-width: 64ch;
  font-size: 1rem;
  line-height: 1.58;
}

.hero-copy-row,
.station-address-row,
.detail-value-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.hero-copy-row .hero-copy,
.station-address-row .station-address,
.detail-value-row strong {
  min-width: 0;
  flex: 1 1 auto;
}

.hero-meta {
  display: grid;
  gap: 10px;
  align-content: start;
}

.metric {
  display: grid;
  gap: 4px;
  padding: 10px 0 12px;
  border-top: 1px solid var(--line);
}

.metric:first-child {
  border-top: 0;
  padding-top: 0;
}

.metric-label {
  font-size: 0.82rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.metric strong {
  font-size: 1.08rem;
  line-height: 1.32;
}

.card {
  margin: 0;
  padding: 18px 0 20px;
  border-top: 1px solid var(--line);
  background: transparent;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 12px;
}

.section-head p {
  margin-top: 6px;
  line-height: 1.45;
  max-width: 62ch;
}

.filters,
.filters-wide {
  display: grid;
  gap: 12px;
  align-items: end;
}

.filters-wide {
  grid-template-columns: minmax(220px, 1.35fr) repeat(3, minmax(0, 1fr)) minmax(200px, 1fr) auto;
}

label {
  display: grid;
  gap: 7px;
}

.combo-field {
  position: relative;
}

.combo-field::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: 17px;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid rgba(31, 43, 36, 0.4);
  border-bottom: 1.5px solid rgba(31, 43, 36, 0.4);
  transform: rotate(45deg);
  pointer-events: none;
}

label span {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

input,
select,
button,
.ghost-button {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.combo-field input[data-combobox-input] {
  padding-right: 34px;
}

input:focus,
select:focus,
button:focus,
.ghost-button:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.42);
}

button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.ghost-button {
  background: transparent;
}

.ghost-button:hover {
  text-decoration: none;
  background: rgba(15, 118, 110, 0.06);
}

.filter-actions {
  display: grid;
  gap: 10px;
}

.combo-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  gap: 0;
  max-height: 280px;
  overflow-y: auto;
  padding: 6px 0;
  border: 1px solid rgba(31, 43, 36, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 40px rgba(31, 43, 36, 0.08);
}

.combo-menu[hidden] {
  display: none;
}

.combo-option {
  width: 100%;
  min-height: 0;
  display: grid;
  justify-items: start;
  gap: 2px;
  padding: 8px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.combo-option:hover,
.combo-option.is-active {
  background: rgba(15, 118, 110, 0.08);
  color: var(--ink);
}

.combo-option-label {
  font-size: 0.93rem;
  font-weight: 600;
}

.combo-option-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.checkbox-field {
  align-content: end;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 2px;
  color: var(--ink);
  font-weight: 600;
}

.checkbox-row input {
  width: auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--accent);
}

.checkbox-row span {
  font-size: 0.94rem;
  color: var(--ink);
}

.alert-banner {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--warning-soft);
  border: 1px solid rgba(180, 83, 9, 0.18);
  color: var(--warning-ink);
  line-height: 1.45;
  font-size: 0.92rem;
}

.list-tools {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 16px;
}

.sort-context {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.order-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.order-chip {
  width: auto;
  min-height: 0;
  padding: 0 0 5px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.order-chip:hover {
  background: transparent;
  color: var(--accent-strong);
}

.order-chip.is-active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.station-list {
  display: grid;
}

.station-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.station-kicker,
.back-link {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.86rem;
}

.station-main h3 {
  margin-top: 4px;
}

.station-address,
.station-meta,
.station-kicker {
  margin-top: 7px;
}

.station-address {
  line-height: 1.5;
}

.station-meta {
  font-size: 0.92rem;
}

.station-side {
  min-width: 220px;
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 6px;
  text-align: right;
}

.pill {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: flex-end;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
}

.pill strong {
  font-size: 1.18rem;
  font-weight: 700;
}

.station-distance {
  font-weight: 600;
}

.station-links,
.detail-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.station-links-inline,
.detail-actions-inline,
.station-links-hero {
  margin-top: 0;
  flex: 0 0 auto;
}

.map-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(31, 43, 36, 0.14);
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-strong);
}

.map-link:hover {
  text-decoration: none;
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(15, 118, 110, 0.3);
}

.map-link svg {
  width: 16px;
  height: 16px;
  display: block;
}

.map-link-apple {
  color: #111827;
}

.detail-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.detail-list div {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

dt {
  font-weight: 700;
}

dd {
  margin: 0;
}

.detail-note {
  display: block;
  margin-top: 6px;
  line-height: 1.45;
  font-size: 0.9rem;
}

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

.data-table th,
.data-table td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  font-size: 0.84rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.is-selected-row td {
  background: rgba(15, 118, 110, 0.05);
}

.empty-state {
  padding: 14px 0 4px;
  color: var(--muted);
  line-height: 1.52;
}

.history-widget {
  display: grid;
  gap: 10px;
}

.chart-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  align-items: start;
  margin-bottom: 4px;
}

.chart-presets {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.chart-range-button,
.chart-apply-button {
  width: auto;
  min-width: 0;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
}

.chart-range-button {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--muted);
}

.chart-range-button:hover {
  background: rgba(15, 118, 110, 0.04);
  border-color: rgba(15, 118, 110, 0.18);
}

.chart-range-button.is-active {
  border-color: rgba(15, 118, 110, 0.24);
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent-strong);
}

.chart-custom-range {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 6px;
  justify-content: end;
  align-items: end;
}

.chart-date-field {
  gap: 4px;
}

.chart-date-field span {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.chart-custom-range input {
  width: 122px;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 0.82rem;
}

.chart-summary {
  font-size: 0.84rem;
  line-height: 1.42;
}

.chart-wrap {
  display: grid;
  gap: 8px;
}

.chart-wrap svg {
  width: 100%;
  height: auto;
  aspect-ratio: 980 / 296;
  border-radius: 14px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.52));
}

.chart-grid {
  stroke: rgba(31, 43, 36, 0.11);
  stroke-dasharray: 4 5;
}

.chart-axis {
  stroke: rgba(31, 43, 36, 0.32);
  stroke-width: 1.2;
}

.chart-axis-label {
  fill: var(--muted);
  font-size: 10.5px;
  text-anchor: end;
}

.chart-axis-label-top,
.chart-axis-label-left {
  text-anchor: start;
}

.chart-axis-label-right {
  text-anchor: end;
}

.chart-empty {
  margin-top: 0;
}

.chart-legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, max-content));
  justify-content: start;
  gap: 10px 18px;
}

.legend-card {
  width: auto;
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 3px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.legend-card:hover {
  background: transparent;
}

.legend-card:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.24);
  outline-offset: 4px;
  border-radius: 8px;
}

.legend-card.is-inactive {
  opacity: 0.64;
}

.legend-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-card-head strong {
  font-size: 0.94rem;
  font-weight: 600;
}

.legend-card.is-active .legend-card-head strong {
  font-weight: 700;
}

.legend-card-meta {
  display: grid;
  gap: 1px;
  padding-left: 18px;
  font-size: 0.75rem;
  line-height: 1.33;
}

.legend-card-meta strong {
  color: var(--ink);
  font-weight: 600;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  flex: 0 0 10px;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

@media (max-width: 1100px) {
  .filters-wide {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .hero,
  .filters-wide,
  .filters,
  .station-card {
    grid-template-columns: 1fr;
  }

  .section-head,
  .hero-copy-row,
  .station-address-row,
  .detail-value-row,
  .pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .list-tools,
  .chart-presets {
    justify-content: flex-start;
  }

  .station-side {
    min-width: 0;
    justify-items: start;
    text-align: left;
  }

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

  .chart-custom-range {
    justify-content: start;
  }

  .detail-list div {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100%, calc(100% - 20px));
    padding-top: 18px;
    padding-bottom: 40px;
  }

  h1 {
    font-size: 1.88rem;
  }

  .hero {
    gap: 16px;
    padding-bottom: 18px;
  }

  .hero-copy {
    margin-top: 10px;
    font-size: 0.96rem;
  }

  .card {
    padding: 16px 0 18px;
  }

  .metric strong {
    font-size: 1rem;
  }

  .chart-custom-range {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    width: 100%;
  }

  .chart-custom-range input {
    width: 100%;
    min-width: 0;
  }

  .chart-apply-button {
    align-self: end;
  }

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

  .data-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .data-table th,
  .data-table td {
    padding: 10px 8px;
  }

  .order-tabs {
    gap: 12px;
  }

  .combo-menu {
    max-height: 240px;
  }
}
