/* ==========================================================================
   Schichtplaner für Zwei · v5 "Mobile 2.0" · Design-System
   --------------------------------------------------------------------------
   Prinzip: Die Oberfläche selbst bleibt neutral (Tinte auf Papier), FARBE
   bedeutet immer eine Schicht- bzw. Terminart. So bleibt der Kalender auf
   dem Handy auf einen Blick lesbar.
   Ersetzt das Tailwind-CDN: schneller, offline-fähig, keine externen
   Anfragen (DSGVO) – Schrift liegt lokal in assets/fonts.
   ========================================================================== */

/* ---------- Schrift (Barlow Semi Condensed, OFL) ----------
   Schmale Laufweite = Kürzel und Uhrzeiten passen in die halben
   Tageszellen des Monatsrasters. */
@font-face { font-family:"Barlow SC"; font-weight:500; font-display:swap;
  src:url("fonts/barlow-semi-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family:"Barlow SC"; font-weight:600; font-display:swap;
  src:url("fonts/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family:"Barlow SC"; font-weight:700; font-display:swap;
  src:url("fonts/barlow-semi-condensed-latin-700-normal.woff2") format("woff2"); }

/* ---------- Tokens: Hell ---------- */
:root {
  color-scheme: light;
  --bg:        #eceef2;
  --surface:   #ffffff;
  --surface-2: #f5f6f8;
  --surface-3: #e9ebf0;
  --line:      #dfe2e8;
  --ink:       #15171c;
  --ink-2:     #4b515d;
  --ink-3:     #8a909b;
  --on-ink:    #ffffff;
  --focus:     #2f6fed;
  --danger:    #d92d20;
  --danger-bg: #fdecea;
  --ok:        #16a34a;
  --ok-bg:     #e7f6ec;
  --ok-strong: #16a34a;     /* Button-Hintergrund mit weißer Schrift */
  --alert:     #d92d20;     /* Warnkarte mit weißer Schrift */
  --free:      #22c55e;
  --postit:    #fff6d6;
  --postit-line:#f1dfa0;
  --backdrop:  rgb(10 12 16 / .42);
  --shadow:    0 1px 2px rgb(16 18 24 / .05), 0 6px 20px rgb(16 18 24 / .06);
  --shadow-up: 0 -6px 24px rgb(16 18 24 / .10);

  --r:   16px;   /* Karten */
  --r-s: 10px;   /* Felder, Buttons */
  --r-xs: 6px;   /* Kürzel-Tags */

  --font-ui:  system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-num: "Barlow SC", "Arial Narrow", system-ui, sans-serif;

  --nav-h:  64px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  /* Schicht-/Terminfarben: Hintergrund / Text / Volltonfarbe */
  --s-blue-bg:#dbe8fe;   --s-blue-fg:#1d4ed8;   --s-blue:#3b82f6;
  --s-orange-bg:#ffe8d4; --s-orange-fg:#b4410c; --s-orange:#f97316;
  --s-indigo-bg:#e2e3ff; --s-indigo-fg:#3b31b8; --s-indigo:#5b50e6;
  --s-green-bg:#d9f6e3;  --s-green-fg:#157a3c;  --s-green:#22c55e;
  --s-red-bg:#fde0de;    --s-red-fg:#b42318;    --s-red:#ef4444;
  --s-gray-bg:#eceff3;   --s-gray-fg:#3d4552;   --s-gray:#94a3b8;
  --s-teal-bg:#d2f5ef;   --s-teal-fg:#0f6b63;   --s-teal:#14b8a6;
  --s-pink-bg:#fce4f1;   --s-pink-fg:#a1185a;   --s-pink:#ec4899;
  --s-amber-bg:#fdf0c4;  --s-amber-fg:#8a4b06;  --s-amber:#f2b01e;
}

/* ---------- Tokens: Dunkel (für Nachtschicht-Augen) ---------- */
/* data-theme="dark" = manuell gewählt; ohne Attribut folgt die App dem System */
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { color-scheme: dark; }
}
:root[data-theme="dark"] {
  --bg:#0e1014; --surface:#171a20; --surface-2:#1d2129; --surface-3:#262b35;
  --line:#2a2f3a; --ink:#eef0f4; --ink-2:#b3b9c5; --ink-3:#7c8494; --on-ink:#0e1014;
  --focus:#6f9bff; --danger:#ff6b5e; --danger-bg:#3a1714; --ok:#4ade80; --ok-bg:#12301d;
  --ok-strong:#15803d; --alert:#a8231a;
  --free:#34d399; --postit:#2c2716; --postit-line:#4a4122; --backdrop:rgb(0 0 0 / .6);
  --shadow:0 1px 2px rgb(0 0 0 / .4); --shadow-up:0 -6px 24px rgb(0 0 0 / .5);
  --s-blue-bg:#1b2c4d;   --s-blue-fg:#a9c8ff;
  --s-orange-bg:#3d2414; --s-orange-fg:#ffbf8f;
  --s-indigo-bg:#272551; --s-indigo-fg:#c3c0ff;
  --s-green-bg:#123522;  --s-green-fg:#8ee4ad;
  --s-red-bg:#3d1a19;    --s-red-fg:#ffaaa3;
  --s-gray-bg:#262b35;   --s-gray-fg:#c4cad4;
  --s-teal-bg:#0f3532;   --s-teal-fg:#8fe6da;
  --s-pink-bg:#3c1729;   --s-pink-fg:#ffaed5;
  --s-amber-bg:#3a2d0c;  --s-amber-fg:#ffd77a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#0e1014; --surface:#171a20; --surface-2:#1d2129; --surface-3:#262b35;
    --line:#2a2f3a; --ink:#eef0f4; --ink-2:#b3b9c5; --ink-3:#7c8494; --on-ink:#0e1014;
    --focus:#6f9bff; --danger:#ff6b5e; --danger-bg:#3a1714; --ok:#4ade80; --ok-bg:#12301d;
    --ok-strong:#15803d; --alert:#a8231a;
    --free:#34d399; --postit:#2c2716; --postit-line:#4a4122; --backdrop:rgb(0 0 0 / .6);
    --shadow:0 1px 2px rgb(0 0 0 / .4); --shadow-up:0 -6px 24px rgb(0 0 0 / .5);
    --s-blue-bg:#1b2c4d;   --s-blue-fg:#a9c8ff;
    --s-orange-bg:#3d2414; --s-orange-fg:#ffbf8f;
    --s-indigo-bg:#272551; --s-indigo-fg:#c3c0ff;
    --s-green-bg:#123522;  --s-green-fg:#8ee4ad;
    --s-red-bg:#3d1a19;    --s-red-fg:#ffaaa3;
    --s-gray-bg:#262b35;   --s-gray-fg:#c4cad4;
    --s-teal-bg:#0f3532;   --s-teal-fg:#8fe6da;
    --s-pink-bg:#3c1729;   --s-pink-fg:#ffaed5;
    --s-amber-bg:#3a2d0c;  --s-amber-fg:#ffd77a;
  }
}

