/* Port tab (static/js/sea-port.js). Same language as the /recycling reliability cards: nested tiles, hairlines, one segmented range switch,
   scrub chart, a day-type x time grid, ranked rows with tracks. Tokens only. Yellow marks the selected or the "what you are looking at" element. */
.sp-root { --sp-hair: rgba(18, 19, 22, .08); --sp-spring: cubic-bezier(.32, .72, 0, 1); display: grid; gap: 12px; margin: 12px 0; font-variant-numeric: tabular-nums; color: var(--nv-ink); }
.sp-card { padding: 14px; border: 1px solid var(--nv-line); border-radius: var(--nv-r); background: var(--nv-raised); min-width: 0; }
.sp-title { margin: 0; font-size: 15px; font-weight: 650; line-height: 1.3; letter-spacing: -.01em; }
.sp-unit, .sp-note { margin: 4px 0 0; font-size: 12px; line-height: 1.45; color: var(--nv-muted); }
.sp-note { font-size: 14px; margin-top: 10px; }
.sp-vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sp-ctl { display: flex; margin: 12px 0 2px; }

/* Segmented switch (range, arrivals/departures, dataset) */
.sp-seg-ctl { display: inline-flex; border: 1px solid var(--nv-line); border-radius: var(--nv-r); overflow: hidden; }
.sp-seg-btn { position: relative; min-height: 36px; padding: 0 14px; border: 0; background: var(--nv-raised); color: var(--nv-ink); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 160ms var(--nv-ease), transform 160ms var(--nv-ease); }
.sp-seg-btn::after { content: ""; position: absolute; inset: -4px 0; }
.sp-seg-btn + .sp-seg-btn { border-left: 1px solid var(--nv-line); }
.sp-seg-btn:hover { background: var(--nv-surface); }
.sp-seg-btn[aria-pressed="true"] { background: var(--nv-accent); color: var(--nv-accent-ink); }
.sp-seg-btn:active { transform: scale(.97); }

/* Right now tiles: pale tray around a white core */
.sp-card-kpi { padding: 0; border: 0; background: none; }
.sp-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.sp-kpi { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; padding: 12px; border: 1px solid var(--sp-hair); border-radius: 4px; background: var(--nv-raised); box-shadow: 0 0 0 3px var(--nv-surface), 0 0 0 4px var(--sp-hair); }
.sp-kpi:first-child { background: color-mix(in srgb, var(--nv-accent) 12%, var(--nv-raised)); }
.sp-kpi-l { font-size: 12px; font-weight: 600; color: var(--nv-muted); }
.sp-kpi strong { font-size: 28px; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; }
.sp-kpi-w { font-size: 12px; line-height: 1.35; color: var(--nv-muted); }
.sp-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 6px; border: 1px solid var(--nv-ink); border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--nv-raised); }
.sp-chip[data-dir="same"] { border-color: var(--nv-line); color: var(--nv-muted); }
.sp-chiprow { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin: 10px 0 0; }

