/* Arbeitsrapport – Design nach BIS-Vorgaben: Anthrazit #17181C / Gold #F9B223, kein Grün.
   Keine externen Schriften (Datenschutz): lokale Systemschriften, BIS-Schriften werden genutzt, falls installiert. */

:root {
  --anthracite-900: #17181c;
  --anthracite-800: #212329;
  --anthracite-700: #2c2f36;
  --anthracite-600: #3a3e46;
  --anthracite-500: #565a60;
  --gold: #f9b223;
  --gold-light: #ffd35a;
  --gold-bronze: #c9971b;
  --gold-dark: #7a5c15;
  --champagne: #ffe9a8;

  --bg: #f3f1eb;
  --surface: #ffffff;
  --surface-2: #faf9f5;
  --line: #e1ded4;
  --line-strong: #c9c5b8;
  --text: #17181c;
  --text-muted: #565a60;
  --text-on-dark: #eceae4;
  --text-muted-on-dark: #c2c4c8;
  --link: #7a5c15;

  --brand: var(--gold);
  --on-brand: #17181c;

  --danger: #b3261e;
  --danger-bg: #fce9e7;
  --warn: #9a4a05;
  --warn-bg: #fdebd3;
  --info-bg: #ffe9a8;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(23, 24, 28, 0.06), 0 4px 16px rgba(23, 24, 28, 0.06);
  --shadow-lg: 0 12px 40px rgba(23, 24, 28, 0.28);

  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-display: 'Saira Condensed', 'Avenir Next Condensed', 'Arial Narrow', 'Helvetica Neue', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --sidebar-w: 256px;
  --gutter: 24px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

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

a, button, input, select, textarea, label, summary, [role='button'] { touch-action: manipulation; }
html { -webkit-tap-highlight-color: rgba(249, 178, 35, 0.25); scroll-padding-top: 72px; }
dialog.modal, .modal-body, .sidebar { overscroll-behavior: contain; }

h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 600; text-wrap: balance; }
h1, h2 { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.04em; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75em; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { color: var(--anthracite-900); }
code, kbd, .mono { font-family: var(--font-mono); font-size: 0.92em; }
small, .small { font-size: 0.85rem; }
.muted { color: var(--text-muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tabular { font-variant-numeric: tabular-nums; }

:focus-visible {
  outline: 3px solid var(--anthracite-900);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(249, 178, 35, 0.7);
  border-radius: 4px;
}

.noscript-msg { padding: 2rem; }
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 1000;
  background: var(--gold); color: var(--on-brand); padding: 10px 14px; border-radius: var(--radius-sm); font-weight: 600;
}
.skip-link:focus { top: 8px; }

/* ---------- Layout ---------- */

.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

.sidebar {
  background: var(--anthracite-900);
  color: var(--text-on-dark);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; height: 100dvh;
  overflow-y: auto;
  border-right: 1px solid #000;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; text-decoration: none; color: inherit; }
.brand img { width: 40px; height: 44px; object-fit: contain; flex: none; }
.brand-name { font-family: var(--font-display); text-transform: uppercase; letter-spacing: 0.08em; font-size: 1.15rem; line-height: 1.1; }

.bottomnav { display: none; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; flex: 1; }
.nav-group { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: #8b8f96; padding: 16px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--text-on-dark); text-decoration: none; font-weight: 500; min-height: 42px;
}
.nav a:hover { background: var(--anthracite-700); color: #fff; }
.nav a[aria-current='page'] { background: var(--anthracite-700); color: var(--gold); box-shadow: inset 3px 0 0 var(--brand); }
.nav .badge { margin-left: auto; }
.nav a:focus-visible, .sidebar button:focus-visible { outline-color: var(--gold); box-shadow: none; }

.sidebar-foot { padding: 12px 16px 16px; border-top: 1px solid var(--anthracite-700); display: grid; gap: 10px; font-size: 0.85rem; }
.who { display: grid; gap: 1px; }
.who strong { color: #fff; font-weight: 600; }
.who span { color: var(--text-muted-on-dark); }
.sidebar-foot .row { display: flex; gap: 8px; align-items: center; }
.local-note { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--gold); font-size: 0.78rem; font-weight: 600; }
.auth-local { padding-top: 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { padding: var(--gutter); max-width: 1320px; width: 100%; margin: 0 auto; flex: 1; }
.content:focus { outline: none; }

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 20px; }
.page-head .sub { color: var(--text-muted); margin-top: 4px; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.stack { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.stack-sm { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ---------- Karten ---------- */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > .card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card > .card-head h2, .card > .card-head h3 { font-size: 1.05rem; }
.card > .card-body { padding: 18px; }
.card.flat { box-shadow: none; }
.card.accent { border-top: 3px solid var(--brand); }

.stat { padding: 16px 18px; display: grid; gap: 4px; text-decoration: none; color: inherit; }
a.stat:hover { border-color: var(--line-strong); }
.stat .label { color: var(--text-muted); font-size: 0.85rem; }
.stat .value { font-family: var(--font-display); font-size: 2.2rem; line-height: 1; letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.stat .foot { font-size: 0.8rem; color: var(--text-muted); }
.stat.warn { border-left: 4px solid var(--danger); }
.stat.gold { border-left: 4px solid var(--brand); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--surface); color: var(--text); border-color: var(--line-strong);
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--anthracite-500); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn-primary:hover { background: var(--gold-light); border-color: var(--gold-light); color: var(--on-brand); }
.btn-dark { background: var(--anthracite-900); color: #fff; border-color: var(--anthracite-900); }
.btn-dark:hover { background: var(--anthracite-700); color: #fff; border-color: var(--anthracite-700); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #8f1d17; color: #fff; border-color: #8f1d17; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(23, 24, 28, 0.06); border-color: transparent; }
.sidebar .btn { background: transparent; color: var(--text-on-dark); border-color: var(--anthracite-600); min-height: 36px; padding: 6px 12px; }
.sidebar .btn:hover { background: var(--anthracite-700); color: #fff; }
.sidebar .btn-group .btn[aria-pressed='true'] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.auth-foot .btn[aria-pressed='true'] { background: var(--anthracite-900); color: #fff; }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: 0.88rem; }
.btn-icon { padding: 0; width: 40px; }
.btn-sm.btn-icon { width: 32px; }
.btn svg, .icon { flex: none; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn + .btn { margin-left: -1px; }
.btn-group .btn[aria-pressed='true'] { background: var(--anthracite-900); color: #fff; border-color: var(--anthracite-900); }

/* ---------- Formulare ---------- */

.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field > label, .field > .label { font-weight: 600; font-size: 0.88rem; }
.field .req { color: var(--danger); margin-left: 2px; }
.field .hint { font-size: 0.82rem; color: var(--text-muted); }
.field .error { font-size: 0.85rem; color: var(--danger); font-weight: 500; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }

input[type='text'], input[type='email'], input[type='password'], input[type='number'], input[type='date'], input[type='time'],
input[type='search'], input[type='tel'], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 12px; font: inherit; color: var(--text);
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
textarea { min-height: 88px; resize: vertical; line-height: 1.45; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-muted); }
input[type='color'] { width: 56px; height: 40px; padding: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; }
input[type='checkbox'], input[type='radio'] { width: 20px; height: 20px; accent-color: var(--anthracite-900); flex: none; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-weight: 500; cursor: pointer; }
.check input { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 8px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0; min-width: 0; }
legend { font-weight: 600; padding: 0 8px; font-size: 0.9rem; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer; font-weight: 500; background: #fff; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--anthracite-900); color: #fff; border-color: var(--anthracite-900); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--anthracite-900); outline-offset: 2px; box-shadow: 0 0 0 6px rgba(249, 178, 35, 0.7); }

.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0; }
.filters .field { min-width: 150px; }
.filters .field.grow { min-width: 220px; }

/* ---------- Tabellen ---------- */

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.table th { text-align: left; font-weight: 600; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); padding: 10px 14px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: #fffaf0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.actions { text-align: right; white-space: nowrap; }
.table .sub { display: block; color: var(--text-muted); font-size: 0.82rem; }
.table .strike { text-decoration: line-through; color: var(--text-muted); }
.table tfoot td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--line-strong); }

.empty { padding: 40px 20px; text-align: center; color: var(--text-muted); display: grid; gap: 10px; justify-items: center; }
.empty svg { opacity: 0.5; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 0.88rem; color: var(--text-muted); }

/* ---------- Chips, Badges ---------- */

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; background: #e7e5dd; color: var(--anthracite-600); border: 1px solid transparent; }
.chip.draft { background: #e7e5dd; color: var(--anthracite-600); }
.chip.submitted { background: var(--champagne); color: #6b4e0c; }
.chip.approved { background: var(--anthracite-900); color: var(--gold); }
.chip.rejected { background: var(--danger-bg); color: var(--danger); }
.chip.cancelled { background: #fff; color: var(--text-muted); border-color: var(--line-strong); text-decoration: line-through; }
.chip.superseded { background: #fff; color: var(--text-muted); border-color: var(--line-strong); }
.chip.open { background: var(--danger-bg); color: var(--danger); }
.chip.in_progress { background: var(--champagne); color: #6b4e0c; }
.chip.closed { background: var(--anthracite-900); color: var(--gold); }
.chip.low { background: #e7e5dd; color: var(--anthracite-600); }
.chip.medium { background: var(--champagne); color: #6b4e0c; }
.chip.high { background: var(--warn-bg); color: var(--warn); }
.chip.critical { background: var(--danger); color: #fff; }
.chip.info { background: var(--info-bg); color: #6b4e0c; }
.chip.dark { background: var(--anthracite-900); color: var(--gold); }
.chip.outline { background: #fff; border-color: var(--line-strong); color: var(--text-muted); }
.chip.quality { background: #eef0f6; color: #2d3a66; }
.chip.safety { background: var(--warn-bg); color: var(--warn); }
.chip.environment { background: #efe7d5; color: #5a4514; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--brand); color: var(--on-brand); font-size: 0.75rem; font-weight: 700; font-variant-numeric: tabular-nums; }

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

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); }
.notice > svg { margin-top: 2px; }
.notice.info { background: #fff8e3; border-color: var(--gold-bronze); }
.notice.warn { background: var(--warn-bg); border-color: #e3a663; color: #5c2c03; }
.notice.danger { background: var(--danger-bg); border-color: #e8a19c; color: #6a1510; }
.notice.ok { background: var(--anthracite-900); border-color: var(--anthracite-900); color: var(--text-on-dark); }
.notice.ok svg { color: var(--gold); }
.notice strong { display: block; }

/* ---------- Tabs, Key-Value, Zeitachse ---------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-strong); overflow-x: auto; margin-bottom: 16px; }
.tabs button, .tabs a { padding: 10px 16px; border: 0; background: transparent; font: inherit; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; text-decoration: none; white-space: nowrap; min-height: 44px; }
.tabs [aria-selected='true'], .tabs [aria-current='page'] { color: var(--text); border-bottom-color: var(--brand); }
.tabs button:hover, .tabs a:hover { color: var(--text); }

.kv { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--text-muted); font-size: 0.88rem; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--line-strong); margin-left: 6px; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--anthracite-900); }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline .when { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); }
.timeline .what { font-weight: 600; }
.timeline .detail { color: var(--text-muted); font-size: 0.88rem; overflow-wrap: anywhere; }

.bar-list { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 34%) 1fr auto; gap: 12px; align-items: center; font-size: 0.9rem; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 14px; background: #ebe8df; border-radius: 3px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--brand); border-right: 2px solid var(--anthracite-900); min-width: 2px; }
.bar > span.dark { background: var(--anthracite-900); border-right-color: var(--gold); }

.thumbs { display: flex; flex-wrap: wrap; gap: 12px; }
.thumb { width: 132px; display: grid; gap: 6px; font-size: 0.8rem; }
.thumb .frame { width: 132px; height: 100px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.line-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--surface-2); display: grid; gap: 10px; }
.line-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px 12px; align-items: start; }
.line-grid > * { min-width: 0; }
.c-2 { grid-column: span 2; } .c-3 { grid-column: span 3; } .c-4 { grid-column: span 4; } .c-5 { grid-column: span 5; } .c-6 { grid-column: span 6; } .c-8 { grid-column: span 8; } .c-12 { grid-column: 1 / -1; }

/* ---------- Dialog, Toast ---------- */

dialog.modal { border: 0; padding: 0; border-radius: 14px; box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--surface); color: var(--text); overflow: hidden; }
dialog.modal.lg { width: min(820px, calc(100vw - 24px)); }
dialog.modal.sm { width: min(440px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(23, 24, 28, 0.62); }
.modal-inner { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); background: var(--anthracite-900); color: #fff; }
.modal-head h2 { font-size: 1.1rem; color: var(--gold); }
.modal-head .btn { color: #fff; border-color: transparent; background: transparent; }
.modal-head .btn:hover { background: var(--anthracite-700); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }

.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 10px; z-index: 2000; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--anthracite-900); color: #fff; box-shadow: var(--shadow-lg); border-left: 4px solid var(--gold); animation: toast-in 0.18s ease-out; }
.toast.error { border-left-color: #ff6b62; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--anthracite-900); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 48px; }

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

.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; background: var(--anthracite-900); background-image: radial-gradient(circle at 20% 10%, rgba(249, 178, 35, 0.18), transparent 45%), radial-gradient(circle at 90% 90%, rgba(249, 178, 35, 0.1), transparent 40%); }
.auth-card { width: min(440px, 100%); background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.auth-head { background: var(--anthracite-800); padding: 26px 28px 20px; display: flex; align-items: center; gap: 16px; color: var(--text-on-dark); border-bottom: 3px solid var(--gold); }
.auth-head img { width: 52px; height: 58px; object-fit: contain; }
.auth-head h1 { color: #fff; font-size: 1.7rem; }
.auth-head p { margin: 2px 0 0; color: var(--text-muted-on-dark); font-size: 0.85rem; }
.auth-body { padding: 26px 28px 28px; display: grid; gap: 16px; }
.auth-foot { padding: 12px 28px; background: var(--surface-2); border-top: 1px solid var(--line); font-size: 0.8rem; color: var(--text-muted); display: flex; justify-content: space-between; gap: 12px; }
.code-input { font-family: var(--font-mono); font-size: 1.4rem !important; letter-spacing: 0.3em; text-align: center; }
.qr { background: #fff; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); display: inline-block; line-height: 0; }
.qr svg { width: 220px; height: 220px; }
.recovery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; font-family: var(--font-mono); font-size: 1.02rem; padding: 14px 16px; background: var(--surface-2); border: 1px dashed var(--anthracite-500); border-radius: var(--radius-sm); }
.secret { font-family: var(--font-mono); font-size: 1.05rem; letter-spacing: 0.08em; word-break: break-all; background: var(--surface-2); border: 1px solid var(--line); padding: 8px 12px; border-radius: var(--radius-sm); user-select: all; }

/* ---------- Mobil ---------- */

@media (max-width: 1100px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  :root { --gutter: 16px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  /* Mitarbeitende: Hauptaktionen als feste Leiste unten (im Rapportformular ersetzt durch dessen Aktionsleiste) */
  .bottomnav { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed; inset: auto 0 0 0; z-index: 60; background: var(--anthracite-900); border-top: 1px solid #000; padding-bottom: env(safe-area-inset-bottom); }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 60px; padding: 6px 4px; color: var(--text-on-dark); text-decoration: none; font-size: 0.75rem; font-weight: 600; text-align: center; line-height: 1.15; }
  .bottomnav a:hover { background: var(--anthracite-700); color: #fff; }
  .bottomnav a.strong { background: var(--brand); color: var(--on-brand); }
  .bottomnav a[aria-current='page'] { color: var(--gold); box-shadow: inset 0 3px 0 var(--brand); }
  .bottomnav a.strong[aria-current='page'] { color: var(--on-brand); box-shadow: inset 0 3px 0 var(--anthracite-900); }
  .bottomnav a:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
  .has-bottomnav .content { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .has-bottomnav ~ .toasts, body:has(.has-bottomnav) .toasts { bottom: 76px; }
  body:has(.rform-bar) .bottomnav { display: none; }
  body:has(.rform-bar) .has-bottomnav .content { padding-bottom: var(--gutter); }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--anthracite-900); color: #fff; position: sticky; top: 0; z-index: 50; padding-top: max(8px, env(safe-area-inset-top)); }
  .topbar .btn { color: #fff; border-color: var(--anthracite-600); background: transparent; }
  .topbar .brand-name { font-size: 1rem; }
  .topbar img { width: 26px; height: 29px; object-fit: contain; }
  .sidebar { position: fixed; z-index: 100; inset: 0 auto 0 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform 0.2s ease; box-shadow: var(--shadow-lg); }
  .nav-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(23, 24, 28, 0.55); z-index: 90; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .line-grid > * { grid-column: 1 / -1 !important; }
  .line-grid > .half { grid-column: span 6 !important; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dt { margin-top: 8px; }
  .page-head h1 { font-size: 1.5rem; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  input[type='text'], input[type='email'], input[type='password'], input[type='number'], input[type='date'], input[type='time'], input[type='search'], select, textarea { min-height: 46px; font-size: 16px; }

  /* Tabellen werden zu Karten */
  .table.cards thead { display: none; }
  .table.cards, .table.cards tbody, .table.cards tr, .table.cards td { display: block; width: 100%; }
  .table.cards tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table.cards td { border: 0; padding: 3px 0; display: flex; gap: 12px; justify-content: space-between; text-align: right; }
  .table.cards td::before { content: attr(data-label); color: var(--text-muted); font-size: 0.8rem; text-align: left; flex: none; }
  .table.cards td.actions { justify-content: flex-end; }
  .table.cards td.actions::before, .table.cards td[data-label='']::before { content: none; }
  .table.cards tbody tr.clickable:hover td { background: transparent; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-row .bar { grid-column: 1 / -1; order: 3; }
  dialog.modal, dialog.modal.lg, dialog.modal.sm { width: 100vw; max-width: 100vw; max-height: 100dvh; margin: auto 0 0; border-radius: 14px 14px 0 0; }
  .modal-inner { max-height: 100dvh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Druck (Rapport als A4: siehe report-paper.css) ---------- */

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .bottomnav, .print-bar, .toasts, .no-print, .skip-link { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Statusleiste des Offline-Betriebs: Verbindung fehlt oder Rapporte warten im Ausgang */
.netbar { display: flex; align-items: center; gap: 8px; padding: 8px var(--gutter); background: var(--anthracite-900); color: #fff; font-size: 0.88rem; font-weight: 600; text-decoration: none; }
.netbar.hidden { display: none; }
.netbar.is-offline { background: #6b4e0c; }
.netbar a { color: inherit; text-decoration: underline; }
.netbar .grow { flex: 1 1 auto; }
