/* blursafe. Admin — Oberflaeche im Corporate Design der Website.
   Reines Stylesheet: keine Funktion, keine Logik, keine Sicherheitsmerkmale.
   Nur HTML/CSS/Vanilla-JS, keine UI-Bibliothek, keine externen Ressourcen
   (Webfonts sind durch die CSP ohnehin ausgeschlossen). */

:root {
  /* Flaechen */
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-2: #fbfbfc;
  --sidebar: #0b0b0c;
  --sidebar-hover: #17171a;
  --sidebar-active: #1f1f23;

  /* Linien und Text */
  --line: #e6e6ea;
  --line-strong: #d8d8de;
  --ink: #0b0b0c;
  --ink-soft: #3f3f46;
  --muted: #71717a;
  --muted-light: #a1a1aa;
  --on-dark: #fafafa;
  --on-dark-muted: #8b8b95;

  /* Status (dezent, nur fuer Zustaende) */
  --ok: #15803d;
  --ok-bg: #f0fdf4;
  --ok-line: #bbf7d0;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --warn-line: #fde68a;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-line: #fecaca;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(9, 9, 11, 0.04), 0 1px 3px rgba(9, 9, 11, 0.06);
  --shadow-lg: 0 10px 30px rgba(9, 9, 11, 0.08), 0 2px 8px rgba(9, 9, 11, 0.04);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
a { color: inherit; }
p { margin: 0; }

/* ---------------------------------------------------------------- Marke */
.brand-mark {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ink);
}
.brand-mark span {
  display: block;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--muted);
  margin-top: 2px;
}
.sidebar .brand-mark { color: var(--on-dark); }
.sidebar .brand-mark span { color: var(--on-dark-muted); }

/* ------------------------------------------------------ Anmeldeansichten */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: var(--surface);
}
/* Rasterzellen duerfen nie breiter werden als ihre Spalte (min-width:auto
   waere der Standard und laesst langen Text ueberlaufen). */
.auth > * { min-width: 0; }
.auth h1, .auth .lead, .auth p { overflow-wrap: break-word; hyphens: auto; }
.auth-intro {
  padding: 56px 64px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.auth-intro-body {
  margin-top: auto;
  margin-bottom: auto;
  max-width: 520px;
}
.auth-intro h1 {
  font-size: clamp(38px, 4.6vw, 60px);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.035em;
}
.auth-intro .lead {
  margin-top: 22px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--muted);
  max-width: 30em;
}
.auth-foot { color: var(--muted-light); font-size: 13px; }