/* Farbklassen setzen lokale Variablen, die Komponenten verwenden */
.c-blue   { --c-bg:var(--s-blue-bg);   --c-fg:var(--s-blue-fg);   --c:var(--s-blue); }
.c-orange { --c-bg:var(--s-orange-bg); --c-fg:var(--s-orange-fg); --c:var(--s-orange); }
.c-indigo { --c-bg:var(--s-indigo-bg); --c-fg:var(--s-indigo-fg); --c:var(--s-indigo); }
.c-green  { --c-bg:var(--s-green-bg);  --c-fg:var(--s-green-fg);  --c:var(--s-green); }
.c-red    { --c-bg:var(--s-red-bg);    --c-fg:var(--s-red-fg);    --c:var(--s-red); }
.c-gray   { --c-bg:var(--s-gray-bg);   --c-fg:var(--s-gray-fg);   --c:var(--s-gray); }
.c-teal   { --c-bg:var(--s-teal-bg);   --c-fg:var(--s-teal-fg);   --c:var(--s-teal); }
.c-pink   { --c-bg:var(--s-pink-bg);   --c-fg:var(--s-pink-fg);   --c:var(--s-pink); }
.c-amber  { --c-bg:var(--s-amber-bg);  --c-fg:var(--s-amber-fg);  --c:var(--s-amber); }
/* frei gewählte Hex-Farbe (Termine/Presets): --c wird inline gesetzt */
.c-hex    { --c-bg:color-mix(in srgb, var(--c) 20%, var(--surface));
            --c-fg:color-mix(in srgb, var(--c) 72%, var(--ink)); }

