/* Schule – iOS-Liquid-Glass, heller Modus.
   Glas (backdrop-filter) nur für die schwebende Ebene: Tab-Leiste, Topbar, Sheet, Steuerelemente.
   Inhaltskarten sind durchscheinend ohne Blur – über dem ruhigen Verlauf sieht das gleich aus und kostet nichts. */

:root {
  color-scheme: light;
  --bg: #eef1f8;
  --wall-1: rgba(110, 160, 255, .45); --wall-2: rgba(255, 160, 205, .38); --wall-3: rgba(120, 225, 200, .36); --wall-4: rgba(255, 205, 140, .34);
  --wall-base: linear-gradient(180deg, #eef2fb, #f6f4fa 50%, #f1f6f6);
  --glass-top: rgba(255, 255, 255, .5); --glass-bottom: rgba(255, 255, 255, .3); --glass-hi: rgba(255, 255, 255, .5);
  --glass-blur: blur(14px) saturate(190%) brightness(1.05);
  --rim: rgba(255, 255, 255, .95); --rim-soft: rgba(255, 255, 255, .2); --rim-low: rgba(255, 255, 255, .45);
  --edge-rgb: 238, 241, 248;
  --sheet-bg: rgba(247, 248, 252, .84); --sheet-hi: rgba(255, 255, 255, .7);
  --raised: #fff; --thumb: rgba(255, 255, 255, .92); --input-bg: rgba(255, 255, 255, .7); --soft-bg: rgba(255, 255, 255, .38);
  --press: rgba(0, 0, 0, .045); --hover: rgba(255, 255, 255, .4); --ink: #000; --tab-ink: rgba(0, 0, 0, .78);
  --scrim: rgba(10, 14, 30, .28); --lens-idle: rgba(120, 120, 128, .14); --lens-lift: rgba(255, 255, 255, .42); --grabber: rgba(60, 60, 67, .26);
  --blue: #007aff; --green: #34c759; --red: #ff3b30; --orange: #ff9500; --yellow: #ffcc00;
  --indigo: #5856d6; --purple: #af52de; --pink: #ff2d55; --teal: #30b0c7; --mint: #00c7be; --cyan: #32ade6; --brown: #a2845e;
  --label: rgba(0, 0, 0, .9);
  --label2: rgba(60, 60, 67, .64);
  --label3: rgba(60, 60, 67, .34);
  --sep: rgba(60, 60, 67, .13);
  --fill: rgba(120, 120, 128, .12);
  --card: rgba(255, 255, 255, .64);
  --card-edge: rgba(255, 255, 255, .75);
  --shadow-card: 0 1px 1px rgba(20, 28, 60, .03), 0 6px 22px rgba(20, 28, 60, .06);
  --shadow-float: 0 12px 40px rgba(20, 28, 60, .14), 0 2px 8px rgba(20, 28, 60, .08);
  --r-card: 26px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --top: calc(var(--safe-t) + 52px);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
html { background: var(--bg); transition: background-color .4s; } /* nicht auf body: dessen Hintergrund läge über dem z-index:-1-Verlauf */
body {
  font: 17px/1.29 var(--font);
  letter-spacing: -.41px;
  color: var(--label);
  -webkit-font-smoothing: antialiased;
  font-optical-sizing: auto;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}
button { font: inherit; color: inherit; letter-spacing: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
[hidden] { display: none !important; }
a { color: var(--blue); text-decoration: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent); outline-offset: 2px; border-radius: 12px; }

/* Ruhiger Pastell-Verlauf: gibt dem Glas etwas zum Brechen, bewegt sich nie (vestibulär unkritisch) */
.wallpaper {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 45% at 8% 4%, var(--wall-1), transparent 70%),
    radial-gradient(55% 40% at 100% 12%, var(--wall-2), transparent 70%),
    radial-gradient(60% 45% at 85% 92%, var(--wall-3), transparent 70%),
    radial-gradient(55% 45% at 0% 85%, var(--wall-4), transparent 70%),
    var(--wall-base);
}

/* ---------------------------------------------------------------- Glas */
.glass {
  position: relative;
  background:
    radial-gradient(120% 70% at 50% 0%, var(--glass-hi), transparent 65%),
    linear-gradient(180deg, var(--glass-top), var(--glass-bottom));
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow:
    inset 0 1px .5px var(--rim),
    inset 0 -1px 1px var(--rim-low),
    inset 0 -10px 20px -14px rgba(20, 28, 60, .10),
    var(--shadow-float);
}
/* Lichtkante: oben links und unten rechts fängt das Material Licht */
.glass::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, var(--rim), var(--rim-soft) 30%, transparent 50%, var(--rim-soft) 70%, var(--rim));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.circle {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 600; letter-spacing: -.2px;
}
.circle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

/* Druck-Feedback sofort beim Aufsetzen, nicht erst beim Loslassen */
.pressable { transition: transform .32s var(--ease-out), opacity .2s; }
.pressable:active { transform: scale(.96); transition-duration: .08s; }

/* ---------------------------------------------------------------- Gerüst */
#app { position: fixed; inset: 0; transform-origin: 50% 0; }
#app.pushed { overflow: hidden; border-radius: 22px; }
main { position: absolute; inset: 0; }
.view {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: var(--top) 16px calc(var(--safe-b) + 112px);
  scrollbar-width: none;
}
.view::-webkit-scrollbar { display: none; }
.view > * { max-width: 680px; margin-left: auto; margin-right: auto; }
.view.enter { animation: fade-in .18s var(--ease-out); }
@keyframes fade-in { from { opacity: 0; } }

/* Topbar mit Scroll-Kanten-Effekt statt harter Trennlinie */
#topbar {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0;
  height: var(--top); padding: var(--safe-t) 16px 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