.auth-panel {
  background: var(--bg);
  border-left: 1px solid var(--line);
  padding: 56px 64px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  animation: rise 0.5s var(--ease) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.auth-card h2 {
  font-size: 20px;
  font-weight: 650;
  margin-bottom: 4px;
}
.auth-card .sub {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 24px;
}

/* ------------------------------------------------------------ Formulare */
label { display: block; font-size: 13.5px; font-weight: 500; color: var(--ink-soft); margin-bottom: 7px; }
.field { margin-bottom: 18px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="number"], input[type="date"], select, textarea {
  width: 100%;
  padding: 11px 13px;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input::placeholder { color: var(--muted-light); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(11, 11, 12, 0.08);
}
textarea { resize: vertical; min-height: 84px; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 8px;
  color: var(--muted); cursor: pointer;
}
.pw-toggle:hover { background: var(--bg); color: var(--ink); }

/* -------------------------------------------------------------- Buttons */
button {
  font: inherit;
  font-size: 14.5px;
  font-weight: 550;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
              color 0.15s var(--ease), transform 0.12s var(--ease), opacity 0.15s;
}
button:hover:not(:disabled) { background: #26262b; }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.55; cursor: default; }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

button.secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
button.secondary:hover:not(:disabled) { background: var(--bg); border-color: var(--muted-light); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover:not(:disabled) { background: var(--bg); color: var(--ink); }
button.danger { background: var(--danger); }
button.danger:hover:not(:disabled) { background: #991b1b; }
button.small { padding: 7px 13px; font-size: 13.5px; }
button.block { width: 100%; display: flex; align-items: center; justify-content: center; gap: 9px; }

/* Ladezustand: feste Hoehe, kein Layoutsprung */
.spinner {
  width: 15px; height: 15px; flex-shrink: 0;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
button.secondary .spinner, button.ghost .spinner {
  border-color: rgba(11, 11, 12, 0.2); border-top-color: var(--ink);
}
@keyframes spin { to { transform: rotate(360deg); } }

.linkbtn {
  display: inline-block; background: none; border: 0; padding: 0;
  color: var(--muted); font-size: 13.5px; font-weight: 450;
  text-decoration: none; cursor: pointer;
}
.linkbtn:hover { color: var(--ink); background: none; text-decoration: underline; }
.auth-alt { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); text-align: center; }

/* ------------------------------------------------------------ Hinweisbox */
.notice {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; line-height: 1.5;
  margin-bottom: 18px;
  animation: noticeIn 0.28s var(--ease) both;
}
@keyframes noticeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.notice svg { flex-shrink: 0; margin-top: 1px; }
.notice-error { background: var(--danger-bg); border: 1px solid var(--danger-line); }
.notice-ok { background: var(--ok-bg); border: 1px solid var(--ok-line); }
.notice-error svg { color: var(--danger); }
.notice-ok svg { color: var(--ok); }
/* Fliesstext bewusst dunkel: hoher Kontrast, nur die Ueberschrift faerbt. */
.notice > div { color: var(--ink-soft); }
.notice strong { display: block; font-weight: 650; margin-bottom: 2px; }
.notice-error strong { color: var(--danger); }
.notice-ok strong { color: var(--ok); }

/* --------------------------------------------------------- MFA-Codefeld */
.code-input { display: flex; gap: 9px; margin-bottom: 20px; }
.code-input input {
  width: 100%; height: 54px; padding: 0;
  text-align: center;
  font-size: 22px; font-weight: 600; letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  border-radius: var(--radius-sm);
}
.code-input input:not(:placeholder-shown) { border-color: var(--ink); }

/* --------------------------------------------------------- Abmeldeseite */
.leaving {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--surface);
}
.leaving-inner { text-align: center; animation: rise 0.4s var(--ease) both; }
.leaving .mark { margin-bottom: 26px; }
.leaving h2 { font-size: 26px; font-weight: 650; }
.leaving p { color: var(--muted); margin-top: 8px; font-size: 15px; }
.leaving .bar {
  width: 180px; height: 3px; margin: 24px auto 0;
  background: var(--line); border-radius: 99px; overflow: hidden;
}
.leaving .bar i { display: block; height: 100%; background: var(--ink); animation: fill 1.6s var(--ease) forwards; }
@keyframes fill { from { width: 0; } to { width: 100%; } }

/* ------------------------------------------------------ Anwendungsshell */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px; flex-shrink: 0;
  background: var(--sidebar);
  color: var(--on-dark);
  display: flex; flex-direction: column;
  padding: 26px 16px 18px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar > .brand-mark { padding: 0 10px; margin-bottom: 28px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--on-dark-muted);
  text-decoration: none;
  font-size: 14.5px; font-weight: 500;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.sidebar nav a svg { flex-shrink: 0; opacity: 0.85; }
.sidebar nav a:hover { background: var(--sidebar-hover); color: var(--on-dark); }
.sidebar nav a.active { background: var(--sidebar-active); color: var(--on-dark); }
.sidebar nav a.active svg { opacity: 1; }

.sidebar-footer { border-top: 1px solid rgba(255, 255, 255, 0.09); padding-top: 14px; }
.session-info {
  display: flex; flex-direction: column; gap: 1px;
  padding: 8px 12px 12px; font-size: 13px; color: var(--on-dark-muted);
}
.session-info .who { color: var(--on-dark); font-weight: 550; font-size: 14px; }
.session-info .role { text-transform: capitalize; }
#btn-logout {
  width: 100%; justify-content: flex-start; gap: 11px; display: flex; align-items: center;
  background: transparent; color: var(--on-dark-muted);
  border-color: transparent; padding: 10px 12px; font-weight: 500;
}
#btn-logout:hover { background: var(--sidebar-hover); color: var(--on-dark); }

/* Der Arbeitsbereich fuellt den gesamten Platz rechts neben der Navigation.
   Frueher stand hier max-width:1560px. Zusammen mit der 248 px breiten
   Seitenleiste endete der Inhalt dadurch bei 1808 px — auf 1920 px blieben
   75 px, auf 2560 px 730 px ungenutzt, waehrend die Kopfleiste bereits bis
   zum Rand lief. Keine Ersatzbegrenzung: die Rasterregeln weiter unten
   bestimmen, wie die gewonnene Breite auf Spalten verteilt wird.
   Der Innenabstand waechst mit, bleibt auf Laptopbreiten aber bei 40 px. */
main { flex: 1; min-width: 0; padding: 34px clamp(40px, 2.2vw, 64px) 56px; }

/* ------------------------------------------------------------ Seitenkopf */
.pagehead { display: flex; align-items: flex-start; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.pagehead h2 { font-size: 34px; font-weight: 700; letter-spacing: -0.035em; }
.pagehead .sub { color: var(--muted); margin-top: 4px; font-size: 15px; }
.pagehead-actions { margin-left: auto; display: flex; gap: 9px; align-items: center; }

/* -------------------------------------------------------------- Karten */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 18px;
}
.card h3 {
  font-size: 16px; font-weight: 650; letter-spacing: -0.01em;
  margin-bottom: 16px; display: flex; align-items: center; gap: 10px;
}
.card h3 .right { margin-left: auto; }
.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; align-items: start; }

/* ------------------------------------------------------------- Kacheln */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 16px; margin-bottom: 18px; }
.tile {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px 20px;
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.tile:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.tile .lbl {
  display: flex; align-items: center; gap: 9px;
  color: var(--ink-soft); font-size: 13.5px; font-weight: 500; margin-bottom: 12px;
}
.tile .lbl svg { color: var(--muted); }
.tile .num { font-size: 34px; font-weight: 700; letter-spacing: -0.04em; line-height: 1.05; }
.tile .foot { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.tile.status .num { font-size: 21px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 9px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.dot.bad { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }

/* ------------------------------------------------------------ Tabellen */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 11px 12px; white-space: nowrap; }
table.data th {
  color: var(--muted); font-weight: 500; font-size: 12.5px;
  border-bottom: 1px solid var(--line); padding-bottom: 9px;
}
table.data td { border-bottom: 1px solid var(--line); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data th[data-sort] { cursor: pointer; user-select: none; }
table.data th[data-sort]:hover { color: var(--ink); }
table.data th.sorted-asc::after { content: " ↑"; color: var(--ink); }
table.data th.sorted-desc::after { content: " ↓"; color: var(--ink); }
table.data tbody tr { transition: background 0.12s var(--ease); }
table.data tbody tr:hover { background: var(--surface-2); }
tr.rowlink { cursor: pointer; }

/* Zweizeilige Tabellenzelle: Hauptwert oben, Nebeninformation darunter. */
.zelle { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.zelle .neben { font-size: 12px; color: var(--muted); }

/* Lizenzkennungen sind bis zu 32 Zeichen lang. Sie duerfen die Spalte nicht
   aufblaehen, bleiben aber vollstaendig ueber title und Detailseite
   erreichbar. */
#lic-table col.c-eng { width: 1%; }
#lic-table .lizenz-id { display: block; max-width: 28ch; overflow: hidden; text-overflow: ellipsis; }
#lic-table .spalte-aktionen { width: 1%; text-align: right; }
#lic-table td.spalte-aktionen { padding-top: 6px; padding-bottom: 6px; }
/* Kundenname darf umbrechen statt die Tabelle zu verbreitern. */
#lic-table td.spalte-kunde { white-space: normal; max-width: 26ch; }

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--ink-soft); }
a.mono, td a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
a.mono:hover, td a:hover { border-bottom-color: var(--ink); }

.badge {
  display: inline-block; padding: 3px 10px; border-radius: 99px;
  font-size: 12px; font-weight: 550; border: 1px solid var(--line-strong); color: var(--ink-soft);
  background: var(--surface-2);
}
.badge.active { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); }
.badge.suspended, .badge.inactive { color: var(--warn); border-color: var(--warn-line); background: var(--warn-bg); }
.badge.revoked, .badge.archived { color: var(--danger); border-color: var(--danger-line); background: var(--danger-bg); }
.badge.expired { color: var(--warn); border-color: var(--warn-line); background: var(--warn-bg); }

/* ---------------------------------------------------------- Werkzeuge */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; align-items: center; }
.toolbar input[type="search"] { max-width: 300px; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
/* Suchfeld rechts in der Filterleiste; bricht auf schmalen Schirmen unter
   die Filter und nimmt dort die volle Breite. */
.toolbar .rechts input[type="search"] { width: 320px; max-width: 100%; }
.chain-badge {
  font-size: 13px; padding: 6px 13px; border-radius: 99px;
  border: 1px solid var(--line-strong); color: var(--muted); background: var(--surface);
}
.chain-badge.ok { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); }
.chain-badge.bad { color: var(--danger); border-color: var(--danger-line); background: var(--danger-bg); }
/* flex-wrap: auf schmalen Schirmen darf die Seiteninformation umbrechen,
   ohne dass „Zurueck“ oder „Weiter“ unerreichbar werden. */
.pager { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; color: var(--muted); font-size: 13.5px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 11px 24px; margin: 0; font-size: 14.5px; }
.kv dt { color: var(--muted); font-weight: 450; }
.kv dd { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; }
.backlink { color: var(--muted); text-decoration: none; font-size: 14px; display: inline-block; margin-bottom: 14px; }
.backlink:hover { color: var(--ink); }
.notes { white-space: pre-wrap; font-size: 14.5px; color: var(--ink-soft); }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 13.5px; }

