/* =====================================================================
   Terminvergabe – Design mit Hell-/Dunkelmodus
   Farben stehen als Variablen oben. Dunkel gilt automatisch nach der
   Geräteeinstellung oder per Schalter (html[data-theme="dark|light"]).
   ===================================================================== */

:root {
  color-scheme: light;
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f0f2f9;
  --input-bg: #ffffff;
  --border: #e2e6f0;
  --border-strong: #c7cfe0;
  --text: #141a2d;
  --muted: #586279;
  --primary: #3b5bdb;
  --primary-hover: #2f4bc2;
  --primary-soft: #e7ecff;
  --on-primary: #ffffff;
  --link: #2f4bc2;
  --ok: #16793a;
  --ok-soft: #e2f5e9;
  --ok-border: #b4e0c3;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --danger-border: #f3c3bd;
  --warn-soft: #fff3d6;
  --warn-border: #efcf80;
  --info: #2f4bc2;
  --info-soft: #e7ecff;
  --info-border: #c6d2fb;
  --shadow: 0 1px 2px rgba(20, 26, 45, .05), 0 6px 18px rgba(20, 26, 45, .06);
  --shadow-pop: 0 12px 32px rgba(20, 26, 45, .2);
  --ring: rgba(59, 91, 219, .38);
  --header-bg: rgba(255, 255, 255, .82);
  --av-bg-l: 92%;
  --av-fg-l: 32%;
  --radius: 16px;
  --radius-sm: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c1019;
    --surface: #141a28;
    --surface-2: #1a2133;
    --input-bg: #0f1524;
    --border: #262f45;
    --border-strong: #38435f;
    --text: #e9edf7;
    --muted: #9ba7c0;
    --primary: #4767ee;
    --primary-hover: #3a58d8;
    --primary-soft: #1d2748;
    --link: #9db3ff;
    --ok: #5fd08a;
    --ok-soft: #12301f;
    --ok-border: #1f5a38;
    --danger: #ff8a80;
    --danger-soft: #3a1717;
    --danger-border: #6b2a2a;
    --warn-soft: #33270c;
    --warn-border: #6b5316;
    --info: #9db3ff;
    --info-soft: #1d2748;
    --info-border: #2f3f77;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 22px rgba(0, 0, 0, .3);
    --shadow-pop: 0 14px 36px rgba(0, 0, 0, .6);
    --ring: rgba(157, 179, 255, .5);
    --header-bg: rgba(12, 16, 25, .82);
    --av-bg-l: 22%;
    --av-fg-l: 82%;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1019;
  --surface: #141a28;
  --surface-2: #1a2133;
  --input-bg: #0f1524;
  --border: #262f45;
  --border-strong: #38435f;
  --text: #e9edf7;
  --muted: #9ba7c0;
  --primary: #4767ee;
  --primary-hover: #3a58d8;
  --primary-soft: #1d2748;
  --link: #9db3ff;
  --ok: #5fd08a;
  --ok-soft: #12301f;
  --ok-border: #1f5a38;
  --danger: #ff8a80;
  --danger-soft: #3a1717;
  --danger-border: #6b2a2a;
  --warn-soft: #33270c;
  --warn-border: #6b5316;
  --info: #9db3ff;
  --info-soft: #1d2748;
  --info-border: #2f3f77;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 22px rgba(0, 0, 0, .3);
  --shadow-pop: 0 14px 36px rgba(0, 0, 0, .6);
  --ring: rgba(157, 179, 255, .5);
  --header-bg: rgba(12, 16, 25, .82);
  --av-bg-l: 22%;
  --av-fg-l: 82%;
}

/* ---------- Grundlagen ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; overflow-wrap: anywhere; hyphens: auto; }
h1 { font-size: 1.85rem; margin: 0 0 12px; font-weight: 750; }
h2 { font-size: 1.25rem; margin: 26px 0 12px; font-weight: 700; }
h3 { font-size: 1.05rem; margin: 24px 0 10px; font-weight: 700; }
.lead { font-size: 1.08rem; color: var(--muted); max-width: 60ch; margin: 0; }
.muted { color: var(--muted); }
code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 7px; border-radius: 6px; font-size: .9em; word-break: break-all; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 540px; margin-left: auto; margin-right: auto; }
main.wrap { padding-top: 34px; padding-bottom: 40px; min-height: 72vh; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Kopfzeile ---------- */
.top {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.bar { display: flex; align-items: center; gap: 10px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 750; font-size: 1.05rem; text-decoration: none; letter-spacing: -.01em; margin-right: auto; min-width: 0; }
.brand img { border-radius: 8px; flex: none; }
.brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav form.inline { display: inline; margin: 0; }
.nav-link {
  display: inline-flex; align-items: center; padding: 8px 14px; border-radius: 999px;
  color: var(--muted); font: inherit; font-weight: 600; font-size: .95rem; text-decoration: none;
  background: none; border: 0; cursor: pointer; transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--primary-soft); color: var(--link); }
