/* Familienkalender – Gestaltung angelehnt an den Papier-Familienplaner */

:root {
  --paper: #fffdf8;
  --ink: #1f3c88;
  --text: #29251c;
  --muted: #7b6f55;
  --sep: rgba(31, 60, 136, .3);   /* Trennstrich zwischen Einträgen eines Tages */
  --danger: #c92a2a;
  --draft: #707070;               /* Entwurf: Schriftfarbe wie Bleistift */
  --dayline-strength: 65%;        /* Deutlichkeit der Linien zwischen den Tagen (0–100 %) */
  /* Monatsfarben: Standard = Gelb, je Monat überschrieben (siehe "Monatsfarben") */
  --strip: #f8f1dc;
  --strip-date: #f2e8cb;
  --sat: #f2e0a6;
  --sat-date: #ead391;
  --sun: #e5bf5e;
  --sun-date: #dcb044;
  --sun-text: #4a3708;
  --line: rgba(90, 70, 20, .25);
  --accent: #e9a514;
  --accent-d: #d4940a;
  --gap: 3px;
  --datew: 62px;
  --rowh: 46px;
  --topbar-h: 68px;
  --shadow: 0 18px 50px rgba(40, 30, 10, .25);
  --hand: "Segoe Print", "Bradley Hand", "Chalkboard SE", "Noteworthy", "Comic Neue", cursive;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --cond: "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font: 15px/1.35 var(--sans);
}

svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Monatsfarben ----------
   Jeder Monat bekommt ein Farbschema (app.js setzt <body data-month="1…12">).
   Reihenfolge ab Oktober: Gelb, Hellblau, Hellgrün, Hellrot, Flieder, Türkis – dann von vorn.
   Zuordnung ändern: einfach die Monatsnummern zwischen den Blöcken verschieben. */

/* Gelb: April, Oktober (Standardwerte aus :root) */
body[data-month="4"], body[data-month="10"] {
  --strip: #f8f1dc; --strip-date: #f2e8cb;
  --sat: #f2e0a6;   --sat-date: #ead391;
  --sun: #e5bf5e;   --sun-date: #dcb044;
  --sun-text: #4a3708; --line: rgba(90, 70, 20, .25);
  --accent: #e9a514; --accent-d: #d4940a;
}
/* Hellblau: Mai, November */
body[data-month="5"], body[data-month="11"] {
  --strip: #ebf3fa; --strip-date: #deebf6;
  --sat: #cde2f3;   --sat-date: #bcd7ee;
  --sun: #97c2e6;   --sun-date: #84b5df;
  --sun-text: #173c5e; --line: rgba(20, 60, 100, .22);
  --accent: #2b8fd6; --accent-d: #1f78ba;
}
/* Hellgrün: Juni, Dezember */
body[data-month="6"], body[data-month="12"] {
  --strip: #eff6e7; --strip-date: #e3eed8;
  --sat: #d5e9c2;   --sat-date: #c6e0b0;
  --sun: #a8d186;   --sun-date: #97c672;
  --sun-text: #2a4714; --line: rgba(40, 80, 20, .22);
  --accent: #4f9a2a; --accent-d: #3f8020;
}
/* Hellrot: Januar, Juli */
body[data-month="1"], body[data-month="7"] {
  --strip: #fbeeec; --strip-date: #f6e1de;
  --sat: #f5d2ce;   --sat-date: #efc3be;
  --sun: #e9a198;   --sun-date: #e19087;
  --sun-text: #631f18; --line: rgba(110, 35, 25, .22);
  --accent: #d9483b; --accent-d: #bb3a2f;
}
/* Flieder: Februar, August */
body[data-month="2"], body[data-month="8"] {
  --strip: #f3effa; --strip-date: #e9e2f5;
  --sat: #ddd1f1;   --sat-date: #d1c2eb;
  --sun: #bba5e0;   --sun-date: #ad94d8;
  --sun-text: #3b2763; --line: rgba(60, 35, 110, .22);
  --accent: #7d55c7; --accent-d: #6844ab;
}
/* Türkis: März, September */
body[data-month="3"], body[data-month="9"] {
  --strip: #e9f5f3; --strip-date: #dbefec;
  --sat: #c5e6e1;   --sat-date: #b3ddd7;
  --sun: #8acbc2;   --sun-date: #76c0b6;
  --sun-text: #134640; --line: rgba(15, 75, 70, .22);
  --accent: #1f9488; --accent-d: #187a70;
}

