/* Schrift wie in der Moses-Webapp (Noto Sans, lokal ausgeliefert, Latin-Subset) */
@font-face { font-family: "Noto Sans"; src: url("fonts/NotoSans-Regular.woff2") format("woff2"); font-weight: normal; font-style: normal; font-display: swap; }
@font-face { font-family: "Noto Sans"; src: url("fonts/NotoSans-Bold.woff2") format("woff2"); font-weight: bold; font-style: normal; font-display: swap; }
@font-face { font-family: "Noto Sans"; src: url("fonts/NotoSans-Italic.woff2") format("woff2"); font-weight: normal; font-style: italic; font-display: swap; }
@font-face { font-family: "Noto Sans"; src: url("fonts/NotoSans-BoldItalic.woff2") format("woff2"); font-weight: bold; font-style: italic; font-display: swap; }

/* Grundgestaltung; Layouts überschreiben die Variablen in assets/layout.css.
   Aufbau: Variablen → Grundelemente → Kopf/Fuß → Bausteine (Kacheln, Karten, Chips, Tabellen, Filter)
   → Seitentypen → Mobil → Dunkelmodus → Druck. Keine externen Ressourcen. */
:root {
  color-scheme: light;
  --akzent: #1f5f99;
  --akzent-dunkel: #164570;
  --akzent-text: #fff;                 /* Schrift auf Akzentfläche */
  --link: var(--akzent);
  --link-hover: var(--akzent-dunkel);
  --text: #1c1e21;
  --text-stark: #0d0f12;
  --leise: #5d6470;
  --linie: #e3e6eb;
  --linie-stark: #cfd4db;
  --flaeche: #f1f3f6;                  /* Tabellenkopf, Hover, Chips */
  --hintergrund: #f6f7f9;              /* Seitenhintergrund */
  --karte: #ffffff;                    /* Flächen: Karten, Tabellen */
  --kopf-bg: #ffffff;
  --kopf-text: var(--text);
  --fuss-bg: #1f2329;
  --fuss-text: #d9dde3;
  --fokus: #1a73e8;
  --schrift: "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --radius: 12px;
  --radius-klein: 8px;
  --schatten: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --schatten-hoch: 0 4px 8px -2px rgba(16, 24, 40, .08), 0 12px 24px -6px rgba(16, 24, 40, .10);
  --tint: color-mix(in srgb, var(--akzent) 9%, var(--karte));
  --breite: 1200px;
}

/* ---------- Grundelemente ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0; font: 16px/1.6 var(--schrift); color: var(--text); background: var(--hintergrund);
  -webkit-font-smoothing: antialiased; overflow-wrap: break-word;
}
.wrap { max-width: var(--breite); margin: 0 auto; padding: 0 24px; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: .18em; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
a:hover { color: var(--link-hover); text-decoration-color: currentColor; }
:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { color: var(--text-stark); font-weight: normal; }  /* wie Bootstrap/Webapp: 500 = normaler Schnitt */
h1 { font-size: clamp(1.7rem, 1.2rem + 1.8vw, 2.35rem); line-height: 1.15; margin: .5em 0 .35em; text-wrap: balance; }
h1 small { display: block; font-size: 1.02rem; font-weight: normal; color: var(--leise); margin-top: .5em; letter-spacing: 0; }
h2 { font-size: 1.35rem; line-height: 1.3; margin: 2.2em 0 .75em; }
h3 { font-size: 1.1rem; line-height: 1.35; margin: 1.6em 0 .5em; }
h4 { font-size: 1rem; margin: 1.4em 0 .4em; }
p { margin: .6em 0; }
ul, ol { padding-left: 1.3em; }
li { margin: .2em 0; }
.vortext, main > p, .abschnitt > p, .abschnitt > ul { max-width: 78ch; }
.vortext { white-space: normal; }
.leise { color: var(--leise); }
.nowrap { white-space: nowrap; }

.sprunglink { position: absolute; left: 12px; top: -80px; z-index: 100; padding: 10px 16px; border-radius: var(--radius-klein); background: var(--text-stark); color: var(--hintergrund); font-weight: normal; text-decoration: none; }
.sprunglink:focus { top: 12px; color: var(--hintergrund); }

