:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --text: #1d1d1b;
  --muted: #6b6b66;
  --line: #deded9;
  --accent: #1f5fa8;
  --warn: #b3261e;
  --note: #8a5a00;
  --ok: #2e7d32;
  --row-hover: #eef3fa;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --panel: #1f1f1d;
    --text: #ebebe6;
    --muted: #9a9a93;
    --line: #34342f;
    --accent: #7fb0ec;
    --warn: #ff8a80;
    --note: #e0b450;
    --ok: #81c784;
    --row-hover: #26303d;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif;
}
header {
  flex: none;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 8px 16px 0;
}
h1 { font-size: 16px; margin: 0 8px 0 0; }
h2 { font-size: 14px; margin: 16px 0 6px; }
.controls { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
select, input, button {
  font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px;
}
button { cursor: pointer; }
nav { display: flex; gap: 2px; margin-top: 6px; overflow-x: auto; }
nav button {
  border: none; border-bottom: 2px solid transparent; border-radius: 0;
  background: none; padding: 6px 10px; white-space: nowrap;
}
nav button.active { border-bottom-color: var(--accent); color: var(--accent); }
main { flex: 1; min-height: 0; overflow: auto; padding: 8px 16px 16px; }
.tab { display: none; }
.tab.active { display: block; }
/* Single-table tabs: the table scrolls, header row stays visible. */
.tab.fill.active { display: flex; flex-direction: column; height: 100%; }
.tab.fill .scroll { flex: 1; min-height: 0; overflow: auto; }
.hint { color: var(--muted); max-width: 90ch; margin: 4px 0 8px; font-size: 12px; }
.scroll { overflow-x: auto; }
table {
  border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); min-width: 100%;
}
th, td {
  padding: 3px 6px; border-bottom: 1px solid var(--line);
  text-align: left; vertical-align: top; white-space: nowrap;
}
td.wrap { white-space: normal; min-width: 22ch; max-width: 48ch; }
th {
  position: sticky; top: 0; z-index: 1;
  background: var(--panel); font-weight: 600;
  box-shadow: inset 0 -1px var(--line);
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--row-hover); }
.tag {
  display: inline-block; padding: 0 6px; margin: 1px 2px 1px 0;
  border-radius: 4px; font-size: 12px; border: 1px solid currentColor;
}
.tag.Ausfall, .tag.Verschwunden { color: var(--warn); }
.tag.Extrazug, .tag.Zielwechsel, .tag.Gleisabweichung,
.tag.Gleiswechsel, .tag.Verspätung { color: var(--note); }
.bad { color: var(--warn); }
.good { color: var(--ok); }
.muted { color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.inline { display: inline-flex; gap: 6px; align-items: center; }
.flagline { display: block; }
.flagline + .flagline { margin-top: 2px; }
#delay-min { width: 5em; }
input[type=search] { width: min(100%, 360px); margin-bottom: 6px; }
.t { font-variant-numeric: tabular-nums; margin-right: 4px; }
.differs { color: var(--note); }
dialog {
  width: min(1100px, 96vw); max-height: 92vh; padding: 16px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
}
dialog::backdrop { background: rgb(0 0 0 / .4); }
dialog .close {
  float: right; font-size: 20px; line-height: 1; border: none; background: none;
}
dl.meta {
  display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px;
}
dl.meta dt { color: var(--muted); }
dl.meta dd { margin: 0; }
details { margin-top: 12px; }
pre {
  background: var(--bg); padding: 8px; border-radius: 6px;
  overflow: auto; max-height: 50vh; font-size: 12px;
}