.icon-btn {
  display: none; align-items: center; justify-content: center; width: 42px; height: 42px; flex: none;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.js .icon-btn.theme-btn { display: inline-flex; }
.icon-btn .icon { display: block; }
.icon-sun { display: none; }
.icon-moon { display: inline-flex; }
:root[data-theme="dark"] .icon-sun { display: inline-flex; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: inline-flex; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}
.menu-btn .icon-close { display: none; }
.menu-btn.is-open .icon-close { display: inline-flex; }
.menu-btn.is-open .icon-open { display: none; }

/* ---------- Karten, Hero ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; margin: 16px 0; box-shadow: var(--shadow);
}
.card h2:first-child { margin-top: 0; }
.hero {
  position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: 22px;
  padding: 34px 30px; margin-bottom: 26px;
  background: radial-gradient(900px 260px at 100% -40%, var(--primary-soft), transparent 70%), var(--surface);
  box-shadow: var(--shadow);
}
.hero h1 { font-size: 2.2rem; margin-bottom: 10px; }
.eyebrow { display: inline-block; margin-bottom: 10px; padding: 4px 12px; border-radius: 999px; background: var(--primary-soft); color: var(--link); font-size: .82rem; font-weight: 700; letter-spacing: .02em; }
.backlink { display: inline-block; margin-bottom: 10px; text-decoration: none; font-weight: 600; }
.backlink:hover { text-decoration: underline; }

/* ---------- Lehrkräfte-Kacheln ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tile {
  display: flex; align-items: center; gap: 14px; margin: 0; padding: 16px 18px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.tile:hover { transform: translateY(-2px); border-color: var(--primary); box-shadow: var(--shadow-pop); }
.tile .tile-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.tile strong { font-size: 1.05rem; }
.tile .chev { color: var(--muted); flex: none; }
.avatar {
  --h: 225;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 48px; height: 48px; border-radius: 50%; font-weight: 750; font-size: 1rem; letter-spacing: .02em;
  background: hsl(var(--h) 80% var(--av-bg-l)); color: hsl(var(--h) 70% var(--av-fg-l));
}
.avatar.lg { width: 60px; height: 60px; font-size: 1.25rem; }
.av-0 { --h: 225; } .av-1 { --h: 160; } .av-2 { --h: 12; } .av-3 { --h: 280; } .av-4 { --h: 35; } .av-5 { --h: 195; }
.person { display: flex; align-items: center; gap: 16px; margin: 4px 0 14px; }
.person h1 { margin: 0; }
.person p { margin: 2px 0 0; }
.search { position: relative; margin: 0 0 16px; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 44px; margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 28px 10px; }

.badge { display: inline-block; align-self: flex-start; padding: 3px 11px; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.badge.free { background: var(--ok-soft); color: var(--ok); }
.badge.full { background: var(--surface-2); color: var(--muted); }

/* ---------- Formulare ---------- */
label { display: block; font-weight: 600; font-size: .94rem; margin: 14px 0 0; }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
input, select, textarea {
  display: block; width: 100%; margin-top: 6px; padding: 11px 13px; font: inherit; color: var(--text);
  background: var(--input-bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }
input.code { font: 700 1.4rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .2em; text-transform: uppercase; text-align: center; }

.btn {
  display: inline-block; margin-top: 16px; padding: 11px 20px; font: inherit; font-weight: 650; font-size: .97rem;
  color: var(--on-primary); background: var(--primary); border: 1px solid transparent; border-radius: 12px;
  cursor: pointer; text-decoration: none; text-align: center; transition: background .15s, transform .05s, border-color .15s;
}
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.small { margin: 0; padding: 6px 12px; font-size: .86rem; border-radius: 10px; }
a.btn.small { display: inline-block; }

.flash { display: flex; gap: 10px; padding: 13px 16px; border-radius: 12px; margin: 0 0 16px; font-weight: 550; word-break: break-word; border: 1px solid; }
.flash.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--ok-border); }
.flash.error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-border); }
.flash.info { background: var(--info-soft); color: var(--info); border-color: var(--info-border); }

