/* =========================================================================
   Catch-All Control — Design-System „Business“
   Klare Geschäftskunden-Optik: Weiß, Anthrazit, ein kräftiges Signalrot.
   Schrift: Source Sans 3 (SIL OFL), lokal gehostet — keine externen
   Anfragen an Google, daher DSGVO-unkritisch.
   ========================================================================= */

@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/source-sans-3-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/source-sans-3-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/source-sans-3-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 800; font-display: swap; src: url("../fonts/source-sans-3-latin-800-normal.woff2") format("woff2"); }

:root {
  /* Marke */
  --red:          #DA0010;
  --red-hover:    #B8000D;
  --red-active:   #9A000B;
  --red-tint:     #FDECEC;

  /* Neutrale */
  --ink:          #25282C;   /* Text, Footer */
  --ink-2:        #4A4D4E;   /* Fließtext sekundär */
  --grey-600:     #6B6E70;   /* Hinweise */
  --grey-400:     #AFAFAF;
  --grey-300:     #CCCCCC;   /* Eingabe-Rahmen */
  --grey-200:     #E5E5E5;   /* Trennlinien */
  --grey-100:     #F2F2F2;   /* Seitenhintergrund */
  --grey-50:      #F8F8F8;
  --white:        #FFFFFF;

  /* Zustandsfarben */
  --success:      #008A00;
  --success-tint: #E8F5E8;
  --warning:      #EB8C00;
  --warning-tint: #FDF3E5;
  --info:         #00788A;
  --info-tint:    #E5F3F5;
  --focus:        #00788A;

  /* Akzentfarben für Rollen */
  --aubergine:    #5E2750;
  --teal:         #00788A;
  --plum:         #9C2AA0;

  --font: "Source Sans 3", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --radius:    6px;
  --radius-lg: 8px;
  --shadow-1:  0 2px 4px rgba(37,40,44,.08);
  --shadow-2:  0 4px 16px rgba(37,40,44,.12);
  --container: 1200px;
  --header-h:  72px;

  /* Kompatibilität mit Inline-Styles in älteren Seiten */
  --text-primary:   var(--ink);
  --text-secondary: var(--ink-2);
  --text-muted:     var(--grey-600);
  --surface-border: var(--grey-200);
  --c-primary-light: var(--accent);
  --c-accent: var(--accent);
  --c-accent-light: var(--accent-hover);
  --font-display: var(--font);
  --font-mono: var(--mono);
  --radius-sm: var(--radius);
}


/* ---------- Gestaltungs-Variablen (von Themes und der Akzentfarbe überschrieben) ---------- */
:root {
  --accent: #DA0010; --accent-hover: #B8000D; --accent-active: #9A000B; --accent-tint: #FDECEC;
  --accent-ink: #FFFFFF;     /* Text auf Akzentflächen */
  --accent-text: #DA0010;    /* Akzent als Text/Icon auf Flächen */
  --accent-edge: #DA0010;    /* Rand von Akzent-Schaltflächen */
  --red: var(--accent);
  --danger: #DA0010;
  --bg: var(--grey-100);
  --on-ink: #FFFFFF;
  --topbar-bg: var(--ink); --topbar-ink: #FFFFFF; --topbar-dim: #D0D0D0; --topbar-line: var(--accent);
  --header-bg: var(--white); --header-ink: var(--ink); --header-hover: var(--accent-text); --header-hover-bg: var(--grey-50);
  --footer-bg: var(--ink); --footer-ink: #C8C8C8; --footer-link: #FFFFFF;
  --focus-ring: rgba(0,120,138,.2);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2325282C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --h1-weight: 800; --h2-weight: 700; --h3-weight: 700; --head-track: -0.01em;
  --btn-radius: var(--radius); --btn-weight: 700; --btn-track: 0; --btn-case: none;
}

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img, svg { max-width: 100%; }
a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

h1, h2, h3, h4 { margin: 0 0 .5em; color: var(--ink); line-height: 1.15; letter-spacing: var(--head-track); font-family: var(--font-display); }
h1 { font-size: 2.5rem;  font-weight: var(--h1-weight); }
h2 { font-size: 1.75rem; font-weight: var(--h2-weight); }
h3 { font-size: 1.25rem; font-weight: var(--h3-weight); }
h4 { font-size: 1.0625rem; font-weight: 700; }
p  { margin: 0 0 1em; color: var(--ink-2); }
code { font-family: var(--mono); font-size: .875em; background: var(--grey-100); padding: 1px 5px; border-radius: 3px; color: var(--ink); }
.muted { color: var(--grey-600); }
.mono  { font-family: var(--mono); font-size: .875rem; }
.small { font-size: .875rem; }
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }

/* Altlasten des vorherigen Designs neutralisieren */
.aurora-bg { display: none; }
.mirror-reflect::after { content: none; }

/* ---------- Kopfbereich ---------- */
.topbar { background: var(--topbar-bg); color: var(--topbar-ink); font-size: .875rem; }
.topbar .container { display: flex; align-items: center; justify-content: space-between; min-height: 36px; gap: 16px; }
.topbar-segments { display: flex; gap: 0; height: 36px; }
.topbar-segments a {
  display: flex; align-items: center; padding: 0 14px; color: var(--topbar-dim); text-decoration: none;
  border-bottom: 3px solid transparent; font-weight: 600;
}
.topbar-segments a:first-child { padding-left: 0; }
.topbar-segments a:hover { color: var(--topbar-ink); }
.topbar-segments a.is-active { color: var(--topbar-ink); border-bottom-color: var(--topbar-line); }
.topbar-meta { display: flex; align-items: center; gap: 18px; color: var(--topbar-dim); }
.topbar-meta a { color: var(--topbar-ink); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.topbar-meta a:hover { text-decoration: underline; }

.site-header { background: var(--header-bg); box-shadow: 0 1px 0 var(--grey-200), 0 2px 6px rgba(37,40,44,.05); position: sticky; top: 0; z-index: 20; }
.site-header .container { display: flex; align-items: stretch; height: var(--header-h); gap: 40px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--header-ink); flex-shrink: 0; }
.brand:hover { color: var(--header-ink); }
.brand-mark { width: 40px; height: 40px; flex-shrink: 0; }
.brand-name { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.brand-name small { display: block; font-size: .75rem; font-weight: 600; color: var(--grey-600); letter-spacing: 0; margin-top: 3px; }

.main-nav { display: flex; align-items: stretch; gap: 4px; flex: 1; }
.main-nav a {
  display: flex; align-items: center; gap: 8px; padding: 0 14px; text-decoration: none;
  color: var(--header-ink); font-weight: 600; font-size: 1.0625rem; position: relative; white-space: nowrap;
}
.main-nav a::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 4px; background: transparent; border-radius: 2px 2px 0 0; }
.main-nav a:hover { color: var(--header-hover); }
.main-nav a.is-active { color: var(--header-ink); }
.main-nav a.is-active::after { background: var(--accent); }
.main-nav .nav-count { background: var(--accent); color: var(--accent-ink); border-radius: 10px; font-size: .75rem; font-weight: 700; padding: 0 7px; line-height: 18px; }

.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-link {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 64px; height: 56px; color: var(--header-ink); text-decoration: none; font-size: .75rem; font-weight: 600; border-radius: var(--radius);
}
.icon-link:hover { color: var(--header-hover); background: var(--header-hover-bg); }
.icon-link svg { width: 24px; height: 24px; }

.nav-toggle { display: none; }

/* ---------- Seitenkopf (Intro-Band) ---------- */
.page-intro { background: var(--white); border-bottom: 1px solid var(--grey-200); }
.page-intro .container { padding-top: 28px; padding-bottom: 32px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.page-intro h1 { margin: 0; }
.page-intro .lead { margin: 10px 0 0; font-size: 1.125rem; max-width: 64ch; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: .875rem; margin-bottom: 14px; color: var(--grey-600); list-style: none; padding: 0; }
.breadcrumb a { color: var(--ink-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent-text); text-decoration: underline; }
.breadcrumb svg { width: 14px; height: 14px; color: var(--grey-400); }
.page-intro-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.page-main { flex: 1; padding: 32px 0 64px; }

/* ---------- Karten & Flächen ---------- */
.panel, .glass-panel {
  background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-1);
  border: 1px solid var(--grey-200);
}
.panel + .panel, .glass-panel + .glass-panel { margin-top: 24px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 24px 16px; flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { margin: 0; }
.panel-head p { margin: 4px 0 0; font-size: .9375rem; }
.panel-body { padding: 0 24px 24px; }
.panel-pad { padding: 24px; }

.card {
  background: var(--white); border: 1px solid var(--grey-200); border-radius: var(--radius-lg);
  padding: 20px 24px; box-shadow: var(--shadow-1); color: var(--ink); display: block;
}
a.card { text-decoration: none; transition: box-shadow .15s ease, border-color .15s ease; }
a.card:hover { box-shadow: var(--shadow-2); border-color: var(--grey-300); color: var(--ink); }

.eyebrow { display: block; font-size: .875rem; font-weight: 700; color: var(--grey-600); letter-spacing: 0; text-transform: none; }

/* Kennzahlen-Kacheln */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 24px; margin-bottom: 32px; }
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 24px; min-height: 168px; position: relative; }
.kpi .kpi-icon { width: 40px; height: 40px; color: var(--accent-text); margin-bottom: 6px; }
.kpi .kpi-value { font-size: 2.5rem; font-weight: 800; line-height: 1; color: var(--ink); }
.kpi .kpi-label { font-size: 1rem; font-weight: 600; color: var(--ink-2); }
.kpi .kpi-chevron { position: absolute; right: 20px; bottom: 22px; width: 20px; height: 20px; color: var(--accent-text); }
.kpi.is-alert .kpi-value { color: var(--danger); }