/* Scrub chart */
.sp-plot { position: relative; margin-top: 12px; height: 112px; touch-action: pan-y; cursor: crosshair; border-radius: var(--nv-r); outline-offset: 4px; }
.sp-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.sp-grid { stroke: var(--nv-line); stroke-dasharray: 3 4; stroke-width: 1; }
.sp-area { fill: var(--nv-accent); opacity: .22; }
.sp-line { stroke: var(--nv-ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sp-line-2 { stroke: var(--nv-muted); stroke-width: 1.5; stroke-dasharray: 4 3; }
.sp-ylab { position: absolute; left: 0; padding: 0 3px 0 0; font-size: 12px; line-height: 1; color: var(--nv-muted); background: var(--nv-raised); pointer-events: none; }
.sp-ylab-hi { top: -1px; }
.sp-ylab-lo { bottom: -1px; }
.sp-rule { position: absolute; top: 0; bottom: 0; left: var(--sp-x, 0); width: 1px; background: var(--nv-ink); opacity: 0; pointer-events: none; }
.sp-dot { position: absolute; left: var(--sp-x, 0); top: var(--sp-y, 0); width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--nv-accent); box-shadow: 0 0 0 1.5px var(--nv-ink); opacity: 0; pointer-events: none; }
.sp-plot.is-scrub .sp-rule, .sp-plot.is-scrub .sp-dot { opacity: 1; }
.sp-plot:focus-visible { outline: 2px solid var(--nv-ink); }
.sp-xaxis { display: flex; justify-content: space-between; margin-top: 4px; font-size: 12px; color: var(--nv-muted); }
.sp-read { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; min-height: 2.4em; margin: 8px 0 0; font-size: 12px; color: var(--nv-muted); }
.sp-read b { color: var(--nv-ink); font-size: 15px; }
.sp-read-t { margin-left: auto; color: var(--nv-ink); font-weight: 600; }
.sp-read-sel { color: var(--nv-ink); }

/* When it is busiest */
.sp-best { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 0; }
.sp-bt { display: grid; gap: 1px; min-width: 0; padding: 8px 10px; border: 1px solid var(--sp-hair); border-left: 3px solid var(--nv-accent); border-radius: 4px; background: var(--nv-raised); }
.sp-bt small { font-size: 12px; font-weight: 600; color: var(--nv-muted); }
.sp-bt b { font-size: 14px; line-height: 1.25; }
.sp-bt em { font-style: normal; font-size: 12px; color: var(--nv-muted); }
.sp-best-even { margin: 12px 0 0; font-size: 14px; font-weight: 600; }
.sp-w { display: grid; grid-template-columns: 68px repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 12px; }
.sp-w-h { display: grid; align-content: center; gap: 1px; min-height: 40px; padding: 4px 2px; border-radius: var(--nv-r); background: var(--nv-surface); text-align: center; font-size: 12px; font-weight: 600; line-height: 1.2; }
.sp-w-h small { font-size: 12px; font-weight: 400; color: var(--nv-muted); white-space: nowrap; }
.sp-w-r { display: flex; align-items: center; padding: 0 8px; border-radius: var(--nv-r); background: var(--nv-surface); font-size: 12px; font-weight: 600; }
.sp-w-cell { position: relative; display: grid; place-items: center; min-height: 44px; border: 0; border-radius: 4px; color: var(--nv-ink); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; transition: transform 140ms var(--nv-ease), box-shadow 140ms var(--nv-ease); }
.sp-w-cell.is-empty { background: repeating-linear-gradient(135deg, var(--nv-surface) 0 3px, #e4e5e8 3px 4px); color: var(--nv-muted); cursor: default; font-weight: 400; }
.sp-w-cell.is-peak { box-shadow: inset 0 0 0 1.5px var(--nv-ink); }
button.sp-w-cell:hover { transform: scale(1.04); }
.sp-w-cell.is-sel { box-shadow: 0 0 0 2px var(--nv-ink); transform: scale(1.04); z-index: 1; }
.sp-w-cell:active { transform: scale(.97); }
.sp-w-cell:focus-visible { outline: 2px solid var(--nv-ink); outline-offset: 2px; }

/* Calls per hour */
.sp-key { display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; white-space: nowrap; }
.sp-sw { display: inline-block; width: 12px; height: 12px; box-sizing: border-box; }
.sp-sw-done { background: var(--nv-accent); box-shadow: inset 0 0 0 1px rgba(18, 19, 22, .5); }
.sp-sw-due { border: 1px solid var(--nv-ink); background: transparent; }
.sp-sw-line { height: 0; border-top: 2px solid var(--nv-ink); }
.sp-sw-dash { height: 0; border-top: 2px dashed var(--nv-muted); }
.sp-hours { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 104px; margin-top: 14px; border-bottom: 1px solid var(--nv-ink); touch-action: pan-y; }
.sp-hcol { position: relative; flex: 1 1 0; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; border-radius: 2px 2px 0 0; }
.sp-hcol:hover { background: var(--nv-surface); }
.sp-seg-done { display: block; width: 100%; background: var(--nv-accent); box-shadow: inset 0 0 0 1px rgba(18, 19, 22, .45); }
.sp-seg-due { display: block; width: 100%; box-sizing: border-box; border: 1px solid var(--nv-ink); border-bottom: 0; background: transparent; }
.sp-seg-done[style*="height:0.0%"], .sp-seg-due[style*="height:0.0%"] { display: none; }
.sp-hcol.is-peak .sp-seg-done, .sp-hcol.is-peak .sp-seg-due { min-height: 2px; }
.sp-now { position: absolute; top: -6px; bottom: 0; width: 0; border-left: 1px dashed var(--nv-ink); pointer-events: none; }
.sp-now-l { position: absolute; top: -14px; left: 4px; padding: 0 6px; font-size: 12px; line-height: 1.4; white-space: nowrap; background: var(--nv-raised); color: var(--nv-ink); border: 1px solid var(--nv-ink); border-radius: var(--nv-r); }
.sp-now-r .sp-now-l { left: auto; right: 4px; }
.sp-axis { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 4px; font-size: 12px; color: var(--nv-muted); }
.sp-alt { margin-top: 8px; font-size: 14px; }
.sp-alt summary { min-height: 36px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.sp-scroll { overflow-x: auto; }
.sp-alt table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sp-alt th, .sp-alt td { padding: 4px 6px; border-bottom: 1px solid var(--nv-line); text-align: right; }
.sp-alt th[scope="row"], .sp-alt th:first-child { text-align: left; }

/* Types: ranked rows, one is a button that filters the map */
.sp-types { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; }
.sp-trow { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "l v" "t t"; gap: 4px 8px; align-items: baseline; width: 100%; padding: 8px 6px; border: 0; border-radius: var(--nv-r); background: transparent; color: var(--nv-ink); font: inherit; font-size: 14px; text-align: left; }
button.sp-trow { cursor: pointer; transition: background 160ms var(--nv-ease), transform 160ms var(--nv-ease); }
button.sp-trow:hover { background: var(--nv-surface); }
button.sp-trow:active { transform: scale(.985); }
button.sp-trow:focus-visible { outline: 2px solid var(--nv-ink); outline-offset: 1px; }
.sp-tl { grid-area: l; display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; line-height: 1.25; }
.sp-tk, .sp-tp { color: var(--nv-muted); font-size: 12px; }
.sp-tv { grid-area: v; white-space: nowrap; }
.sp-tv strong { font-weight: 700; }
.sp-track { grid-area: t; display: block; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--marker-color, var(--nv-accent)) 16%, var(--nv-raised)); overflow: hidden; }
.sp-track i { display: block; height: 100%; min-width: 2px; border-radius: 3px; background: var(--marker-color, var(--nv-accent)); transform-origin: left; }
.sp-other .sp-track i { background: transparent; box-shadow: inset 0 0 0 1px var(--nv-muted); }
.sp-other { color: var(--nv-muted); }

/* Footer: early-data pill, help disclosure, one source line */
.sp-foot { padding: 0 2px; }
.sp-meta { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 10px; }
.sp-pill { display: inline-flex; align-items: center; padding: 2px 8px; border: 1px solid var(--nv-line); border-left: 3px solid var(--nv-warn); border-radius: var(--nv-r); background: var(--nv-surface); font-size: 12px; font-weight: 600; }
.sp-help { font-size: 12px; color: var(--nv-muted); }
.sp-help summary { cursor: pointer; list-style: none; padding: 2px 0; text-decoration: underline; text-decoration-color: var(--nv-line); text-underline-offset: 3px; }
.sp-help summary::-webkit-details-marker { display: none; }
.sp-help[open] { flex-basis: 100%; }
.sp-help p { margin: 6px 0 0; line-height: 1.45; }
.sp-help b { color: var(--nv-ink); }
.sp-src { margin: 8px 0 0; font-size: 12px; line-height: 1.45; color: var(--nv-muted); }

@keyframes sp-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .sp-root.sp-enter > * { animation: sp-rise 520ms cubic-bezier(.16, 1, .3, 1) both; }
  .sp-enter > :nth-child(2) { animation-delay: 60ms; } .sp-enter > :nth-child(3) { animation-delay: 120ms; } .sp-enter > :nth-child(4) { animation-delay: 180ms; }
  .sp-enter > :nth-child(5) { animation-delay: 240ms; } .sp-enter > :nth-child(n+6) { animation-delay: 300ms; }
}
@media (prefers-reduced-motion: reduce) { .sp-seg-btn, .sp-w-cell, button.sp-trow { transition: none; } }
