/*======================================================================
 *| Kurztext      : Hallenplaner – Styles
 *|======================================================================
 *| Entwickler    : Leon Wolf
 *|======================================================================
 *| Datum         : 31.10.2026
 *|======================================================================
 *| Beschreibung  : Mobile-first Layout, Hell-/Dunkelmodus, Kalenderraster.
 *|======================================================================
 *| ID    Entwickler   Datum
 *|
 *|======================================================================*/
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --text: #1b1f24;
  --muted: #5d6673;
  --border: #dde1e6;
  --primary: #1f6feb;
  --primary-text: #ffffff;
  --danger: #cf222e;
  --ok: #1a7f37;
  --warn: #9a6700;
  --hour: 48px;
  --radius: 10px;
  --shadow: 0 4px 18px rgba(0,0,0,.08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #20262e;
    --text: #e6e9ee;
    --muted: #9aa4b2;
    --border: #2c333d;
    --primary: #4c8dff;
    --danger: #ff6b6b;
    --ok: #4ac26b;
    --warn: #d4a72c;
    --shadow: 0 4px 18px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
/* App-Verhalten: kein Zoomen, kein seitliches Wackeln, kein Textvergrößern (iOS) */
html { touch-action: pan-x pan-y; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: hidden; }
/* clip statt hidden: hidden macht body zum eigenen Scroll-Bereich -> „sticky“-Kopfzeile scrollt sonst weg */
body { overflow-x: clip; overscroll-behavior-x: none; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }

/* ---------- Buttons & Formulare ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; min-height: 38px;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.ok { color: var(--ok); border-color: var(--ok); }
a.btn { text-decoration: none; }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn.icon { padding: 6px 10px; }
.btn:disabled { opacity: .5; cursor: default; }
label.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); min-height: 40px;
}
textarea { min-height: 70px; resize: vertical; }
/* iOS zoomt beim Fokus in Felder unter 16px hinein – und springt nicht zurück */
@media (max-width: 760px) { input, select, textarea { font-size: 16px; } }
/* Einheitlicher Auswahlpfeil mit genug Platz (statt gequetschtem Browser-Pfeil) */
select {
  -webkit-appearance: none; appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%238a94a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px;
}
/* Datum / Von / Bis im Buchungsformular */
.when { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
@media (max-width: 520px) { .when { grid-template-columns: 1fr 1fr; } .when-date { grid-column: 1 / -1; } }
/* Neue Buchung wie Outlook: Beginn/Ende je Datum + Uhrzeit; „Ganztägig“ blendet Uhrzeiten aus */
.dt { display: grid; gap: 10px; }
.dt-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px; }
form.allday .dt-time { display: none; }
form.allday .dt-row, form.allday .when { grid-template-columns: 1fr; }
fieldset.repeat[hidden] { display: none; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stack { display: grid; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--danger); font-size: 14px; }

/* ---------- Ladezustand / Login ---------- */
.center-screen { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.login { width: 100%; max-width: 380px; }
.login h1 { margin: 8px 0 4px; font-size: 22px; }
.login .logo { width: 56px; height: 56px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 6px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- Kopfzeile & Navigation ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.brand img { width: 28px; height: 28px; }
.tabs { display: flex; gap: 4px; margin-left: 12px; }
.tab { border: 0; background: none; padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); position: relative; }
.tab.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; line-height: 18px; text-align: center; margin-left: 4px; }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.userbox .who { text-align: right; line-height: 1.2; }
.role-pill { font-size: 11px; color: var(--muted); }
.banner { background: color-mix(in srgb, var(--warn) 15%, var(--surface)); border-bottom: 1px solid var(--border); padding: 8px 16px; font-size: 14px; white-space: pre-wrap; }

.lbl-short { display: none; }
.day-head { font-weight: 600; margin: 14px 0 6px; }
@media (max-width: 760px) {
  .lbl-long { display: none; }
  .lbl-short { display: inline; }
  .tabs {
    position: fixed; bottom: 0; left: 0; right: 0; margin: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--border);
    justify-content: space-around; padding: 6px 4px; padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
  .tab { flex: 1; font-size: 12px; padding: 8px 4px; }
  .userbox .who { display: none; }
  main { padding-bottom: 80px; }
  .fab { bottom: calc(76px + env(safe-area-inset-bottom)) !important; }
  .topbar { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .brand span { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* Kalender-Toolbar bleibt unter der Kopfzeile stehen: Datum/Ansicht immer erreichbar */
  .toolbar.cal { position: sticky; top: var(--topbar-h, 52px); z-index: 15; background: var(--bg); padding: 6px 0; margin: 0 0 6px; }
  /* Zeile 1: Heute ‹ › Datum (kurz) · Zeile 2: Tag/Woche/Monat/Liste · Zeile 3 (Filterzeile, wischbar): Bereich + Abteilungen */
  .toolbar.cal .label { flex: 1 1 0; min-width: 0; margin: 0; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .toolbar.cal .spacer, .toolbar.cal .res-toolbar { display: none; }
  .toolbar.cal .seg { flex: 1 0 100%; }
  .toolbar.cal .seg button { flex: 1; padding: 8px 6px; min-height: 40px; }
  .toolbar.cal .btn { min-height: 40px; }
  .dlg-foot .btn, .dlg-body .btn { min-height: 44px; }
  .tbl-wrap { max-width: 100%; }
}

main { padding: 12px 16px 24px; max-width: 1400px; margin: 0 auto; }

/* ---------- Kalender-Toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.toolbar .label { font-weight: 650; font-size: 17px; margin: 0 6px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 7px 12px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--primary); color: var(--primary-text); }
.toolbar .spacer { flex: 1; }
.toolbar select { width: auto; min-width: 160px; }

/* ---------- Zeitraster (Tag/Woche) ---------- */
.tg { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 190px);
  overscroll-behavior: contain; }   /* am Ende des Rasters nicht die ganze Seite weiterscrollen */
.tg-head, .tg-body { display: grid; grid-template-columns: 52px repeat(var(--cols), minmax(var(--colmin, 110px), 1fr)); }
.tg-head { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--border); }
.tg-head > div { padding: 8px 6px; text-align: center; font-size: 13px; border-left: 1px solid var(--border); }
.tg-head > div:first-child { border-left: 0; }
.tg-head .today { color: var(--primary); font-weight: 700; }
.tg-head .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.tg-times { position: relative; }
.tg-times div { height: var(--hour); font-size: 11px; color: var(--muted); text-align: right; padding-right: 6px; transform: translateY(-7px); }
.tg-times div:first-child { transform: none; }
.tg-col {
  position: relative; border-left: 1px solid var(--border); cursor: cell;
  background-image: repeating-linear-gradient(to bottom, var(--border) 0 1px, transparent 1px calc(var(--hour) / 2), color-mix(in srgb, var(--border) 45%, transparent) calc(var(--hour) / 2) calc(var(--hour) / 2 + 1px), transparent calc(var(--hour) / 2 + 1px) var(--hour));
}
.tg-col.readonly { cursor: default; }
.tg-col.today { background-color: color-mix(in srgb, var(--primary) 5%, transparent); }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 3; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.ev {
  position: absolute; border-radius: 6px; padding: 3px 6px; font-size: 12px; line-height: 1.25; overflow: hidden;
  color: #fff; cursor: pointer; border: 1px solid rgba(0,0,0,.15); z-index: 2;
}
.ev b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev .t { opacity: .9; font-size: 11px; }
.ev.pending { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,.25) 0 6px, transparent 6px 12px); }
.ev.event { background-image: repeating-linear-gradient(135deg, rgba(255,255,255,.22) 0 5px, transparent 5px 10px); outline: 1px dashed rgba(255,255,255,.75); outline-offset: -3px; }   /* Veranstaltung (keine Buchung) */
.ev.blackout { background: repeating-linear-gradient(45deg, #6e7781 0 8px, #57606a 8px 16px) !important; }
.ev:hover { filter: brightness(1.08); }
.ev.mine { cursor: grab; }
.rz { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; }
.ghost { position: absolute; left: 2px; right: 2px; z-index: 6; pointer-events: none; border: 2px dashed var(--primary); border-radius: 6px; background: color-mix(in srgb, var(--primary) 22%, transparent); color: var(--text); font-size: 12px; font-weight: 600; padding: 2px 6px; }
body.dragging { user-select: none; cursor: grabbing; }
@media (pointer: coarse) { .rz { display: none; } }

/* ---------- Monatsansicht ---------- */
.month { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.month .wd { padding: 6px; text-align: center; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--border); }
.month .cell { min-height: 96px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; cursor: pointer; overflow: hidden; }
.month .cell:nth-child(7n) { border-right: 0; }
.month .cell.other { background: var(--surface-2); color: var(--muted); }
.month .num { font-size: 12px; font-weight: 600; }
.month .cell.today .num { background: var(--primary); color: #fff; border-radius: 10px; padding: 0 6px; }
.month .it { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
@media (max-width: 760px) { .month .cell { min-height: 64px; } .month .it span.tx { display: none; } }

/* ---------- Listen ---------- */
.list { display: grid; gap: 14px; }
.list h3 { margin: 4px 0; font-size: 14px; color: var(--muted); }
.item { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; }
.item .bar { width: 5px; align-self: stretch; border-radius: 3px; flex: none; }
.item .main { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.item .meta { font-size: 13px; color: var(--muted); }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--border); color: var(--muted); }
.tag.pending { color: var(--warn); border-color: var(--warn); }
.tag.blackout { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* ---------- Verwaltung ---------- */
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
table.tbl { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.tbl th { background: var(--surface-2); font-size: 12px; color: var(--muted); font-weight: 600; }
.tbl select { width: auto; min-height: 32px; padding: 4px 8px; }
.tbl-wrap { overflow-x: auto; }
.bar-chart { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 160px 1fr 70px; gap: 8px; align-items: center; font-size: 13px; }
.bar-row .b { height: 14px; border-radius: 4px; background: var(--primary); }
@media (max-width: 600px) { .bar-row { grid-template-columns: 100px 1fr 56px; } .grid2 { grid-template-columns: 1fr; } }

/* ---------- V2: Abteilungen, Serien, Freigaben ---------- */
.legend { display: flex; gap: 6px; flex-wrap: wrap; margin: -2px 0 10px; }
.legend .res-legend { display: none; }   /* nur Handy, Desktop hat den Bereichsfilter in der Toolbar */
.legend select { width: auto; min-width: 200px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); border-radius: 16px; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.chip.active { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); font-weight: 600; }
.access-card { margin-top: 12px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.warnbox { border: 1px solid var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.warnbox ul { margin: 6px 0; padding-left: 18px; }
.conflict { font-size: 13px; color: var(--warn); margin-top: 2px; }
fieldset.repeat { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px 12px; margin: 0; display: grid; gap: 10px; }
fieldset.repeat legend { font-size: 13px; color: var(--muted); padding: 0 4px; }
.weekdays { display: flex; gap: 6px; flex-wrap: wrap; }
.wdchip input { position: absolute; opacity: 0; pointer-events: none; }
.wdchip span { display: inline-grid; place-items: center; width: 42px; height: 38px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-weight: 600; user-select: none; }
@media (max-width: 520px) { .weekdays { flex-wrap: nowrap; gap: 4px; } .wdchip { flex: 1; display: block; } .wdchip span { width: 100%; } }
.wdchip input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.wdchip input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.tag.rejected { color: var(--danger); border-color: var(--danger); }
.item.unseen { border-color: var(--primary); box-shadow: inset 3px 0 0 var(--primary); }
.item.approval .main { cursor: pointer; }
.welcome { border-color: var(--primary); }
.dept-list { display: grid; gap: 4px; }
.dept-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.dept-row:last-child { border-bottom: 0; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatches .sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer; padding: 0; }
.swatches .sw.active { box-shadow: 0 0 0 2px var(--primary); }
.swatches[hidden] { display: none; }
.swatches.more { margin-top: 8px; }
.swatches .sw-more { display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-size: 18px; font-weight: 600; line-height: 1; }
.colorpick { display: grid; grid-template-columns: minmax(0, 1fr); }
.colorpick .sw { flex: 0 1 28px; height: auto; aspect-ratio: 1; min-width: 20px; }   /* schrumpft auf schmalen Handys, damit „+“ in der ersten Zeile bleibt */
.colorpick > .swatches:not(.more) { flex-wrap: nowrap; }
/* „Neue Abteilung“ direkt im Buchungsformular */
.newdept { border: 1px dashed var(--primary); border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
.newdept[hidden] { display: none; }
/* Install-Hinweis vor dem Login */
.btn[hidden] { display: none; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.month .it.pend { opacity: .7; font-style: italic; }
.ev i { font-style: italic; }

.ok-note { color: var(--ok); }
/* Kontrollkästchen mit langem Text: Haken links neben dem Text, nicht darüber */
.chk { flex-wrap: nowrap; align-items: flex-start; gap: 8px; }
.chk input { margin-top: 3px; flex: none; }

/* ---------- V3: Aushang (druckbar) ---------- */
.poster { background: #fff; color: #111; max-width: 720px; border-radius: 12px; padding: 40px 32px; text-align: center; border: 1px solid var(--border); }
.poster-logo { width: 84px; height: 84px; }
.poster h1 { margin: 10px 0 0; font-size: 40px; }
.poster h2 { margin: 2px 0 14px; font-size: 26px; font-weight: 600; color: #1f6feb; }
.poster-lead { font-size: 18px; margin: 0 auto 20px; max-width: 520px; }
.poster-qr { display: inline-block; padding: 10px; background: #fff; }
.poster-qr img, .poster-qr canvas { display: block; margin: 0 auto; }
.poster-url { font-size: 22px; font-weight: 700; margin-top: 8px; }
.poster-code { font-size: 22px; margin-top: 10px; }
.poster-code b { letter-spacing: 3px; }
.poster-steps { text-align: left; max-width: 520px; margin: 24px auto 0; font-size: 16px; display: grid; gap: 6px; }
@media print {
  @page { size: A4; margin: 15mm; }
  body { background: #fff !important; }
  body:not(.print-cal) * { visibility: hidden; }
  body:not(.print-cal) .poster, body:not(.print-cal) .poster * { visibility: visible; }
  body:not(.print-cal) .poster { position: absolute; left: 0; top: 0; width: 100%; max-width: none; border: 0; }
  /* Kalender drucken („Drucken“-Knopf): Menü, Knöpfe, Filter aus; Raster komplett statt scrollend */
  body.print-cal { background: #fff; color: #000; --bg: #fff; --surface: #fff; --surface-2: #f2f3f5; --text: #000; --muted: #444; --border: #b8bcc2; --primary: #1f6feb; color-scheme: light; }
  body.print-cal .topbar, body.print-cal .tabs, body.print-cal .fab, body.print-cal .banner, body.print-cal .legend,
  body.print-cal .toolbar .btn, body.print-cal .toolbar .seg, body.print-cal .toolbar .spacer, body.print-cal .search,
  body.print-cal .access-card, body.print-cal #toast { display: none !important; }
  body.print-cal main { padding: 0; max-width: none; }
  body.print-cal .toolbar.cal { position: static; }
  body.print-cal .tg { max-height: none; overflow: visible; zoom: .7; }
  body.print-cal .tg-head { position: static; }
  body.print-cal .ev, body.print-cal .dot, body.print-cal .bar { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.search { margin-bottom: 10px; }
@media (max-width: 760px) { .printbtn { display: none; } }

/* ---------- Dialog / Toast / FAB ---------- */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 24px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow); max-height: calc(100vh - 40px); }
dialog::backdrop { background: rgba(0,0,0,.45); }
/* Kopf und Buttons bleiben stehen, nur der Inhalt scrollt (sonst muss man am Handy zum „Buchen“ erst ganz nach unten wischen) */
dialog { overflow: hidden; max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); }
dialog form { display: flex; flex-direction: column; max-height: inherit; }
.dlg-head, .dlg-foot { flex: none; }
.dlg-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.dlg-head h2 { margin: 0; font-size: 17px; }
.dlg-body { padding: 16px 18px; display: grid; gap: 12px; }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--border); }
.dlg-foot .left { margin-right: auto; }
/* Schmal: Buttons gleich breit im Raster, „Löschen“ als eigene Zeile ganz unten */
@media (max-width: 520px) {
  .dlg-foot { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); }
  .dlg-foot .left { grid-column: 1 / -1; order: 9; margin: 0; }
  .dlg-foot .wide { grid-column: 1 / -1; }          /* lange Beschriftung: eigene Zeile */
  .dlg-foot .btn { white-space: normal; text-align: center; line-height: 1.25; }
}
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv .sub { display: block; font-size: 13px; color: var(--muted); }
.kv .par + .par { margin-top: 8px; }
.kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: #24292f; color: #fff; padding: 10px 16px; border-radius: 8px; opacity: 0; transition: .25s; z-index: 100; max-width: calc(100vw - 32px); pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--danger); }
.fab { position: fixed; right: 20px; bottom: 24px; z-index: 25; border-radius: 28px; padding: 12px 20px; box-shadow: var(--shadow); font-weight: 600; }

/* Download-Zeile im Veranstaltungsplan: Knöpfe bündig mit den Datumsfeldern (nicht mittig) */
.toolbar.dl-row { align-items: flex-end; }

/* Handy: Filterzeile + Kalenderhöhe. Bewusst am Dateiende – die Regeln weiter oben im Handy-Block
   verlor gegen die späteren Basisregeln (.legend, .seg, .tg) mit gleicher Gewichtung. */
@media (max-width: 760px) {
  .legend { position: relative; flex-wrap: nowrap; align-items: center; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    padding-right: 28px; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
  .legend::-webkit-scrollbar { display: none; }
  .legend .res-legend { display: inline-flex; flex: none; }
  .legend .res-legend button { padding: 4px 10px; min-height: 34px; font-size: 13px; }
  .legend select { flex: 1 1 0; min-width: 0; min-height: 34px; padding-top: 4px; padding-bottom: 4px; }
  .chip { flex: none; min-height: 34px; }
  .tg { max-height: calc(100vh - 150px); }   /* eine Toolbar-Zeile weniger als früher (190 px) */
}
