:root {
  color-scheme: light dark;
  --accent: #004c97;        /* FernUni-Blau */
  --accent-2: #4a90d9;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
  --bg: #ffffff;
  --card: #ffffff;
  --text: #1a1a1a;
  --border: #e2e4e8;
  --muted: #6b7280;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #5b9bd5;
    --accent-2: #6aa9e0;
    --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
    --bg: #14161a;
    --card: #1c1f26;
    --text: #e9ecf1;
    --border: #2c313b;
    --muted: #9aa3b2;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1rem 5rem;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}
a { color: var(--accent-2); }

/* Header */
.site-header { padding: 1.75rem 0 1rem; }
.logo-wrap {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: .9rem 1.1rem; display: inline-block; max-width: 100%;
}
.logo-wrap img { display: block; height: 22px; width: auto; max-width: 100%; }
h1 { font-size: 1.7rem; margin: 1.1rem 0 .25rem; letter-spacing: -0.02em; }
p.sub { color: var(--muted); margin-top: 0; font-size: .95rem; }
p.note {
  color: var(--muted); font-size: .82rem; margin: .6rem 0 0;
  background: var(--accent-soft); border-radius: 10px; padding: .6rem .75rem;
}
p.note strong { color: var(--text); }

/* Suche */
.search {
  width: 100%; padding: .75rem .9rem; border: 1px solid var(--border);
  border-radius: 12px; margin: 0 0 1.1rem; font-size: 1rem;
  background: var(--card); color: var(--text);
}
.search:focus { outline: none; border-color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--accent-soft); }