/* --------------------------------------------------------- Donut-Chart */
.donut-wrap { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.donut { flex-shrink: 0; }
.donut-legend { display: flex; flex-direction: column; gap: 11px; font-size: 14px; flex: 1; min-width: 160px; }
.donut-legend .row { display: flex; align-items: center; gap: 10px; }
.donut-legend .swatch { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.donut-legend .val { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.donut-total {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line);
  display: flex; align-items: baseline; justify-content: space-between;
}
.donut-total .n { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }

/* ------------------------------------------------------- Lizenzassistent */
/* Die Deckelung galt fuer das einspaltige Formular. Zweispaltig ist sie zu
   eng: bei 1635 px Inhaltsbreite blieben rechts 995 px leer. Die Breite
   ergibt sich jetzt aus dem Raster darunter. */
.wizard { max-width: none; }
.step { display: flex; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.step:last-of-type { border-bottom: 0; }
/* Die Regel .stepno ist entfallen: die nummerierten Marker wurden aus dem
   Markup entfernt, es gab keinen anderen Verwender. */
.step .field { flex: 1; min-width: 0; margin-bottom: 0; }

/* ------------------------------------------- Formular „Neue Lizenz anlegen“
   Zweispaltig ab 1100 px. Die DOM-Reihenfolge (Kunde … Kommentar, dann
   Hinweis, dann Absenden) ist zugleich Tab- und Mobilreihenfolge; die
   Spaltenzuweisung im Fussbereich erfolgt ueber grid-column, nicht ueber
   order. */
.nl-felder { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 32px; }
.nl-felder > * { min-width: 0; }
.nl-felder .step { border-bottom: 0; padding: 12px 0; align-items: flex-start; }
.feldhilfe { display: block; margin-top: 6px; font-size: 12.5px; color: var(--muted); }

.nl-fuss {
  display: grid; grid-template-columns: minmax(0, 1fr);
  gap: 16px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line);
}
.nl-fuss > * { min-width: 0; }
.nl-aktion { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
/* Der Knopf behaelt seine Eigenbreite; volle Breite erst auf Mobilbreiten
   (Regel im 880er Breakpoint weiter unten). */
.nl-aktion #nl-submit { align-self: flex-start; }

/* Dezente Informationsbox — kein Warnstil, keine Akzentfarbe, kein role. */
.infobox {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 13px 15px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13.5px; line-height: 1.5; color: var(--muted);
}
.infobox-icon { flex-shrink: 0; display: flex; margin-top: 1px; color: var(--muted-light); }

@media (min-width: 1100px) {
  .nl-felder { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Rasterzeilen teilen sich beide Spalten. Der Hilfetext unter „Laufzeit“
     machte seine Zeile 25 px hoeher als die linke Zelle daneben, weshalb
     „Kommentar“ 49 statt 24 px Abstand hatte. Er wird deshalb aus dem Fluss
     genommen und unter dem Feld positioniert — darunter liegt in der rechten
     Spalte ohnehin freie Flaeche. Einspaltig bleibt er im Fluss. */
  .nl-felder .field { position: relative; }
  .nl-felder .feldhilfe { position: absolute; top: 100%; left: 0; right: 0; }
  .nl-fuss { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; }
  /* Absenden links, Hinweis rechts — unabhaengig von der DOM-Reihenfolge und
     davon, ob Schritt 4 bei Plan „lifetime“ ausgeblendet ist. */
  .nl-fuss .infobox { grid-column: 2; grid-row: 1; }
  .nl-fuss .nl-aktion { grid-column: 1; grid-row: 1; }
}

.keyreveal { max-width: 620px; border-color: var(--warn-line); }
.keyreveal h2 { font-size: 24px; font-weight: 700; margin-bottom: 14px; }
.keyreveal h2:focus { outline: none; }
.keyreveal .kv { margin-top: 20px; }
.keyreveal .actions { margin-top: 16px; }
.confirm-row {
  display: flex; align-items: flex-start; gap: 11px;
  margin: 22px 0 0; padding: 14px 16px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14.5px; font-weight: 500; color: var(--ink); cursor: pointer;
}
.confirm-row input { width: 17px; height: 17px; margin: 1px 0 0; flex-shrink: 0; accent-color: var(--ink); cursor: pointer; }
.confirm-row:hover { border-color: var(--muted-light); }
.warn-box {
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  border-radius: var(--radius-sm); padding: 13px 15px;
  font-size: 14px; color: var(--warn); line-height: 1.5;
}
.keybox {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 19px; letter-spacing: 0.02em; font-weight: 600;
  background: var(--sidebar); color: #fff;
  border-radius: var(--radius-sm); padding: 18px 20px;
  margin: 18px 0; word-break: break-all; user-select: all; text-align: center;
}

/* ------------------------------------------------------ Releaseverwaltung */
/* Hinweisband ueber der Releaseliste: die Veroeffentlichungssperre muss
   sichtbar sein, bevor jemand ein Release vorbereitet. */
.gate-banner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; margin-bottom: 18px;
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  border-radius: var(--radius-sm);
  font-size: 13.5px; line-height: 1.55;
}
.gate-banner svg { flex-shrink: 0; margin-top: 1px; color: var(--warn); }
.gate-banner strong { display: block; color: var(--warn); font-weight: 650; margin-bottom: 2px; }
.gate-banner span { color: var(--ink-soft); }

.badge.draft { color: var(--muted); }
.badge.artifacts_uploaded, .badge.verified { color: var(--ink-soft); border-color: var(--muted-light); }
.badge.signed, .badge.ready { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); }
.badge.published { color: var(--ok); border-color: var(--ok-line); background: var(--ok-bg); }
.badge.paused { color: var(--warn); border-color: var(--warn-line); background: var(--warn-bg); }
.badge.withdrawn, .badge.superseded { color: var(--danger); border-color: var(--danger-line); background: var(--danger-bg); }

.upload-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 18px; }
.upload-grid .field { margin-bottom: 14px; }
input[type="file"] {
  padding: 9px 11px; font-size: 13.5px; color: var(--ink-soft);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); width: 100%;
}
.progress {
  height: 6px; border-radius: 99px; background: var(--surface-2);
  border: 1px solid var(--line); overflow: hidden; margin: 4px 0 8px;
}
.progress > i { display: block; height: 100%; width: 0; background: var(--ink); transition: width 0.2s var(--ease); }
.upload-status { margin-bottom: 12px; }
.upload-zahlen {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.upload-zahlen span { flex: 1; }
.filter-check {
  display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-soft);
  cursor: pointer; white-space: nowrap;
}
/* Die Toolbar gibt Eingabefeldern eine Mindestbreite von 150px — fuer ein
   Ankreuzfeld ergibt das eine leere Flaeche zwischen Kaestchen und Text. */
.filter-check input[type="checkbox"],
.toolbar input[type="checkbox"] {
  width: 16px; height: 16px; min-width: 0; margin: 0;
  accent-color: var(--ink); cursor: pointer; flex: 0 0 auto;
}

/* Die Artefaktzeile traegt bis zu vier Aktionen. Ohne Begrenzung schiebt
   sie die Tabelle aus dem sichtbaren Bereich; so brechen die Knoepfe um. */
#ud-artifacts td:last-child .actions { max-width: 200px; }
#ud-artifacts td { vertical-align: top; }
.status-code { font-variant-numeric: tabular-nums; font-weight: 600; }
.status-code.ok { color: var(--ok); }
.status-code.warn { color: var(--warn); }
.status-code.bad { color: var(--danger); }
tr.tombstone td { opacity: 0.55; }
tr.tombstone td:first-child::before { content: "✕ "; color: var(--danger); }