#topbar .edge {
  position: absolute; inset: 0 0 -18px;
  -webkit-backdrop-filter: blur(10px) saturate(160%);
  backdrop-filter: blur(10px) saturate(160%);
  background: linear-gradient(180deg, rgba(var(--edge-rgb), .82), rgba(var(--edge-rgb), .35) 70%, rgba(var(--edge-rgb), 0));
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
  mask-image: linear-gradient(180deg, #000 55%, transparent);
  opacity: var(--edge, 0);
}
#compact-title { position: relative; font-size: 17px; font-weight: 600; letter-spacing: -.43px; opacity: var(--edge, 0); }
#me, #add, #search { position: absolute; right: 16px; bottom: 4px; pointer-events: auto; color: var(--blue); }
#add { right: 70px; }
#search { right: 124px; }
#search svg { width: 20px; height: 20px; stroke-width: 2.2; }
#add svg { width: 22px; height: 22px; stroke-width: 2.4; }

/* Große Titel: enges Tracking und knapper Zeilenabstand, je größer desto enger */
.large-title { padding: 6px 4px 14px; }
.large-title .eyebrow { margin: 0 0 2px; font-size: 13px; line-height: 18px; font-weight: 600; letter-spacing: -.08px; color: var(--label2); text-transform: uppercase; }
.large-title h1 { margin: 0; font-size: 34px; line-height: 40px; font-weight: 700; letter-spacing: -.022em; }
.section-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 26px 4px 10px; font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -.02em;
}
.section-title a, .section-title button { font-size: 15px; font-weight: 500; letter-spacing: -.24px; color: var(--blue); }

/* ---------------------------------------------------------------- Karten & Listen */
.card {
  position: relative;
  background: var(--card);
  border-radius: var(--r-card);
  box-shadow: inset 0 0 0 .5px var(--card-edge), inset 0 1px 0 var(--rim-soft), var(--shadow-card);
}
.list { overflow: hidden; }
.row {
  position: relative; display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 56px; padding: 12px 16px;
}
.row + .row::before {
  content: ""; position: absolute; top: 0; right: 0; left: var(--inset, 16px);
  height: 1px; background: var(--sep); transform: scaleY(.5); transform-origin: 0 0;
}
button.row { transition: background-color .25s; }
button.row:active { background-color: var(--press); transition-duration: 0s; }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 600; letter-spacing: -.41px; }
.row .sub { margin-top: 2px; font-size: 15px; line-height: 20px; letter-spacing: -.24px; color: var(--label2); }
.row .trail { flex: none; font-size: 15px; letter-spacing: -.24px; color: var(--label2); font-variant-numeric: tabular-nums; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chev { flex: none; width: 8px; height: 14px; fill: none; stroke: var(--label3); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px; border-radius: 11px;
  font-size: 12px; font-weight: 600; letter-spacing: 0; white-space: nowrap;
  color: color-mix(in srgb, var(--c, var(--blue)) 82%, var(--ink));
  background: color-mix(in srgb, var(--c, var(--blue)) 14%, transparent);
}
.chip.solid { color: #fff; background: var(--c, var(--blue)); }
.meta-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }

.empty { padding: 34px 20px; text-align: center; color: var(--label2); font-size: 15px; letter-spacing: -.24px; }
.empty svg { display: block; width: 44px; height: 44px; margin: 0 auto 10px; fill: none; stroke: var(--label3); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.btn-link { color: var(--blue); font-weight: 500; }
.footnote { margin: 22px 4px 0; text-align: center; font-size: 13px; line-height: 18px; letter-spacing: -.08px; color: var(--label2); }

.banner {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; margin-bottom: 12px;
  font-size: 15px; line-height: 20px; letter-spacing: -.24px;
}
.banner b { display: block; font-weight: 600; }
.banner.warn { --c: var(--orange); }
.banner.info { --c: var(--indigo); }
.banner::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--c); }

/* ---------------------------------------------------------------- Heute */
.hero { display: block; width: 100%; padding: 20px 20px 18px; overflow: hidden; border-radius: 30px; }
.hero::before {  /* Fachfarbe leuchtet durch das Glas */
  content: ""; position: absolute; inset: -40% -20% auto auto; width: 75%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--c, var(--blue)) 34%, transparent), transparent);
  pointer-events: none;
}
.hero .kicker { font-size: 13px; font-weight: 600; letter-spacing: -.08px; color: color-mix(in srgb, var(--c, var(--blue)) 85%, var(--ink)); text-transform: uppercase; }
.hero .subject { margin: 4px 0 2px; font-size: 30px; line-height: 35px; font-weight: 700; letter-spacing: -.022em; }
.hero .where { font-size: 15px; letter-spacing: -.24px; color: var(--label2); }
.hero .progress { height: 6px; margin: 16px 0 8px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.hero .progress i { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--blue)); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); transition: transform 1s linear; }
.hero .foot { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; letter-spacing: -.08px; color: var(--label2); font-variant-numeric: tabular-nums; }
.hero .foot b { color: var(--label); font-weight: 600; }
.hero.alert { --c: var(--orange); }

.mini-lesson .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.mini-lesson .time { flex: none; width: 46px; font-size: 15px; font-weight: 500; color: var(--label2); font-variant-numeric: tabular-nums; letter-spacing: -.24px; }

/* ---------------------------------------------------------------- Plan */
.seg {
  position: relative; display: flex; padding: 4px; border-radius: 999px;
  -webkit-user-select: none; user-select: none;
}
.seg-bar { position: sticky; z-index: 5; top: calc(var(--top) - 4px); margin-bottom: 16px; }
.seg button { position: relative; z-index: 1; flex: 1; min-height: 36px; border-radius: 999px; text-align: center; font-size: 13px; font-weight: 600; letter-spacing: -.08px; color: var(--label2); transition: color .25s; }
.seg button[aria-selected="true"] { color: var(--label); }
.seg .thumb {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; border-radius: 999px;
  background: var(--thumb);
  box-shadow: 0 3px 10px rgba(20, 28, 60, .12), 0 0 0 .5px rgba(20, 28, 60, .05), inset 0 1px 0 var(--rim-soft);
  will-change: transform;
}
.days button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 50px; }
.days button span { font-size: 11px; font-weight: 600; letter-spacing: .06px; text-transform: uppercase; }
.days button b { font-size: 19px; font-weight: 600; letter-spacing: -.45px; font-variant-numeric: tabular-nums; color: var(--label); }
.days button.today b { color: var(--blue); }
.days button i { position: absolute; top: 5px; right: calc(50% - 21px); width: 6px; height: 6px; border-radius: 50%; background: var(--orange); }