/* ---------- Kopf, Navigation (Layout default) ---------- */
.kopf { background: var(--kopf-bg); color: var(--kopf-text); border-bottom: 1px solid var(--linie); }
.kopf-innen { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 32px; min-height: 68px; padding-top: 10px; padding-bottom: 10px; }
.marke { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-weight: 700; font-size: 1.08rem; letter-spacing: -.01em; }
.marke::before { content: ""; width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--akzent), var(--akzent-dunkel)); flex: none; }
.marke:has(img)::before { display: none; }
.marke img { height: 40px; width: auto; }
.hauptnav { display: flex; flex-wrap: wrap; gap: 4px; }
.hauptnav a { color: var(--leise); text-decoration: none; padding: 7px 12px; border-radius: 999px; font-weight: normal; font-size: .95rem; }
.hauptnav a:hover { color: var(--text-stark); background: var(--flaeche); }
.hauptnav a[aria-current] { color: var(--link); background: var(--tint); }
.hauptnav a:focus-visible { outline-offset: -3px; }
.sprachwahl { font-size: .9rem; color: var(--leise); text-decoration: none; padding: 6px 12px; border: 1px solid var(--linie); border-radius: 999px; white-space: nowrap; }
.sprachwahl:hover { color: var(--link); border-color: var(--link); }
.login-knopf { font-size: .9rem; font-weight: 600; color: var(--akzent-text); background: var(--akzent); text-decoration: none; padding: 6px 14px; border-radius: 999px; white-space: nowrap; }
.login-knopf:hover { background: var(--akzent-dunkel); color: var(--akzent-text); }

/* Brotkrumen */
.krumen { font-size: .85rem; color: var(--leise); padding-top: 18px; padding-bottom: 0; }
.krumen a { color: var(--leise); text-decoration: none; }
.krumen a:hover { color: var(--link); text-decoration: underline; }
.krumen span[aria-hidden] { display: inline-block; margin: 0 .35em; opacity: .55; }
.krumen > span:last-child { color: var(--text); font-weight: normal; }

main { padding-bottom: 64px; min-height: 60vh; }
.fuss { background: var(--fuss-bg); color: var(--fuss-text); font-size: .875rem; padding: 28px 0; }

/* ---------- Kacheln (Einstiegsseiten) ---------- */
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 16px; margin: 1.5em 0; padding: 0; list-style: none; }
.kacheln > li { margin: 0; }
.kachel {
  position: relative; display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 22px 22px 20px;
  border: 1px solid var(--linie); border-radius: var(--radius); text-decoration: none; color: inherit;
  background: var(--karte); box-shadow: var(--schatten); transition: box-shadow .15s, border-color .15s, transform .15s;
}
.kachel:hover { border-color: color-mix(in srgb, var(--akzent) 45%, var(--linie)); box-shadow: var(--schatten-hoch); transform: translateY(-1px); color: inherit; }
.kachel strong { display: block; color: var(--text-stark); font-size: 1.12rem; }
.kachel strong::after { content: " →"; color: var(--link); opacity: 0; transition: opacity .15s; }
.kachel:hover strong::after, .kachel:focus-visible strong::after { opacity: 1; }
.kachel span { color: var(--leise); font-size: .93rem; line-height: 1.5; }
.kachel .icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: var(--tint); color: var(--link); margin-bottom: 8px; }
.kachel .icon svg { width: 22px; height: 22px; }

.einstieg { padding: 28px 0 4px; }
.einstieg h1 { margin-top: 0; font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.8rem); max-width: 24ch; }
.einstieg p { color: var(--leise); font-size: 1.1rem; max-width: 60ch; }

/* ---------- Karten, Raster ---------- */
.raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr)); gap: 20px; margin: 1.2em 0; align-items: start; }
.raster > * { min-width: 0; }
.karte { border: 1px solid var(--linie); border-radius: var(--radius); padding: 6px 22px 16px; background: var(--karte); box-shadow: var(--schatten); }
.karte h2, .karte h3 { margin: 1em 0 .5em; font-size: 1.05rem; }
.karte h2 .leise { font-weight: normal; }

/* ---------- Chips, Badges, Knöpfe ---------- */
.badge, .chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: normal; line-height: 1.5;
  padding: 1px 9px; border-radius: 999px; background: var(--flaeche); border: 1px solid var(--linie);
  color: var(--text); vertical-align: middle; white-space: nowrap; text-decoration: none;
}
td .badge, li .badge, .termin .badge { margin-left: 6px; }
/* Lange Labels/Formate dürfen in Tabellen umbrechen, sonst sprengen sie die Tabellenbreite */
td .badge, td .chip { white-space: normal; max-width: 100%; border-radius: 10px; }
td .chip { overflow-wrap: normal; }      /* Formate: nur an Leerzeichen umbrechen */
td .badge { overflow-wrap: anywhere; }   /* Labels: notfalls im Wort, sonst sprengen lange Wörter die Tabelle */
a.badge:hover { border-color: var(--akzent); color: var(--link); }
.chip-akzent { background: var(--tint); border-color: color-mix(in srgb, var(--akzent) 25%, transparent); color: var(--akzent-dunkel); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: .2em 0 1.2em; padding: 0; list-style: none; }
.chips > li { margin: 0; }
.chips .chip { font-size: .85rem; padding: 4px 12px; white-space: normal; }
.chips .chip b { font-weight: normal; color: var(--text-stark); }
.chips .chip-akzent b { color: inherit; }