/* ---------- Kopfzeile ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.mtitle { display: flex; align-items: baseline; gap: 10px; margin-right: auto; min-width: 0; }
.mnum {
  font: 800 46px/.85 var(--sans);
  color: var(--accent);
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.mname { font: 32px/1 var(--hand); white-space: nowrap; }
.myear { font-weight: 700; color: var(--muted); }
.nav, .tools { display: flex; align-items: center; gap: 6px; }

.btn, .icon-btn {
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid #ddd1b0;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn { padding: 8px 16px; font-weight: 600; }
.btn:hover, .icon-btn:hover { background: var(--strip); border-color: #cdbb88; }
.btn:focus-visible, .icon-btn:focus-visible, .item:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #17306f; }
.btn.danger { color: var(--danger); border-color: #f0c4c4; }
.btn.danger:hover { background: #fff0f0; }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:disabled, .icon-btn:disabled { opacity: .45; cursor: default; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; padding: 0; }
.icon-btn.sm { width: 34px; height: 34px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.add-btn { background: var(--accent); border-color: var(--accent); color: #fff; }
.add-btn:hover { background: var(--accent-d); border-color: var(--accent-d); }
.add-btn svg { stroke-width: 2.6; }

/* ---------- Kalenderraster ---------- */

/* Beim Wischen gleitet das Raster seitlich hinaus – das soll keinen waagerechten Scrollbalken erzeugen */
#app { overflow-x: clip; }

.cal {
  display: grid;
  grid-template-columns: var(--datew) repeat(var(--cols, 5), minmax(0, 1fr));
  column-gap: var(--gap);
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 max(12px, env(safe-area-inset-right)) 60px max(12px, env(safe-area-inset-left));
  transition: opacity .15s;
  touch-action: pan-y pinch-zoom; /* waagerechtes Wischen übernimmt app.js, senkrecht wird normal gescrollt */
}
.cal.loading { opacity: .55; }
.cal.swiping { transition: none; will-change: transform, opacity; }
.row { display: contents; }

.cell {
  position: relative;
  min-width: 0;
  min-height: var(--rowh);
  display: flex;
  flex-direction: column;
  padding: 4px 6px 3px calc(6px + var(--bars, 0) * 7px);
  background: var(--strip);
  border-bottom: 2px dotted rgba(60, 45, 15, .4); /* Fallback für ältere Browser */
  border-bottom: 2px dotted color-mix(in srgb, var(--sun-text) var(--dayline-strength), transparent);
}

.cell.day { cursor: pointer; }
@media (hover: hover) {
  .cell.day:hover { background-image: linear-gradient(rgba(31, 60, 136, .06), rgba(31, 60, 136, .06)); }
}

.row.sat > .cell { background-color: var(--sat); }
.row.sun > .cell, .row.hol > .cell { background-color: var(--sun); }

/* Kopfzeile mit Namen */
.row.head > .cell {
  position: sticky;
  top: var(--topbar-h);
  z-index: 10;
  min-height: 0;
  padding: 12px 6px 4px;
  background: var(--paper);
  border-bottom: 3px solid var(--mc, var(--text));
}
.mhead span {
  display: block;
  font: 26px/1.15 var(--hand);
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 4px;
}
/* Name anklickbar → Übersicht aller Termine der Person */
.cell.mhead { cursor: pointer; }
@media (hover: hover) {
  .cell.mhead:hover span { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
}
.cell.mhead:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }

/* Datumsspalte */
.cell.date {
  flex-direction: row;
  align-items: baseline;
  gap: 5px;
  padding: 6px 4px 3px 6px;
  background: var(--strip-date);
}
.row.sat > .cell.date { background-color: var(--sat-date); }
.row.sun > .cell.date, .row.hol > .cell.date { background-color: var(--sun-date); }
.cell.date b {
  flex: none;
  font: 800 22px/1 var(--sans);
  font-variant-numeric: tabular-nums;
  min-width: 1.3em;
  text-align: right;
}
.cell.date span { flex: none; font: 600 12px/1 var(--cond); color: var(--muted); letter-spacing: .03em; }
.row.sun > .cell.date span, .row.hol > .cell.date span { color: var(--sun-text); }