/* ---------- Basis ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.45 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { color: inherit; }
a.btn { text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
svg { width: 20px; height: 20px; flex: none; }
svg.chev { width: 18px; height: 18px; color: var(--ink-3); }
.grow { flex: 1; min-width: 0; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.xs { font-size: 12px; }
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- App-Rahmen ---------- */
.app { min-height: 100dvh; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 24px); }
.view { max-width: 760px; margin: 0 auto; padding: 0 12px; }
.view[hidden] { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--safe-t) + 10px) 14px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  margin: 0 -12px 8px;
}
.topbar-row { display: flex; align-items: center; gap: 8px; }
.topbar h1 { font-family: var(--font-num); font-weight: 700; font-size: 28px; line-height: 1.05; letter-spacing: -.01em; }
.topbar h1 small { font-weight: 500; color: var(--ink-3); font-size: 22px; margin-left: 4px; }
.topbar .sub { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.spacer { flex: 1; }

/* ---------- Tab-Leiste unten (daumengerecht) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
}
.tab {
  height: var(--nav-h); border: 0; background: none; color: var(--ink-3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; position: relative;
}
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--ink); }
.tab .badge-dot { position: absolute; top: 9px; left: calc(50% + 8px); }
.tab-add { display: grid; place-items: center; height: var(--nav-h); border: 0; background: none; }
.tab-add span {
  width: 52px; height: 52px; border-radius: 18px; background: var(--ink); color: var(--on-ink);
  display: grid; place-items: center; box-shadow: 0 6px 18px rgb(16 18 24 / .25);
  transition: transform .15s ease;
}
.tab-add:active span { transform: scale(.94); }
.tab-add svg { width: 26px; height: 26px; }
@media (min-width: 761px) {
  .tabbar { left: 50%; right: auto; width: 760px; transform: translateX(-50%);
            border: 1px solid var(--line); border-bottom: 0; border-radius: 18px 18px 0 0; }
}

/* ---------- Karten ---------- */
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-h h2, .card-h h3 { font-size: 15px; font-weight: 700; }
.card-h .muted { font-size: 12px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card.postit { background: var(--postit); box-shadow: none; border: 1px solid var(--postit-line); }
.card.alert { background: var(--alert); color: #fff; }
.card.alert .muted { color: rgb(255 255 255 / .8); }
.section-label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
                 color: var(--ink-3); margin: 18px 4px 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 16px; border-radius: var(--r-s); border: 1px solid var(--line);
  background: var(--surface); font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: transform .1s ease, background .15s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn-danger  { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.btn-ok      { background: var(--ok-strong); color: #fff; border-color: var(--ok-strong); }
.btn-ghost   { background: transparent; border-color: transparent; }
.btn-soft    { background: var(--surface-2); border-color: transparent; }
.btn-block   { width: 100%; }
.btn-lg      { min-height: 52px; font-size: 16px; border-radius: 14px; }
.btn-sm      { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn svg     { width: 18px; height: 18px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent;
  display: inline-grid; place-items: center; color: var(--ink-2); flex: none;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.soft { background: var(--surface); box-shadow: var(--shadow); }
.icon-btn:active { background: var(--surface-3); }
.btn-row { display: flex; gap: 8px; }
.btn-row > * { flex: 1; }

/* ---------- Formulare (16px = kein iOS-Zoom beim Fokus) ---------- */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 11px 13px; font-size: 16px;
  border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface);
  appearance: none; -webkit-appearance: none;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.select { background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
input[type="date"].input, input[type="time"].input, input[type="datetime-local"].input { font-family: var(--font-num); font-size: 17px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inline-form { display: flex; gap: 8px; }
.inline-form .input { flex: 1; min-width: 0; }

/* Schalter */
.switch-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 0; }
.switch-row > span:first-child { flex: 1; font-weight: 500; }
.switch-row small { display: block; color: var(--ink-3); font-size: 12px; font-weight: 400; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 30px; background: var(--surface-3); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .2s; }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 2.5px solid var(--focus); outline-offset: 2px; }

/* Segment-Umschalter */
.seg { display: inline-flex; background: var(--surface-3); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; border-radius: 9px; min-height: 36px; padding: 0 14px;
  font-weight: 600; font-size: 14px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
.seg.full { display: flex; } .seg.full button { flex: 1; }

/* Auswahl-Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 12px;
  border-radius: 20px; border: 1.5px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: 14px; white-space: nowrap; flex: none;
}
.chips:not(.scroll) .chip { flex: 0 1 auto; }
.chip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.chip.colored { background: var(--c-bg); color: var(--c-fg); border-color: transparent; }
.chip.colored[aria-pressed="true"] { border-color: var(--c-fg); box-shadow: inset 0 0 0 1px var(--c-fg); }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip .x { margin-left: 2px; opacity: .6; border: 0; background: none; padding: 0 2px; font-size: 16px; line-height: 1; }

/* Farbfelder (visuelle Farbwahl) */
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--c);
  box-shadow: inset 0 0 0 2px rgb(0 0 0 / .08); position: relative; }
.swatch[aria-pressed="true"]::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2.5px solid var(--ink); }
.swatch-custom { width: 38px; height: 38px; border-radius: 50%; overflow: hidden; border: 2px dashed var(--line); position: relative; }
.swatch-custom input { position: absolute; inset: -8px; width: 56px; height: 56px; border: 0; padding: 0; cursor: pointer; }

/* Kürzel-Tag (Schicht-/Terminkürzel) */
.tag { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 5px;
  border-radius: var(--r-xs); background: var(--c-bg); color: var(--c-fg);
  font: 700 12.5px/1 var(--font-num); letter-spacing: .02em; }
.tag.lg { min-width: 34px; height: 30px; font-size: 15px; border-radius: 8px; }

/* Punkte & Badges */
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--ink-3)); flex: none; }
.badge-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px var(--surface); }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 10px;
  font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--ink-2); }
