/* Sophie — Schulorganisation.
 *
 * Mobile first, and not just as a slogan: the base rules below ARE the phone
 * layout, and the only media query widens it. The dashboard is one grid whose
 * areas are re-ordered at 900px, so the markup has exactly one order and the
 * two layouts cannot drift apart. */

:root {
  --bg: #f7f5f0;
  --card: #ffffff;
  --ink: #23262b;
  --muted: #74787f;
  --accent: #2f6f4f;
  --accent-dark: #245740;
  --accent-soft: #e6f0ea;
  --danger: #b3402e;
  --warn: #b26a00;
  --line: #e5e1d8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(35, 38, 43, .06), 0 6px 20px rgba(35, 38, 43, .06);
  --tab-h: 58px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  /* Room for the bottom tab bar plus the iOS home indicator — without this the
   * last list item sits permanently under the bar and cannot be tapped. */
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
main { max-width: 1400px; margin: 0 auto; padding: .75rem; }
h1 { font-size: 1.35rem; margin: .4rem 0 .8rem; }
h2 { font-size: 1rem; margin: 0; }
h3 { font-size: .76rem; margin: .9rem 0 .3rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
a { color: var(--accent-dark); }
code { font-size: .85em; background: #f1efe9; padding: .1em .35em; border-radius: 4px; }
.muted { color: var(--muted); font-size: .88em; }
.hint { margin: .5rem 0 0; line-height: 1.45; }
.error { color: var(--danger); }
.empty { color: var(--muted); font-style: italic; margin: .6rem 0; }
.spacer { flex: 1; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; width: 100%; }

/* ── Navigation: Tabs unten auf dem Handy, Topbar ab Desktop ──────────────── */
.topbar { display: none; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; height: var(--tab-h);
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .1rem; text-decoration: none; color: var(--muted); font-size: .66rem;
}
.tabbar a span { font-size: 1.25rem; line-height: 1; }
.tabbar a:active { background: var(--accent-soft); }

/* ── Karten & Formulare ──────────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .85rem; margin: 0 0 .75rem;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.card-head h2 { flex: 1; }

label { display: block; margin: .45rem 0; font-size: .85rem; color: #4b4f56; }
label.inline { display: inline-flex; align-items: center; gap: .4rem; margin: .3rem .6rem .3rem 0; }
label.grow { flex: 1 1 260px; }
input, select, textarea, button {
  font: inherit; padding: .55rem .65rem;
  border: 1px solid var(--line); border-radius: 9px; background: #fff;
  max-width: 100%;
}
/* 16px on the phone: anything smaller makes iOS Safari zoom the whole page on
 * focus, and it never zooms back out. */
input, select, textarea { font-size: 16px; }
label > input, label > select, label > textarea { width: 100%; margin-top: .2rem; }
textarea { width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
button {
  background: var(--accent); color: #fff; border: none; cursor: pointer;
  font-weight: 600; border-radius: 9px; padding: .6rem .9rem;
  /* 44px is the smallest reliably tappable target on a phone. */
  min-height: 44px;
}
button:active { background: var(--accent-dark); }
button.linkish, .linkish {
  background: none; color: var(--accent-dark); font-weight: 500;
  padding: .3rem .4rem; min-height: 0; border: none; cursor: pointer; text-decoration: none;
}
button.linkish.danger, .linkish.danger { color: var(--danger); }
.btn { display: inline-block; text-decoration: none; text-align: center; }
.btn-primary { background: var(--accent); color: #fff; padding: .65rem 1rem; border-radius: 9px; font-weight: 600; }
.stack > * { margin-block: .45rem; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.row > label { margin: 0; }

fieldset.tagpick { border: 1px solid var(--line); border-radius: 9px; padding: .4rem .6rem; margin: .45rem 0; }
fieldset.tagpick legend { font-size: .74rem; color: var(--muted); padding: 0 .3rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; margin: .2rem .5rem .2rem 0; font-size: .85rem; }
.chip input { accent-color: var(--c, var(--accent)); width: auto; }

.tag {
  display: inline-block; color: #fff; font-size: .68rem; font-weight: 600;
  padding: .1rem .45rem; border-radius: 999px; margin-left: .25rem; white-space: nowrap;
}
.tag-ro { background: #8a8f98; }
.pill {
  display: inline-block; font-size: .7rem; font-weight: 700; padding: .15rem .5rem;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark);
  text-decoration: none;
}
.week-A { background: #e6f0ea; color: #245740; }
.week-B { background: #efe9f5; color: #5b3f7a; }
.pill.active { outline: 2px solid currentColor; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-left: 3px; vertical-align: middle; }

/* ── Dashboard-Raster ────────────────────────────────────────────────────── */
/* Phone order is the one that was named: offene Aufgaben 7 Tage → Agenda
 * heute → Kalender (klickbar) → Tagesvorschau. Nothing goes between those
 * four — the calendar has to stay reachable with one thumb-scroll.
 *
 * `next` (der grosse 14-Tage-Termin) und `quick` (die Icon-Kacheln) kommen
 * danach: beide wurden fuer den DESKTOP verlangt, wo sie oben nebeneinander
 * stehen. Auf dem Handy waeren sie hier zwei Bloecke, die den Kalender aus
 * dem ersten Bildschirm schieben. Damit die Krankmeldung trotzdem nicht
 * hinter einem langen Scroll liegt, hat die Tab-Leiste einen eigenen
 * Eintrag dafuer — ein Griff statt einer Reihenfolgeaenderung. */
.dash {
  display: grid; gap: .75rem;
  grid-template-columns: 1fr;
  grid-template-areas: "tasks" "cal" "next" "quick" "infos";
}
.area-tasks { grid-area: tasks; }
.area-quick { grid-area: quick; }
.area-next { grid-area: next; }
.area-cal { grid-area: cal; }
.area-infos { grid-area: infos; }
/* Auf dem Handy loesen sich die beiden Spalten-Wrapper auf: ihre Kinder werden
 * direkte Rasterzellen, `grid-template-areas` oben bestimmt die Reihenfolge.
 * Ohne das muesste es zwei Markup-Pfade geben, und der zweite driftet. */
.col { display: contents; }
.dash .card { margin: 0; }

/* ── Allgemeine Infos ────────────────────────────────────────────────────── */
/* Zugeklappt, weil elf Eintraege ausgeklappt laenger sind als der Rest des
 * Dashboards zusammen. Der Titel ist die Zeile, nach der man sucht. */
.infolist { margin-top: .3rem; }
.infolist details { border-top: 1px solid var(--line); }
.infolist > details:first-child { border-top: none; }
.infolist summary { font-weight: 600; font-size: .92rem; line-height: 1.35; }
.info-body { margin: 0 0 .7rem; white-space: pre-wrap; font-size: .88rem; line-height: 1.5; color: var(--ink); }
.donebox { margin-top: .9rem; padding-top: .7rem; border-top: 2px solid var(--line); }
.donebox h3 { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
/* Je Aufgabe genau EINE Zeile. Der Titel bekommt den Rest der Breite und wird
 * abgeschnitten, nicht umgebrochen — sonst waeren es wieder zwei Zeilen, und
 * der ganze Sinn dieser Liste ist, dass sie kurz bleibt. Der volle Titel steht
 * im `title`-Attribut. */
.donelist { list-style: none; margin: .35rem 0 0; padding: 0; }
.donelist li { display: flex; align-items: center; gap: .4rem; padding: .12rem 0; font-size: .82rem; }
.donelist form { display: flex; }
.donetick {
  flex: 0 0 auto; width: 18px; height: 18px; min-height: 18px; padding: 0;
  border: none; border-radius: 5px; background: var(--accent); color: #fff;
  font-size: .7rem; font-weight: 800; line-height: 1;
}
.donetitle {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-decoration: line-through; color: var(--muted);
}
.donedue { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; font-size: .75rem; }

/* ── Kacheln zu den Standard-Aufgaben ────────────────────────────────────── */
/* Horizontally scrollable on the phone so a fourth tile does not push the
 * calendar off-screen; a plain grid once there is width for it. */
.tiles {
  display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .2rem;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.tiles::-webkit-scrollbar { display: none; }
.tile {
  flex: 0 0 auto; width: 5.2rem; height: 5.2rem;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem;
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  font-weight: 500; text-decoration: none; padding: .3rem;
}
.tile:active { background: var(--accent-soft); }
.tile-icon { font-size: 1.6rem; line-height: 1; }
.tile-label { font-size: .68rem; text-align: center; line-height: 1.15; color: var(--muted); }
.tile-more .tile-icon { color: var(--muted); }

/* ── Aufgabenliste ───────────────────────────────────────────────────────── */
.tasklist { list-style: none; margin: .5rem 0 0; padding: 0; }
.task { display: flex; align-items: flex-start; gap: .55rem; padding: .5rem 0; border-top: 1px solid var(--line); }
.tasklist > .task:first-child { border-top: none; }
.tick {
  flex: 0 0 auto; width: 30px; height: 30px; min-height: 30px; padding: 0;
  border-radius: 8px; border: 2px solid var(--line); background: #fff;
  color: var(--accent); font-weight: 800; line-height: 1;
}
.is-done .tick { background: var(--accent); border-color: var(--accent); color: #fff; }
.task-body { flex: 1; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.task-title { font-weight: 600; line-height: 1.3; }
.is-done .task-title { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; font-size: .75rem; color: var(--muted); }
.task-notes { font-size: .8rem; color: var(--muted); white-space: pre-wrap; }
.due.bad { color: var(--danger); font-weight: 600; }
.is-overdue { background: #fff6f4; margin-inline: -.85rem; padding-inline: .85rem; }
.by { font-style: italic; }
.archive .task { opacity: .65; }
.compact .task { padding: .35rem 0; }

.quick-add { display: flex; gap: .4rem; margin-top: .3rem; }
.quick-add input[name=title] { flex: 1; min-width: 0; }
.quick-add input[type=date] { flex: 0 0 8.5rem; }
.quick-add button { flex: 0 0 auto; padding-inline: .9rem; font-size: 1.2rem; }

/* ── Kalender-Container: Raster + Heute + gewaehlter Tag ─────────────────── */
/* Eine Karte, drei Teile. Auf dem Handy untereinander, und `order` haelt die
 * verlangte Reihenfolge (Heute vor dem Raster) — die frueheren drei getrennten
 * Karten brauchten dafuer drei Rasterzellen, die auseinanderfielen, sobald das
 * Raster nicht griff. `display: contents` loest den rechten Wrapper auf, damit
 * seine beiden Kinder mitsortiert werden koennen. */
.calbox { display: flex; flex-direction: column; gap: .7rem; }
.calbox-side { display: contents; }
.pane-today { order: -1; }
.calpane {
  border: 1px solid var(--line); border-radius: 10px;
  padding: .6rem .65rem; background: #fcfbf8;
}
.calpane .card-head { margin-bottom: .35rem; }

/* ── Heute / Tagesvorschau ───────────────────────────────────────────────── */
.daylabel { margin: 0 0 .5rem; font-size: .85rem; color: var(--muted); }
.frame { list-style: none; margin: 0 0 .6rem; padding: .5rem .6rem; background: var(--accent-soft); border-radius: 9px; font-size: .85rem; }
.frame li { padding: .1rem 0; }
.frame b { font-variant-numeric: tabular-nums; margin-right: .4rem; }
.agenda { list-style: none; margin: .3rem 0 0; padding: 0; }
.agenda li { display: flex; gap: .55rem; align-items: baseline; padding: .35rem 0; border-top: 1px solid var(--line); }
.agenda li:first-child { border-top: none; }
.agenda .when { flex: 0 0 3.4rem; font-variant-numeric: tabular-nums; font-weight: 600; font-size: .82rem; }
.agenda.big .when { flex-basis: 4.2rem; }
.agenda .what { flex: 1; line-height: 1.35; }
.lessons { list-style: none; margin: .3rem 0; padding: 0; font-size: .85rem; }
.lessons li { display: flex; gap: .5rem; padding: .2rem 0; }
.lessons .slot { flex: 0 0 1.4rem; color: var(--muted); }
.lessons .time { flex: 0 0 3rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.lessons .subject { flex: 1; font-weight: 600; }
.lessons .room { color: var(--muted); }
.lessons .free .subject { font-weight: 400; color: var(--muted); }

/* ── Nächster Termin ─────────────────────────────────────────────────────── */
.next-card { border-left: 4px solid var(--accent); }
.next-when { margin: 0; color: var(--accent-dark); font-weight: 600; font-size: .9rem; }
.next-title { margin: .15rem 0 .3rem; font-size: 1.5rem; line-height: 1.15; text-transform: none; letter-spacing: 0; color: var(--ink); }
.next-where { margin: .2rem 0; color: var(--muted); font-size: .9rem; }
.next-tags { margin: .35rem 0 0; }
.next-tags .tag { margin-left: 0; margin-right: .3rem; }
.next-notes { margin: .5rem 0 0; white-space: pre-wrap; font-size: .9rem; }
/* Eine Spalte je Termin. Auf dem Handy waagerecht scrollbar statt umgebrochen:
 * ein Umbruch macht aus "Spalten" wieder eine Liste, und die gab es hier
 * vorher schon. `scroll-snap` sorgt dafuer, dass eine Spalte ganz steht. */
.soonrow {
  list-style: none; display: flex; gap: .5rem;
  margin: .8rem 0 0; padding: .7rem 0 .2rem;
  border-top: 1px solid var(--line);
  overflow-x: auto; scroll-snap-type: x proximity;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.soonrow::-webkit-scrollbar { display: none; }
.soonitem {
  flex: 0 0 8.5rem; scroll-snap-align: start;
  display: flex; flex-direction: column; gap: .1rem;
  padding: .45rem .55rem;
  background: var(--accent-soft); border-radius: 10px;
}
/* Datum und Uhrzeit untereinander — dieselbe Spalte, zwei Zeilen. */
.soon-date { font-size: .78rem; font-weight: 700; color: var(--accent-dark); font-variant-numeric: tabular-nums; }
.soon-time { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.soon-title { margin-top: .15rem; font-size: .85rem; font-weight: 600; line-height: 1.25; }
.soon-tags { display: flex; gap: 2px; margin-top: .2rem; min-height: 8px; }

/* ── Monatskalender ──────────────────────────────────────────────────────── */
table.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.cal th { font-size: .68rem; font-weight: 600; color: var(--muted); padding: .2rem 0; }
table.cal th.wk, td.wk { width: 1.4rem; font-size: .62rem; font-weight: 700; text-align: center; border-radius: 4px; }
td.day { padding: 1px; }
td.day > button {
  width: 100%; min-height: 2.9rem; padding: .2rem .15rem .25rem;
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: .18rem;
  background: none; border: 1px solid transparent; border-radius: 8px; color: var(--ink);
  font-weight: 500;
}
td.day > button:active { background: var(--accent-soft); }
td.day .numrow { display: flex; align-items: flex-start; justify-content: space-between; gap: .1rem; }
td.day .num { font-size: .88rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
td.day .badges { display: flex; gap: 2px; }
td.outside > button { color: #bcbfc4; }
td.outside .tl { opacity: .35; }
td.weekend .num { color: var(--muted); }
td.today > button { background: var(--accent-soft); font-weight: 800; }
td.selected > button { border-color: var(--accent); }
/* Zwei Zahlen oben rechts, und sie bedeuten Verschiedenes: gelb = faellige
 * Aufgaben (war vorher `.tickmark`), blau = ganztaegige Termine. Dieselbe Form
 * fuer beide waere sparsamer und genau deshalb falsch. */
.badge {
  font-style: normal; font-size: .56rem; font-weight: 700; color: #fff;
  border-radius: 999px; padding: 0 .24rem; line-height: 1.35;
}
.badge-task { background: var(--warn); }
.badge-allday { background: #1971c2; }

/* ── Zeitleiste: 07:00 links, 20:00 rechts ───────────────────────────────── */
/* Die Fensterbreite steht in helpers.js (DAY_FROM_MIN/DAY_TO_MIN); hier wird
 * nur gefaerbt. Ein Balken ohne Endzeit bekommt dort eine Mindestbreite —
 * unsichtbar waere die schlechteste Antwort auf "ist da was?". */
.tl {
  position: relative; display: block; height: 5px; border-radius: 3px;
  background: #eceae4; overflow: hidden;
}
.tl-bar { position: absolute; top: 0; bottom: 0; border-radius: 3px; display: block; }
.tl-school { background: #e8710a; }   /* Schule */
.tl-repeat { background: #2f9e44; }   /* Gruppe, Tanzen — alles Wiederkehrende */
.tl-once   { background: #d63939; }   /* einmalige Termine */
/* Ein unterrichtsfreier Schultag: die Leiste bleibt, aber sie sagt "frei". */
.tl-off { background: repeating-linear-gradient(45deg, #eceae4, #eceae4 3px, #dcd9d1 3px, #dcd9d1 6px); }

.tlbig { margin: .5rem 0 .2rem; }
.tlbig-track {
  position: relative; height: 12px; border-radius: 4px;
  background: #eceae4; overflow: hidden;
}
.tlbig-track .tl-bar { border-radius: 4px; }
.tlbig-scale { position: relative; height: 1rem; margin-top: .1rem; }
.tlbig-scale span {
  position: absolute; transform: translateX(-50%);
  font-size: .62rem; color: var(--muted); font-variant-numeric: tabular-nums;
}
.tlbig-scale span:first-child { transform: none; }
.tlbig-scale span:last-child { transform: translateX(-100%); }
.tl-legend {
  display: flex; flex-wrap: wrap; gap: .1rem .8rem; align-items: center;
  margin: .5rem 0 0; font-size: .68rem; color: var(--muted);
}
.tl-legend span { display: flex; align-items: center; gap: .25rem; }
.tl-legend .tl-bar { position: static; width: .8rem; height: 5px; }
.notice {
  margin: .4rem 0; padding: .35rem .5rem; border-radius: 8px;
  background: #fff4e6; border-left: 3px solid #e8710a;
  font-size: .85rem; font-weight: 600;
}

/* ── Stundenplan ─────────────────────────────────────────────────────────── */
.weekswitch { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .7rem; }
/* The grid is 6 columns wide and does not fit a phone. Scrolling it inside its
 * own box keeps the page itself from scrolling sideways, which would drag the
 * bottom tab bar out of reach. */
.tt-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -.75rem; padding: 0 .75rem; }
table.tt { border-collapse: collapse; min-width: 34rem; width: 100%; }
table.tt th, table.tt td { border: 1px solid var(--line); padding: 2px; vertical-align: top; }
table.tt thead th { background: var(--accent-soft); font-size: .8rem; padding: .3rem; }
.tt-time { width: 3.2rem; text-align: left; font-size: .68rem; color: var(--muted); font-weight: 400; padding: .25rem !important; }
.tt-time b { display: block; font-size: .85rem; color: var(--ink); }
.tt-time span { font-variant-numeric: tabular-nums; }
table.tt td input { width: 100%; border: none; padding: .3rem .25rem; font-size: .85rem; border-radius: 5px; }
table.tt td input:focus { outline: 2px solid var(--accent); }
.tt-room { font-size: .72rem !important; color: var(--muted); }
.tt-off { background: repeating-linear-gradient(45deg, #fafaf7, #fafaf7 6px, #f2f0ea 6px, #f2f0ea 12px); text-align: center; font-size: .7rem; padding: .5rem 0 !important; }
.frameform { display: flex; flex-wrap: wrap; gap: .4rem; align-items: flex-end; padding: .45rem 0; border-top: 1px solid var(--line); }
.frameform .fr-day { flex: 0 0 5.5rem; font-size: .85rem; }
.frameform label { margin: 0; font-size: .7rem; }
.frameform input { padding: .35rem .4rem; }
.frameform button { min-height: 36px; padding: .3rem .7rem; }

/* ── Prozesse, Feeds ─────────────────────────────────────────────────────── */
.modal-notes { white-space: pre-wrap; line-height: 1.5; margin: .4rem 0; }
.modal-steps { margin: .3rem 0 .6rem; padding-left: 1.2rem; line-height: 1.6; }
.serieslist, .feedlist { list-style: none; margin: .4rem 0 0; padding: 0; }
.serieslist li, .feedlist li { display: flex; gap: .5rem; align-items: center; padding: .45rem 0; border-top: 1px solid var(--line); }
.serieslist li:first-child, .feedlist li:first-child { border-top: none; }
.serieslist .what, .feedlist > li > div { flex: 1; }
.taglrow { align-items: center; margin: .3rem 0; }
.taglrow input[type=color] { width: 3rem; padding: .1rem; height: 2.4rem; }
.taglrow input[type=email] { flex: 1; min-width: 10rem; }
details summary { cursor: pointer; padding: .4rem 0; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 22, 26, .45);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  position: relative;
  background: var(--card); width: 100%; max-width: 32rem;
  /* Sheet from the bottom on a phone — that is where the thumb already is,
   * and it matches every native "share"/"action" surface. */
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.1rem 1rem calc(1.1rem + env(safe-area-inset-bottom));
  max-height: 88vh; overflow-y: auto;
  box-shadow: 0 -6px 30px rgba(0, 0, 0, .2);
}
.modal-x { position: absolute; top: .5rem; right: .5rem; background: none; color: var(--muted); font-size: 1.1rem; min-height: 40px; }
.modal-icon { font-size: 2.4rem; margin: 0; line-height: 1; }
.modal h2 { font-size: 1.25rem; margin: .2rem 0 .5rem; }
.modal-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; margin-top: .8rem; }
.modal-actions form { display: flex; gap: .4rem; align-items: flex-end; flex-wrap: wrap; }

/* ── Login ───────────────────────────────────────────────────────────────── */
.login-box { max-width: 22rem; margin: 12vh auto 0; }
.login-box button { width: 100%; margin-top: .6rem; }

/* ── Desktop ─────────────────────────────────────────────────────────────── */
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 1rem;
    background: rgba(255, 255, 255, .94); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line); padding: 0 1rem; height: 54px;
  }
  .topbar .brand { font-weight: 700; text-decoration: none; color: var(--ink); }
  .topnav { display: flex; gap: 1rem; }
  .topbar a { text-decoration: none; color: var(--ink); font-size: .95rem; }
  .topbar a:hover { color: var(--accent-dark); }
  .topbar .who { color: var(--muted); font-size: .85rem; }
  main { padding: 1rem; }

  /* Zwei UNABHAENGIGE Spalten. Vorher war das ein gemeinsames Raster, und
   * dessen Zeilen koppeln die Hoehen: eine lange Aufgabenliste links liess
   * rechts eine Luecke stehen, die nichts fuellen konnte. Flex-Spalten haben
   * keine gemeinsamen Zeilen, jede Spalte packt ihre Karten dicht.
   *
   * Die linke Spalte behaelt intern ein Raster — Heute und Tagesvorschau
   * gehoeren neben den Kalender, nicht irgendwohin. */
  .dash { display: flex; align-items: flex-start; gap: .75rem; }
  .col { display: flex; flex-direction: column; gap: .75rem; min-width: 0; }
  .col-main { flex: 2 1 0; }
  .col-side { flex: 1 1 0; }

  /* Erst hier wird der Kalender-Container zweispaltig: Raster links, Heute
   * ueber dem gewaehlten Tag rechts. Beides ist EINE Karte, also kann kein
   * Raster von aussen die beiden Haelften auseinanderziehen. */
  .calbox {
    display: grid; align-items: start;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: .75rem;
  }
  .calbox-side { display: flex; flex-direction: column; gap: .6rem; }
  .pane-today { order: 0; }
  .tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.2rem, 1fr)); overflow: visible; }
  .tile { width: auto; }
  .next-title { font-size: 2rem; }
  td.day > button { min-height: 3.2rem; }
  .modal-backdrop { align-items: center; }
  .modal { border-radius: var(--radius); padding-bottom: 1.1rem; }
}