.codebox {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.6;
  background: var(--sidebar); color: #fff;
  border-radius: var(--radius-sm); padding: 16px 18px;
  overflow-x: auto; white-space: pre; margin: 0;
}
.hash { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--muted); }

/* =========================================================================
   Phase D2.1 — Enterprise-Layout
   Ausschliesslich bestehende Farbtokens. Kein neuer Farbwert, keine neue
   Schrift, keine neuen Rundungen oder Schatten. Veraendert wird nur die
   Anordnung, die Dichte und die Bedienung.
   ========================================================================= */

/* ------------------------------------------------------- Arbeitsbereich */
.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Kopfleiste: bleibt beim Blaettern stehen und traegt Marke und die drei
   Kopfmenues. */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 18px;
  /* Waechst im selben Verhaeltnis wie der Innenabstand von main, damit
     Kopfleiste und Inhalt auf breiten Schirmen nicht auseinanderlaufen. */
  padding: 12px clamp(30px, 1.65vw, 48px);
  /* Hoehe der frueheren Kopfzeile mit Suchfeld — bewusst beibehalten,
     damit der Ausbau der globalen Suche die Leiste nicht schrumpfen laesst. */
  min-height: 71px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-brand { flex-shrink: 0; }
.topbar-brand.brand-mark { font-size: 18px; }
.topbar-brand.brand-mark span { display: inline; font-size: 18px; font-weight: 400; margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-shrink: 0; }

.iconbtn {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 38px; height: 38px; padding: 0;
  background: transparent; border: 1px solid transparent; color: var(--ink-soft);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.iconbtn:hover:not(:disabled) { background: var(--bg); border-color: var(--line); color: var(--ink); }
.iconbtn[aria-expanded="true"] { background: var(--bg); border-color: var(--line-strong); color: var(--ink); }
.iconbtn.wide { width: auto; padding: 0 12px; font-size: 14px; font-weight: 500; }
.iconbtn .avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--sidebar); color: var(--on-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.02em; flex-shrink: 0;
}
.iconbtn .zahl {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 99px; background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 700; line-height: 16px; text-align: center;
}

/* Aufklappmenue der Kopfleiste und der Tabellenaktionen */
.menu {
  position: fixed; z-index: 60; min-width: 240px; max-width: 340px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 6px; animation: rise 0.16s var(--ease) both;
}
.menu h4 {
  margin: 0; padding: 8px 10px 6px;
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted);
}
.menu button, .menu a {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 14px; text-align: left; text-decoration: none;
  border-radius: 8px; cursor: pointer;
}
.menu button:hover:not(:disabled), .menu a:hover { background: var(--bg); }
.menu button:disabled { color: var(--muted-light); cursor: not-allowed; }
.menu button.danger-item { color: var(--danger); }
.menu button.danger-item:hover:not(:disabled) { background: var(--danger-bg); }
.menu .trenner { height: 1px; background: var(--line); margin: 6px 4px; }
.menu .zeile {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 7px 10px; font-size: 13.5px; color: var(--muted);
}
.menu .zeile b { color: var(--ink); font-weight: 550; }
.menu .leer { padding: 10px; font-size: 13.5px; color: var(--muted); }
.menu .hinweis {
  display: flex; gap: 9px; padding: 9px 10px; border-radius: 8px;
  font-size: 13.5px; line-height: 1.45; color: var(--ink-soft);
}
.menu .hinweis.warn { background: var(--warn-bg); }
.menu .hinweis.bad { background: var(--danger-bg); }
.menu .hinweis.ok { background: var(--ok-bg); }
.menu .hinweis b { display: block; color: var(--ink); font-weight: 600; }

.menubtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0; flex-shrink: 0;
  background: transparent; border: 1px solid var(--line); color: var(--ink-soft);
  border-radius: 8px; cursor: pointer; font-size: 15px; line-height: 1;
}
.menubtn:hover:not(:disabled) { background: var(--bg); border-color: var(--line-strong); color: var(--ink); }
.menubtn[aria-expanded="true"] { background: var(--bg); border-color: var(--line-strong); }

/* -------------------------------------------------- Aufklappbares Anlegen */
.collapsible { margin-bottom: 18px; padding: 0; overflow: hidden; }
.collapsible > summary {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 22px; cursor: pointer; list-style: none;
  font-size: 15.5px; font-weight: 600; color: var(--ink);
}
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible > summary .chev {
  margin-left: auto; color: var(--muted);
  transition: transform 0.18s var(--ease);
}
.collapsible[open] > summary { border-bottom: 1px solid var(--line); }
.collapsible[open] > summary .chev { transform: rotate(180deg); }
.collapsible > summary .plus {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--ink); color: #fff; flex-shrink: 0;
}
.collapsible > summary .sub { font-size: 13.5px; font-weight: 400; color: var(--muted); }
.collapsible-body { padding: 22px; }
/* Karten im Aufklappbereich verlieren ihren eigenen Rahmen — sonst steckt
   eine Karte sichtbar in einer Karte. */
.collapsible-body > .card {
  border: 0; box-shadow: none; padding: 0; margin: 0; background: transparent;
}
.collapsible-body > .card + .card { margin-top: 22px; }
/* Zweite Deckelung derselben Karte — sie war die wirksame (640 statt 620).
   Ebenfalls aufgehoben; die Breite regelt jetzt .nl-felder. */
.collapsible-body .wizard { max-width: none; }
.collapsible-body .keyreveal {
  border: 1px solid var(--warn-line); border-radius: var(--radius);
  padding: 24px; background: var(--surface);
}