.pager {
  display: flex; margin: 0 -16px; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none; max-width: none;
}
.pager::-webkit-scrollbar { display: none; }
.page { flex: 0 0 100%; padding: 0 16px; scroll-snap-align: start; scroll-snap-stop: always; }
.page > * { max-width: 680px; margin-left: auto; margin-right: auto; }
.page-day { display: none; }

.lesson { --inset: 74px; align-items: stretch; min-height: 68px; }
.lesson .time { flex: none; width: 46px; display: flex; flex-direction: column; justify-content: center; font-variant-numeric: tabular-nums; }
.lesson .time b { font-size: 15px; font-weight: 600; letter-spacing: -.24px; }
.lesson .time span { font-size: 13px; color: var(--label2); letter-spacing: -.08px; }
.lesson .bar { flex: none; width: 4px; border-radius: 2px; background: var(--c); }
.lesson .main { display: flex; flex-direction: column; justify-content: center; }
.lesson .num { flex: none; align-self: center; font-size: 13px; font-weight: 600; color: var(--label3); font-variant-numeric: tabular-nums; }
.lesson.cancelled .title { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--label2); }
.lesson.now { background: color-mix(in srgb, var(--blue) 7%, transparent); }
/* Vertretung und Entfall sitzen direkt an der betroffenen Stunde */
.lesson.changed { background: color-mix(in srgb, var(--orange) 10%, transparent); }
.lesson.changed .bar { background: var(--orange); }
.lesson.cancelled { background: color-mix(in srgb, var(--red) 6%, transparent); }
.lesson.cancelled .bar { background: color-mix(in srgb, var(--red) 55%, transparent); }
.change-text { margin-top: 4px; font-size: 13px; line-height: 18px; font-weight: 500; letter-spacing: -.08px; color: color-mix(in srgb, var(--orange) 80%, var(--ink)); }
.cancelled .change-text { color: color-mix(in srgb, var(--red) 85%, var(--ink)); }
.break { display: flex; align-items: center; gap: 10px; padding: 6px 16px 6px 74px; font-size: 12px; font-weight: 500; color: var(--label3); }
.break::after { content: ""; flex: 1; height: 1px; background: var(--sep); }

/* ---------------------------------------------------------------- Aufgaben (Erinnerungen) */
.task { --inset: 56px; align-items: flex-start; padding-top: 13px; padding-bottom: 13px; }
.check {
  flex: none; position: relative; width: 26px; height: 26px; margin: -1px 2px 0 0; border-radius: 50%;
  box-shadow: inset 0 0 0 1.75px var(--label3);
  transition: box-shadow .2s;
}
.check::after {
  content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--c, var(--blue));
  transform: scale(0); transition: transform .35s cubic-bezier(.34, 1.56, .64, 1);
}
.check[aria-checked="true"] { box-shadow: inset 0 0 0 1.75px var(--c, var(--blue)); }
.check[aria-checked="true"]::after { transform: scale(1); }
.task .main { padding-top: 1px; }
.task .title { font-weight: 400; }
.task.done .title { color: var(--label2); }
.task.leaving { animation: leave .45s .35s var(--ease-out) forwards; }
@keyframes leave { to { opacity: 0; transform: translateX(14px); } }
.due { font-size: 13px; font-weight: 500; color: var(--label2); letter-spacing: -.08px; }
.due.late { color: var(--red); }
.due.soon { color: var(--orange); }
.disclosure { display: flex; align-items: center; gap: 6px; margin: 22px auto 0; padding: 8px 14px; border-radius: 999px; font-size: 15px; font-weight: 500; color: var(--blue); letter-spacing: -.24px; }

