/* Familienkalender – Gestaltung
   Idee: Die Farbe gehört den Menschen. Oberfläche und Text bleiben neutral,
   damit die Magnete (ein Farbpunkt pro Person) das Einzige sind, das leuchtet. */
:root {
  --bg: #F1F4F6;
  --surface: #FFFFFF;
  --ink: #17212B;
  --ink-2: #56626D;
  --line: #DAE1E6;
  --on-ink: #FFFFFF;
  --danger: #B42318;
  --backdrop: rgba(16, 22, 28, .5);
  --r-xs: 4px; --r-s: 10px; --r-m: 14px; --r-l: 22px; --r-pill: 999px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif; /* die eigentliche Schrift steht in fonts.css */
  --link: #1D4ED8;
  /* Tagesfarben (in der App unter Menü > Farben anpassbar) */
  --day-past: #DDE3E8;
  --day-today: #22c55e;
  --day-weekend: #B4BFC9;
  --day-selected: #2563EB;
  --day-border: var(--line);
  --grid-w: 1px;
  --day-past-ink: var(--ink);
  --day-today-ink: var(--ink);
  --day-weekend-ink: var(--ink);
  --day-selected-ink: #FFFFFF;
  color-scheme: light dark;
}

/* Dunkel: JavaScript setzt data-mode (hell/dunkel, bei "Automatisch" nach dem Gerät).
   Vor dem Start gilt die Medienabfrage. */
:root[data-mode="light"] { color-scheme: light; }
:root[data-mode="dark"] {
  color-scheme: dark;
    --bg: #10161C;
    --surface: #18212A;
    --ink: #EAF0F4;
    --ink-2: #9AA6B1;
    --line: #27323C;
    --on-ink: #10161C;
    --danger: #F97066;
    --backdrop: rgba(0, 0, 0, .6);
    --day-past: #0D1318;
    --day-today: #2f9e5b;
    --day-weekend: #2A3641;
    --day-selected: #60A5FA;
    --day-selected-ink: #0B1220;
    --link: #7DB3FF;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-mode]) {
    --bg: #10161C;
    --surface: #18212A;
    --ink: #EAF0F4;
    --ink-2: #9AA6B1;
    --line: #27323C;
    --on-ink: #10161C;
    --danger: #F97066;
    --backdrop: rgba(0, 0, 0, .6);
    --day-past: #0D1318;
    --day-today: #2f9e5b;
    --day-weekend: #2A3641;
    --day-selected: #60A5FA;
    --day-selected-ink: #0B1220;
    --link: #7DB3FF;
  }
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.45 var(--font);
  -webkit-tap-highlight-color: transparent;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.boot { padding: 48px 24px; color: var(--ink-2); text-align: center; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Magnete ---------- */
.magnet {
  display: inline-block; flex: none;
  width: 10px; height: 10px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12);
}
.magnet.lg { width: 18px; height: 18px; margin-top: 3px; }
.magnet.xl { width: 28px; height: 28px; }

/* ---------- Buttons & Formulare ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px;
  border: 1.5px solid var(--ink); border-radius: var(--r-pill);
  background: transparent; font-weight: 650;
}
.btn.primary { background: var(--ink); color: var(--on-ink); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.quiet { border-color: transparent; color: var(--ink-2); }
.btn.small { min-height: 36px; padding: 6px 14px; font-size: .9rem; }
.btn[disabled] { opacity: .5; cursor: default; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  border: 1.5px solid var(--line); background: var(--surface);
}
.icon-btn svg, .btn svg { width: 22px; height: 22px; }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .field > .label { font-size: .875rem; color: var(--ink-2); font-weight: 550; }
.field input[type=text], .field input[type=email], .field input[type=password],
.field input[type=date], .field input[type=time], .field textarea, .field select {
  width: 100%; min-height: 46px; padding: 11px 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-m);
  background: var(--bg);
}
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 1px; border-color: var(--ink);
}
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }

.error { color: var(--danger); font-weight: 550; margin: 0 0 12px; }
.hint { color: var(--ink-2); font-size: .9rem; }

/* ---------- Anmeldung & Start ---------- */
.auth {
  max-width: 420px; margin: 0 auto;
  padding: calc(48px + env(safe-area-inset-top)) 24px 48px;
}
.auth .brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.auth h1 {
  font-size: 2.3rem; line-height: 1.05; font-weight: 800;
  font-variation-settings: 'wdth' 88; word-spacing: .12em;
}
.auth .lead { color: var(--ink-2); margin-bottom: 24px; }
.auth form .btn { width: 100%; }
.auth .switch { margin-top: 18px; text-align: center; }
.auth .switch button {
  background: none; border: 0; padding: 4px; font-weight: 650;
  text-decoration: underline; text-underline-offset: 3px;
}
.auth hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
.auth h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 12px; }

