/* Grafisk tidtabell (graf.html). Färgerna är desamma som på kartan. */
:root {
  --bg: #eef1f4; --panel: #ffffff; --fg: #16202b; --muted: #5d6b79; --line: #d8dee5; --grid: #e6eaef;
  --accent: #0a5bd6; --ok: #1d8a4e; --warn: #c27a00; --bad: #c8261f;
  --font: "Overpass", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Overpass Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e141b; --panel: #151d26; --fg: #e6ebf0; --muted: #93a1af; --line: #2a3542; --grid: #1d2732;
    --accent: #5c9bff; --ok: #3fbf74; --warn: #f0a92c; --bad: #ff5d52; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: var(--bg); color: var(--fg); font: 14px/1.35 var(--font); }
a { color: var(--accent); }

header { display: grid; gap: 6px; padding: 10px 16px 8px; background: var(--panel); border-bottom: 1px solid var(--line); }
h1 { margin: 0; font-size: 16px; font-weight: 800; }
h1 .home { color: var(--muted); text-decoration: none; font-weight: 600; }
h1 span { color: var(--muted); font-weight: 400; }
h1 b { font-weight: 800; color: var(--accent); }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: 13px; }
.controls select { font: inherit; padding: 3px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); }
.zoom { display: inline-flex; gap: 4px; }
.btn { font: 600 13px var(--font); padding: 4px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.status { color: var(--muted); font-variant-numeric: tabular-nums; }
.status.err { color: var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { display: inline-block; width: 18px; height: 4px; border-radius: 2px; }
.legend .thin { height: 1px; background: var(--fg); opacity: .6; }
.legend .thick { background: var(--fg); }
.legend .pred { background: var(--fg); opacity: .4; }

main { position: relative; min-height: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
main.dragging { cursor: grabbing; }
svg { display: block; width: 100%; height: 100%; }
svg text { font: 11px var(--font); fill: var(--muted); }
svg .st-major { font-weight: 800; fill: var(--fg); }
svg .grid-st { stroke: var(--grid); stroke-width: 1; }
svg .grid-st.major { stroke: var(--line); }
svg .grid-t { stroke: var(--grid); stroke-width: 1; }
svg .grid-t.hour { stroke: var(--line); }
svg .tick { font: 600 11px var(--mono); font-variant-numeric: tabular-nums; }
svg .now { stroke: var(--bad); stroke-width: 1.5; }
svg .now-label { font: 800 11px var(--mono); fill: var(--bad); }
svg .plan { fill: none; stroke-width: 1; opacity: .55; }
svg .plan.canceled { stroke-dasharray: 3 3; opacity: .45; }
svg .real { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
svg .real.pred { opacity: .4; }
svg .hit { fill: none; stroke: transparent; stroke-width: 12; pointer-events: stroke; cursor: pointer; }
svg .train { transition: opacity .15s; }
svg.has-sel .train { opacity: .18; }
svg.has-sel .train.sel { opacity: 1; }
svg .train.sel .plan { opacity: .9; stroke-width: 1.5; }
svg .train.sel .real { stroke-width: 4; }
svg .labelbg { fill: var(--panel); }
svg .empty { font-size: 14px; fill: var(--muted); }

.card { position: absolute; right: 12px; top: 12px; width: min(340px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow-y: auto; padding: 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 4px 18px rgba(0,0,0,.18); cursor: auto; user-select: text; -webkit-user-select: text; }
.card h2 { margin: 0 0 2px; font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.card .num { font: 800 12px var(--mono); color: #fff; padding: 2px 6px; border-radius: 5px; }
.card .meta { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.card table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.card th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; padding: 2px 4px; }
.card td { padding: 2px 4px; border-top: 1px solid var(--line); }
.card td.t { font-family: var(--mono); white-space: nowrap; }
.card .late { color: var(--warn); font-weight: 700; }
.card .vlate { color: var(--bad); font-weight: 700; }
.card .ok { color: var(--ok); }
.card .bad { color: var(--bad); }
.card .pass { color: var(--muted); }
.card .est { font-style: italic; }
.card .row { display: flex; gap: 6px; margin-top: 10px; }

footer { padding: 8px 16px; border-top: 1px solid var(--line); background: var(--panel); font-size: 11.5px; color: var(--muted); }
footer a { color: inherit; }

@media (max-width: 600px) {
  header { padding: 8px 10px 6px; }
  h1 { font-size: 14px; }
  h1 .home, h1 > span { display: none; }
  footer .hint { display: none; }
  .card { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 55%; }
}