/* Heute */
.row.today > .cell { box-shadow: inset 0 2px 0 var(--ink), inset 0 -2px 0 var(--ink); }
.row.today > .cell.date b {
  display: inline-grid;
  place-items: center;
  min-width: 1.55em;
  height: 1.4em;
  margin: -.2em 0;
  padding: 0 .15em;
  color: #fff;
  background: var(--ink);
  border-radius: .7em;
}

/* Einträge */
.items { display: flex; flex-direction: column; position: relative; z-index: 1; }
.item {
  all: unset;
  position: relative;
  display: block;
  font-size: 13.5px;
  line-height: 1.25;
  color: var(--ink);
  font-weight: 500;
  overflow-wrap: break-word;
  -webkit-hyphens: auto;
  hyphens: auto;
  border-radius: 4px;
  padding: 1px 3px;
  margin-left: -3px;
  cursor: pointer;
}
.item:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.item.hl { background: var(--hl); }
.item.multi { font-weight: 700; font-size: 12.5px; }
.item .mark { color: var(--muted); font-size: .85em; font-weight: 400; }
/* Entwurf: graue Schrift (wie mit Bleistift eingetragen) */
.item.draft { color: var(--draft); }
/* Mehrere Einträge an einem Tag: feiner Strich zwischen den Einträgen */
.item + .item { margin-top: 7px; }
.item + .item::before {
  content: "";
  position: absolute;
  left: 3px;
  right: 3px;
  top: -4px;
  height: 1px;
  background: var(--sep);
  pointer-events: none;
}

/* Mehrtägige Einträge als durchgehender Balken */
.bar {
  position: absolute;
  top: 0;
  bottom: -1px;
  left: calc(4px + var(--lane) * 7px);
  width: 5px;
  background: var(--bc);
  opacity: .85;
  cursor: pointer;
  z-index: 2;
}
.bar::before { content: ""; position: absolute; inset: 0 -3px; }
.bar.s { top: 5px; border-radius: 3px 3px 0 0; }
.bar.e { bottom: 5px; border-radius: 0 0 3px 3px; }
.bar.s.e { border-radius: 3px; }

/* KW und Tagesbezeichnungen */
.kw {
  position: absolute;
  top: 5px;
  right: 6px;
  font: 700 10px/1 var(--cond);
  color: var(--muted);
  letter-spacing: .04em;
  pointer-events: none;
}
.cell.has-kw .items { padding-right: 34px; }
.daylabel {
  margin-top: auto;
  align-self: flex-end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-top: 2px;
  font: 600 9.5px/1.2 var(--cond);
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  text-align: right;
  pointer-events: none;
  max-width: 100%;
}
.daylabel span { max-width: 100%; overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; }
.daylabel .h { color: var(--sun-text); font-weight: 800; }

.cal-msg {
  grid-column: 1 / -1;
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
}
.cal-msg strong { display: block; color: var(--danger); margin-bottom: 6px; }

/* ---------- Dialoge ---------- */