.badge.new { background: var(--focus); color: #fff; }
.badge.warn { background: var(--danger-bg); color: var(--danger); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center;
  font: 700 13px/1 var(--font-num); background: var(--ink); color: var(--on-ink); flex: none; }
.avatar.partner { background: var(--surface-3); color: var(--ink); }

/* ---------- Listen ---------- */
.list > li { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 600; overflow-wrap: anywhere; }
.list .meta { font-size: 12px; color: var(--ink-3); }
.list .done .title { text-decoration: line-through; color: var(--ink-3); font-weight: 500; }
.check { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--ink-3); background: transparent;
  display: grid; place-items: center; flex: none; color: transparent; }
.check svg { width: 16px; height: 16px; }
.check[aria-checked="true"] { background: var(--ok-strong); border-color: var(--ok-strong); color: #fff; }
.check.square { border-radius: 9px; }
.row-btn { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0;
  background: none; padding: 10px 0; min-height: 52px; }
.row-btn .chev { color: var(--ink-3); width: 18px; height: 18px; }
.empty { color: var(--ink-3); font-size: 14px; padding: 10px 0; }

/* ---------- Akkordeon (Profil) ---------- */
.acc { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: 10px; overflow: hidden; }
.acc > summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px; min-height: 60px; cursor: pointer; font-weight: 700; }
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary .ico { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; font-size: 18px; flex: none; }
.acc > summary small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-3); }
.acc > summary .chev { margin-left: auto; transition: transform .2s; color: var(--ink-3); width: 18px; height: 18px; flex: none; }
.acc[open] > summary .chev { transform: rotate(90deg); }
.acc-body { padding: 0 14px 14px; }