/* Aufgaben-Kacheln (Dashboard) */
.task-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 24px; }
.task { display: grid; grid-template-columns: 48px 1fr 20px; gap: 16px; align-items: start; padding: 24px; }
.task svg.task-icon { width: 48px; height: 48px; color: var(--accent-text); }
.task h3 { margin: 2px 0 4px; font-size: 1.125rem; }
.task p { margin: 0; font-size: .9375rem; }
.task .task-chevron { width: 20px; height: 20px; color: var(--accent-text); margin-top: 6px; }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 16px; }
.section-title h2 { margin: 0; font-size: 1.5rem; }

/* ---------- Layout-Helfer ---------- */
.row { display: flex; align-items: center; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.gap-md { gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 0 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 0 24px; }
.stack > * + * { margin-top: 24px; }
.divider { height: 1px; background: var(--grey-200); margin: 24px 0; }
.page-shell { min-height: calc(100vh - 200px); }

/* ---------- Buttons ---------- */
.btn {
  -webkit-appearance: none; appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 24px; border-radius: var(--btn-radius);
  font-family: var(--font); font-size: 1.0625rem; font-weight: var(--btn-weight); letter-spacing: var(--btn-track); text-transform: var(--btn-case); line-height: 1;
  background: var(--accent); color: var(--accent-ink); border: 2px solid var(--accent-edge);
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn:active { background: var(--accent-active); border-color: var(--accent-active); }
.btn svg { width: 20px; height: 20px; }
.btn-accent { /* Primär (Alias) */ }
.btn-ghost, .btn-secondary { background: var(--white); color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover, .btn-secondary:hover { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn-dark:hover { background: #000; border-color: #000; }
.btn-danger { background: var(--white); color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-text { background: none; border-color: transparent; color: var(--ink); padding: 0 4px; text-decoration: underline; text-underline-offset: 2px; min-height: 32px; font-weight: 600; font-size: .9375rem; }
.btn-text:hover { background: none; border-color: transparent; color: var(--accent-text); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: .9375rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- Formulare ---------- */
.field { margin-bottom: 20px; }
.field > label, .label { display: block; font-weight: 700; font-size: 1rem; margin-bottom: 6px; color: var(--ink); }
.field input[type="text"], .field input[type="password"], .field input[type="email"], .field input[type="search"],
.field select, .field textarea, .input {
  width: 100%; min-height: 48px; padding: 10px 14px; font-family: var(--font); font-size: 1rem; color: var(--ink);
  background: var(--white); border: 1px solid var(--grey-400); border-radius: var(--radius);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.field select {
  -webkit-appearance: none; appearance: none; padding-right: 44px; cursor: pointer;
  background-image: var(--chev);
  background-repeat: no-repeat; background-position: right 14px center; background-size: 18px;
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--ink-2); }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-ring);
}
.field input::placeholder, .field textarea::placeholder { color: var(--grey-400); }
.hint { font-size: .875rem; color: var(--grey-600); margin-top: 6px; }
.form-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 8px; }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 1rem; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); flex-shrink: 0; }

/* Auswahl-Kacheln (Checkbox-Listen) */
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px,1fr)); gap: 12px; margin: 16px 0 24px; }
.checklist label {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer;
  background: var(--white); border: 1px solid var(--grey-300); border-radius: var(--radius);
  font-size: .9375rem; font-weight: 600; word-break: break-all;
}
.checklist label:hover { border-color: var(--ink-2); }
.checklist label:has(input:checked) { border: 2px solid var(--accent); padding: 13px 15px; background: var(--white); }
.checklist input { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }

/* Aufklappbare Bereiche */
details.create-form { margin-bottom: 24px; }
details.create-form > summary, details.disclosure > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 20px 24px; font-weight: 700; font-size: 1.125rem;
}
details.create-form > summary h3 { margin: 0; font-size: 1.125rem; }
details.create-form > summary::-webkit-details-marker, details.disclosure > summary::-webkit-details-marker,
details.inline-edit summary::-webkit-details-marker { display: none; }
details.create-form > summary::after, details.disclosure > summary::after {
  content: ""; width: 10px; height: 10px; flex-shrink: 0; margin-right: 4px; transition: transform .2s ease;
  border-right: 2.4px solid var(--accent-text); border-bottom: 2.4px solid var(--accent-text); transform: translateY(-3px) rotate(45deg);
}
details[open].create-form > summary::after, details[open].disclosure > summary::after { transform: translateY(3px) rotate(-135deg); }
details.create-form[open] > summary { border-bottom: 1px solid var(--grey-200); }
details.create-form > form, details.create-form > .details-body { padding: 24px; margin: 0 !important; }

details.inline-edit { position: relative; }
details.inline-edit summary { list-style: none; cursor: pointer; font-weight: 600; font-size: .9375rem; text-decoration: underline; text-underline-offset: 2px; padding: 8px 4px; }
details.inline-edit summary:hover { color: var(--accent-text); }
details.inline-edit[open] summary { color: var(--accent-text); }
.mini-form {
  position: absolute; z-index: 10; right: 0; top: 100%; width: 320px; margin-top: 6px;
  background: var(--white); border: 1px solid var(--grey-200); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2); padding: 20px; text-align: left;
}
.mini-form .field { margin-bottom: 14px; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.data-table th {
  text-align: left; font-weight: 700; font-size: .875rem; color: var(--ink-2);
  background: var(--grey-50); padding: 12px 16px; border-top: 1px solid var(--grey-200); border-bottom: 1px solid var(--grey-200);
  white-space: nowrap;
}
.data-table th:first-child, .data-table td:first-child { padding-left: 24px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 24px; }
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--grey-200); vertical-align: middle; color: var(--ink); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: var(--grey-50); }
.data-table .cell-strong { font-weight: 700; }
.data-table td.empty { text-align: center; color: var(--grey-600); padding: 40px 16px; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.col-actions { text-align: right !important; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 12px;
  font-size: .8125rem; font-weight: 700; white-space: nowrap; background: var(--grey-100); color: var(--ink);
}
.badge-administrator { background: var(--ink); color: var(--on-ink); }
.badge-superuser     { background: var(--aubergine); color: #fff; }
.badge-master        { background: var(--teal); color: #fff; }
.badge-slave         { background: var(--grey-200); color: var(--ink); }
.badge-lvl1          { background: var(--grey-200); color: var(--ink); }
.badge-lvl2          { background: var(--plum); color: #fff; }
.badge-status-aktiv, .badge-status-suspendiert, .badge-status-warn { background: transparent; padding: 0; height: auto; font-weight: 600; color: var(--ink); }
.badge-status-aktiv::before, .badge-status-suspendiert::before, .badge-status-warn::before {
  content: ""; width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.badge-status-aktiv::before { background: var(--success); }
.badge-status-suspendiert::before { background: var(--grey-400); }
.badge-status-warn::before { background: var(--warning); }
.badge-unread { background: var(--accent); color: var(--accent-ink); border-radius: 10px; font-size: .75rem; font-weight: 700; padding: 0 7px; line-height: 20px; min-width: 20px; text-align: center; }

/* ---------- Hinweise ---------- */
.alert {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px 20px; margin-bottom: 24px;
  background: var(--white); border: 1px solid var(--grey-200); border-left: 6px solid var(--info);
  border-radius: var(--radius); box-shadow: var(--shadow-1); color: var(--ink); font-size: 1rem;
}
.alert::before { content: ""; width: 24px; height: 24px; flex-shrink: 0; background: center/24px no-repeat; }
.alert-success { border-left-color: var(--success); }
.alert-success::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23008A00' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M7.5 12.5l3 3 6-6.5'/%3E%3C/svg%3E"); }
.alert-error { border-left-color: var(--danger); }
.alert-error::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23DA0010' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 7v6M12 16.5v.5'/%3E%3C/svg%3E"); }
.alert-info { border-left-color: var(--info); }
.alert-info::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300788A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 11v6M12 7.5v.5'/%3E%3C/svg%3E"); }
.alert-warning { border-left-color: var(--warning); }
.alert-warning::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23EB8C00' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l10 18H2z'/%3E%3Cpath d='M12 10v5M12 18v.5'/%3E%3C/svg%3E"); }
.alert > div > strong:first-child { display: block; margin-bottom: 2px; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- Leerzustände ---------- */
.empty-state { text-align: center; padding: 56px 24px; }
.empty-state svg { width: 56px; height: 56px; color: var(--accent-text); margin-bottom: 12px; }
.empty-state h3 { margin-bottom: 6px; }
.empty-state p { max-width: 46ch; margin: 0 auto; }

/* ---------- Postfach ---------- */
.mail-shell { display: grid; grid-template-columns: 300px minmax(0,1fr); gap: 24px; align-items: start; }
.mail-side { padding: 8px 0; position: sticky; top: calc(var(--header-h) + 16px); }
.side-title { font-size: .875rem; font-weight: 700; color: var(--grey-600); padding: 14px 20px 6px; }
.mailbox-picker, .folder-list { display: flex; flex-direction: column; }
.mailbox-picker a, .folder-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 20px 10px 17px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .9375rem;
  border-left: 4px solid transparent; word-break: break-all;
}
.mailbox-picker a span:first-child, .folder-list a span:first-child { display: flex; align-items: center; gap: 10px; }
.mailbox-picker a svg, .folder-list a svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--ink-2); }
.mailbox-picker a:hover, .folder-list a:hover { background: var(--grey-50); color: var(--accent-text); }
.mailbox-picker a.active, .folder-list a.active { border-left-color: var(--accent); background: var(--grey-50); color: var(--ink); }
.mailbox-picker a.active svg, .folder-list a.active svg { color: var(--accent-text); }
.side-form { padding: 6px 20px 14px; }
.side-form summary { font-weight: 600; font-size: .9375rem; cursor: pointer; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; list-style: none; padding: 6px 0; }
.side-form summary::-webkit-details-marker { display: none; }
.side-form summary:hover { color: var(--accent-text); }

.mail-list-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 24px; border-bottom: 1px solid var(--grey-200); flex-wrap: wrap; }
.mail-list-head h2 { margin: 0; font-size: 1.375rem; }
.folder-tag { font-size: .875rem; color: var(--grey-600); font-weight: 600; }
.mail-row {
  display: grid !important; grid-template-columns: 12px minmax(160px, 240px) minmax(0,1fr) auto; gap: 16px; align-items: center;
  padding: 14px 24px; border-bottom: 1px solid var(--grey-200); text-decoration: none; color: var(--ink);
}
.mail-row:last-child { border-bottom: 0; }
.mail-row:hover { background: var(--grey-50); color: var(--ink); }
.mail-row .dot { width: 8px; height: 8px; border-radius: 50%; background: transparent; }
.mail-row.unread .dot { background: var(--accent); }
.mail-from { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-from .muted { font-weight: 400; }
.mail-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.mail-row.unread .mail-from, .mail-row.unread .mail-subject { font-weight: 700; color: var(--ink); }
.mail-date { font-size: .875rem; color: var(--grey-600); white-space: nowrap; }

.mail-detail { padding: 24px 32px 32px; }
.mail-detail h2 { font-size: 1.75rem; margin: 16px 0 16px; }
.mail-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: .9375rem; padding: 16px 0; border-top: 1px solid var(--grey-200); border-bottom: 1px solid var(--grey-200); margin-bottom: 24px; }
.mail-meta dt { color: var(--grey-600); font-weight: 600; }
.mail-meta dd { margin: 0; word-break: break-all; }
.mail-body { line-height: 1.65; font-size: 1rem; color: var(--ink); margin-bottom: 32px; overflow-wrap: anywhere; }
.mail-body.is-text { white-space: pre-wrap; }
.mail-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; padding-top: 24px; border-top: 1px solid var(--grey-200); }
.mail-actions .field { margin: 0; min-width: 220px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: .9375rem; text-decoration: none; }
.back-link svg { width: 18px; height: 18px; color: var(--accent-text); }
.back-link:hover { text-decoration: underline; }

/* ---------- Editor ---------- */
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 2px; align-items: center; padding: 6px;
  border: 1px solid var(--grey-400); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; background: var(--grey-50);
}
.editor-toolbar button, .editor-toolbar select {
  height: 36px; min-width: 36px; padding: 0 10px; border: 1px solid transparent; border-radius: 4px; background: transparent;
  font-family: var(--font); font-size: .9375rem; color: var(--ink); cursor: pointer;
}
.editor-toolbar button:hover, .editor-toolbar select:hover { background: var(--white); border-color: var(--grey-300); }
.editor-toolbar input[type="color"] { width: 36px; height: 36px; padding: 4px; border: 1px solid transparent; border-radius: 4px; background: transparent; cursor: pointer; }
.editor-toolbar .sep { width: 1px; height: 24px; background: var(--grey-300); margin: 0 6px; }
.editor-surface {
  min-height: 320px; padding: 16px; border: 1px solid var(--grey-400); border-radius: 0 0 var(--radius) var(--radius);
  background: var(--white); line-height: 1.6; overflow-wrap: anywhere;
}
.editor-surface:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-ring); }
.editor-surface blockquote { border-left: 3px solid var(--grey-300); margin: 8px 0; padding-left: 12px; color: var(--grey-600); }
.cc-bcc-toggle { background: none; border: 0; padding: 0; font-family: var(--font); font-size: .9375rem; font-weight: 600; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.cc-bcc-toggle:hover { color: var(--accent-text); }

/* ---------- Login / Setup ---------- */
.auth-wrap { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 56px 24px; background: var(--white); }
.auth-form { width: 100%; max-width: 440px; }
.auth-form h1 { font-size: 2.25rem; margin-bottom: 8px; }
.auth-form .lead { font-size: 1.125rem; margin-bottom: 32px; }
.auth-visual {
  background: var(--accent); color: var(--accent-ink); padding: 72px 64px; display: flex; flex-direction: column; justify-content: center;
  position: relative; overflow: hidden;
}
.auth-visual > * { position: relative; max-width: 480px; }
.auth-visual h2 { color: var(--accent-ink); font-size: 2.75rem; font-weight: 800; line-height: 1.05; margin-bottom: 20px; }
.auth-visual p { color: var(--accent-ink); font-size: 1.125rem; }
.auth-visual ul { list-style: none; padding: 0; margin: 24px 0 0; }
.auth-visual li { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; font-size: 1.0625rem; font-weight: 600; }
.auth-visual li svg { width: 24px; height: 24px; flex-shrink: 0; }
.auth-visual .auth-pattern { position: absolute; right: -120px; bottom: -120px; width: 480px; height: 480px; opacity: .14; max-width: none; }

.password-reveal { position: relative; }
.password-reveal input { padding-right: 52px !important; }
.pw-toggle {
  position: absolute; right: 4px; bottom: 4px; width: 40px; height: 40px; border: 0; background: none; cursor: pointer;
  color: var(--ink-2); display: flex; align-items: center; justify-content: center; border-radius: 4px;
}
.pw-toggle:hover { color: var(--accent-text); }
.pw-toggle svg { width: 22px; height: 22px; }

/* Schrittfolge (Setup) */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0 0 28px; }
.steps li { counter-increment: step; position: relative; padding-left: 44px; margin-bottom: 14px; color: var(--ink-2); }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--ink); color: var(--on-ink); font-weight: 700; font-size: .875rem; display: flex; align-items: center; justify-content: center;
}
.form-section { padding-top: 24px; margin-top: 8px; border-top: 1px solid var(--grey-200); }
.form-section h3 { margin-bottom: 4px; }
.form-section > p { font-size: .9375rem; margin-bottom: 16px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--footer-bg); color: var(--footer-ink); font-size: .875rem; margin-top: auto; }
.site-footer .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; padding-top: 16px; padding-bottom: 16px; }
.site-footer a { color: var(--footer-link); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; color: var(--footer-link); }
.footer-links { display: flex; gap: 24px; flex-wrap: wrap; }

