:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --card: #ffffff;
  --flaeche: #f8f9fa;
  --fg: #212529;
  /* Bootstraps #6c757d kommt auf der Kopfzeilenflaeche nur auf 4,45:1,
     eine Spur dunkler reicht fuer 4,5:1 und aendert optisch nichts. */
  --muted: #696f76;
  --line: #dee2e6;
  --kopf: #212529;
  /* Das Cyan von 50ohm.de traegt als Flaeche, aber nicht als Text: auf Weiss
     kommt es nur auf 2,6:1. Fuer Text deshalb die dunklere Variante. */
  --accent: #00adef;
  --accent-text: #036c93;
  --accent-soft: #d2f3ff;
  --auf-accent: #04303f;
  --ok-bg: #e3f5ee;
  --ok-fg: #1d7a56;
  --warn-bg: #fff3cd;
  --warn-fg: #664d03;
  --warn-line: #ffe69c;
  --bad: #b02a37;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --card: #1c2024;
    --flaeche: #22272b;
    --fg: #e9ecef;
    --muted: #9aa3ab;
    --line: #343a40;
    /* Hell: dunkler Balken gegen hellen Inhalt. Dunkel geht das nicht auf,
       da wirkt dunkler als der Grund wie ein Loch. Erhoehte Flaechen sind
       im Dunkelmodus heller, nicht dunkler. */
    --kopf: #262c31;
    --accent: #00adef;
    --accent-text: #4fc9f5;
    --accent-soft: #0b3a4d;
    --auf-accent: #04303f;
    --ok-bg: #10352a;
    --ok-fg: #5fd0a3;
    --warn-bg: #3a2f14;
    --warn-fg: #f0d492;
    --warn-line: #6b5620;
    --bad: #ff8078;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 1.25rem 4rem;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.head, main, footer { max-width: 62rem; margin: 0 auto; }

/* Die Leiste laeuft ueber die volle Breite und hebt das body-Padding auf,
   der Inhalt darin bleibt auf derselben Achse wie der Rest der Seite. */
/* Der Fussabstand faellt mit dem Kopfabstand des naechsten Elements zusammen
   statt sich zu addieren, deshalb steht hier 2rem und nicht bei jedem der
   moeglichen ersten Elemente (Warnbalken, Werkzeugleiste, Rechtstext). */
.topbar { background: var(--kopf); margin: 0 -1.25rem 2rem; padding: 0 1.25rem;
          border-bottom: 1px solid var(--line); }
.head { padding: 2.5rem 0 2rem; color: #ffffff; }
.head .sub, .head .stamp { color: #adb5bd; }
.head a { color: #6fd2f7; }
h1 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.4rem); letter-spacing: -0.02em; }
.sub { margin: .6rem 0 0; color: var(--muted); max-width: 44rem; }
.stamp { margin: 1rem 0 0; font-size: .85rem; color: var(--muted); }

section { margin: 2.75rem 0; }
h2 { font-size: 1.15rem; margin: 0 0 1rem; display: flex; align-items: baseline; gap: .6rem; }
h3 { font-size: 1rem; margin: 1.5rem 0 .4rem; }
.count { font-weight: 400; font-size: .85rem; color: var(--muted); }

.call {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .04em;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 5px;
  padding: .12rem .45rem;
}

.title { margin: 0; }

.dok { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.alert {
  background: var(--warn-bg);
  color: var(--warn-fg);
  border: 1px solid var(--warn-line);
  border-radius: 8px;
  padding: .8rem 1rem;
  margin-top: 2rem;
  font-size: .9rem;
}

.note { border-top: 1px solid var(--line); padding-top: 2rem; }
.note p { max-width: 46rem; }
.links { padding-left: 1.1rem; }
.links li { margin: .3rem 0; }

a { color: var(--accent-text); }

footer {
  border-top: 1px solid var(--line);
  padding-top: 1.5rem;
  font-size: .82rem;
  color: var(--muted);
}
footer p { margin: .35rem 0; }

.lead { color: var(--muted); font-size: .9rem; margin: -.4rem 0 1rem; max-width: 46rem; }
.meta .ok { color: var(--ok-fg); }
.meta .pending { color: var(--warn-fg); }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--card); }

