/* SchichtSnap – Oberfläche der Anwendung.
   Farben, Schrift und Regeln stehen in DESIGN.md (angelehnt an Cal.com).
   Aufbau: Grundlagen → Rahmen (Seitenleiste) → Bausteine → Dienstplan →
   Listen → Dialoge → Handy. */

/* Inter liegt selbst gehostet unter /fonts - keine Google Fonts, das wäre
   in Deutschland ein Datenschutzproblem. latin-ext lädt nur, wenn ein Name
   Zeichen wie ş oder ł enthält. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-ext-var.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --surface-3: #f3f4f6;
  --ink: #111111;
  --ink-active: #2a2a2a;
  --on-ink: #ffffff;
  --text: #374151;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --line: #e5e7eb;
  --line-2: #d1d5db;
  --brand: #2563eb;
  --ok: #047857;
  --ok-bg: #ecfdf5;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  /* Alte Namen, auf die noch Stellen im Code verweisen */
  --accent: var(--ink);
  --accent-bg: var(--surface-3);

  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .14);
  --ring: 0 0 0 3px rgba(17, 17, 17, .08);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --sidebar-w: 240px;

  /* Gruppenfarben: Fläche, Streifen, Text, und voll eingefärbt für die eigene Schicht */
  --g-blue-bg: #eff6ff;  --g-blue: #3b82f6;  --g-blue-text: #1e40af;  --g-blue-solid: #1d4ed8;
  --g-green-bg: #ecfdf5; --g-green: #10b981; --g-green-text: #065f46; --g-green-solid: #047857;
  --g-amber-bg: #fffbeb; --g-amber: #f59e0b; --g-amber-text: #92400e; --g-amber-solid: #b45309;
  --g-red-bg: #fef2f2;   --g-red: #ef4444;   --g-red-text: #991b1b;   --g-red-solid: #b91c1c;
  --g-gray-bg: #f3f4f6;  --g-gray: #9ca3af;  --g-gray-text: #374151;  --g-gray-solid: #374151;
}

/* Dunkel: wenn die Person es wählt (data-theme="dark", Profil → Darstellung)
   oder bei „Automatisch“, wenn das Gerät dunkel eingestellt ist. Die beiden
   Blöcke müssen gleich bleiben. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101010;
  --surface: #161616;
  --surface-2: #141414;
  --surface-3: #222222;
  --ink: #fafafa;
  --ink-active: #e5e5e5;
  --on-ink: #111111;
  --text: #d4d4d8;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  --line: #262626;
  --line-2: #3a3a3a;
  --brand: #60a5fa;
  --ok: #34d399;
  --ok-bg: rgba(16, 185, 129, .13);
  --warn: #fbbf24;
  --warn-bg: rgba(245, 158, 11, .13);
  --danger: #f87171;
  --danger-bg: rgba(239, 68, 68, .13);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
  --ring: 0 0 0 3px rgba(255, 255, 255, .12);

  --g-blue-bg: rgba(59, 130, 246, .15);  --g-blue-text: #bfdbfe;
  --g-green-bg: rgba(16, 185, 129, .15); --g-green-text: #a7f3d0;
  --g-amber-bg: rgba(245, 158, 11, .15); --g-amber-text: #fde68a;
  --g-red-bg: rgba(239, 68, 68, .15);    --g-red-text: #fecaca;
  --g-gray-bg: rgba(156, 163, 175, .15); --g-gray-text: #e5e7eb; --g-gray-solid: #52525b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101010;
    --surface: #161616;
    --surface-2: #141414;
    --surface-3: #222222;
    --ink: #fafafa;
    --ink-active: #e5e5e5;
    --on-ink: #111111;
    --text: #d4d4d8;
    --text-2: #a1a1aa;
    --text-3: #71717a;
    --line: #262626;
    --line-2: #3a3a3a;
    --brand: #60a5fa;
    --ok: #34d399;
    --ok-bg: rgba(16, 185, 129, .13);
    --warn: #fbbf24;
    --warn-bg: rgba(245, 158, 11, .13);
    --danger: #f87171;
    --danger-bg: rgba(239, 68, 68, .13);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
    --ring: 0 0 0 3px rgba(255, 255, 255, .12);

    --g-blue-bg: rgba(59, 130, 246, .15);  --g-blue-text: #bfdbfe;
    --g-green-bg: rgba(16, 185, 129, .15); --g-green-text: #a7f3d0;
    --g-amber-bg: rgba(245, 158, 11, .15); --g-amber-text: #fde68a;
    --g-red-bg: rgba(239, 68, 68, .15);    --g-red-text: #fecaca;
    --g-gray-bg: rgba(156, 163, 175, .15); --g-gray-text: #e5e7eb; --g-gray-solid: #52525b;
  }
}

/* ---------- Stil „Modern“ (Profil → Darstellung) ----------
   Angelehnt an die Startseite: leicht getönte Flächen, Farbverlauf blau →
   violett für Hauptknöpfe und Auswahl, weichere Karten mit Schatten.
   Die Farbe kommt hier aus der Oberfläche - bewusst anders als „Schlicht“
   (DESIGN.md). Für dunkel wieder zwei gleiche Blöcke. */