/* ---------- Responsiv ---------- */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .task-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .main-nav a { padding: 0 10px; font-size: 1rem; }
  .main-nav a::after { left: 10px; right: 10px; }
}
@media (max-width: 960px) {
  .site-header .container { gap: 16px; }
  .nav-toggle {
    display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; align-self: center;
    border: 0; background: none; color: var(--header-ink); cursor: pointer; border-radius: var(--radius); margin-left: auto;
  }
  .nav-toggle svg { width: 28px; height: 28px; }
  .header-actions { margin-left: auto; }
  .nav-toggle { order: 3; margin-left: 0; flex-shrink: 0; }
  .main-nav {
    display: none; position: absolute; top: var(--header-h); left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--white); border-top: 1px solid var(--grey-200); box-shadow: var(--shadow-2); padding: 8px 0;
  }
  .main-nav.is-open { display: flex; }
  .main-nav a { padding: 14px 24px; border-left: 4px solid transparent; }
  .main-nav a::after { content: none; }
  .main-nav a.is-active { border-left-color: var(--accent); background: var(--grey-50); }
  .mail-shell { grid-template-columns: 1fr; }
  .mail-side { position: static; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-visual { padding: 40px 24px; }
  .auth-visual h2 { font-size: 2rem; }
}
@media (max-width: 720px) {
  h1 { font-size: 2rem; }
  .page-intro h1 { font-size: 1.875rem; }
  .kpi-grid, .task-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .icon-link span { display: none; }
  .icon-link { min-width: 44px; }
  .brand-name small { display: none; }
  .topbar-meta .hide-sm { display: none; }
  .mail-row { grid-template-columns: 10px minmax(0,1fr) auto; grid-template-areas: "dot from date" ". subj subj"; row-gap: 4px; gap: 4px 12px; padding: 14px 16px; }
  .mail-row .dot { grid-area: dot; align-self: start; margin-top: 8px; }
  .mail-row .mail-from { grid-area: from; }
  .mail-row .mail-date { grid-area: date; align-self: start; font-size: .8125rem; }
  .mail-row .mail-subject { grid-area: subj; }
  .mini-form { position: static; width: auto; box-shadow: none; }
  .data-table th, .data-table td { padding: 12px; }
  .mail-detail { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Reiter ---------- */
.tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--grey-200); overflow-x: auto; }
.tabs a {
  display: inline-flex; align-items: center; gap: 8px; padding: 18px 12px 15px; text-decoration: none; white-space: nowrap;
  color: var(--ink-2); font-weight: 600; border-bottom: 4px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--accent-text); }
