/* =====================================================================
   Personaleinsatzplanung – Gestaltung
   Breiten: Handy < 760 px · Tablet 760–1099 px · PC ≥ 1100 px (Seitenleiste)
   ===================================================================== */
:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1d2733;
  --muted: #5f6f80;
  --line: #dde3ea;
  --primary: #1f6f8b;
  --primary-ink: #ffffff;
  --ok: #2a7149;
  --ok-bg: #e7f5ec;
  --warn: #875910;
  --warn-bg: #fdf3e1;
  --bad: #b83227;
  --bad-bg: #fbe9e7;
  --full-bg: #eef1f5;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --sidebar: 248px;
  --bottomnav: 64px;
  --touch: 44px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161c; --card: #1a2129; --text: #e6ebf0; --muted: #9aa8b6; --line: #2c3742;
    --primary: #4fb3d4; --primary-ink: #0d1a20;
    --ok: #5cc28a; --ok-bg: #173226; --warn: #e2b05a; --warn-bg: #3a2d14; --bad: #f07b6e; --bad-bg: #3d1d1a; --full-bg: #222b35;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

/* ---------- Grundlagen ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); -webkit-tap-highlight-color: transparent; }
h1 { font-size: 1.45rem; margin: 0 0 .5rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; line-height: 1.3; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.error { color: var(--bad); min-height: 1.2em; margin: .25rem 0 0; }
.inactive { opacity: .55; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }

/* ---------- Formulare ---------- */
label { display: grid; gap: .3rem; font-size: .9rem; font-weight: 500; }
input, select, textarea { font: inherit; font-weight: 400; padding: .5rem .6rem; min-height: 40px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--text); width: 100%; max-width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
input[type="number"] { width: 6.5em; }
input[type="checkbox"] { width: 1.15em; height: 1.15em; min-height: 0; accent-color: var(--primary); margin: .15em 0 0; }
input[type="color"] { width: 4em; height: 2.6em; padding: 2px; }
textarea { resize: vertical; }
label.check { display: flex; gap: .55rem; align-items: flex-start; font-weight: 400; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .9rem .9rem; margin: 0 0 .9rem; min-width: 0; }
legend { font-weight: 600; font-size: .9rem; padding: 0 .35rem; }

button { font: inherit; font-weight: 600; cursor: pointer; padding: .5rem .95rem; min-height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--primary); background: var(--primary); color: var(--primary-ink); display: inline-flex; align-items: center; justify-content: center; gap: .4rem; transition: filter .15s, background .15s; }
button:hover { filter: brightness(1.06); }
button:active { filter: brightness(.95); }
button.ghost { background: transparent; color: var(--primary); }
button.ghost:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); filter: none; }
button.danger { border-color: var(--bad); background: transparent; color: var(--bad); }
button.danger-solid { border-color: var(--bad); background: var(--bad); color: #fff; }
button.tiny { padding: .15rem .55rem; min-height: 30px; font-size: .82rem; }
button:disabled { opacity: .5; cursor: not-allowed; }

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .75rem; }
.toolbar .spacer { flex: 1; }
.toolbar select, .toolbar input:not([type="checkbox"]) { width: auto; min-width: 180px; max-width: 100%; }
.toolbar label { grid-auto-flow: column; align-items: center; gap: .5rem; }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; }
.row > label { min-width: 150px; flex: 1 1 180px; }
.row > label.check { flex: 0 0 auto; min-width: 0; }
.row > label:has(input[type="number"]) { flex: 0 1 140px; min-width: 110px; }
.row > label:has(input[type="number"]) input { width: 100%; }
.filters label { min-width: 170px; }

/* ---------- Karten, Kennzahlen, Badges ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; margin-bottom: 1rem; box-shadow: var(--shadow); min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 1rem; margin-bottom: 1rem; }
.grid-2 > .card { margin-bottom: 0; }
.stat { font-size: 1.6rem; font-weight: 700; line-height: 1.2; margin: .15rem 0 .4rem; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badges { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .3rem; }
.progress { height: .6rem; background: var(--line); border-radius: 999px; overflow: hidden; margin: .25rem 0 .4rem; }
.progress > div { height: 100%; background: var(--primary); border-radius: 999px; }
.warn-card { border-left: 4px solid var(--bad); }
.legend { display: flex; gap: .9rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-bottom: .5rem; }
.legend span::before { content: ""; display: inline-block; width: .8em; height: .8em; border-radius: 3px; margin-right: .35em; vertical-align: -1px; }
.legend .l-bad::before { background: var(--bad); }
.legend .l-ok::before { background: var(--ok); }
.legend .l-full::before { background: var(--muted); }
.legend .l-covered::before { background: var(--warn); }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: .5rem .55rem; text-align: left; vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { display: flex; gap: .3rem; flex-wrap: wrap; }
tr.clickable { cursor: pointer; }

/* Tabellen als Karten: auf dem Handy immer, auf dem Tablet wenn sie nicht in die Breite passen,
   und für einzelne Datensätze (z. B. eigenes Stundenkonto) als Kachelraster */