.head-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.head-row .btn { margin-top: 0; }
.head-row h1, .head-row h2 { margin-bottom: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.linkbox { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 4px 0 16px; padding: 12px 14px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 12px; }
.linkbox a { text-decoration: none; min-width: 0; }
.linkbox .btn { margin-left: auto; }

/* ---------- Kennzahlen ---------- */
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin: 14px 0 18px; }
.stat {
  flex: 1 1 130px; display: flex; flex-direction: column; padding: 14px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  border-top: 3px solid var(--primary);
}
.stat:nth-child(2) { border-top-color: var(--ok); }
.stat:nth-child(3) { border-top-color: #e0a100; }
.stat:nth-child(4) { border-top-color: var(--muted); }
.stat strong { font-size: 1.9rem; line-height: 1.1; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: .88rem; }

/* ---------- Tabellen ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tr.free td { color: var(--muted); }
tr.booked td:first-child { box-shadow: inset 4px 0 0 var(--primary); font-weight: 650; }
tr.inactive td { color: var(--muted); opacity: .75; }
table.compact td, table.compact th { font-size: .84rem; padding: 6px 9px; }
table.compact { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.t-bookings:not(.t-admin) { table-layout: fixed; }
.t-bookings:not(.t-admin) th:nth-child(1) { width: 22%; }
.t-bookings:not(.t-admin) th:nth-child(2) { width: 30%; }
.t-bookings:not(.t-admin) th:nth-child(4) { width: 18%; }
.t-admin td.noprint { width: 400px; }

.rowactions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
.rowactions form { margin: 0; }
.t-admin .rowactions { justify-content: flex-end; }
.editbox { position: relative; }
.editbox summary { list-style: none; display: inline-block; cursor: pointer; margin: 0; }
.editbox summary::-webkit-details-marker { display: none; }
.editbox[open] summary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.editform {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: min(350px, 86vw); padding: 14px 16px 16px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-pop); text-align: left;
}
.editform label { margin-top: 10px; font-size: .88rem; }
.editform .btn { margin-top: 14px; }

.inline-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.inline-grid label { margin: 0; }
.inline-grid .btn { margin: 0; }

/* ---------- Terminauswahl ---------- */
fieldset.day { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); margin: 14px 0; padding: 12px 18px 18px; min-width: 0; }
fieldset.day legend { font-weight: 750; padding: 0 10px; }
.slotgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.slot { display: block; margin: 0; position: relative; }
.slot input { position: absolute; opacity: 0; pointer-events: none; }
.slot span, .slot.taken {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 12px 6px; min-height: 62px;
  border: 2px solid var(--ok-border); background: var(--ok-soft); color: var(--text); border-radius: 12px; font-weight: 750;
  cursor: pointer; transition: border-color .12s, background .12s, transform .08s;
}
.slot:hover span { border-color: var(--ok); }
.slot small { font-weight: 500; color: var(--muted); font-size: .78rem; }
.slot.taken { border-color: var(--border); background: var(--surface-2); color: var(--muted); cursor: not-allowed; text-decoration: line-through; opacity: .8; }
.slot input:checked + span { border-color: var(--primary); background: var(--primary); color: var(--on-primary); }
.slot input:checked + span small { color: var(--on-primary); opacity: .85; }
.slot input:checked + span::after { content: "✓"; position: absolute; top: 6px; right: 10px; font-size: .85rem; }
.slot input:focus-visible + span { outline: 3px solid var(--ring); outline-offset: 2px; }

.codebox { margin: 18px 0; padding: 18px; text-align: center; background: var(--warn-soft); border: 2px dashed var(--warn-border); border-radius: 14px; }
.codebox span { display: block; color: var(--muted); font-size: .9rem; }
.codebox strong { font: 750 2.1rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .25em; }
.big { font-size: 1.25rem; font-weight: 750; }
.tight { margin: 4px 0 0; }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 20px; padding-top: 18px; padding-bottom: 30px; color: var(--muted); font-size: .86rem; border-top: 1px solid var(--border); }