dialog {
  width: min(540px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: none;
  border-radius: 18px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(35, 28, 10, .45); }
dialog form { display: flex; flex-direction: column; max-height: inherit; }
.dlg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 6px 22px;
}
.dlg-head h2 { margin: 0; font: 30px/1.1 var(--hand); color: var(--ink); }
.dlg-body { padding: 8px 22px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.dlg-body h3 { margin: 6px 0 -4px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.dlg-foot {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 12px 18px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid #eee5cc;
  background: #fffcf3;
}
.spacer { flex: 1; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field > span, .field > legend { font-size: 13px; font-weight: 700; color: var(--muted); padding: 0; }
.field small { font-weight: 400; }
input, select, textarea {
  font: inherit;
  font-size: 16px; /* verhindert Auto-Zoom auf iOS */
  color: var(--text);
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #ddd1b0;
  border-radius: 10px;
  background: var(--paper);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: var(--ink); }
textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Personen-Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip input, .swatch input, .segmented input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 2px solid var(--mc);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.chip span::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--mc); }
.chip input:checked + span { background: var(--mc); color: #fff; }
.chip input:checked + span::before { background: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Farbmarkierung */
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sc);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #d8cca8;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.swatch.auto span { background: var(--paper); width: auto; padding: 0 10px; border-radius: 999px; }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--ink); }
.swatch input:focus-visible + span { outline: 2px dashed var(--ink); outline-offset: 3px; }

/* Umschalter "Nur dieser Termin / Ganze Serie" */
.segmented { display: flex; background: var(--strip); border-radius: 12px; padding: 3px; }
.segmented label { flex: 1; }
.segmented span { display: block; text-align: center; padding: 7px 8px; border-radius: 9px; font-weight: 600; font-size: 14px; cursor: pointer; }
.segmented input:checked + span { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); color: var(--ink); }
.segmented input:focus-visible + span { outline: 2px solid var(--ink); }

/* Einstellungen */
.member-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mrow { display: flex; align-items: center; gap: 6px; }
.mrow input[type="color"] { width: 40px; height: 38px; padding: 2px; flex: none; cursor: pointer; }
.mrow input[type="text"] { flex: 1; min-width: 0; }
.mrow.off input[type="text"] { color: var(--muted); text-decoration: line-through; }
.mrow .icon-btn.sm { flex: none; font-weight: 700; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--ink); }
.check small { color: var(--muted); }
.hint { margin: -6px 0 0 30px; font-size: 13px; color: var(--muted); }
.pw-hint { margin: -4px 0 0; font-size: 13px; color: var(--muted); }
.pw-hint.warn { color: var(--danger); font-weight: 600; }