/* Modul-Karten */
.mod {
  border: 1px solid var(--border); border-radius: 16px; background: var(--card);
  margin-bottom: .7rem; overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.mod.active { border-color: var(--accent-2);
  box-shadow: 0 0 0 3px var(--accent-soft); }

.mod-head {
  display: flex; align-items: center; gap: .8rem;
  padding: .9rem 1rem; cursor: pointer; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.mod-head .toggle {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--accent-2); color: var(--accent-2);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.mod-head .toggle svg { display: block; }
.mod.active .mod-head .toggle {
  background: var(--accent-2); color: #fff; border-color: var(--accent-2);
}
.mod-head .info { flex: 1; min-width: 0; }
.mod-head .title { font-weight: 600; }
.mod-head .nr { color: var(--muted); font-size: .78rem; margin-top: .12rem;
  font-variant-numeric: tabular-nums; }

.mod-body { padding: 0 1rem; max-height: 0; overflow: hidden;
  transition: max-height .22s ease; }
.mod.active .mod-body { max-height: 6000px; padding-bottom: 1rem; }
.mod-body-inner { border-top: 1px solid var(--border); padding-top: .85rem; }

.field { margin-bottom: .7rem; }
.field label { display: block; font-size: .82rem; color: var(--muted);
  margin-bottom: .3rem; font-weight: 500; }
.field select {
  width: 100%; padding: .6rem .55rem; border: 1px solid var(--border);
  border-radius: 10px; font-size: 1rem; background: var(--card); color: var(--text);
}
.checkline { display: flex; align-items: center; gap: .55rem; margin: .2rem 0 .3rem;
  font-size: .95rem; cursor: pointer; }
.checkline input { width: 1.2rem; height: 1.2rem; accent-color: var(--accent-2); }

.actions { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: .9rem; }
.actions a {
  text-decoration: none; border-radius: 11px; padding: .6rem 1rem;
  font-size: .92rem; font-weight: 600; transition: opacity .15s;
}
.actions a:active { opacity: .7; }
.actions a.sub { background: var(--accent-2); color: #fff; }
.actions a.dl { border: 1px solid var(--accent-2); color: var(--accent-2); }

.count-hint { font-size: .8rem; color: var(--muted); margin-top: .6rem; }
.modlink { font-size: .8rem; margin-top: .55rem; }
.modlink a { color: var(--muted); }
.warn { color: #d9534f; font-size: .85rem; margin-top: .7rem; }

.termine { margin-top: .7rem; }
.termine summary {
  cursor: pointer; font-size: .85rem; color: var(--accent-2);
  font-weight: 600; list-style: none; padding: .3rem 0;
}
.termine summary::-webkit-details-marker { display: none; }
.termine summary::before { content: "▸ "; font-size: .7rem; }
.termine details[open] summary::before { content: "▾ "; }
.termine-head { font-size: .78rem; font-weight: 600; color: var(--muted);
  margin: .55rem 0 .2rem; }
.termine-list { list-style: none; margin: 0; padding: 0;
  font-size: .82rem; font-variant-numeric: tabular-nums; }
.termine-list li { padding: .2rem 0; border-bottom: 1px solid var(--border);
  color: var(--text); }
.termine-list li:last-child { border-bottom: none; }

.empty { color: var(--muted); text-align: center; padding: 2rem 1rem; }
footer { margin-top: 2rem; font-size: .78rem; color: var(--muted);
  text-align: center; display: flex; flex-direction: column; gap: .25rem; }
.disclaimer { opacity: .8; }
.madewith { opacity: .8; margin-top: .15rem; }

/* ---- Builder-Prototyp ---- */

body { padding-bottom: 8rem; }  /* Platz für fixe Bar unten */

.bottom-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  max-width: 640px; margin: 0 auto;
  background: var(--card); border-top: 1px solid var(--border);
  box-shadow: 0 -6px 20px color-mix(in srgb, #000 14%, transparent);
  padding-bottom: env(safe-area-inset-bottom);
}

.collisions { border-bottom: 1px solid var(--border); }
.collisions.hidden { display: none; }
.collisions.neutral, .collisions.ok, .collisions.bad { }
.col-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; padding: .6rem 1rem; font-size: .9rem;
}
.collisions.bad .col-bar { cursor: pointer; }
.col-status { font-weight: 700; }
.col-hint { color: var(--muted); font-size: .8rem; }
.col-chevron { color: #d9534f; font-weight: 700; }
.collisions.ok { background: color-mix(in srgb, #2e9e5b 12%, transparent); }
.collisions.bad { background: color-mix(in srgb, #d9534f 12%, transparent); }

/* ausklappbare Konfliktliste nach oben (scrollt bei vielen Konflikten) */
.col-body { max-height: 0; overflow: hidden; transition: max-height .2s ease; }
.collisions.bad.open .col-body { max-height: 55vh; overflow-y: auto;
  padding: 0 1rem .8rem; }

/* Konflikt-Timeline je Tag */
.tl-day { padding: .7rem 0; border-bottom: 1px solid var(--border); }
.tl-day:last-child { border-bottom: none; }
.tl-date { font-weight: 700; font-size: .82rem; margin-bottom: .5rem;
  font-variant-numeric: tabular-nums; }
.tl-chart { position: relative; }
.tl-axis { position: relative; height: 14px; margin-left: 38%; }
.tl-tick { position: absolute; top: 0; transform: translateX(-50%);
  font-size: .68rem; color: var(--muted); }
.tl-tick::after { content: ""; position: absolute; left: 50%; top: 14px;
  width: 1px; height: 6px; background: var(--border); }
.tl-row { display: flex; align-items: center; gap: .5rem; margin: .28rem 0;
  position: relative; z-index: 1; }
.tl-label { width: 38%; flex: none; font-size: .74rem; line-height: 1.2;
  color: var(--text); padding-right: .4rem; }
.tl-track { position: relative; flex: 1; height: 22px;
  background: color-mix(in srgb, var(--border) 35%, transparent);
  border-radius: 6px; }
.tl-bar { position: absolute; top: 0; height: 22px; border-radius: 6px;
  min-width: 3px; display: flex; align-items: center; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.tl-bar span { color: #fff; font-size: .68rem; font-weight: 600;
  padding: 0 .35rem; white-space: nowrap; }

.confirm-bar {
  display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem;
}
.confirm-count { font-size: .82rem; color: var(--muted); flex: none; }
.confirm-btn {
  flex: 1; background: var(--accent-2); color: #fff; border: none;
  padding: .8rem 1rem; border-radius: 11px; font-size: .95rem; font-weight: 700;
  cursor: pointer;
}
.confirm-btn:disabled { opacity: .45; cursor: not-allowed; }

#result:not(:empty) {
  border: 1px solid var(--accent-2); border-radius: 14px; padding: 1rem;
  margin: 1rem 0; background: var(--accent-soft);
}
.result-head { font-weight: 700; font-size: 1.05rem; }
.result-sub { color: var(--muted); font-size: .85rem; margin: .2rem 0 .8rem; }
.sub-item { display: flex; align-items: center; gap: .75rem; padding: .6rem 0;
  border-top: 1px solid var(--border); }
.sub-item:first-of-type { border-top: none; }
.sub-info { flex: 1; min-width: 0; }
.sub-title { font-weight: 600; }
.sub-meta { font-size: .8rem; color: var(--muted); margin-top: .1rem; }
.sub-btn { flex: none; background: var(--accent-2); color: #fff;
  text-decoration: none; padding: .55rem .9rem; border-radius: 10px;
  font-size: .9rem; font-weight: 600; }

/* Mehrfach-AG-Checkboxen (Beta) */
.hint-inline { font-weight: 400; color: var(--muted); font-size: .8em; }

/* AG-Toggle-Chips (Buttons nebeneinander) */
.ag-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .7rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  font-size: .9rem; font-family: inherit; transition: all .12s;
  -webkit-tap-highlight-color: transparent;
}
.chip:active { transform: scale(.96); }
.chip .chip-count {
  font-size: .72rem; color: var(--muted);
  background: color-mix(in srgb, var(--border) 45%, transparent);
  border-radius: 999px; padding: .05rem .4rem; font-variant-numeric: tabular-nums;
}
.chip.on {
  background: var(--accent-2); border-color: var(--accent-2); color: #fff;
}
.chip.on .chip-count { color: #fff; background: rgba(255,255,255,.25); }