/* ==========================================================================
   KALENDER
   ========================================================================== */
.cal-tools { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.legend { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.legend .avatar { width: 20px; height: 20px; font-size: 11px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }

.cal { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 8px 6px 6px;
  touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.cal-wd { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center;
  font: 600 12px/1 var(--font-num); color: var(--ink-3); padding: 2px 0 7px; letter-spacing: .04em; }
.cal-wd span:nth-child(n+6) { color: var(--ink-2); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.day {
  position: relative; min-height: 70px; border: 0; padding: 4px 3px 3px; border-radius: 10px;
  background: transparent; text-align: left; display: flex; flex-direction: column; gap: 2px;
  -webkit-touch-callout: none; transition: background .12s;
}
.day.we { background: var(--surface-2); }
.day.out { opacity: .38; }
.day:active { background: var(--surface-3); }
.day[aria-selected="true"] { box-shadow: inset 0 0 0 2px var(--ink); }
.day-n { font: 600 13px/1 var(--font-num); color: var(--ink-2); display: flex; align-items: center; gap: 3px; height: 18px; padding-left: 2px; }
.day.today .day-n b { background: var(--ink); color: var(--on-ink); border-radius: 9px; min-width: 20px; height: 18px; display: inline-grid; place-items: center; padding: 0 4px; }
.day.hol .day-n { color: var(--danger); }
.day .new-dot { position: absolute; top: 5px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--focus); }
.day-shared { height: 15px; border-radius: 5px; background: var(--c-bg); color: var(--c-fg);
  font: 700 10.5px/15px var(--font-num); padding: 0 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.lanes { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; flex: 1; }
.lane { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lane .t {
  height: 20px; border-radius: 5px; background: var(--c-bg); color: var(--c-fg);
  font: 700 12px/20px var(--font-num); text-align: center; overflow: hidden; white-space: nowrap;
  letter-spacing: .01em;
}
.lane .t.pending, .tl-block.pending, .entry.pending .entry-bar { opacity: .55; outline: 1.5px dashed var(--c); outline-offset: -1.5px; }
.lane .t.long { font-size: 10.5px; letter-spacing: -.02em; }
.lane .t.xlong { font-size: 9.5px; letter-spacing: -.03em; }
.lane .t.more { background: var(--surface-3); color: var(--ink-2); font-size: 10.5px; height: 14px; line-height: 14px; }
.lane .t.zz, .tl-sleep {
  background: repeating-linear-gradient(-45deg, var(--surface-3) 0 4px, transparent 4px 8px);
  color: var(--ink-3);
}
.lane .t.zz { height: 13px; line-height: 13px; font-size: 10px; }
@media (min-width: 560px) {
  .day { min-height: 92px; padding: 6px 5px 5px; }
  .lane .t { height: 22px; line-height: 22px; font-size: 13px; }
}

/* Planen-Modus */
.cal.painting .day { cursor: copy; }
.paintbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 31;
  padding: 10px 12px calc(10px + var(--safe-b)); background: var(--surface);
  border-top: 1px solid var(--line); box-shadow: var(--shadow-up);
}
.paintbar .hint { font-size: 12px; color: var(--ink-3); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.paintbar .chips.scroll { margin: 0 -12px; padding: 0 12px; }
@keyframes pop { 0% { transform: scale(.85); } 100% { transform: scale(1); } }
.lane .t.just { animation: pop .18s ease-out; }

/* Agenda-Liste */
.agenda { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 2px 12px; }
.ag-day { display: grid; grid-template-columns: 44px 1fr; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line);
  width: 100%; text-align: left; border-left: 0; border-right: 0; border-top: 0; background: none; -webkit-touch-callout: none; }
.ag-day:last-child { border-bottom: 0; }
.ag-date { text-align: center; font-family: var(--font-num); line-height: 1.05; }
.ag-date .wd { font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; }
.ag-date .dn { font-size: 22px; font-weight: 700; }
.ag-day.today .ag-date .dn { background: var(--ink); color: var(--on-ink); border-radius: 10px; display: inline-block; min-width: 34px; padding: 1px 0; }
.ag-day.we { background: linear-gradient(to right, var(--surface-2), transparent 70%); }
.ag-day.hol .ag-date .dn { color: var(--danger); }
.ag-lines { display: flex; flex-direction: column; gap: 5px; min-width: 0; justify-content: center; }
.ag-line { display: flex; align-items: center; gap: 7px; font-size: 14px; min-width: 0; }
.ag-line .avatar { width: 20px; height: 20px; font-size: 11px; }
.ag-line .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-line .time { font-family: var(--font-num); font-weight: 600; color: var(--ink-2); }
.ag-free { font-size: 13px; color: var(--ok); font-weight: 600; }

/* ---------- Tagespanel ---------- */
.daypanel { margin-top: 12px; }
.dp-head { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.dp-head h2 { font-family: var(--font-num); font-size: 22px; font-weight: 700; line-height: 1.1; }
.dp-head .sub { font-size: 13px; color: var(--ink-3); }
.dp-head .hol-name { color: var(--danger); font-weight: 600; }

/* Zeitstrahl: das Herzstück – zwei Spuren über 24 h */
.tl { position: relative; margin: 4px 0 6px; }
.tl-row { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: center; margin-bottom: 6px; }
.tl-row .avatar { width: 24px; height: 24px; font-size: 12px; }
.tl-track { position: relative; height: 30px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.tl-track.appts { height: 16px; border-radius: 6px; }
.tl-grid { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to right, var(--line) 1px, transparent 1px) 0 0 / 25% 100%; }
.tl-block { position: absolute; top: 0; bottom: 0; background: var(--c-bg); color: var(--c-fg);
  border-left: 3px solid var(--c); font: 700 12.5px/30px var(--font-num); padding: 0 6px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border-radius: 4px; }
.tl-track.appts .tl-block { font-size: 10.5px; line-height: 16px; border-left-width: 2px; padding: 0 3px; text-overflow: clip; }
.tl-block.cont-l { border-left: 0; border-radius: 0 4px 4px 0; }
.tl-block.cont-r { border-radius: 4px 0 0 4px; }
.tl-sleep { position: absolute; top: 0; bottom: 0; font: 600 11px/30px var(--font-num); padding-left: 5px; overflow: hidden; white-space: nowrap; }
.tl-free { position: relative; height: 6px; margin-left: 34px; border-radius: 3px; background: var(--surface-2); }
.tl-free i { position: absolute; top: 0; bottom: 0; background: var(--free); border-radius: 3px; }
.tl-axis { position: relative; height: 14px; margin-left: 34px; font: 600 10.5px/14px var(--font-num); color: var(--ink-3); }
.tl-axis span { position: absolute; transform: translateX(-50%); }
.tl-axis span:first-child { transform: none; }
.tl-axis span:last-child { transform: translateX(-100%); }
.tl-now { position: absolute; top: -3px; bottom: 16px; width: 2px; background: var(--danger); border-radius: 1px; z-index: 2; pointer-events: none; }
.tl-now::before { content: ""; position: absolute; top: -2px; left: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.free-note { font-size: 13px; color: var(--ok); font-weight: 600; margin: 6px 0 2px; }
.free-note.none { color: var(--ink-3); font-weight: 500; }

/* Einträge im Tagespanel */
.entries { margin-top: 8px; }
.entries h4 { font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; margin: 12px 0 4px; display: flex; align-items: center; gap: 6px; }
.entry { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: none;
  padding: 9px 0; min-height: 50px; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; }
.entry-bar { width: 4px; align-self: stretch; border-radius: 2px; background: var(--c); flex: none; }
.entry .grow { flex: 1; min-width: 0; }
.entry .title { font-weight: 600; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.entry .time { font-family: var(--font-num); font-weight: 600; font-size: 14px; color: var(--ink-2); }
.entry .note { font-size: 13px; color: var(--ink-3); font-style: italic; }
.status-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.emoji-btn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-size: 20px; display: grid; place-items: center; }
.emoji-btn[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--surface-2); }

/* ---------- Heute ---------- */
.now-card { padding: 16px 14px 12px; }
.now-who { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.now-who .grow { flex: 1; min-width: 0; }
.now-who .state { font-weight: 700; font-size: 16px; }
.now-who .detail { font-size: 13px; color: var(--ink-3); }
.now-who .emoji { font-size: 22px; }
.state-pill { display: inline-flex; align-items: center; gap: 6px; }
.state-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--ok)); }
.big-free { font-family: var(--font-num); font-size: 20px; font-weight: 700; line-height: 1.2; }
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 10px; }
.kpi { background: var(--surface-2); border-radius: 12px; padding: 10px; }
.kpi b { display: block; font: 700 22px/1.1 var(--font-num); }
.kpi span { font-size: 12px; color: var(--ink-3); }
.progress { height: 10px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--ink); border-radius: 5px; transition: width .6s linear; }
.progress.done i { background: var(--ok); }
table.duz { width: 100%; border-collapse: collapse; font-size: 14px; }
table.duz td { padding: 7px 0; border-bottom: 1px solid var(--line); }
table.duz td:not(:first-child) { text-align: right; font-family: var(--font-num); font-weight: 600; }
table.duz tr.sum td { font-weight: 800; border-bottom: 0; font-size: 15px; }

/* ---------- Einkauf ---------- */
.shop-add { position: sticky; top: calc(var(--safe-t) + 64px); z-index: 10; }

/* ---------- Bottom-Sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: var(--backdrop); opacity: 0; transition: opacity .22s ease; }
.sheet {
  position: relative; width: 100%; max-width: 640px; max-height: calc(100dvh - var(--safe-t) - 24px);
  background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-up);
  display: flex; flex-direction: column; transform: translateY(100%); transition: transform .26s cubic-bezier(.2,.8,.2,1);
}
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: translateY(0); }
.sheet-grip { padding: 8px 0 2px; display: grid; place-items: center; touch-action: none; cursor: grab; }
.sheet-grip i { width: 38px; height: 5px; border-radius: 3px; background: var(--surface-3); }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 2px 10px 6px 18px; touch-action: none; }
.sheet-head h2 { font-size: 18px; font-weight: 700; flex: 1; min-width: 0; }
.sheet-head .sub { font-size: 13px; color: var(--ink-3); font-weight: 500; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 18px calc(18px + var(--safe-b)); -webkit-overflow-scrolling: touch; }
@media (min-width: 700px) {
  .sheet-wrap { align-items: center; padding: 20px; }
  .sheet { border-radius: 22px; max-height: 88dvh; transform: translateY(24px) scale(.98); opacity: 0; transition: transform .2s, opacity .2s; }
  .sheet-wrap.open .sheet { opacity: 1; transform: none; }
  .sheet-grip { display: none; }
  .sheet-head { padding-top: 14px; }
}

/* Schichttyp-Kacheln im Eintragen-Sheet */
.type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type-tile { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px; min-height: 60px;
  border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); }