/* ---------------------------------------------------------------- Nachrichten */
.msg { --inset: 70px; align-items: flex-start; }
.avatar {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center; font-size: 15px; font-weight: 600; letter-spacing: 0; color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 72%, #fff), var(--c));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45);
}
.msg .head { display: flex; gap: 8px; align-items: baseline; }
.msg .head .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg .head time { flex: none; font-size: 15px; color: var(--label2); letter-spacing: -.24px; }
.msg.unread::after { content: ""; position: absolute; left: 5px; top: 30px; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.msg.unread .title { font-weight: 700; }

.bubble { white-space: pre-wrap; overflow-wrap: anywhere; }
.thread { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.reply { padding: 10px 14px; border-radius: 20px; background: var(--fill); font-size: 15px; line-height: 20px; letter-spacing: -.24px; }
.reply b { display: block; margin-bottom: 2px; font-size: 13px; color: var(--label2); }
.attach { display: flex; align-items: center; gap: 10px; }
.attach svg { flex: none; width: 22px; height: 22px; fill: none; stroke: var(--blue); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- Noten */
.grade-row .avg { flex: none; min-width: 52px; text-align: right; font-size: 22px; font-weight: 700; letter-spacing: -.45px; font-variant-numeric: tabular-nums; }
.grade-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.grade-chip { min-width: 30px; height: 24px; padding: 0 7px; border-radius: 8px; display: inline-grid; place-items: center; font-size: 13px; font-weight: 600; background: var(--fill); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- Tab-Leiste */
#tabbar {
  position: fixed; z-index: 30;
  left: 50%; bottom: max(calc(var(--safe-b) - 10px), 14px);
  width: min(calc(100% - 28px), 460px); height: 66px;
  translate: -50% 0;
  display: flex; padding: 4px; border-radius: 33px;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: none;
}
#tabbar button {
  position: relative; z-index: 1; flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 29px; color: var(--tab-ink);
  transition: color .2s;
}
#tabbar button[aria-selected="true"] { color: var(--blue); }
#tabbar svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }
#tabbar svg .fill { fill: currentColor; stroke: none; }
#tabbar button[aria-selected="true"] svg { stroke-width: 2.2; }
#tabbar span { font-size: 10px; line-height: 12px; font-weight: 600; letter-spacing: .1px; }
.badge {
  position: absolute; top: 3px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  font-size: 11px; line-height: 18px; font-weight: 700; letter-spacing: 0; text-align: center; color: #fff;
  background: var(--red); box-shadow: 0 0 0 2px rgba(255, 255, 255, .7);
}
.badge.orange { background: var(--orange); }

.lens { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0; pointer-events: none; will-change: transform; }
.lens i {
  position: absolute; inset: 0; border-radius: 29px;
  background: var(--lens-idle);
  transition: transform .45s cubic-bezier(.34, 1.4, .64, 1), background-color .3s, box-shadow .3s;
}
/* Beim Greifen hebt sich die Linse als eigenes Glas aus der Leiste */
.lens.lifted i {
  transform: scale(1.14, 1.2);
  background: var(--lens-lift);
  box-shadow: inset 0 1px 1px var(--rim), inset 0 -1px 1px var(--rim-low), 0 8px 24px rgba(20, 28, 60, .16), 0 0 0 .5px rgba(255, 255, 255, .8);
  transition-duration: .3s;
}

/* ---------------------------------------------------------------- Sheet */
#scrim { position: fixed; inset: 0; z-index: 40; background: var(--scrim); opacity: 0; will-change: opacity; }
#sheet {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: 0;
  top: calc(var(--safe-t) + 10px);
  max-width: 720px; margin: 0 auto;
  display: flex; flex-direction: column;
  border-radius: 38px 38px 0 0;
  background:
    radial-gradient(120% 40% at 50% 0%, var(--sheet-hi), transparent 70%),
    var(--sheet-bg);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  box-shadow: inset 0 1px .5px var(--rim), 0 -8px 40px rgba(20, 28, 60, .16);
  transform: translateY(110%);
  will-change: transform;
}
.sheet-head { position: relative; flex: none; padding: 22px 70px 10px 22px; touch-action: none; cursor: grab; }
.grabber { position: absolute; top: 7px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--grabber); }
.sheet-head h2 { margin: 6px 0 0; min-height: 34px; font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -.02em; }
.sheet-close { position: absolute; top: 16px; right: 16px; color: var(--label2); }
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px calc(var(--safe-b) + 28px); }
.sheet-body > * + * { margin-top: 14px; }
.sheet-body .card { padding: 16px; }
.sheet-body .list.card { padding: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 15px; letter-spacing: -.24px; }
.kv dt { color: var(--label2); }
.kv dd { margin: 0; text-align: right; font-weight: 500; }
.label-sm { margin: 20px 4px 8px; font-size: 13px; font-weight: 600; letter-spacing: -.08px; color: var(--label2); text-transform: uppercase; }

/* Schalter im iOS-Stil */
.switch { appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 51px; height: 31px; margin: 0; border-radius: 16px; background: var(--fill); transition: background-color .25s; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .16); transition: transform .35s cubic-bezier(.34, 1.3, .64, 1); }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }
.switch:disabled { opacity: .45; }