table.as-cards thead { display: none; }
table.as-cards, table.as-cards tbody, table.as-cards tr, table.as-cards td { display: block; width: 100%; }
table.as-cards tr { border: 1px solid var(--line); border-radius: var(--radius); padding: .45rem .75rem; margin-bottom: .6rem; background: var(--card); }
table.as-cards td { border: 0; padding: .35rem 0 .35rem 42%; position: relative; text-align: right !important; min-height: 1.9em; }
table.as-cards td::before { content: attr(data-label); position: absolute; left: 0; top: .4rem; width: 40%; text-align: left; color: var(--muted); font-size: .8rem; font-weight: 500; }
table.as-cards td:not([data-label]), table.as-cards td[data-label=""] { padding-left: 0; }
table.as-cards td:not([data-label])::before, table.as-cards td[data-label=""]::before { display: none; }
table.as-cards td.actions { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: .4rem; padding-top: .55rem; }
table.as-cards td .person, table.as-cards td .badges { justify-content: flex-end; }
table.as-cards ul.files li { justify-content: flex-end; }
table.as-cards td input[type="number"] { width: 5.5em; display: inline-block; }
.table-wrap:has(> table.as-cards) { overflow: visible; }
@media (min-width: 760px) {
  /* mehrere Karten nebeneinander */
  table.as-cards tbody { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: .75rem; }
  table.as-cards tr { margin: 0; }
  /* ein einzelner Datensatz als Kachelraster */
  table.as-cards.single tbody { display: block; }
  table.as-cards.single tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; padding: .75rem; }
  table.as-cards.single td { padding: 1.35rem .6rem .45rem; text-align: left !important; background: var(--bg); border-radius: var(--radius-sm); font-size: 1.05rem; font-weight: 600; }
  table.as-cards.single td::before { top: .35rem; left: .6rem; width: auto; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; }
}
/* breite Auswertung: Namensspalte bleibt beim seitlichen Schieben stehen */
table.sticky-first th:first-child, table.sticky-first td:first-child { position: sticky; left: 0; background: var(--card); z-index: 1; box-shadow: 1px 0 0 var(--line); }
tr.clickable:hover td { background: color-mix(in srgb, var(--primary) 6%, transparent); }

/* ---------- Kopf, Navigation ---------- */
#topbar { display: flex; align-items: center; gap: .75rem; padding: .55rem 1rem; padding-top: calc(.55rem + env(safe-area-inset-top)); background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.brand { font-weight: 700; display: flex; align-items: center; gap: .55rem; min-width: 0; }
.brand-mark { display: flex; align-items: center; flex: 0 0 auto; }
.brand-logo { height: 32px; max-width: 120px; object-fit: contain; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-sub { font-size: .75rem; font-weight: 500; color: var(--muted); }
.logo { color: var(--primary); font-size: 1.4rem; line-height: 1; }
.who { display: flex; align-items: center; gap: .5rem; font-size: .9rem; margin-left: auto; min-width: 0; }
.who #who { display: inline-flex; min-width: 0; }
.who #who .who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#logout .icon { display: none; }
.bell { position: relative; min-width: 40px; padding: .35rem; }
.bell .tab-badge { position: absolute; top: 2px; right: 0; }
.notif-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; max-height: 60vh; overflow-y: auto; }
.notif-item { display: grid; gap: .1rem; width: 100%; text-align: left; justify-items: start; background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 400; padding: .55rem .7rem; }
.notif-list li.unread .notif-item { border-left: 4px solid var(--primary); background: color-mix(in srgb, var(--primary) 6%, transparent); }
.notif-item:hover { filter: none; background: color-mix(in srgb, var(--primary) 8%, transparent); }

.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group + .nav-group { margin-top: .9rem; }
.nav-group-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: .2rem .7rem .3rem; }
.nav-item { justify-content: flex-start; width: 100%; background: transparent; color: var(--text); border: 0; font-weight: 500; padding: .5rem .7rem; min-height: 42px; border-radius: 8px; gap: .65rem; text-align: left; }
.nav-item:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); filter: none; }
.nav-item.active { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); font-weight: 700; }
.nav-item .icon { flex: 0 0 auto; }
.nav-item .label { flex: 1; }
.tab-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.35em; height: 1.35em; padding: 0 .35em; border-radius: 999px; background: var(--bad); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1; }
.icon { width: 20px; height: 20px; display: inline-block; }
.icon svg { width: 100%; height: 100%; display: block; }

#bottomnav { display: none; }
.nav-backdrop { display: none; }

main { padding: 1.1rem; max-width: 1500px; margin: 0 auto; }

/* PC: Seitenleiste */
@media (min-width: 1100px) {
  body.app #topbar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); flex-direction: column; align-items: stretch; gap: 1rem; padding: 1rem .75rem; border-bottom: 0; border-right: 1px solid var(--line); overflow-y: auto; }
  body.app .brand { padding: 0 .35rem; }
  body.app #tabs { flex: 1; }
  body.app .who { margin: 0; flex-direction: column; align-items: stretch; gap: .5rem; padding-top: .75rem; border-top: 1px solid var(--line); }
  body.app .who #who { font-size: .85rem; padding: 0 .35rem; }
  body.app main { margin-left: var(--sidebar); max-width: none; padding: 1.5rem 2rem; }
  body.app main > * { max-width: 1400px; }
}

/* Handy und Tablet: kompakte Kopfzeile, Menüleiste unten, Menü als Einblendung */
@media (max-width: 1099.98px) {
  body.app { padding-bottom: calc(var(--bottomnav) + env(safe-area-inset-bottom)); }
  body.app #tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--card); border-radius: 18px 18px 0 0; box-shadow: var(--shadow-lg);
    max-height: 82vh; overflow-y: auto; padding: .5rem .9rem calc(var(--bottomnav) + 1rem + env(safe-area-inset-bottom)); transform: translateY(105%); transition: transform .22s ease; visibility: hidden; }
  body.app #tabs::before { content: ""; display: block; width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: .2rem auto .8rem; }
  body.app.nav-open #tabs { transform: none; visibility: visible; }
  body.app.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(10, 15, 20, .45); }
  /* Kopfzeile (enthält das Menü) beim Aufklappen über die Abdunkelung heben */
  body.app.nav-open #topbar { z-index: 55; }
  body.app #tabs .nav-group { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; }
  body.app #tabs .nav-group-title { grid-column: 1 / -1; }
  body.app #bottomnav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    height: calc(var(--bottomnav) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--card); border-top: 1px solid var(--line); }
  #bottomnav button { flex-direction: column; gap: 2px; background: transparent; color: var(--muted); border: 0; border-radius: 0; font-size: .7rem; font-weight: 600; padding: .35rem .2rem; min-height: var(--bottomnav); position: relative; }
  #bottomnav button.active { color: var(--primary); }
  #bottomnav button.active::before { content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; border-radius: 0 0 3px 3px; background: var(--primary); }
  #bottomnav .icon { width: 24px; height: 24px; }
  #bottomnav .tab-badge { position: absolute; top: 6px; left: calc(50% + 6px); }
  #bottomnav .bn-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #toast { bottom: calc(var(--bottomnav) + .75rem + env(safe-area-inset-bottom)); }
}

