/* Feuerwehr-Verwaltung
   Farben: Feuerrot (Fahrzeug), Tinte (Schrift), Alu (Geräteraum-Rollladen), Reflexgelb (Warnstreifen)
   Schrift: Barlow und Barlow Condensed, angelehnt an Fahrzeugbeschriftung */

@font-face { font-family: 'Barlow'; font-weight: 400; font-display: swap; src: url('/fonts/barlow-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 500; font-display: swap; src: url('/fonts/barlow-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 600; font-display: swap; src: url('/fonts/barlow-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow'; font-weight: 700; font-display: swap; src: url('/fonts/barlow-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-display: swap; src: url('/fonts/barlow-condensed-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; font-display: swap; src: url('/fonts/barlow-condensed-latin-700-normal.woff2') format('woff2'); }

:root {
  --rot: #B3261E;
  --rot-dunkel: #8E1C16;
  --rot-hell: #FBECEA;
  --tinte: #1A222C;
  --tinte-2: #2A3440;
  --text-2: #56616E;
  --alu: #E9ECEF;
  --alu-2: #F4F6F7;
  --weiss: #FFFFFF;
  --linie: #D3D9DF;
  --linie-2: #E5E9ED;
  --reflex: #DCE81D;
  --ok: #1D7445; --ok-bg: #E4F2EA;
  --warn: #9A5B00; --warn-bg: #FCF0D9; --warn-bar: #E3A21A;
  --krit: #B3261E; --krit-bg: #FBE6E4;
  --aus: #6B7580; --aus-bg: #ECEEF0;
  --sans: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --cond: 'Barlow Condensed', 'Barlow', system-ui, sans-serif;
  --r-lg: 12px; --r: 8px; --r-sm: 6px;
  --side: 248px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 16px; line-height: 1.45; color: var(--tinte); background: var(--alu); -webkit-font-smoothing: antialiased; }
a { color: var(--rot-dunkel); text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-family: var(--cond); font-weight: 700; font-size: 1.85rem; letter-spacing: .005em; }
h2 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 .6em; }
:focus-visible { outline: 3px solid var(--tinte); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; flex: none; }
.muted { color: var(--text-2); }
.small { font-size: .875rem; }
.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.cond { font-family: var(--cond); font-weight: 700; letter-spacing: .01em; }
.code { font-family: var(--cond); font-weight: 600; font-size: .95em; color: var(--tinte-2); background: var(--alu-2); border: 1px solid var(--linie-2); border-radius: 4px; padding: 0 .35em; margin-right: .4em; white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--weiss); padding: 8px 12px; }
.skip:focus { left: 8px; }
.boot, .loading { padding: 48px 20px; text-align: center; color: var(--text-2); }

/* ---------- Grundgerüst ---------- */
.side { display: none; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--rot); color: #fff; padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 10px; }
.topbar .brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.topbar .brand b { font-family: var(--cond); font-size: 1.2rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .brand-mark, .topbar .brand-logo { width: 32px; height: 32px; }
.topbar .brand-mark rect:first-child { fill: var(--rot-dunkel); }
.topbar .icon-btn { color: #fff; }
.brand-logo { object-fit: contain; border-radius: 6px; background: #fff; }
main { padding: 18px 16px calc(var(--tab-h) + var(--safe-b) + 28px); max-width: 1180px; margin: 0 auto; outline: none; }

.tabbar { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr); background: var(--weiss); border-top: 1px solid var(--linie); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-2); text-decoration: none; font-size: .75rem; font-weight: 600; }
.tabbar a .ic { width: 24px; height: 24px; }
.tabbar a.active { color: var(--rot); }
.tab-scan { position: relative; }
.scan-btn { display: grid; place-items: center; width: 62px; height: 62px; margin-top: -26px; border-radius: 50%; background: var(--rot); color: #fff;
  box-shadow: 0 0 0 4px var(--weiss), 0 0 0 7px var(--reflex); }
.scan-btn .ic { width: 30px; height: 30px; stroke-width: 2.1; }
.tab-scan.active .scan-btn { background: var(--rot-dunkel); }

@media (min-width: 900px) {
  .topbar, .tabbar { display: none; }
  .side { display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--tinte); color: #DCE2E8; padding: 18px 12px; overflow-y: auto; }
  .side .brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; padding: 4px 8px 18px; }
  .side .brand span { display: flex; flex-direction: column; min-width: 0; }
  .side .brand small { color: #9AA6B2; font-size: .78rem; }
  .side .brand b { font-family: var(--cond); font-size: 1.2rem; line-height: 1.1; }
  .side .brand-mark, .side .brand-logo { width: 40px; height: 40px; flex: none; }
  .side-scan { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 6px 14px; padding: 11px; border-radius: var(--r);
    background: var(--rot); color: #fff; font-weight: 700; text-decoration: none; box-shadow: inset 0 -3px 0 var(--reflex); }
  .side-scan:hover { background: var(--rot-dunkel); }
  .nav-group { margin: 16px 10px 4px; font-size: .78rem; color: #8592A0; font-weight: 600; }
  .nav-link { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: none;
    color: #DCE2E8; text-decoration: none; font: inherit; font-size: .95rem; cursor: pointer; text-align: left; }
  .nav-link .ic { color: #8E9BA8; }
  .nav-link:hover { background: var(--tinte-2); }
  .nav-link.active { background: var(--tinte-2); color: #fff; box-shadow: inset 3px 0 0 var(--rot); }
  .nav-link.active .ic { color: #fff; }
  .side .logout { margin-top: auto; }
  main { margin-left: var(--side); padding: 28px 36px 60px; max-width: calc(1180px + var(--side)); }
  .hide-lg { display: none !important; }
}
@media (max-width: 899px) { .hide-sm { display: none !important; } }
body.bare .topbar, body.bare .tabbar, body.bare .side { display: none; }

/* ---------- Seitenkopf ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin: 4px 0 18px; }
.page-head .count { font-family: var(--sans); font-size: .95rem; font-weight: 600; color: var(--text-2); vertical-align: middle; margin-left: 6px; }
.head-sub { margin: 4px 0 0; color: var(--text-2); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.head-actions select { width: auto; }
.detail-head h1 { font-size: 1.7rem; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 6px; color: var(--text-2); text-decoration: none; font-weight: 500; font-size: .95rem; }
.back:hover { color: var(--tinte); }
.back .ic { width: 18px; height: 18px; }
.month { font-size: .95rem; color: var(--text-2); margin: 22px 2px 8px; }

/* ---------- Bedienelemente ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 0 16px; border-radius: var(--r);
  border: 1px solid transparent; font: inherit; font-weight: 600; font-size: .95rem; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn .ic { width: 18px; height: 18px; }
.btn.primary { background: var(--rot); color: #fff; }
.btn.primary:hover { background: var(--rot-dunkel); }
.btn.ghost { background: var(--weiss); color: var(--tinte); border-color: var(--linie); }
.btn.ghost:hover { border-color: var(--tinte-2); }
.btn.danger { background: var(--krit); color: #fff; }
.btn.danger-ghost { background: none; color: var(--krit); border-color: transparent; padding: 0 8px; }
.btn.small { min-height: 34px; padding: 0 11px; font-size: .875rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: var(--r); background: none; color: inherit; cursor: pointer; }
.icon-btn:hover { background: rgba(0,0,0,.06); }

input, select, textarea { font: inherit; color: var(--tinte); width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid var(--linie); border-radius: var(--r); background: var(--weiss); }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--tinte); box-shadow: 0 0 0 3px rgba(26,34,44,.14); }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2356616E' stroke-width='2'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 18px; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.search { position: relative; flex: 1 1 240px; display: block; }
.search .ic { position: absolute; left: 11px; top: 12px; color: var(--text-2); }
.search input { padding-left: 38px; }
.filter { flex: 0 1 200px; width: auto; }
.counter { font-weight: 600; color: var(--text-2); }

.seg { display: inline-flex; background: var(--alu-2); border: 1px solid var(--linie); border-radius: var(--r); padding: 3px; gap: 2px; margin-bottom: 14px; }
.seg a, .seg button { border: 0; background: none; font: inherit; font-weight: 600; font-size: .9rem; color: var(--text-2); padding: 7px 14px; border-radius: var(--r-sm); text-decoration: none; cursor: pointer; }
.seg .on { background: var(--weiss); color: var(--tinte); box-shadow: 0 1px 0 var(--linie); }
.seg.wide { display: flex; } .seg.wide > * { flex: 1; text-align: center; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: relative; width: 42px; height: 24px; flex: none; border-radius: 12px; background: #C3CBD3; transition: background .15s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 3px solid var(--tinte); outline-offset: 2px; }
.switch.small { font-size: .9rem; }

/* ---------- Flächen und Listen ---------- */
.panel { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--r-lg); margin-bottom: 14px; overflow: hidden; }
.panel.pad, .pad { padding: 16px 18px; }
.pad-x { padding: 12px 18px; margin: 0; }
.panel h2 { margin-bottom: 10px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 10px 18px; border-bottom: 1px solid var(--linie-2); }
.panel-head h2 { margin: 0; }
.panel-head .count { font-weight: 600; color: var(--text-2); }
.stack > * + * { margin-top: 0; }
.link-panel { display: block; text-decoration: none; color: inherit; }
.link-panel:hover { border-color: var(--tinte-2); }
.link-panel p { margin: 0; color: var(--text-2); }

.list { display: flex; flex-direction: column; }
.row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 14px 10px 18px; border: 0; border-bottom: 1px solid var(--linie-2);
  background: none; color: inherit; text-decoration: none; font: inherit; text-align: left; width: 100%; cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--alu-2); }
.row.static { cursor: default; } .row.static:hover { background: none; }
.row::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 0 3px 3px 0; background: transparent; }
.row.tone-ok::before { background: var(--ok); }
.row.tone-warn::before { background: var(--warn-bar); }
.row.tone-krit::before { background: var(--krit); }
.row.tone-aus::before { background: var(--aus); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-title { font-weight: 600; overflow-wrap: anywhere; }
.row-title.cond { font-size: 1.15rem; }
.row-sub { color: var(--text-2); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; }
.row-right { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; text-align: right; max-width: 52%; }
.row-right small { flex-basis: 100%; }
.row-chev { color: #A6B0BA; width: 18px; height: 18px; }
.row-ic { color: var(--text-2); }
.row .lbl { font-size: .8rem; color: var(--text-2); font-weight: 600; }
.check-row { cursor: pointer; }
.check-row input { width: 20px; height: 20px; accent-color: var(--rot); }
.more { padding: 12px 18px; margin: 0; color: var(--text-2); font-size: .9rem; }
.date-block { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 46px; height: 46px; flex: none; border-radius: var(--r); background: var(--alu-2); border: 1px solid var(--linie-2); line-height: 1; }
.date-block b { font-family: var(--cond); font-size: 1.35rem; }
.date-block small { font-size: .72rem; color: var(--text-2); font-weight: 600; margin-top: 2px; }

.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; line-height: 1.5; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.krit { background: var(--krit-bg); color: var(--krit); }
.badge.aus { background: var(--aus-bg); color: var(--aus); }
.badge.neutral { background: var(--alu-2); color: var(--tinte-2); border: 1px solid var(--linie-2); }

.empty { text-align: center; padding: 40px 24px; }
.empty-title { font-family: var(--cond); font-size: 1.35rem; font-weight: 700; margin-bottom: 6px; }
.empty p { color: var(--text-2); max-width: 52ch; margin: 0 auto 14px; }
.note { background: var(--alu-2); border: 1px solid var(--linie); border-left: 4px solid var(--tinte-2); border-radius: var(--r); padding: 12px 14px; margin-bottom: 14px; }
.note.warn { background: var(--warn-bg); border-color: #EBD3A6; border-left-color: var(--warn-bar); }
.note ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- Startseite ---------- */
.hello h1 { font-size: 2.1rem; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 14px 14px 12px; background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--r-lg);
  border-top: 4px solid var(--linie); text-decoration: none; color: inherit; min-height: 98px; }
.tile b { font-family: var(--cond); font-size: 2.1rem; line-height: 1; }
.tile span { font-size: .875rem; color: var(--text-2); line-height: 1.3; }
.tile.tone-ok { border-top-color: var(--ok); }
.tile.tone-warn { border-top-color: var(--warn-bar); }
.tile.tone-krit { border-top-color: var(--krit); } .tile.tone-krit b { color: var(--krit); }
.tile:hover { border-color: var(--tinte-2); }
.dash { display: grid; gap: 0 16px; }
@media (min-width: 1100px) { .dash { grid-template-columns: 1fr 1fr; align-items: start; } .dash > .tiles, .dash > .start { grid-column: 1 / -1; } }
.steps { margin: 6px 0 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 8px; }
@media (min-width: 700px) { .start .steps { grid-template-columns: 1fr 1fr 1fr; } }
.steps li { counter-increment: s; }
.steps li > a, .steps.plain li { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px 12px 48px; position: relative; border: 1px solid var(--linie-2); border-radius: var(--r); text-decoration: none; color: inherit; height: 100%; }
.steps li > a:hover { border-color: var(--tinte-2); }
.steps li::before { content: counter(s); position: absolute; margin: 12px 0 0 14px; width: 24px; height: 24px; border-radius: 50%; background: var(--tinte); color: #fff; font-family: var(--cond); font-weight: 700; display: grid; place-items: center; font-size: .95rem; }
.steps li { position: relative; }
.steps span { color: var(--text-2); font-size: .9rem; }
.steps.plain { gap: 10px; }
.steps.plain .btn { align-self: flex-start; margin-top: 8px; }

.hours-card h2 { margin-bottom: 6px; }
.hours-figure { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.hours-figure b { font-family: var(--cond); font-size: 2.6rem; line-height: 1; }
.hours-figure span { color: var(--text-2); }
.bar { display: block; height: 10px; border-radius: 5px; background: var(--alu); overflow: hidden; margin: 4px 0 8px; }
.bar > span { display: block; height: 100%; background: var(--warn-bar); border-radius: 5px; }
.bar.full > span { background: var(--ok); }
.hours-row .bar { height: 7px; margin: 6px 0 0; max-width: 340px; }
.num.big { font-family: var(--cond); font-size: 1.4rem; }

/* ---------- Detail ---------- */
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.quick:empty { display: none; }
.detail-grid { display: grid; gap: 0 16px; }
@media (min-width: 1000px) { .detail-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; } }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; margin: 0; }
.facts > div { min-width: 0; }
.facts .wide { grid-column: 1 / -1; }
.facts dt { font-size: .82rem; color: var(--text-2); font-weight: 500; }
.facts dd { margin: 1px 0 0; font-weight: 500; overflow-wrap: anywhere; }
@media (max-width: 520px) { .facts { grid-template-columns: 1fr; } }
.roles-help .facts { grid-template-columns: 1fr; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; padding: 14px; }
.file { position: relative; }
.file img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r); border: 1px solid var(--linie-2); display: block; }
.file-doc { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; aspect-ratio: 1; padding: 8px; border: 1px solid var(--linie-2); border-radius: var(--r); text-decoration: none; color: var(--tinte); font-size: .8rem; text-align: center; overflow-wrap: anywhere; }
.file .icon-btn { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; background: rgba(255,255,255,.9); }

/* ---------- Formulare ---------- */
.form fieldset { margin: 0 0 14px; min-width: 0; }
.form legend { float: left; width: 100%; font-weight: 600; font-size: 1.05rem; margin-bottom: 12px; padding: 0; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 14px; clear: both; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
@media (max-width: 560px) { .field.half { grid-column: 1 / -1; } }
.field label, .field .label { font-weight: 600; font-size: .92rem; }
.field.check { flex-direction: row; align-items: center; }
.field.check .help { margin-left: 8px; }
.req { color: var(--krit); }
.help { color: var(--text-2); font-size: .84rem; }
.form-error { color: var(--krit); font-weight: 600; min-height: 1px; margin: 0 0 10px; }
.form-error:empty { display: none; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 20px; }
.spacer { flex: 1; }
.form.compact .grid { margin-bottom: 10px; }
.checklist { display: grid; gap: 6px; }
.checklist label { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--linie-2); border-radius: var(--r); cursor: pointer; font-weight: 500; }
.checklist input { width: 20px; height: 20px; accent-color: var(--ok); }
.result-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 700px) { .result-pick { grid-template-columns: repeat(4, 1fr); } }
.result-pick label { position: relative; }
.result-pick input { position: absolute; opacity: 0; }
.result-pick span { display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 6px 10px; text-align: center; border: 1px solid var(--linie); border-radius: var(--r); font-weight: 600; cursor: pointer; }
.result-pick input:checked + span { border-color: var(--tinte); background: var(--tinte); color: #fff; }
.result-pick input:focus-visible + span { outline: 3px solid var(--tinte); outline-offset: 2px; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.copy { display: flex; gap: 8px; margin: 10px 0; }

.sticky-save { position: sticky; bottom: calc(var(--tab-h) + var(--safe-b) + 8px); z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--tinte); color: #fff; border-radius: var(--r-lg); padding: 10px 10px 10px 18px; margin: 10px 0 20px; }
.sticky-save span { font-weight: 600; }
@media (min-width: 900px) { .sticky-save { bottom: 16px; } }

/* ---------- Anwesenheit ---------- */
.person { display: grid; grid-template-columns: 1fr; gap: 8px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--linie-2); position: relative; }
.person:last-child { border-bottom: 0; }
.person::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 0 3px 3px 0; }
.person.anwesend::before { background: var(--ok); }
.person.entschuldigt::before { background: var(--aus); }
.person-name { display: flex; flex-direction: column; }
.person-name small { color: var(--text-2); }
.person-ctl, .person-more { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill-btn { min-height: 42px; padding: 0 16px; border-radius: 21px; border: 1px solid var(--linie); background: var(--weiss); font: inherit; font-weight: 600; cursor: pointer; color: var(--tinte); }
.pill-btn.yes[aria-pressed=true] { background: var(--ok); border-color: var(--ok); color: #fff; }
.pill-btn.exc[aria-pressed=true] { background: var(--aus); border-color: var(--aus); color: #fff; }
.hrs { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); font-weight: 600; }
.hrs input { width: 76px; min-height: 42px; text-align: right; }
.person:not(.anwesend) .hrs { opacity: .45; }
.person-more select { width: auto; min-width: 150px; min-height: 40px; }
.person:not(.anwesend) .person-more { display: none; }
@media (min-width: 760px) { .person { grid-template-columns: minmax(180px, 1fr) auto; align-items: center; } .person-more { grid-column: 1 / -1; } }

/* ---------- Scanner ---------- */
body.scan-mode { background: var(--tinte); }
body.scan-mode main { color: #fff; }
.scan-page { max-width: 560px; margin: 0 auto; }
.scan-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.scan-top h1 { color: #fff; }
.scan-top .seg { margin: 0; background: var(--tinte-2); border-color: #3A4654; }
.scan-top .seg button { color: #B8C2CC; }
.scan-top .seg .on { background: #fff; color: var(--tinte); }
.scan-stage { position: relative; aspect-ratio: 1; border-radius: var(--r-lg); overflow: hidden; background: #0E1419; }
#reader { width: 100%; height: 100%; }
#reader video { width: 100% !important; height: 100% !important; object-fit: cover; }
#reader__dashboard, #reader img[alt="Info icon"], #qr-shaded-region { display: none !important; }
.scan-frame { position: absolute; inset: 14% 10%; pointer-events: none; }
.scan-frame i { position: absolute; width: 38px; height: 38px; border: 5px solid var(--reflex); }
.scan-frame i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 10px; }
.scan-frame i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 10px; }
.scan-frame i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 10px; }
.scan-frame i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 10px; }
.scan-hint { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; margin: 0; padding: 0 16px; color: #fff; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.scan-stage.nocam { aspect-ratio: 16 / 9; display: grid; place-items: center; }
.scan-stage.nocam .scan-frame { display: none; }
.scan-stage.nocam .scan-hint { position: static; }
.scan-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.manual { display: flex; gap: 8px; flex: 1 1 300px; }
.manual input { background: #fff; }
.scan-tools .btn.ghost { background: var(--tinte-2); color: #fff; border-color: #3A4654; }
.scan-result { color: var(--tinte); border-left: 5px solid var(--linie); }
.scan-result.ok { border-left-color: var(--ok); }
.scan-result.warn { border-left-color: var(--reflex); }
.scan-result.serie { border-left-color: var(--reflex); }
.scan-result .grid { margin: 10px 0; }

/* ---------- Atemschutz-Tabelle ---------- */
.table-wrap { overflow-x: auto; }
.matrix { width: 100%; border-collapse: collapse; font-size: .92rem; }
.matrix th, .matrix td { padding: 10px 12px; border-bottom: 1px solid var(--linie-2); text-align: left; vertical-align: middle; }
.matrix thead th { font-size: .8rem; color: var(--text-2); font-weight: 600; background: var(--alu-2); min-width: 110px; }
.matrix tbody th { font-weight: 600; white-space: nowrap; }
.matrix tbody th a { color: inherit; text-decoration: none; margin-right: 8px; }
.matrix td { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-ok { color: var(--ok); }
.cell-warn { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.cell-krit { background: var(--krit-bg); color: var(--krit); font-weight: 600; }

/* ---------- Statistik ---------- */
.figures { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 800px) { .figures { grid-template-columns: repeat(4, 1fr); } }
.figures > div { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--r-lg); padding: 14px 16px; }
.figures b { display: block; font-family: var(--cond); font-size: 2.4rem; line-height: 1; color: var(--rot); }
.figures span { color: var(--text-2); font-size: .9rem; }
.cols { display: grid; gap: 0 14px; }
@media (min-width: 900px) { .cols { grid-template-columns: 1fr 1fr; align-items: start; } }
table.simple { width: 100%; border-collapse: collapse; }
table.simple th, table.simple td { padding: 7px 0; border-bottom: 1px solid var(--linie-2); text-align: left; }
table.simple th { font-size: .8rem; color: var(--text-2); font-weight: 600; }
table.simple .num { text-align: right; }

/* ---------- Menü ---------- */
.menu-group h2 { font-size: .9rem; color: var(--text-2); margin: 18px 4px 8px; }

/* ---------- Anmeldung ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--alu);
  background-image: repeating-linear-gradient(180deg, transparent 0 46px, rgba(26,34,44,.045) 46px 48px); }
.auth-card { width: 100%; max-width: 400px; background: var(--weiss); border: 1px solid var(--linie); border-radius: 16px; padding: 26px 24px; border-top: 6px solid var(--rot); }
.auth-card.wide { max-width: 560px; }
.auth-card .form .field { margin-bottom: 14px; }
.auth-card .grid .field { margin-bottom: 0; }
.auth-card .grid { margin-bottom: 14px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.auth-brand img, .auth-brand .brand-mark { width: 52px; height: 52px; object-fit: contain; }
.auth-brand small { display: block; color: var(--text-2); }
.auth-brand b { font-family: var(--cond); font-size: 1.5rem; line-height: 1.1; }

/* ---------- Dialog und Hinweis ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; background: rgba(14,20,25,.5); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .modal-wrap { align-items: center; padding: 20px; } }
.modal { width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; background: var(--weiss); border-radius: 16px 16px 0 0; padding-bottom: var(--safe-b); }
@media (min-width: 640px) { .modal { border-radius: 16px; } }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 12px 6px 20px; position: sticky; top: 0; background: var(--weiss); }
.modal-head h2 { font-family: var(--cond); font-size: 1.4rem; font-weight: 700; }
.modal-body { padding: 6px 20px 20px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin: 14px 0 6px; }
.confirm-text { font-size: 1.05rem; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 18px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--tinte); color: #fff; padding: 12px 18px; border-radius: var(--r); font-weight: 600; max-width: calc(100vw - 32px); transition: opacity .2s, transform .2s; border-left: 5px solid var(--ok); }
.toast.krit { border-left-color: var(--krit); }
.toast.neutral { border-left-color: var(--reflex); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 900px) { .toast { bottom: 24px; left: calc(50% + var(--side) / 2); } }
.logo-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.logo-prev { width: 64px; height: 64px; object-fit: contain; border: 1px solid var(--linie-2); border-radius: var(--r); }

/* ---------- Etiketten ---------- */
.sheet { display: grid; grid-template-columns: repeat(auto-fill, 70mm); gap: 4mm; justify-content: start; }
.etikett { width: 70mm; height: 37mm; background: #fff; border: 1px dashed var(--linie); display: flex; align-items: center; gap: 3mm; padding: 3mm; overflow: hidden; }
.etikett svg { width: 29mm; height: 29mm; flex: none; }
.label-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.label-txt small { font-size: 7pt; color: #444; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.label-txt b { font-family: var(--cond); font-size: 12pt; margin: 1mm 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.label-txt .code { margin: 0; align-self: flex-start; font-size: 10pt; }
.label-txt .code:empty { display: none; }
.label-txt .lc { font-size: 7pt; color: #555; margin-top: 1mm; }

@media print {
  @page { size: A4; margin: 15mm 0 0 0; }
  body { background: #fff; }
  .side, .topbar, .tabbar, .no-print, .toast, .back, .head-actions { display: none !important; }
  main { margin: 0 !important; padding: 0 !important; max-width: none; }
  .sheet { grid-template-columns: repeat(3, 70mm); gap: 0; }
  .etikett { border: 0; break-inside: avoid; }
  .panel { break-inside: avoid; border-color: #bbb; }
}

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