:root {
  --bg: #f4f5f7; --card: #fff; --text: #14161a; --muted: #6a7078; --line: #e3e5e9;
  --accent: #0b5fff; --accent-ink: #fff; --chip: #e9ecf2; --ok: #1a7f37; --warn: #b54708; --live: #d92d20;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f12; --card: #171a1f; --text: #eceff4; --muted: #98a0ab; --line: #262b33;
    --accent: #5b8cff; --accent-ink: #0d0f12; --chip: #222831; --ok: #4cc26b; --warn: #f0a04b; --live: #ff6b5e;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: var(--accent); }
main { max-width: 640px; margin: 0 auto; padding: 8px 16px 24px; }

.top {
  position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: calc(10px + env(safe-area-inset-top)) 16px 8px; border-bottom: 1px solid var(--line);
}
.top h1 { margin: 0 0 8px; font-size: 1.35rem; max-width: 640px; margin-inline: auto; }
.chips { display: flex; gap: 8px; overflow-x: auto; max-width: 640px; margin: 0 auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 7px 13px; border-radius: 999px; background: var(--chip); color: var(--text);
  text-decoration: none; font-size: .9rem; white-space: nowrap;
}
.chip.on { background: var(--accent); color: var(--accent-ink); }

.day { margin: 22px 0 8px; font-size: .85rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.card {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 8px 12px 12px; margin-bottom: 10px;
}
.card.finished { opacity: .96; }
.card.cancelled h3 { text-decoration: line-through; }
.when { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.when .t { font-weight: 650; }
.when .d { font-size: .8rem; color: var(--muted); }
.what h3 { margin: 0; font-size: 1.02rem; line-height: 1.3; }
.what h3 a { color: inherit; text-decoration: none; }
.meta { margin: 5px 0 0; display: flex; flex-wrap: wrap; gap: 5px 6px; align-items: center; font-size: .82rem; color: var(--muted); }
.tag { background: var(--chip); color: var(--text); border-radius: 6px; padding: 1px 7px; }
.tag.alt { background: transparent; border: 1px solid var(--line); }
.tag.live { background: var(--live); color: #fff; }
.tag.warn { background: var(--warn); color: #fff; }
.outcome { margin: 6px 0 0; font-size: .95rem; }
.muted { color: var(--muted); font-weight: 400; }
.why { margin: 6px 0 0; font-size: .75rem; color: var(--muted); }
.ghost { background: none; border: 0; color: var(--muted); font-size: 1.05rem; padding: 6px 10px; cursor: pointer; border-radius: 8px; }
.ghost:hover { background: var(--chip); }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }

.tabs {
  position: fixed; inset: auto 0 0 0; display: flex; justify-content: center; gap: 4px;
  background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); z-index: 20;
}
.tabs a {
  flex: 1; max-width: 200px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: .72rem;
}
.tabs a span { font-size: 1.25rem; line-height: 1; }
.tabs a[aria-current="page"] { color: var(--accent); font-weight: 600; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.panel h2 { margin: 0 0 8px; font-size: 1rem; }
.source { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.source.off { opacity: .55; }
.err { color: var(--live); font-size: .85rem; word-break: break-word; }
.btn { font: inherit; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--chip); color: var(--text); cursor: pointer; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; margin-top: 8px; }
input.copy { width: 100%; font: .8rem ui-monospace, monospace; padding: 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.back { margin: 8px 0; }

.login { max-width: 360px; margin: 18vh auto 0; display: grid; gap: 14px; }
.login h1 { margin: 0 0 6px; }
.login label { display: grid; gap: 4px; font-size: .9rem; color: var(--muted); }
.login input { font: inherit; padding: 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.login .btn { width: 100%; padding: 12px; margin-top: 4px; }

/* Filter-Editor */
.notice { background: color-mix(in srgb, var(--ok) 14%, var(--card)); border: 1px solid var(--ok); border-radius: 10px; padding: 9px 12px; margin: 12px 0; }
.intro, .hint { color: var(--muted); font-size: .9rem; margin: 10px 0; }
.linkbtn { display: inline-block; text-decoration: none; font: inherit; }
.btn.primary.linkbtn { margin-top: 0; color: var(--accent-ink); }
.btn.danger { background: var(--live); color: #fff; border-color: transparent; }
.card.pick { display: block; text-decoration: none; color: inherit; }
.card.pick h3 { margin: 0; }
.scopeline { margin: 8px 0 14px; }
.rule-form fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 12px; margin: 12px 0; background: var(--card); }
.rule-form legend { padding: 0 6px; font-weight: 600; font-size: .95rem; }
.field { display: grid; gap: 4px; font-size: .88rem; color: var(--muted); margin: 8px 0; }
.field input { font: inherit; color: var(--text); padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.check { display: inline-flex; cursor: pointer; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check span { padding: 7px 12px; border-radius: 999px; background: var(--chip); border: 1px solid transparent; font-size: .9rem; }
.check small { color: var(--muted); margin-left: 4px; }
.check input:checked + span { background: var(--accent); color: var(--accent-ink); }
.check input:checked + span small { color: inherit; opacity: .8; }
.check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.check.on-off { margin: 14px 0 6px; }
.actions { display: flex; gap: 10px; align-items: center; margin: 14px 0; }
.actions .btn.primary { margin-top: 0; }
.delete-form { margin: 26px 0 8px; }
code { font-size: .85em; }

/* Kompakte Regelliste: eine Zeile pro Regel, Schalter rechts */
.rules { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.rule { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--line); }
.rule:first-child { border-top: 0; }
.rtext { flex: 1; min-width: 0; line-height: 1.3; }
.rule.off .rtext { opacity: .55; }
.rname { font-weight: 600; color: var(--text); text-decoration: none; }
.rname::after { content: ""; position: absolute; inset: 0; } /* ganze Zeile ist antippbar */
.rscope { color: var(--muted); font-size: .85rem; }
.rsub { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 1px; color: var(--muted); font-size: .84rem; }
.rule form { position: relative; z-index: 1; margin: 0; }
.switch { position: relative; flex: none; width: 46px; height: 28px; padding: 0; border: 0; border-radius: 999px; background: var(--line); cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.35); transition: transform .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(18px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hits { white-space: nowrap; }