/* ---------- Anmeldung ---------- */
.login { max-width: 400px; margin: 10vh auto; border-top: 5px solid var(--primary); }
.login form { display: grid; gap: .8rem; margin-top: 1rem; }
.login details { margin: .5rem 0; }
.login-brand { text-align: center; margin-bottom: .5rem; }
.login-brand h1 { font-size: 1.5rem; margin: .5rem 0 .15rem; }
.login-sub { margin: 0; color: var(--primary); font-weight: 600; letter-spacing: .02em; }
.login-logo { display: flex; justify-content: center; }
.login-logo-img { max-height: 72px; max-width: 240px; object-fit: contain; }
.login-logo-icon { font-size: 2.6rem; color: var(--primary); line-height: 1; }
.login-foot { text-align: center; margin: .75rem 0 0; }
.logo-preview { padding: .75rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); display: inline-block; margin-bottom: .5rem; }
.code-input { font-size: 1.4rem; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; }
.steps { padding-left: 1.2rem; display: grid; gap: .75rem; }
.button-link { display: block; text-align: center; margin: .6rem 0 .4rem; padding: .75rem 1rem; border-radius: var(--radius); background: var(--primary); color: var(--primary-ink); font-weight: 600; text-decoration: none; font-size: 1.05rem; }
.key-row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.qr { margin: .5rem 0; }
.qr img { background: #fff; padding: 8px; border-radius: var(--radius-sm); display: block; max-width: 100%; height: auto; }
.secret { display: inline-block; padding: .3rem .5rem; background: var(--bg); border-radius: 4px; font-size: .95rem; word-break: break-all; }
.codes { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem; font-size: 1.05rem; columns: 2; line-height: 1.8; }

/* ---------- Dienstplan (Woche) ---------- */
.plan-scroll { overflow: auto; max-height: calc(100vh - 220px); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.plan { min-width: 960px; table-layout: fixed; border-collapse: separate; border-spacing: 0; }
.plan th, .plan td { border-bottom: 1px solid var(--line); }
.plan thead th { position: sticky; top: 0; z-index: 3; background: var(--card); }
.plan th:first-child, .plan td.rowhead { position: sticky; left: 0; z-index: 2; background: var(--card); border-right: 1px solid var(--line); }
.plan thead th:first-child { z-index: 4; }
.plan th.day { text-align: center; }
.plan th.day.weekend, .plan td.weekend { background-color: color-mix(in srgb, var(--primary) 5%, var(--card)); }
.plan th.day.holiday { color: var(--bad); }
.plan th.day.today { box-shadow: inset 0 -3px 0 var(--primary); }
.plan td.rowhead { width: 150px; font-weight: 600; }
.plan td.rowhead .time { font-weight: 400; color: var(--muted); font-size: .8rem; }
.plan .unit-row td { background: var(--bg); font-weight: 700; padding-top: .8rem; position: sticky; left: 0; }
.plan .building-row td { background: color-mix(in srgb, var(--primary) 12%, var(--card)); color: var(--primary); font-weight: 700; text-transform: uppercase; font-size: .78rem; letter-spacing: .05em; }
.chip { display: inline-block; min-width: 1.7em; text-align: center; padding: 0 .3em; border-radius: 4px; color: #fff; font-size: .75rem; font-weight: 700; margin-right: .35em; }
.cell { border-radius: var(--radius-sm); padding: .4rem; min-height: 4.2rem; display: flex; flex-direction: column; gap: .3rem; border-left: 4px solid transparent; font-size: .85rem; }
.cell.bad { background: var(--bad-bg); border-left-color: var(--bad); }
.cell.ok { background: var(--ok-bg); border-left-color: var(--ok); }
.cell.full { background: var(--full-bg); border-left-color: var(--muted); }
.cell.covered { background: var(--warn-bg); border-left-color: var(--warn); border-left-style: dashed; }
.cell .verbund-info { font-size: .75rem; color: var(--muted); }
.swap-mark { color: var(--warn); font-weight: 700; margin-left: .2rem; }
.cell .verbund-info.ok { color: var(--ok); }
.cell li .li-actions { display: inline-flex; gap: .2rem; flex: 0 0 auto; }
.cell .person-btn { display: inline-flex; align-items: center; gap: .3rem; background: transparent; border: 0; color: inherit; font: inherit; font-weight: inherit;
  padding: .15rem .25rem; margin: 0 -.25rem; min-height: 32px; border-radius: 5px; text-align: left; min-width: 0; max-width: 100%; }
.cell .person-btn:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); filter: none; }
.cell .person-btn > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.verbund-tag { display: inline-block; margin-left: .5rem; font-size: .72rem; font-weight: 600; color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, transparent); border-radius: 999px; padding: .05rem .5rem; vertical-align: middle; }
.cell.none { color: var(--muted); font-size: .8rem; justify-content: center; align-items: center; }
.cell .count { font-size: .75rem; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: .25rem; }
.cell ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .15rem; }
.cell li { display: flex; justify-content: space-between; align-items: center; gap: .25rem; min-width: 0; }
.cell li .person { min-width: 0; }
.cell li .person > :last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell li.me { font-weight: 700; }
.cell .note { font-size: .75rem; color: var(--warn); }
.cell .missing { font-size: .75rem; color: var(--bad); font-weight: 600; }
.cell select { font-size: .8rem; padding: .2rem; min-height: 32px; }
.absent-info { color: var(--warn); font-weight: 600; text-transform: none; letter-spacing: 0; }

