/* Wehrkontor – Feuerwehr-App
   Hell/Dunkel über data-theme oder Systemeinstellung. Keine externen Schriften (DSGVO). */

:root {
  --red: #c8102e;
  --red-strong: #a50d25;
  --red-soft: #fde8eb;
  --orange: #e8730c;
  --orange-soft: #fff1e3;
  --green: #15803d;
  --green-soft: #e3f6ea;
  --blue: #2563eb;
  --blue-soft: #e6eefe;

  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e3e5ea;
  --border-strong: #cfd3da;
  --text: #15181d;
  --text-2: #4b5260;
  --muted: #7a8190;
  --sidebar: #ffffff;
  --sidebar-text: #2b3039;
  --sidebar-strong: #15181d;
  --sidebar-muted: #7a8190;
  --sidebar-hover: #f1f2f5;
  --sidebar-line: #e3e5ea;
  --sidebar-avatar: #eceef2;
  --shadow: 0 1px 2px rgba(16, 20, 28, .05), 0 2px 8px rgba(16, 20, 28, .05);
  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --red: #ef3b4f; --red-strong: #ff5a6c; --red-soft: #3a1419;
    --orange: #f59a3c; --orange-soft: #3a2611;
    --green: #3ccb72; --green-soft: #12301f;
    --blue: #6b9bff; --blue-soft: #16244a;
    --bg: #0e1014; --surface: #171a20; --surface-2: #1c2027; --border: #272c35; --border-strong: #353b46;
    --text: #e9ebef; --text-2: #b6bcc8; --muted: #858c9a;
    --sidebar: #0b0d10; --sidebar-hover: #1a1e25; --sidebar-text: #c9ced8; --sidebar-strong: #ffffff; --sidebar-muted: #7d8494; --sidebar-line: rgba(255,255,255,.07); --sidebar-avatar: #2c323d; --sidebar-text: #c9ced8; --sidebar-strong: #ffffff; --sidebar-muted: #7d8494; --sidebar-line: rgba(255,255,255,.07); --sidebar-avatar: #2c323d;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --red: #ef3b4f; --red-strong: #ff5a6c; --red-soft: #3a1419;
  --orange: #f59a3c; --orange-soft: #3a2611;
  --green: #3ccb72; --green-soft: #12301f;
  --blue: #6b9bff; --blue-soft: #16244a;
  --bg: #0e1014; --surface: #171a20; --surface-2: #1c2027; --border: #272c35; --border-strong: #353b46;
  --text: #e9ebef; --text-2: #b6bcc8; --muted: #858c9a;
  --sidebar: #0b0d10; --sidebar-hover: #1a1e25; --sidebar-text: #c9ced8; --sidebar-strong: #ffffff; --sidebar-muted: #7d8494; --sidebar-line: rgba(255,255,255,.07); --sidebar-avatar: #2c323d;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); }
.ic { flex: none; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }

/* -------------------------------------------------- App-Layout */
.app { display: grid; grid-template-columns: 268px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-text);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid var(--sidebar-line);
}
.brand { display: flex; gap: 12px; align-items: center; padding: 18px 18px 14px; color: var(--sidebar-strong); text-decoration: none !important; border-bottom: 1px solid var(--sidebar-line); }
.brand-logo { width: 44px; height: 44px; object-fit: contain; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: .95rem; line-height: 1.2; }
.brand-text small { color: var(--sidebar-muted); font-size: .78rem; }
.logo-fallback { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--red); color: #fff; flex: none; }
.logo-fallback.big { width: 52px; height: 52px; }
.nav { padding: 10px 10px 20px; flex: 1; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sidebar-muted); padding: 16px 10px 6px; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--sidebar-text); text-decoration: none !important; font-size: .92rem; }
.nav-item:hover { background: var(--sidebar-hover); color: var(--sidebar-strong); }
.nav-item.active:hover { background: var(--red-strong); color: #fff; }
.nav-item.active { background: var(--red); color: #fff; }
.nav-sub { padding-left: 20px; font-size: .86rem; }
.nav-sub .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; margin: 0 6px 0 4px; }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--sidebar-line); display: flex; flex-wrap: wrap; gap: 6px; }
.sidebar-foot .btn-ghost { color: var(--sidebar-text); border-color: var(--sidebar-line); }
.sidebar-foot .btn-ghost:hover { background: var(--sidebar-hover); }
.me { display: flex; gap: 10px; align-items: center; width: 100%; margin-bottom: 6px; }
.me-text { display: flex; flex-direction: column; min-width: 0; }
.me-text strong { color: var(--sidebar-strong); font-size: .9rem; }
.me-text small { color: var(--sidebar-muted); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--sidebar-avatar); color: var(--sidebar-strong); display: grid; place-items: center; font-weight: 600; font-size: .8rem; flex: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.topbar-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.topbar h1 { font-size: 1.2rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.top-logo { width: 30px; height: 30px; object-fit: contain; }
.topbar-logo .logo-fallback { width: 30px; height: 30px; border-radius: 7px; }
.content { padding: 24px 28px 48px; max-width: 1400px; width: 100%; }
.only-mobile, .icon-btn.only-mobile { display: none; }
.pwa-only, .btn.pwa-only { display: none; }
@media (display-mode: standalone) { .btn.pwa-only { display: inline-flex; } }
.sidebar-backdrop { display: none; }

.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.theme-toggle .when-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .when-dark { display: inline; }
:root[data-theme="dark"] .theme-toggle .when-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .when-dark { display: inline; }
  :root:not([data-theme="light"]) .theme-toggle .when-light { display: none; }
}

