/* On-time history page. Shared tokens and layout come from site.css. */

.h-body { display: flex; flex-direction: column; gap: 24px; }

.h-note { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted, #555); }
.h-muted { color: var(--muted, #555); font-size: 13px; }

/* Controls */
.h-controls { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; }
.h-period { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; }

.h-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.h-chips[hidden], .h-station-pick[hidden] { display: none; }
.h-chips button {
  font: inherit; font-size: 15px; font-weight: 700; min-height: 44px; padding: 0 16px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; border-radius: 22px;
  border: 2px solid #BDBDBD; background: #FFF; color: var(--ink, #1A1A1A);
}
.h-chips button[aria-pressed="true"] { border-color: var(--brown, #3A2C26); background: var(--tan-2, #F3E9DE); }

.h-station-pick { display: flex; flex-direction: column; gap: 6px; max-width: 480px; }
.h-station-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.h-station-list:empty { display: none; }
.h-station-list { border: 1px solid var(--line, #D9CCBE); border-radius: 6px; background: #FFF; overflow: hidden; }
.h-station-list li + li { border-top: 1px solid var(--line-soft, #EDE3D8); }
.h-station-list li.h-note { padding: 12px 14px; }
.h-station-list button {
  font: inherit; font-size: 15px; width: 100%; min-height: 44px; padding: 6px 14px; border: 0; background: none;
  display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; color: var(--ink, #1A1A1A);
}
.h-station-list button:hover { background: var(--selected); }
.h-station-list .h-muted { margin-left: auto; }

/* Cards */
.h-card { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.h-card h2, .h-section h2 { font-size: 20px; }
.h-section { display: flex; flex-direction: column; gap: 12px; }

/* Chart */
.h-chart-scroll { overflow-x: auto; }
.h-chart { display: flex; padding-bottom: 4px; }
.h-yaxis { position: sticky; left: 0; z-index: 1; background: #FFF; flex: 0 0 52px; height: 280px; font-size: 12px; color: var(--muted, #555); }
.h-yaxis span { position: absolute; right: 12px; transform: translateY(50%); font-variant-numeric: tabular-nums; }
.h-yaxis span.edge { font-weight: 700; color: var(--ink, #1A1A1A); }
.h-chart-main { flex: 1 1 auto; display: flex; flex-direction: column; gap: 8px; }
.h-flags { position: relative; margin-bottom: -8px; }
.h-plot { position: relative; height: 280px; border-bottom: 2px solid var(--brown, #3A2C26); }
.h-grid { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line-soft, #EDE3D8); }
.h-grid.edge { border-top: 1px dashed #8C8C8C; }
.h-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.h-points { position: absolute; inset: 0; }
.h-point {
  position: absolute; transform: translate(-50%, 7px); display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.h-val { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; background: #FFF; padding: 0 2px; line-height: 1.3; }
.h-dot { display: block; width: 14px; height: 14px; box-sizing: border-box; border-radius: 50%; border: 3px solid; }
.h-xaxis { display: flex; }
.h-xaxis span { flex: 1 1 0; text-align: center; font-size: 11px; color: var(--muted, #555); line-height: 1.3; }

/* Alert flags (chart) and numbers (list) */
.h-flag {
  width: 22px; height: 22px; border-radius: 50%; background: var(--brown, #3A2C26); color: #FFF;
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.h-flags .h-flag { position: absolute; transform: translateX(-50%); cursor: default; }

.h-alerts ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.h-alerts li { display: flex; gap: 8px 16px; padding: 14px 0; border-top: 1px solid var(--line-soft, #EDE3D8); }
.h-alerts li .h-flag { flex: 0 0 auto; width: 28px; height: 28px; font-size: 13px; }
.h-alert-body { flex: 1 1 auto; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.h-alert-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.h-alert-head strong { font-size: 16px; }
.h-kind { font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--brown, #3A2C26); }
.h-alert-title { font-size: 15px; font-weight: 700; }
.h-alert-text { font-size: 15px; line-height: 1.5; color: #333; }
.h-alert-effect { font-size: 13px; color: var(--muted, #555); font-variant-numeric: tabular-nums; }

/* Results table */
.h-table { min-width: 560px; }
.h-table tbody th a span:last-child { text-decoration: underline; text-decoration-color: var(--line); }
.h-table tbody th a { color: var(--ink); text-decoration: none; min-height: 32px; }
.h-table tbody th a:hover span:last-child { color: var(--link); text-decoration-color: currentColor; }
.h-table tr.h-sel th, .h-table tr.h-sel td { background: var(--selected); }

@media (max-width: 600px) {
  .h-controls .segmented { display: flex; width: 100%; }
  .h-controls .segmented .tab { flex: 1 1 0; padding: 0 8px; }
  .h-card { padding: 16px; }
  .h-body .tiles { grid-template-columns: 1fr 1fr; gap: 12px; }
  .h-body .tile { padding: 12px; }
  .h-body .tile-value { font-size: 26px; }
}