/* ---------- Menüleiste oben (immer sichtbar, Handy und PC) ---------- */
.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

.topbar {
  flex: none; position: relative; z-index: 30;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "menu clock nav" "menu cal mail";
  align-items: center; column-gap: 2px; row-gap: 0; min-height: 52px;
  padding: calc(3px + env(safe-area-inset-top)) 6px 3px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
#tb-menu { grid-area: menu; }
.tb-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; border: 0; border-radius: var(--r-m);
  background: none; color: var(--ink-2);
}
.tb-btn svg { width: 23px; height: 23px; }
#tb-menu { color: var(--ink); }
.tb-btn[aria-current=page] { color: var(--ink); background: var(--bg); box-shadow: inset 0 0 0 1.5px var(--line); }
.tb-nav { grid-area: nav; display: flex; align-items: center; }
.clock {
  grid-area: clock;
  display: flex; align-items: baseline; gap: 7px; flex: 1; min-width: 0; overflow: hidden;
  padding: 0 4px; background: none; border: 0; color: inherit; text-align: left; white-space: nowrap;
}
.clock-date { font-size: .88rem; font-weight: 650; }
.clock-time { font-size: 1.05rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.clock-kw { color: var(--ink-2); font-size: .7rem; font-weight: 650; }
.clock .yr { display: none; }
.calname {
  grid-area: cal; display: flex; align-items: center; gap: 6px; min-width: 0; padding: 0 4px; margin-top: -2px;
  background: none; border: 0; color: var(--ink-2); font-size: .78rem; font-weight: 650; text-align: left;
}
.calname svg { width: 14px; height: 14px; flex: none; }
.calname-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-mail {
  grid-area: mail; justify-self: end; max-width: 48vw; padding-right: 8px; margin-top: -2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-size: .68rem;
}
.calmark {
  display: inline-grid; place-items: center; flex: none; width: 16px; height: 16px; border-radius: 50%;
  font-size: .62rem; line-height: 1; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2);
}
.calmark.lg { width: 34px; height: 34px; font-size: 1.05rem; }
.callist { display: grid; }
.calrow {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) 24px; align-items: center; gap: 12px; width: 100%;
  padding: 10px 4px; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); color: inherit;
}
.calrow svg { width: 20px; height: 20px; }
.calrow-text { display: grid; min-width: 0; }
.calrow[aria-pressed=true] strong { text-decoration: underline; text-underline-offset: 3px; }

.main {
  flex: 1; min-height: 0; width: 100%; max-width: none; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 8px 6px calc(84px + env(safe-area-inset-bottom));
}
.main.cal { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; }
.calwrap { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cal-head { flex: none; }
.cal-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.cal-scroll .weekdays { position: sticky; top: 0; z-index: 5; margin-bottom: 0; padding-bottom: 3px; background: var(--bg); }

.fab {
  position: fixed; z-index: 15;
  right: calc(14px + env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--on-ink); border: 0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}
.fab svg { width: 26px; height: 26px; }

/* Menü-Schublade */
.drawer-wrap { position: fixed; inset: 0; z-index: 60; display: flex; background: var(--backdrop); }
.drawer {
  display: flex; flex-direction: column; width: min(340px, 88vw); height: 100%; overflow-y: auto;
  padding: calc(10px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom));
  background: var(--surface); animation: slide .18s ease-out;
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 8px; font-size: 1.25rem; }
.menu-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: 4px; width: 100%;
  padding: 8px 4px; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); color: inherit;
}
.menu-text { display: grid; min-width: 0; }
.menu-block { display: grid; gap: 8px; padding: 12px 4px; border-top: 1px solid var(--line); }
@keyframes slide { from { transform: translateX(-24px); opacity: 0; } }

/* ---------- Kalender-Kopf (kompakt) ---------- */
.cal-head { display: grid; gap: 6px; margin-bottom: 8px; }
.cal-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-title {
  min-width: 0; font-size: clamp(1.35rem, 5.6vw, 2.2rem); line-height: 1.05; font-weight: 800;
  font-variation-settings: 'wdth' 88; word-spacing: .12em; letter-spacing: -.01em;
}
.kw-inline { margin-left: 8px; font-size: .42em; font-weight: 650; color: var(--ink-2); font-variation-settings: 'wdth' 100; letter-spacing: 0; white-space: nowrap; }
.cal-nav { display: flex; align-items: center; gap: 6px; flex: none; }
.cal-nav .icon-btn { width: 38px; height: 38px; }
.cal-nav .icon-btn svg { width: 20px; height: 20px; }