/* Dienstplan (Tag, Handy) */
.phone-nav { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.phone-nav strong { flex: 1; text-align: center; }
.phone-nav button { min-width: var(--touch); min-height: var(--touch); }
.phone-plan > select { margin-bottom: .6rem; }
.day-chips { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; margin-bottom: .9rem; }
.day-chip { display: flex; flex-direction: column; align-items: center; padding: .35rem 0; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); position: relative; min-height: 54px; font-weight: 500; gap: 0; }
.day-chip .wd { font-size: .7rem; color: var(--muted); }
.day-chip .dn { font-size: 1.1rem; font-weight: 700; }
.day-chip.today { border-color: var(--primary); }
.day-chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.day-chip.active .wd { color: inherit; }
.day-chip.holiday .dn { color: var(--bad); }
.day-chip.active.holiday .dn { color: inherit; }
.day-chip .dot { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; }
.dot.mine { background: var(--ok); }
.dot.gap { background: var(--bad); }
.phone-day h2 { margin-bottom: .25rem; }
.holiday-text { color: var(--bad); }
.phone-plan section h3 { margin: 1.1rem 0 .45rem; display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.phone-plan section h3 .muted { font-size: .8rem; font-weight: 500; }
.phone-shift { margin-bottom: .7rem; }
.phone-shift-head { display: flex; align-items: center; gap: .4rem; margin-bottom: .3rem; }
.phone-shift-head .muted { margin-left: auto; }
.phone-shift .cell { min-height: 0; font-size: .95rem; padding: .55rem .6rem; }
.phone-shift .cell button { min-height: var(--touch); font-size: .95rem; }
.phone-shift .cell button.tiny { min-height: 34px; }
.phone-shift .cell select { min-height: var(--touch); font-size: 16px; }

/* ---------- Personen, Fotos ---------- */
.avatar { border-radius: 50%; object-fit: cover; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; background: var(--line); }
.avatar-initials { background: color-mix(in srgb, var(--primary) 18%, var(--card)); color: color-mix(in srgb, var(--primary) 70%, var(--text)); font-weight: 700; letter-spacing: .02em; }
.person { display: inline-flex; align-items: center; gap: .45rem; min-width: 0; }
.cell li .person { gap: .3rem; }
.foto-control { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.foto-control button { margin: 0 .4rem .3rem 0; }
.akte-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: center; }
.akte-main { flex: 1; min-width: 200px; }
.akte-foto .foto-control p { display: none; }
.akte-contact { display: flex; flex-direction: column; gap: .3rem; }
.akte-contact a { text-decoration: none; }

/* ---------- Campus ---------- */
.campus-building { border-left: 4px solid var(--primary); }
.campus-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.campus-head h2 { margin: 0; }
.campus-stations { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: .75rem; }
.station { margin: 0; box-shadow: none; background: var(--bg); }
.station-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: .5rem; }
.station-head h3 { margin: 0 0 .25rem; }
.station .row > label { flex-basis: 140px; }
.station-meta { display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .85rem; color: var(--muted); margin-bottom: .5rem; }
details.edit > summary { cursor: pointer; color: var(--primary); font-weight: 600; font-size: .9rem; padding: .3rem 0; list-style: none; }
details.edit > summary::-webkit-details-marker { display: none; }
details.edit > summary::before { content: "✎ "; }
details.edit[open] > summary { margin-bottom: .5rem; }

/* ---------- Wünsche ---------- */
.wish-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .3rem; }
.wish-head { text-align: center; font-size: .75rem; font-weight: 700; color: var(--muted); padding: .2rem 0; }
.wish-day { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: .1rem; min-height: 64px; padding: .3rem .1rem;
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); font-weight: 500; }
.wish-day.empty { border: 0; background: transparent; }
.wish-day.weekend { background: color-mix(in srgb, var(--primary) 6%, var(--bg)); }
.wish-day.locked { opacity: .45; }
.wish-day .wd-num { font-weight: 700; }
.wish-day .wish-tag { font-size: .72rem; font-weight: 700; border-radius: 999px; padding: 0 .45rem; }
.wish-day.wish-frei { border-color: var(--ok); background: var(--ok-bg); }
.wish-day.wish-frei .wish-tag { color: var(--ok); }
.wish-day.wish-dienst { border-color: var(--primary); }
.wish-day.wish-dienst .wish-tag { color: var(--primary-ink); background: var(--primary); }
.wish-day .wish-abs { font-size: .65rem; color: var(--warn); line-height: 1.1; text-align: center; }
.legend .l-wish::before { background: var(--primary); }
.wish-info { color: var(--primary); font-weight: 600; text-transform: none; letter-spacing: 0; }

/* ---------- Sonstiges ---------- */
.check-list { display: grid; gap: .45rem; max-height: 40vh; overflow-y: auto; }
.save-bar { position: sticky; bottom: calc(var(--bottomnav) + .5rem + env(safe-area-inset-bottom)); z-index: 5; display: flex; justify-content: flex-end; padding: .6rem .9rem; }
@media (min-width: 1100px) { .save-bar { bottom: .75rem; } }
@media (max-width: 759.98px) { .save-bar button { width: 100%; } }
ul.files { list-style: none; padding: 0; margin: .25rem 0 0; font-size: .85rem; display: grid; gap: .2rem; }
ul.files li { display: flex; gap: .3rem; align-items: center; }
.logo-preview img { display: block; }

/* ---------- Dialoge ---------- */
dialog.ui-dialog { border: 0; padding: 0; border-radius: 14px; width: min(460px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); background: var(--card); color: var(--text); box-shadow: var(--shadow-lg); }
dialog.ui-dialog::backdrop { background: rgba(10, 15, 20, .5); }
.ui-dialog-body { padding: 1.2rem 1.2rem 1rem; display: grid; gap: .6rem; }
.ui-dialog-body h2 { margin: 0; font-size: 1.15rem; }
.ui-dialog-msg { margin: 0; color: var(--muted); white-space: pre-line; }
.ui-dialog-fields { display: grid; gap: .7rem; }
.ui-dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; margin-top: .4rem; }