.type-tile .grow { min-width: 0; flex: 1; }
.type-tile .nm, .type-tile .tm { display: block; }
.type-tile .nm { font-weight: 700; font-size: 14px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; }
.type-tile .tm { font: 600 13px/1.2 var(--font-num); color: var(--ink-3); }
.type-tile[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--surface-2); }
/* Termin-Formular: Ganztägig blendet Uhrzeiten aus */
.dt-row { display: grid; grid-template-columns: 1.25fr 1fr; gap: 8px; }
form[data-allday] .dt-row { grid-template-columns: 1fr; }
form[data-allday] .dt-row input[type="time"] { display: none; }
.more-types > summary { list-style: none; margin: 8px 0 4px; display: inline-flex; color: var(--ink-2); }
.more-types > summary::-webkit-details-marker { display: none; }
body.painting .app { padding-bottom: 220px; }
body.painting .tabbar, body.painting #dayPanel { display: none; }
.hint-box { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }

/* ---------- Toast ---------- */
.toasts { position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + var(--safe-b) + 12px); z-index: 60;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 520px; width: 100%;
  background: var(--ink); color: var(--on-ink); border-radius: 14px; padding: 10px 10px 10px 16px; min-height: 48px;
  box-shadow: 0 8px 24px rgb(0 0 0 / .25); font-size: 14px; font-weight: 500;
  animation: toast-in .2s ease-out; }
