@font-face {
  font-family: "Inter";
  src: url("/fonts/inter/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --navy: #101334;
  --brand: #0e24ea;
  --brand-dark: #0a1bb8;
  --violet: #6728c2;
  --violet-soft: #b79af0;
  --shell: #101334;
  --shell-hover: #1c1f4a;
  --shell-current: #0e24ea;
  --shell-text: #e6e8f7;
  --shell-muted: #a4a9d1;
  --ground: #eaecf6;
  --surface: #ffffff;
  --ink: #101334;
  --muted: #484d6b;
  --rule: #c3c8de;
  --hairline: #e0e3f0;
  --link: #0e24ea;
  --ok: #1c7a54;
  --warn: #8a5600;
  --crit: #b3261e;
  --ne: #4f5472;
  --focus: #0e24ea;
  --control: #767c9f;
  /* Darstellung (T0): Grundwerte der Primärschaltfläche, damit app.css auch ohne theme.css trägt; theme.css hält sie je Darstellung (Test hält beide gleich) */
  --accent-fill: #0e24ea;
  --text-on-accent: #ffffff;
  --display: "Inter", "Segoe UI", system-ui, sans-serif;
  --sans: "Inter", "Segoe UI", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { color-scheme: light; scrollbar-color: #9aa0c8 var(--ground); }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
  caret-color: var(--focus);
}

::selection { background: #cdd2fb; color: var(--ink); }

a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.ledger td a { color: var(--ink); font-weight: 600; text-decoration: none; }
.ledger td a:hover { color: var(--brand); text-decoration: underline; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; text-wrap: balance; }
/* Kennzahl- und Zustandsüberschriften gleichmäßig umbrechen (Leitlinien-Prüfung, Schnellgewinn 1); Fließtext ohne einzelne Restwörter. */
h4, .kz-name, .vb-num, .le-m-t, .n2-lead > strong { text-wrap: balance; }
.vb-say, .n2-def, .bf-note, .kn-grund { text-wrap: pretty; }
h1 { font-size: 2rem; line-height: 1.15; letter-spacing: -0.025em; }
h2 { font-size: 1.3rem; line-height: 1.25; margin-top: 2.5rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1rem; max-width: 68ch; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  background: transparent;
  color: var(--brand);
  font: 600 14px/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms var(--ease-out), color 120ms var(--ease-out);
}
.btn:hover { background: #e3e6fc; }
.btn-primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--text-on-accent); }
.btn-primary:hover { background: var(--brand-dark); }
.btn[aria-disabled="true"], .btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn-small { padding: 6px 12px; font-size: 13px; }

/* ---------- Application shell ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
/* BB16 (SO0-G): Die Leiste fuellt die volle Seitenhoehe, auch wenn der Inhalt laenger ist als das Fenster (die Leiste selbst bleibt sticky). */
.app { background-image: linear-gradient(to right, var(--shell) var(--rail-w, 248px), transparent var(--rail-w, 248px)); }

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--shell);
  color: var(--shell-text);
  padding: 24px 0 24px;
  scrollbar-color: #3b3f78 var(--shell);
}
.rail-top { display: block; }
.nav-toggle { display: none; }
.rail-brand { display: block; padding: 0 24px 24px; color: #fff; text-decoration: none; }
.rail-brand img { display: block; width: 132px; height: auto; }
.rail-brand span { display: block; margin-top: 10px; font: 600 13px/1.2 var(--sans); color: var(--shell-muted); }
.rail-group { padding: 12px 0 4px; }
.rail-group h2 { margin: 0; padding: 0 24px 6px; font: 600 12.5px/1.2 var(--sans); color: var(--shell-muted); }
.rail a.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 1px 12px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--shell-text);
  text-decoration: none;
  font-size: 14.5px;
  transition: background-color 120ms var(--ease-out);
}
.rail a.nav-item:hover { background: var(--shell-hover); }
.rail a.nav-item[aria-current="page"] { background: var(--shell-current); color: #fff; font-weight: 600; }
.rail a.nav-item.is-locked { color: var(--shell-muted); }
.lock { color: var(--violet-soft); width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 40px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}
.topbar-tenant { font: 600 1.05rem/1.2 var(--display); }
.plan-tag { margin-left: 10px; padding: 2px 8px; border: 1px solid var(--rule); border-radius: 4px; font: 600 12.5px/1.4 var(--sans); color: var(--muted); }
.plan-tag.plan-premium { color: var(--violet); border-color: var(--violet); }
.topbar-right { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 14px; }
.demo-note { padding: 2px 8px; border-radius: 4px; background: #fbf0d9; color: #6b4300; font-weight: 600; font-size: 12.5px; }
.inline-form { margin: 0; }

.sheet { flex: 1 0 auto; width: 100%; padding: 32px 40px 64px; max-width: 1240px; }

/* ---------- Report head ---------- */
.report-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 8px;
}
.report-meta { margin: 6px 0 0; color: var(--muted); font-size: 14.5px; }
.report-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.lead { margin: 18px 0 0; max-width: 72ch; font-size: 17px; line-height: 1.55; }

/* ---------- Ledger tables ---------- */
.table-wrap { overflow-x: auto; }
.ledger { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; background: var(--surface); }
.ledger caption { text-align: left; padding: 0 0 8px; font: 600 1.05rem/1.3 var(--display); }
.ledger th {
  padding: 9px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--ink);
  white-space: nowrap;
}
.ledger td { padding: 11px 10px; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.ledger tbody tr:hover td { background: #f5f6fc; }
.ledger .num { text-align: right; white-space: nowrap; }
.ledger tfoot td { font-weight: 700; border-top: 1px solid var(--ink); border-bottom: 3px double var(--ink); background: var(--surface); }
.ledger .sub { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
.ledger .ne {
  color: var(--ne);
  font-style: italic;
  background: repeating-linear-gradient(135deg, transparent 0 5px, rgba(16, 19, 52, 0.09) 5px 6px);
}
.fn { font-size: 12px; vertical-align: super; line-height: 0; margin-left: 2px; }
.fn a { text-decoration: none; font-weight: 700; }
.premium-mark { color: var(--violet); font-weight: 600; font-size: 13px; }

.ledger .stat-col { white-space: nowrap; }
.table-wrap { position: relative; }

/* ---------- Status ---------- */
.st { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; white-space: nowrap; }
.st::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: currentColor; flex: none; }
.st-erfuellt { color: var(--ok); }
.st-abweichung { color: var(--warn); }
.st-kritisch { color: var(--crit); }
.st-ohne-ziel, .st-nicht-erhoben { color: var(--ne); }
.st-nicht-erhoben::before { background: repeating-linear-gradient(135deg, currentColor 0 2px, transparent 2px 4px); outline: 1px solid currentColor; outline-offset: -1px; }
.st-ohne-ziel::before { background: transparent; outline: 1.5px solid currentColor; outline-offset: -1.5px; }
.st-akzeptiert { color: var(--brand); }
.st-akzeptiert::before { border-radius: 50%; box-shadow: inset 0 0 0 2px #fff; outline: 1.5px solid currentColor; outline-offset: 0; }
.dev-pos { color: var(--ok); } .dev-neg { color: var(--crit); }

.sev { font-weight: 700; }
.sev-kritisch { color: var(--crit); } .sev-hoch { color: var(--warn); } .sev-mittel { color: var(--ne); } .sev-niedrig, .sev-info { color: var(--ne); }

/* ---------- Bilanzbalken ---------- */
.balance { margin: 22px 0 0; max-width: 880px; }
.balance-bar { display: flex; gap: 3px; height: 16px; }
.balance .seg { flex-basis: 0; min-width: 6px; border-radius: 4px; transform-origin: left center; animation: grow 700ms var(--ease-out) both; }
.balance .seg:nth-child(2) { animation-delay: 70ms; }
.balance .seg:nth-child(3) { animation-delay: 140ms; }
.balance .seg:nth-child(4) { animation-delay: 210ms; }
.seg-erfuellt { background: var(--ok); }
.seg-abweichung { background: #c98a1b; }
.seg-kritisch { background: var(--crit); }
.seg-nicht-erhoben { background: repeating-linear-gradient(135deg, #8d93b5 0 3px, #e3e6f3 3px 6px); }
.seg-ohne-ziel { background: #fff; box-shadow: inset 0 0 0 1.5px var(--ne); }
.seg-akzeptiert { background: repeating-linear-gradient(90deg, var(--brand) 0 4px, #dfe3fb 4px 8px); }
.balance-legend { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 14px; }
.balance-legend b { font-variant-numeric: tabular-nums; margin-left: 4px; }
@keyframes grow { from { transform: scaleX(0); opacity: 0.4; } to { transform: scaleX(1); opacity: 1; } }

/* ---------- Layout ---------- */
.cols { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(300px, 1fr); gap: 48px; align-items: start; }
.cols > section > h2:first-child { margin-top: 2rem; }
/* Die Bilanztabelle braucht Platz: unter 1400 px stehen die Spalten untereinander (sonst wird die Statusspalte abgeschnitten). */
@media (max-width: 1400px) { .cols { grid-template-columns: minmax(0, 1fr); gap: 8px; } }

.todo { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); background: var(--surface); }
.todo li { padding: 12px 12px; border-bottom: 1px solid var(--hairline); }
.todo .t { display: block; font-weight: 600; }
.todo .m { display: block; color: var(--muted); font-size: 13.5px; margin-top: 2px; }

.annex { margin-top: 3rem; padding-top: 12px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 13.5px; max-width: 80ch; }
.annex h2 { margin: 0 0 6px; font-size: 1rem; }
.annex ol { margin: 0; padding-left: 1.2rem; }
.annex li { margin-bottom: 4px; }

/* ---------- Trend ---------- */
.trend { margin-top: 2rem; }
.trend-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.trend label { font-weight: 600; margin-right: 8px; }
.trend select { padding: 7px 10px; border: 1px solid var(--control); border-radius: 6px; background: var(--surface); font: 400 14.5px var(--sans); color: var(--ink); max-width: 100%; }
/* Ein Auswahlfeld richtet seine Breite nach der laengsten Option; der umgebende Flex-Eintrag darf nicht mitwachsen (lange Kennzahlnamen). */
.trend-bar > div { min-width: 0; max-width: 100%; }
.trend-canvas { position: relative; height: auto; padding: 12px; background: var(--surface); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--hairline); }
.trend-note { color: var(--muted); font-size: 13.5px; margin: 8px 0 0; max-width: 80ch; }

/* ---------- Locked / forbidden ---------- */
.locked-lead { max-width: 64ch; margin-top: 20px; font-size: 17px; }
.locked-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 48px; align-items: start; margin-top: 8px; }
.locked-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.compare { margin-top: 24px; max-width: 760px; }
.ledger th.is-premium, .ledger td.is-premium { color: var(--violet); font-weight: 700; }

/* ---------- Public pages ---------- */
.pub { min-height: 100vh; display: flex; flex-direction: column; overflow-x: clip; }
.skip-link { position: absolute; left: 12px; top: -64px; z-index: 100; padding: 10px 16px; background: #fff; color: var(--ink); font-weight: 600; border-radius: 4px; }
.skip-link:focus { top: 12px; outline: 3px solid var(--brand); }
.pub-head { position: sticky; top: 0; z-index: 40; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding: 14px 48px; background: var(--shell); color: #fff; border-bottom: 1px solid rgba(164, 169, 209, 0.18); }
.pub-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 28px; }
.pub-nav a:not(.btn) { display: inline-flex; align-items: center; min-height: 44px; color: var(--shell-text); text-decoration: none; padding: 10px 0; font-size: 14.5px; font-weight: 500; text-underline-offset: 5px; }
.pub-nav a:not(.btn):hover { color: #fff; text-decoration: underline; }
.pub-head a:focus-visible, .pub-toggle:focus-visible { outline: 3px solid #fff; outline-offset: 3px; border-radius: 3px; }
.pub-toggle { display: none; min-height: 44px; padding: 0 16px; background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, 0.55); border-radius: 4px; font: 600 14px var(--sans); cursor: pointer; }
.pub-main:focus { outline: none; }
/* Q45d: Sprungziele und Fokus landen unter der festen Kopfleiste. --pub-kopf misst pubnav.js (Kopfhoehe ist variabel: Umbruch, Textgroesse); 76px gilt ohne Skript. */
html:has(.pub-head) { scroll-padding-top: calc(var(--pub-kopf, 76px) + 16px); }
@media (max-width: 860px) {
  .pub-head { padding: 10px 20px; }
  .pub-head.has-js .pub-toggle { display: inline-flex; align-items: center; }
  /* Q94: Anmelden bleibt auch bei zugeklapptem Menue im Kopf sichtbar. Q95: das nav bleibt ein echtes Element (Landmark, aria-controls zeigt auf eine Box, kein display: contents);
     die Reihenfolge im Dokument (Logo, Menue-Knopf, nav mit Anmelden) ist die sichtbare Reihenfolge, damit Tab und Auge dasselbe sehen (WCAG 2.4.3). */
  .pub-head.has-js .pub-toggle { margin-left: auto; }
  .pub-head.has-js:not(.is-open) .pub-nav a:not(.btn) { display: none; }
  .pub-head.has-js.is-open .pub-nav { display: flex; flex-basis: 100%; flex-direction: column; align-items: stretch; gap: 0; padding: 4px 0 12px; }
  .pub-head.has-js .pub-nav a:not(.btn) { padding: 14px 0; min-height: 44px; border-bottom: 1px solid rgba(164, 169, 209, 0.18); }
  .pub-head.has-js.is-open .pub-nav .btn { margin-top: 12px; justify-content: center; min-height: 44px; }
}
.pub-brand { display: inline-flex; align-items: center; gap: 18px; color: #fff; text-decoration: none; font: 600 15px/1.2 var(--sans); }
.pub-brand img { display: block; width: 104px; height: auto; }
.pub-brand span { padding-left: 18px; border-left: 1px solid rgba(255, 255, 255, 0.35); color: var(--shell-text); }
.pub-head .btn { color: #fff; border-color: rgba(255, 255, 255, 0.55); }
.pub-head .btn { min-height: 44px; font-size: 14px; }
.pub-head .btn:hover { background: var(--shell-hover); }
.pub-main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 48px 72px; }
.hero-band { margin: 0 calc(50% - 50vw); padding: 72px calc(50vw - 50%) 80px; background: var(--shell); color: #fff; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 56px; align-items: center; max-width: 1084px; margin: 0 auto; }
.hero h1 { font-size: clamp(2.2rem, 4.4vw, 3.4rem); line-height: 1.05; letter-spacing: -0.035em; max-width: 14ch; color: #fff; }
.hero p { margin-top: 20px; font-size: 18px; line-height: 1.55; color: #cfd3f2; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.hero .btn { border-color: rgba(255, 255, 255, 0.6); color: #fff; padding: 12px 20px; font-size: 15px; }
.hero .btn:hover { background: rgba(255, 255, 255, 0.12); }
.hero .btn-primary { background: #fff; color: var(--navy); border-color: #fff; }
.hero .btn-primary:hover { background: #e3e6fc; }
.preview { margin: 0; background: var(--surface); color: var(--ink); border-radius: 12px; padding: 20px 20px 14px; box-shadow: 0 18px 40px rgba(0, 0, 8, 0.35); }
.preview .ledger { border-top: 0; }
.preview figcaption { margin-top: 10px; color: var(--muted); font-size: 13px; }
.pub-section { margin-top: 72px; }
.pub-section h2 { margin-top: 0; font-size: 1.6rem; }
.steps { margin: 20px 0 0; padding: 0; list-style: none; counter-reset: step; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 2px solid var(--ink); }
.steps li { counter-increment: step; padding: 18px 24px 8px 0; }
.steps li::before { content: counter(step); display: block; margin-bottom: 10px; font: 700 2rem/1 var(--display); color: var(--brand); letter-spacing: -0.03em; }
.steps strong { display: block; font-size: 1.05rem; margin-bottom: 4px; }
.steps span { color: var(--muted); }

.auth { max-width: 880px; padding-top: 56px; }
.tenant-list { margin: 28px 0 0; padding: 0; list-style: none; border-top: 2px solid var(--ink); background: var(--surface); }
.tenant-list li { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px 24px; align-items: center; padding: 18px 16px; border-bottom: 1px solid var(--hairline); }
.tenant-name { font: 700 1.15rem/1.2 var(--display); letter-spacing: -0.01em; }
.tenant-plan { display: block; margin-top: 4px; font: 600 13px/1.2 var(--sans); color: var(--muted); }
.tenant-plan.is-premium { color: var(--violet); }
.role-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.role-grid form { margin: 0; }
.role-grid .btn { width: 100%; justify-content: center; }

/* ---------- Hinweisband, Leerzustand, Formularhilfen ---------- */
.notice { max-width: none; margin: 18px 0 0; padding: 12px 16px; border: 1px solid; border-radius: 8px; font-weight: 500; }
.notice-ok { background: #e6f3ec; border-color: #9fcdb5; color: #14573c; }
.notice-info { background: #e3e6fc; border-color: #aab2f3; color: var(--navy); }
.notice-warn { background: #fbf0d9; border-color: #e3c47f; color: #6b4300; }
.notice-error { background: #fbe9e7; border-color: #e5a7a1; color: #8f1d17; }

.empty-state { margin: 20px 0 0; padding: 20px 24px; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; max-width: 72ch; }
.empty-state h2 { margin: 0 0 8px; font-size: 1.15rem; }
.empty-state p:last-child { margin-bottom: 0; }

.step-hint { margin: 8px 0 0; color: var(--muted); font-size: 13.5px; }
.form-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.form-row form, .member-form { margin: 0; }
.btn-quiet { border-color: var(--rule); color: var(--muted); }
.btn-quiet:hover { background: #fbe9e7; border-color: #e5a7a1; color: #8f1d17; }
.btn-large { padding: 13px 24px; font-size: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field select { padding: 8px 10px; min-height: 40px; border: 1px solid var(--control); border-radius: 6px; background: var(--surface); font: 400 14.5px var(--sans); color: var(--ink); }

.st-laeuft { color: var(--brand); }
.st-laeuft::before { border-radius: 50%; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

/* ---------- Schritte der Anbindung ---------- */
.stepper { list-style: none; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.step { display: flex; flex-direction: column; gap: 12px; padding-top: 16px; border-top: 3px solid var(--rule); min-width: 0; }
.step.is-current { border-top-color: var(--brand); }
.step.is-done { border-top-color: var(--ok); }
.step.is-error { border-top-color: var(--crit); }
.step-mark { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border: 2px solid var(--ne); border-radius: 8px; font: 700 16px/1 var(--display); color: var(--ne); background: transparent; }
.is-current .step-mark { background: var(--brand); border-color: var(--brand); color: #fff; }
.is-done .step-mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.is-error .step-mark { background: var(--crit); border-color: var(--crit); color: #fff; }
.step-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.step-body { min-width: 0; }
.step-body h2 { margin: 0; font-size: 1.15rem; }
.step-body p { margin: 8px 0 0; }
.step-body .step-state { margin-top: 4px; font-size: 13.5px; font-weight: 700; color: var(--muted); }
.is-current .step-state { color: var(--brand); }
.is-done .step-state { color: var(--ok); }
.is-error .step-state { color: var(--crit); }
.step-body .btn { margin-top: 12px; }
.step-body .step-hint { margin-top: 8px; }

/* ---------- Benutzerverwaltung ---------- */
.members { list-style: none; margin: 0; padding: 0; background: var(--surface); border-top: 1px solid var(--ink); }
.member { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px 24px; padding: 14px 16px; border-bottom: 1px solid var(--hairline); }
.member-who { min-width: 0; }
.member-name { display: block; font-weight: 600; overflow-wrap: anywhere; }
.member-mail { display: block; color: var(--muted); font-size: 13.5px; overflow-wrap: anywhere; }
.member-actions { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.member-form { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.members-waiting { margin-top: 24px; }
.members-waiting h2 { margin-top: 0; }
.members-lead { color: var(--muted); margin-bottom: 12px; }
.members-waiting .members { border: 1px solid var(--brand); border-radius: 8px; overflow: hidden; background: #eef0ff; }
.members-waiting .member:last-child { border-bottom: 0; }
.member.is-waiting { border-bottom-color: #cdd2fb; }

/* ---------- Anmeldung ---------- */
.auth-action { margin: 28px 0 0; }
.auth-notes { margin: 20px 0 0; padding-left: 1.2rem; max-width: 64ch; color: var(--muted); }
.auth-notes li { margin-bottom: 6px; }
.auth-steps { margin: 0; padding-left: 1.3rem; max-width: 64ch; }
.auth-steps li { margin-bottom: 8px; }
.demo-access { margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--rule); }
.demo-access h2 { margin: 0 0 4px; font-size: 1rem; color: var(--muted); }
.demo-access p { color: var(--muted); font-size: 14px; }
.demo-access .tenant-list { margin-top: 16px; border-top-width: 1px; border-top-color: var(--rule); }

/* ---------- Einrichtungsassistent ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.setup { max-width: 760px; }
.wiz { list-style: none; margin: 24px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.wiz-step { display: flex; align-items: center; gap: 12px; padding-top: 14px; border-top: 3px solid var(--rule); min-width: 0; }
.wiz-step.is-current { border-top-color: var(--brand); }
.wiz-step.is-done { border-top-color: var(--ok); }
.wiz-step.is-current .step-mark { background: var(--brand); border-color: var(--brand); color: #fff; }
.wiz-step.is-done .step-mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.wiz-text { display: flex; flex-direction: column; min-width: 0; }
.wiz-label { font-weight: 700; line-height: 1.3; }
.wiz-step .step-state { font-size: 13.5px; font-weight: 700; color: var(--muted); }
.wiz-step.is-current .step-state { color: var(--brand); }
.wiz-step.is-done .step-state { color: var(--ok); }
.wiz-panel { margin-top: 28px; padding: 28px 32px 32px; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; }
.wiz-panel h2 { margin: 0; font-size: 1.4rem; }
.wiz-panel .lead { margin-top: 12px; }
.wiz-panel h3 { font-size: 1rem; margin: 0 0 6px; }
.wiz-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 0; }
.wiz-panel .notice { margin-top: 24px; }
.wiz-panel .step-hint { max-width: 68ch; }
.wiz-rights { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 24px 0 20px; border-top: 2px solid var(--ink); }
.wiz-right { padding: 16px 24px 4px 0; }
.wiz-right + .wiz-right { padding-left: 24px; border-left: 1px solid var(--hairline); }
.wiz-right p { color: var(--muted); }
.setup-form { display: flex; flex-direction: column; gap: 8px; margin-top: 24px; max-width: 460px; }
.setup-form .field { margin: 0; }
.input { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--muted); border-radius: 6px; background: var(--surface); font: 400 16px var(--sans); color: var(--ink); }
.field-check { display: flex; align-items: flex-start; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 14px; line-height: 1.5; cursor: pointer; }
.field-check input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--brand); }
.wiz-uris { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--rule); }
.wiz-uris .step-hint { margin: 0 0 12px; }
.copy-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; padding: 6px 6px 6px 14px; background: var(--ground); border: 1px solid var(--hairline); border-radius: 6px; }
.copy-line code { min-width: 0; font: 500 13.5px/1.4 ui-monospace, "Cascadia Mono", Consolas, monospace; overflow-wrap: anywhere; }
.setup-code { display: block; margin: 24px 0 0; padding: 20px 16px; background: var(--ground); border: 2px solid var(--ink); border-radius: 8px; text-align: center; font: 700 clamp(1.9rem, 8vw, 3.2rem)/1.1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: 0.18em; text-indent: 0.18em; color: var(--navy); overflow-wrap: anywhere; user-select: all; }
.wiz-mono { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.setup .ledger { margin-top: 24px; }
.setup .ledger th[scope="row"] { white-space: normal; font-size: 13.5px; width: 38%; border-bottom: 1px solid var(--hairline); padding: 11px 10px; }
.notice a { font-weight: 700; color: inherit; }
.notice .btn { margin-left: 12px; color: var(--navy); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .app { grid-template-columns: 232px minmax(0, 1fr); --rail-w: 232px; }
  .cols { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .topbar, .sheet { padding-left: 28px; padding-right: 28px; }
}

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; background-image: none; }
  .rail { position: sticky; top: 0; z-index: 30; height: auto; max-height: 100vh; padding: 0; overflow-y: visible; }
  .rail-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; }
  .rail-brand { padding: 0; }
  .rail-brand img { width: 92px; }
  .rail-brand span { display: none; }
  .nav-toggle { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid rgba(255, 255, 255, 0.45); border-radius: 8px; background: transparent; color: #fff; font: 600 14px var(--sans); cursor: pointer; }
  .nav-toggle:hover { background: var(--shell-hover); }
  .rail nav { display: none; max-height: calc(100vh - 68px); overflow-y: auto; padding: 4px 0 16px; border-top: 1px solid rgba(255, 255, 255, 0.14); }
  .rail.rail-open nav { display: block; }
  .rail a.nav-item { min-height: 44px; margin: 1px 8px; }
  .topbar { position: static; flex-wrap: wrap; gap: 8px 16px; padding: 12px 20px; }
  .topbar-right { display: contents; }
  .topbar-right > span:not(.demo-note) { margin-left: auto; }
  .demo-note { order: 5; flex-basis: 100%; text-align: center; }
  .ledger td a { display: inline-block; padding: 12px 0; }
  .nav-toggle[aria-expanded="true"] { background: var(--shell-current); border-color: var(--shell-current); }
  .sheet { padding: 24px 20px 56px; }
  .report-head { flex-direction: column; align-items: flex-start; gap: 16px; }
  h1 { font-size: 1.75rem; }
  .btn { min-height: 44px; }
  .btn-small { min-height: 44px; }
  .field select { min-height: 44px; }
  .stepper { grid-template-columns: 1fr; gap: 20px; }
  .step { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 0 14px; align-items: start; }
  .member { grid-template-columns: 1fr; }
  .member-form, .member-actions { width: 100%; }
  .member-form .field { flex: 1 1 160px; }
  .pub-head { padding: 12px 20px; }
  .pub-brand span { display: none; }
  .pub-main { padding: 0 20px 56px; }
  .hero-band { padding-top: 40px; padding-bottom: 48px; }
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .hero p { font-size: 17px; }
  .steps { grid-template-columns: 1fr; }
  .steps li { padding-right: 0; border-bottom: 1px solid var(--hairline); }
  .locked-grid { grid-template-columns: 1fr; gap: 16px; }
  .site-foot .sf-inner { padding-left: 20px; padding-right: 20px; }
  .site-foot .sf-grid { grid-template-columns: 1fr 1fr; }
  .site-foot .sf-brand { grid-column: 1 / -1; }
  .auth { padding-top: 32px; }
  .wiz-panel { padding: 22px 20px 24px; }
  .wiz-rights { grid-template-columns: 1fr; }
  .wiz-right, .wiz-right + .wiz-right { padding: 16px 0 4px; border-left: 0; }
  .wiz-right + .wiz-right { border-top: 1px solid var(--hairline); }
  .tenant-list li { grid-template-columns: 1fr; }
}

.only-sm { display: none !important; }

@media (max-width: 480px) {
  .topbar-right > span:not(.demo-note) { display: none; }
  .topbar-right > .inline-form { margin-left: auto; }
}

@media (max-width: 640px) {
  .hide-sm { display: none; }
  .only-sm { display: block !important; }
  .ledger th:first-child, .ledger td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--hairline); }
  .ledger th, .ledger td { padding-left: 8px; padding-right: 8px; }
  .ledger .st, .ledger .stat-col { white-space: normal; align-items: flex-start; }
  .trend-bar > div { flex: 1 1 100%; }
  .trend label { display: block; margin: 0 0 6px; }
  .trend select { width: 100%; }
  .ledger .st::before { margin-top: 0.4em; }
  .role-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wiz { grid-template-columns: 1fr; gap: 10px; }
  .wiz-step { padding-top: 10px; }
  .wiz-actions .btn { width: 100%; justify-content: center; }
  .copy-line { flex-wrap: wrap; }
  .notice .btn { display: flex; margin: 12px 0 0; justify-content: center; }
  .setup .ledger th[scope="row"], .setup .ledger td { display: block; width: auto; }
  .setup .ledger th[scope="row"] { border-bottom: 0; padding-bottom: 0; }
  .setup .ledger th:first-child, .setup .ledger td:first-child { position: static; box-shadow: none; }
  .trend-canvas { padding: 8px; }
  .balance-legend { gap: 6px 16px; }
}

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

/* ---------- extern: Drittscanner-Quellen (getrennt vom Microsoft-Score) ---------- */
.ext-new { margin: 24px 0 0; padding: 16px 20px; background: var(--surface); border: 1px solid var(--hairline); border-top: 2px solid var(--ink); }
.ext-new h2 { font-size: 1.05rem; margin: 0 0 10px; }
.ext-fields { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.ext-fields label { display: grid; gap: 4px; font-weight: 600; font-size: 13.5px; min-width: 0; }
.ext-fields select, .ext-fields input { font: 400 15px/1.3 var(--sans); padding: 8px 10px; border: 1px solid var(--control); border-radius: 6px; background: #fff; color: var(--ink); min-width: 220px; max-width: 100%; }
.ext-card { margin: 24px 0 0; padding: 18px 20px 16px; background: var(--surface); border: 1px solid var(--hairline); border-top: 2px solid var(--ink); }
.ext-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; align-items: flex-start; }
.ext-head h2 { font-size: 1.2rem; margin: 0; overflow-wrap: anywhere; }
.ext-age { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; color: var(--muted); }
.ext-state, .ext-cover { margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.ext-card .table-wrap { margin-top: 12px; }
.ext-actions { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--hairline); }
.ext-upload { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; min-width: 0; }
.ext-file { display: inline-flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 13.5px; max-width: 100%; }
.ext-file input { font: 400 14px/1.3 var(--sans); max-width: 100%; }
.ext-card .ledger th:first-child, .ext-card .ledger td:first-child { position: static; box-shadow: none; }
@media (max-width: 640px) {
  .ext-fields select, .ext-fields input, .ext-fields .btn { width: 100%; min-width: 0; }
  .ext-fields label { width: 100%; }
  .ext-upload .btn, .ext-actions form, .ext-actions .btn { width: 100%; justify-content: center; }
  .ext-card { padding: 14px 12px; }
}

/* Datenschutz-Bereich in den Einstellungen (Export und Loeschung) */
.privacy-block { margin-top: 40px; }
.privacy-block h2 { padding-top: 14px; border-top: 2px solid var(--ink); }
.privacy-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 12px; }
.privacy-card { padding: 16px 18px; background: var(--surface); border: 1px solid var(--hairline); }
.privacy-card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.privacy-card p { margin: 0 0 12px; line-height: 1.5; }
.privacy-card .field { display: grid; gap: 4px; margin-bottom: 12px; }
.privacy-card input[type="text"] { width: 100%; padding: 10px 12px; border: 1px solid var(--control); font: inherit; }
.privacy-danger { border-color: #e5a7a1; }
.btn-danger { border-color: #b3261e; background: #b3261e; color: #fff; }
.btn-danger:hover { background: #8f1d17; border-color: #8f1d17; }
@media (max-width: 800px) { .privacy-actions { grid-template-columns: 1fr; } }

/* Einheitlicher Footer */
.site-foot { margin-top: 72px; background: var(--navy); color: var(--shell-text); font-size: 14px; }
.site-foot .sf-inner { max-width: 1480px; margin: 0 auto; padding: 48px 48px 24px; }
.site-foot.is-compact { margin-top: 48px; }
.site-foot.is-compact .sf-inner { padding-top: 20px; padding-bottom: 20px; }
.site-foot .sf-grid { display: grid; grid-template-columns: minmax(0, 2fr) repeat(2, minmax(0, 1fr)); gap: 40px; padding-bottom: 32px; border-bottom: 1px solid rgba(164, 169, 209, 0.25); }
.site-foot .sf-brand img { display: block; width: 150px; height: auto; }
.site-foot .sf-pledge { margin: 16px 0 0; max-width: 46ch; color: var(--shell-muted); line-height: 1.55; }
.site-foot h2 { margin: 0 0 12px; font-size: 14px; font-weight: 700; letter-spacing: 0.02em; color: #fff; }
.site-foot ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.site-foot a { color: var(--shell-text); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; padding: 12px 0; text-underline-offset: 4px; }
.site-foot a:hover { color: #fff; text-decoration: underline; }
.site-foot a:focus-visible { outline: 3px solid #fff; outline-offset: 3px; border-radius: 2px; }
.site-foot .sf-base { display: flex; flex-wrap: wrap; gap: 8px 32px; justify-content: space-between; align-items: center; padding-top: 20px; color: var(--shell-muted); font-size: 14px; }
.site-foot.is-compact .sf-base { padding-top: 0; }
.site-foot .sf-links { display: flex; flex-wrap: wrap; gap: 0 24px; }
.site-foot .sf-note { margin: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.site-foot .sf-dev { color: #ffd48a; }
.site-foot .sf-urheber > span { white-space: nowrap; } /* BB16: keine Waisenzeile (einzelnes Wort in der letzten Zeile) */
.site-foot .sf-dev { text-wrap: balance; }

/* ---------- U1: Komponentenbibliothek (Feinschliff, Beschreibung in DESIGN.md) ---------- */
/* Klickflächen und Kontrast der geteilten Elemente */
.skip-link { min-height: 44px; display: inline-flex; align-items: center; }
.rail a.nav-item.is-locked[aria-current="page"] { color: #fff; }
.ledger td .fn a { display: inline; padding: 0; }

/* Zeilenkopf in Tabellen: gleiche Wirkung in allen Schlüssel-Wert-Tabellen */
.ledger th[scope="row"] { color: var(--ink); font-size: 14px; white-space: normal; border-bottom: 1px solid var(--hairline); padding: 11px 10px; }
.ledger tbody tr:has(th[scope="row"]) th { width: 34%; }

/* Tabellen- und Listenwerkzeuge (public/js/table-tools.js): Suchfeld, Zähler, sortierbare Spaltenköpfe */
.table-wrap-spaced { margin-top: 48px; }
.tbl-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 20px; margin: 32px 0 8px; }
.tbl-tools + .table-wrap, .tbl-tools + .members { margin-top: 0; }
.tbl-tools .field { flex: 0 1 380px; min-width: 0; }
.tbl-tools input[type="search"] { min-height: 44px; padding: 8px 12px; border: 1px solid var(--control); border-radius: 6px; background: var(--surface); font: 400 15px var(--sans); color: var(--ink); width: 100%; }
.tbl-count { margin: 0 0 12px; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl-sort { display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.tbl-sort::after { content: "\2195"; color: var(--ne); font-weight: 400; }
.ledger th[aria-sort="ascending"], .ledger th[aria-sort="descending"] { color: var(--ink); }
.ledger th[aria-sort="ascending"] .tbl-sort::after { content: "\2191"; color: var(--brand); font-weight: 700; }
.ledger th[aria-sort="descending"] .tbl-sort::after { content: "\2193"; color: var(--brand); font-weight: 700; }
.ledger th.num .tbl-sort { flex-direction: row-reverse; }
.ledger tbody tr[hidden], .members > li[hidden] { display: none; }

/* Einstellungen: Konfigurationsbereiche als gleichmäßiges Raster aus Karten */
.set-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 40px; }
.mc .set-grid > section { display: flex; flex-direction: column; align-items: flex-start; margin: 0; padding: 18px 20px 20px; background: var(--surface); border: 1px solid var(--hairline); border-top: 2px solid var(--ink); }
.mc .set-grid > section h2 { margin: 0 0 6px; font-size: 1.05rem; }
.set-grid > section p { margin: 0 0 16px; color: var(--muted); font-size: 14.5px; }
.set-grid > section .btn { margin-top: auto; }
.empty-line { margin: 0; padding: 14px 16px; border-top: 1px solid var(--ink); background: var(--surface); color: var(--muted); max-width: none; }
.mc-intro.is-flush { margin-top: 0; }
.mc-intro.is-spaced { margin-bottom: 24px; }
.members-lead.is-flush { margin: 0; }

/* Leerzustand: gleiche Abstände auf allen Seiten, auch unter .mb/.mc (deren h2-Abstände sonst greifen) */
.empty-state > h2:first-child { margin-top: 0; }

/* Meldungs- und Fehlerseiten: Hauptaktion und Nebenwege */
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn-subtle { border-color: var(--control); color: var(--ink); }
.btn-subtle:hover { background: var(--hairline); }

@media (max-width: 960px) {
  .rail-brand { display: flex; align-items: center; min-height: 44px; }
  .mb-more a, .bf-more a, .bf-ref a { display: inline-flex; align-items: center; min-height: 44px; }
  details > summary { min-height: 44px; }
  .tbl-sort { min-height: 44px; }
  .fw-checks a, a.bf-note { display: inline-block; padding: 11px 0; }
}
/* Datumsfelder: der Fokus liegt im Feld, der Rahmen gehört an das ganze Feld */
input[type="date"]:focus-within, input[type="time"]:focus-within, input[type="number"]:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
@media (max-width: 800px) { .set-grid { grid-template-columns: 1fr; } }

/* GE1: eingeklappte Erklärung auf Anmelde- und Freigabeseiten (eine Aussage oben, Details auf Wunsch). */
.auth-mehr { margin-top: 16px; }
.auth-mehr > summary { display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; font-weight: 600; color: var(--link); }
.auth-mehr > p { margin: 4px 0 0; max-width: 60ch; }