.hinweis { border: 1px solid color-mix(in srgb, var(--akzent) 30%, var(--linie)); border-left: 4px solid var(--akzent); background: var(--tint); padding: 12px 16px; margin: 1em 0; border-radius: var(--radius-klein); }
.knopf {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 7px 16px; font: inherit; font-size: .92rem; font-weight: normal;
  border: 1px solid var(--linie-stark); border-radius: var(--radius-klein); color: var(--text); text-decoration: none;
  background: var(--karte); cursor: pointer; box-shadow: var(--schatten); transition: background .15s, border-color .15s;
}
.knopf:hover { border-color: var(--akzent); color: var(--link); }
.knopf-primaer { background: var(--akzent); border-color: var(--akzent); color: var(--akzent-text); }
.knopf-primaer:hover { background: var(--akzent-dunkel); border-color: var(--akzent-dunkel); color: var(--akzent-text); }
.knoepfe { display: flex; flex-wrap: wrap; gap: 8px; margin: 1em 0 1.2em; }

/* Semesterwahl als Pillenleiste */
.semesterwahl { display: flex; flex-wrap: wrap; gap: 6px; margin: .8em 0 1.2em; }
.semesterwahl a, .semesterwahl span {
  display: inline-flex; align-items: center; min-height: 36px; padding: 5px 14px; border: 1px solid var(--linie);
  border-radius: 999px; text-decoration: none; font-size: .9rem; font-weight: normal; background: var(--karte); color: var(--text);
}
.semesterwahl a:hover { border-color: var(--akzent); color: var(--link); }
.semesterwahl span { background: var(--akzent); color: var(--akzent-text); border-color: var(--akzent); }

/* ---------- Tabellen ---------- */
.tabelle-scroll {
  overflow-x: auto; -webkit-overflow-scrolling: touch; margin: .8em 0 1.2em;
  background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten);
}
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .94rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--linie); }
thead th {
  background: var(--flaeche); font-weight: bold; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--leise); white-space: nowrap; border-bottom: 1px solid var(--linie-stark);
}
.tabelle-scroll thead th:first-child { border-top-left-radius: calc(var(--radius) - 1px); }
.tabelle-scroll thead th:last-child { border-top-right-radius: calc(var(--radius) - 1px); }
tbody tr:last-child > * { border-bottom: 0; }
table.liste tbody tr:hover { background: var(--tint); }
table.stapel td:first-child:not(.kurz) a, table.stapel td.titel a { font-weight: normal; }
table.liste td .leise { font-size: .88rem; }
table.stapel tr.leise td.titel a, table.stapel tr.leise td:first-child:not(.kurz) a { font-weight: normal; }
td.zahl, th.zahl { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 700; border-top: 1px solid var(--linie-stark); border-bottom: 0; }
table.kv th, table.kv td { padding: 9px 0; }
table.kv th { width: 38%; padding-right: 16px; font-weight: normal; color: var(--leise); font-size: .9rem; }
table.kv td { overflow-wrap: anywhere; }
table.kv tr:last-child > * { border-bottom: 0; }
.abschnitt > table.kv { max-width: 640px; }

/* Lange Tabellen am Desktop: Kopf bleibt beim Scrollen stehen (Seiten-Scroll statt Tabellen-Scroll) */
@media (min-width: 1000px) {
  .tabelle-scroll { overflow: visible; }
  table.liste thead th { position: sticky; top: 0; z-index: 2; }
  table.liste td { overflow-wrap: anywhere; }
  table.liste td.nowrap, table.liste td.zahl, table.liste td.termine-zelle { overflow-wrap: normal; }
  /* Platz für einen Termin wie "Mi. 02.12.26, 15:00 - 18:00"; längere Serien umbrechen an Leerzeichen */
  table.liste td.termine-zelle { width: 17em; min-width: 17em; }
  /* Titel nicht mitten im Wort umbrechen */
  table.stapel td:first-child:not(.kurz) { min-width: 16em; }
}