.btn-primary {
  display: block; width: 100%; height: 52px; border-radius: 26px; text-align: center;
  font-size: 17px; font-weight: 600; letter-spacing: -.41px; color: #fff;
  background: linear-gradient(180deg, #2b8fff, var(--blue));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 6px 18px color-mix(in srgb, var(--blue) 32%, transparent);
}
.btn-primary:disabled { opacity: .6; }
.btn-plain { width: 100%; text-align: center; font-weight: 500; color: var(--blue); }
.btn-plain.danger { color: var(--red); }

/* ---------------------------------------------------------------- Login & Start */
#login, #boot { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 380px); padding: 34px 24px 24px; border-radius: 36px; text-align: center; }
.app-icon { display: block; margin: 0 auto 16px; border-radius: 20px; box-shadow: 0 8px 24px rgba(20, 50, 140, .25); }
.login-card h1 { margin: 0; font-size: 28px; line-height: 34px; font-weight: 700; letter-spacing: -.022em; }
.login-card p { margin: 6px 0 22px; font-size: 15px; line-height: 20px; letter-spacing: -.24px; color: var(--label2); }
.login-card input[type=password] {
  width: 100%; height: 52px; padding: 0 18px; border: 0; border-radius: 16px; outline: none;
  font: 17px var(--font); letter-spacing: -.41px; color: var(--label);
  background: var(--input-bg); box-shadow: inset 0 0 0 .5px var(--sep), inset 0 1px 2px rgba(20, 28, 60, .06);
}
.login-card input[type=password]:focus { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--blue) 60%, transparent); }
.login-card .login-error { min-height: 20px; margin: 8px 0 10px; color: var(--red); }
.shake { animation: shake .4s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
#boot { z-index: 49; pointer-events: none; }
#boot p { margin: 14px 0 0; font-size: 15px; color: var(--label2); text-align: center; }
.spinner { width: 28px; height: 28px; margin: 0 auto; border-radius: 50%; border: 3px solid rgba(60, 60, 67, .14); border-top-color: var(--label2); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.haptic { position: fixed; left: -100px; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }

/* ---------------------------------------------------------------- Eigene Einträge */
.event .bar { background: repeating-linear-gradient(180deg, var(--c) 0 6px, transparent 6px 9px); }
.allday .time b { font-size: 12px; font-weight: 600; color: var(--label2); text-transform: uppercase; letter-spacing: .2px; }
.lesson .num .chip { height: 20px; padding: 0 7px; font-size: 11px; }
.add-row { display: block; width: 100%; margin-top: 10px; padding: 12px; border-radius: 18px; text-align: center; font-size: 15px; font-weight: 600; color: var(--blue); background: var(--soft-bg); box-shadow: inset 0 0 0 .5px var(--card-edge); }
.empty.slim { padding: 18px; }
button.card.empty, button.banner { display: block; width: 100%; text-align: center; }
button.banner { display: flex; text-align: left; }
.big-num { font-size: 34px; line-height: 40px; font-weight: 700; letter-spacing: -.022em; font-variant-numeric: tabular-nums; }
.grade-row .avg, .row .avg { flex: none; min-width: 52px; text-align: right; font-size: 22px; font-weight: 700; letter-spacing: -.45px; font-variant-numeric: tabular-nums; }
.warn-text { text-align: left; color: color-mix(in srgb, var(--red) 85%, var(--ink)); }

.notes-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.note { display: flex; flex-direction: column; gap: 6px; min-height: 140px; padding: 14px 16px; text-align: left; }
.note .title { display: flex; gap: 6px; align-items: center; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note .body { flex: 1; font-size: 14px; line-height: 19px; letter-spacing: -.15px; color: var(--label2); white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.note .meta-line { margin-top: 0; }
.pin { flex: none; width: 13px; height: 13px; fill: var(--orange); }

.new-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.new-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 12px; font-weight: 600; }
.new-tile svg { width: 40px; height: 40px; fill: none; stroke: var(--blue); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Formulare im iOS-Stil: gruppierte Zeilen, Beschriftung links, Wert rechts */
.form > * + * { margin-top: 14px; }
.form .footnote { margin-top: 8px; }
.form-group { padding: 0; }
.field { position: relative; display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 16px; }
.field + .field::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; height: 1px; background: var(--sep); transform: scaleY(.5); transform-origin: 0 0; }
.field input:not([type=checkbox]):not([type=radio]), .field textarea {
  flex: 1; min-width: 0; padding: 14px 0; border: 0; outline: 0; background: transparent;
  font: 17px/1.3 var(--font); letter-spacing: -.41px; color: var(--label);
}
.field textarea { resize: vertical; }
.field ::placeholder { color: var(--label3); }
.field.inline > span { flex: none; }
.field.inline input:not([type=checkbox]) { text-align: right; color: var(--blue); }
.field input[type=date], .field input[type=time] { -webkit-appearance: none; appearance: none; min-height: 24px; display: flex; justify-content: flex-end; }
.field .suffix { flex: none; font-style: normal; color: var(--label2); margin-left: -8px; }
.choice { display: flex; gap: 2px; padding: 3px; border-radius: 13px; background: var(--fill); }
.choice label { flex: 1; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: block; padding: 8px 0; border-radius: 10px; text-align: center; font-size: 14px; font-weight: 600; color: var(--label2); transition: background-color .2s, color .2s, box-shadow .2s; cursor: pointer; }
.choice input:checked + span { color: var(--label); background: var(--raised); box-shadow: 0 2px 8px rgba(20, 28, 60, .12), 0 0 0 .5px rgba(20, 28, 60, .04); }
.choice input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--blue) 55%, transparent); }
.form-error { min-height: 0; margin: 0; text-align: center; color: var(--red); font-size: 15px; }
.form-error:empty { display: none; }
.btn-plain { display: block; padding: 10px; border-radius: 14px; }
.copybox { width: 100%; padding: 10px; border: 0; border-radius: 12px; font: 12px ui-monospace, Menlo, monospace; }

/* ---------------------------------------------------------------- Klingel-Zeile und Ferien-Countdown */
.bell-row { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 12px; padding: 12px 16px; text-align: left; font-size: 15px; letter-spacing: -.24px; }
.bell-row b { font-variant-numeric: tabular-nums; color: var(--blue); }
.bell-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 18%, transparent); }
.bell-dot.pause { background: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 18%, transparent); }
.now-row { background: color-mix(in srgb, var(--blue) 8%, transparent); }
.holiday { display: flex; align-items: center; gap: 14px; margin-top: 12px; padding: 14px 18px; }
.holiday .big { min-width: 44px; font-size: 34px; line-height: 38px; font-weight: 700; letter-spacing: -.022em; font-variant-numeric: tabular-nums; color: var(--indigo); }
.holiday .title { font-weight: 600; }