/* ---------- Bildzuschnitt ---------- */
.crop-dialog { justify-items: center; }
.crop-dialog > h2, .crop-dialog > .ui-dialog-msg, .crop-dialog > .ui-dialog-actions { justify-self: stretch; }
.crop-stage { position: relative; overflow: hidden; border-radius: 12px; background: #000; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.crop-stage:active { cursor: grabbing; }
.crop-stage canvas { display: block; }
/* abgedunkelter Bereich außerhalb des Kreises */
.crop-mask { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0, 0, 0, .55); outline: 2px solid rgba(255, 255, 255, .9); pointer-events: none; }
/* Orientierung: Kopf (Oval) und Augenlinie */
.crop-guide { position: absolute; left: 31%; right: 31%; top: 14%; bottom: 24%; border: 2px dashed rgba(255, 255, 255, .45); border-radius: 50% 50% 46% 46%; pointer-events: none; }
.crop-controls { display: flex; align-items: center; gap: .5rem; width: 100%; max-width: 340px; }
.crop-controls button { min-width: 44px; font-size: 1.25rem; padding: 0; }
.crop-zoom { flex: 1; min-height: 0; padding: 0; border: 0; background: transparent; accent-color: var(--primary); }

/* ---------- Meldung ---------- */
#toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%) translateY(8px); background: var(--text); color: var(--bg); padding: .65rem 1rem; border-radius: var(--radius); opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: min(92vw, 520px); z-index: 100; box-shadow: var(--shadow-lg); text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--bad); color: #fff; }

/* ---------- Tablet ---------- */
@media (max-width: 1099.98px) and (min-width: 760px) {
  main { padding: 1rem 1.25rem; }
}

/* ---------- Handy ---------- */
@media (max-width: 759.98px) {
  body { font-size: 16px; }
  main { padding: .6rem; }
  .card { padding: .85rem; border-radius: 12px; }
  #topbar { padding: .45rem .7rem; padding-top: calc(.45rem + env(safe-area-inset-top)); gap: .5rem; }
  .brand { font-size: .95rem; }
  .brand-sub { display: none; }
  .who #who .who-name { display: none; }
  .toolbar select, .toolbar input:not([type="checkbox"]) { flex: 1 1 100%; min-width: 0; }
  #logout .label { display: none; }
  #logout .icon { display: inline-block; }
  #logout { min-width: var(--touch); padding: .4rem; }
  /* 16 px verhindert das automatische Hineinzoomen auf dem iPhone */
  input, select, textarea, button { font-size: 16px; min-height: var(--touch); }
  input[type="checkbox"] { min-height: 0; width: 1.35em; height: 1.35em; }
  button.tiny { min-height: 36px; padding: .3rem .75rem; font-size: .9rem; }
  .row { flex-direction: column; align-items: stretch; }
  .row > label, .row > button, .row > label:has(input[type="number"]) { width: 100%; flex: 1 1 auto; max-width: none; }
  .row input[type="number"] { width: 100%; }
  .toolbar > button, .toolbar > a > button { flex: 1 1 auto; }
  .toolbar > h2 { flex: 1 1 100%; }
  .grid-2 { grid-template-columns: 1fr; gap: .6rem; margin-bottom: .6rem; }
  .stat { font-size: 1.4rem; }
  .login { margin: 3vh auto; }
  .codes { columns: 1; }
  fieldset { padding: .5rem .65rem .75rem; }

  /* Dialoge als Einblendung von unten */
  dialog.ui-dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 90vh; }
  .ui-dialog-body { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
  .ui-dialog-actions { flex-direction: column-reverse; }
  .ui-dialog-actions button { width: 100%; }
  .campus-head > .toolbar { width: 100%; }
}

