/* Tidenplaner – schlichtes Layout, hell und dunkel, ohne Fremdbibliotheken (Grundgerüst wie BanDelay). */
:root {
  --bg: #f3f6f8; --surface: #fff; --surface-2: #eef2f5; --text: #1d1d1f; --muted: #636369; --line: #d2d7dc;
  --accent: #0e6e8c; --high: #0b5d78; --red: #c4000f; --warn: #a04800; --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15191c; --surface: #23292e; --surface-2: #2f363c; --text: #f2f4f5; --muted: #9aa2a8; --line: #39424a;
    --accent: #5cc0de; --high: #8fd6ec; --red: #ff6b61; --warn: #ffab40;
  }
}
* { 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.5rem; margin: .2rem 0 .6rem; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
code { background: var(--surface-2); border-radius: 4px; padding: 0 .25rem; }
.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; }
.notice.warn { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
button, .button, input, select {
  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; }
@media (prefers-color-scheme: dark) { .primary { color: #0b1215; } }
button.link { border: 0; background: none; color: var(--accent); padding: 0 .3rem; }
.danger, button.link.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: 64rem; margin: 0 auto; padding: 1rem 1.2rem 2rem; }
main.narrow { max-width: 40rem; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.actions form, form.rename { display: inline; }
.stack { display: grid; gap: .8rem; }
.stack label { display: grid; gap: .25rem; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem .8rem; margin: 0; display: grid; gap: .6rem; }
legend { color: var(--muted); font-size: .9rem; padding: 0 .3rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
@media (max-width: 30rem) { .pair { grid-template-columns: 1fr; } }
.radios { display: flex; flex-wrap: wrap; gap: 1rem; }
.stack label.radio { display: flex; align-items: center; gap: .4rem; }
.search-form { display: flex; flex-wrap: wrap; gap: .7rem; align-items: end; }
.search-form label { display: grid; gap: .25rem; flex: 1 1 10rem; }
.danger-zone { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.scroll { overflow-x: auto; }
.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); }

/* 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; }

/* Seitenkopf mit Tageswechsel */
.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; }
.segmented { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.segmented a { padding: .25rem .7rem; 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; }

/* Tabellen */
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead 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; }
td.rule { white-space: nowrap; font-variant-numeric: tabular-nums; }
.departure { white-space: nowrap; }
.departure .time { font-size: 1.25rem; font-weight: 650; font-variant-numeric: tabular-nums; }
table.tides th { font-weight: 500; white-space: nowrap; width: 1%; padding-right: 1rem; }
.tide { display: inline-block; margin-right: 1.1rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tide b { display: inline-block; min-width: 1.8rem; color: var(--muted); font-weight: 600; }
.tide.high b { color: var(--high); }

/* Schmale Bildschirme: jede Route als Kachel – links Route und Regel, rechts die Abfahrten. */
@media (max-width: 40rem) {
  main { padding: .8rem .7rem 2rem; }
  .card { padding: .8rem .9rem; }
  table.departures thead { display: none; }
  table.departures tr { display: grid; grid-template-columns: 1fr auto; column-gap: .8rem; border-bottom: 1px solid var(--line); padding: .5rem 0; }
  table.departures td { border: 0; padding: 0; }
  table.departures td:first-child { grid-column: 1; }
  table.departures td.rule { grid-column: 1; grid-row: 2; color: var(--muted); font-size: .9rem; white-space: normal; }
  table.departures td:last-child { grid-column: 2; grid-row: 1 / span 2; text-align: right; }
  .departure .muted { display: block; margin-top: -.2rem; }
  table.tides tr { display: grid; }
  table.tides th, table.tides td { border: 0; padding: .1rem 0; }
  table.tides tr { border-bottom: 1px solid var(--line); padding: .35rem 0; }
}