/* ---------- Filterleiste (Markup-Hooks data-filter-* bleiben unverändert) ---------- */
.filter {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 1.2em 0 .6em; padding: 12px;
  background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten);
}
.filter input, .filter select {
  font: inherit; font-size: .95rem; min-height: 44px; padding: 9px 12px; border: 1px solid var(--linie-stark);
  border-radius: var(--radius-klein); background-color: var(--karte); color: var(--text); max-width: 100%;
}
.filter input:focus, .filter select:focus { outline: none; border-color: var(--fokus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fokus) 30%, transparent); }
.filter input {
  flex: 3 1 280px; padding-left: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23808893' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 12px 50%; background-size: 18px;
}
.filter input::placeholder { color: var(--leise); opacity: .9; }
.filter select {
  flex: 1 1 200px; width: 0; min-width: 160px; appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23808893' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px;
}
.treffer { color: var(--leise); font-size: .85rem; font-variant-numeric: tabular-nums; white-space: nowrap; padding: 0 6px; }
.treffer:empty { display: none; }

/* ---------- Bäume (Einrichtungen, Gebäude) ---------- */
ul.baum, ul.baum ul { list-style: none; padding-left: 18px; margin: 0; }
ul.baum ul { border-left: 1px solid var(--linie); margin-left: 4px; padding-left: 14px; }
ul.baum { padding-left: 0; }
ul.baum li { margin: 5px 0; }
ul.baum details > summary { cursor: pointer; list-style-position: inside; }
ul.baum details > summary::marker { color: var(--leise); }
ul.baum li:not(:has(> details)) { padding-left: 1.1em; }
.baum-anzahl { font-size: .75rem; color: var(--leise); border: 1px solid var(--linie); border-radius: 999px; padding: 0 7px; margin-left: 4px; }
li.baum-treffer > a, li.baum-treffer > details > summary > a { background: var(--tint); border-radius: 4px; padding: 0 3px; font-weight: normal; }
.flaeche { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); padding: 6px 22px 16px; box-shadow: var(--schatten); }
.flaeche > h2:first-child, .flaeche > h3:first-child { margin-top: .8em; }

/* ---------- Studiengangsaufbau ---------- */
.bereich-0 > td { background: var(--flaeche); }
.bereich-0 > td:first-child a { font-weight: 700; }
.einzug-1 { padding-left: 32px !important; } .einzug-2 { padding-left: 52px !important; } .einzug-3 { padding-left: 72px !important; }

/* ---------- Veranstaltung: Termine ---------- */
.termin {
  display: grid; gap: 4px; padding: 14px 18px; margin: 10px 0; background: var(--karte);
  border: 1px solid var(--linie); border-left: 4px solid var(--akzent); border-radius: var(--radius-klein); box-shadow: var(--schatten);
}
.termin > div:first-child strong { font-size: 1.02rem; color: var(--text-stark); }
.termin details { margin-top: 4px; }
.termin details summary { cursor: pointer; color: var(--link); font-size: .9rem; font-weight: normal; width: fit-content; }
.termin ul { margin: 8px 0 0; padding-left: 18px; font-size: .9rem; columns: 2 320px; column-gap: 32px; }
.termin li { break-inside: avoid; }

/* ---------- Modulbeschreibung: Inhaltsverzeichnis + Abschnitte ---------- */
.dokument { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px 40px; }
.inhaltsverzeichnis { font-size: .9rem; }
.inhaltsverzeichnis strong { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--leise); margin-bottom: 6px; }
.inhaltsverzeichnis ol { list-style: none; margin: 0; padding: 0; }
.inhaltsverzeichnis li { margin: 0; }
.inhaltsverzeichnis a { display: block; padding: 5px 10px; border-left: 2px solid var(--linie); color: var(--leise); text-decoration: none; line-height: 1.35; }
.inhaltsverzeichnis a:hover { color: var(--link); border-left-color: var(--akzent); background: var(--tint); }
.abschnitt { scroll-margin-top: 16px; }
.abschnitt > h2 { margin-top: 1.8em; }
.abschnitt:first-child > h2 { margin-top: .9em; }
@media (min-width: 1100px) {
  .dokument { grid-template-columns: 220px minmax(0, 1fr); }
  .inhaltsverzeichnis { position: sticky; top: 16px; align-self: start; max-height: calc(100vh - 32px); overflow: auto; padding-top: 1.6em; }
}
@media (max-width: 1099px) {
  .inhaltsverzeichnis { background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); padding: 14px 16px; margin-top: 1em; }
  .inhaltsverzeichnis ol { columns: 2 220px; column-gap: 16px; }
  .inhaltsverzeichnis a { border-left: 0; padding: 4px 0; }
}