.quick { display: flex; align-items: center; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.quick::-webkit-scrollbar { display: none; }
.qchip {
  flex: none; min-height: 32px; padding: 3px 12px;
  border: 1.5px solid var(--line); border-radius: var(--r-pill); background: var(--surface);
  font-size: .84rem; font-weight: 600; color: var(--ink-2);
}
.qchip[aria-pressed=true] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

.segmented {
  display: inline-flex; flex: none; padding: 3px; gap: 2px;
  border: 1.5px solid var(--line); border-radius: var(--r-pill); background: var(--surface);
}
.segmented button {
  min-height: 36px; padding: 4px 16px; border: 0; border-radius: var(--r-pill);
  background: none; font-weight: 600; color: var(--ink-2);
}
.segmented button[aria-pressed=true] { background: var(--ink); color: var(--on-ink); }
.segmented.small { padding: 2px; }
.segmented.small button { min-height: 28px; padding: 2px 12px; font-size: .84rem; }

/* ---------- Monatsansicht ---------- */
.cal-layout { display: grid; gap: 10px; }

.weekdays, .days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.weekdays { margin-bottom: 3px; text-align: center; font-size: .74rem; font-weight: 650; color: var(--ink-2); }
.weekdays .wd-long { display: none; }
.days {
  gap: var(--grid-w); background: var(--day-border); border: var(--grid-w) solid var(--day-border);
  border-radius: var(--r-m); overflow: hidden;
}

.day {
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  min-height: 78px; min-width: 0; padding: 0 0 3px;
  background: var(--surface); color: var(--ink);
  border: 0; border-radius: 0; text-align: left; font: inherit;
}
.day.off { background: var(--day-weekend); color: var(--day-weekend-ink); }
.day.past { background: var(--day-past); color: var(--day-past-ink); }
.day.today { outline: 2px solid var(--day-today); outline-offset: -2px; }
.day.today .dayhead { margin-bottom: 1px; padding: 2px 3px 1px; background: var(--day-today); color: var(--day-today-ink); }
.day.today.selected { box-shadow: inset 0 0 0 5px var(--day-selected); }
.day.cellcolor { background: var(--cell-bg) !important; color: var(--cell-ink) !important; }
.day.selected { box-shadow: inset 0 0 0 3px var(--day-selected); position: relative; z-index: 1; }
.day.out > * { opacity: .5; }

.dayhead { display: flex; align-items: baseline; gap: 3px; padding: 2px 3px 0; min-width: 0; }
.num {
  display: inline-grid; place-items: center; flex: none;
  min-width: 22px; height: 22px; padding: 0 4px; border-radius: min(var(--r-pill), 11px);
  font-size: .88rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.day.selected .num { background: var(--day-selected); color: var(--day-selected-ink); }
.kw { font-size: .56rem; font-weight: 650; opacity: .8; white-space: nowrap; }
.holiday-name {
  padding: 0 3px; font-size: .6rem; line-height: 1.1; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.evs { display: grid; gap: 1px; min-width: 0; }
.ev-line {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
  min-width: 0; padding: 1px 2px;
  border-left: 3px solid var(--ev-bar, transparent); border-radius: 0 var(--r-xs) var(--r-xs) 0;
  background: var(--ev-bg, transparent); color: var(--ev-ink, inherit);
  font-size: .62rem; line-height: 1.16; font-weight: 600; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto;
}
.ev-line .ev-time { display: block; font-size: .54rem; line-height: 1.1; font-weight: 700; opacity: .85; font-variant-numeric: tabular-nums; }
.ev-line .inis { display: none; }
.ev-line.done .ev-title { text-decoration: line-through; opacity: .7; }
.more { padding: 0 4px; font-size: .62rem; font-weight: 700; opacity: .8; }
html[data-circles="off"] .ev-line .inis { display: none !important; }
html[data-times="off"] .ev-line .ev-time { display: none !important; }

/* Farbstil der Termine (Menü > Farben) */
html[data-evstyle="text"] .ev-line { background: transparent; color: var(--ev-color, inherit); }
html[data-evstyle="text"] .time-pill { background: var(--line); color: var(--ink); }
html[data-evstyle="text"] .event .event-title { color: var(--row-color, inherit); }
.day.cellcolor .ev-line.allday { background: transparent; color: inherit; }

.inis { display: inline-flex; flex: none; gap: 2px; }
.ini {
  display: inline-grid; place-items: center; flex: none;
  width: 20px; height: 20px; border-radius: 50%;
  font-size: .68rem; font-weight: 750; line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2);
}
.ini.long { font-size: .5rem; letter-spacing: -.02em; }
.ev-line .ini { width: 17px; height: 17px; font-size: .6rem; }

/* ---------- Tagesliste (kompakt, mit Details) ---------- */
.day-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.day-panel h2 { font-size: 1.12rem; font-weight: 750; font-variation-settings: 'wdth' 88; }

.event { display: flex; align-items: center; gap: 2px; width: 100%; border-top: 1px solid var(--line); }
.event:last-child { border-bottom: 1px solid var(--line); }
.event-main {
  display: flex; flex: 1; flex-wrap: wrap; align-items: flex-start; gap: 4px 8px; min-width: 0;
  padding: 7px 2px; text-align: left; background: none; border: 0; color: inherit;
}
.task-check { flex: none; display: grid; place-items: center; width: 40px; height: 40px; background: none; border: 0; padding: 0; }
.event.done .box { background: var(--ink); color: var(--on-ink); }
.event.done .box svg { opacity: 1; }
.event.done .event-title { text-decoration: line-through; color: var(--ink-2); }
.time-pill {
  flex: none; padding: 1px 8px; border-radius: var(--r-s);
  background: var(--pill-bg, var(--line)); color: var(--pill-ink, var(--ink));
  font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.event-text { display: grid; flex: 1; min-width: 7ch; }
.event-title { font-weight: 650; overflow-wrap: anywhere; line-height: 1.3; }
.event-sub { color: var(--ink-2); font-size: .8rem; line-height: 1.3; overflow-wrap: anywhere; }
.event-sub.notes { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; white-space: pre-line; }
.badge {
  flex: none; padding: 1px 9px;
  border: 1.5px solid var(--ink); border-radius: var(--r-pill);
  font-size: .74rem; font-weight: 650;
}
.empty { color: var(--ink-2); padding: 14px 4px; }

/* ---------- Wochenansicht ---------- */
.week { display: grid; gap: 4px; }
.week-day { padding: 8px 0 4px; border-top: 1px solid var(--line); min-width: 0; }
.week-day-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.week-day-head h3 { font-size: 1.05rem; font-weight: 750; font-variation-settings: 'wdth' 88; }
.week-day.today h3 { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 4px; }
.week-day.selected .week-day-head h3::after { content: ' •'; }
.week-day .empty { padding: 6px 4px 10px; }
.week-add {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border: 1.5px solid var(--line); border-radius: 50%; background: var(--surface);
}
.week-add svg { width: 18px; height: 18px; }

/* ---------- Listen ---------- */
.page-title {
  font-size: clamp(1.9rem, 7vw, 2.8rem); line-height: 1.02; font-weight: 800;
  font-variation-settings: 'wdth' 88; word-spacing: .12em; margin-bottom: 16px;
}
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  padding: 16px 4px; text-align: left; background: none; border: 0; border-top: 1px solid var(--line);
}
.list-row:last-of-type { border-bottom: 1px solid var(--line); }
.list-row strong { font-size: 1.1rem; font-weight: 700; display: block; }
.list-row span.hint { display: block; }
.list-row svg { width: 20px; height: 20px; color: var(--ink-2); }

.inline-form { display: flex; gap: 8px; margin-top: 18px; }
.inline-form input {
  flex: 1; min-width: 0; min-height: 46px; padding: 11px 14px;
  border: 1.5px solid var(--line); border-radius: var(--r-m); background: var(--surface);
}
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; padding: 6px 8px 6px 0; background: none; border: 0; font-weight: 650; color: var(--ink-2); }
.back svg { width: 20px; height: 20px; }

.item { display: flex; align-items: center; gap: 12px; padding: 4px 0; border-top: 1px solid var(--line); }
.item:last-of-type { border-bottom: 1px solid var(--line); }
.item-check {
  display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0;
  min-height: 52px; padding: 6px 0; background: none; border: 0; text-align: left;
}
.box {
  display: inline-grid; place-items: center; flex: none;
  width: 26px; height: 26px; border: 2px solid var(--ink); border-radius: var(--r-s);
}
.box svg { width: 18px; height: 18px; opacity: 0; }
.item[data-done=true] .box { background: var(--ink); color: var(--on-ink); }
.item[data-done=true] .box svg { opacity: 1; }
.item[data-done=true] .item-text { color: var(--ink-2); text-decoration: line-through; }
.item-text { overflow-wrap: anywhere; font-size: 1.05rem; }
.item-del { width: 40px; height: 40px; border: 0; background: none; border-radius: 50%; color: var(--ink-2); display: grid; place-items: center; }
.item-del svg { width: 20px; height: 20px; }
.list-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }

