/* Bandelay Web – schlichtes Layout, hell und dunkel, ohne Fremdbibliotheken. */
:root {
  --bg: #f5f5f7; --surface: #fff; --surface-2: #f0f0f3; --text: #1d1d1f; --muted: #6e6e73; --line: #d2d2d7;
  --accent: #1c5cab; --red: #d70015; --warn: #b25000; --radius: 12px;
  /* Diagramme (geprüft mit dem dataviz-Validator gegen #fff bzw. #2c2c2e) */
  --series-1: #2a78d6; --series-2: #eb6834; --grid: #e5e5ea; --axis: #6e6e73;
  /* Heatmap: eine Farbe, hell → dunkel = wenig → viel Verspätung */
  --heat-0: #cde2fb; --heat-1: #9ec5f4; --heat-2: #6da7ec; --heat-3: #3987e5; --heat-4: #256abf; --heat-5: #104281; --heat-none: #ededf0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1e; --surface: #2c2c2e; --surface-2: #3a3a3c; --text: #f5f5f7; --muted: #98989d; --line: #3a3a3c;
    --accent: #6da7ec; --red: #ff453a; --warn: #ff9f0a;
    --series-1: #3987e5; --series-2: #d95926; --grid: #3a3a3c; --axis: #98989d;
    /* Im Dunkeln: wenig Verspätung nah an der Fläche, viel Verspätung hell */
    --heat-0: #173052; --heat-1: #184f95; --heat-2: #256abf; --heat-3: #3987e5; --heat-4: #6da7ec; --heat-5: #b7d3f6; --heat-none: #353537;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .2rem 0 .6rem; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.strong { font-weight: 600; }
.error { color: var(--red); }
.notice { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border-radius: 10px; padding: .6rem .9rem; }
button, .button, input, select, textarea {
  font: inherit; color: inherit; border: 1px solid var(--line); background: var(--surface);
  border-radius: 8px; padding: .4rem .75rem;
}
button, .button { cursor: pointer; display: inline-block; }
button:hover, .button:hover { border-color: var(--accent); text-decoration: none; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.link { border: 0; background: none; color: var(--accent); padding: 0 .3rem; }
button.danger { color: var(--red); }
.card { background: var(--surface); border-radius: var(--radius); padding: 1rem 1.2rem; box-shadow: 0 1px 3px rgb(0 0 0 / .08); margin-bottom: 1rem; }
main { max-width: 72rem; margin: 0 auto; padding: 1rem 1.2rem 2rem; }
main.narrow { max-width: 46rem; }
form.inline, .actions form { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.stack { display: grid; gap: .7rem; }
.stack label, .search-form label { display: grid; gap: .25rem; }
.search-form { display: flex; flex-wrap: wrap; gap: .7rem; align-items: end; }
.search-form label { flex: 1 1 12rem; }
.danger-zone { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.scroll { overflow-x: auto; }
.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr)); gap: 0 1rem; }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.badge { font-size: .72rem; border-radius: 6px; padding: .05rem .4rem; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.warn { border-color: var(--warn); color: var(--warn); }
.badge.warn::before { content: "⚠︎ "; }

/* Kopfzeile */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.2rem; padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand img { width: 1.9rem; height: 1.9rem; display: block; }
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; background: var(--bg); border-radius: 9px; padding: 3px; }
.tabs a { padding: .25rem .8rem; border-radius: 7px; color: var(--text); border: 2px solid transparent; }
.tabs a:hover { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); text-decoration: none; }
.tabs a[aria-current] { background: var(--surface); border-color: var(--accent); font-weight: 600; }
.topbar-end { display: flex; align-items: center; gap: 1rem; margin-left: auto; }
.account-menu { position: relative; }
.account-menu summary { cursor: pointer; list-style: none; }
.account-menu .menu { position: absolute; right: 0; top: 1.8rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .5rem; display: grid; gap: .4rem; min-width: 11rem; }
.account-menu .menu button { width: 100%; text-align: left; }
.footer { color: var(--muted); font-size: .8rem; text-align: center; padding: 1.5rem; }