/* ---------- Mobil ---------- */
@media (max-width: 700px) {
  .wrap { padding: 0 16px; }
  h2 { margin-top: 1.8em; }
  .kopf-innen { min-height: 0; padding-top: 12px; padding-bottom: 8px; gap: 8px; }
  .hauptnav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 12px 4px; width: calc(100% + 32px); }
  .hauptnav::-webkit-scrollbar { display: none; }
  .hauptnav a { white-space: nowrap; }
  .karte, .flaeche { padding: 4px 16px 12px; }
  .filter { padding: 10px; gap: 8px; }
  .filter input, .filter select { flex: 1 1 100%; width: 100%; }
  table.kv th, table.kv td { display: block; width: auto; padding: 0; border: 0; }
  table.kv th { padding-top: 10px; font-size: .8rem; }
  table.kv td { padding-bottom: 10px; border-bottom: 1px solid var(--linie); }
  table.kv tr:last-child td { border-bottom: 0; }
  .termin ul { columns: 1; }
  th, td { padding: 8px; }
  table { font-size: .9rem; }
  thead th { white-space: normal; text-transform: none; letter-spacing: 0; font-size: .8rem; hyphens: auto; overflow-wrap: anywhere; }
  table.liste td { overflow-wrap: anywhere; hyphens: auto; }
  table.liste:not(.stapel) tr > :first-child { min-width: 7.5em; }
  td.zahl { white-space: normal; }

  /* Listen als Karten: jede Zeile ein Block, Spaltennamen aus data-label */
  .tabelle-scroll:has(> table.stapel) { overflow: visible; background: none; border: 0; box-shadow: none; }
  table.stapel, table.stapel tbody, table.stapel td { display: block; }
  table.stapel thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.stapel tbody { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  table.stapel tr {
    display: flex; flex-wrap: wrap; gap: 2px 12px; padding: 12px 14px; background: var(--karte);
    border: 1px solid var(--linie); border-radius: var(--radius-klein); box-shadow: var(--schatten);
  }
  table.stapel tr[hidden] { display: none; }
  table.stapel td { flex: 1 1 100%; padding: 0; border: 0; font-size: .9rem; text-align: left; white-space: normal; }
  table.stapel td:first-child:not(.kurz), table.stapel td.titel { font-size: 1rem; padding-bottom: 2px; }
  table.stapel td.titel { order: -1; }
  table.stapel td.kurz { flex: 0 1 auto; max-width: 100%; color: var(--leise); }
  table.stapel td:empty { display: none; }
  table.stapel td[data-label]::before { content: attr(data-label) ": "; color: var(--leise); font-size: .85em; }
}

/* ---------- Dunkelmodus (folgt der Systemeinstellung) ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --akzent: #3d7fc2;
    --akzent-dunkel: #2f6aa6;
    --link: #8cbcf0;
    --link-hover: #b5d4f6;
    --text: #e3e6ea;
    --text-stark: #f5f7fa;
    --leise: #a1a8b3;
    --linie: #2e333b;
    --linie-stark: #3c424c;
    --flaeche: #23272e;
    --hintergrund: #121417;
    --karte: #1a1d22;
    --kopf-bg: #1a1d22;
    --fuss-bg: #0b0c0e;
    --fuss-text: #b8bec7;
    --fokus: #8cbcf0;
    --schatten: 0 1px 2px rgba(0, 0, 0, .4);
    --schatten-hoch: 0 6px 18px rgba(0, 0, 0, .5);
    --tint: color-mix(in srgb, var(--akzent) 16%, var(--karte));
  }
  .chip-akzent { color: var(--link); }
}

@media print {
  :root { --hintergrund: #fff; --karte: #fff; --schatten: none; }
  .kopf nav, .krumen, .fuss, .filter, .knoepfe, .semesterwahl, .sprunglink, .inhaltsverzeichnis { display: none !important; }
  .dokument { display: block; }
  details { display: block; } details > summary { display: none; }
  a { color: inherit; text-decoration: none; }
  .tabelle-scroll { overflow: visible; box-shadow: none; }
  .karte, .kachel, .termin { box-shadow: none; }
  thead th { position: static !important; }
}

/* Stöbern nach Organisationseinheit/Label (VV-Semesterseite) */
details.stoebern { margin: 1.2em 0; background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); }
details.stoebern > summary { cursor: pointer; padding: 14px 20px; font-weight: normal; color: var(--text-stark); list-style-position: inside; }
details.stoebern > summary:hover { color: var(--link); }
details.stoebern[open] > summary { border-bottom: 1px solid var(--linie); }
details.stoebern .raster { padding: 0 20px 12px; margin: 0; }
details.stoebern h2 { font-size: 1.05rem; margin: 1em 0 .5em; }
details.stoebern h2::before { display: none !important; }