/* ---------- Familie ---------- */
.section { margin-bottom: 32px; max-width: 560px; }
.section h2 { font-size: 1.25rem; font-weight: 750; margin-bottom: 10px; }
.member { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-top: 1px solid var(--line); }
.member:last-child { border-bottom: 1px solid var(--line); }
.member b { font-weight: 700; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.swatch {
  width: 40px; height: 40px; border-radius: 50%; border: 0; padding: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);
}
.swatch[aria-pressed=true] { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--ink); }
.code {
  display: inline-block; padding: 10px 16px; margin: 4px 0 12px;
  border: 1.5px dashed var(--ink); border-radius: var(--r-m);
  font-size: 1.5rem; font-weight: 750; letter-spacing: .12em; font-variant-numeric: tabular-nums;
}
.stack { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Dialog ---------- */
.sheet-wrap {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: flex-end; justify-content: center;
  background: var(--backdrop);
}
.sheet {
  width: 100%; max-width: 560px; max-height: 94dvh; overflow-y: auto;
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  background: var(--surface); border-radius: var(--r-l) var(--r-l) 0 0;
  animation: rise .2s ease-out;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet-head h2 { font-size: 1.4rem; font-weight: 800; font-variation-settings: 'wdth' 85; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sheet-actions .grow { flex: 1; }

.invite {
  display: grid; gap: 10px; margin-bottom: 18px; padding: 14px;
  border: 1.5px solid var(--ink); border-radius: var(--r-m);
}
.invite p { font-weight: 650; }

.toggle { display: flex; align-items: center; gap: 12px; min-height: 44px; margin-bottom: 14px; font-weight: 600; }
.toggle input { width: 22px; height: 22px; accent-color: var(--ink); }

.people { display: flex; flex-wrap: wrap; gap: 8px; }
.person {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px 6px 10px;
  border: 1.5px solid var(--line); border-radius: var(--r-pill); background: none; font-weight: 600;
}
.person .magnet { width: 16px; height: 16px; }
.person[aria-pressed=true] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.person small { color: var(--ink-2); font-weight: 500; }

@keyframes rise { from { transform: translateY(28px); opacity: 0; } }

/* ---------- Hinweisleiste (API veraltet) ---------- */
.banner {
  display: grid; gap: 8px; margin-bottom: 10px; padding: 12px 14px; justify-items: start;
  border: 2px solid var(--danger); border-radius: var(--r-m); background: var(--surface); font-size: .92rem; line-height: 1.35;
}
.banner strong { color: var(--danger); }
.auth .banner { margin-bottom: 18px; }

/* ---------- Termin-Seite ---------- */
.page-wrap {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto;
  background: var(--bg); animation: fade .15s ease-out;
}
.page-head {
  position: sticky; top: 0; z-index: 2;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.page-head h2 { font-size: 1.1rem; font-weight: 750; text-align: center; }
.page-head .btn:first-child { justify-self: start; }
.page-head .btn:last-child { justify-self: end; }
.page-body { max-width: 720px; margin: 0 auto; padding: 8px 16px calc(48px + env(safe-area-inset-bottom)); position: relative; }
.share-tools { display: flex; justify-content: flex-end; gap: 8px; padding: 6px 0 0; }
.share-tools .icon-btn { border-color: transparent; background: none; }

.frow { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: start; padding: 8px 0; }
.ficon { display: grid; place-items: center; height: 44px; color: var(--ink-2); }
.ficon svg { width: 22px; height: 22px; }
.fbody { display: grid; gap: 10px; align-content: center; min-height: 44px; min-width: 0; }
.frow.muted { color: var(--ink-2); }
.frow.muted .fbody { min-height: 44px; }
.tag {
  margin-left: 10px; padding: 1px 8px; border: 1px solid var(--line); border-radius: var(--r-pill);
  font-size: .72rem; font-weight: 650; vertical-align: middle;
}

.title-in, .plain-in {
  width: 100%; min-height: 44px; padding: 8px 2px;
  border: 0; border-bottom: 2px solid var(--line); border-radius: 0; background: transparent;
}
.title-in { font-size: 1.4rem; font-weight: 700; }
.plain-in { font-size: 1rem; }
.plain-in:focus-visible, .title-in:focus-visible { outline: none; border-bottom-color: var(--ink); }
textarea.plain-in { resize: none; overflow: hidden; line-height: 1.45; }
.plain-btn { min-height: 44px; padding: 0; background: none; border: 0; text-align: left; font-size: 1rem; }
.link-btn { padding: 6px 0; background: none; border: 0; color: var(--link); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-align: left; }
.shown-in { display: flex; align-items: center; min-height: 44px; }

.pcircles { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.pc { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0; background: none; border: 0; }
.pcircle { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.pcircle svg { width: 20px; height: 20px; stroke-width: 3; }
.pc[aria-pressed=true] .pcircle { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2), 0 0 0 3px var(--bg), 0 0 0 5px var(--ink); }
.pname { font-weight: 600; }
.pc small { color: var(--ink-2); }

.cbx { display: inline-flex; align-items: center; gap: 12px; min-height: 44px; padding: 0; background: none; border: 0; text-align: left; font-size: 1rem; }
.cbx[aria-checked=true] .box { background: var(--ink); color: var(--on-ink); }
.cbx[aria-checked=true] .box svg { opacity: 1; }
.cbox {
  display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px;
  border: 2px solid var(--ink); border-radius: var(--r-s); font-size: 1.05rem; line-height: 1;
}

.dt { display: grid; gap: 12px; }
.wday { display: block; margin-bottom: 4px; font-size: .9rem; font-weight: 600; }
.dt-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.dt-line .abox { width: auto; flex: 1; min-width: 0; }
.tparts { display: inline-flex; align-items: center; gap: 6px; }
.dbox, .nbox {
  min-height: 44px; padding: 8px 10px;
  border: 1.5px solid var(--line); border-radius: var(--r-s); background: var(--surface);
}
.dbox { flex: 1 1 8.4rem; min-width: 8.2rem; max-width: 12rem; }
.nbox { width: 46px; padding: 8px 4px; text-align: center; font-variant-numeric: tabular-nums; }
.plain-icon { display: inline-grid; place-items: center; width: 36px; height: 40px; background: none; border: 0; border-radius: 50%; color: var(--ink-2); }
.plain-icon svg { width: 20px; height: 20px; }

.page-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 12px; }

/* ---------- Fenster (Farbe, Symbol, Einladen) ---------- */
.popup { z-index: 60; }
.sheet.small { max-width: 440px; }
.pop-h { margin: 14px 0 8px; font-size: .95rem; font-weight: 700; color: var(--ink-2); }
.pop-h:first-child { margin-top: 0; }
.cpick-row { display: flex; align-items: center; gap: 10px; }
.cpick { width: 56px; height: 46px; padding: 2px; border: 1.5px solid var(--line); border-radius: var(--r-s); background: none; flex: none; }
.hexbox {
  flex: 1; min-width: 0; min-height: 46px; padding: 8px 12px;
  border: 1.5px solid var(--line); border-radius: var(--r-s); background: var(--bg);
  font-variant-numeric: tabular-nums; text-transform: lowercase;
}
.cprev { flex: none; width: 46px; height: 46px; border-radius: var(--r-s); border: 1.5px solid var(--line); }
.emojis { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji { aspect-ratio: 1; font-size: 1.4rem; line-height: 1; background: none; border: 1.5px solid transparent; border-radius: var(--r-s); }
.emoji[aria-pressed=true] { border-color: var(--ink); }
a.btn { text-decoration: none; color: inherit; }

@keyframes fade { from { opacity: 0; } }

/* ---------- Hinweis ---------- */
#toast {
  position: fixed; left: 50%; z-index: 80;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%); max-width: min(92vw, 420px);
  padding: 10px 18px; border-radius: var(--r-pill);
  background: var(--ink); color: var(--on-ink); font-weight: 600; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
#toast.show { opacity: 1; }

/* ---------- Ab 700px: ausführliche Zeilen im Raster ---------- */
@media (min-width: 700px) {
  .main { padding: 14px 2vw 96px; }
  .main.cal { padding-bottom: 0; }
  .clock .yr { display: inline; }
  .clock-date { font-size: .95rem; }
  .weekdays { font-size: .9rem; }
  .weekdays .wd-short { display: none; }
  .weekdays .wd-long { display: inline; }
  .day { min-height: 124px; padding: 0 0 4px; gap: 3px; }
  .dayhead { padding-top: 4px; }
  .day.today .dayhead { padding: 4px 3px 2px; }
  .num { min-width: 26px; height: 26px; font-size: 1rem; }
  .kw { font-size: .74rem; }
  .holiday-name { padding: 0 6px; font-size: .76rem; }
  .ev-line {
    display: flex; align-items: center; gap: 5px; padding: 2px 4px;
    font-size: .8rem; line-height: 1.25; border-radius: 0 var(--r-xs) var(--r-xs) 0; hyphens: manual;
  }
  .ev-line .ev-time { display: inline; margin: 0; font-size: .74rem; }
  .ev-line .inis { display: inline-flex; }
  .ev-line .ini { width: 18px; height: 18px; }
  .ev-line .ev-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .more { font-size: .76rem; padding: 0 6px; }
  html[data-evstyle="time"] .ev-line { background: transparent; color: inherit; }
  html[data-evstyle="time"] .ev-line .ev-time { background: var(--ev-bg, transparent); color: var(--ev-ink, inherit); padding: 0 4px; border-radius: var(--r-xs); }
  html[data-evstyle="time"] .ev-line.notime { background: var(--ev-bg, transparent); color: var(--ev-ink, inherit); }
  html[data-evstyle="fullday"] .ev-line.allday { background: var(--ev-bg, transparent); }
  .time-pill { font-size: .88rem; }
  .event-sub { font-size: .86rem; }
  .fab { right: 28px; bottom: 28px; width: 58px; height: 58px; }
  #toast { bottom: 32px; }
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: var(--r-l); }
}

@media (min-width: 900px) {
  .week { grid-template-columns: repeat(var(--cols, 7), minmax(0, 1fr)); gap: 12px; }
  .week-day { border-top: 2px solid var(--ink); padding-top: 10px; }
}

/* ---------- Anzeige-Menü ---------- */
.qchip.menu { display: inline-flex; align-items: center; gap: 4px; }
.qchip.menu svg { width: 14px; height: 14px; }
.dropdown {
  position: fixed; z-index: 45; min-width: 236px; padding: 6px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-m); box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}
.dropdown hr { margin: 4px 0; border: 0; border-top: 1px solid var(--line); }
.mi {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 6px 10px;
  background: none; border: 0; border-radius: var(--r-s); color: inherit; text-align: left;
}
.mi svg { width: 20px; height: 20px; flex: none; }
.mi .box { width: 22px; height: 22px; border-radius: var(--r-xs); }
.mi .box svg { width: 16px; height: 16px; }
.mi[aria-checked=true] .box { background: var(--ink); color: var(--on-ink); }
.mi[aria-checked=true] .box svg { opacity: 1; }
.radio[disabled] { opacity: .55; cursor: default; }

/* ---------- Jahresübersicht ---------- */
.year { display: grid; gap: 14px; }
.ysummary { display: grid; gap: 8px; }
.ybig { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.ylegend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none; font-size: .88rem; }
.ylegend li { display: inline-flex; align-items: center; gap: 6px; }
.ydot { flex: none; width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.ygrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ycard {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "m t" "b b"; gap: 6px 8px; align-items: baseline;
  padding: 12px; text-align: left; color: inherit; background: var(--surface);
  border: 1.5px solid var(--day-border); border-radius: var(--r-m);
}
.ycard.now { border-color: var(--day-today); box-shadow: inset 0 0 0 1px var(--day-today); }
.ymonth { grid-area: m; font-weight: 700; }
.ytotal { grid-area: t; font-size: 1.45rem; font-variant-numeric: tabular-nums; }
.ybar { grid-area: b; display: flex; gap: 2px; height: 14px; border-radius: min(var(--r-pill), 7px); overflow: hidden; background: var(--line); }
.yseg { min-width: 3px; }
.yseg.empty { flex: 1; background: transparent; }

/* ---------- Datum und Uhrzeit auswählen ---------- */
.popup2 { z-index: 70; }
.dhead { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-bottom: 8px; }
.dtitle { flex: 1; text-align: center; font-size: 1rem; }
.icon-btn.small { width: 36px; height: 36px; }
.icon-btn.small svg { width: 18px; height: 18px; }
.dgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dwd { padding: 4px 0; text-align: center; font-size: .78rem; font-weight: 650; color: var(--ink-2); }
.dcell { min-height: 40px; aspect-ratio: 1; border: 0; border-radius: var(--r-s); background: none; color: inherit; font-size: .98rem; font-variant-numeric: tabular-nums; }
.dcell.out { color: var(--ink-2); opacity: .55; }
.dcell.off { background: color-mix(in srgb, var(--line) 55%, transparent); }
.dcell.today { box-shadow: inset 0 0 0 2px var(--day-today); }
.dcell[aria-pressed=true] { background: var(--ink); color: var(--on-ink); }
.tgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.tcell { min-height: 48px; border: 1.5px solid var(--line); border-radius: var(--r-s); background: var(--surface); color: inherit; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.tcell[aria-pressed=true] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.datebtn { text-align: left; cursor: pointer; color: inherit; }
.nbox { cursor: pointer; }
.hint.small { font-size: .82rem; }

/* ---------- Listeneinträge bearbeiten ---------- */
.item-check { flex: none; display: grid; place-items: center; gap: 0; width: 44px; min-height: 52px; padding: 0; }
.item-label { flex: 1; min-width: 0; min-height: 52px; padding: 6px 0; background: none; border: 0; text-align: left; color: inherit; font-size: 1.05rem; overflow-wrap: anywhere; }
.item[data-done=true] .item-label { color: var(--ink-2); text-decoration: line-through; }
.item-edit { flex: 1; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1.5px solid var(--ink); border-radius: var(--r-s); background: var(--surface); font-size: 1.05rem; }

/* ---------- Farbvorschau ---------- */
.preview-cal { position: sticky; top: 58px; z-index: 3; margin: 0 0 8px; padding: 6px 0 8px; background: var(--bg); }
.preview-cal .day { min-height: 76px; cursor: default; }

/* ---------- Terminvorlagen ---------- */
.tchips { display: flex; align-items: center; gap: 8px; padding: 2px 0 4px; overflow-x: auto; scrollbar-width: none; }
.tchips::-webkit-scrollbar { display: none; }
.tchip {
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 14px 4px 6px;
  border: 1.5px solid var(--line); border-radius: var(--r-pill); background: var(--surface); font-weight: 600;
}
.tchip[aria-pressed=true] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.tdot {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); font-size: .95rem; line-height: 1;
}
.tlist { display: grid; }
.trow {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) 24px; align-items: center; gap: 12px; width: 100%;
  padding: 10px 2px; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); color: inherit;
}
.trow:last-child { border-bottom: 1px solid var(--line); }
.trow svg { width: 20px; height: 20px; color: var(--ink-2); }
.tcolor { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-s); border: 1.5px solid var(--line); font-size: 1.1rem; }
.tname { display: grid; min-width: 0; }
.tname small { overflow-wrap: anywhere; }