/* ---------- Druck ---------- */
@media print {
  #topbar, #bottomnav, .toolbar button, .cell button, .cell select, .nav-backdrop { display: none !important; }
  body, body.app { background: #fff; padding: 0; }
  body.app main { margin: 0; padding: 0; }
  .card { box-shadow: none; border: 0; }
  .plan-scroll { max-height: none; overflow: visible; border: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Impressum / Datenschutz */
.legal-text { max-height: 60vh; overflow-y: auto; padding-right: .3rem; }
.legal-text h3 { font-size: 1rem; margin: .9rem 0 .2rem; }
.legal-text p { margin: 0 0 .6rem; }
.legal-links { text-align: center; margin: .8rem 0 0; }
.legal-links a { display: inline-block; padding: .5rem .3rem; }

/* Barrierefreiheit: Sprunglink, sichtbarer Tastaturfokus, nur für Screenreader */
.skip-link { position: absolute; left: .5rem; top: -3rem; z-index: 1000; background: var(--primary); color: var(--primary-ink); padding: .6rem 1rem; border-radius: var(--radius-sm); text-decoration: none; }
.skip-link:focus { top: .5rem; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 70%, #f5b800); outline-offset: 2px; }
.table-wrap:focus-visible, .plan-scroll:focus-visible { outline-offset: -3px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
#main:focus { outline: none; }
/* Touch-Geräte (auch große Tablets): ausreichend große Tippflächen */
@media (pointer: coarse) { button.tiny { min-height: 36px; } }
/* Kontrast der Zusatzinfos auf rot markierten Schichten */
.cell.bad .count, .cell.bad .verbund-info:not(.ok) { color: color-mix(in srgb, var(--muted) 60%, var(--text)); }

/* Passkeys */
.passkey-login { display: grid; gap: .5rem; margin-top: .8rem; text-align: center; }
.passkey-login button { justify-content: center; display: inline-flex; align-items: center; gap: .4rem; }
.oder { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .85rem; }
.oder::before, .oder::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.passkey-list { list-style: none; padding: 0; margin: .5rem 0 1rem; display: grid; gap: .5rem; }
.passkey-list li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .7rem; }

/* Demo-Modus: Rollenauswahl */
.login.demo-login { max-width: 760px; margin: 4vh auto; }
.demo-hinweis { text-align: center; display: grid; justify-items: center; gap: .3rem; margin-bottom: .5rem; }
.demo-hinweis p { margin: 0; max-width: 52ch; }
.demo-h { font-size: 1rem; margin: 1rem 0 .5rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.demo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .5rem; }
button.demo-person { display: flex; align-items: center; justify-content: flex-start; width: 100%; gap: .7rem; text-align: left; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .7rem; min-height: 60px; font-weight: 400; }
button.demo-person:hover { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 6%, var(--card)); }
.demo-person-text { display: grid; gap: .1rem; min-width: 0; }
.demo-person-text strong { font-size: 1rem; }
.demo-neu-wrap, .demo-pw { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .7rem; }
.demo-neu-wrap summary, .demo-pw summary { cursor: pointer; font-weight: 600; padding: .4rem 0; min-height: 32px; }
.demo-neu { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); align-items: end; margin-top: .5rem; }
.demo-switch { margin-left: .4rem; white-space: nowrap; }
.demo-teaser { border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; margin: .8rem 0 1rem; background: color-mix(in srgb, var(--primary) 5%, var(--card)); }
.demo-teaser h2 { font-size: 1.05rem; margin: 0 0 .2rem; }
.demo-teaser p { margin: .2rem 0 .6rem; }
.demo-rollen { display: grid; gap: .5rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
a.demo-rolle { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem; border-radius: var(--radius-sm); background: var(--primary); color: var(--primary-ink); text-decoration: none; min-height: 64px; }
a.demo-rolle:hover { filter: brightness(1.08); }
a.demo-rolle .icon { flex: none; margin-top: .1rem; }
a.demo-rolle span { display: grid; gap: .15rem; }
a.demo-rolle strong { font-size: 1.05rem; }
.login-echt { font-size: 1.05rem; margin: .4rem 0 0; }
.demo-live { text-align: center; margin-top: 1rem; }
.demo-switch .demo-kurz { display: none; }
@media (max-width: 1099px) {
  .demo-switch .demo-lang { display: none; }
  .demo-switch .demo-kurz { display: inline; }
  .demo-switch { padding: .3rem .5rem; margin-left: .25rem; }
}
.who #who { gap: .4rem; align-items: center; }
.who #who .avatar, .who #who .demo-switch { flex: none; }
@media (max-width: 1099px) { .who #who, .who #who .person { flex: none; } body.demo #logout { display: none; } }

/* Stempeluhr */
.stempeluhr { max-width: 560px; display: grid; gap: .8rem; }
.stempel-kopf { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.stempel-kopf h2 { margin: 0; }
.stempel-uhr { font-variant-numeric: tabular-nums; font-size: 1.1rem; color: var(--muted); }
.stempel-status { margin: 0; font-size: 1.15rem; font-weight: 700; }
.stempel-status.an { color: var(--ok); }
.stempel-status.pause { color: var(--warn); }
.stempel-dienst { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.stempel-zaehler { display: grid; justify-items: center; padding: .6rem; border-radius: var(--radius); background: color-mix(in srgb, var(--primary) 7%, var(--card)); }
.stempel-zaehler strong { font-size: clamp(2.4rem, 12vw, 3.4rem); font-variant-numeric: tabular-nums; letter-spacing: .02em; line-height: 1.1; }
button.stempel-btn { min-height: 64px; font-size: 1.25rem; font-weight: 700; width: 100%; border-radius: var(--radius); }
button.stempel-btn.kommen { background: var(--ok); border-color: var(--ok); color: #fff; }
button.stempel-btn.gehen { background: var(--bad); border-color: var(--bad); color: #fff; }
button.stempel-btn.weiter { background: var(--primary); color: var(--primary-ink); }
button.stempel-btn:disabled { opacity: .5; }
.stempel-pausen-btns { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.stempel-pausen-btns .stempel-btn { min-height: 56px; font-size: 1.05rem; }
.stempel-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; font-size: .92rem; }
.stempel-liste li { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; border-bottom: 1px dashed var(--line); padding: .25rem 0; }
.stempel-erledigt h3 { margin: .3rem 0; font-size: 1rem; }
.stempel-ergebnis { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .7rem; display: grid; gap: .4rem; }
.stempel-ergebnis dl { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; margin: 0; font-size: .92rem; }
.stempel-ergebnis dt { color: var(--muted); }
.stempel-ergebnis dd { margin: 0; text-align: right; }
.stempel-vergessen { border: 1px solid var(--warn); border-radius: var(--radius-sm); padding: .6rem; background: var(--warn-bg); }
.stempel-vergessen p { margin: 0 0 .5rem; }
button.linkish { background: none; border: 0; color: var(--primary); text-decoration: underline; padding: .3rem; min-height: 32px; justify-self: center; font-weight: 400; }
.zeit-stempel { margin: .25rem 0 0; padding: 0; list-style: none; font-size: .8rem; color: var(--muted); }

/* Personenansicht des Dienstplans */
.segmented { display: inline-flex; border: 1px solid var(--primary); border-radius: var(--radius-sm); overflow: hidden; }
.segmented button { border: 0; border-radius: 0; min-height: 36px; }
.segmented button.ghost { background: var(--card); }
.phone-plan > .segmented { width: 100%; margin-bottom: .5rem; }
.phone-plan > .segmented button { flex: 1; }
.pp .toolbar input[type=search] { width: 12rem; max-width: 100%; }
.pp-legend .pp-abs { display: inline-block; }
.pp-scroll { max-height: calc(100vh - 230px); }
table.pp-table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
table.pp-table th, table.pp-table td { border-bottom: 1px solid var(--line); padding: 0; text-align: center; }
table.pp-table thead th { position: sticky; top: 0; z-index: 2; background: var(--card); font-size: .78rem; padding: .25rem .1rem; }
table.pp-table .pp-day span { display: block; line-height: 1.15; }
table.pp-table .pp-name { position: sticky; left: 0; z-index: 1; background: var(--card); text-align: left; padding: .2rem .5rem .2rem .3rem; min-width: 11rem; max-width: 14rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; border-right: 1px solid var(--line); }
table.pp-table thead .pp-name { z-index: 3; }
table.pp-table .pp-name .avatar { vertical-align: middle; margin-right: .35rem; }
table.pp-table tr.pp-me th, table.pp-table tr.pp-me td { background: color-mix(in srgb, var(--primary) 7%, var(--card)); }
table.pp-table tr.pp-group th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .5rem .4rem .2rem; background: var(--bg); position: sticky; left: 0; }
.pp-cell { min-width: 2.6rem; height: 2.4rem; }
.pp-monat .pp-cell { min-width: 2.2rem; }
.pp-cell.weekend { background: color-mix(in srgb, var(--muted) 7%, var(--card)); }
.pp-cell.holiday { background: color-mix(in srgb, var(--warn) 10%, var(--card)); }
.pp-cell.today, th.pp-day.today { box-shadow: inset 2px 0 0 var(--primary), inset -2px 0 0 var(--primary); }
.pp-btn { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; justify-content: center; width: 100%; min-height: 2.4rem; padding: 2px; background: transparent; border: 0; color: inherit; font: inherit; border-radius: 0; }
button.pp-btn:hover, button.pp-btn:focus-visible { background: color-mix(in srgb, var(--primary) 12%, transparent); filter: none; }
.pp-code { display: inline-flex; align-items: baseline; padding: .05rem .3rem; border-radius: 4px; color: #fff; font-weight: 700; font-size: .78rem; text-shadow: 0 0 2px rgba(0,0,0,.35); }
.pp-code sup { font-size: .6rem; margin-left: 1px; }
.pp-abs { padding: .05rem .3rem; border-radius: 4px; font-weight: 700; font-size: .75rem; background: var(--warn-bg); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
.pp-abs.beantragt { border-style: dashed; }
.pp-wish { font-size: .75rem; color: var(--muted); }
.pp-leer { color: var(--line); }
.pp-std { padding: 0 .5rem !important; font-variant-numeric: tabular-nums; }
tr.pp-cover td.bad, .pp-bad { color: var(--bad); font-weight: 700; }
tr.pp-cover td.bad { background: var(--bad-bg); }
tr.pp-cover td.ok, .pp-ok { color: var(--ok); }
tr.pp-cover th { font-size: .8rem; }
.pp-dlg-list { list-style: none; padding: 0; margin: .3rem 0; display: grid; gap: .4rem; }
.pp-dlg-list li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .45rem .55rem; }
@media print { .pp-scroll { max-height: none; overflow: visible; } }
.pp-toolbar { flex-wrap: wrap; }
.pp-nav { display: inline-flex; align-items: center; gap: .4rem; flex-wrap: nowrap; }
.pp-nav strong { white-space: nowrap; }
.pp-filter > summary { cursor: pointer; font-weight: 600; padding: .35rem 0; min-height: 32px; display: flex; align-items: center; gap: .5rem; }
.pp-filter[open] > summary { display: none; }
table.pp-table .pp-name { text-transform: none; letter-spacing: normal; font-size: .88rem; color: var(--text); }
table.pp-table thead .pp-name { font-size: .78rem; color: var(--muted); }
@media (min-width: 760px) { .pp-filter > summary { display: none; } }
@media (max-width: 759.98px) {
  .pp-toolbar { gap: .4rem; }
  .pp-toolbar .segmented { width: 100%; }
  .pp-toolbar .segmented button { flex: 1; }
  .pp-nav { flex: 1; justify-content: space-between; }
  .pp-nav button { min-width: 44px; }
  .pp-filter[open] > summary { display: flex; }
  table.pp-table .pp-name { min-width: 7.5rem; max-width: 8.5rem; font-size: .82rem; padding-left: .2rem; }
  table.pp-table .pp-name .avatar { display: none; }
  .pp-scroll { max-height: none; }
}
.pp-group-label { position: sticky; left: .4rem; display: inline-block; }
table.pp-table tr.pp-group th { position: static; }
.pp-inhalt { display: contents; }
.pp-btn { position: relative; } /* hält den unsichtbaren Screenreader-Text innerhalb der Tabelle */
.wish-day { position: relative; }
.cell.gesperrt { opacity: .9; }
.stempel-offline { border: 1px solid var(--warn); background: var(--warn-bg); border-radius: var(--radius-sm); padding: .5rem .6rem; font-size: .9rem; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.offline-seite { max-width: 560px; margin: 1rem auto; display: grid; gap: .7rem; }

/* Rückmeldung */
.rm-form { max-width: 640px; display: grid; gap: .7rem; }
.rm-arten { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.rm-arten legend { font-weight: 600; margin-bottom: .3rem; }
.rm-art { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--line); border-radius: 999px; padding: .4rem .8rem; min-height: 40px; cursor: pointer; }
.rm-art:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--card)); }
.rm-liste { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.rm-eintrag { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .7rem; }
.rm-kopf { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.rm-text { white-space: pre-wrap; margin: .4rem 0; }
.rm-antwort { background: color-mix(in srgb, var(--primary) 6%, var(--card)); border-radius: var(--radius-sm); padding: .4rem .6rem; margin: .3rem 0; white-space: pre-wrap; }
.sso-login { display: grid; gap: .6rem; margin: .8rem 0 .2rem; }
a.sso-btn { display: flex; align-items: center; justify-content: center; gap: .5rem; min-height: 48px; border-radius: var(--radius-sm); background: var(--primary); color: var(--primary-ink); text-decoration: none; font-weight: 600; }
a.sso-btn:hover { filter: brightness(1.08); }

/* Beschäftigungsart: Flexpool / Extern */
.btag { display: inline-block; font-size: .68rem; font-weight: 800; letter-spacing: .03em; line-height: 1; padding: .2rem .32rem; border-radius: 4px; margin-left: .3rem; vertical-align: middle; white-space: nowrap; }
.btag.fp { background: #ede4fb; color: #5b2a9e; border: 1px solid #c9b2ef; }
.btag.ext { background: #ffe9d6; color: #8a3d00; border: 1px solid #f2b98a; }
.besetzung-art { margin-left: .35rem; }
.besetzung-art .btag { margin-left: .15rem; }
table.pp-table tr.pp-flexpool th.pp-name { box-shadow: inset 4px 0 0 #8e5bd6; }
table.pp-table tr.pp-extern th.pp-name { box-shadow: inset 4px 0 0 #e07a1f; }
table.pp-table tr.pp-group-flexpool th { color: #5b2a9e; }
table.pp-table tr.pp-group-extern th { color: #8a3d00; }
@media (prefers-color-scheme: dark) {
  .btag.fp { background: #3a2a55; color: #d9c5ff; border-color: #6b4fa0; }
  .btag.ext { background: #4a2c14; color: #ffd0a8; border-color: #9a5a28; }
}
.cell .person-btn > span:nth-child(2), .cell .person > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cell .person-btn > .btag, .cell .person > .btag { flex: none; overflow: visible; margin-left: .2rem; }
.cell .count .besetzung-art { white-space: nowrap; }

.cell .is-ext, .cell .is-fp { border-radius: 4px; padding-left: 4px; }
.cell .is-ext { box-shadow: inset 3px 0 0 #e07a1f; background: color-mix(in srgb, #e07a1f 10%, transparent); }
.cell .is-fp { box-shadow: inset 3px 0 0 #8e5bd6; background: color-mix(in srgb, #8e5bd6 10%, transparent); }
.cell .is-ext .avatar { outline: 2px solid #e07a1f; }
.cell .is-fp .avatar { outline: 2px solid #8e5bd6; }
.legend .l-fp::before { background: #8e5bd6; }
.legend .l-ext::before { background: #e07a1f; }
.android-app { text-align: center; margin: .6rem 0 0; }

/* Schichtprotokoll */
.prot-liste { list-style: none; padding: 0; margin: .3rem 0 1rem; display: grid; gap: .4rem; }
.prot-btn { width: 100%; display: flex; align-items: center; gap: .6rem; text-align: left; background: var(--card); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .55rem .65rem; min-height: 56px; font-weight: 400; }
.prot-btn:hover { border-color: var(--primary); filter: none; }
.prot-zeile.mein .prot-btn { border-left: 4px solid var(--primary); }
.prot-info { display: grid; gap: .1rem; flex: 1; min-width: 0; }
.prot-status { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.protokoll { max-width: 860px; display: grid; gap: .6rem; }
.protokoll h3 { margin: .6rem 0 .1rem; }
.pd-hinweis { border-left: 4px solid var(--warn); background: var(--warn-bg); padding: .5rem .7rem; border-radius: var(--radius-sm); font-size: .9rem; }
.pd-warnung { border: 1px solid var(--bad); background: var(--bad-bg); color: var(--text); padding: .5rem .7rem; border-radius: var(--radius-sm); font-size: .9rem; }
.diktat-bereich { display: grid; gap: .3rem; }
.diktat { display: grid; gap: .4rem; }
button.diktat-btn { min-height: 64px; font-size: 1.2rem; font-weight: 700; border-radius: var(--radius); width: 100%; }
button.diktat-btn.aktiv { background: var(--bad); border-color: var(--bad); animation: puls 1.4s ease-in-out infinite; }
.diktat.klein { justify-items: start; }
.diktat.klein button.aktiv { color: var(--bad); border-color: var(--bad); }
@keyframes puls { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--bad) 25%, transparent); } }
.diktat-text { min-height: 1.2em; font-size: 1.05rem; }
.diktat-vorschau { border: 2px solid var(--primary); border-radius: var(--radius); padding: .7rem .8rem; background: color-mix(in srgb, var(--primary) 5%, var(--card)); }
.diktat-vorschau h3 { margin-top: 0; }
.diktat-punkte { list-style: none; padding: 0; margin: .4rem 0; display: grid; gap: .3rem; }
.prot-zahlen { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
.stepper { display: grid; gap: .25rem; }
.stepper-label { font-weight: 600; font-size: .9rem; }
.stepper-reihe { display: grid; grid-template-columns: 48px 1fr 48px; gap: .3rem; }
.stepper-reihe input { text-align: center; font-size: 1.2rem; font-weight: 700; min-width: 0; }
.stepper-reihe button { font-size: 1.3rem; padding: 0; min-height: 48px; }
.vk-liste { display: grid; gap: .45rem; }
.vk-zeile { display: grid; grid-template-columns: minmax(150px, 1.2fr) 70px 110px minmax(140px, 2fr) auto; gap: .35rem; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .4rem; }
.vk-anzahl { text-align: center; }
@media (max-width: 759.98px) { .vk-zeile { grid-template-columns: 1fr 70px 110px; } .vk-zeile > input:nth-of-type(3) { grid-column: 1 / 3; } }
.prot-besetzung ul { margin: .2rem 0; padding-left: 1.1rem; }
.prot-aktionen { padding-top: .6rem; border-top: 1px solid var(--line); }
/* untere Leiste: Spalten dürfen schrumpfen, lange Beschriftungen werden gekürzt statt überzulaufen */
body.app #bottomnav { grid-auto-columns: minmax(0, 1fr); }
#bottomnav button { min-width: 0; }
/* feststehende Speicherleiste im Protokoll nicht über den Inhalt legen */
.protokoll { padding-bottom: .5rem; }
.prot-aktionen { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.prot-aktionen button { min-height: 48px; }
.pegel { display: inline-block; width: 120px; height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; vertical-align: middle; margin-left: .5rem; }
.pegel > span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .1s linear; }
.aufnahme-punkt { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--bad); animation: puls 1.2s ease-in-out infinite; vertical-align: middle; }
/* Plus/Minus-Felder: Zahlenfeld darf schrumpfen (Browser geben Zahlenfeldern sonst eine feste Mindestbreite) */
.prot-zahlen { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
.stepper-reihe { grid-template-columns: 44px minmax(0, 1fr) 44px; }
.stepper-reihe input { width: 100%; min-width: 0; }
.stepper-reihe button { min-width: 0; width: 44px; }
@media (max-width: 759.98px) { .prot-zahlen { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem .6rem; } }
.vk-zeile > * { min-width: 0; }
.stepper-reihe input::placeholder { font-size: .8rem; font-weight: 400; }
.app-update { position: fixed; left: .75rem; right: .75rem; bottom: calc(var(--bottomnav, 64px) + .75rem + env(safe-area-inset-bottom)); z-index: 70; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap;
  background: var(--primary); color: var(--primary-ink); padding: .6rem .8rem; border-radius: var(--radius); box-shadow: var(--shadow); }
.app-update span { flex: 1; min-width: 10rem; }
.app-update a.button { background: var(--primary-ink); color: var(--primary); padding: .45rem .8rem; border-radius: var(--radius-sm); text-decoration: none; font-weight: 700; }
.app-update button { color: var(--primary-ink); border-color: transparent; }