/* ---------- Suchseiten (static/suche.js) ---------- */
.suchform { margin: 1.2em 0; padding: 18px 20px; background: var(--karte); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); }
.suchform fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.suchform legend, .suchform .feld > span, .suchform .feld label > span, .zeitraum span { display: block; font-size: .8rem; font-weight: normal; color: var(--leise); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .03em; }
.suchform input[type=search], .suchform input[type=text], .suchform input[type=date], .suchform input[type=time], .suchform select {
  font: inherit; font-size: .95rem; min-height: 44px; padding: 9px 12px; border: 1px solid var(--linie-stark);
  border-radius: var(--radius-klein); background-color: var(--karte); color: var(--text); width: 100%; box-sizing: border-box;
}
.suchform select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23808893' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px; }
.suchform input[type=search] { padding-left: 40px; font-size: 1.05rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23808893' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 12px 50%; background-size: 18px; }
.suchform input:focus, .suchform select:focus { outline: none; border-color: var(--fokus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fokus) 30%, transparent); }
.such-zeile { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.such-zeile .feld-q { flex: 3 1 320px; }
.such-zeile .feld-sem { flex: 1 1 200px; }
.such-zeile .knopf { min-height: 44px; padding-inline: 22px; }
.such-kat { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px !important; }
.such-kat legend { float: left; margin: 0 8px 0 0; line-height: 34px; }
.chip-reihe { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-wahl { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 12px; border: 1px solid var(--linie-stark);
  border-radius: 999px; font-size: .9rem; cursor: pointer; user-select: none; background: var(--karte); }
.chip-wahl:has(input:checked) { border-color: var(--akzent); background: color-mix(in srgb, var(--akzent) 10%, var(--karte)); color: var(--text-stark); }
.chip-wahl input { accent-color: var(--akzent); margin: 0; }
.haken { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: .9rem; cursor: pointer; }
.haken input { accent-color: var(--akzent); width: 18px; height: 18px; margin: 0; }
.such-hinweis { color: var(--akzent); font-size: .9rem; margin: 6px 0 0; }
.such-hinweis:empty { display: none; }
details.erweitert { margin-top: 16px; border-top: 1px solid var(--linie); padding-top: 12px; }
details.erweitert > summary { cursor: pointer; font-weight: normal; color: var(--link); width: max-content; }
.such-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px 20px; margin-top: 16px; }
.such-raster .feld-breit { grid-column: 1 / -1; }
details.such-panel { border: 1px solid var(--linie); border-radius: var(--radius-klein); background: var(--karte); }
details.such-panel > summary { cursor: pointer; padding: 10px 14px; font-weight: normal; color: var(--text-stark); list-style-position: inside; }
details.such-panel > summary:hover { color: var(--link); }
details.such-panel > summary .leise { font-weight: 400; font-size: .85rem; }
details.such-panel[open] > summary { border-bottom: 1px solid var(--linie); }
details.such-panel > fieldset { padding: 12px 14px 14px; }
.panel-zahl:not(:empty) { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: var(--tint); color: var(--link); font-size: .8rem; font-weight: normal; }
.zeitraum { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.zeitraum span { text-transform: none; letter-spacing: 0; }
.such-ergebnis { margin-top: 1em; }
.suche-anzahl { font-weight: normal; color: var(--text-stark); margin: 0 0 .6em; }
.suche-leer { padding: 24px; text-align: center; background: var(--karte); border: 1px dashed var(--linie-stark); border-radius: var(--radius); color: var(--leise); }
.kachel-suche { border-color: var(--akzent) !important; }
@media print { .suchform { display: none; } }

/* ---------- Wochenkalender (Raumbelegung) ---------- */
.kalender { margin: .6em 0 1.6em; }
.kal-leiste { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.kal-leiste .knopf { min-height: 34px; padding: 4px 12px; }
.kal-titel { margin-left: 8px; font-weight: normal; }
.kal-raster {
  display: grid; position: relative; overflow-x: auto;
  grid-template-columns: 3.5em repeat(var(--tage, 5), minmax(110px, 1fr));
  grid-template-rows: auto repeat(calc(var(--stunden, 10) * 4), 16px);
  border: 1px solid var(--linie); border-radius: var(--radius); background: var(--karte); box-shadow: var(--schatten);
}
.kal-ecke, .kal-kopf { grid-row: 1; background: var(--flaeche); border-bottom: 1px solid var(--linie-stark); }
.kal-kopf { padding: 8px 10px; font-size: .8rem; font-weight: normal; color: var(--leise); border-left: 1px solid var(--linie); }
.kal-heute { color: var(--akzent); }
.kal-zeit { grid-column: 1; font-size: .72rem; color: var(--leise); padding: 0 6px; transform: translateY(-.6em); text-align: right; }
.kal-linie { border-top: 1px solid var(--linie); pointer-events: none; }
.kal-termin {
  z-index: 1; margin: 1px 3px; padding: 3px 6px; overflow: hidden; border-radius: 6px; font-size: .75rem; line-height: 1.25;
  background: var(--tint); border-left: 3px solid var(--akzent); color: var(--text); text-decoration: none; box-sizing: border-box;
}
.kal-termin:hover, .kal-termin:focus-visible { background: color-mix(in srgb, var(--akzent) 18%, var(--karte)); }
.kal-uhr { display: block; font-weight: normal; color: var(--leise); font-variant-numeric: tabular-nums; }
.termin-raum { display: block; font-size: .85em; color: var(--leise); }
.termin-raum a { color: inherit; }
.termin-raum::before { content: attr(data-vor); }
.kal-name { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.kal-gruppe, .kal-doz { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 400; color: var(--leise); }
.kal-doz { font-style: italic; }

/* ---------- OE-Auswahl (Baum mit Suche, nach Moses) ---------- */
.oe-auswahl { position: relative; }
.feld-oe > span { display: block; font-size: .8rem; font-weight: normal; color: var(--leise); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .03em; }
.oe-feld { display: flex; align-items: stretch; border: 1px solid var(--linie-stark); border-radius: var(--radius-klein); background: var(--karte); }
.oe-feld:focus-within { border-color: var(--akzent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--akzent) 18%, transparent); }
.oe-feld input { flex: 1; min-width: 0; border: 0 !important; box-shadow: none !important; outline: none; background: transparent; padding: 9px 12px; font: inherit; color: var(--text); }
.oe-feld button { border: 0; background: none; color: var(--leise); cursor: pointer; padding: 0 10px; font-size: 1rem; }
.oe-feld button:hover { color: var(--link); }
.oe-liste {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); max-height: 360px; overflow: auto; margin: 0; padding: 4px 0;
  list-style: none; background: var(--karte); border: 1px solid var(--linie-stark); border-radius: var(--radius-klein); box-shadow: 0 8px 24px rgb(0 0 0 / .14);
  min-width: min(520px, 90vw);
}
.oe-liste li { display: flex; align-items: baseline; gap: 6px; padding: 5px 12px 5px calc(12px + var(--t, 0) * 16px); cursor: pointer; font-size: .9rem; line-height: 1.35; }
.oe-liste li.aktiv, .oe-liste li:hover { background: var(--tint); }
.oe-liste li[aria-selected="true"] { font-weight: normal; }
.oe-liste li.kontext { color: var(--leise); }
.oe-liste li b { color: var(--akzent-dunkel); }
.oe-pfeil { color: var(--leise); flex: none; }
.oe-name { flex: 1; }
.oe-zahl { flex: none; font-size: .75rem; color: var(--leise); font-variant-numeric: tabular-nums; }
.oe-nichts { color: var(--leise); cursor: default !important; }

/* Sortierbare Spaltenköpfe */
table.sortierbar th { padding: 0; }
.sortier-knopf { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 6px; width: 100%; padding: 10px 14px; cursor: pointer; }
th.zahl .sortier-knopf { justify-content: flex-end; }
/* LP-Spalten: linksbündig, "6 LP" nie umbrechen */
td.lp, th.lp { text-align: left; }
th.lp .sortier-knopf { justify-content: flex-start; }
td.lp, td.lp .chip { white-space: nowrap; }
.sortier-knopf::after { content: "↕"; opacity: .35; font-size: .9em; }
th[aria-sort="ascending"] .sortier-knopf::after { content: "↑"; opacity: 1; color: var(--akzent); }
th[aria-sort="descending"] .sortier-knopf::after { content: "↓"; opacity: 1; color: var(--akzent); }
.sortier-knopf:hover, .sortier-knopf:focus-visible { color: var(--text-stark); }
.sortier-knopf:focus-visible { outline: 2px solid var(--akzent); outline-offset: -2px; }

/* Panels je LV-Vorlage in der Modulbeschreibung */
details.lv-panel { margin: .5em 0; border: 1px solid var(--linie); border-radius: var(--radius-klein); background: var(--karte); }
details.lv-panel > summary { cursor: pointer; padding: 9px 14px; font-weight: normal; list-style-position: inside; }
details.lv-panel > summary:hover .lv-panel-titel { color: var(--link); }
details.lv-panel[open] > summary { border-bottom: 1px solid var(--linie); }
details.lv-panel > ul.baum { padding: 6px 14px 0; }
details.lv-panel > ul.baum:last-child { padding-bottom: 8px; }
.lv-panel-fuss { margin: 4px 14px 10px; font-size: .88rem; }

/* Terminfilter: Wochentage, Schnellwahl */
.wochentage { margin-top: 12px; align-items: center; }
.wochentage .chip-wahl { min-width: 3.4em; justify-content: center; }
.knopf-klein { min-height: 34px; padding: 4px 12px; font-size: .85rem; box-shadow: none; }
.wochentage .knopf-klein:first-of-type { margin-left: 8px; }
p.klein { font-size: .85rem; margin: 8px 0 0; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Daten und Schnittstellen ---------- */
pre.code { background: var(--tint); border: 1px solid var(--linie); border-radius: var(--radius-klein); padding: 12px 14px; overflow-x: auto; font-size: .85rem; line-height: 1.45; max-width: 100%; }
pre.code code, .lv-panel-titel code, table.liste td code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
details.lv-panel > p, details.lv-panel > pre, details.lv-panel > .tabelle-scroll { margin-left: 14px; margin-right: 14px; }
.tub-fuss a, .fuss a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Chat-Widget (static/chat.js, nur wenn chat_url gesetzt ist) ---------- */
.chat-knopf { position: fixed; right: 16px; bottom: 16px; z-index: 50; border: 0; border-radius: 999px; padding: .7em 1.2em;
  background: var(--akzent); color: var(--akzent-text); font: inherit; font-weight: bold; box-shadow: var(--schatten-hoch); cursor: pointer; }
.chat-knopf:hover { background: var(--akzent-dunkel); }
.chat-knopf[aria-expanded="true"] { display: none; }
.chat-panel { position: fixed; right: 16px; bottom: 16px; z-index: 51; width: min(520px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 32px)); display: flex; flex-direction: column; background: var(--karte); color: var(--text);
  border: 1px solid var(--linie-stark); border-radius: var(--radius); box-shadow: var(--schatten-hoch); overflow: hidden; }
.chat-panel[hidden] { display: none; }
.chat-panel.chat-gross { left: 16px; right: 16px; top: 16px; bottom: 16px; width: auto; height: auto; }
.chat-gross .chat-msg { max-width: min(80%, 1100px); }
.chat-gross .chat-tabelle table { font-size: .95em; }
.chat-kopf { display: flex; align-items: center; gap: .5em; padding: .6em .8em; background: var(--akzent); color: var(--akzent-text); }
.chat-kopf strong { flex: 1; }
.chat-klein { border: 1px solid color-mix(in srgb, var(--akzent-text) 50%, transparent); background: transparent;
  color: inherit; border-radius: var(--radius-klein); padding: .15em .6em; font: inherit; cursor: pointer; }
.chat-liste { flex: 1; overflow-y: auto; padding: .8em; display: flex; flex-direction: column; gap: .6em; }
.chat-msg { max-width: 92%; padding: .55em .8em; border-radius: var(--radius); line-height: 1.45; overflow-wrap: anywhere; }
.chat-msg p, .chat-msg ul, .chat-msg ol { margin: .3em 0; }
.chat-msg ul, .chat-msg ol { padding-left: 1.3em; }
.chat-nutzer { align-self: flex-end; background: var(--tint); white-space: pre-wrap; }
.chat-assistent { align-self: flex-start; background: var(--flaeche); }
.chat-fehler { border-left: 3px solid var(--akzent); }
.chat-status { color: var(--leise); font-style: italic; }
.chat-tabelle { overflow-x: auto; }
.chat-tabelle table { border-collapse: collapse; font-size: .9em; }
.chat-tabelle th, .chat-tabelle td { border: 1px solid var(--linie-stark); padding: .25em .45em; text-align: left; vertical-align: top; }
.chat-hinweis { margin: 0; padding: .35em .8em; font-size: .78em; color: var(--leise); border-top: 1px solid var(--linie); }
.chat-form { display: flex; gap: .5em; padding: .6em .8em; border-top: 1px solid var(--linie); }
.chat-form textarea { flex: 1; resize: none; font: inherit; padding: .45em .6em; border: 1px solid var(--linie-stark);
  border-radius: var(--radius-klein); background: var(--karte); color: var(--text); }
.chat-form button { border: 0; border-radius: var(--radius-klein); padding: 0 1em; background: var(--akzent); color: var(--akzent-text);
  font: inherit; font-weight: bold; cursor: pointer; }
.chat-form button:disabled { opacity: .5; cursor: wait; }
@media (max-width: 520px) { .chat-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border: 0; } }
@media print { .chat-knopf, .chat-panel { display: none !important; } }