:root[data-style="modern"] {
  --bg: #f5f6fb;
  --surface: #ffffff;
  --surface-2: #f0f2f8;
  --surface-3: #e9ecf5;
  --ink: #0f172a;
  --ink-active: #1e293b;
  --on-ink: #ffffff;
  --text: #334155;
  --text-2: #64748b;
  --text-3: #94a3b8;
  --line: #e3e7f0;
  --line-2: #cfd6e4;
  --brand: #4f46e5;
  --accent-grad: linear-gradient(135deg, #3b82f6 0%, #6366f1 55%, #8b5cf6 100%);
  --accent-soft: rgba(99, 102, 241, .10);
  --accent-text: #4f46e5;
  --accent-glow: 0 8px 22px -8px rgba(99, 102, 241, .65);
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px -8px rgba(15, 23, 42, .10);
  --shadow-lg: 0 30px 70px -20px rgba(15, 23, 42, .35);
  --ring: 0 0 0 3px rgba(99, 102, 241, .20);
  --page-glow: radial-gradient(900px 420px at 85% -120px, rgba(139, 92, 246, .10), transparent 70%),
    radial-gradient(700px 360px at 10% -140px, rgba(59, 130, 246, .10), transparent 70%);
}
:root[data-style="modern"][data-theme="dark"] {
  --bg: #07080c;
  --surface: #0f121a;
  --surface-2: #0b0d13;
  --surface-3: #181c27;
  --ink: #f5f7fb;
  --ink-active: #e2e8f0;
  --on-ink: #0b0d13;
  --text: #c3cad8;
  --text-2: #8a93a8;
  --text-3: #5d6579;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --brand: #818cf8;
  --accent-soft: rgba(129, 140, 248, .14);
  --accent-text: #a5b4fc;
  --accent-glow: 0 8px 26px -8px rgba(139, 92, 246, .75);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px -12px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .9);
  --ring: 0 0 0 3px rgba(129, 140, 248, .25);
  --page-glow: radial-gradient(900px 420px at 85% -120px, rgba(124, 58, 237, .18), transparent 70%),
    radial-gradient(700px 360px at 10% -140px, rgba(37, 99, 235, .18), transparent 70%);
}
@media (prefers-color-scheme: dark) {
  :root[data-style="modern"]:not([data-theme="light"]) {
    --bg: #07080c;
    --surface: #0f121a;
    --surface-2: #0b0d13;
    --surface-3: #181c27;
    --ink: #f5f7fb;
    --ink-active: #e2e8f0;
    --on-ink: #0b0d13;
    --text: #c3cad8;
    --text-2: #8a93a8;
    --text-3: #5d6579;
    --line: rgba(255, 255, 255, .08);
    --line-2: rgba(255, 255, 255, .14);
    --brand: #818cf8;
    --accent-soft: rgba(129, 140, 248, .14);
    --accent-text: #a5b4fc;
    --accent-glow: 0 8px 26px -8px rgba(139, 92, 246, .75);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px -12px rgba(0, 0, 0, .7);
    --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .9);
    --ring: 0 0 0 3px rgba(129, 140, 248, .25);
    --page-glow: radial-gradient(900px 420px at 85% -120px, rgba(124, 58, 237, .18), transparent 70%),
      radial-gradient(700px 360px at 10% -140px, rgba(37, 99, 235, .18), transparent 70%);
  }
}

/* ---------- Grundlagen ---------- */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 { color: var(--ink); font-weight: 600; margin: 0 0 .6rem; }
h1 { font-size: 1.6rem; line-height: 1.25; letter-spacing: -.02em; }
h2 { font-size: 1rem; line-height: 1.35; letter-spacing: -.005em; }
h3 { font-size: .95rem; }
p { margin: 0 0 .6rem; }
a { color: var(--ink); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.icon { display: inline-flex; flex: none; }
.icon svg { width: 1.15em; height: 1.15em; }

/* ---------- Rahmen: Seitenleiste am PC ---------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 16px 12px 12px;
  background: var(--surface-2);
  border-right: 1px solid var(--line);
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  color: var(--ink);
  text-decoration: none;
}
.side-brand img { width: 30px; height: 30px; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand-text strong { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text small { font-size: 12px; color: var(--text-2); }

nav.main { display: flex; flex-direction: column; gap: 2px; }
.nav-section {
  padding: 16px 10px 6px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
}
nav.main a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
nav.main a .icon svg { width: 18px; height: 18px; color: var(--text-2); }
nav.main a:hover { background: var(--surface-3); color: var(--ink); }
/* Aktiv wie die weiße Pille in einer Pill-Gruppe */
nav.main a.active {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}
nav.main a.active .icon svg { color: var(--ink); }

.side-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 6px 2px;
  border-top: 1px solid var(--line);
}
.side-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 4px;
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
}
.side-profile:hover, .side-profile.active { background: var(--surface-3); }
.side-user .who { flex: 1; min-width: 0; line-height: 1.3; }
.side-user .who strong { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user .who span { font-size: 12px; color: var(--text-2); }

.avatar {
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar.big { width: 72px; height: 72px; font-size: 24px; }
.profile-head { display: flex; align-items: center; gap: 16px; margin: 4px 0 12px; }
.profile-head strong { color: var(--ink); font-size: 16px; }
.photo-preview img { display: block; width: 180px; height: 180px; margin: 4px auto 12px; border-radius: 50%; object-fit: cover; }
.avatar.a0 { background: #fed7aa; color: #7c2d12; }
.avatar.a1 { background: #fbcfe8; color: #831843; }
.avatar.a2 { background: #ddd6fe; color: #4c1d95; }
.avatar.a3 { background: #a7f3d0; color: #064e3b; }

.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.page-title { display: none; }

.page-head { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 32px 4px; }
.page-head h1 { margin: 0; font-size: 26px; }

main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 16px 32px 64px; }

/* Schmale PC-Fenster und Tablets: Seitenleiste nur mit Symbolen */
@media (min-width: 721px) and (max-width: 1100px) {
  :root { --sidebar-w: 68px; }
  .sidebar { padding: 14px 10px 10px; align-items: stretch; }
  .side-brand { justify-content: center; padding: 4px 0 14px; }
  .brand-text, nav.main a > span:not(.icon), .side-user .who { display: none; }
  nav.main a { justify-content: center; padding: 9px 0; }
  .nav-section { font-size: 0; padding: 0; height: 1px; margin: 10px 8px; background: var(--line); }
  .side-user { flex-direction: column; padding: 12px 0 2px; }
  .page-head, main { padding-left: 24px; padding-right: 24px; }
}

/* ---------- Formularelemente ---------- */

button, .btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: background-color .12s, border-color .12s;
}
button:hover, .btn:hover { background: var(--surface-2); }
button:active, .btn:active { background: var(--surface-3); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); font-weight: 600; }
button.primary:hover { background: var(--ink-active); border-color: var(--ink-active); }
button.danger { color: var(--danger); }
button.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
button.ghost:hover { background: var(--surface-3); color: var(--ink); }
button.small, .btn.small { min-height: 30px; padding: 4px 10px; font-size: 13px; }

input, select, textarea {
  font: inherit;
  font-size: 14px;
  width: 100%;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 76px; resize: vertical; }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: var(--ring); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--ink); }
label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }

.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 140px; }
.row.tight > * { flex: 0 0 auto; }
.checkline { display: flex; align-items: center; gap: 8px; }
.checkline label { margin: 0; font-size: 14px; font-weight: 400; color: var(--text); }

/* ---------- Karten, Leisten, Abzeichen ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 16px;
}
.card h2 { margin-bottom: 12px; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1 1 auto; }
.toolbar > strong, .weeknav strong { color: var(--ink); font-weight: 600; font-size: 15px; padding: 0 4px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}
.badge.draft { background: var(--warn-bg); color: var(--warn); }
.badge.published { background: var(--ok-bg); color: var(--ok); }
.badge.alert { background: var(--danger-bg); color: var(--danger); }

.muted { color: var(--text-2); }
.small { font-size: 13px; }
.empty { color: var(--text-2); padding: 40px 16px; text-align: center; }

/* ---------- Dienstplan: Wochenraster ---------- */

.board {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
}
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 900px; }
table.grid th, table.grid td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  padding: 0;
}
table.grid tr > :last-child { border-right: 0; }
table.grid tbody tr:last-child > * { border-bottom: 0; }
/* Kein position:sticky mit Versatz: .board ist wegen overflow-x ein
   eigener Scroll-Container, ein top-Wert würde die Kopfzeile innerhalb
   der Tabelle nach unten schieben statt sie am Fenster zu halten. */