/* Personen-Übersicht (Klick auf einen Namen) */
.person-dlg .dlg-head h2 {
  border-bottom: 3px solid var(--mc, var(--ink));
  padding: 0 4px 2px;
  margin-left: -4px;
}
.person-top { display: flex; flex-direction: column; gap: 8px; padding: 6px 22px 2px; }
.person-top .segmented { max-width: 320px; }
.person-range { margin: 0; font-size: 13px; color: var(--muted); }
.person-dlg .dlg-body { gap: 10px; }
.person-dlg .dlg-foot .btn { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-dlg .dlg-body h3 { margin: 8px 0 -6px; }
.plist { list-style: none; margin: 0; padding: 0; }
.pitem {
  all: unset;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 6.6em minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 7px 6px;
  border-bottom: 1px dotted var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.plist li:last-child .pitem { border-bottom: 0; }
.pitem:hover { background: var(--strip); }
.pitem:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.pdate {
  font: 600 13px/1.4 var(--cond);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pdate.today { color: var(--ink); font-weight: 800; }
.ptext { min-width: 0; }
.ptitle { color: var(--ink); font-weight: 500; overflow-wrap: break-word; }
.ptitle.hl { background: var(--hl); border-radius: 4px; padding: 0 3px; margin-left: -3px; }
.ptitle .mark { color: var(--muted); font-size: .85em; font-weight: 400; }
.pitem.draft .ptitle { color: var(--draft); }
.ptext small { display: block; margin-top: 1px; font-size: 12px; color: var(--muted); }
.pempty { margin: 6px 0; color: var(--muted); }

/* ---------- Anmeldung ---------- */

.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: var(--strip); }
.login-card {
  width: min(360px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-logo { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.login-logo .mname { font-size: 28px; }
.login-err { margin: 0; min-height: 1.2em; color: var(--danger); font-size: 14px; }

/* ---------- Hinweis-Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(86px, calc(env(safe-area-inset-bottom) + 68px));
  transform: translate(-50%, 20px);
  background: var(--text);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

/* ---------- Smartphone ---------- */

@media (max-width: 700px) {
  :root { --datew: 34px; --gap: 2px; --rowh: 44px; --topbar-h: 58px; }
  .topbar { gap: 8px; padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); }
  /* Monatsname über der Jahreszahl, damit alles in eine Zeile passt */
  .mtitle { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 6px; align-items: end; }
  .mnum { grid-row: 1 / span 2; align-self: center; font-size: 36px; }
  .mname { font-size: 21px; overflow: hidden; text-overflow: ellipsis; }
  .myear { font-size: 12px; line-height: 1; }
  .today-btn { padding: 6px 9px; font-size: 14px; }
  .icon-btn { width: 34px; height: 34px; }
  .icon-btn svg { width: 18px; height: 18px; }
  .nav, .tools { gap: 3px; }
  .hide-sm { display: none; }
  /* Plus-Button schwebt unten rechts (Daumenbereich) */
  .add-btn {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 30;
    width: 56px;
    height: 56px;
    box-shadow: 0 6px 18px rgba(120, 80, 0, .35);
  }
  .add-btn svg { width: 26px; height: 26px; }
  .cal { padding: 0 max(4px, env(safe-area-inset-right)) 96px max(4px, env(safe-area-inset-left)); }
  .cell { padding: 3px 3px 2px calc(3px + var(--bars, 0) * 6px); }
  .cell.date { flex-direction: column; align-items: center; gap: 2px; padding: 4px 1px 2px; }
  .cell.date b { font-size: 16px; min-width: 0; text-align: center; }
  .cell.date span { font-size: 9.5px; }
  .daylabel { letter-spacing: 0; }
  .row.head > .cell { padding: 8px 2px 3px; }
  .mhead span { font-size: 17px; padding-left: 1px; }
  .item { font-size: 12px; line-height: 1.2; padding: 1px 2px; margin-left: -2px; }
  .item + .item { margin-top: 6px; }
  .item + .item::before { left: 2px; right: 2px; top: -3.5px; }
  .item.multi { font-size: 11px; }
  .bar { left: calc(2px + var(--lane) * 6px); width: 4px; }
  .kw { font-size: 8.5px; top: 3px; right: 3px; }
  .cell.has-kw .items { padding-right: 0; padding-top: 9px; }
  .daylabel { font-size: 8px; letter-spacing: .02em; }

  dialog {
    width: 100vw;
    max-width: 100vw;
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
    max-height: 94dvh;
  }
  .dlg-body { padding: 6px 16px 14px; }
  .dlg-head { padding: 14px 12px 4px 16px; }
  .row2 { gap: 8px; }
  .person-top { padding: 4px 16px 2px; }
  .person-top .segmented { max-width: none; }
  .person-dlg .dlg-foot .spacer { display: none; }
  .person-dlg .dlg-foot .btn { flex: 1; }
  .pitem { grid-template-columns: 6.2em minmax(0, 1fr); padding: 7px 4px; }
}

@media (max-width: 380px) {
  .topbar { gap: 6px; }
  .today-btn { padding: 6px 7px; font-size: 13px; }
}

/* ---------- Druck (A4 hoch) ---------- */

@page { size: A4 portrait; margin: 9mm; }
@media print {
  :root { --rowh: 7.8mm; --topbar-h: 0px; --gap: 2px; --datew: 14mm; }
  body { background: #fff; font-size: 9pt; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .topbar { position: static; border: 0; padding: 0 0 3mm; }
  .nav, .tools, dialog, .toast { display: none !important; }
  .mnum { font-size: 34pt; }
  .mname { font-size: 22pt; }
  .cal { max-width: none; padding: 0; }
  .row.head > .cell { position: static; padding: 1mm 1mm 0.5mm; }
  .mhead span { font-size: 15pt; }
  .cell { padding: 0.6mm 1.2mm 0.3mm calc(1.2mm + var(--bars, 0) * 6px); }
  .cell.date { padding: 0.8mm 1mm 0; }
  .cell.date b { font-size: 13pt; }
  .cell.date span { font-size: 7pt; }
  .item { font-size: 8pt; line-height: 1.15; padding: 0 1px; }
  .item + .item { margin-top: 3px; }
  .item + .item::before { top: -2px; height: 0.6px; }
  .item.multi { font-size: 7.5pt; }
  .daylabel { font-size: 6pt; }
  .kw { font-size: 6pt; top: 1mm; }
  .row.today > .cell { box-shadow: none; }
  .row.today > .cell.date b { background: none; color: inherit; padding: 0; margin: 0; }
}