table { border-collapse: collapse; width: 100%; font-size: .92rem; }
th, td { text-align: left; padding: .6rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600;
     position: sticky; top: 0; background: var(--flaeche); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.zugeteilt { color: var(--muted); }
.nowrap { white-space: nowrap; }

.call { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
        font-size: 1rem; font-weight: 600; letter-spacing: .04em; color: var(--fg); }
.dok { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: nowrap; }

.badge { display: inline-block; white-space: nowrap; font-size: .78rem; font-weight: 600;
         border-radius: 999px; padding: .1rem .55rem; }
.badge.aktiv { background: var(--ok-bg); color: var(--ok-fg); }
.badge.bald { background: var(--warn-bg); color: var(--warn-fg); }
.badge.zugeteilt { background: transparent; color: var(--muted); border: 1px solid var(--line); }

.flag { display: block; font-size: .72rem; color: var(--warn-fg); }
/* Untereinander statt nebeneinander: mit der Spalte "Gearbeitet" wird die
   Tabelle sonst breiter als die Seite. padding-left ueberschreibt die
   Einrueckung, die .links fuer die Linkliste im Infoteil setzt. */
td.links { white-space: nowrap; padding-left: .6rem; }
td.links a { display: block; font-size: .85rem; }
td.links a + a { margin-top: .3rem; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; margin-bottom: 1rem; }
.toolbar input {
  flex: 1 1 18rem; min-width: 0;
  padding: .5rem .75rem; font: inherit; font-size: .92rem;
  color: var(--fg); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px;
}
.toolbar input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.toolbar button {
  padding: .5rem .8rem; font: inherit; font-size: .85rem; cursor: pointer;
  color: var(--fg); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px;
}
.toolbar button:hover { border-color: var(--accent); color: var(--accent-text); }
.hits { font-size: .85rem; color: var(--muted); white-space: nowrap; }

th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--fg); }
th.sortable::after { content: "↕"; opacity: .35; margin-left: .35rem; }
th.sortable.asc::after { content: "↑"; opacity: 1; color: var(--accent-text); }
th.sortable.desc::after { content: "↓"; opacity: 1; color: var(--accent-text); }

.badge.neu { background: var(--accent); color: var(--auf-accent); margin-left: .4rem; }

.alert.stale {
  background: transparent;
  border-color: var(--bad);
  color: var(--bad);
  font-weight: 600;
}

tbody tr.abgelaufen { color: var(--muted); }
tbody tr.abgelaufen .call { text-decoration: line-through; text-decoration-thickness: 1px; }
.badge.abgelaufen { background: transparent; color: var(--muted); border: 1px dashed var(--line); }

th.sortable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.legal { max-width: 44rem; }
.legal section { margin: 2rem 0; }
.legal h2 { font-size: 1.05rem; margin-bottom: .5rem; }
.legal p { margin: .6rem 0; }
.legal code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }

/* Wavelog-Abfrage. Die Spalte bleibt verborgen, solange kein Zugang
   eingetragen ist, damit die Seite fuer alle anderen unveraendert aussieht. */
#tbl:not(.wl-on) .wl { display: none; }

.wl-status { font-size: .85rem; color: var(--muted); margin: -.5rem 0 1rem; }
.wl-status button { font: inherit; font-size: .85rem; cursor: pointer; margin-left: .5rem;
                    padding: .1rem .5rem; color: var(--fg); background: var(--card);
                    border: 1px solid var(--line); border-radius: 6px; }
.wl-status button:hover { border-color: var(--accent); color: var(--accent-text); }

.worked { display: flex; flex-wrap: wrap; gap: .25rem; }
.worked .badge { background: var(--accent-soft); color: var(--accent-text); font-weight: 500;
                 font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
                 font-size: .72rem; }
.worked-no { color: var(--muted); font-size: .85rem; }
.worked-err { color: var(--bad); font-size: .85rem; }

.wl-dlg {
  max-width: 34rem; width: calc(100vw - 2.5rem);
  color: var(--fg); background: var(--card);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 1.5rem;
}
.wl-dlg::backdrop { background: rgba(0, 0, 0, .45); }
.wl-dlg h2 { margin-top: 0; }
.wl-dlg .lead { margin-top: 0; }
.wl-dlg label { display: block; margin: 1rem 0 .3rem; font-size: .85rem; font-weight: 600; }
.wl-dlg input {
  width: 100%; padding: .5rem .75rem; font: inherit; font-size: .92rem;
  color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
}
.wl-dlg input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.hint { font-size: .8rem; color: var(--muted); margin: .5rem 0 0; }
.hint code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.wl-msg { font-size: .85rem; border-radius: 8px; padding: .6rem .8rem; margin: 1rem 0 0;
          background: var(--accent-soft); color: var(--accent-text); }
.wl-msg.bad { background: var(--warn-bg); color: var(--warn-fg); }

.wl-btns { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem; }
.wl-btns button {
  padding: .5rem .8rem; font: inherit; font-size: .85rem; cursor: pointer;
  color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
}
.wl-btns button:hover { border-color: var(--accent); color: var(--accent-text); }
/* Die eigentliche Aktion des Dialogs, deshalb als einzige gefuellt. */
#wl-save { background: var(--accent); border-color: var(--accent); color: var(--auf-accent); font-weight: 600; }