/* ---------------------------------------------------------------- Schulweg: Wetter und Verbindungen */
.way { margin-top: 12px; padding-top: 14px; overflow: hidden; }
.way-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 16px; }
.way .kicker { font-size: 13px; font-weight: 600; letter-spacing: -.08px; color: var(--teal); text-transform: uppercase; }
.wx-row { display: flex; gap: 10px; padding: 10px 16px 4px; }
.wx { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.wx-icon { font-size: 28px; line-height: 1; }
.wx b { font-size: 20px; font-weight: 600; letter-spacing: -.45px; font-variant-numeric: tabular-nums; }
.wx-t { min-width: 0; }
.wx-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wx span { font-size: 15px; letter-spacing: -.24px; color: var(--label2); }
.wx small { display: block; font-size: 12px; font-weight: 500; color: var(--label3); font-variant-numeric: tabular-nums; }
.way-hint { margin: 8px 16px 0; padding: 8px 12px; border-radius: 12px; font-size: 13px; font-weight: 600; letter-spacing: -.08px;
  color: color-mix(in srgb, var(--blue) 80%, var(--ink)); background: color-mix(in srgb, var(--blue) 10%, transparent); }
.way .list { margin-top: 6px; }
.way .list .row:first-child::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; height: 1px; background: var(--sep); transform: scaleY(.5); transform-origin: 0 0; }
.trip .lines { flex: none; display: flex; align-items: center; gap: 3px; min-width: 44px; }
.trip .line { padding: 2px 7px; border-radius: 7px; font-size: 13px; font-weight: 700; color: #fff; background: var(--teal); font-variant-numeric: tabular-nums; }
.trip .via { font-size: 12px; color: var(--label3); }
.trip .title { font-variant-numeric: tabular-nums; }
.bday.today .title { color: var(--pink); }
.bday .cake { font-size: 22px; }

/* ---------------------------------------------------------------- Tafelbilder */
.photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.photo { display: block; overflow: hidden; padding: 0; text-align: left; }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--fill); }
.photo .cap { display: grid; gap: 1px; padding: 8px 12px 10px; font-size: 13px; letter-spacing: -.08px; }
.photo .cap b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo .cap span { flex: none; color: var(--label2); }
.photo-full { display: block; width: 100%; max-height: 50vh; margin-bottom: 12px; object-fit: contain; border-radius: 16px; background: var(--fill); }
.photo-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.photo-thumb { flex: none; width: 104px; height: 78px; overflow: hidden; border-radius: 12px; background: var(--fill); }
.photo-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ---------------------------------------------------------------- Lernzeit */
.ring { flex: none; transform: rotate(-90deg); }
.ring circle { fill: none; stroke: var(--fill); stroke-width: 4; }
.ring .fill { stroke: var(--c, var(--teal)); stroke-linecap: round; stroke-dasharray: 100; transition: stroke-dashoffset 1s linear; }
.timer-card { display: flex; align-items: center; gap: 14px; width: 100%; margin-top: 12px; padding: 12px 16px; text-align: left; }
.timer-card .main { flex: 1; min-width: 0; }
.timer-card .kicker { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; letter-spacing: -.08px; color: color-mix(in srgb, var(--c) 85%, var(--ink)); text-transform: uppercase; }
.timer-card .big { font-size: 28px; line-height: 32px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.timer-big { position: relative; display: grid; place-items: center; width: 220px; height: 220px; margin: 8px auto 16px; }
.timer-big .ring { position: absolute; inset: 0; }
.timer-big .ring circle { stroke-width: 2.4; }
.timer-text { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.timer-text b { font-size: 52px; line-height: 56px; font-weight: 300; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.timer-text span { font-size: 15px; letter-spacing: -.24px; color: var(--label2); }
.stats { display: grid; gap: 10px; padding: 14px 16px; }
.stat { display: grid; grid-template-columns: minmax(0, 7.5em) 1fr auto; align-items: center; gap: 10px; font-size: 15px; letter-spacing: -.24px; }
.stat span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat i { height: 8px; border-radius: 4px; background: var(--c); transform: scaleX(var(--w)); transform-origin: 0 50%; }
.stat b { font-size: 13px; font-weight: 600; color: var(--label2); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- Zuhause (Home Assistant) */
.pc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pc-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 16px; text-align: left; font-weight: 600; letter-spacing: -.24px; }
.pc-btn svg { width: 28px; height: 28px; fill: none; stroke: var(--label2); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: stroke .25s; }
.pc-btn.on svg { stroke: var(--green); }
.pc-btn small { font-size: 13px; font-weight: 500; color: var(--label2); }
.pc-btn:disabled { opacity: .5; }

/* ---------------------------------------------------------------- PC-Bildschirm */
.screen-view { position: fixed; inset: 0; z-index: 55; display: flex; flex-direction: column; background: #000; color: #fff; }
.screen-bar, .screen-keys { flex: none; display: flex; gap: 6px; padding: 8px 10px; background: rgba(28, 28, 30, .92); }
.screen-bar { align-items: center; padding-top: calc(var(--safe-t, 0px) + 8px); overflow-x: auto; scrollbar-width: none; }
.screen-keys { flex-wrap: wrap; border-top: .5px solid rgba(255, 255, 255, .12); }
.screen-keys[hidden] { display: none; }
.sbtn { flex: none; min-width: 40px; min-height: 36px; padding: 0 12px; border-radius: 999px; font-size: 14px; font-weight: 600; color: #fff; background: rgba(255, 255, 255, .14); transition: background-color .2s; }
.sbtn:active { background: rgba(255, 255, 255, .3); transition-duration: 0s; }
.sbtn[hidden] { display: none; }
.screen-area { position: relative; display: flex; flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; }
.screen-area img { display: block; flex: none; margin: auto; width: calc(var(--z, 1) * 100%); max-width: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.screen-msg { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 24px; text-align: center; font-size: 15px; color: rgba(255, 255, 255, .72); }
.screen-msg[hidden] { display: none; }
.screen-input { position: fixed; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; font-size: 16px; }

/* ---------------------------------------------------------------- Einkauf */
.shop-add { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 6px 12px 6px 16px; }
.shop-add input { flex: 1; min-width: 0; min-height: 44px; border: 0; background: none; font: inherit; color: var(--label); }
.shop-add input:focus { outline: none; }

/* ---------------------------------------------------------------- Ticket */
.ticket svg { flex: none; width: 24px; height: 24px; fill: none; stroke: var(--indigo); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ticket .main { flex: 1; min-width: 0; font-weight: 600; color: var(--label); }
.ticket b { font-weight: 500; color: var(--label2); }
.ticket b.warn { color: var(--orange); font-weight: 600; }

/* ---------------------------------------------------------------- Woche wechseln */
.week-nav { display: flex; align-items: center; gap: 10px; margin: -4px 0 14px; }
.week-nav .circle { width: 38px; height: 38px; color: var(--blue); }
.week-nav .circle svg { width: 18px; height: 18px; stroke-width: 2.6; }
.week-range { font-size: 17px; font-weight: 600; letter-spacing: -.43px; font-variant-numeric: tabular-nums; }
.today-pill { margin-left: auto; height: 36px; padding: 0 16px; border-radius: 18px; font-size: 15px; font-weight: 600; color: var(--blue); }
.pager.slide-l { animation: week-in-l .42s var(--ease-out); }
.pager.slide-r { animation: week-in-r .42s var(--ease-out); }
@keyframes week-in-l { from { opacity: 0; transform: translateX(28px); } }
@keyframes week-in-r { from { opacity: 0; transform: translateX(-28px); } }

/* ---------------------------------------------------------------- Neue Bausteine */
.field select { flex: 1; min-width: 0; padding: 14px 0; border: 0; outline: 0; background: transparent; -webkit-appearance: none; appearance: none; text-align: right; text-align-last: right; font: 17px var(--font); color: var(--blue); cursor: pointer; }
.field[hidden] { display: none; }
.pill { margin-left: 0; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--orange); background: color-mix(in srgb, var(--orange) 12%, transparent); }
.pill.on { color: #fff; background: var(--orange); }
.star { color: var(--orange); }
.msg-actions { display: flex; gap: 8px; }
.pill.like { margin-left: 0; color: var(--pink); background: color-mix(in srgb, var(--pink) 12%, transparent); }
.pill.like.on { color: #fff; background: var(--pink); }
.reply.mine { background: color-mix(in srgb, var(--blue) 14%, transparent); }
.composer { margin-top: 18px; }
.composer > * + * { margin-top: 12px; }
.to-card { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 12px; }
.to-chips { display: contents; }
.to-chip { display: inline-flex; gap: 6px; align-items: center; height: 30px; padding: 0 12px; border-radius: 15px; font-size: 15px; font-weight: 500; color: #fff; background: var(--blue); }
.to-card input { flex: 1; min-width: 160px; height: 32px; border: 0; outline: 0; background: transparent; font: 17px var(--font); color: var(--label); }
.preview { padding: 14px 16px; }
.preview .bubble { margin-top: 6px; }
.avatar.small { width: 32px; height: 32px; font-size: 13px; }
.search-field { display: flex; align-items: center; padding: 0 14px; margin-bottom: 14px; }
.search-field input { flex: 1; height: 46px; border: 0; outline: 0; background: transparent; font: 17px var(--font); letter-spacing: -.41px; color: var(--label); }
.calc { margin-top: 14px; padding: 16px; }
.calc > .title { font-weight: 600; }
.calc .form-group { margin-top: 10px; }
.calc-out { min-height: 22px; margin: 12px 4px 0; font-size: 15px; color: var(--label2); }
.calc-out b { color: var(--label); font-size: 20px; }
.calc-out.good { color: color-mix(in srgb, var(--green) 80%, var(--ink)); }
.calc-out.bad { color: color-mix(in srgb, var(--red) 85%, var(--ink)); }
.warn-label { color: color-mix(in srgb, var(--red) 85%, var(--ink)); }
.look-hint { margin: 8px 4px 0; font-size: 13px; color: var(--label2); }

/* Federnde Einblendungen wie in iOS: neue Einträge, Inhaltswechsel im Sheet, Hinweis-Kapsel */
.appear { animation: appear .55s cubic-bezier(.34, 1.4, .64, 1); }
@keyframes appear { from { opacity: 0; transform: scale(.94) translateY(6px); } }
.sheet-body.swap > * { animation: swap-in .28s var(--ease-out) both; }
@keyframes swap-in { from { opacity: 0; transform: translateY(8px); } }
#toast {
  position: fixed; z-index: 60; left: 50%; top: calc(var(--safe-t) + 12px); translate: -50% 0;
  max-width: calc(100% - 32px); padding: 12px 20px; border-radius: 999px;
  font-size: 15px; font-weight: 600; letter-spacing: -.24px; text-align: center; color: var(--label);
  transform: translateY(-160%) scale(.9); opacity: 0; pointer-events: none;
  transition: transform .55s cubic-bezier(.34, 1.4, .64, 1), opacity .3s;
}
#toast.show { transform: none; opacity: 1; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }

/* ---------------------------------------------------------------- Dunkelmodus (theme.js setzt data-theme vor dem ersten Zeichnen) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --blue: #0a84ff; --green: #30d158; --red: #ff453a; --orange: #ff9f0a; --yellow: #ffd60a;
  --indigo: #5e5ce6; --purple: #bf5af2; --pink: #ff375f; --teal: #40c8e0; --mint: #63e6e2; --cyan: #64d2ff; --brown: #ac8e68;
  --label: rgba(255, 255, 255, .94); --label2: rgba(235, 235, 245, .62); --label3: rgba(235, 235, 245, .32);
  --sep: rgba(84, 84, 88, .55); --fill: rgba(120, 120, 128, .26);
  --card: rgba(30, 30, 36, .62); --card-edge: rgba(255, 255, 255, .08);
  --shadow-card: 0 1px 1px rgba(0, 0, 0, .25), 0 6px 22px rgba(0, 0, 0, .3);
  --shadow-float: 0 12px 40px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .35);
  --bg: #0b0d14;
  --wall-1: rgba(60, 100, 230, .38); --wall-2: rgba(190, 70, 150, .3); --wall-3: rgba(40, 160, 140, .28); --wall-4: rgba(200, 120, 50, .22);
  --wall-base: linear-gradient(180deg, #0b0e18, #100c17 50%, #08120f);
  --glass-top: rgba(255, 255, 255, .13); --glass-bottom: rgba(255, 255, 255, .05); --glass-hi: rgba(255, 255, 255, .12);
  --glass-blur: blur(16px) saturate(170%) brightness(.95);
  --rim: rgba(255, 255, 255, .38); --rim-soft: rgba(255, 255, 255, .07); --rim-low: rgba(255, 255, 255, .12);
  --edge-rgb: 11, 13, 20;
  --sheet-bg: rgba(28, 28, 34, .84); --sheet-hi: rgba(255, 255, 255, .06);
  --raised: #48484f; --thumb: rgba(255, 255, 255, .2); --input-bg: rgba(255, 255, 255, .08); --soft-bg: rgba(255, 255, 255, .06);
  --press: rgba(255, 255, 255, .07); --hover: rgba(255, 255, 255, .05); --ink: #fff; --tab-ink: rgba(255, 255, 255, .82);
  --scrim: rgba(0, 0, 0, .5); --lens-idle: rgba(255, 255, 255, .13); --lens-lift: rgba(255, 255, 255, .16); --grabber: rgba(235, 235, 245, .3);
}
:root[data-theme="dark"] .btn-primary { background: linear-gradient(180deg, #2f95ff, var(--blue)); }

/* Liquid Glass „Klar“ wie in iOS: kaum Milchglas, der Hintergrund scheint durch */
:root[data-glass="clear"] {
  --glass-top: rgba(255, 255, 255, .16); --glass-bottom: rgba(255, 255, 255, .05); --glass-hi: rgba(255, 255, 255, .22);
  --glass-blur: blur(3px) saturate(180%) brightness(1.06);
  --card: rgba(255, 255, 255, .36); --sheet-bg: rgba(247, 248, 252, .5); --thumb: rgba(255, 255, 255, .7);
}
:root[data-theme="dark"][data-glass="clear"] {
  --glass-top: rgba(255, 255, 255, .07); --glass-bottom: rgba(255, 255, 255, .02); --glass-hi: rgba(255, 255, 255, .08);
  --glass-blur: blur(3px) saturate(170%) brightness(1);
  --card: rgba(30, 30, 36, .34); --sheet-bg: rgba(28, 28, 34, .5); --thumb: rgba(255, 255, 255, .16);
}

/* ---------------------------------------------------------------- PC & Tablet quer
   Tab-Leiste wandert wie unter iPadOS nach oben, Heute in zwei Spalten, Stundenplan als Wochenansicht. */
@media (hover: hover) {
  button.row:hover { background-color: var(--hover); }
  #tabbar button:hover { color: var(--label); }
  #tabbar button[aria-selected="true"]:hover { color: var(--blue); }
}
@media (min-width: 900px) {
  :root { --top: calc(var(--safe-t) + 96px); }
  #tabbar { top: 18px; bottom: auto; width: 620px; height: 56px; border-radius: 28px; }
  #tabbar button { flex-direction: row; gap: 7px; border-radius: 24px; }
  #tabbar svg { width: 22px; height: 22px; }
  #tabbar span { font-size: 14px; letter-spacing: -.15px; }
  #tabbar .badge { position: static; margin-left: 1px; box-shadow: none; }
  .lens i { border-radius: 24px; }
  .lens.lifted i { transform: scale(1.06, 1.12); }
  #compact-title { display: none; }
  #topbar { height: 92px; }
  #me, #add, #search { top: 24px; bottom: auto; right: 24px; }
  #add { right: 78px; }
  #search { right: 132px; }
  .view { padding: var(--top) 32px 48px; }
  .view > * { max-width: 1180px; }
  #view-aufgaben > *, #view-schule > * { max-width: 760px; }
  .notes-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #view-kalender .page-day { font-size: 15px; }
  .large-title h1 { font-size: 40px; line-height: 46px; }
  .today-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 0 28px; align-items: start; }
  .today-grid .col > .section-title:first-child { margin-top: 0; }
  #view-kalender > * { max-width: none; } /* Titel und Tagesleiste beginnen dort, wo die erste Spalte beginnt */
  #view-kalender .seg-bar { display: none; } /* am PC sieht man die ganze Woche – die Tagesleiste braucht es nur am Handy */
  #view-kalender .pager.slim-weekend { grid-template-columns: repeat(5, minmax(200px, 1fr)) repeat(2, minmax(110px, .45fr)); grid-auto-flow: row; }
  #view-kalender .pager {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px;
    max-width: none; margin: 0 -32px; padding: 0 32px 10px; scroll-padding: 0 32px;
    scroll-snap-type: x proximity; scrollbar-width: thin;
  }
  #view-kalender .pager::-webkit-scrollbar { display: block; height: 8px; }
  #view-kalender .pager::-webkit-scrollbar-thumb { border-radius: 4px; background: rgba(60, 60, 67, .22); }
  #view-kalender .page { padding: 0; scroll-snap-stop: normal; }
  .page-day { display: block; margin: 0 4px 10px; font-size: 17px; font-weight: 700; letter-spacing: -.43px; }
  .page-day span { color: var(--label2); font-weight: 500; }
  .page-day.today, .page-day.today span { color: var(--blue); }
  #view-kalender .lesson { --inset: 12px; gap: 9px; padding: 10px 12px; }
  #view-kalender .lesson .num .chip { display: none; }
  #view-kalender .lesson .num, #view-kalender .row .chev { display: none; }
  #view-kalender .lesson .time { width: 40px; }
  #view-kalender .break { padding-left: 12px; }
  #sheet { top: 6vh; bottom: 6vh; max-width: 620px; border-radius: 38px; box-shadow: inset 0 1px .5px var(--rim), 0 24px 80px rgba(20, 28, 60, .28); }
  .sheet-body { padding-bottom: 28px; }
}

/* ---------------------------------------------------------------- Barrierefreiheit */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  #scrim, #sheet { transition: opacity .2s ease !important; }
  .spinner { animation: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .glass, #sheet, #topbar .edge { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(250, 250, 252, .98); }
  .card { background: var(--raised); }
  :root[data-theme="dark"] .glass, :root[data-theme="dark"] #sheet { background: #1c1c22; }
}
@media (prefers-contrast: more) {
  :root { --label2: rgba(60, 60, 67, .85); --label3: rgba(60, 60, 67, .6); --sep: rgba(60, 60, 67, .35); }
  .glass, .card, #sheet { background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); }
  .glass::after { display: none; }
}
.new-tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