table.grid thead th {
  background: var(--surface-2);
  padding: 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-align: left;
}
table.grid thead th.today { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ink); }
table.grid td.group-cell, table.grid th.group-cell {
  width: 112px;
  padding: 10px 12px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
table.grid td.day { padding: 6px; min-width: 118px; background: var(--surface); }

/* Eine Schicht wie ein Kalendereintrag: heller Farbton, Streifen links */
.chip {
  --chip-bg: var(--g-gray-bg);
  --chip-bar: var(--g-gray);
  --chip-text: var(--g-gray-text);
  --chip-solid: var(--g-gray-solid);
  display: block;
  width: 100%;
  min-height: 0;
  margin-bottom: 4px;
  padding: 6px 8px;
  border: 0;
  border-left: 3px solid var(--chip-bar);
  border-radius: 6px;
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}
.chip:hover { background: var(--chip-bg); filter: brightness(.97); }
.chip:active { background: var(--chip-bg); }
.chip .who { display: block; font-weight: 600; }
.chip .when { display: block; opacity: .8; }
.chip .tag { float: right; margin-left: 4px; font-size: 10.5px; font-weight: 600; opacity: .8; }

.chip.g-blue { --chip-bg: var(--g-blue-bg); --chip-bar: var(--g-blue); --chip-text: var(--g-blue-text); --chip-solid: var(--g-blue-solid); }
.chip.g-green { --chip-bg: var(--g-green-bg); --chip-bar: var(--g-green); --chip-text: var(--g-green-text); --chip-solid: var(--g-green-solid); }
.chip.g-amber { --chip-bg: var(--g-amber-bg); --chip-bar: var(--g-amber); --chip-text: var(--g-amber-text); --chip-solid: var(--g-amber-solid); }
.chip.g-red { --chip-bg: var(--g-red-bg); --chip-bar: var(--g-red); --chip-text: var(--g-red-text); --chip-solid: var(--g-red-solid); }
.chip.g-gray { --chip-bg: var(--g-gray-bg); --chip-bar: var(--g-gray); --chip-text: var(--g-gray-text); --chip-solid: var(--g-gray-solid); }

.chip.open {
  --chip-bg: transparent;
  --chip-text: var(--text-2);
  border: 1px dashed var(--line-2);
}
/* Die eigene Schicht fällt sofort auf: voll eingefärbt */
.chip.mine { --chip-bg: var(--chip-solid); --chip-text: #ffffff; border-left-color: var(--chip-solid); }
.chip.conflict { outline: 2px solid var(--danger); outline-offset: -1px; }
.chip.warned { box-shadow: inset 0 0 0 1.5px var(--warn); }
/* Vorschau: schraffiert, damit sie sich auch aus der Entfernung
   klar von freigegebenen Positionen unterscheidet. */
.chip.preview {
  background-image: repeating-linear-gradient(-45deg,
    rgba(127, 127, 127, .2) 0, rgba(127, 127, 127, .2) 5px, transparent 5px, transparent 11px);
  border: 1px dashed var(--line-2);
}
.chip.preview .tag { background: var(--text-2); color: var(--surface); border-radius: 3px; padding: 0 4px; opacity: 1; }

.addbtn {
  width: 100%;
  min-height: 26px;
  padding: 2px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 400;
}
.addbtn:hover { background: var(--surface-2); border-color: var(--line-2); color: var(--ink); }

/* ---------- Tabellen und Listen ---------- */

table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  text-align: left;
}
table.list td { padding: 10px; border-bottom: 1px solid var(--line); }
table.list tr:last-child td { border-bottom: none; }
.person-cell { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 500; }
.person-cell .avatar { width: 28px; height: 28px; font-size: 11px; }
table.list tr.inactive td { opacity: .5; }

.shift-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.shift-item:last-child { border-bottom: none; }
.shift-date { width: 92px; flex: none; font-size: 13px; font-weight: 500; color: var(--text-2); }
.shift-main { flex: 1 1 200px; min-width: 0; }
.shift-main strong { color: var(--ink); font-weight: 600; }

/* Team als Liste zum Antippen (Handy) */
.person-list { padding: 4px 18px; }
.person-row {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-height: 60px;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: none;
  color: var(--text);
  text-align: left;
}
.person-row:hover, .person-row:active { background: none; }
.person-row:last-child { border-bottom: none; }
.person-row.inactive { opacity: .5; }
.person-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.person-main strong { color: var(--ink); font-weight: 600; }
.person-row .chevron { color: var(--text-3); font-size: 1.5rem; line-height: 1; }

/* ---------- Personalbogen ---------- */

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.pb-list { display: flex; flex-direction: column; }
.pb-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.pb-row:last-child { border-bottom: 0; }
.pb-section {
  margin: 20px 0 6px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.pb-field { display: flex; align-items: center; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pb-field-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pb-field-main strong { color: var(--ink); font-weight: 500; }
.kv { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 6px 14px; margin: 0 0 6px; }
.kv dt { color: var(--text-2); font-size: 13.5px; overflow-wrap: anywhere; }
.kv dd { margin: 0; color: var(--ink); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.kv dd.muted { color: var(--text-3); }
.notice-text { white-space: pre-wrap; color: var(--text); font-size: 14px; line-height: 1.6; }
.pb-preview { max-height: 150px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.pb-details summary { padding: 6px 0; color: var(--ink); font-weight: 500; cursor: pointer; }
.pb-details .notice-text {
  margin: 8px 0 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.pb-confirm { align-items: flex-start; margin-top: 14px; }
.pb-confirm input { margin-top: 3px; }
.pb-confirm label { line-height: 1.5; }
.pb-intro .card-head { margin: 0; align-items: center; }
/* Bewerbungen */
.ap-list { display: flex; flex-direction: column; }
.ap-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.ap-row:last-child { border-bottom: 0; }
.ap-row > .badge { justify-self: start; }
.ap-row.done { opacity: .6; }
.ap-who { display: flex; flex-direction: column; min-width: 0; }
.ap-who > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-contact { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ap-shift { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ap-shift strong { color: var(--ink); font-weight: 600; }
.ap-shift .tag { display: inline-block; margin: 4px 6px 0 0; padding: 1px 8px; border-radius: 99px; font-size: 12px; background: var(--warn-bg); color: var(--warn); }
.multi { display: flex; flex-wrap: wrap; gap: 8px; }
.multi-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  cursor: pointer;
  margin: 0;
}
.multi-option:has(input:checked) { border-color: var(--ink); color: var(--ink); background: var(--accent-bg); }
.multi-option input { margin: 0; }
.login-wrap.apply-wrap { max-width: 600px; margin-top: 4vh; }
.apply-wrap .card + .card { margin-top: 14px; }
.apply-wrap .card h2 { font-size: 17px; }
/* Fängt Formular-Programme ab, für Menschen unsichtbar (auch für Screenreader). */
.ap-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 720px) {
  .ap-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ap-row > .small { grid-column: 1; }
}
/* Unterschrift: weiß wie Papier, auch im dunklen Modus - die Tinte ist dunkel. */
.pb-signature { margin: 16px 0 14px; }
.pb-signature > label { display: block; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
.sig-pad {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  aspect-ratio: 3 / 1;
  background: #fff;
  border: 1px dashed var(--g-gray);
  border-radius: var(--radius);
  touch-action: none;
  cursor: crosshair;
}
.sig-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; max-width: 560px; margin-top: 6px; }
.sig-image {
  display: block;
  width: 100%;
  max-width: 300px;
  height: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.pb-signature .notice { max-width: 560px; }
.pb-hint { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; border-color: var(--ink); }
.btn.primary-link { background: var(--ink); border-color: var(--ink); color: var(--on-ink); font-weight: 600; }
.btn.primary-link:hover { background: var(--ink-active); }

/* Mehrere Bögen, Freigabe, Bedingungen, Dateien, weitere Jobs */
.pb-sheets select { width: auto; min-width: 200px; max-width: 100%; }
.pb-sheet-actions { display: flex; flex-wrap: wrap; gap: 4px; margin: -6px 0 10px; }
button.danger-text { color: var(--danger); }
.pb-row.with-sheet { grid-template-columns: minmax(150px, 1.2fr) 190px 180px minmax(0, 1fr) auto; }
.pb-sheet-select { min-width: 0; }
.pb-row > .badge { justify-self: start; }
.pb-release { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.pb-release > div { flex: 1 1 260px; }
.pb-cond { margin: -4px 0 12px 26px; padding-left: 12px; border-left: 2px solid var(--line); }
.pb-cond-values .checkline { padding: 2px 0; }
.job-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .8fr) auto; gap: 6px; margin-bottom: 6px; }
.file-list { margin: 0 0 8px; padding-left: 18px; }
.file-list li { margin: 4px 0; overflow-wrap: anywhere; }

/* ---------- Leihgaben und Rechte ---------- */

.loan-card { padding-top: 6px; }
.loan-person {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 16px 0 6px;
}
.loan-person:not(:first-child) { border-top: 1px solid var(--line); margin-top: 6px; }
.loan-row, .item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0 10px 42px;
}
.loan-row + .loan-row { border-top: 1px solid var(--line); }
.item-row { grid-template-columns: minmax(0, 1fr) auto; padding-left: 0; border-bottom: 1px solid var(--line); }
.item-row:last-child { border-bottom: 0; }
.loan-toolbar select { width: auto; min-width: 130px; }
.loan-toolbar input[type=search] { width: 260px; max-width: 100%; }
.list-search { width: 260px; max-width: 100%; }
.list-search-row { margin: 0 0 10px; }
.loan-row.closed .loan-main > span:first-child, .item-row.inactive strong { color: var(--text-2); }
.loan-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.loan-main > span:first-child { color: var(--ink); font-weight: 500; }
.loan-actions { display: flex; gap: 6px; justify-content: flex-end; }
.loan-list { margin: 0 0 12px; padding-left: 18px; }
.loan-list li { margin: 4px 0; line-height: 1.5; }
.loan-confirm { margin-bottom: 8px; }
.perm-list .checkline { align-items: flex-start; padding: 8px 0; }
.perm-list .checkline input { margin-top: 3px; }
.perm-list label { display: flex; flex-direction: column; gap: 2px; }
.perm-list label strong { color: var(--ink); font-weight: 500; }

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

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px;
  overflow-y: auto;
  background: rgba(17, 17, 17, .42);
}
.modal {
  width: 100%;
  max-width: 520px;
  padding: 20px 22px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}
.modal header { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.modal header h2 { flex: 1; margin: 0; font-size: 18px; letter-spacing: -.01em; }
.modal header .ghost { width: 32px; min-height: 32px; height: 32px; padding: 0; border-radius: 50%; }
.modal footer { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.modal footer .spacer { flex: 1; }
.modal footer:empty { display: none; }

/* Aufklappmenü für Nebenaktionen */
.menu-wrap { position: relative; display: inline-flex; }
.menu-wrap .caret { font-size: 10px; color: var(--text-2); }
.menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 210px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.menu-pop button {
  justify-content: flex-start;
  min-height: 34px;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  font-weight: 500;
  text-align: left;
}
.menu-pop button:hover { background: var(--surface-3); }

.action-list { display: flex; flex-direction: column; gap: 8px; }
.action-list button { width: 100%; }
.action-list input[type="date"] { width: 100% !important; }

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

body:has(.login-wrap) { background: var(--surface-2); }
.login-wrap { max-width: 400px; margin: 10vh auto 2rem; padding: 0 16px; }
.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.login-brand img { width: 32px; height: 32px; }
.login-wrap .card { padding: 28px; box-shadow: var(--shadow-sm); }
.login-wrap h1 { font-size: 22px; }
.login-wrap form button.primary { width: 100%; margin-top: 4px; }
.login-legal { display: flex; justify-content: center; gap: 16px; margin-top: 20px; font-size: 13px; }
.login-legal a { color: var(--text-2); text-decoration: none; }
.login-legal a:hover { color: var(--ink); }

/* ---------- Hinweise ---------- */

.notice {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13.5px;
}
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.err { background: var(--danger-bg); color: var(--danger); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.info { background: var(--surface-3); color: var(--text); }

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
#toast div {
  max-width: 90vw;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
}
#toast div.err { background: #b91c1c; color: #fff; }

code.pw {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--ink);
  font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 15px;
}

/* Hinweis auf dem Handy: SchichtSnap auf den Startbildschirm legen */
.install-hint { width: 100%; max-width: 1240px; margin: 16px auto 0; padding: 0 32px; }
.install-hint-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 14px;
  border-radius: var(--radius-lg);
  background: var(--surface-3);
  color: var(--text);
  font-size: 14px;
}
.install-hint-box .grow { flex: 1 1 auto; min-width: 0; }
.install-hint-box > :not(.grow) { flex: 0 0 auto; }
.install-hint-box .icon svg { vertical-align: -.2em; }
/* Tarif-Hinweis für Admins: Testphase neutral, Überschreitung bernstein */
.install-hint-box.warn { background: var(--warn-bg); color: var(--warn); }
.install-hint-box.warn .btn { border-color: currentColor; color: inherit; background: transparent; }
/* Einstempeln nur vor Ort */
.geo-note { color: var(--warn); margin-top: 2px; }
.geo-box { margin-top: 8px; }
/* Verlauf einer Schicht */
.history-list { list-style: none; margin: 8px 0 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.history-list li { position: relative; display: flex; flex-direction: column; gap: 1px; padding: 6px 0 8px; font-size: 14px; }
.history-list li::before { content: ""; position: absolute; left: -19px; top: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.history-list li:last-child::before { background: var(--ink); }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--surface-2); border: 1px solid var(--line); }
.stat strong { font-size: 22px; color: var(--ink); letter-spacing: -0.02em; }
.stat.alert strong { color: var(--warn); }
.plan-meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin: 6px 0 4px; }
.plan-meter > i { display: block; height: 100%; border-radius: 99px; background: var(--ink); }
.plan-meter.over > i { background: var(--warn); }

.tabbar { display: none; }
.more-list { display: flex; flex-direction: column; }

/* Plattformverwaltung: schlichte Kopfleiste statt Seitenleiste */
.platform-bar { background: var(--bg); border-bottom: 1px solid var(--line); }
.platform-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1240px;
  min-height: 64px;
  margin: 0 auto;
  padding: 8px 32px;
  padding-top: calc(8px + env(safe-area-inset-top));
}
.platform-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; letter-spacing: -.01em; }
.platform-brand img { width: 28px; height: 28px; }

/* ---------- Handy ----------
   Unter 720px: oben Betrieb und Seitentitel, unten eine Leiste mit den
   wichtigsten Seiten. Die Breite muss zu mobileQuery in core.js passen. */

@media (max-width: 720px) {
  body { font-size: 16px; }

  .shell { display: block; }
  .sidebar, .page-head { display: none; }

  .topbar {
    display: block;
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .topbar-inner { padding: 10px 16px 10px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .brand { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
  .brand img { width: 16px; height: 16px; }
  .page-title { display: block; font-size: 21px; font-weight: 600; color: var(--ink); letter-spacing: -.02em; line-height: 1.3; }

  main { padding: 14px 12px calc(96px + env(safe-area-inset-bottom)); }
  .install-hint { padding: 0 12px; margin-top: 12px; }

  .tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: var(--bg);
    border-top: 1px solid var(--line);
  }
  .tabbar a, .tabbar button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 3px 0 2px;
    border: 0;
    border-radius: 10px;
    background: none;
    color: var(--text-3);
    font-size: 11px;
    font-weight: 500;
    text-decoration: none;
  }
  .tabbar .icon { padding: 2px 14px; border-radius: 999px; }
  .tabbar .icon svg { width: 22px; height: 22px; }
  .tabbar span:not(.icon) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar .active { color: var(--ink); }
  .tabbar .active .icon { background: var(--surface-3); }

  .more-head { display: flex; align-items: center; gap: 12px; padding: 4px 2px 12px; border-bottom: 1px solid var(--line); }
  .more-head strong { display: block; color: var(--ink); }
  .more-list a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 4px;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    font-weight: 500;
    text-decoration: none;
  }
  .more-list a:last-child { border-bottom: 0; }
  .more-list a .icon svg { width: 22px; height: 22px; color: var(--text-2); }
  .more-list a.active { background: var(--surface-3); border-radius: var(--radius); }

  /* Fingergerecht - und ab 16px zoomt das iPhone beim Antippen nicht mehr ein */
  input, select, textarea { font-size: 16px; min-height: 44px; padding: 10px 12px; }
  select { padding-right: 36px; }
  button, .btn { min-height: 44px; padding: 10px 16px; font-size: 15px; }
  button.small, .btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
  input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; min-height: 0; flex: none; }
  .checkline { min-height: 44px; }
  .checkline label { font-size: 15px; }
  label { font-size: 13.5px; }

  .card { padding: 16px; margin-bottom: 12px; }
  h2 { font-size: 16px; }

  /* Dialoge als Blatt von unten, der Inhalt scrollt, die Knöpfe bleiben stehen */
  .overlay { align-items: flex-end; padding: 0; overflow: hidden; }
  .modal {
    max-width: none;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    padding: 16px 16px calc(14px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 18px 18px 0 0;
    animation: sheet-up .2s ease-out;
  }
  .modal > div { overflow-y: auto; min-height: 0; -webkit-overflow-scrolling: touch; }
  .modal footer { flex-wrap: wrap; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
  .modal footer .spacer { display: none; }
  .modal footer button { flex: 1 1 auto; }

  #toast { bottom: calc(88px + env(safe-area-inset-bottom)); width: calc(100% - 32px); }

  /* Tabellen seitlich wischen statt die Seite zu sprengen */
  table.list { display: block; overflow-x: auto; white-space: nowrap; }

  .shift-item { gap: 4px 12px; padding: 12px 0; }
  .shift-date { width: 66px; }
  .shift-main { flex: 1 1 0; }
  .shift-item > button, .shift-item > .badge { flex: none; }

  /* Dienstplan als Tagesliste */
  .toolbar-mobile { flex-direction: column; align-items: stretch; gap: 10px; }
  .toolbar-mobile .weeknav { display: flex; align-items: center; gap: 8px; }
  .toolbar-mobile .weeknav strong { flex: 1; text-align: center; font-size: 15px; }
  .toolbar-mobile .weeknav button { width: 44px; padding: 0; font-size: 22px; line-height: 1; border-radius: 50%; }
  .toolbar-mobile .weeknav .weeklabel {
    flex: 1;
    width: auto;
    gap: 6px;
    border: 0;
    border-radius: var(--radius);
    background: none;
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
  }
  .toolbar-mobile .weeknav .weeklabel .caret { font-size: 11px; color: var(--text-2); }
  .toolbar-mobile .toolbar-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
  .toolbar-mobile .toolbar-row .spacer { flex: 1; }

  .daystrip { display: flex; gap: 6px; margin-bottom: 14px; }
  .daypill {
    flex: 1 1 0;
    min-width: 0;
    min-height: 54px;
    flex-direction: column;
    gap: 1px;
    padding: 4px 0;
    border-color: var(--line);
    border-radius: var(--radius-lg);
    color: var(--text-2);
    font-size: 11.5px;
  }
  .daypill strong { color: var(--ink); font-size: 16px; font-weight: 600; }
  .daypill.today { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
  .daypill.today strong { color: var(--on-ink); }
  .daypill.empty-day { opacity: .5; }

  .agenda-day { scroll-margin-top: 96px; }
  .agenda-day.today { border-color: var(--ink); }
  .agenda-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
  .agenda-head strong { color: var(--ink); font-weight: 600; }
  .agenda-day.today .agenda-head .badge { background: var(--ink); color: var(--on-ink); }
  .agenda-group {
    margin: 12px 0 6px;
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-3);
  }
  .agenda .chip { margin-bottom: 6px; padding: 10px 12px; border-radius: 8px; font-size: 14.5px; }
  .agenda .chip .who, .agenda .chip .when { display: inline; }
  .agenda .chip .when::before { content: " · "; }
  .agenda .addbtn { min-height: 40px; margin-top: 6px; font-size: 14px; }

  /* Anmeldung: nicht am Rand kleben */
  .login-wrap { margin-top: calc(7vh + env(safe-area-inset-top)); }
  .login-wrap .card { padding: 22px 18px; }
  .login-wrap p.small a { display: inline-block; padding: 8px 0; }

  .person-list { padding: 2px 16px; }

  .pb-row { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; }
  .pb-row .pb-date { grid-column: 1; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dt { margin-top: 8px; }

  .pb-row.with-sheet { grid-template-columns: minmax(0, 1fr) auto; }
  .pb-row.with-sheet .pb-sheet-select { grid-column: 1 / -1; order: 5; }
  .job-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .job-row input:first-child { grid-column: 1 / -1; }
  .pb-cond { margin-left: 8px; }

  .loan-row { grid-template-columns: minmax(0, 1fr) auto; padding-left: 0; }
  .loan-toolbar input[type=search] { flex: 1 1 140px; width: auto; }
  .toolbar .list-search, .list-search-row .list-search { flex: 1 1 100%; width: 100%; }
  .loan-row .loan-actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* Nur Bewegung, keine Transparenz: Hält ein Gerät die Animation an, bleibt
   das Blatt trotzdem deckend. */
@keyframes sheet-up {
  from { transform: translateY(40px); }
  to { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .modal { animation: none; }
}

/* ---------- Zwei-Faktor-Anmeldung ---------- */

.tf-steps { margin: 0 0 14px; padding-left: 20px; line-height: 1.55; }
.tf-steps li { margin-bottom: 10px; }
.tf-secret { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.tf-secret code {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 14px;
  letter-spacing: .04em;
  overflow-wrap: anywhere;
}
.tf-code { font-size: 20px; letter-spacing: .2em; text-align: center; max-width: 220px; }
.tf-recovery { columns: 2; margin: 0 0 14px; padding-left: 24px; }
.tf-recovery li { margin: 4px 0; }
.tf-recovery code { font-size: 15px; }

/* ---------- Umschalter (Pill-Gruppe), z. B. Profil → Darstellung ---------- */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface-3); }
.seg button { min-height: 32px; padding: 6px 14px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); font-weight: 500; }
.seg button:hover { background: transparent; color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- Stil „Modern“: Bausteine ---------- */
[data-style="modern"] body { background-image: var(--page-glow); background-repeat: no-repeat; }
[data-style="modern"] .sidebar { background: color-mix(in srgb, var(--surface) 72%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
[data-style="modern"] nav.main a.active { background: var(--accent-soft); border-color: transparent; box-shadow: none; color: var(--accent-text); }
[data-style="modern"] nav.main a.active .icon svg { color: var(--accent-text); }
[data-style="modern"] button.primary,
[data-style="modern"] .btn.primary-link { background: var(--accent-grad); border-color: transparent; color: #ffffff; box-shadow: var(--accent-glow); }
[data-style="modern"] button.primary:hover,
[data-style="modern"] .btn.primary-link:hover { background: var(--accent-grad); border-color: transparent; filter: brightness(1.08); }
[data-style="modern"] .card { box-shadow: var(--shadow-sm); }
[data-style="modern"] .overlay { background: rgba(10, 12, 20, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
[data-style="modern"] input:focus, [data-style="modern"] select:focus, [data-style="modern"] textarea:focus { border-color: var(--brand); box-shadow: var(--ring); }
[data-style="modern"] .seg button.on { background: var(--accent-grad); color: #ffffff; box-shadow: var(--accent-glow); }
[data-style="modern"] .page-head h1 { letter-spacing: -.03em; }
[data-style="modern"] nav.main a.active { position: relative; }
[data-style="modern"] nav.main a.active::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-grad); }
[data-style="modern"] table.grid thead th.today { color: var(--accent-text); box-shadow: inset 0 -2px 0 var(--brand); }
[data-style="modern"] .daypill.today { background: var(--accent-grad); border-color: transparent; color: #ffffff; box-shadow: var(--accent-glow); }
[data-style="modern"] .daypill.today strong { color: #ffffff; }
[data-style="modern"] .agenda-day.today { border-color: var(--brand); }
[data-style="modern"] .agenda-day.today .agenda-head .badge { background: var(--accent-grad); color: #ffffff; }
@media (max-width: 720px) {
  [data-style="modern"] .topbar,
  [data-style="modern"] .tabbar { background: color-mix(in srgb, var(--bg) 82%, transparent); -webkit-backdrop-filter: saturate(160%) blur(16px); backdrop-filter: saturate(160%) blur(16px); }
  [data-style="modern"] .tabbar .active { color: var(--accent-text); }
  [data-style="modern"] .tabbar .active .icon { background: var(--accent-soft); }
}

/* ---------- Stil „Modern“: Schicht-Kärtchen ----------
   Kräftiger als „Schlicht“: Farbverlauf je Gruppe, Streifen als Verlauf,
   leichtes Leuchten; die eigene Schicht voll im Verlauf. Offene Positionen,
   Vorschau-Schraffur und Warnungen bleiben wie gehabt erkennbar. */
[data-style="modern"] .chip { --m-a: #f1f5f9; --m-b: #e2e8f0; --m-text: #1e293b; --m-bar1: #94a3b8; --m-bar2: #64748b; --m-glow: rgba(71, 85, 105, .45); }
[data-style="modern"] .chip.g-blue { --m-a: #dbeafe; --m-b: #e0e7ff; --m-text: #1e3a8a; --m-bar1: #3b82f6; --m-bar2: #6366f1; --m-glow: rgba(79, 70, 229, .55); }
[data-style="modern"] .chip.g-green { --m-a: #d1fae5; --m-b: #ccfbf1; --m-text: #064e3b; --m-bar1: #10b981; --m-bar2: #14b8a6; --m-glow: rgba(13, 148, 136, .55); }
[data-style="modern"] .chip.g-amber { --m-a: #fef3c7; --m-b: #ffedd5; --m-text: #78350f; --m-bar1: #f59e0b; --m-bar2: #f97316; --m-glow: rgba(234, 88, 12, .5); }
[data-style="modern"] .chip.g-red { --m-a: #fee2e2; --m-b: #fce7f3; --m-text: #7f1d1d; --m-bar1: #ef4444; --m-bar2: #ec4899; --m-glow: rgba(219, 39, 119, .5); }
[data-style="modern"] .chip.g-gray { --m-a: #f1f5f9; --m-b: #e2e8f0; --m-text: #1e293b; --m-bar1: #94a3b8; --m-bar2: #64748b; --m-glow: rgba(71, 85, 105, .45); }
:root[data-style="modern"][data-theme="dark"] .chip { --m-a: rgba(148, 163, 184, .22); --m-b: rgba(100, 116, 139, .18); --m-text: #e2e8f0; }
:root[data-style="modern"][data-theme="dark"] .chip.g-blue { --m-a: rgba(59, 130, 246, .30); --m-b: rgba(99, 102, 241, .22); --m-text: #dbeafe; }
:root[data-style="modern"][data-theme="dark"] .chip.g-green { --m-a: rgba(16, 185, 129, .28); --m-b: rgba(20, 184, 166, .20); --m-text: #d1fae5; }
:root[data-style="modern"][data-theme="dark"] .chip.g-amber { --m-a: rgba(245, 158, 11, .28); --m-b: rgba(249, 115, 22, .20); --m-text: #fef3c7; }
:root[data-style="modern"][data-theme="dark"] .chip.g-red { --m-a: rgba(239, 68, 68, .28); --m-b: rgba(236, 72, 153, .20); --m-text: #fee2e2; }
:root[data-style="modern"][data-theme="dark"] .chip.g-gray { --m-a: rgba(148, 163, 184, .22); --m-b: rgba(100, 116, 139, .18); --m-text: #e2e8f0; }
@media (prefers-color-scheme: dark) {
  :root[data-style="modern"]:not([data-theme="light"]) .chip { --m-a: rgba(148, 163, 184, .22); --m-b: rgba(100, 116, 139, .18); --m-text: #e2e8f0; }
  :root[data-style="modern"]:not([data-theme="light"]) .chip.g-blue { --m-a: rgba(59, 130, 246, .30); --m-b: rgba(99, 102, 241, .22); --m-text: #dbeafe; }
  :root[data-style="modern"]:not([data-theme="light"]) .chip.g-green { --m-a: rgba(16, 185, 129, .28); --m-b: rgba(20, 184, 166, .20); --m-text: #d1fae5; }
  :root[data-style="modern"]:not([data-theme="light"]) .chip.g-amber { --m-a: rgba(245, 158, 11, .28); --m-b: rgba(249, 115, 22, .20); --m-text: #fef3c7; }
  :root[data-style="modern"]:not([data-theme="light"]) .chip.g-red { --m-a: rgba(239, 68, 68, .28); --m-b: rgba(236, 72, 153, .20); --m-text: #fee2e2; }
  :root[data-style="modern"]:not([data-theme="light"]) .chip.g-gray { --m-a: rgba(148, 163, 184, .22); --m-b: rgba(100, 116, 139, .18); --m-text: #e2e8f0; }
}
[data-style="modern"] .chip:not(.open):not(.preview) {
  border-left: 0;
  padding-left: 11px;
  border-radius: 9px;
  color: var(--m-text);
  background:
    linear-gradient(180deg, var(--m-bar1), var(--m-bar2)) left / 3px 100% no-repeat,
    linear-gradient(135deg, var(--m-a), var(--m-b));
  box-shadow: 0 6px 14px -8px var(--m-glow);
}
[data-style="modern"] .chip:not(.open):not(.preview):hover { filter: brightness(1.04) saturate(1.15); }
[data-style="modern"] .chip.mine:not(.open):not(.preview) {
  color: #ffffff;
  background: linear-gradient(135deg, var(--m-bar1), var(--m-bar2));
  box-shadow: 0 8px 18px -8px var(--m-glow);
}
[data-style="modern"] .chip.warned:not(.open):not(.preview) { box-shadow: inset 0 0 0 1.5px var(--warn), 0 6px 14px -8px var(--m-glow); }
[data-style="modern"] .chip.open { border-radius: 9px; }
[data-style="modern"] .chip.preview { border-radius: 9px; }

/* ---------- Einsätze (jobs.js) ---------- */
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.row3 { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 0 12px; }
.badge.info { background: var(--g-blue-bg); color: var(--g-blue-text); }
.modal.modal-wide { max-width: 760px; }
.job-day { margin: 22px 2px 10px; font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--text-2); }
.job-day:first-child { margin-top: 4px; }
.job-card {
  display: grid; grid-template-columns: 74px minmax(0, 1fr) auto 14px; align-items: center; gap: 14px;
  width: 100%; min-height: 0; margin-bottom: 10px; padding: 14px 16px;
  text-align: left; font-weight: 400; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.job-card:hover { background: var(--surface); border-color: var(--line-2); }
.job-card.cancelled { opacity: .6; }
.job-card.cancelled .job-title strong { text-decoration: line-through; }
.job-time { display: flex; flex-direction: column; gap: 2px; }
.job-time strong { color: var(--ink); font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.job-time span { color: var(--text-2); font-size: 12.5px; }
.job-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.job-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.job-title strong { color: var(--ink); font-size: 15.5px; }
.job-roles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.job-pill { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--surface-3); color: var(--text); white-space: nowrap; }
.job-pill.full { background: var(--ok-bg); color: var(--ok); }
.job-pill.short { background: var(--warn-bg); color: var(--warn); }
.job-pill.info { background: var(--g-blue-bg); color: var(--g-blue-text); }
.job-pill.alert { background: var(--danger-bg); color: var(--danger); }
.job-count { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.job-card .chevron { color: var(--text-3); font-size: 22px; }
.empty-card { text-align: center; padding: 36px 22px; }
.empty-card p { max-width: 460px; margin: 0 auto 16px; }

.job-head-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.job-head-title { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.job-when { margin: 6px 0 14px; color: var(--ink); font-size: 16px; font-weight: 600; }
.job-role-block { padding: 12px 0; border-top: 1px solid var(--line); }
.job-role-block:first-of-type { border-top: 0; }
.job-role-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.job-role-head .spacer { flex: 1; }
.job-staff { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.job-person { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.job-person.applied { border-style: dashed; }
.job-person-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.job-person-main > span:first-child { color: var(--ink); font-weight: 500; }
.job-slot { min-height: 44px; border: 1px dashed var(--line-2); background: transparent; color: var(--text-2); font-size: 13px; justify-content: flex-start; }
.job-slot:hover { color: var(--ink); background: var(--surface-2); }
.job-candidates { display: flex; flex-direction: column; gap: 8px; max-height: 55vh; overflow-y: auto; }
.job-eq { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.job-eq:first-of-type { border-top: 0; }
.job-eq.inactive { opacity: .55; }
.job-eq-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.job-eq-main strong { color: var(--ink); font-weight: 550; }
.job-pack { display: flex; gap: 14px; flex-wrap: wrap; }
.job-pack .checkline { margin: 0; font-size: 13.5px; }
.job-role-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.job-role-row { display: grid; grid-template-columns: 1.3fr 1fr 70px 1.3fr 32px; gap: 8px; align-items: center; }
.job-role-row.head { margin-bottom: -2px; }
.job-mine.focus { border-color: var(--brand); box-shadow: var(--ring); }
.job-team { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; }
.job-team-row { display: flex; flex-direction: column; gap: 6px; }
.job-team-people { display: flex; flex-wrap: wrap; gap: 8px; }
.job-team-person { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 999px; background: var(--surface-3); font-size: 13px; color: var(--ink); }
.job-team-person .avatar { width: 24px; height: 24px; font-size: 10px; }
.job-team-person.me { background: var(--g-blue-bg); color: var(--g-blue-text); font-weight: 600; }
.job-open-title { color: var(--ink); font-size: 16px; }
.job-head .kv, .job-mine .kv { grid-template-columns: 150px minmax(0, 1fr); }
.job-person.applied { flex-wrap: wrap; }
.job-person.applied .job-actions { flex-basis: 100%; justify-content: flex-end; }
.job-rel { margin: 0 0 2px; color: var(--brand); font-size: 13px; font-weight: 650; letter-spacing: .01em; }
[data-style="modern"] .job-card { box-shadow: var(--shadow-sm); }
[data-style="modern"] .job-card:hover { border-color: var(--brand); }
@media (max-width: 720px) {
  .row2, .row3 { grid-template-columns: 1fr; }
  .job-card { grid-template-columns: 58px minmax(0, 1fr) 12px; gap: 10px; padding: 12px; }
  .job-card .job-count { display: none; }
  .job-time strong { font-size: 15px; }
  .job-staff { grid-template-columns: 1fr; }
  .job-role-row { grid-template-columns: 1fr 1fr; }
  .job-role-row.head { display: none; }
  .job-eq { flex-direction: column; align-items: flex-start; }
  .job-head .kv, .job-mine .kv { grid-template-columns: 1fr; }
  .job-toolbar .job-back { flex-basis: 100%; justify-content: flex-start; padding-left: 2px; }
  .job-toolbar .spacer { display: none; }
}