.tabs a.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.tab-count { font-size: .8125rem; font-weight: 700; background: var(--grey-100); color: var(--ink-2); border-radius: 10px; padding: 0 8px; line-height: 20px; }
.tabs a.is-active .tab-count { background: var(--ink); color: var(--on-ink); }
.mini-form .checklist { grid-template-columns: 1fr; max-height: 280px; overflow: auto; margin: 8px 0 16px; }
.addr-card { display: grid; grid-template-columns: 48px minmax(0,1fr); gap: 16px; padding: 24px; }
.addr-card svg.task-icon { width: 48px; height: 48px; color: var(--accent-text); }
.addr-card h3 { margin: 2px 0 2px; font-size: 1.125rem; overflow-wrap: anywhere; }
.addr-card p { margin: 0; font-size: .9375rem; }
.bl-layout { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 960px) { .bl-layout { grid-template-columns: 1fr; } }
.segmented { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0; }
.segmented legend { padding: 0; margin-bottom: 6px; }
.segmented label { position: relative; flex: 1; min-width: 140px; }
.segmented input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmented span {
  display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 16px; text-align: center;
  border: 1px solid var(--grey-400); font-weight: 600; background: var(--white); cursor: pointer;
}
.segmented label:first-of-type span { border-radius: var(--radius) 0 0 var(--radius); }
.segmented label:last-of-type span { border-radius: 0 var(--radius) var(--radius) 0; border-left: 0; }
.segmented input:checked + span { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

/* Mit JavaScript: geschlossene Anlege-Formulare ausblenden, die Schaltfläche im Seitenkopf öffnet sie */
.js details.create-form.js-toggle:not([open]) { display: none; }
.mail-shell > .panel, .bl-layout > .panel, .grid-2 > .panel, .task-grid > .panel { margin-top: 0; }
.field .editor-toolbar select {
  width: auto; min-height: 36px; height: 36px; padding: 0 30px 0 10px; border: 1px solid transparent; background-color: transparent;
  background-position: right 8px center; background-size: 14px; font-size: .9375rem;
}
.field .editor-toolbar select:hover { border-color: var(--grey-300); background-color: var(--white); }
@media (max-width: 720px) {
  .site-header .header-actions { display: none; }
  .site-header .nav-toggle { margin-left: auto; }
  .container { padding: 0 16px; }
}
details.create-form, [id] { scroll-margin-top: calc(var(--header-h) + 16px); }

/* ---------- Terminal (Schlüsselliste im Setup) ----------
   Bewusst im Retro-Entwickler-Look: Phosphorgrün auf Schwarz, Schreibmaschinen-
   Schrift, feine Scanlines. Alles drumherum bleibt im Systemdesign. */
.term {
  position: relative; background: #0b100c; border: 1px solid #243026; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2); overflow: hidden; font-family: var(--mono); color: #4cff7a;
}
.term::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.025) 0 1px, transparent 1px 3px);
}
.term-bar { display: flex; align-items: center; gap: 12px; padding: 9px 14px; background: #131a14; border-bottom: 1px solid #243026; font-size: 11px; color: #7fa88a; }
.term-dots { display: inline-flex; gap: 6px; }
.term-dots span { width: 9px; height: 9px; border-radius: 50%; background: #2a362c; }
.term-body { max-height: 540px; overflow: auto; padding: 14px 16px 18px; font-size: 10px; line-height: 1.7; text-shadow: 0 0 5px rgba(76,255,122,.35); }
.term-body:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.term-line { white-space: pre-wrap; margin-bottom: 2px; }
.term-prompt { color: #ffb000; }
.term-dim { color: #3fa862; }
.term-cursor { display: inline-block; width: 6px; height: 11px; background: #4cff7a; margin-left: 3px; vertical-align: -2px; animation: term-blink 1.1s steps(1) infinite; }
@keyframes term-blink { 50% { opacity: 0; } }
.term-grid { display: grid; grid-template-columns: repeat(10, max-content); gap: 1px 28px; margin-top: 10px; }
.term-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; padding: 1px 4px; border-radius: 2px; }
.term-cell:hover { background: rgba(76,255,122,.09); }
.term-pick {
  font: inherit; font-size: 10px; line-height: 1.4; padding: 0 6px; background: transparent; color: #ffb000;
  border: 1px solid #6b4d00; border-radius: 2px; cursor: pointer; text-shadow: none;
}
.term-pick:hover, .term-pick:focus-visible { background: #ffb000; color: #0b100c; border-color: #ffb000; }
.term-pick:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
.term ::selection { background: #4cff7a; color: #0b100c; }
.code-block { margin: 0 0 20px; padding: 16px 20px; background: var(--grey-50); border: 1px solid var(--grey-200); border-radius: var(--radius); font-family: var(--mono); font-size: .875rem; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .term-cursor { animation: none; } }


/* ---------- Dekor-Elemente (standardmäßig unsichtbar, Themes schalten sie ein) ---------- */
.deco, .topbar-date { display: none; }
.brand-mark .bm-bg { fill: var(--accent); }
.brand-mark .bm-fg { stroke: var(--accent-ink); }

/* ---------- Seite „Design“ ---------- */
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; margin: 4px 0 8px; }
.theme-card { position: relative; display: block; cursor: pointer; }
.theme-card input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.theme-card .tc-body {
  display: block; height: 100%; padding: 20px; background: var(--white); border: 2px solid var(--grey-200);
  border-radius: var(--radius-lg); transition: border-color .15s ease, box-shadow .15s ease;
}
.theme-card:hover .tc-body { border-color: var(--grey-400); box-shadow: var(--shadow-2); }
.theme-card input:checked + .tc-body { border-color: var(--accent-edge); box-shadow: 0 0 0 3px var(--focus-ring), var(--shadow-2); }
.theme-card input:focus-visible + .tc-body { outline: 2px solid var(--focus); outline-offset: 3px; }
.tc-chips { display: flex; margin-bottom: 16px; border-radius: 10px; overflow: hidden; height: 44px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.tc-chips i { flex: 1; display: block; }
.tc-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 1.25rem; font-weight: 700; color: var(--ink); font-family: var(--font-display); }
.tc-tag { display: block; margin-top: 2px; color: var(--grey-600); font-size: .9375rem; }
.tc-hl { display: block; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--grey-200); font-size: .875rem; color: var(--ink-2); }
.tc-hl b { color: var(--ink); }
.tc-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--grey-300); flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.theme-card input:checked + .tc-body .tc-check { background: var(--accent); border-color: var(--accent-edge); }
.theme-card input:checked + .tc-body .tc-check::after { content: ""; width: 9px; height: 5px; border-left: 2px solid var(--accent-ink); border-bottom: 2px solid var(--accent-ink); transform: rotate(-45deg) translate(1px,-1px); }

.swatch-tools { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.swatch-tools .field { margin: 0; flex: 1 1 260px; max-width: 360px; }
.swatch-current { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.swatch-current i { width: 28px; height: 28px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.swatch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: 460px; overflow: auto; padding: 4px; }
.swatch { position: relative; display: block; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.swatch .sw-body { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 2px solid var(--grey-200); border-radius: var(--radius); background: var(--white); height: 100%; }
.swatch .sw-chip { width: 34px; height: 34px; border-radius: 6px; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.swatch .sw-name { display: block; font-size: .8125rem; font-weight: 700; line-height: 1.2; color: var(--ink); overflow-wrap: anywhere; }
.swatch .sw-hex { display: block; font-size: .75rem; color: var(--grey-600); font-family: var(--mono); }
.swatch:hover .sw-body { border-color: var(--grey-400); }
.swatch input:checked + .sw-body { border-color: var(--ink); box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--ink); }
.swatch input:focus-visible + .sw-body { outline: 2px solid var(--focus); outline-offset: 2px; }
.swatch[hidden] { display: none; }
.design-bar { position: sticky; bottom: 0; z-index: 15; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 24px; padding: 16px 20px; background: var(--white); border: 1px solid var(--grey-200); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); }
.design-bar .muted { flex: 1 1 260px; font-size: .9375rem; }