/* ---------- Farbwähler ---------- */
.sv {
  position: relative; width: 100%; height: 170px; border-radius: var(--r-m); touch-action: none; cursor: crosshair;
  background-color: #f00;
  background-image: linear-gradient(to top, #000, rgba(0, 0, 0, 0)), linear-gradient(to right, #fff, rgba(255, 255, 255, 0));
  border: 1.5px solid var(--line);
}
.hue {
  position: relative; width: 100%; height: 28px; margin-top: 14px; border-radius: min(var(--r-pill), 14px); touch-action: none; cursor: pointer;
  background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
  border: 1.5px solid var(--line);
}
.thumb {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .35); pointer-events: none;
}
.hue .thumb { top: 50%; }
.cpick-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.sv:focus-visible, .hue:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ---------- Einstellungsseiten ---------- */
.settings { max-width: 640px; }
.arow { display: grid; grid-template-columns: minmax(112px, 35%) minmax(0, 1fr); gap: 8px 14px; align-items: start; padding: 12px 0; }
.alabel { padding-top: 10px; font-size: .92rem; font-weight: 700; text-align: right; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; }
.acontrol { display: grid; gap: 8px; align-content: start; min-width: 0; }
.abox {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1.5px solid var(--line); border-radius: var(--r-s); background: var(--surface);
}
.abox.short { width: 5.5rem; }
.abox[readonly] { padding-left: 0; background: transparent; border-color: transparent; }
.abox:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; border-color: var(--ink); }
.radios { display: grid; gap: 10px; }
.radio { display: flex; align-items: flex-start; gap: 12px; min-height: 34px; padding: 2px 0; background: none; border: 0; text-align: left; font-size: .95rem; }
.radio .dot { flex: none; width: 26px; height: 26px; margin-top: -1px; border: 2px solid var(--ink); border-radius: 50%; }
.radio[aria-checked=true] .dot { background: var(--ink); box-shadow: inset 0 0 0 5px var(--bg); }
.mlist { display: grid; gap: 4px; }
.mrow { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0; background: none; border: 0; text-align: left; }
.mdot { flex: none; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); }
.mdot.big { width: 32px; height: 32px; }
.cbox.sq { width: 36px; height: 36px; }
.stack-col { display: grid; gap: 10px; }
.stack-col.center { justify-items: center; margin-top: 18px; }
.page-actions.spread { justify-content: space-between; }

/* ---------- Suche und Tagesdetails ---------- */
.results { display: grid; max-height: 34dvh; margin-top: 6px; overflow: auto; }
.result {
  display: grid; grid-template-columns: 7.4rem minmax(0, 1fr); gap: 10px; align-items: start;
  padding: 8px 2px; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); color: inherit;
}
.rdate { display: grid; font-size: .85rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.rdate small, .rtext small { color: var(--ink-2); font-weight: 500; }
.rtext { display: grid; min-width: 0; overflow-wrap: anywhere; }
.inline-form.tight { margin-top: 0; }
.details { display: grid; }
.detail { display: grid; gap: 4px; padding: 10px 0; border-top: 1px solid var(--line); }
.detail-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.detail-title { flex: 1; min-width: 8ch; }
.detail-line, .detail-notes { font-size: .92rem; overflow-wrap: anywhere; }
.detail-notes { white-space: pre-wrap; color: var(--ink-2); }
.detail a { color: var(--link); }

@media (min-width: 520px) { .ygrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .ygrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

@media (prefers-reduced-motion: reduce) {
  .sheet, .page-wrap, .drawer { animation: none; }
  #toast { transition: none; }
}