/* ------------------------------------------------------------- Kopfzeile */
.pagehead { align-items: flex-start; }
.toolbar { justify-content: flex-start; }
.toolbar .rechts { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.kartenkopf { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }

/* -------------------------------------------------------- Kennzahlkacheln */
.tiles.kompakt { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
/* Lange, ungetrennte Werte (Adressen, Schluesselkennungen) duerfen die Kachel
   weder sprengen noch den Statuspunkt auf eine eigene Zeile schieben. */
.tile.status .num { flex-wrap: nowrap; align-items: baseline; font-size: 18px; }
.tile.status .num > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.tile.status .dot { align-self: center; }
.tile .trend { font-size: 12.5px; color: var(--muted); margin-top: 6px; display: flex; gap: 6px; align-items: center; }
.tile .trend b { color: var(--ink); font-weight: 600; }

/* Balken statt reiner Zahlen: nutzt nur Tinte und Flaechen */
.balken { display: flex; flex-direction: column; gap: 12px; }
.balken .zeile { display: grid; grid-template-columns: 130px 1fr auto; gap: 12px; align-items: center; font-size: 14px; }
.balken .spur { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; }
.balken .spur i { display: block; height: 100%; background: var(--ink); }
.balken .wert { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }

/* --------------------------------------------------------------- Tabellen */
/* Rasterspalten haben von Haus aus min-width:auto — eine breite Tabelle
   sprengt damit ihre Spalte und schiebt die ganze Seite auseinander.
   min-width:0 laesst sie stattdessen innerhalb ihres Bereichs scrollen. */
.grid-2 > *, .tiles > *, .layout > *, .workspace > * { min-width: 0; }
.card > .table-wrap, .collapsible-body { min-width: 0; }
.table-wrap { overflow-x: auto; min-width: 0; }
table.data th { white-space: nowrap; }
table.data td .actions { flex-wrap: nowrap; }
table.data td:last-child { text-align: right; white-space: nowrap; }
table.data th:last-child { text-align: right; }
/* Die Rechtsbuendigkeit der Aktionsspalte darf den Leerzustand nicht erfassen. */
table.data td[colspan] { text-align: center; white-space: normal; }
.leerzustand { padding: 34px 20px; text-align: center; color: var(--muted); font-size: 14.5px; }
.leerzustand b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; font-size: 15px; }

/* ------------------------------------------------------------- Responsive */
@media (max-width: 1080px) {
  .topbar { padding: 10px 20px; gap: 12px; }
}
@media (max-width: 880px) {
  .workspace { width: 100%; }
  .topbar { flex-wrap: wrap; padding: 10px 16px; }
  .topbar-brand { order: 1; }
  .topbar-actions { order: 2; }
  .menu { max-width: calc(100vw - 32px); }
  .balken .zeile { grid-template-columns: 100px 1fr auto; }
}

/* =========================================================================
   Phase D2.2 — Kontrollzentrum
   Wieder ausschliesslich bestehende Farbtokens. Die Diagramme arbeiten mit
   Tinte auf Flaeche und den drei Statusfarben; kein neuer Farbwert.
   ========================================================================= */

/* Lange Titel in Kurzlisten duerfen die Karte nicht in die Hoehe treiben. */
.liste .kopf b, .liste .kopf span {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* -------------------------------------------------------------------------
   Zone 1 — Hero: Begruessung und Schnellaktionen in EINER Zeile.
   Vorher standen vier grosse Aktionskacheln als eigener Block darueber; das
   kostete rund 130 px Hoehe fuer vier Woerter. Jetzt tragen sie die Kopfzeile
   mit, so wie in Stripe/Vercel die primaeren Aktionen neben dem Seitentitel
   stehen.
   ------------------------------------------------------------------------- */
.hero {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; margin-bottom: 20px;
}
.hero-text { min-width: 0; }
.hero-text h2 { font-size: 30px; letter-spacing: -0.03em; }
.hero-text .sub { color: var(--muted); font-size: 14.5px; margin-top: 4px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.schnellaktion {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 10px 15px 10px 11px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  font: inherit; font-size: 14px; font-weight: 550; white-space: nowrap;
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease), border-color 0.15s var(--ease);
}
.schnellaktion:hover:not(:disabled) {
  color: #fff;
  border-color: var(--muted-light); box-shadow: var(--shadow-lg); transform: translateY(-1px);
}
.schnellaktion .sym {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--ink); color: #fff;
}
/* Die erste Aktion ist die haeufigste — sie traegt die volle Tinte. */
.schnellaktion.primaer { background: var(--ink); color: var(--on-dark); border-color: var(--ink); }
.schnellaktion.primaer .sym { background: rgba(255, 255, 255, 0.16); color: var(--on-dark); }
.schnellaktion.primaer:hover:not(:disabled) { border-color: var(--ink); }

/* -------------------------------------------------------------------------
   Zone 2 — Statusband: ein durchgehendes Band statt fuenf Einzelkacheln.
   Links das Gesamturteil (beantwortet "Ist das System gesund?" in unter einer
   Sekunde), rechts die Einzelwerte als gleichwertige Segmente.
   ------------------------------------------------------------------------- */
.statusband {
  display: grid; grid-template-columns: minmax(210px, auto) minmax(0, 1fr);
  gap: 0; padding: 0; overflow: hidden; margin-bottom: 20px;
}
.statusband-urteil {
  display: flex; flex-direction: column; justify-content: center; gap: 3px;
  /* Kein eigener Grauton und keine Trennlinie zu den Kacheln mehr — das
     Urteil steht auf dem Kartenweiss des Bands, der Abstand traegt allein. */
  padding: 18px 22px;
}
.statusband-urteil .zeile { display: flex; align-items: center; gap: 9px; }
.statusband-urteil b { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.statusband-urteil span { font-size: 12.5px; color: var(--muted); }
.statusband-urteil.ok b { color: var(--ok); }
.statusband-urteil.warn b { color: var(--warn); }
.statusband-urteil.bad b { color: var(--danger); }

.statusband-punkte {
  /* Mindestbreite 124px statt 150px: mit dem Kachelabstand unten haetten
     fuenf Punkte sonst schon auf 1600er-Desktops umgebrochen (gemessen:
     716px Innenbreite, fuenf Kacheln brauchen 5*min + 4*14). Mit 124px
     stehen sie dort und auf dem einspaltigen 1280er-Dashboard in EINER
     Reihe; erst wo der Platz wirklich fehlt (etwa 1366px zweispaltig),
     verteilt auto-fit gleichmaessig auf zwei Zeilen. Die Inhalte tragen
     das: Beschriftungen ellipsieren, Werte brechen notfalls um. */
  display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
  /* Frueher klebten die Punkte als Segmente mit 1px-Trennlinien aneinander
     und sassen ohne Luft an den Bandkanten. Jetzt trennt sie derselbe
     Kachelabstand wie bei den Kennzahlen darunter (.kpis, 14px), und der
     Innenabstand des Bereichs gibt der Reihe oben und unten Luft — die
     18px seitlich entsprechen Fusszeile und Urteilsspalte des Bands. */
  gap: 14px; padding: 14px 18px;
}
.statuspunkt {
  min-width: 0;
}
.statuspunkt .lbl {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted); margin-bottom: 5px;
}
.statuspunkt .lbl svg { flex-shrink: 0; }
.statuspunkt .lbl span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.statuspunkt .wert {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; min-width: 0;
}
.statuspunkt .wert > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.statusband-fuss {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 12px;
  /* Weiss wie die Karte; die horizontale Linie darueber bleibt als
     dezente Strukturierung des Blocks bestehen. */
  padding: 9px 18px; border-top: 1px solid var(--line);
  font-size: 12.5px;
}
.statusband-fuss button { margin-left: auto; }

/* -------------------------------------------------------------------------
   Zone 3 — Arbeitsflaeche.
   Zwei Spalten, aber die Schiene wird auf die HOEHE der Hauptspalte
   gestreckt (align-items: stretch). Genau daran krankte die alte Fassung:
   die Nebenspalte endete nach dem ersten Bildschirm und darunter blieb
   ueber 1000 px Leerflaeche stehen.
   ------------------------------------------------------------------------- */
.dash {
  /* Die Nebenspalte war starr 340 px. Auf breiten Schirmen ging der gesamte
     Zugewinn an die Hauptspalte; die Schiene wirkte dann zu duenn. Sie waechst
     jetzt bis 380 px mit. Untergrenze bewusst 340 px statt weniger: bis rund
     1890 px Viewport bleibt damit exakt die bisherige Aufteilung stehen, sonst
     verloere die Hauptspalte auf 1366 px Breite Platz an die Schiene. */
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(340px, 18vw, 380px);
  gap: 18px; align-items: stretch;
}
.dash-haupt { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.dash-haupt > .grid-2 { align-items: stretch; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1080px) {
  .dash-haupt > .grid-2 { grid-template-columns: 1fr; }
}
.dash-schiene { display: flex; flex-direction: column; gap: 18px; min-width: 0; min-height: 0; }
/* Das letzte Modul der Schiene fuellt den Rest der Spalte — mit Basis 0:
   bei Basis auto trug die Aktivitaetsliste ihre volle Inhaltshoehe in die
   Schiene ein, die Schiene wurde hoeher als die Hauptspalte und zog die
   Gridzeile mit — die Karte ragte unter die letzte Kartenzeile. Mit Basis 0
   bestimmt allein die Hauptspalte die Zeilenhoehe (align-items: stretch),
   die Karte erhaelt den Rest der Schiene und schliesst buendig ab. */
.dash-schiene .timeline-card { flex: 1 1 0px; min-height: 280px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; align-items: stretch; }
.grid-3 > *, .grid-4 > * { min-width: 0; }

/* Kennzahlen: sechs gleichwertige Werte in einer Reihe. */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.kpis > * { min-width: 0; }
.kpis .tile .lbl { font-size: 12.5px; }
.kpis .tile .num { font-size: 27px; }
.kpis .tile .foot { overflow-wrap: anywhere; }
.kpis .umsatz-tile .num { font-size: 22px; overflow-wrap: anywhere; }

/* --------------------------------------------------------- Verlaufsgrafik */
.verlauf { display: flex; align-items: flex-end; gap: 3px; height: 132px; margin-top: 6px; }
.verlauf .saeule {
  flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end;
  height: 100%; border-radius: 3px 3px 0 0; position: relative;
}
.verlauf .saeule i {
  display: block; width: 100%; background: var(--ink); border-radius: 3px 3px 0 0;
  min-height: 2px; transition: opacity 0.15s var(--ease);
}
.verlauf .saeule.leer i { background: var(--line); }
.verlauf .saeule:hover i { opacity: 0.72; }
.verlauf.hoch { height: 190px; }
.verlauf.zweireihig { gap: clamp(2px, 0.3vw, 6px); }
.chart-tag { flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; gap: 2px; }
.chart-tag i { display: block; flex: 1; min-width: 0; border-radius: 3px 3px 0 0; }
.chart-tag .aktivierung, .chart-legende .aktivierung { background: var(--ink); }
.chart-tag .teststart, .chart-legende .teststart { background: #2563eb; }
.chart-legende { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 14px; font-size: 13px; }
.chart-legende > span { display: flex; align-items: center; gap: 7px; }
.chart-legende i { width: 11px; height: 11px; flex-shrink: 0; border-radius: 2px; }
.chart-hinweis { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.chart-gross h3 { flex-wrap: wrap; }
.verlauf-achse {
  display: flex; justify-content: space-between;
  margin-top: 8px; font-size: 12px; color: var(--muted);
}
.achse {
  display: flex; justify-content: space-between;
  margin-top: 8px; font-size: 12px; color: var(--muted);
}
.summe { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.summe span { font-weight: 400; color: var(--muted); }

/* Flaechendiagramm (Kundenwachstum) — dieselbe Tinte wie die Saeulen. */
.flaeche { height: 108px; margin-top: 6px; }
.flaeche svg { display: block; width: 100%; height: 100%; }
.kennwert { margin-top: 10px; font-size: 13px; color: var(--muted); }
.kennwert b { color: var(--ink); font-weight: 600; font-size: 15px; }

/* Karten in Rasterreihen sind gleich hoch — der Inhalt sitzt oben, der
   Fussbereich unten. Ohne das "rutschen" Karten unterschiedlich weit. */
.grid-3 > .card, .grid-4 > .card { display: flex; flex-direction: column; }
.grid-3 > .card > .liste, .grid-4 > .card > .balken { flex: 1 1 auto; }
.donut-wrap.kompakt { gap: 16px; }
.donut-wrap.kompakt .donut svg { width: 108px; height: 108px; }
.donut-wrap.kompakt .donut-legend { gap: 7px; font-size: 13px; min-width: 118px; }

/* Ehrlicher Leerzustand fuer Angaben, die das Datenmodell nicht hergibt. */
.nichtverfuegbar {
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
  padding: 16px; margin-top: 4px;
  background: var(--surface-2); border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
}
.nichtverfuegbar .marke {
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--warn); background: var(--warn-bg);
  border: 1px solid var(--warn-line); border-radius: 99px; padding: 2px 9px;
}
.nichtverfuegbar p { font-size: 13px; color: var(--muted); line-height: 1.5; }

/* ---------------------------------------------------------- Offene Aufgaben */
.aufgaben { display: flex; flex-direction: column; gap: 10px; }
.aufgabe {
  display: flex; align-items: flex-start; gap: 12px; width: 100%; text-align: left;
  padding: 13px 15px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 400;
}
button.aufgabe:hover:not(:disabled) { background: var(--bg); border-color: var(--muted-light); }
.aufgabe.warn { background: var(--warn-bg); border-color: var(--warn-line); }
.aufgabe.bad { background: var(--danger-bg); border-color: var(--danger-line); }
.aufgabe.ok { background: var(--ok-bg); border-color: var(--ok-line); }
.aufgabe .sym { flex-shrink: 0; margin-top: 1px; color: var(--muted); }
.aufgabe.warn .sym { color: var(--warn); }
.aufgabe.bad .sym { color: var(--danger); }
.aufgabe.ok .sym { color: var(--ok); }
.aufgabe .txt { min-width: 0; }
.aufgabe b { display: block; font-weight: 600; margin-bottom: 1px; }
.aufgabe span { color: var(--ink-soft); font-size: 13.5px; line-height: 1.45; }
.aufgabe .pfeil { margin-left: auto; color: var(--muted-light); flex-shrink: 0; }

/* ------------------------------------------------------------- Kurzlisten */
.liste { display: flex; flex-direction: column; }
.liste a, .liste .eintrag {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 2px; border-bottom: 1px solid var(--line);
  text-decoration: none; color: var(--ink);
}
.liste a:last-child, .liste .eintrag:last-child { border-bottom: 0; }
.liste a:hover { background: var(--surface-2); }
.liste .kopf { min-width: 0; flex: 1; }
.liste .kopf b { display: block; font-weight: 550; font-size: 14.5px; overflow-wrap: anywhere; }
.liste .kopf span { display: block; font-size: 12.5px; color: var(--muted); }
.liste .rechts { flex-shrink: 0; text-align: right; font-size: 12.5px; color: var(--muted); }

/* --------------------------------------------------------------- Timeline */
/* Kein Viewport-Deckel mehr (frueher calc(100vh - 110px)): der hatte mit der
   Dashboard-Geometrie nichts zu tun und liess die Karte je nach Bildschirm
   ueber- oder unterlaufen. Die Hoehe kommt jetzt aus der Spalte selbst;
   in den Stapel-Breakpoints gelten weiterhin deren eigene Deckel. */
.timeline-card { display: flex; flex-direction: column; min-height: 0; }
.timeline {
  list-style: none; margin: 0; padding: 0 0 0 20px;
  /* Fuellt den Rest der Karte und scrollt intern, statt sie zu dehnen. */
  flex: 1 1 0px; min-height: 0;
  overflow-y: auto; position: relative;
}
.timeline::before {
  content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px;
  width: 1px; background: var(--line);
}
#dash-timeline { overflow: clip; }
.timeline li { position: relative; padding: 9px 0; }
.timeline li::before {
  content: ""; position: absolute; left: -20px; top: 15px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--muted-light);
}
.timeline li.ok::before { border-color: var(--ok); }
.timeline li.warn::before { border-color: var(--warn); }
.timeline li.bad::before { border-color: var(--danger); }
.timeline .was { font-size: 14px; font-weight: 550; overflow-wrap: anywhere; }
.timeline .wer { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.timeline .wann { font-size: 12px; color: var(--muted-light); }

/* -------------------------------------------------------------------------
   Responsive — vier Stufen. Ziel ist, dass auf JEDER Stufe die Reihen voll
   werden: keine einzelne Karte, die allein in einer Reihe steht, und keine
   Spalte, die frueher endet als ihre Nachbarin.
   ------------------------------------------------------------------------- */

/* Grosser Laptop: sechs Kennzahlen werden zu drei mal zwei, die vier
   Verteilungen zu zwei mal zwei. */
@media (max-width: 1580px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Kleiner Laptop: die Schiene traegt sich nicht mehr — sie wandert unter die
   Hauptspalte und wird dort selbst zu einer Reihe aus drei Karten, damit
   unten keine schmale Restspalte stehen bleibt. */
@media (max-width: 1280px) {
  .dash { grid-template-columns: 1fr; }
  .dash-schiene {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
  }
  .dash-schiene .timeline-card { min-height: 0; max-height: 460px; }
  /* Gestapelt gibt es keine Nachbarspalte, an der sich die Karte strecken
     koennte — die Liste traegt wieder ihre Inhaltshoehe (Basis auto) und
     der max-height-Deckel der Karte uebernimmt das interne Scrollen. */
  .timeline { flex-basis: auto; }
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Tablet quer */
@media (max-width: 1080px) {
  .statusband { grid-template-columns: 1fr; }
  /* Gestapelt trennt eine HORIZONTALE Linie das Urteil von den Kacheln —
     die entfallene vertikale gibt es hier ohnehin nicht mehr. */
  .statusband-urteil { border-bottom: 1px solid var(--line); }
  .dash-schiene { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-schiene .timeline-card { grid-column: 1 / -1; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Tablet hoch */
@media (max-width: 880px) {
  .hero { align-items: flex-start; }
  .hero-actions { width: 100%; }
  .schnellaktion { flex: 1 1 auto; justify-content: flex-start; }
  .grid-3, .grid-4, .dash-schiene { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .verlauf { height: 108px; }
  .verlauf.hoch { height: 150px; }
  .timeline-card { max-height: none; }
  .dash-schiene .timeline-card { max-height: 420px; }
  /* Filter und Suche untereinander, Suche in voller Breite. */
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar select, .toolbar input { width: 100%; min-width: 0; }
  .toolbar .rechts { margin-left: 0; width: 100%; }
  .toolbar .rechts input[type="search"] { width: 100%; max-width: none; }
  /* Auf Mobilbreiten ist der Absenden-Knopf ein volles Ziel. */
  .nl-aktion { align-items: stretch; }
  .nl-aktion #nl-submit { align-self: stretch; }
}

@media (max-width: 560px) {
  .hero-text h2 { font-size: 25px; }
  .kpis { grid-template-columns: 1fr; }
  /* Gestapelt trennt derselbe 14px-Abstand die Punkte vertikal —
     die frueheren Trennlinien sind mit dem Kachelabstand entfallen. */
  .statusband-punkte { grid-template-columns: 1fr; }
  .donut-wrap.kompakt { justify-content: center; }
}

/* ------------------------------- Ergaenzungen zum Kontrollzentrum -------
   Drei Bausteine des neuen Dashboards hatten noch keine Stile: die
   Flaechenkurve des Kundenwachstums, die Datumsachse unter den Diagrammen
   und der Kennwert darunter. Weiterhin nur bestehende Farbtokens. */
.flaeche { display: flex; align-items: flex-end; gap: 2px; height: 84px; margin-top: 4px; }
.flaeche .saeule {
  flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; height: 100%;
}
.flaeche .saeule i {
  display: block; width: 100%; min-height: 2px; border-radius: 2px 2px 0 0;
  background: var(--ink-soft);
}
.flaeche .saeule.leer i { background: var(--line); }

.achse {
  display: flex; justify-content: space-between; gap: 10px;
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
}
.kennwert { margin-top: 10px; font-size: 13.5px; color: var(--ink-soft); }

/* Dashboard: Kartenbreite richtet sich nach dem verfuegbaren Platz. */
.dash-haupt .grid-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@container (min-width: 1174px) {
  .dash-haupt .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@container (max-width: 577px) {
  .dash-haupt .grid-4 { grid-template-columns: 1fr; }
}
.dash .card h3 { flex-wrap: wrap; }
.dash .card h3 .muted { white-space: nowrap; }
.dash .balken .zeile {
  grid-template-columns: minmax(0, 1fr) minmax(40px, 1fr) auto;
}
.dash .balken .zeile > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.dash .grid-4 .achse {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px;
}
.dash .grid-4 .achse > span { white-space: nowrap; }
.dash .grid-4 .achse > span:nth-child(2) {
  grid-column: 1 / -1; grid-row: 2; text-align: center;
}
.dash .grid-4 .achse > span:last-child { text-align: right; }
/* ---------------------------------------------------------------- Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(9, 9, 11, 0.42);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade 0.18s var(--ease) both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(460px, 100%); margin: 0; box-shadow: var(--shadow-lg);
  animation: rise 0.24s var(--ease) both; max-height: 88vh; overflow-y: auto;
}
.modal h3 { font-size: 19px; margin-bottom: 8px; }
.modal > p { color: var(--muted); font-size: 14.5px; white-space: pre-line; margin-bottom: 18px; }
.modal .actions { justify-content: flex-end; margin-top: 22px; }

/* ----------------------------------------------------------- Responsive */
@media (max-width: 1080px) {
  .grid-2 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-intro { padding: 44px 32px 0; }
  .auth-intro-body { margin-bottom: 34px; }
  .auth-intro h1 { font-size: 36px; }
  .auth-panel { border-left: 0; border-top: 1px solid var(--line); padding: 32px; }
  .auth-foot { display: none; }
}
@media (max-width: 880px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: center; flex-wrap: wrap;
    gap: 10px; padding: 12px 16px;
  }
  .sidebar > .brand-mark { margin-bottom: 0; }
  .sidebar > .brand-mark span { display: none; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; flex: 1 0 100%; order: 3; }
  .sidebar nav a { padding: 8px 11px; font-size: 14px; }
  .sidebar-footer { border-top: 0; padding-top: 0; margin-left: auto; display: flex; align-items: center; gap: 8px; }
  .session-info { padding: 0; }
  .session-info .role { display: none; }
  #btn-logout { width: auto; }
  main { padding: 22px 16px 40px; }
  .pagehead h2 { font-size: 27px; }
  .pagehead-actions { margin-left: 0; width: 100%; }
  .code-input { gap: 6px; }
  .code-input input { height: 48px; font-size: 19px; }
}

@media (max-width: 520px) {
  .auth-intro { padding: 32px 18px 0; }
  .auth-intro h1 { font-size: 30px; }
  .auth-intro .lead { font-size: 15.5px; margin-top: 16px; }
  .auth-panel { padding: 22px 18px 40px; }
  /* Feste Kartenbreite aufheben: 400 px + Innenabstand waeren auf schmalen
     Geraeten breiter als der Viewport und wuerden seitlich ueberlaufen. */
  .auth-card { max-width: none; padding: 24px 20px; }
  .code-input { gap: 5px; }
  .code-input input { height: 44px; font-size: 17px; }
  .leaving h2 { font-size: 21px; }
  .leaving-inner { padding: 0 20px; }
}

/* ---------------------------------------------------------------------------
   Adminkonten und Kontoaktivierung

   Keine neuen Bausteine: Badges, Karten, Menues und die Einmal-Anzeige sind
   dieselben wie ueberall. Hier stehen nur die Masse fuer Inhalte, die deutlich
   laenger sind als ein Lizenzschluessel (Aktivierungslink, Recovery-Codes).
   --------------------------------------------------------------------------- */
#adm-table .spalte-aktionen { width: 1%; text-align: right; }
#adm-table td.spalte-aktionen { padding-top: 6px; padding-bottom: 6px; }

#adm-link {
  font-size: 13.5px; font-weight: 500; letter-spacing: 0;
  text-align: left; line-height: 1.55;
}

/* QR-Code der TOTP-Einrichtung: schwarz auf reinem Weiss (Scan-Kontrast),
   die Ruhezone liegt bereits IM Canvas; ganzzahlige Module bleiben scharf. */
.qr-rahmen { display: flex; justify-content: center; margin: 16px 0 4px; }
.qr-rahmen canvas {
  background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-sm); image-rendering: pixelated;
  max-width: 100%;
}
.inv-manuell {
  margin: 14px 0 2px; font-size: 13px; font-weight: 600;
  color: var(--ink-soft);
}

/* Geheimnis und Recovery-Codes stehen in der schmalen Anmeldekarte. */
#inv-secret { font-size: 16px; padding: 14px 16px; }
#inv-codes {
  font-size: 15px; line-height: 1.9; text-align: left;
  white-space: pre-line; word-break: normal;
}
#view-invite .auth-card .actions { justify-content: flex-start; }

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

/* Ruhige Kennzahlen und kompakter Systemstatus, nach echter Inhaltsbreite. */
.dash-haupt { container-type: inline-size; }
.dash-haupt .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.kpis .tile { padding: 20px; border-radius: 14px; box-shadow: none; display: flex; flex-direction: column; }
.kpis .tile:hover { transform: none; box-shadow: none; }
.kpis .tile .lbl { align-items: flex-start; min-height: 2.8em; margin-bottom: 12px; font-size: 13px; line-height: 1.4; }
.kpis .tile .lbl svg { flex-shrink: 0; margin-top: 1px; }
.kpis .tile .lbl span { min-width: 0; overflow-wrap: normal; }
.kpis .tile .num { font-size: 30px; line-height: 1.15; font-variant-numeric: tabular-nums; margin-bottom: 10px; }
.kpis .umsatz-tile .num { font-size: 26px; }
.kpis .tile .foot { margin-top: auto; min-height: 2.8em; line-height: 1.4; overflow-wrap: normal; hyphens: auto; }
@container (max-width: 659px) { .dash-haupt .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 399px) { .dash-haupt .kpis { grid-template-columns: 1fr; } }
#dash-statusband { grid-template-columns: minmax(0, 1fr); }
#dash-statusband .statusband-urteil { padding: 18px 20px 10px; border-bottom: 0; }
#dash-status { grid-template-columns: repeat(auto-fit, minmax(min(100%, 165px), 1fr)); gap: 10px; padding: 8px 20px 18px; }
#dash-status .tile { padding: 14px 16px; background: var(--surface-2); border: 0; border-radius: 10px; box-shadow: none; }
#dash-status .tile:hover { transform: none; box-shadow: none; }
#dash-status .lbl { font-size: 12px; margin-bottom: 9px; line-height: 1.4; }
#dash-status .num { font-size: 16px; line-height: 1.4; letter-spacing: -0.01em; align-items: flex-start; }
#dash-status .num .dot { margin-top: 7px; }
#dash-status .num > span:last-child { min-width: 0; overflow-wrap: normal; word-break: normal; }

/* Kennzahlenblock und Handlungsbedarf teilen sich die erste Dashboard-Zeile. */
.kpis .tile { padding: 14px 18px; }
.kpis .tile .lbl { min-height: 0; margin-bottom: 8px; }
.kpis .tile .num { font-size: 28px; margin-bottom: 8px; }
.kpis .umsatz-tile .num { font-size: 26px; }
.kpis .tile .foot { min-height: 0; }
.dash-schiene > .card:first-child { margin-bottom: 0; }

/* Einheitlicher Abstand zwischen allen Dashboard-Karten. */
#panel-dashboard { --dashboard-gap: 14px; }
#panel-dashboard .dash,
#panel-dashboard .dash-haupt,
#panel-dashboard .dash-schiene,
#panel-dashboard .kpis,
#panel-dashboard .grid-2,
#panel-dashboard .grid-3,
#panel-dashboard .grid-4,
#panel-dashboard #dash-status,
#panel-dashboard .aufgaben { gap: var(--dashboard-gap); }
#panel-dashboard .dash .card { margin-bottom: 0; }
#panel-dashboard #dash-statusband,
#panel-dashboard .hero { margin-bottom: var(--dashboard-gap); }

/* Kennzahlen verwenden denselben Kartenschatten wie die uebrigen Module. */
#panel-dashboard .kpis .tile,
#panel-dashboard .kpis .tile:hover { box-shadow: var(--shadow); }

/* Mehr Platz fuer einzeilige Gruende: Balkenspalte um 40 Prozent kuerzer. */
#dash-reasons .zeile { grid-template-columns: minmax(max-content, 1.4fr) minmax(0, 0.6fr) auto; }
#dash-reasons .zeile > span:first-child { white-space: nowrap; overflow-wrap: normal; }

/* Update-Filter gleichmaessig ueber die volle Inhaltsbreite. */
#panel-updates > .toolbar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
#panel-updates > .toolbar > select { width: 100%; min-width: 0; }
@media (max-width: 700px) {
  #panel-updates > .toolbar { grid-template-columns: 1fr; }
}

/* Balken direkt an der Achse, mit 15 Prozent weniger Hoehe. */
#dash-akt-chart .chart-tag { height: 85%; }
#dash-akt-achse { margin-top: 0; }

/* Lizenzfilter und Suche gleichmaessig ueber die volle Breite. */
#panel-licenses > .toolbar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
#panel-licenses > .toolbar > select { width: 100%; min-width: 0; }
#panel-licenses > .toolbar > .rechts { margin-left: 0; width: 100%; min-width: 0; }
#panel-licenses > .toolbar > .rechts input[type="search"] { width: 100%; min-width: 0; max-width: none; }
@media (max-width: 700px) {
  #panel-licenses > .toolbar { grid-template-columns: 1fr; }
}