/* -------------------------------------------------- Bausteine */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 8px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 16px 20px 0; }
.card.red-top { border-top: 3px solid var(--red); }
.card.orange-top { border-top: 3px solid var(--orange); }

.grid { display: grid; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.cols-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.span-2 { grid-column: span 2; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); text-decoration: none !important; color: var(--text); display: block; }
.stat:hover { border-color: var(--border-strong); }
.stat .label { color: var(--muted); font-size: .82rem; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 2rem; font-weight: 700; line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat.red .value { color: var(--red); }
.stat.orange .value { color: var(--orange); }
.stat.red { border-left: 4px solid var(--red); }
.stat.orange { border-left: 4px solid var(--orange); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 500; font-size: .9rem; cursor: pointer; text-decoration: none !important; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-strong); border-color: var(--red-strong); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--red); border-color: var(--red); background: transparent; }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 5px 10px; font-size: .82rem; }
.btn-lg { padding: 11px 20px; font-size: 1rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-orange { background: var(--orange-soft); color: var(--orange); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-muted { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; font-size: .92rem; }
.alert-success { background: var(--green-soft); border-color: transparent; color: var(--green); }
.alert-error { background: var(--red-soft); border-color: transparent; color: var(--red); }
.alert-warning { background: var(--orange-soft); border-color: transparent; color: var(--orange); }
.alert-info { background: var(--blue-soft); border-color: transparent; color: var(--blue); }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.row-link { cursor: pointer; }
.tbl tr.row-link:hover td { background: var(--surface-2); }
.tbl tr.row-red td:first-child { box-shadow: inset 4px 0 0 var(--red); }
.tbl tr.row-orange td:first-child { box-shadow: inset 4px 0 0 var(--orange); }
.tbl .title { font-weight: 600; color: var(--text); }
.tbl .sub { color: var(--muted); font-size: .8rem; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* Listen */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t { font-weight: 600; display: block; color: var(--text); }
.list .s { color: var(--muted); font-size: .82rem; }
.list li.red { box-shadow: inset 3px 0 0 var(--red); padding-left: 12px; }
.list li.orange { box-shadow: inset 3px 0 0 var(--orange); padding-left: 12px; }
.color-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* Formulare */
.form fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px 18px; margin: 0 0 18px; }
.form legend { font-weight: 600; padding: 0 6px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: .85rem; font-weight: 500; color: var(--text-2); }
label.inline { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
input, select, textarea {
  font: inherit; font-size: .95rem; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 9px 11px; width: 100%; min-width: 0;
}
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--red); }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--red) 35%, transparent); border-color: var(--red); }
textarea { resize: vertical; min-height: 80px; }
textarea.code { font-family: var(--mono); font-size: .8rem; }
.hint { font-size: .78rem; color: var(--muted); font-weight: 400; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters > * { flex: 0 1 auto; }
.filters input[type="search"] { min-width: 220px; }
.filters select { width: auto; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--text-2); border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none !important; font-weight: 500; font-size: .9rem; }
.tabs a.active { color: var(--red); border-color: var(--red); }
.tabs .count { color: var(--muted); font-size: .78rem; margin-left: 4px; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: .92rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg label { flex-direction: row; padding: 5px 10px; cursor: pointer; font-size: .82rem; gap: 4px; border-right: 1px solid var(--border-strong); }
.seg label:last-child { border-right: 0; }
.seg input { display: none; }
.seg label:has(input:checked) { background: var(--surface-2); font-weight: 700; }
.seg label.ok:has(input:checked) { background: var(--green-soft); color: var(--green); }
.seg label.nok:has(input:checked) { background: var(--red-soft); color: var(--red); }

.doc-group { margin-bottom: 14px; }
.doc-group h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.doc { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; font-size: .9rem; }
.doc a.grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }

.qr-box { display: flex; gap: 16px; align-items: center; }
.qr-box .qr { background: #fff; padding: 8px; border-radius: 8px; border: 1px solid var(--border); line-height: 0; }

/* -------------------------------------------------- Anmeldung */
.bare { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; }
.floating { position: absolute; top: 16px; right: 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 720px; }
.auth-head { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
.auth-head h1 { font-size: 1.3rem; margin: 0; }
.auth-head p { margin: 2px 0 0; }
.auth-logo { width: 64px; height: 64px; object-fit: contain; }
.auth-card form { display: grid; gap: 14px; }

/* -------------------------------------------------- Kalender */
.cal-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-toolbar h2 { margin: 0; font-size: 1.15rem; min-width: 180px; }
.seg-btns { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; }
.seg-btns button { border: 0; background: var(--surface); color: var(--text); padding: 7px 14px; font: inherit; font-size: .88rem; cursor: pointer; border-right: 1px solid var(--border-strong); }
.seg-btns button:last-child { border-right: 0; }
.seg-btns button.active { background: var(--red); color: #fff; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .8rem; color: var(--text-2); margin-top: 12px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }

.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cal-month .dow { padding: 8px; font-size: .75rem; text-transform: uppercase; color: var(--muted); font-weight: 600; background: var(--surface-2); border-bottom: 1px solid var(--border); text-align: center; }
.cal-day { min-height: 112px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 4px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.other { background: var(--surface-2); }
.cal-day.other .num { color: var(--muted); }
.cal-day .num { font-size: .8rem; font-weight: 600; padding: 2px 4px; align-self: flex-start; border-radius: 6px; }
.cal-day.today .num { background: var(--red); color: #fff; }
.cal-day:hover { background: var(--surface-2); }
.ev { display: block; font-size: .74rem; line-height: 1.3; padding: 2px 6px; border-radius: 5px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none !important; cursor: pointer; border-left: 3px solid rgba(0,0,0,.18); }
.ev.overdue { background: var(--red) !important; box-shadow: 0 0 0 1px var(--red); font-weight: 700; }
.ev.soon { box-shadow: inset 0 0 0 2px var(--orange); }
.ev.done { opacity: .5; text-decoration: line-through !important; }
.ev.frist::before { content: "⚑ "; }
.more { font-size: .72rem; color: var(--muted); padding: 0 6px; }

.cal-week { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cw-head, .cw-allday, .cw-body { display: grid; grid-template-columns: 56px repeat(var(--days, 7), minmax(0, 1fr)); }
.cw-head > div { padding: 8px 6px; text-align: center; font-size: .8rem; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
.cw-head > div:first-child { border-left: 0; cursor: default; }
.cw-head .d { display: block; font-size: 1.1rem; font-weight: 700; }
.cw-head .today .d { color: var(--red); }
.cw-allday > div { border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 3px; min-height: 30px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cw-allday > div:first-child { border-left: 0; font-size: .7rem; color: var(--muted); padding: 6px 4px; }
.cw-body { position: relative; max-height: 640px; overflow-y: auto; }
.cw-times > div { height: 48px; font-size: .7rem; color: var(--muted); text-align: right; padding: 2px 6px 0 0; border-bottom: 1px solid transparent; }
.cw-col { position: relative; border-left: 1px solid var(--border); min-width: 0; }
.cw-col .slot { height: 48px; border-bottom: 1px solid var(--border); }
.cw-col .slot:nth-child(odd) { border-bottom-style: dashed; }
.cw-col .tev { position: absolute; left: 3px; right: 3px; border-radius: 6px; padding: 3px 6px; font-size: .74rem; color: #fff; overflow: hidden; line-height: 1.25; cursor: pointer; border-left: 3px solid rgba(0,0,0,.2); }
.cw-col .tev small { display: block; opacity: .85; }
.cw-col.today { background: color-mix(in srgb, var(--red) 4%, transparent); }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 3; }

/* Dialog */
dialog { border: 1px solid var(--border); border-radius: 14px; padding: 0; background: var(--surface); color: var(--text); width: min(560px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(10, 12, 16, .55); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.dlg-head h2 { margin: 0; }
.dlg-body { padding: 18px 20px; display: grid; gap: 12px; }
.dlg-foot { display: flex; justify-content: space-between; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* -------------------------------------------------- Scanner */
.scan-wrap { max-width: 640px; margin: 0 auto; }
#reader { width: 100%; border-radius: var(--radius); overflow: hidden; background: #000; min-height: 260px; }
#reader video { border-radius: var(--radius); }
.scan-result { margin-top: 16px; }
.scan-mode { display: flex; gap: 8px; margin-bottom: 14px; }
.scan-mode label { flex: 1; flex-direction: row; justify-content: center; align-items: center; gap: 8px; border: 1px solid var(--border-strong); border-radius: 10px; padding: 12px; cursor: pointer; background: var(--surface); font-weight: 600; color: var(--text); }
.scan-mode input { display: none; }
.scan-mode label:has(input:checked) { border-color: var(--red); background: var(--red-soft); color: var(--red); }

/* -------------------------------------------------- Druck: Etiketten & Protokoll */
.print-only { display: none; }
.labels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.label-card { border: 1px dashed #999; border-radius: 6px; padding: 8px; display: flex; gap: 8px; align-items: center; background: #fff; color: #000; break-inside: avoid; page-break-inside: avoid; }
.label-card .qr { line-height: 0; flex: none; }
.label-card .txt { font-size: 10px; line-height: 1.3; min-width: 0; }
.label-card .txt strong { font-size: 11.5px; display: block; }
.label-card .org { font-size: 8.5px; color: #444; display: flex; gap: 4px; align-items: center; margin-bottom: 2px; }
.label-card .org img { width: 14px; height: 14px; object-fit: contain; }

.protokoll { background: #fff; color: #111; max-width: 820px; margin: 0 auto; padding: 36px 40px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.protokoll h1 { font-size: 20px; margin: 0; }
.protokoll .p-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 3px solid #c8102e; padding-bottom: 14px; margin-bottom: 18px; }
.protokoll .p-org { display: flex; gap: 12px; align-items: center; }
.protokoll .p-org img { width: 64px; height: 64px; object-fit: contain; }
.protokoll .p-org .n { font-weight: 700; font-size: 15px; }
.protokoll .p-org .a { color: #555; font-size: 11.5px; }
.protokoll .p-meta { text-align: right; font-size: 11.5px; color: #555; }
.protokoll h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: #c8102e; margin: 20px 0 8px; }
.protokoll table { width: 100%; border-collapse: collapse; }
.protokoll td, .protokoll th { border: 1px solid #ccc; padding: 6px 8px; text-align: left; vertical-align: top; }
.protokoll th { background: #f4f4f4; width: 28%; font-weight: 600; }
.protokoll .result { display: inline-block; padding: 4px 12px; border-radius: 4px; font-weight: 700; border: 2px solid; }
.protokoll .r-bestanden { color: #15803d; }
.protokoll .r-maengel { color: #c2410c; }
.protokoll .r-nicht_bestanden { color: #c8102e; }
.protokoll .sig { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 46px; }
.protokoll .sig div { border-top: 1px solid #333; padding-top: 6px; font-size: 11px; color: #444; }
.protokoll .foot { margin-top: 30px; font-size: 10px; color: #777; display: flex; justify-content: space-between; }

@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff !important; color: #000; }
  .sidebar, .topbar, .no-print, .sidebar-backdrop { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  .print-only { display: block; }
  .protokoll { border: 0; padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .labels { gap: 6px; }
}

/* -------------------------------------------------- Responsiv */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cols-main { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 50; transform: translateX(-100%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; }
  .only-mobile, .icon-btn.only-mobile { display: inline-grid; }
  .topbar { padding: 10px 16px; }
  .topbar h1 { font-size: 1.05rem; }
  .content { padding: 16px 16px 40px; }
  .cols-2, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .labels { grid-template-columns: repeat(2, 1fr); }
  .cal-day { min-height: 76px; }
  .cal-day .ev { font-size: .66rem; padding: 1px 4px; }
  .protokoll { padding: 18px; }
  .protokoll .p-head { flex-direction: column; }
  .protokoll .p-meta { text-align: left; }
  /* Tabellen als Karten */
  table.tbl.stack thead { display: none; }
  table.tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; width: 100%; }
  .tbl.stack tr { border-bottom: 1px solid var(--border); padding: 10px 14px; }
  .tbl.stack td { border: 0; padding: 2px 0; }
  .tbl.stack td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-size: .78rem; font-family: var(--font); }
  .tbl.stack tr.row-red, .tbl.stack tr.row-orange { box-shadow: inset 4px 0 0 var(--red); }
  .tbl.stack tr.row-orange { box-shadow: inset 4px 0 0 var(--orange); }
  .tbl.stack tr td:first-child { box-shadow: none; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .value { font-size: 1.6rem; }
  .cal-month .dow { font-size: .65rem; padding: 6px 2px; }
  .cal-day { min-height: 64px; padding: 2px; }
  .cal-day .ev { font-size: 0; height: 6px; padding: 0; border: 0; }
  .topbar-actions .btn span.lbl { display: none; }
  .labels { grid-template-columns: 1fr; }
}

/* Passwortfeld mit Auge */
.pw-wrap { position: relative; display: block; width: 100%; }
.pw-wrap input { width: 100%; padding-right: 46px; }
.pw-auge { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.pw-auge:hover { color: var(--text); background: var(--surface-2); }
.pw-auge.an { color: var(--red); }
.pw-auge:focus-visible { outline: 2px solid var(--red); }
input::-ms-reveal, input::-ms-clear { display: none; }

/* Kameraden-Kalender: Liste, Rückmeldungen */
.cal-liste { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.cl-tag { padding: 8px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: .85rem; color: var(--text-2); position: sticky; top: 0; }
.cl-tag.heute { color: var(--red); }
.cl-ev { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); text-align: left; font: inherit; cursor: pointer; width: 100%; }
.cl-ev:hover { background: var(--surface-2); }
.cl-ev.overdue { box-shadow: inset 4px 0 0 var(--red); }
.cl-ev.done { opacity: .55; }
.cl-zeit { width: 96px; flex: none; font-variant-numeric: tabular-nums; color: var(--text-2); font-size: .88rem; }
.cl-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cl-txt strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-txt small { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-rm { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.rm-box { margin-top: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; display: grid; gap: 8px; }
.rm-gruppe { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.rsvp.active { outline: 2px solid currentColor; outline-offset: 1px; font-weight: 700; }
.rsvp-zu { color: var(--green); }
.rsvp-vielleicht { color: var(--orange); }
.rsvp-ab { color: var(--red); }
.rsvp-zu.active { background: var(--green-soft); }
.rsvp-vielleicht.active { background: var(--orange-soft); }
.rsvp-ab.active { background: var(--red-soft); }
@media (max-width: 600px) {
  .cl-ev { flex-wrap: wrap; row-gap: 4px; }
  .cl-zeit { width: 64px; font-size: .8rem; }
  .cl-txt { flex: 1 1 calc(100% - 110px); }
  .cl-txt strong { white-space: normal; }
  .cl-rm { flex-basis: 100%; flex-direction: row; align-items: center; gap: 8px; padding-left: 98px; }
  .cal-toolbar .btn-row { width: 100%; }
  .cal-toolbar select { flex: 1; }
}

/* Glocke / Benachrichtigungen */
.bell { position: relative; }
.bell .bell-n { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center; }
.notif { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.notif:last-child { border-bottom: 0; }
.notif.neu .notif-t { font-weight: 700; }
.notif .notif-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--red); margin-top: 7px; flex: none; }
.notif:not(.neu) .notif-dot { background: var(--border-strong); }

/* Anleitungen */
ol.anleitung { padding-left: 22px; margin: 6px 0 16px; display: grid; gap: 8px; }
ol.anleitung li::marker { color: var(--red); font-weight: 700; }
[data-panel] h3 { margin-top: 6px; }

/* Atemschutztauglichkeit */
.agt-ja { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-weight: 800; }
.agt-nein { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--red-soft); color: var(--red); font-weight: 800; }
.agt-tbl td { vertical-align: top; }
.agt-tbl th, .agt-tbl td { padding: 10px 8px; }
.agt-tbl th { white-space: normal; font-size: .7rem; line-height: 1.25; }
.agt-tbl td:nth-child(2) { min-width: 150px; }
.agt-tbl .title { white-space: nowrap; }
.agt-tbl td:nth-child(7), .agt-tbl td:nth-child(8) { text-align: center; }
.agt-tbl td .badge { margin-top: 3px; }
tr.agt-inaktiv td { opacity: .6; }
.agt-fs { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 0; }
.agt-fs legend { font-size: .82rem; font-weight: 600; padding: 0 4px; }
.seg.seg-gross { width: max-content; }
.seg.seg-gross label { padding: 8px 14px; font-size: .9rem; }
.sammel-leiste { gap: 8px; }
@media (max-width: 860px) { .sammel-leiste { width: 100%; } .sammel-leiste select, .sammel-leiste input { flex: 1; } }
@media print {
  .agt-tbl th:first-child, .agt-tbl td:first-child { display: none; }
  .agt-tbl { font-size: 11px; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .badge { border: 1px solid currentColor; }
}

/* App-Installation */
.install-banner { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; border-left: 4px solid var(--red); }
.install-banner.hidden { display: none; }
.install-icon { width: 52px; height: 52px; border-radius: 12px; flex: none; }
@media (display-mode: standalone) {
  .topbar { padding-top: max(10px, env(safe-area-inset-top)); }
}

/* Online-Status, Einladung */
.online-punkt { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); flex: none; vertical-align: middle; }
.online-punkt.an { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.online-zeile { display: inline-flex; align-items: center; gap: 6px; }
.pw-staerke { height: 5px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.pw-staerke span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.einladung-box { border: 1px dashed var(--border-strong); border-radius: 10px; padding: 12px; margin-top: 12px; display: grid; gap: 8px; }

/* Verbesserungsvorschläge (1.7) */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: .72rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.nav-item.active .nav-badge { background: #fff; color: var(--red); }
.vorschlag-grid { grid-template-columns: 1.4fr 1fr; align-items: start; }
.vorschlag-filter { margin-bottom: 8px; }
.vorschlag-filter select { max-width: 320px; }
.vorschlag-liste { display: flex; flex-direction: column; }
.vorschlag-zeile { display: flex; gap: 12px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid var(--border); color: inherit; text-decoration: none !important; border-radius: 6px; }
.vorschlag-zeile:last-child { border-bottom: 0; }
.vorschlag-zeile:hover { background: var(--surface-2); }
.vorschlag-zeile .notif-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); margin-top: 7px; flex: none; }
.vorschlag-zeile.neu .notif-dot { background: var(--red); }
.vorschlag-zeile:not(.neu) strong { font-weight: 600; }
.vz-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.vz-text strong { overflow-wrap: anywhere; }
.vz-status { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.vorschlag-kopf { margin-bottom: 14px; }
.vorschlag-kopf h2 { overflow-wrap: anywhere; }
.verlauf { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.nachricht { max-width: 85%; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.nachricht.von-admin { align-self: flex-end; background: var(--red-soft); border-color: transparent; }
.nachricht-kopf { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.nachricht-loeschen { margin-left: auto; }
.nachricht-text { overflow-wrap: anywhere; line-height: 1.5; }
.icon-btn-sm { width: 30px; height: 30px; }
.antwort-form { border-top: 1px solid var(--border); padding-top: 14px; }
.antwort-leiste { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.antwort-leiste select { width: auto; }
@media (max-width: 900px) { .vorschlag-grid { grid-template-columns: 1fr; } .nachricht { max-width: 100%; } }
.vorschlag-hinweis { display: flex; align-items: center; gap: 10px; text-decoration: none !important; color: inherit; }

/* Brother-Etikettendrucker (1.8) */
.brother-layout { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 14px; align-items: start; }
.brother-einst h2 { display: flex; align-items: center; gap: 8px; }
.bl-check { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin: 4px 0 14px; }
.bl-check label { font-size: .88rem; }
.bl-hilfe { margin-top: 12px; font-size: .88rem; }
.bl-hilfe summary { cursor: pointer; font-weight: 600; }
.bl-hilfe ol, .bl-ol { padding-left: 20px; margin: 8px 0 0; display: grid; gap: 6px; line-height: 1.45; }
.bl-vorschau { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.bl-etikett { margin: 0; display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.bl-etikett img { display: block; max-width: 100%; height: auto; background: #fff; border-radius: 4px; box-shadow: 0 0 0 1px var(--border-strong), 0 2px 6px rgba(0,0,0,.12); image-rendering: auto; }
.bl-etikett figcaption { font-size: .78rem; color: var(--muted); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ptouch-grid { align-items: start; }
.ptouch-grid code { font-size: .82rem; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
#brother-druck { display: none; }
@media print {
  body.bl-druck > *:not(#brother-druck) { display: none !important; }
  body.bl-druck { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  body.bl-druck #brother-druck { display: block; }
  #brother-druck .bl-seite { overflow: hidden; page-break-after: always; break-after: page; }
  #brother-druck .bl-seite:last-child { page-break-after: auto; break-after: auto; }
  #brother-druck img { width: 100%; height: 100%; display: block; }
}
@media (max-width: 900px) { .brother-layout { grid-template-columns: 1fr; } }

/* Organisation wechseln (1.9) */
.org-wechsel { padding: 0 14px 10px; border-bottom: 1px solid var(--sidebar-line); }
.org-wechsel select { width: 100%; font-size: .85rem; padding: 7px 10px; background: var(--sidebar-hover, var(--surface-2)); color: var(--sidebar-strong, var(--text)); border-color: var(--sidebar-line); }
.feld-stapel { display: grid; gap: 12px; align-content: start; }

/* Fahrzeuge (1.9) */
.fz-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-bottom: 14px; }
.fz-karte { display: flex; flex-direction: column; gap: 12px; color: inherit; text-decoration: none !important; border-left: 4px solid var(--green); transition: box-shadow .15s; margin: 0; }
.fz-karte:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.fz-karte.fz-ueberfaellig { border-left-color: var(--red); }
.fz-karte.fz-bald { border-left-color: var(--orange); }
.fz-karte.fz-none { border-left-color: var(--border-strong); }
.fz-kopf { display: flex; align-items: center; gap: 12px; }
.fz-kopf > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fz-icon { width: 46px; height: 46px; border-radius: 12px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; flex: none; }
.fz-name { font-size: 1.1rem; }
.kennzeichen { font-family: var(--mono); font-weight: 700; font-size: .82rem; padding: 3px 8px 3px 14px; border: 2px solid #111; border-radius: 4px; background: #fff linear-gradient(90deg, #1d4ed8 0 9px, transparent 9px); color: #111; white-space: nowrap; letter-spacing: .03em; }
.fz-fristen { display: flex; flex-wrap: wrap; gap: 6px; }
.fz-frist { display: inline-flex; flex-direction: column; padding: 5px 9px; border-radius: 8px; font-size: .72rem; line-height: 1.25; background: var(--green-soft); color: var(--green); }
.fz-frist strong { font-size: .82rem; }
.fz-frist.fz-ueberfaellig { background: var(--red-soft); color: var(--red); }
.fz-frist.fz-bald { background: var(--orange-soft); color: var(--orange); }
.fz-fuss { border-top: 1px solid var(--border); padding-top: 10px; }
.fz-daten { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 28px; }
.fz-fach { font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 6px; }
.fz-fach:first-of-type { margin-top: 4px; }
.fz-beladung td { padding: 7px 10px; }
.fz-fristliste { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 8px; }
.fz-fristliste li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; border-left: 3px solid var(--green); background: var(--surface-2); }
.fz-fristliste li.fz-ueberfaellig { border-left-color: var(--red); }
.fz-fristliste li.fz-bald { border-left-color: var(--orange); }
.fz-geraete { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.fz-geraete li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fz-geraete li a { flex: 1; min-width: 120px; }
.bl-edit { display: inline-block; position: relative; }
.bl-edit summary { list-style: none; }
.bl-edit summary::-webkit-details-marker { display: none; }
.bl-edit-form { position: absolute; right: 0; top: 34px; z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.15); display: grid; gap: 6px; width: 260px; }
@media (max-width: 700px) { .fz-daten { grid-template-columns: 1fr; } .fz-grid { grid-template-columns: 1fr; } }
@media print { .fz-karte { break-inside: avoid; } .bl-edit, .fz-beladung .no-print { display: none !important; } }

/* Prüfprotokoll-Archiv (1.9) */
.pa-jahr { margin-bottom: 22px; }
.pa-jahr-titel { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 10px; font-size: 1.3rem; }
.pa-monat { margin-bottom: 10px; overflow: hidden; }
.pa-monat > summary { display: flex; align-items: center; gap: 10px; padding: 14px 18px; cursor: pointer; list-style: none; font-weight: 600; }
.pa-monat > summary::-webkit-details-marker { display: none; }
.pa-monat > summary::before { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; margin-right: 4px; }
.pa-monat[open] > summary::before { transform: rotate(45deg); }
.pa-monat[open] > summary { border-bottom: 1px solid var(--border); }
.pa-monat-name { flex: 1; }

/* Brother: Etikett direkt von der Geräteseite (1.9) */
.brother-schnell { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }
.brother-schnell-bild img { display: block; max-width: 100%; height: auto; margin: 0 auto 10px; border-radius: 4px; box-shadow: 0 0 0 1px var(--border-strong); background: #fff; }
.btn-block { width: 100%; justify-content: center; }
.fz-dl { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