.toast span { flex: 1; }
.toast button { border: 0; background: rgb(255 255 255 / .14); color: inherit; font-weight: 700; border-radius: 10px; min-height: 36px; padding: 0 12px; }
:root[data-theme="dark"] .toast button { background: rgb(0 0 0 / .12); }
.toast.err { background: var(--alert); color: #fff; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

/* Verbindungs-Status (Live / Sync / Lokal / Offline) */
.sync-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px;
  border-radius: 16px; border: 0; background: var(--surface); box-shadow: var(--shadow); flex: none;
  font: 700 12.5px/1 var(--font-ui); color: var(--ink-2); }
.sync-chip::after { content: ""; position: absolute; inset: -6px -2px; }           /* größere Tippfläche */
.sync-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.sync-chip[data-state="sync"] i { background: var(--s-amber); box-shadow: none; animation: blink .9s ease-in-out infinite; }
.sync-chip[data-state="local"] i { background: var(--ink-3); box-shadow: none; }
.sync-chip[data-state="off"] i { background: var(--danger); box-shadow: none; }
.sync-chip[data-state="off"] { color: var(--danger); }
@keyframes blink { 50% { opacity: .25; } }
.status-dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; margin: 4px 0 16px; }
.status-dl dt { color: var(--ink-3); }
.status-dl dd { margin: 0; font-weight: 600; }
@media (max-width: 430px) { .legend .nm { display: none; } .legend { gap: 4px; } }