/* Kopf einer Seite mit Auswahl */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .6rem 1rem; margin-bottom: .6rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.segmented { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.segmented a { padding: .2rem .65rem; border-radius: 7px; color: var(--text); font-size: .9rem; white-space: nowrap; }
.segmented a:hover { text-decoration: none; background: var(--surface-2); }
.segmented a[aria-current] { background: var(--accent); color: #fff; }

/* Kennzahlen */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.tile { background: var(--surface); border-radius: var(--radius); padding: .8rem 1rem; box-shadow: 0 1px 3px rgb(0 0 0 / .08); }
.tile-label { color: var(--muted); font-size: .85rem; }
.tile-value { font-size: 1.5rem; font-weight: 600; font-variant-numeric: proportional-nums; }
.tile.hero .tile-value { font-size: 3rem; line-height: 1.1; }
.tile.hero { grid-column: span 2; }

/* Tabellen */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .35rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: .85rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.compact td, table.compact th { padding: .2rem .35rem; font-size: .8rem; }
.late { color: var(--red); }
.table-view { margin-top: .6rem; }
.table-view summary { cursor: pointer; color: var(--accent); font-size: .85rem; }

/* Diagramme */
.chart-wrap { width: 100%; overflow-x: auto; }
svg.chart { width: 100%; height: auto; display: block; min-width: 32rem; font-family: inherit; }
svg.chart .grid { stroke: var(--grid); stroke-width: 1; }
svg.chart .axis { fill: var(--axis); font-size: 11px; }
svg.chart .value { fill: var(--text); font-size: 11px; font-variant-numeric: tabular-nums; }
svg.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .line.series-1 { stroke: var(--series-1); }
svg.chart .line.series-2 { stroke: var(--series-2); }
svg.chart .dot { stroke: var(--surface); stroke-width: 2; }
svg.chart .dot.series-1, svg.chart .fill.series-1 { fill: var(--series-1); }
svg.chart .dot.series-2 { fill: var(--series-2); }
svg.chart .hit { fill: transparent; }
svg.chart .hit:hover { fill: color-mix(in srgb, var(--text) 6%, transparent); }
svg.chart rect[class^="heat"] { stroke: transparent; stroke-width: 2; }
svg.chart rect[class^="heat"]:hover { stroke: var(--text); }
.heat-0 { fill: var(--heat-0); background: var(--heat-0); } .heat-1 { fill: var(--heat-1); background: var(--heat-1); }
.heat-2 { fill: var(--heat-2); background: var(--heat-2); } .heat-3 { fill: var(--heat-3); background: var(--heat-3); }
.heat-4 { fill: var(--heat-4); background: var(--heat-4); } .heat-5 { fill: var(--heat-5); background: var(--heat-5); }
.heat-none { fill: var(--heat-none); background: var(--heat-none); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem 1rem; padding: 0; margin: .5rem 0 0; font-size: .85rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: .35rem; }
.swatch { display: inline-block; width: .9rem; height: .9rem; border-radius: 3px; }
.key { display: inline-block; width: 1.1rem; height: 2px; border-radius: 1px; }
.key.series-1 { background: var(--series-1); } .key.series-2 { background: var(--series-2); }
.chart-empty { padding: 1.5rem 0; }

/* Reisen */
.result .facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .6rem; margin: 0 0 .6rem; }
.result dt { color: var(--muted); font-size: .85rem; }
.result dd { margin: 0; font-size: 1.15rem; font-weight: 600; }
.result dd.big { font-size: 2rem; }
.result-late dd.big { color: var(--red); }
table.legs tr.replacement td { background: color-mix(in srgb, var(--series-2) 7%, transparent); }
table.legs tr.transfer td { color: var(--muted); font-size: .85rem; border-bottom: 1px solid var(--line); padding-left: 1.5rem; }
.departures { display: grid; gap: .5rem; }
.departure { margin: 0; padding: .6rem 1rem; }
.departure summary { cursor: pointer; }
.dep-time { font-variant-numeric: tabular-nums; font-weight: 600; margin-right: .3rem; }
.stop-buttons { display: flex; flex-wrap: wrap; gap: .35rem; }
.stop-buttons form { display: inline; }
.prose p { max-width: 42rem; }

/* Anmeldung */
.centered { display: grid; place-items: center; min-height: 100vh; }
.login { display: grid; gap: .8rem; width: min(24rem, 92vw); }
.login label { display: grid; gap: .3rem; }
.login h1 { display: flex; align-items: center; gap: .5rem; }
.login-icon { width: 2.2rem; height: 2.2rem; }
main.narrow > form.card:only-child { display: grid; gap: .8rem; }
main.narrow > form.card:only-child label { display: grid; gap: .3rem; }

/* Beleg zum Drucken */
body.receipt { background: #fff; color: #000; max-width: 52rem; margin: 0 auto; padding: 1.5rem; }
body.receipt a { color: #000; }
.receipt-table { margin-bottom: 1rem; }
.receipt-table th, .receipt-table td { border-bottom: 1px solid #ccc; color: #000; }
.receipt-table th { width: 16rem; }
@media print {
  .no-print { display: none; }
  body.receipt { padding: 0; }
  h2 { break-after: avoid; }
  table { break-inside: auto; }
  tr { break-inside: avoid; }
}

@media (max-width: 760px) {
  .tile.hero { grid-column: span 1; }
  .tile.hero .tile-value { font-size: 2.2rem; }
  main { padding: .8rem; }
}
tr.subhead th { color: var(--text); font-weight: 600; font-size: .95rem; padding-top: 1rem; }