@supports (padding: max(0px)) {
  .wrap { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
}
.no-anim *, .no-anim *::before, .no-anim *::after { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- Mobil ---------- */
@media (max-width: 820px) {
  main.wrap { padding-top: 22px; }
  h1 { font-size: 1.5rem; }
  .hero { padding: 24px 20px; border-radius: 18px; }
  .hero h1 { font-size: 1.6rem; }
  .brand span { font-size: .9rem; }
  .card { padding: 16px; }

  /* Menü klappt unter der Kopfzeile auf (nur mit JavaScript, sonst bleibt es sichtbar) */
  .js .menu-btn { display: inline-flex; }
  .js .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 2px;
    padding: 10px 16px 16px; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-pop);
  }
  .js .nav.open { display: flex; }
  .js .nav .nav-link { width: 100%; padding: 13px 14px; border-radius: 12px; font-size: 1rem; justify-content: flex-start; }
  .js .nav form.inline { display: block; }
  html:not(.js) .bar { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  html:not(.js) .nav { width: 100%; flex-wrap: wrap; }

  input, select, textarea { min-height: 48px; font-size: 16px; }
  .btn { display: block; width: 100%; min-height: 48px; padding: 12px 16px; }
  .btn.small { display: inline-block; width: auto; min-height: 42px; padding: 9px 14px; }
  .head-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .actions { flex-direction: column; }
  .actions .btn { margin-top: 0; }
  .inline-grid { grid-template-columns: 1fr; }
  .inline-grid .btn { margin-top: 6px; }
  .linkbox .btn { margin-left: 0; width: 100%; }

  .stats { flex-wrap: nowrap; gap: 8px; }
  .stat { flex: 1 1 0; min-width: 0; padding: 10px 12px; }
  .stat strong { font-size: 1.5rem; }
  .stat span { font-size: .78rem; line-height: 1.25; }

  .slotgrid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .slot span, .slot.taken { padding: 14px 6px; min-height: 66px; }
  fieldset.day { padding: 10px 12px 14px; }
  .codebox strong { font-size: 1.6rem; letter-spacing: .18em; }
  input.code { font-size: 1.25rem; }

  /* Tabellen werden zu Karten mit Beschriftung */
  table:not(.compact), table:not(.compact) thead, table:not(.compact) tbody,
  table:not(.compact) tr, table:not(.compact) th, table:not(.compact) td { display: block; }
  table:not(.compact) thead { display: none; }
  table:not(.compact) tr { border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; margin: 0 0 10px; background: var(--surface); }
  table:not(.compact) tr.free { background: var(--surface-2); }
  table:not(.compact) tr.booked { border-left: 4px solid var(--primary); }
  table:not(.compact) tr.booked td:first-child { box-shadow: none; }
  table:not(.compact) td { border: 0; padding: 3px 0; background: transparent !important; }
  table:not(.compact) td:first-child { font-weight: 750; font-size: 1.05rem; }
  table:not(.compact) td:empty { display: none; }
  .rowactions { margin-top: 8px; }
  .t-admin td.noprint { width: auto; }
  .t-admin .rowactions { justify-content: flex-start; }
  .editbox { width: 100%; }
  .editform { position: static; width: 100%; margin-top: 8px; box-shadow: none; background: var(--surface-2); }
  .editform .btn.small { width: 100%; min-height: 46px; }
  td form { margin-top: 6px; }

  .t-bookings td:nth-child(2)::before { content: "Kind: "; color: var(--muted); font-weight: 400; }
  .t-bookings td:nth-child(3)::before { content: "Eltern: "; color: var(--muted); font-weight: 400; }
  .t-bookings td.noprint::before, .t-allbook td.noprint::before { content: none; }
  .t-users td:nth-child(2)::before { content: "Benutzer: "; color: var(--muted); }
  .t-users td:nth-child(3)::before { content: "Rolle: "; color: var(--muted); }
  .t-users td:nth-child(4)::before { content: "Raum: "; color: var(--muted); }
  .t-users td:nth-child(5)::before { content: "Gebucht/Termine: "; color: var(--muted); }
  .t-users td:nth-child(6)::before { content: "Status: "; color: var(--muted); }
  .t-allbook td:nth-child(2)::before { content: "Zeit: "; color: var(--muted); }
  .t-allbook td:nth-child(3)::before { content: "Lehrkraft: "; color: var(--muted); }
  .t-allbook td:nth-child(4)::before { content: "Kind: "; color: var(--muted); }
  .t-allbook td:nth-child(5)::before { content: "Eltern: "; color: var(--muted); }
  .t-users td:nth-child(n+2), .t-allbook td:nth-child(n+2), .t-bookings td:nth-child(n+2) { font-weight: 500; }
}

@media (max-width: 380px) {
  .wrap { padding-left: 14px; padding-right: 14px; }
  .brand span { font-size: .8rem; }
  .bar { gap: 8px; }
  .slotgrid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Drucken: immer hell und ohne Bedienelemente ---------- */
@media print {
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    --bg: #fff !important; --surface: #fff !important; --surface-2: #fff !important; --text: #000 !important;
    --muted: #333 !important; --border: #999 !important; --shadow: none !important; --primary-soft: #fff !important;
  }
  .top, .noprint, .foot, .btn, .linkbox, .backlink { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .stat, fieldset.day { border: 0; padding: 0; box-shadow: none; }
  table, thead, tbody, tr, th, td { display: revert; }
  thead { display: table-header-group; }
  td, th { border-bottom: 1px solid #999; }
}