/* Zusammen-Zähler */
.tg-days { font: 700 48px/1 var(--font-num); letter-spacing: -.01em; }
.tg-days small { font-size: 20px; font-weight: 600; color: var(--ink-3); margin-left: 6px; }
.tg-ymd { font-weight: 600; margin-top: 6px; }
.tg-live { font: 600 14px/1.4 var(--font-num); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.together { background: linear-gradient(140deg, color-mix(in srgb, var(--s-pink) 12%, var(--surface)), var(--surface) 60%); }

/* Geburtstage im Kalender */
.day-n .yr { font-size: 10px; line-height: 1; margin-left: 1px; }
.tl-rest { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--ink) 5%, transparent); pointer-events: none; }

/* Lade-Skelett */
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%;
  animation: shimmer 1.2s infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Fokus-Timer */
.pomo-time { font: 700 76px/1 var(--font-num); text-align: center; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pomo-phase { text-align: center; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: 13px; }
.pomo-ring { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin: 12px 0 16px; }
.pomo-ring i { display: block; height: 100%; background: var(--c, var(--s-teal)); transition: width 1s linear; }

/* ---------- Login / Registrierung ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: calc(var(--safe-t) + 20px) 16px calc(var(--safe-b) + 20px); }
.auth-box { width: 100%; max-width: 400px; }
.auth-logo { width: 64px; height: 64px; border-radius: 16px; display: block; margin-bottom: 18px; }
.auth h1 { font-family: var(--font-num); font-size: 32px; font-weight: 700; line-height: 1.05; margin-bottom: 6px; }
.auth .lead { color: var(--ink-2); margin-bottom: 22px; }
.auth .err { background: var(--danger-bg); color: var(--danger); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.sys-card { display: flex; gap: 12px; padding: 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); margin-bottom: 10px; cursor: pointer; }
.sys-card:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.sys-card input { width: 22px; height: 22px; accent-color: var(--ink); margin-top: 2px; flex: none; }
.sys-card b { display: block; }
.sys-card .tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.auth .foot { text-align: center; margin-top: 18px; font-size: 14px; color: var(--ink-2); }
.auth .foot a { font-weight: 700; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; margin-bottom: 8px; }
.check-row input { width: 22px; height: 22px; accent-color: var(--ink); }
