/* Corporate Design B „Modern & technisch“, Zwilling von Punchify: Space Grotesk für Überschriften, IBM Plex Sans für Text
   (OFL, selbst gehostet). Farben stehen nur in brand.css; hier werden ausschließlich Variablen verwendet. */
@font-face { font-family: "IBM Plex Sans"; src: url("/static/fonts/ibm-plex-sans-400.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/static/fonts/ibm-plex-sans-500.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/static/fonts/ibm-plex-sans-600.woff") format("woff"); font-weight: 600 900; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("/static/fonts/space-grotesk-500.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("/static/fonts/space-grotesk-700.woff") format("woff"); font-weight: 600 900; font-display: swap; }
:root {
  --radius: 10px;
  --font-head: "Space Grotesk", "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2, h3, .brand { font-family: var(--font-head); }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
[hidden] { display: none !important; }
h1, h2 { margin: 0 0 12px; letter-spacing: -0.01em; }
h1 { font-size: 24px; }
h2 { font-size: 17px; }
a { color: var(--accent-text); text-underline-offset: 3px; }

/* ---------- Hinweise und Banner ---------- */
.lic-banner { padding: 12px 20px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; border-bottom: 1px solid var(--line); }
.lic-banner.info { background: var(--info-bg); color: var(--info-ink); }
.lic-banner.warning { background: var(--warn-bg); color: var(--warn-ink); }
.lic-banner.critical { background: var(--crit-bg); color: var(--crit-ink); }
.lic-banner span:empty { display: none; }
.lic-banner a { color: inherit; }
.banner { background: var(--accent); color: var(--accent-ink); text-align: center; padding: 8px 16px; font-size: 14px; font-weight: 600; }

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.brand .dot { width: 24px; height: 24px; background: url("/static/favicon.svg") center / contain no-repeat; flex: none; }
a.brand { color: var(--text); text-decoration: none; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }

/* ---------- Anmeldung ---------- */
.corner { position: absolute; top: 12px; right: 12px; }
.login { min-height: 90vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 12px; }
.login-card .brand { margin-bottom: 8px; }
.login-card .brand .theme-toggle { margin-left: auto; }

/* ---------- Formulare und Knöpfe ---------- */
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 15px; min-height: 32px; }
label.inline { display: flex; align-items: center; gap: .4rem; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; margin: 2px; flex: none; accent-color: var(--accent); }
.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 10px; padding: 9px 16px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.big { font-size: 18px; padding: 14px 26px; border-radius: 14px; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.danger, .btn.danger:hover { background: var(--danger); border-color: var(--danger); color: var(--danger-btn-ink); }
.danger-text { color: var(--danger-ink); }
.error { color: var(--danger-ink); min-height: 1em; margin: 0; font-size: 14px; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }
.req { color: var(--danger-ink); font-weight: 700; }
.required-legend { margin: 0 0 6px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: 8px; top: -60px; z-index: 50; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 8px; font-weight: 600; }
.skip:focus { top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Kopfzeile und Navigation ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.topbar .brand, .topbar .user { flex: none; }
.brand .company-name { font-weight: 500; color: var(--muted); font-size: 14px; margin-left: 4px; }
.brand .company-name:not(:empty)::before { content: "·"; margin-right: 6px; }
.company-logo { height: 32px; max-width: 120px; width: auto; object-fit: contain; border-radius: 6px; vertical-align: middle; margin-right: 8px; }
.tabs { display: flex; flex-wrap: nowrap; gap: 4px; flex: 1 1 auto; min-width: 0; overflow-x: auto; justify-content: safe center; scrollbar-width: thin; }
.tabs button, .tabs a { font: inherit; font-weight: 600; border: 0; background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 10px; cursor: pointer; white-space: nowrap; flex: none; text-decoration: none; }
.tabs button:hover, .tabs a:hover { color: var(--text); }
.tabs button.active, .tabs a.active { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.topbar.many .tabs { order: 3; flex-basis: 100%; justify-content: flex-start; }
.user { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.user select { font: inherit; font-size: 13px; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.user-btn { font-weight: 500; color: var(--muted); }
.user-btn.active { color: var(--text); background: var(--bg); }
#help-link { text-decoration: none; }
a.help-link { font-weight: 600; }
.theme-toggle { min-width: 44px; min-height: 44px; padding: 0 10px; font-size: 20px; line-height: 1; cursor: pointer; }
.menu-toggle { display: none; }
.content { max-width: 960px; margin: 24px auto; padding: 0 16px; }
.content.wide { max-width: 1180px; }
.content:focus { outline: none; }
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 24px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.row.end { justify-content: flex-end; }
.row.wrap { flex-wrap: wrap; }
.row h2 { margin: 0; }
.col { display: flex; flex-direction: column; gap: 8px; }
.row.col { align-items: stretch; }

/* Verwaltung: zweite Ebene der Navigation */
.admin { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 20px; align-items: start; }
.subnav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 12px; }
.subnav a { display: block; padding: 8px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; text-decoration: none; }
.subnav a:hover { color: var(--text); }
.subnav a[aria-current="page"] { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.admin-body { min-width: 0; }
.admin-body > .card:last-child { margin-bottom: 0; }

/* ---------- Tabellen, Listen, Kennzeichen ---------- */
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th[scope="row"] { color: var(--text); font-size: inherit; font-weight: 500; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 6px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
table.table:focus-visible { outline-offset: -2px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.dim td { opacity: .6; }
.table-wrap { overflow-x: auto; position: relative; }   /* position: absolut gesetzte sr-only-Texte in Tabellen dürfen die Seite nicht verbreitern */
.table { position: relative; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); }
.pill.badge { margin-left: 8px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-text); }
.pill.ok { background: var(--status-ok-bg); color: var(--status-ok-ink); }
.pill.warn, .pill.danger { background: var(--status-overdue-bg); color: var(--status-overdue-ink); }
td .pill + .pill { margin-left: 4px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.grid-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: .5rem 1rem; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; }
.break-all { word-break: break-all; }
.empty { color: var(--muted); }
.unreadable { color: var(--muted); font-style: italic; }
.is-locked input:disabled { cursor: not-allowed; }
ul.plain { list-style: none; padding: 0; margin: .4rem 0 .8rem; display: grid; gap: .3rem; }
.levels li { margin: .3rem 0; }
.integrity:empty { display: none; }
.integrity { margin-bottom: 1rem; }
.filters { flex-wrap: wrap; gap: .5rem 1rem; margin: .5rem 0 1rem; }
.filters input[type=search] { min-width: 16rem; flex: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 13px; }
.rule { gap: .5rem; align-items: center; flex-wrap: wrap; }
.rule input.num, input.num { width: 5.5rem; flex: none; }
.notice-warn { border-left: 4px solid var(--status-soon); padding: .4rem .7rem; background: var(--status-soon-bg); color: var(--status-soon-ink); }
.warn-card { border-color: var(--status-soon); background: var(--status-soon-bg); }
.features { display: grid; gap: 10px; margin: 8px 0 16px; }
.feature.soon span { color: var(--muted); }
form.card > label { margin-bottom: 14px; }
form.card h3 { margin: 18px 0 4px; font-size: 15px; }

/* ---------- Fälligkeitsstatus (D6): immer Text und Symbol, nie nur Farbe ---------- */
.status { --s-c: var(--status-paused); --s-bg: var(--status-paused-bg); --s-ink: var(--status-paused-ink); --s-icon: url("/static/icons/status-paused.svg");
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 99px; border: 1px solid var(--s-c);
  background: var(--s-bg); color: var(--s-ink); font-size: 13px; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.status-icon { width: 14px; height: 14px; flex: none; background: var(--s-c); -webkit-mask: var(--s-icon) center / contain no-repeat; mask: var(--s-icon) center / contain no-repeat; }
.status-overdue { --s-c: var(--status-overdue); --s-bg: var(--status-overdue-bg); --s-ink: var(--status-overdue-ink); --s-icon: url("/static/icons/status-overdue.svg"); }
.status-soon { --s-c: var(--status-soon); --s-bg: var(--status-soon-bg); --s-ink: var(--status-soon-ink); --s-icon: url("/static/icons/status-soon.svg"); }
.status-ok { --s-c: var(--status-ok); --s-bg: var(--status-ok-bg); --s-ink: var(--status-ok-ink); --s-icon: url("/static/icons/status-ok.svg"); }
.status-done { --s-c: var(--status-ok); --s-bg: var(--status-ok-bg); --s-ink: var(--status-ok-ink); --s-icon: url("/static/icons/status-done.svg"); }
.status-paused { --s-icon: url("/static/icons/status-paused.svg"); }
.status-void { --s-icon: url("/static/icons/status-void.svg"); }
.status-list { display: flex; flex-wrap: wrap; gap: 8px 12px; list-style: none; margin: 8px 0 0; padding: 0; }
@media (forced-colors: active) { .status-icon { background: CanvasText; } }

/* ---------- Cockpit ---------- */
.page-head { margin-bottom: 16px; }
.page-head h1 { margin-bottom: 4px; }
.cockpit-empty { text-align: center; padding: 40px 20px; }
.cockpit-empty .mark { width: 56px; height: 56px; margin: 0 auto 12px; background: url("/static/logo.svg") center / contain no-repeat; }
.cockpit-empty h2 { font-size: 22px; margin-bottom: 8px; }
.cockpit-empty p { max-width: 36rem; margin: 0 auto 16px; color: var(--muted); }
.cockpit-legend h2 { font-size: 15px; }

/* ---------- Dialog, Hinweis (Toast) ---------- */
.dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: 0; background: var(--surface); color: var(--text); width: min(520px, calc(100vw - 32px)); }
.dialog.wide { width: min(720px, calc(100vw - 32px)); }
.dialog::backdrop { background: var(--overlay); }
.dialog-inner { padding: 22px; display: flex; flex-direction: column; gap: 12px; max-height: 85vh; overflow-y: auto; }
.dialog-inner h2 { margin: 0 0 4px; }
.dialog-inner label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
.dialog-inner label.check { flex-direction: row; align-items: center; color: var(--text); font-size: 15px; }
.checklist { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; }
.checklist legend { font-size: 13px; color: var(--muted); padding: 0 4px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 10px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
#demo-hint { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
#demo-hint p { width: 100%; margin: 4px 0 0; }

/* ---------- Anmeldung, Sicherheit ---------- */
.login-alt { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.login-alt .btn[hidden] { display: none; }
img.qr { width: 200px; height: 200px; background: var(--qr-bg); padding: 6px; border-radius: 8px; align-self: center; }
code.secret { font-size: 15px; letter-spacing: .05em; user-select: all; }
pre.codes { font-size: 15px; line-height: 1.7; columns: 2; background: var(--bg); padding: 10px 14px; border-radius: 8px; user-select: all; }
.logo-preview { max-height: 64px; max-width: 160px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: var(--bg); }

/* ---------- API-Dokumentation, OAuth ---------- */
.docs { max-width: 980px; }
.docs pre.code, pre.code { background: var(--bg); padding: 12px 14px; border-radius: 10px; overflow-x: auto; font-size: 13px; }
.endpoint { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.endpoint h3 { font-size: 16px; margin: 0 0 6px; }
.verb { display: inline-block; min-width: 56px; text-align: center; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 6px; background: var(--bg); color: var(--accent-text); }
.verb.post { color: var(--status-ok-ink); }

/* ---------- Tresor-Assistent, Statusseite, Support-Zugang ---------- */
.steps { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0; margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.steps li { display: inline-flex; align-items: center; gap: 6px; }
.steps li.current { color: var(--text); font-weight: 600; }
.steps li.done { color: var(--status-ok-ink); }
.step-no { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid currentColor; font-size: 12px; font-variant-numeric: tabular-nums; }
.steps li.current .step-no { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.wizard h2:focus { outline: none; }
.wizard h2:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
ul.bullets { margin: 0 0 8px; padding-left: 1.2rem; display: grid; gap: 6px; }
ul.bullets li.strong { font-weight: 600; }
.recovery-key { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 4px 0; padding: 14px 16px; border: 1px dashed var(--line); border-radius: 10px; background: var(--bg); font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 20px; letter-spacing: .04em; user-select: all; }
.recovery-key .grp { white-space: nowrap; }
.recovery-sheet { display: none; }
dl.facts { display: grid; grid-template-columns: minmax(10rem, 18rem) 1fr; gap: 6px 20px; margin: 0; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.cred { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }

/* ---------- Stammdaten: Objekte, Orte, Partner, Personen, Import ---------- */
.seg { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 16px; }
.seg a { padding: 8px 14px; border-radius: 10px; color: var(--muted); font-weight: 600; text-decoration: none; border: 1px solid transparent; }
.seg a:hover { color: var(--text); }
.seg a[aria-current="page"] { color: var(--text); border-color: var(--line); background: var(--surface); box-shadow: inset 0 -3px 0 var(--accent); }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > label { font-size: 13px; color: var(--muted); font-weight: 500; }
.filters .field { margin-bottom: 0; min-width: 11rem; }
.filters .field:first-child { flex: 1; min-width: 16rem; }
.crumbs { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.dyn { display: flex; flex-direction: column; gap: 12px; }
.dlg-h { margin: 8px 0 0; font-size: 15px; }
ul.files li { padding: 4px 0; border-bottom: 1px solid var(--line); }
tr.row-error td { background: var(--status-overdue-bg); }
.wizard .req { color: var(--danger-ink); }
@media (max-width: 700px) {
  .filters .field, .filters .field:first-child { min-width: 100%; }
  .page-head.row { align-items: flex-start; }
  .page-head .row { flex-wrap: wrap; }
}

/* ---------- Pflichten, Cockpit, Einrichtung, Kalender (Phase 9) ---------- */
textarea { resize: vertical; width: 100%; }
.back { margin: 0 0 8px; }
.sources { margin: 4px 0; }
.sources a { display: inline-block; padding: 4px 0; min-height: 24px; }
button.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; text-align: left; }
.next-preview { margin: 0; font-weight: 600; }
.scroll { max-height: 14rem; overflow-y: auto; }
.pill.warn { white-space: nowrap; }
.pill.bind-pflicht, .pill.bind-pflicht_bedingt { border: 1px solid var(--text); color: var(--text); background: transparent; }
.pill.bind-empfehlung { border: 1px dashed var(--muted); background: transparent; }
.btn.count { gap: 6px; }
.btn.count.on { border-color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.counts { margin: 8px 0; }
.files-box summary { cursor: pointer; }
.dist-preview { min-height: 1.4em; }

/* Kacheln im Cockpit: Zahl, Text und Symbol, die Farbe ist nur Beigabe */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 12px; list-style: none; margin: 0 0 12px; padding: 0; }
.tile { --s-c: var(--line); --s-bg: var(--surface); --s-ink: var(--text); --s-icon: url("/static/icons/status-paused.svg");
  display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 14px 16px; border: 1px solid var(--s-c); border-left-width: 5px; border-radius: var(--radius);
  background: var(--s-bg); color: var(--s-ink); text-decoration: none; }
.tile:hover { border-color: var(--accent); }
.tile-n { font-family: var(--font-head); font-size: 34px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-l { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.tile-h { font-size: 12px; color: inherit; }
.tile-icon { width: 16px; height: 16px; flex: none; background: var(--s-c); -webkit-mask: var(--s-icon) center / contain no-repeat; mask: var(--s-icon) center / contain no-repeat; }
.tile-overdue { --s-c: var(--status-overdue); --s-bg: var(--status-overdue-bg); --s-ink: var(--status-overdue-ink); --s-icon: url("/static/icons/status-overdue.svg"); }
.tile-soon { --s-c: var(--status-soon); --s-bg: var(--status-soon-bg); --s-ink: var(--status-soon-ink); --s-icon: url("/static/icons/status-soon.svg"); }
.tile-ok { --s-c: var(--status-ok); --s-bg: var(--status-ok-bg); --s-ink: var(--status-ok-ink); --s-icon: url("/static/icons/status-ok.svg"); }
.tile-neutral .tile-icon { display: none; }
@media (forced-colors: active) { .tile-icon { background: CanvasText; } }
.area h2 { margin: 0; }
.duty-list { margin: 8px 0; gap: 0; }
.duty-row { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) auto auto; gap: 4px 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.duty-row:last-child { border-bottom: 0; }
.duty-due { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }

/* Tabellen, die auf dem Handy zu Karten werden */
@media (max-width: 700px) {
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table.stack tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .table.stack td, .table.stack th[scope="row"] { display: flex; gap: 10px; border: 0; padding: 3px 4px; text-align: left; }
  .table.stack td::before, .table.stack th[scope="row"]::before { content: attr(data-label); flex: 0 0 7.5rem; color: var(--muted); font-size: 12px; font-weight: 600; }
  .table.stack td.empty::before { content: none; }
  .duty-row { grid-template-columns: 1fr auto; }
  .duty-state { grid-column: 1 / -1; }
}

/* Segmentschalter aus Knöpfen (Einrichtung) */
.seg .seg-btn { font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 10px; color: var(--muted); border: 1px solid transparent; background: transparent; cursor: pointer; }
.seg .seg-btn:hover { color: var(--text); }
.seg .seg-btn[aria-pressed="true"] { color: var(--text); border-color: var(--line); background: var(--surface); box-shadow: inset 0 -3px 0 var(--accent); }
.grid-form { display: flex; flex-direction: column; gap: 4px; max-width: 34rem; }
.bulk { margin: 8px 0; }
.prop-group { margin: 16px 0; }
.prop-group h3 { margin: 0; font-size: 16px; }
.prop-list { gap: 0; margin: 8px 0 0; }
.prop { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.prop-head { display: flex; gap: 10px; align-items: flex-start; }
.prop-head .grow { flex: 1; min-width: 0; }
.prop-title { font-weight: 600; color: var(--text); font-size: 15px; }
.prop-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; align-items: center; }
.prop-more summary { cursor: pointer; color: var(--accent-text); font-size: 13px; }
.prop-more dl.facts { margin-top: 8px; grid-template-columns: minmax(8rem, 12rem) 1fr; }
.pref { margin: 8px 0; }

/* Kalender */
.cal-nav h2 { margin: 0; }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; list-style: none; margin: 0; padding: 0; }
.cal-day { min-height: 6.5rem; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); min-width: 0; }
.cal-day.other { background: var(--bg); }
.cal-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-date { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.cal-items { gap: 4px; margin: 0; }
.cal-item { display: block; width: 100%; text-align: left; font: inherit; font-size: 12px; padding: 4px 6px; border: 1px solid var(--line); border-left-width: 4px; border-radius: 6px; background: var(--bg); color: var(--text); text-decoration: none; cursor: pointer; overflow-wrap: anywhere; }
.cal-item:hover { border-color: var(--accent); }
.cal-event { border-left-color: var(--accent); }
.cal-duty { border-left-color: var(--status-paused); }
.cal-s-ueberfaellig { border-left-color: var(--status-overdue); }
.cal-s-bald_faellig { border-left-color: var(--status-soon); }
.cal-s-ok { border-left-color: var(--status-ok); }
.cal-type { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--muted); }
.cal-item .status { font-size: 11px; padding: 0 6px 0 4px; }
.cal-title { display: block; font-weight: 600; }
.cal-more { font-size: 12px; }
.cal-grid.week { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-grid.week .cal-day { min-height: 12rem; }
@media (max-width: 860px) {
  .cal-weekdays { display: none; }
  .cal-grid, .cal-grid.week { grid-template-columns: 1fr; }
  .cal-day { min-height: 0; }
  .cal-day.quiet { display: none; }
}

/* ---------- Schmale Bildschirme ---------- */
@media (max-width: 860px) {
  .admin { grid-template-columns: 1fr; gap: 12px; }
  .subnav { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .subnav a { padding: 8px 12px; }
  .subnav a[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--accent); }
}
@media (max-width: 700px) {
  .topbar { gap: 10px; }
  .menu-toggle { display: inline-flex; align-items: center; gap: 6px; order: 2; margin-left: auto; font-weight: 600; }
  .topbar .user { order: 2; margin-left: 0; flex-wrap: wrap; flex: 1 1 100%; }
  .tabs, .topbar.many .tabs { display: none; order: 4; flex-basis: 100%; flex-direction: column; overflow: visible; gap: 2px; padding-top: 6px; border-top: 1px solid var(--line); }
  .topbar.menu-open .tabs { display: flex; }
  .tabs button, .tabs a { width: 100%; text-align: left; padding: 12px 14px; font-size: 16px; }
  .grid { grid-template-columns: 1fr; }
  .table { display: block; overflow-x: auto; }
  .user #user-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .brand .company-name { display: none; }
  dl.facts { grid-template-columns: 1fr; gap: 0; }
  dl.facts dd { margin-bottom: 8px; }
  .recovery-key { font-size: 17px; }
}

/* Druckblatt für den Wiederherstellungsschlüssel: nur dieses Blatt, schwarz auf weiß, unabhängig vom Farbschema */
@media print {
  body.print-key { background: var(--paper); color: var(--paper-ink); }
  body.print-key > *:not(.recovery-sheet) { display: none !important; }
  body.print-key .recovery-sheet { display: block; max-width: 17cm; margin: 2cm auto; color: var(--paper-ink); background: var(--paper); font-family: system-ui, sans-serif; font-size: 12pt; line-height: 1.5; }
  .recovery-sheet h1 { font-size: 20pt; margin: 0 0 12pt; color: var(--paper-ink); }
  .recovery-sheet .recovery-key { display: flex; flex-wrap: wrap; gap: 8pt 16pt; margin: 14pt 0; padding: 12pt 14pt; border: 1.5pt solid var(--paper-ink); border-radius: 0; background: var(--paper); color: var(--paper-ink); font-size: 18pt; user-select: auto; }
  .recovery-sheet .sheet-line { margin-top: 22pt; }
}

/* Aufklappbereiche: Ziel mindestens 24 px hoch (WCAG 2.2, 2.5.8) */
.sub-how summary, .prop-more summary, .files-box summary { display: block; padding: 6px 0; min-height: 24px; }

/* Cockpit: Links unter den Bereichen und im Satz „Ihre eigenen Pflichten“ erreichen die Zielgröße von 24 px (WCAG 2.5.8) */
#cockpit-body .area p > a, #cockpit-mine a { display: inline-block; min-height: 24px; line-height: 24px; }

/* Wartung und Fuhrpark (Phase 10 und 11): Checkliste im Erledigen-Dialog, Mailvorschau, Foto der Fahrerlaubnis */
.check-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(8rem, 1fr) minmax(0, 2fr); gap: 6px 10px; align-items: center; }
.check-row label { color: var(--text); }
.mail-text { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 18rem; overflow: auto; font: inherit; }
.lic-photo { display: block; max-width: 100%; max-height: 22rem; margin: 8px 0; border: 1px solid var(--line); border-radius: 10px; }
.seg a[hidden] { display: none; }
@media (max-width: 700px) { .check-row { grid-template-columns: 1fr; } }

/* Verträge: Zeitleiste, Zähler und Fortschritt (nur Variablen aus brand.css) */
ul.counts { list-style: none; padding: 0; margin: .25rem 0 .75rem; gap: .5rem; }
.btn.count { display: inline-flex; align-items: center; gap: .35rem; min-height: 24px; }
.btn.count.on { border-color: var(--accent); }
ol.timeline { list-style: none; margin: .75rem 0; padding: 0 0 0 1rem; border-left: 3px solid var(--line); display: grid; gap: .6rem; }
ol.timeline li { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem; }
ol.timeline .tl-date { font-weight: 600; min-width: 7rem; }
.contract-progress { width: 100%; height: .6rem; accent-color: var(--accent); }
.files li { padding: .25rem 0; }
/* Tickets und Eingang (Phase 13) */
.tk-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin: 8px 0; }
.tk-thumbs figure { margin: 0; }
.tk-thumbs img { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.tk-thumbs figcaption { font-size: 13px; overflow-wrap: anywhere; }
.tk-comments { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.tk-comments li { border-left: 3px solid var(--line); padding: 4px 10px; }
.tk-comments li.public { border-left-color: var(--accent); }
.pill.tk-neu { background: var(--info-bg); color: var(--info-ink); }
.pill.tk-in_arbeit, .pill.tk-wartet { background: var(--status-soon-bg); color: var(--status-soon-ink); }
.pill.tk-erledigt { background: var(--status-ok-bg); color: var(--status-ok-ink); }
.pill.tk-verworfen { background: var(--status-paused-bg); color: var(--status-paused-ink); }
tr.tk-new td:first-child { font-weight: 700; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Begehungen (Phase 14) */
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
tr.archived td { opacity: .7; }
.plain-pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 50vh; overflow: auto; font: inherit; background: var(--bg); padding: .75rem; border-radius: 8px; }
.pill.insp-laufend { background: var(--info-bg); color: var(--info-ink); }
.pill.insp-abgeschlossen { background: var(--status-ok-bg); color: var(--status-ok-ink); }
.pill.insp-abgebrochen { background: var(--status-paused-bg); color: var(--status-paused-ink); }
.pill.find-offen { background: var(--status-overdue-bg); color: var(--status-overdue-ink); }
.pill.find-behoben { background: var(--status-soon-bg); color: var(--status-soon-ink); }
.pill.find-nachgeprueft { background: var(--status-ok-bg); color: var(--status-ok-ink); }
.pill.find-verworfen, .pill.find-ohne_ticket { background: var(--status-paused-bg); color: var(--status-paused-ink); }
.pill.res-ok { background: var(--status-ok-bg); color: var(--status-ok-ink); }
.pill.res-mangel { background: var(--status-overdue-bg); color: var(--status-overdue-ink); }
.pill.res-na { background: var(--status-paused-bg); color: var(--status-paused-ink); }
.insp-items > li { padding: .6rem 0; border-top: 1px solid var(--line); }
.insp-items > li:first-child { border-top: 0; }

.run-sticky { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: .4rem 0; border-bottom: 1px solid var(--line); }
.run-status { font-weight: 600; margin: 0; }
.run-item { border: 1px solid var(--line); border-radius: 10px; padding: .75rem; margin: 0 0 .75rem; background: var(--surface); }
.run-item.mangel { border-color: var(--status-overdue); }
.run-item.ok { border-color: var(--status-ok); }
.run-item legend { font-weight: 600; padding: 0 .25rem; }
.run-item .choices { display: flex; gap: .5rem; flex-wrap: wrap; margin: .5rem 0; }
.run-item .choice { flex: 1 1 7rem; display: flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; padding: .4rem .6rem;
  border: 2px solid var(--line); border-radius: 10px; cursor: pointer; font-weight: 600; }
.run-item .choice.on.ok { background: var(--status-ok-bg); color: var(--status-ok-ink); border-color: var(--status-ok); }
.run-item .choice.on.mangel { background: var(--status-overdue-bg); color: var(--status-overdue-ink); border-color: var(--status-overdue); }
.run-item .choice.on.na { background: var(--status-paused-bg); color: var(--status-paused-ink); border-color: var(--status-paused); }
.run-item .choice:focus-within { outline: 3px solid var(--info-ink); outline-offset: 2px; }
.run-note textarea { width: 100%; }
.run-photo-grid { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.run-photo { margin: 0; display: flex; flex-direction: column; gap: .25rem; align-items: flex-start; }
.run-thumb { width: 6.5rem; height: 6.5rem; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.sig { margin: .5rem 0; }
.sig-pad { display: block; width: 100%; max-width: 32rem; aspect-ratio: 640 / 220; background: var(--paper); border: 2px dashed var(--muted); border-radius: 10px; touch-action: none; }

/* Mitarbeitermanagement (Phase 15): Matrix, Unterschrift, Details */
.matrix-wrap { max-height: 70vh; overflow: auto; }
.matrix th, .matrix td { white-space: nowrap; vertical-align: top; }
.matrix th.mx-name, .matrix td.mx-name { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 180px; white-space: normal; }
.matrix thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; }
.matrix thead th.mx-name { z-index: 3; }
.matrix th.mx-col { white-space: normal; min-width: 130px; max-width: 170px; font-weight: 600; font-size: 13px; }
.matrix th.mx-group { text-align: left; border-left: 1px solid var(--line); }
.matrix .mx-cell .status { font-size: 12px; }
.matrix .mx-none { color: var(--muted); text-align: center; }
.sig-box { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.sig-box .sig-pad { width: 100%; max-width: 600px; aspect-ratio: 3 / 1; background: var(--sig-bg); border: 2px solid var(--line); border-radius: var(--radius); touch-action: none; cursor: crosshair; }
.sig-box .sig-pad:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.prewrap { white-space: pre-wrap; }
.h3 { font-size: 18px; margin: 16px 0 6px; }
.h4 { font-size: 16px; margin: 12px 0 4px; }
.person-detail section + section { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 8px; }
.checklist-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; margin: 8px 0; }
.reasons li, .participants li, .files li { padding: 6px 0; border-bottom: 1px solid var(--line); }
.files-line { padding-left: 12px; }
.hint .plain li { padding: 4px 0; }
.field.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* ---------- Berichte und Diagramme (Phase 16) ---------- */
.ch { margin: 0 0 8px; }
.ch figcaption { font-weight: 600; margin-bottom: 6px; }
.ch-svg { width: 100%; height: auto; max-width: 720px; display: block; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-axis { fill: var(--muted); font-size: 11px; }
.ch-val { fill: var(--text); font-size: 11px; font-weight: 600; }
.ch-val-l { fill: var(--text); font-size: 12px; font-weight: 600; }
.ch-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.ch-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2.5; }
.ch-bar { fill: var(--accent); }
.ch-bar-bg { fill: var(--status-paused-bg); stroke: var(--status-paused); stroke-width: 1; }
.ch-bar-over { fill: var(--status-overdue); }
.ch-alt { margin-top: 8px; }
.ch-alt summary { cursor: pointer; font-weight: 600; color: var(--accent-text); }
.ch-table { max-width: 720px; }
.kpi-tile { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; gap: 2px; }
.kpi-value { font-family: var(--font-head); font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.mail-body { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; max-height: 14rem; overflow: auto; }
.table tr.total th, .table tr.total td { font-weight: 700; border-top: 2px solid var(--line); }
ul.facts { display: flex; flex-wrap: wrap; gap: .3rem 1.5rem; }
@media (forced-colors: active) { .ch-bar, .ch-bar-over { fill: CanvasText; } .ch-line, .ch-dot { stroke: CanvasText; } }
