/* Pfad: /css/main.css */
/* KeyManager Pro — Globales Stylesheet */
/* Design: Behördlich-professionell, Schweizer Designsystem trifft SaaS */

/* Google Fonts werden per <link> in den HTML-Dateien geladen (non-blocking) */

/* ═══════════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════════ */
:root {
  --navy:       #1A2744;
  --navy-mid:   #2D4A6F;
  --navy-light: #3A5A8A;
  --blue:       #3A7BD5;
  --blue-light: #E8F0FE;
  --green:      #2D6A4F;
  --green-light:#E8F5E9;
  --orange:     #E65100;
  --orange-light:#FFF3E0;
  --red:        #C62828;
  --red-light:  #FFEBEE;
  --bg:         #F4F1EA;
  --card:       #FFFFFF;
  --border:     #EAE6DE;
  --text:       #1A2744;
  --text-muted: #8A8470;
  --text-light: #A09888;
  --gold:       #C9A84C;
  --gold-light: #FDF6EC;
  --black-light:#424242;
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   16px;
  --space-lg:   24px;
  --space-xl:   40px;
  --space-2xl:  64px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  /* Standard-Radius für Karten/Kästen/Panels. Wer `var(--radius)` schreibt,
     bekommt diesen Wert — an EINER Stelle änderbar (z220). */
  --radius:     12px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.04);
  --shadow-md:  0 4px 12px rgba(0,0,0,.07);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.1);
  --shadow-xl:  0 20px 60px rgba(0,0,0,.15);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', -apple-system, sans-serif;
  --transition:   all .2s ease;
  /* Akzentfarbe — wird per Theme überschrieben */
  --accent:        #2D6A4F;
  --accent-light:  #E8F5E9;
  --accent-hover:  #245A42;
}

/* ═══════════════════════════════════════════════
   FARBTHEMEN — Akzentfarbe
   ═══════════════════════════════════════════════ */
[data-theme="green"]  { --accent:#2D6A4F; --accent-light:#E8F5E9; --accent-hover:#245A42; }
[data-theme="blue"]   { --accent:#1565C0; --accent-light:#E3F2FD; --accent-hover:#0D47A1; }
[data-theme="purple"] { --accent:#7B1FA2; --accent-light:#F3E5F5; --accent-hover:#6A1B9A; }
[data-theme="teal"]   { --accent:#00695C; --accent-light:#E0F2F1; --accent-hover:#004D40; }
[data-theme="orange"] { --accent:#D84315; --accent-light:#FBE9E7; --accent-hover:#BF360C; }
[data-theme="slate"]  { --accent:#37474F; --accent-light:#ECEFF1; --accent-hover:#263238; }
[data-theme="blau"]   { --accent:#2B5CE6; --accent-light:#E4EBFF; --accent-hover:#1E3FA8; }

/* ═══════════════════════════════════════════════
   NAVIGATIONSFARBE — Sidebar
   ═══════════════════════════════════════════════ */
[data-navcolor="navy"]   .sidebar { background: #1A2744; }
[data-navcolor="black"]  .sidebar { background: #111111; }
[data-navcolor="green"]  .sidebar { background: #1B4332; }
[data-navcolor="blue"]   .sidebar { background: #0D3063; }
[data-navcolor="purple"] .sidebar { background: #3E1060; }
[data-navcolor="slate"]  .sidebar { background: #263238; }
[data-navcolor="brown"]  .sidebar { background: #3E2723; }
[data-navcolor="blau"]   .sidebar { background: #1E3FA8; }
[data-navcolor="ink"]    .sidebar { background: #0B1533; }

/* ── v1.99.172: HELLE Sidebar-Farbtöne ───────────────────────────────────────
   Die Sidebar ist von Haus aus hell-auf-dunkel. Für helle Hintergründe müssen
   Text/Icons/Hover/Trenner/Versions-Karte/Fußzeile auf DUNKEL gestellt werden,
   sonst hell-auf-hell (unlesbar). Nur im LICHT-Modus aktiv (im Dark-Mode bleibt
   die Sidebar dunkel). Textbehandlung ist für alle hellen Töne identisch → einmal
   per :is()-Gruppe; nur der Hintergrund unterscheidet sich. Gilt auch im Redesign
   (kmrd nutzt dieselben .sidebar-Klassen; dessen Linien-Icons folgen currentColor).
   Der aktive Link behält seine Akzent-Füllung + weißen Text (:not(.active)). */
[data-mode="light"][data-navcolor="weiss"]    .sidebar { background: #F7F9FC; }
[data-mode="light"][data-navcolor="hellgrau"] .sidebar { background: #E8ECF2; }
[data-mode="light"][data-navcolor="creme"]    .sidebar { background: #F4EEE0; }
[data-mode="light"][data-navcolor="hellblau"] .sidebar { background: #DEE9F7; }
[data-mode="light"][data-navcolor="mint"]     .sidebar { background: #E2F0E8; }
[data-mode="light"][data-navcolor="rose"]     .sidebar { background: #F7E7EC; }
[data-mode="light"][data-navcolor="lavendel"] .sidebar { background: #ECE7F7; }

[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .sidebar { color: #2A3542; }
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .sidebar__org-name { color: #1E2732; }
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .sidebar__link:not(.active) { color: #3C4757; }
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .sidebar__link:not(.active):hover { color: #1E2732; background: rgba(15,23,42,.06); }
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .sidebar__user-name { color: #2A3542; }
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .sidebar__version-card__title { color: #1E2732; }
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .sidebar__version-card__arrow { color: rgba(30,39,50,.45); }
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .sidebar__detached-head { color: rgba(30,39,50,.6); }
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .sidebar__detached-empty { color: rgba(30,39,50,.45); }
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .km-add-module-btn { color: #3C4757; border-color: rgba(15,23,42,.22); }
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .km-add-module-btn:hover { color: #1E2732; background: rgba(15,23,42,.05); border-color: rgba(15,23,42,.4); }
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .sidebar__brand #sidebarFallback { color: #2A3542 !important; background: rgba(15,23,42,.06) !important; }
/* Trenner + Flächen: helle Weiß-Transparenzen → dunkle Transparenzen */
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .sidebar { border-right-color: rgba(15,23,42,.10); }   /* v1.99.211: rechte Trennlinie auf hellen Tönen dunkel */
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .sidebar__brand { border-bottom-color: rgba(15,23,42,.10); }
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .sidebar__settings { border-top-color: rgba(15,23,42,.10); }
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .sidebar__footer { border-top-color: rgba(15,23,42,.10); }
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .sidebar__logo { background: rgba(15,23,42,.05); }
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .sidebar__version-card { background: rgba(15,23,42,.03); border-color: rgba(15,23,42,.10); }
/* v1.99.201: Faktura-Gruppe (.kmfg-*) auf hellen Navigationsfarben lesbar — dunkle Schrift + dunkle Anzahl-Badges (die kmfg-Standardfarben sind für dunkle Sidebars gemacht) */
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) :is(.kmfg-head,.kmfg-item,.kmbg-head,.kmbg-item) { color: #3C4757; }
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) :is(.kmfg-head,.kmfg-item,.kmbg-head,.kmbg-item):hover { color: #1E2732; background: rgba(15,23,42,.06); }
[data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .kmfg-item:not(.active) .kmfg-badge { background: rgba(15,23,42,.12); color: #1E2732; }
@media (max-width: 768px) {
  [data-mode="light"]:is([data-navcolor="weiss"],[data-navcolor="hellgrau"],[data-navcolor="creme"],[data-navcolor="hellblau"],[data-navcolor="mint"],[data-navcolor="rose"],[data-navcolor="lavendel"]) .sidebar.open .sidebar__nav .sidebar__link:not(.active) { color: #3C4757; }
}

/* ═══════════════════════════════════════════════
   HINTERGRUNDFARBE — Seitenhintergrund (nur Light-Mode)
   ═══════════════════════════════════════════════ */
[data-bgcolor="creme"]    { --bg:#F4F1EA; }
[data-bgcolor="weiss"]    { --bg:#FBFCFD; }
[data-bgcolor="hellblau"] { --bg:#F5F7FC; }
[data-bgcolor="hellgrau"] { --bg:#F1F3F6; }
[data-bgcolor="protograu"]{ --bg:#F5F6F8; }

/* ═══════════════════════════════════════════════
   TITELLEISTEN-HINTERGRUNDFARBE (data-titlecolor) — gleiche Palette wie Navigationsfarbe (v1.99.199 / #14)
   Gilt für die durchgehenden Faktura-Titelleisten .rgo-bar (Listen) und .rgd-titlebar (Belegdetail).
   ═══════════════════════════════════════════════ */
/* v1.99.202: Farbwerte je Titelleisten-Farbe auf <html> setzen (Variablen), dann EINMAL mit !important
   anwenden — so schlägt es auch modul-eigene, id-gescopte .page-header-Regeln (z. B. #einViewList .page-header). */
[data-titlecolor="navy"]     { --km-tb-bg:#1A2744; --km-tb-fg:#fff; }
[data-titlecolor="black"]    { --km-tb-bg:#111111; --km-tb-fg:#fff; }
[data-titlecolor="green"]    { --km-tb-bg:#1B4332; --km-tb-fg:#fff; }
[data-titlecolor="blue"]     { --km-tb-bg:#0D3063; --km-tb-fg:#fff; }
[data-titlecolor="blau"]     { --km-tb-bg:#1E3FA8; --km-tb-fg:#fff; }
[data-titlecolor="purple"]   { --km-tb-bg:#3E1060; --km-tb-fg:#fff; }
[data-titlecolor="slate"]    { --km-tb-bg:#263238; --km-tb-fg:#fff; }
[data-titlecolor="brown"]    { --km-tb-bg:#3E2723; --km-tb-fg:#fff; }
[data-titlecolor="hellgrau"] { --km-tb-bg:#E8ECF2; --km-tb-fg:#2A3542; }
[data-titlecolor="creme"]    { --km-tb-bg:#F4EEE0; --km-tb-fg:#2A3542; }
[data-titlecolor="hellblau"] { --km-tb-bg:#DEE9F7; --km-tb-fg:#2A3542; }
[data-titlecolor="mint"]     { --km-tb-bg:#E2F0E8; --km-tb-fg:#2A3542; }
[data-titlecolor="rose"]     { --km-tb-bg:#F7E7EC; --km-tb-fg:#2A3542; }
[data-titlecolor="lavendel"] { --km-tb-bg:#ECE7F7; --km-tb-fg:#2A3542; }
/* „weiss" = Standard → keine Variablen gesetzt → Titelleisten behalten ihr Standard-Aussehen. */
[data-titlecolor]:not([data-titlecolor="weiss"]) :is(.rgo-bar,.rgd-titlebar,.page-header){ background:var(--km-tb-bg) !important; }
[data-titlecolor]:not([data-titlecolor="weiss"]) :is(.rgo-bar,.rgd-titlebar,.page-header) :is(.rgo-bar__title,.rgd-crumb,.rgd-root,.rgd-nr,.page-header__title,.page-header__sub){ color:var(--km-tb-fg) !important; }
/* Dunkle Töne: Outline-Buttons hell (nur bei den dunklen Werten) */
:is([data-titlecolor="navy"],[data-titlecolor="black"],[data-titlecolor="green"],[data-titlecolor="blue"],[data-titlecolor="blau"],[data-titlecolor="purple"],[data-titlecolor="slate"],[data-titlecolor="brown"]) :is(.rgo-bar,.rgd-titlebar,.page-header) .btn--outline{ color:#fff !important; border-color:rgba(255,255,255,.45) !important; }
/* .page-header wird bei gewählter Farbe zum Vollbreite-Farbband (schlägt modul-eigene Ränder) */
[data-titlecolor]:not([data-titlecolor="weiss"]) .page-header{ margin-left:calc(-1 * var(--space-lg)) !important; margin-right:calc(-1 * var(--space-lg)) !important; padding-left:var(--space-lg) !important; padding-right:var(--space-lg) !important; border-bottom:1px solid var(--border); }
/* Projekte-Liste nutzt .pjv2 .list__head statt .page-header → gleiche Titelleisten-Farbe + Vollbreite-Band (v1.99.203) */
[data-titlecolor]:not([data-titlecolor="weiss"]) .pjv2 .list__head{ background:var(--km-tb-bg) !important; margin-left:calc(-1 * var(--space-lg)) !important; margin-right:calc(-1 * var(--space-lg)) !important; padding-left:var(--space-lg) !important; padding-right:var(--space-lg) !important; padding-top:var(--space-md) !important; }
[data-titlecolor]:not([data-titlecolor="weiss"]) .pjv2 .list__head :is(h1,p){ color:var(--km-tb-fg) !important; }

/* ═══ v1.99.204: DETAIL-/Einzelansichten — Titelleisten-Farbe (+ Band/sticky wo die Kopfzeile dünn ist) ═══
   Detailköpfe nutzen EIGENE Klassen (nicht .page-header):
     Inventar .inv-det-head · Artikel .art-det-head              → bereits sticky+94px, nur Farbe
     Termin  #evModalBox .modal__header                          → Band/sticky/94px liegen inline (modul13)
     Projekt .pjv2 .pj-topbar · Kontakt #ktDetailView .kd-topbar → dünne Zeile → Farbband + sticky + 94px
     Einsatz #einViewDetail .page-header                         → Hintergrund schon gefärbt, nur Krümel-Text */
[data-titlecolor]:not([data-titlecolor="weiss"]) :is(.inv-det-head,.art-det-head,.kd-topbar,#evModalBox .modal__header){ background:var(--km-tb-bg) !important; }
[data-titlecolor]:not([data-titlecolor="weiss"]) .inv-det-head :is(.inv-crumb,.inv-crumb a,#bearbeitenTitle){ color:var(--km-tb-fg) !important; }
[data-titlecolor]:not([data-titlecolor="weiss"]) .art-det-head :is(.art-crumb,.art-crumb a,#modalArtikelTitle){ color:var(--km-tb-fg) !important; }
[data-titlecolor]:not([data-titlecolor="weiss"]) #ktDetailView .kd-topbar :is(.kd-topbar__title,.kd-bc,#kdTitle,.kd-topbar__sub){ color:var(--km-tb-fg) !important; }
[data-titlecolor]:not([data-titlecolor="weiss"]) #evModalBox .modal__header :is(.modal__title,.modal__close){ color:var(--km-tb-fg) !important; }
[data-titlecolor]:not([data-titlecolor="weiss"]) #einViewDetail .page-header :is(.ein-crumb,.ein-crumb a,#einCrumbTitle){ color:var(--km-tb-fg) !important; }
/* dunkle Töne: Outline-Buttons in den Detailköpfen hell */
:is([data-titlecolor="navy"],[data-titlecolor="black"],[data-titlecolor="green"],[data-titlecolor="blue"],[data-titlecolor="blau"],[data-titlecolor="purple"],[data-titlecolor="slate"],[data-titlecolor="brown"]) :is(.inv-det-head,.art-det-head,.kd-topbar,#evModalBox .modal__header) .btn--outline{ color:#fff !important; border-color:rgba(255,255,255,.45) !important; }
/* Projekt-Detail-Kopf (dünne Flex-Zeile) → Vollbreite-Farbband + sticky + 94px, nur bei gewählter Farbe */
[data-titlecolor]:not([data-titlecolor="weiss"]) .pjv2 .pj-topbar{ background:var(--km-tb-bg) !important; margin:0 calc(-1 * var(--space-lg)) var(--space-md) !important; padding:16px var(--space-lg) !important; min-height:94px !important; box-sizing:border-box !important; position:sticky !important; top:0 !important; z-index:20; }
[data-titlecolor]:not([data-titlecolor="weiss"]) .pjv2 .pj-topbar :is(.pj-kcrumb,.rgd-crumb,#pjBackBtn,.pbtn){ color:var(--km-tb-fg) !important; }
/* Kontakt-Detail-Kopf (Karte) → Vollbreite-Farbband + sticky + 94px, nur bei gewählter Farbe */
[data-titlecolor]:not([data-titlecolor="weiss"]) #ktDetailView .kd-topbar{ margin:0 calc(-1 * var(--space-lg)) var(--space-md) !important; padding:16px var(--space-lg) !important; min-height:94px !important; box-sizing:border-box !important; border-radius:0 !important; position:sticky !important; top:0 !important; z-index:20; }

/* ═══════════════════════════════════════════════
   DARK MODE
   ═══════════════════════════════════════════════ */
[data-mode="dark"] {
  --bg:           #0F1419;
  --card:         #1A2232;
  --border:       #2A3548;
  --text:         #D8E4F0;
  --text-muted:   #7A8FA6;
  --text-light:   #506070;
  --blue-light:   #1A2D50;
  --green-light:  #1B2D22;
  --orange-light: #2D1A0A;
  --red-light:    #2D1215;
  --gold-light:   #2A2010;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.3);
  --shadow-md:    0 4px 12px rgba(0,0,0,.4);
  --shadow-lg:    0 8px 32px rgba(0,0,0,.5);
}
[data-mode="dark"] body          { background: var(--bg); color: var(--text); }
[data-mode="dark"] h1,
[data-mode="dark"] h2,
[data-mode="dark"] h3,
[data-mode="dark"] h4            { color: var(--text); }
[data-mode="dark"] .card         { background: var(--card); border-color: var(--border); }
[data-mode="dark"] .form__input,
[data-mode="dark"] .form__select,
[data-mode="dark"] .form__textarea {
  background: #111927;
  border-color: var(--border);
  color: var(--text);
}
[data-mode="dark"] .form__label  { color: var(--text-muted); }
[data-mode="dark"] .table th     { border-color: var(--border); color: var(--text-muted); }
[data-mode="dark"] .table td     { border-color: var(--border); color: var(--text); }
[data-mode="dark"] .table tbody tr:hover td { background: #1E2D42; }
[data-mode="dark"] .btn--outline { color: var(--text); border-color: var(--border); }
[data-mode="dark"] .btn--outline:hover { background: var(--border); }
[data-mode="dark"] .modal__box   { background: var(--card); border-color: var(--border); }
[data-mode="dark"] .modal__header { border-color: var(--border); }
[data-mode="dark"] .modal__footer { border-color: var(--border); }
[data-mode="dark"] .tabs__btn    { background: var(--card); border-color: var(--border); color: var(--text-muted); }
[data-mode="dark"] .tabs__btn.active { background: var(--accent); color: #fff; }
[data-mode="dark"] .tabs__panel  { background: transparent; }
[data-mode="dark"] .info-box     { background: var(--card); border-color: var(--border); }
[data-mode="dark"] .badge--gray  { background: #2A3548; color: var(--text-muted); }
[data-mode="dark"] .page-header__sub { color: var(--text-muted); }
[data-mode="dark"] .sidebar      { background: #080E17; border-right-color: var(--border); }   /* v1.99.211: rechte Trennlinie im Dark-Mode */
[data-mode="dark"] .sidebar__link.active { background: #1A2D42; }
[data-mode="dark"] .topbar       { background: #080E17; border-color: var(--border); }
[data-mode="dark"] .settings-nav { background: var(--card); border-color: var(--border); }
[data-mode="dark"] .settings-nav__link:hover { background: var(--border); }
[data-mode="dark"] .settings-nav__link.active { background: var(--accent); color: #fff; }
[data-mode="dark"] select option { background: #1A2232; }

/* ═══════════════════════════════════════════════
   SCHRIFTGRÖSSE
   Nur body + Textelemente skalieren.
   html-root bleibt immer bei 16 px → rem-basierte
   Abstände (Padding, Radius, Shadow) bleiben stabil.
   ═══════════════════════════════════════════════ */
[data-fontsize="small"] body { font-size: 14px; }
[data-fontsize="large"]  body { font-size: 18px; }

/* Überschriften explizit skalieren (rem → proportional) */
[data-fontsize="small"] h1 { font-size: 2.19rem; }
[data-fontsize="small"] h2 { font-size: 1.53rem; }
[data-fontsize="small"] h3 { font-size: 1.09rem; }
[data-fontsize="small"] h4 { font-size: 0.96rem; }
[data-fontsize="large"]  h1 { font-size: 2.81rem; }
[data-fontsize="large"]  h2 { font-size: 1.97rem; }
[data-fontsize="large"]  h3 { font-size: 1.41rem; }
[data-fontsize="large"]  h4 { font-size: 1.24rem; }

/* Schaltflächen, Labels, Badges, Inputs skalieren mit body-Größe mit */
[data-fontsize="small"] .btn,
[data-fontsize="small"] .form__input,
[data-fontsize="small"] .form__select,
[data-fontsize="small"] .form__textarea,
[data-fontsize="small"] .form__label,
[data-fontsize="small"] .badge,
[data-fontsize="small"] .sidebar__link,
[data-fontsize="small"] .modal__title,
[data-fontsize="small"] td, [data-fontsize="small"] th { font-size: 0.8125rem; } /* 13px */

[data-fontsize="large"]  .btn,
[data-fontsize="large"]  .form__input,
[data-fontsize="large"]  .form__select,
[data-fontsize="large"]  .form__textarea,
[data-fontsize="large"]  .form__label,
[data-fontsize="large"]  .badge,
[data-fontsize="large"]  .sidebar__link,
[data-fontsize="large"]  .modal__title,
[data-fontsize="large"]  td, [data-fontsize="large"]  th { font-size: 1rem; } /* 16px */

/* ═══════════════════════════════════════════════
   KOMPAKT-MODUS
   ═══════════════════════════════════════════════ */
[data-compact="true"] .card          { padding: var(--space-md); }
[data-compact="true"] .table th,
[data-compact="true"] .table td      { padding: 7px 10px; }
[data-compact="true"] .sidebar__link { padding: 7px 12px; }
/* Modals: Kompakt-Modus greift hier NICHT — Dialoge behalten immer vollen Rand */
[data-compact="true"] .form__group   { margin-bottom: var(--space-sm); }
[data-compact="true"] .page-header   { padding: var(--space-md) 0; }

/* Akzentfarbe-Overrides (ersetzen --green überall) */
.btn--green          { background: var(--accent) !important; }
.btn--green:hover    { background: var(--accent-hover) !important; }
.btn--green-light    { background: var(--accent-light) !important; color: var(--accent) !important; }
.sidebar__link.active { background: var(--accent) !important; }
.table th.sort-asc,
.table th.sort-desc  { color: var(--accent) !important; }
.table th.sort-asc::after,
.table th.sort-desc::after { color: var(--accent) !important; }
.table th.sortable:hover   { color: var(--accent) !important; }
.filter-chip.active  { background: var(--accent) !important; border-color: var(--accent) !important; }
.badge--green        { background: var(--accent-light); color: var(--accent); }
.progress__bar       { background: var(--accent) !important; }

/* ═══════════════════════════════════════════════
   DARSTELLUNGS-EINSTELLUNGEN UI
   ═══════════════════════════════════════════════ */
.theme-section-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}
.mode-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.mode-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 12px 12px;
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
  background: var(--bg);
}
.mode-card:hover  { border-color: var(--accent); }
.mode-card.active { border-color: var(--accent); background: var(--accent-light); }
.mode-card__preview {
  width: 100%;
  height: 52px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
  display: flex;
  gap: 4px;
}
.mode-card__preview-sidebar {
  width: 28%;
  height: 100%;
  border-radius: 4px 0 0 4px;
}
.mode-card__preview-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px;
}
.mode-card__preview-line {
  height: 6px;
  border-radius: 3px;
}
.mode-card__label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text);
}
.mode-card__sub {
  font-size: .68rem;
  color: var(--text-muted);
}
/* Light preview */
.mode-card--light .mode-card__preview { background: #F4F1EA; }
.mode-card--light .mode-card__preview-sidebar { background: #1A2744; }
.mode-card--light .mode-card__preview-line:nth-child(1) { background: #e0dbd4; width: 90%; }
.mode-card--light .mode-card__preview-line:nth-child(2) { background: #e8e3dc; width: 70%; }
.mode-card--light .mode-card__preview-line:nth-child(3) { background: var(--accent); width: 50%; }
/* Dark preview */
.mode-card--dark .mode-card__preview  { background: #0F1419; }
.mode-card--dark .mode-card__preview-sidebar { background: #080E17; }
.mode-card--dark .mode-card__preview-line:nth-child(1) { background: #2A3548; width: 90%; }
.mode-card--dark .mode-card__preview-line:nth-child(2) { background: #1A2232; width: 70%; }
.mode-card--dark .mode-card__preview-line:nth-child(3) { background: var(--accent); width: 50%; }
/* System preview */
.mode-card--system .mode-card__preview {
  background: linear-gradient(to right, #F4F1EA 50%, #0F1419 50%);
}
.mode-card--system .mode-card__preview-sidebar {
  background: linear-gradient(to bottom, #1A2744 50%, #080E17 50%);
}
.mode-card--system .mode-card__preview-line:nth-child(1) { background: #9E9E9E; width: 90%; }
.mode-card--system .mode-card__preview-line:nth-child(2) { background: #BDBDBD; width: 70%; }
.mode-card--system .mode-card__preview-line:nth-child(3) { background: var(--accent); width: 50%; }

.color-swatches {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}
.color-swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid transparent;
  transition: var(--transition);
  position: relative;
}
.color-swatch:hover    { transform: scale(1.15); }
.color-swatch.active   { border-color: var(--text); }
.color-swatch.active::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .75rem;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}

.fontsize-btns {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}
.fontsize-btn {
  flex: 1;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 600;
}
.fontsize-btn:hover  { border-color: var(--accent); }
.fontsize-btn.active { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  margin-bottom: var(--space-sm);
}
.toggle-row__info strong { font-size: .875rem; color: var(--text); display: block; }
.toggle-row__info span   { font-size: .75rem; color: var(--text-muted); }
.toggle-switch {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  position: relative;
  background: var(--border);
  transition: background .2s;
  flex-shrink: 0;
}
.toggle-switch.on { background: var(--accent); }
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: left .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.toggle-switch.on::after { left: 23px; }

/* ═══════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════ */
*, *::before, *::after {
  margin: 0; padding: 0; box-sizing: border-box;
}
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}
/* ── Seiten-Übergang ── */
/* WICHTIG: Kein transform hier verwenden! Sonst wird body zum
   Containing Block für position:fixed → Modals werden relativ
   zum Body (Dokument) positioniert statt zum Viewport. */
@keyframes km-page-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  min-height: 100vh;
  animation: km-page-in 0.2s ease forwards;
}
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea {
  font-family: var(--font-body);
  font-size: inherit;
}
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  color: var(--navy);
}
h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

/* ═══════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}
.container--narrow {
  max-width: 480px;
}
.container--mid {
  max-width: 640px;
}

/* ═══════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════ */
.card {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.card--hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card--navy {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.card--featured {
  border: 2px solid var(--gold);
  box-shadow: var(--shadow-md);
  transform: scale(1.03);
  position: relative;
}

/* ═══════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn--disabled {
  opacity: .5; cursor: not-allowed; pointer-events: none;
}
.btn--green   { background: var(--green); color: #fff; }
.btn--navy    { background: var(--navy); color: #fff; }
.btn--blue    { background: var(--blue); color: #fff; }
.btn--red     { background: var(--red); color: #fff; }
.btn--orange  { background: var(--orange); color: #fff; }
.btn--gold    { background: var(--gold); color: #fff; }
.btn--ghost   { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }
.btn--ghost:hover { background: rgba(255,255,255,.1); }
.btn--outline { background: transparent; color: var(--navy); border: 1px solid var(--border); }
.btn--outline:hover { background: var(--bg); }
.btn--sm      { padding: 6px 14px; font-size: .8rem; }
.btn--lg      { padding: 14px 32px; font-size: 1rem; }
.btn--full    { width: 100%; }
.btn--icon    { padding: 8px; min-width: 36px; }
.btn--green-light { background: var(--green-light); color: var(--green); }
.btn--red-light   { background: var(--red-light); color: var(--red); }
.btn--blue-light  { background: var(--blue-light); color: var(--blue); }

/* Loading state */
.btn--loading {
  pointer-events: none;
  position: relative;
  color: transparent !important; /* Ausnahme: Loading-State muss Text verbergen */
}
.btn--loading::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════════ */
.form__group {
  margin-bottom: var(--space-md);
}
.form__label {
  display: block;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: var(--space-xs);
}
.form__input,
.form__select,
.form__textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: .9rem;
  background: #FAFAF6;
  color: var(--text);
  transition: var(--transition);
}
.form__input:focus,
.form__select:focus,
.form__textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(58,123,213,.12);
}
.form__input--error {
  border-color: var(--red);
}
.form__error {
  font-size: .78rem;
  color: var(--red);
  margin-top: var(--space-xs);
  display: none;
}
.form__error.visible {
  display: block;
}
.form__hint {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}
.form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
}
.form__select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238A8470' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.form__textarea {
  resize: vertical;
  min-height: 80px;
}
.form__checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  font-size: .875rem;
  cursor: pointer;
}
.form__checkbox input[type="checkbox"] {
  width: 18px; height: 18px;
  margin-top: 2px;
  accent-color: var(--green);
  cursor: pointer;
}

/* Password strength bar */
.pw-strength {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin-top: var(--space-sm);
  overflow: hidden;
}
.pw-strength__bar {
  height: 100%;
  border-radius: 2px;
  width: 0;
  transition: width .3s, background .3s;
}
.pw-strength__label {
  font-size: .75rem;
  margin-top: var(--space-xs);
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}
.badge--green  { background: var(--green-light); color: var(--green); }
.badge--orange { background: var(--orange-light); color: var(--orange); }
.badge--red    { background: var(--red-light); color: var(--red); }
.badge--blue   { background: var(--blue-light); color: var(--blue); }
.badge--navy   { background: var(--navy); color: #fff; }
.badge--gold   { background: var(--gold-light); color: var(--gold); }
.badge--gray   { background: #F0ECE4; color: var(--text-muted); }
.badge--black  { background: #EEEEEE; color: var(--black-light); }

/* ═══════════════════════════════════════════════
   INFO TAGS
   ═══════════════════════════════════════════════ */
.tag {
  display: inline-block;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  margin: 2px;
}
.tag__label {
  font-size: .65rem;
  color: var(--text-light);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.tag__value {
  font-size: .8rem;
  color: var(--navy);
  font-weight: 700;
}
.tag--mono .tag__value {
  font-family: 'Courier New', monospace;
}

/* ═══════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
}
.table {
  width: 100%;
  border-collapse: collapse;
}

/* ═══════════════════════════════════════════════
   62z65: MOBILE — iOS-Auto-Zoom beim Fokussieren von Eingaben verhindern.
   Felder mit Schriftgröße < 16px lösen auf iOS automatisch Zoom aus (Layout „verrutscht",
   sieht schlecht aus). Nur ≤768px → betrifft die PC-Ansicht NICHT.
   ═══════════════════════════════════════════════ */
@media (max-width: 768px) {
  input:not([type="checkbox"]):not([type="radio"]),
  select, textarea,
  .form__input, .form__textarea, .form__select {
    font-size: 16px !important;
  }
  .table-wrap { -webkit-overflow-scrolling: touch; }

  /* 62z66: Opt-in Tabelle → Karten auf Mobil (kein Querscrollen).
     Modul fügt `class="table table--cards"` hinzu und gibt jeder <td> ein
     data-label="Spaltenname"; Aktions-/Leerzellen bekommen kein data-label. */
  .table--cards, .table--cards tbody { display: block; width: 100%; }
  .table--cards thead { display: none; }
  .table--cards tr {
    display: block; border: 1px solid var(--border); border-radius: 10px;
    padding: 4px 10px; margin-bottom: 10px; background: var(--card, #fff);
  }
  .table--cards td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 7px 2px; border: none !important; text-align: right; white-space: normal; min-width: 0;
  }
  .table--cards td:not(:last-child) { border-bottom: 1px solid var(--border) !important; }
  .table--cards td[data-label]::before {
    content: attr(data-label); font-weight: 700; font-size: .68rem;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px;
    text-align: left; flex: 0 0 auto; margin-right: auto;
  }
  /* Zellen ohne data-label (Aktionen) → nur der Inhalt, rechtsbündig, keine Trennlinie */
  .table--cards td:not([data-label]) { justify-content: flex-end; border-bottom: none !important; }
  /* „Keine Einträge"-Zeile (colspan) normal zentriert lassen */
  .table--cards td[colspan] { display: block; text-align: center; }
}
.table th {
  text-align: left;
  padding: 10px 14px;
  color: var(--text-muted);
  font-weight: 700;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .8px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
/* Sortierbare Spalten */
.table th.sortable {
  cursor: pointer;
  user-select: none;
  padding-right: 22px;
  position: relative;
  transition: color .15s;
}
.table th.sortable:hover {
  color: var(--green);
}
.table th.sortable::after {
  content: '⇅';
  position: absolute;
  right: 6px;
  font-size: .75rem;
  opacity: .35;
  transition: opacity .15s;
}
.table th.sortable:hover::after { opacity: .7; }
.table th.sort-asc::after  { content: '▲'; opacity: 1; color: var(--green); }
.table th.sort-desc::after { content: '▼'; opacity: 1; color: var(--green); }
.table th.sort-asc,
.table th.sort-desc { color: var(--green); }
.table td {
  padding: 11px 14px;
  font-size: .875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:hover td {
  background: #FAF9F6;
}

/* ═══════════════════════════════════════════════
   MODAL
   Padding und max-width in em → skalieren proportional
   mit der gewählten Schriftgröße (Klein/Normal/Groß).
   ═══════════════════════════════════════════════ */
.modal__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: none;
  z-index: 1000;
  /* Overlay selbst scrollt wenn Modal größer als Viewport */
  overflow-y: auto;
  padding: 1em;
}
.modal__overlay.open {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  /* min-height: 100% kombiniert mit margin:auto am Box → vertikal zentriert wenn passt,
     scrollbar wenn größer */
  min-height: 100%;
}
.modal__box {
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 1.5em;
  width: 100%;
  box-shadow: var(--shadow-xl);
  margin: auto 0;
  /* Modal wächst frei, Overlay scrollt — keine max-height-Begrenzung mehr nötig.
     Speichern-Buttons sind dadurch IMMER per Scroll erreichbar. */
}
/* Footer-Buttons werden klebrig am Modal-Boden – auch beim Scrollen sichtbar */
.modal__footer {
  position: sticky;
  bottom: -1.5em;
  background: var(--card);
  margin-bottom: -1.5em;
  padding-bottom: 1.5em;
  z-index: 2;
}
/* em-basierte max-width: Modal wächst/schrumpft mit Schriftgröße */
.modal__box--sm { max-width: min(27.5em, 95vw); }   /* ~440px bei Normal */
.modal__box--md { max-width: min(35em,   95vw); }   /* ~560px bei Normal */
.modal__box--lg { max-width: min(43.75em,95vw); }   /* ~700px bei Normal */
.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5em;
}
.modal__title {
  font-size: 1.15rem;
  font-weight: 800;
}
.modal__close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
}
.modal__footer {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5em;
  margin-top: 1.5em;
  padding-top: 1em;
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════
   TABS
   ═══════════════════════════════════════════════ */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: var(--space-lg);
}
.tabs__btn {
  flex: 1;
  padding: 9px 16px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
  transition: var(--transition);
}
.tabs__btn.active {
  background: var(--card);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
}
.tabs__panel {
  display: none;
}
.tabs__panel.active {
  display: block;
}

/* ═══════════════════════════════════════════════
   STEPPER (Progress Steps)
   ═══════════════════════════════════════════════ */
.stepper {
  display: flex;
  gap: 4px;
  margin-bottom: var(--space-lg);
}
.stepper__step,
.step {
  flex: 1;
  text-align: center;
}
.stepper__bar,
.step-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin-bottom: var(--space-xs);
  transition: background .3s;
}
.stepper__bar.done,
.step-bar.done {
  background: var(--green);
}
.stepper__label,
.step-label {
  font-size: .7rem;
  color: var(--text-light);
  font-weight: 500;
}
.stepper__label.active,
.step-label.active {
  color: var(--green);
  font-weight: 700;
}

/* ═══════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-sm);
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn .3s ease;
  max-width: 380px;
}
.toast--success { background: var(--green); color: #fff; }
.toast--error   { background: var(--red); color: #fff; }
.toast--warning { background: var(--orange); color: #fff; }
.toast--info    { background: var(--blue); color: #fff; }
.toast--out { animation: toastOut .3s ease forwards; }
@keyframes toastIn  { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastOut { from { opacity:1; transform:translateY(0); } to { opacity:0; transform:translateY(10px); } }

/* ═══════════════════════════════════════════════
   CODE INPUT (6-digit verification)
   ═══════════════════════════════════════════════ */
.code-input {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
}
.code-input__field {
  width: 48px; height: 56px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: #FAFAF6;
  transition: var(--transition);
}
.code-input__field:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(58,123,213,.15);
}

/* ═══════════════════════════════════════════════
   APP SHELL — SIDEBAR
   ═══════════════════════════════════════════════ */
/* ── Modulwechsel ohne „Zucken": Cross-Document View Transitions ──────────────
   Jede Modulseite ist ein eigenes HTML-Dokument; ein Wechsel ist eine echte
   (Voll-)Navigation. Ohne Uebergang sieht man den harten Dokument-Austausch als
   Flackern/Weiss-Blitz. `@view-transition { navigation: auto }` laesst den Browser
   die alte und neue Seite weich ueberblenden — ganz ohne JS. Da ALLE Seiten diese
   eine main.css teilen und die Shell-Klassen (.sidebar/.app__main) ueberall gleich
   heissen, genuegt dieser eine Ort.
   Progressive Enhancement: Browser ohne Unterstuetzung (aktuell Firefox/Safari)
   navigieren einfach hart wie bisher — kein Bruch. */
@view-transition { navigation: auto; }

/* Die Sidebar als DURCHGEHENDES Element markieren: beim Wechsel bleibt sie stehen
   (kein Neuaufbau-Flackern der Seitenleiste), nur der Arbeitsbereich blendet ueber.
   view-transition-name MUSS pro Dokument eindeutig sein → nur auf DEM einen
   .sidebar-Container, niemals auf einzelnen Links. */
.sidebar { view-transition-name: km-sidebar; }

/* Ueberblendung dezent + kurz halten (Standard waeren 250 ms Crossfade). */
::view-transition-group(root) { animation-duration: .16s; }

/* Bewegungsreduktion respektieren — auch fuer die bestehenden Shell-Animationen. */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
  .sidebar, .app__main { transition: none !important; }
}

.app {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 240px;
  height: 100vh;
  height: 100dvh; /* dynamische Viewport-Höhe (Browser-Toolbar berücksichtigt) */
  background: var(--navy);
  color: #C8D6E5;
  border-right: 1px solid rgba(255,255,255,.08);   /* v1.99.211: durchgehende Trennlinie zur Titelleiste/zum Inhalt */
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0;
  bottom: 0;
  z-index: 100;
  transition: transform .3s;
  overflow-y: auto;  /* v1.99.202 (#3): Fallback — falls die fixe Fußzeile (Nutzer/Abmelden) mal nicht in die Höhe passt, ist sie durch Scrollen der Seitenleiste erreichbar (greift nur, wenn die Navi den Überlauf nicht schon selbst scrollt) */
  overflow-x: hidden;
  will-change: auto; /* sicherstellen dass kein Containing-Block Bug entsteht */
}
.sidebar__brand {
  flex: 0 0 auto;
  height: 94px;                 /* auf einer Höhe mit der Titelleiste des Inhalts (Linie deckungsgleich) */
  box-sizing: border-box;
  padding: 0 var(--space-md);
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;   /* Logo mittig auf Titel-Höhe */
  gap: 4px;
  position: relative;
}
.sidebar__logo {
  width: 64px; height: 64px;
  border-radius: var(--radius-md);
  object-fit: contain;
  margin: 0 auto var(--space-sm);
  background: rgba(255,255,255,.08);
  padding: 8px;
}
/* Logo/Fallback in den 94px-Kopf einpassen (überschreibt die Inline-Grössen in der Sidebar-HTML). */
.sidebar__brand #sidebarLogo   { max-height: 42px !important; margin: 0 !important; }
.sidebar__brand #sidebarFallback { width: 40px !important; height: 40px !important; margin: 0 !important; font-size: 1.25rem !important; }
.sidebar__org-name {
  font-family: var(--font-display);
  font-size: .82rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
}
.sidebar__nav {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-md) var(--space-sm);
  /* Scrollbar in beiden Zuständen (ein-/ausgeklappt) verstecken — Scrolling bleibt möglich */
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* IE/Edge alt */
}
.sidebar__nav::-webkit-scrollbar {
  display: none;               /* Chrome/Safari/Edge neu */
  width: 0;
  height: 0;
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #8EA4C0;
  font-weight: 600;
  font-size: .875rem;
  text-decoration: none;
  margin-bottom: 2px;
  transition: var(--transition);
}
.sidebar__link:hover {
  background: rgba(255,255,255,.06);
  color: #C8D6E5;
  text-decoration: none;
}
.sidebar__link.active {
  background: var(--navy-mid);
  color: #fff;
}
.sidebar__link-icon {
  font-size: 1rem;
  width: 20px;
  text-align: center;
}
/* Schritt B1: BETA-Kennzeichnung */
.km-beta-pill {
  display: inline-block;
  font-size: .56rem;
  font-weight: 800;
  letter-spacing: .5px;
  background: #f59e0b;
  color: #1a1a1a;
  padding: 1px 5px;
  border-radius: 6px;
  margin-left: 4px;
  vertical-align: middle;
  text-transform: uppercase;
}
.km-beta-badge {
  display: inline-block;
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .6px;
  background: #f59e0b;
  color: #1a1a1a;
  padding: 2px 8px;
  border-radius: 8px;
  margin-left: 8px;
  vertical-align: middle;
  text-transform: uppercase;
}
.km-beta-banner {
  background: linear-gradient(135deg,#fef3c7,#fde68a);
  border: 1px solid #f59e0b;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: .82rem;
  color: #92400e;
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar__settings {
  flex: 0 0 auto;
  padding: var(--space-sm);
  border-top: 1px solid rgba(255,255,255,.08);
}

/* ═══════════════════════════════════════════════
   Schritt 62z17: Globales Versions-Card in der Sidebar
   ═══════════════════════════════════════════════ */
.sidebar__version-card {
  flex: 0 0 auto;
  margin: var(--space-sm) var(--space-md) 0;
  padding: 10px 12px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .12s;
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}
.sidebar__version-card:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(16,185,129,.35);
  transform: translateY(-1px);
}
.sidebar__version-card:active {
  transform: translateY(0);
}
.sidebar__version-card__icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(16,185,129,.12);
  border: 1px solid rgba(16,185,129,.30);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.sidebar__version-card__text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.sidebar__version-card__title {
  font-size: .82rem;
  color: #E0E7EF;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.sidebar__version-card__ver {
  font-size: .68rem;
  color: #10b981;
  font-family: 'SF Mono', Consolas, monospace;
  margin-top: 2px;
  letter-spacing: .02em;
}
.sidebar__version-card__arrow {
  color: rgba(200,214,229,.45);
  font-size: 1.05rem;
  flex-shrink: 0;
  transition: transform .15s, color .15s;
}
.sidebar__version-card:hover .sidebar__version-card__arrow {
  color: #10b981;
  transform: translateX(2px);
}

/* Eingeklappte Sidebar: nur Icon zeigen */
body.sidebar-collapsed .sidebar__version-card {
  margin: var(--space-sm) auto 0;
  padding: 8px;
  justify-content: center;
}
body.sidebar-collapsed .sidebar__version-card__text,
body.sidebar-collapsed .sidebar__version-card__arrow {
  display: none;
}
.sidebar__footer {
  flex: 0 0 auto;
  padding: var(--space-md);
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.sidebar__avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--navy-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.sidebar__user-name {
  font-size: .78rem;
  font-weight: 600;
  color: #C8D6E5;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar__logout {
  font-size: .7rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
}
.sidebar__logout:hover { color: var(--red); }

/* App main area */
.app__main {
  flex: 1;
  margin-left: 240px;
  padding: var(--space-lg);
  background: var(--bg);
  min-height: 100vh;
  overflow-y: auto;
}
/* margin-left NUR beim interaktiven Ein-/Ausklappen animieren, NICHT beim Laden.
   Sonst rutscht der Arbeitsbereich bei eingeklappter Sidebar bei JEDEM Seiten-
   wechsel sichtbar von 240px auf 76px. body.km-ready wird per rAF nach dem ersten
   Paint gesetzt (main.js), also greift der Uebergang erst nach dem Laden. */
body.km-ready .app__main { transition: margin-left .25s ease; }

/* ── Lade-Skelett (Platzhalter, während Daten laden) ──────────────────────────
   Zentral: main.js/kmInitSkeletons() füllt jeden [data-km-skeleton]-Container mit
   Platzhalter-Zeilen, bis der echte Render den Inhalt setzt. Verhindert den
   „leere Tabelle → Zeilen poppen rein"-Sprung beim Modul-Start. Theme-aware über
   Tokens; Auto-Clear + Reduced-Motion-Guard. */
.km-skel-row { pointer-events: none; }
.km-skel-bar {
  display: block; height: 14px; width: 70%; border-radius: 7px;
  /* neutrales Grau mit Alpha → auf hellem UND dunklem Theme sichtbar */
  background: linear-gradient(90deg, rgba(130,140,155,.20) 25%, rgba(130,140,155,.42) 37%, rgba(130,140,155,.20) 63%);
  background-size: 400% 100%;
  animation: kmSkelShimmer 1.3s ease-in-out infinite;
}
tr.km-skel-row > td { padding: 14px 12px; border-bottom: 1px solid var(--border); }
.km-skel-row.km-skel-block { padding: 14px 4px; border-bottom: 1px solid var(--border); }
.km-skel-row.km-skel-card {
  padding: 16px; border: 1px solid var(--border); border-radius: var(--radius, 10px);
  background: var(--card, #fff); margin-bottom: 12px;
}
.km-skel-row.km-skel-card .km-skel-bar:first-child { width: 45%; height: 16px; margin-bottom: 10px; }
@keyframes kmSkelShimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .km-skel-bar { animation: none; } }

/* ── „Erst komplett, dann zeigen" — koordiniertes Einblenden des Arbeitsbereichs ──
   Der Arbeitsbereich (.app__main) wird beim Laden verdeckt und erst als GANZES
   eingeblendet, wenn der Inhalt fertig ist (main.js setzt body.km-revealed, sobald
   die Liste gerendert ODER ein Timeout/window.load erreicht ist) → kein sichtbarer
   stufenweiser Aufbau. Die Sidebar bleibt sichtbar (außerhalb .app__main).
   FAILSAFE: eine CSS-Animation blendet nach 3,5 s AUCH dann ein, wenn JS nie läuft
   → der Inhalt kann NIE dauerhaft unsichtbar bleiben. */
.app__main { opacity: 0; animation: kmRevealFailsafe 1ms linear 3500ms forwards; }
body.km-revealed .app__main { opacity: 1; animation: none; transition: opacity .22s ease; }
@keyframes kmRevealFailsafe { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { body.km-revealed .app__main { transition: none; } }
@media print { .app__main { opacity: 1 !important; animation: none !important; } }
/* v1.99.204: Desktop — .app__main NICHT als eigener Scroll-Container behandeln. Mit overflow-y:auto WÄCHST
   .app__main zwar mit dem Inhalt (das Fenster scrollt), aber es bildet trotzdem einen Scroll-Kontext, der die
   position:sticky-Titelleisten der In-Flow-Detailansichten (Einsatz/Projekt/Kontakt) „einfängt" → sie scrollen
   doch mit. overflow-y:visible lässt sticky sich auf den VIEWPORT beziehen (Titelleiste bleibt oben), overflow-x:clip
   klemmt breite Inhalte weiterhin ab (kein horizontaler Seiten-Scroll). Das Fenster bleibt der Scroller
   (window.scrollTo etc. unverändert). Modal-basierte Detailköpfe (Termin/Inventar/Artikel) haben ihren eigenen
   Scroll-Container und sind davon unberührt. Mobil (<769px) bleibt overflow-y:auto (dort sind Kopfzeilen statisch). */
@media (min-width:769px){ .app__main{ overflow-x:clip; overflow-y:visible; } }

/* ── Sidebar einklappbar (Teams-Style) ──
   .sidebar-collapsed auf <body> → Sidebar wird auf 76px reduziert.
   Icon zentriert + kleines Label darunter (wie Teams).
*/
body.sidebar-collapsed .sidebar { width: 76px; }
body.sidebar-collapsed .app__main { margin-left: 76px; }
body.sidebar-collapsed .sidebar__brand {
  height: 94px; padding: 0;   /* v1.99.28: HÖHE bleibt wie ausgeklappt → Nav-Icons verrutschen NICHT nach oben */
  border-bottom: 1px solid rgba(255,255,255,.08);
}
/* Eingeklappt: nur noch der Hamburger — Logo, Fallback und Firmenname ausgeblendet. */
body.sidebar-collapsed .sidebar__logo,
body.sidebar-collapsed #sidebarLogo,
body.sidebar-collapsed #sidebarFallback,
body.sidebar-collapsed .sidebar__org-name { display: none !important; }
body.sidebar-collapsed .sidebar__org-name {
  display: none;
}
body.sidebar-collapsed .sidebar__nav {
  padding: var(--space-md) var(--space-sm);   /* gleiche H-Polsterung wie ausgeklappt → Icons verrutschen NICHT */
  /* Scrollbar verstecken aber Scrolling erlauben */
  scrollbar-width: none;       /* Firefox */
  -ms-overflow-style: none;    /* IE/Edge alt */
}
body.sidebar-collapsed .sidebar__nav::-webkit-scrollbar {
  display: none;               /* Chrome/Safari */
  width: 0;
}
body.sidebar-collapsed .sidebar__settings {
  padding: 4px;
}
/* Plancraft-Stil: eingeklappt bleibt das ROW-Layout (Icon links) — NUR das Label wird ausgeblendet.
   Vorher war es column (Icon oben, Label darunter, grösseres Icon) → die Icons verrutschten beim Einklappen. */
body.sidebar-collapsed .sidebar__link {
  /* v1.99.28: Icons MITTIG im 76px-Rail als quadratische Kachel. Vertikale Metrik (padding 10px + margin 2px)
     bleibt identisch zum ausgeklappten Zustand → KEINE Verschiebung nach oben; nur horizontal zentriert. */
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 44px;
  padding: 10px 0;
  margin: 0 auto 2px;
  text-align: center;
  position: relative;
  border-radius: 8px;
  min-height: 0;
}
body.sidebar-collapsed .sidebar__link-icon {
  font-size: 1rem;             /* wie ausgeklappt (nicht vergrössern) → keine Verschiebung */
  width: 20px;
  text-align: center;
  /* v1.99.28: KEIN line-height:1 — sonst schrumpft die Zeilenbox (16px statt ~26px vom Emoji) und die
     Icons rutschen nach oben. Natürliche Zeilenhöhe = identische Zeilenbox wie ausgeklappt. */
}
/* Eingeklappt: NUR Icons sichtbar (Label ausblenden) — wie Plancraft. */
body.sidebar-collapsed .sidebar__link > span:not(.sidebar__link-icon) {
  display: none;
}
/* v1.99.28: Aktiver Eintrag = die zentrierte Kachel selbst (Hintergrund). Kein Balken links (würde neben
   der mittigen Kachel schweben). */
body.sidebar-collapsed .sidebar__link.active::before { display: none; }
/* Unread-Badges etc. — neu positionieren (rechts oben am Icon, ÜBERLAPPEND).
   Wichtig: !important überschreibt die Inline-Styles aus setSidebarBadge() in main.js. */
body.sidebar-collapsed .sidebar__link {
  /* Overflow auf visible lassen, damit der Badge "raussteht" – aber Link selbst behält Box */
  overflow: visible;
  /* v1.99.213: setSidebarBadge() setzt inline justify-content:flex-start (für den ausgeklappten
     Zustand, Badge rechts). Eingeklappt MUSS das Icon aber mittig bleiben → !important schlägt
     das Inline-Style; der Badge liegt ohnehin absolut oben-rechts (überlappt das Icon). */
  justify-content: center !important;
}
body.sidebar-collapsed .sidebar__link-extra,
body.sidebar-collapsed .sidebar__link-badge,
body.sidebar-collapsed .sidebar__badge,
body.sidebar-collapsed .km-badge {
  position: absolute !important;
  top: 2px !important;
  right: 4px !important;
  left: auto !important;
  margin: 0 !important;
  font-size: .58rem !important;
  min-width: 16px !important;
  height: 16px !important;
  padding: 0 4px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 9px !important;
  background: #dc2626 !important;
  color: #fff !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  box-shadow: 0 0 0 2px var(--navy-deep, #1B4332) !important;
  z-index: 2 !important;
  /* Keine Breitenänderung am Link mehr */
  flex: 0 0 auto !important;
}
body.sidebar-collapsed .sidebar__footer {
  flex-direction: column;
  padding: 10px 6px 14px;
  gap: 6px;
  align-items: center;
}
/* Username weg, Abmelden bleibt sichtbar – als Icon */
body.sidebar-collapsed .sidebar__user-name {
  display: none !important;
}
body.sidebar-collapsed .sidebar__logout {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 32px;
  margin: 0;
  font-size: 0;
  color: #fff;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  transition: background .15s ease, color .15s ease;
}
body.sidebar-collapsed .sidebar__logout::before {
  content: '⎋';
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
}
body.sidebar-collapsed .sidebar__logout:hover {
  background: rgba(220, 38, 38, .15);
  border-color: rgba(220, 38, 38, .4);
}
body.sidebar-collapsed .sidebar__logout:hover::before {
  color: #ef4444;
}
/* Tooltip beim Hover (in beiden Modi) */
.sidebar__link[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  background: #1f2937;
  color: #fff;
  padding: 5px 9px;
  border-radius: 5px;
  font-size: .76rem;
  font-weight: 600;
  white-space: nowrap;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  pointer-events: none;
}

/* Sidebar-Toggle-Button — fest oben, immer sichtbar */
.sidebar-toggle {
  position: fixed;
  top: 31px;                     /* vertikal mittig im 94px-Kopf (wie der Titel) */
  left: 204px;                   /* rechtsbündig an der Sidebar-Kante (240px) */
  width: 32px; height: 32px;
  background: var(--card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;            /* eckig statt rund */
  cursor: pointer;
  z-index: 110;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  color: var(--text-muted, #6b7280);
  box-shadow: 0 2px 6px rgba(0,0,0,.1);
  transition: all .25s ease;
}
.sidebar-toggle:hover {
  color: var(--text, #1f2937);
  border-color: var(--text-muted, #6b7280);
  transform: scale(1.05);
}
/* Eingebetteter Modus (Workspace-iframe): kein funktionsloser ☰-Toggle */
body.km-embed .sidebar-toggle { display: none !important; }
body.sidebar-collapsed .sidebar-toggle {
  /* v1.99.28: NUR horizontal einfahren — gleiche Höhe (top) und Grösse wie ausgeklappt, mittig im 76px-Rail
     ((76 - 32) / 2 = 22). Keine Höhenänderung. */
  top: 31px;
  left: 22px;
  width: 32px; height: 32px;
  background: rgba(255,255,255,.08);
  color: #fff;
  border-color: rgba(255,255,255,.18);
  font-size: 1rem;
}
body.sidebar-collapsed .sidebar-toggle:hover {
  background: rgba(255,255,255,.15);
  transform: scale(1.06);
}
/* (Eingeklappt: Logo ausgeblendet → kein zusätzlicher Innenabstand nötig.) */
body.sidebar-collapsed .sidebar__brand {
  padding-top: 0;
}
/* v1.99.28: „Neues Design"-Umschalter (eigene id-Styles, deshalb höhere Spezifität nötig) ebenfalls mittig
   als quadratische Kachel — sonst bliebe der ✨ linksbündig. */
body.sidebar-collapsed #kmDesignToggle .km-designtoggle__btn {
  width: 44px;
  margin: 0 auto;
  padding: 10px 0;
  gap: 0;
  justify-content: center;
}
/* v1.99.28: „＋ Modul hinzufügen" eingeklappt = kleines QUADRAT mit quadratischer Umrandung, mittig
   (höhere Spezifität als der in main.js injizierte body.sidebar-collapsed .km-add-module-btn). */
body.sidebar-collapsed .sidebar .km-add-module-btn {
  display: flex; align-items: center;   /* block-level → margin:auto zentriert zuverlässig (unabhängig von main.js) */
  width: 44px; height: 44px;
  padding: 0;
  margin: 8px auto 6px;
  gap: 0;
  justify-content: center;
  border-radius: 8px;
}
body.sidebar-collapsed .sidebar .km-add-module-btn__icon { font-size: 1.15rem; }
@media (max-width: 768px) {
  .sidebar-toggle { display: none; }
}

/* ── KONTEXT-MENÜ (Rechtsklick auf Sidebar-Link) ── */
.km-ctx-menu {
  position: fixed;
  background: #1f2937;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  padding: 4px;
  z-index: 99999;
  min-width: 220px;
  font-size: .85rem;
  color: #e5e7eb;
  animation: km-ctx-in .12s ease-out;
}
@keyframes km-ctx-in {
  from { opacity: 0; transform: scale(.95); }
  to   { opacity: 1; transform: scale(1); }
}
.km-ctx-menu__item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.km-ctx-menu__item:hover { background: rgba(255,255,255,.08); }
.km-ctx-menu__item--danger { color: #fca5a5; }
.km-ctx-menu__item--danger:hover { background: rgba(220,38,38,.18); }
.km-ctx-menu__sep {
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: 4px 6px;
}
.km-ctx-menu__icon { width: 18px; text-align: center; font-size: .95rem; }

/* ── LOSGELÖSTE MODULE ── */
.sidebar__detached-section {
  padding: 8px 6px;
  border-top: 1px dashed rgba(255,255,255,.12);
  margin-top: 4px;
}
.sidebar__detached-head {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: rgba(200,214,229,.55);
  padding: 4px 10px 6px;
  display: flex; align-items: center; gap: 6px;
  cursor: pointer;
  user-select: none;
}
.sidebar__detached-head__toggle {
  font-size: .55rem;
  transition: transform .15s;
}
.sidebar__detached-list.collapsed { display: none; }
.sidebar__detached-section.is-collapsed .sidebar__detached-head__toggle {
  transform: rotate(-90deg);
}
.sidebar__detached-empty {
  font-size: .72rem;
  color: rgba(200,214,229,.4);
  font-style: italic;
  padding: 2px 12px;
}
/* ── LOSGELÖST-Bereich im eingeklappten Zustand ── */
body.sidebar-collapsed .sidebar__detached-section {
  padding: 6px 2px 4px;
  margin-top: 2px;
}
body.sidebar-collapsed .sidebar__detached-head {
  font-size: .56rem;
  letter-spacing: .2px;
  text-transform: none;    /* "Losgelöst" statt "LOSGELÖST" – schmaler */
  text-align: center;
  justify-content: center;
  padding: 2px 0 4px;
  gap: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.sidebar-collapsed .sidebar__detached-head > span:last-child {
  display: inline-block;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.sidebar-collapsed .sidebar__detached-head__toggle { display: none; }
/* Lange "Per Rechtsklick → Loslösen"-Hilfe wäre im 76px-Slot Lesemüll →
   durch kompaktes Mini-Icon "···" ersetzen, das beim Hover den Volltext zeigt. */
body.sidebar-collapsed .sidebar__detached-empty {
  font-size: 0;
  padding: 4px 0 2px;
  text-align: center;
  color: rgba(200,214,229,.35);
  position: relative;
  cursor: help;
}
body.sidebar-collapsed .sidebar__detached-empty::before {
  content: '⋯';
  font-size: 1rem;
  font-style: normal;
  line-height: 1;
  display: inline-block;
}
body.sidebar-collapsed .sidebar__detached-empty:hover::after {
  content: 'Per Rechtsklick → Loslösen';
  position: absolute;
  left: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  background: #1f2937;
  color: #fff;
  padding: 5px 9px;
  border-radius: 5px;
  font-size: .76rem;
  font-weight: 600;
  font-style: normal;
  white-space: nowrap;
  z-index: 200;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  pointer-events: none;
}
/* Losgelöste Links selbst: gleicher Look wie normale Sidebar-Links im
   collapsed-Mode (Icon + kleines Label darunter, nicht horizontal) */
body.sidebar-collapsed .sidebar__detached-list .sidebar__link {
  padding: 6px 4px;
  min-height: 50px;
}

/* ── INFO-MODAL für Modul-Infos ── */
.km-info-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 99998;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.km-info-box {
  background: #fff;
  color: #1f2937;
  border-radius: 12px;
  max-width: 520px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.km-info-box__head {
  background: linear-gradient(135deg, #1B4332, #2D6A4F);
  color: #fff;
  padding: 22px 24px;
  display: flex; align-items: center; gap: 14px;
  border-radius: 12px 12px 0 0;
}
.km-info-box__icon {
  font-size: 2.4rem;
  background: rgba(255,255,255,.15);
  border-radius: 12px;
  width: 60px; height: 60px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.km-info-box__title { margin: 0; font-size: 1.2rem; font-weight: 700; }
.km-info-box__sub   { margin: 4px 0 0; font-size: .82rem; opacity: .85; }
.km-info-box__body { padding: 22px 24px; }
.km-info-box__section { margin-bottom: 16px; }
.km-info-box__label {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: #64748b; margin-bottom: 6px;
}
.km-info-box__text { font-size: .92rem; line-height: 1.5; color: #1f2937; }
.km-info-box__perm-list { list-style: none; padding: 0; margin: 0; }
.km-info-box__perm-list li {
  padding: 6px 10px;
  background: #f3f4f6;
  border-radius: 5px;
  margin-bottom: 4px;
  font-size: .85rem;
}
.km-info-box__foot {
  padding: 14px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex; gap: 8px; justify-content: flex-end;
  background: #fafafa;
  border-radius: 0 0 12px 12px;
}

/* ═══════════════════════════════════════════════
   STANDARD-MODUL-KOPFZEILE
   Pattern für ALLE Module (Bestand & neu):
     <div class="page-header">
       <div>                                ← Titel + Beschreibung (links)
         <h2 class="page-header__title">…</h2>
         <p  class="page-header__sub">…</p>
       </div>
       <div class="flex gap-sm">            ← Action-Buttons (rechts)
         <button class="btn btn--outline btn--sm">Action 1</button>
         <button class="btn btn--outline btn--sm">Action 2</button>
         <button class="btn btn--green">+ Neu hinzufügen</button>   ← IMMER ZULETZT
       </div>
     </div>
   – Primary-Action (grün, „+ Neu…") steht im HTML immer am Ende
     → landet visuell ganz rechts.
   – Alle weiteren Aktions-Buttons (Export, Refresh, Import, …)
     stehen davor → links der Primary-Action.
   – Kopfzeile wird unten mit einer dezenten Linie vom Modul-Inhalt
     getrennt (border-bottom).
   ═══════════════════════════════════════════════ */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;   /* v1.99.211: Titel vertikal mittig im Band (statt oben klebend) */
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-md);
  flex-wrap: wrap;
  gap: var(--space-md);
  border-bottom: 1px solid var(--border);
  /* v1.99.202 (#4): Titelleiste bleibt beim Scrollen oben; deckender Hintergrund, damit Inhalt nicht durchscheint */
  position: sticky; top: 0; z-index: 20; background: var(--bg); padding-top: var(--space-md);
}
.page-header__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
}
.page-header__sub {
  color: var(--text-muted);
  font-size: .875rem;
  margin-top: 2px;
  display: none;   /* v1.99.211: Untertitel/Beschreibung aus den Modul-Titelleisten entfernt */
}
/* Action-Container (zweiter, also letzter Direkt-Child der Kopfzeile):
   alle Buttons in einer Reihe, rechtsbündig, mit konsistentem Abstand.
   Greift unabhängig davon, ob der Container die Klasse ".flex" hat
   oder nicht — damit künftige Module die Konvention automatisch erben. */
.page-header > div:last-child:not(:first-child) {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  justify-content: flex-end;
  flex: 0 1 auto;
  min-width: 0;
}
/* Im Dark-Mode soll die Trennlinie nicht zu kontrastreich sein */
[data-mode="dark"] .page-header { border-bottom-color: var(--border); }
/* v1.99.212: sichtbare Trennlinie UNTER der Titelleiste (passend zur Sidebar-Trennlinie rechts).
   var(--border) war zu blass (bei hellen Titelleisten-Farben unsichtbar). !important schlaegt die
   colored-state-Regel (Zeile ~158, border-bottom:var(--border) ohne !important) in allen 4 Kombis. */
.page-header,
.pjv2 .list__head { border-bottom: 1px solid rgba(15,23,42,.14) !important; }
[data-mode="dark"] .page-header,
[data-mode="dark"] .pjv2 .list__head { border-bottom-color: rgba(255,255,255,.12) !important; }

/* ═══════════════════════════════════════════════
   BUILDING CARDS GRID
   ═══════════════════════════════════════════════ */
.bld-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}
.bld-card {
  position: relative;
  cursor: pointer;
}
.bld-card__badge {
  position: absolute;
  top: 12px; right: 14px;
  font-size: .7rem;
  background: var(--bg);
  padding: 3px 10px;
  border-radius: 6px;
  color: var(--text-muted);
  font-weight: 600;
}
.bld-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: var(--space-md);
}
.bld-card__icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.bld-card__name {
  font-family: var(--font-body);
  font-size: .95rem;
  font-weight: 700;
  color: var(--navy);
}
.bld-card__addr {
  font-size: .78rem;
  color: var(--text-muted);
}

/* Progress bar (keys issued) */
.progress {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin-top: var(--space-sm);
}
.progress__bar {
  height: 100%;
  border-radius: 2px;
  transition: width .3s;
}

/* KPI stat cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}
.kpi-card {
  display: flex;
  flex-direction: column;
}
.kpi-card__label {
  font-size: .65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
}
.kpi-card__value {
  font-size: 1.75rem;
  font-weight: 800;
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════
   EMOJI PICKER
   ═══════════════════════════════════════════════ */
.emoji-picker {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}
.emoji-picker__btn {
  width: 40px; height: 40px;
  font-size: 1.25rem;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: var(--transition);
}
.emoji-picker__btn:hover {
  border-color: var(--border);
}
.emoji-picker__btn.active {
  border-color: var(--gold);
  background: var(--gold-light);
}

/* ═══════════════════════════════════════════════
   CHIPS (Schlüssel-Vorschläge)
   ═══════════════════════════════════════════════ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip.active { background: var(--blue-light); border-color: var(--blue); color: var(--blue); }

/* ═══════════════════════════════════════════════
   ACTION MENU (3-dot)
   ═══════════════════════════════════════════════ */
.action-menu {
  position: relative;
}
.action-menu__trigger {
  background: none;
  border: none;
  padding: 4px 8px;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 4px;
}
.action-menu__trigger:hover { background: var(--bg); }
.action-menu__dropdown {
  display: none;
  position: absolute;
  right: 0; top: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  min-width: 200px;
  z-index: 50;
  overflow: hidden;
}
.action-menu__dropdown.open {
  display: block;
}
.action-menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 14px;
  font-size: .84rem;
  color: var(--text);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background .1s;
}
.action-menu__item:hover { background: var(--bg); }
.action-menu__item--danger { color: var(--red); }

/* ═══════════════════════════════════════════════
   HERO SECTION (Landing)
   ═══════════════════════════════════════════════ */
.hero {
  background: var(--navy);
  color: #fff;
  padding: var(--space-2xl) 0;
  position: relative;
  overflow: hidden;
}
.hero__bg-pattern {
  position: absolute;
  inset: 0;
  opacity: .04;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0L60 30L30 60L0 30z' fill='%23fff' fill-opacity='.1'/%3E%3C/svg%3E");
  background-size: 40px 40px;
}
.hero__content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
  align-items: center;
  position: relative;
  z-index: 1;
}
.hero__headline {
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: var(--space-md);
}
.hero__sub {
  font-size: 1.1rem;
  color: rgba(255,255,255,.7);
  margin-bottom: var(--space-lg);
  line-height: 1.6;
}
.hero__buttons {
  display: flex;
  gap: var(--space-md);
}

/* ═══════════════════════════════════════════════
   PRICING SECTION
   ═══════════════════════════════════════════════ */
.pricing-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}
.pricing-toggle__label {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-muted);
}
.pricing-toggle__label.active { color: var(--navy); }
.pricing-toggle__switch {
  width: 48px; height: 26px;
  border-radius: 13px;
  background: var(--border);
  position: relative;
  cursor: pointer;
  border: none;
  transition: background .2s;
}
.pricing-toggle__switch.active { background: var(--green); }
.pricing-toggle__switch::after {
  content: '';
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px; left: 3px;
  transition: transform .2s;
}
.pricing-toggle__switch.active::after { transform: translateX(22px); }

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-md);
  align-items: flex-start;
}

/* ═══════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════ */
.login-page {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100vh;
}
.login-page__brand {
  background: var(--navy);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}
.login-page__brand-logo {
  width: 120px; height: 120px;
  border-radius: var(--radius-lg);
  object-fit: contain;
  background: rgba(255,255,255,.08);
  padding: 16px;
  margin-bottom: var(--space-lg);
}
.login-page__brand-name {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: #fff;
  font-weight: 700;
  text-align: center;
}
.login-page__brand-sub {
  color: rgba(255,255,255,.5);
  font-size: .9rem;
  margin-top: var(--space-sm);
}
.login-page__form-area {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}
.login-page__form {
  width: 100%;
  max-width: 380px;
}

/* ═══════════════════════════════════════════════
   TRUST BADGES
   ═══════════════════════════════════════════════ */
.trust-badges {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  padding: var(--space-xl) 0;
}
.trust-badge {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
}
.trust-badge__icon {
  font-size: 1.2rem;
}

/* ═══════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════ */
.footer {
  background: var(--navy);
  color: rgba(255,255,255,.6);
  padding: var(--space-xl) 0;
}
.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-xl);
}
.footer__brand {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: var(--space-sm);
}
.footer__heading {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,.4);
  margin-bottom: var(--space-md);
}
.footer__link {
  display: block;
  color: rgba(255,255,255,.6);
  font-size: .85rem;
  margin-bottom: var(--space-sm);
  text-decoration: none;
}
.footer__link:hover { color: #fff; }

/* ═══════════════════════════════════════════════
   INLINE FORM (Lagerplatz schnell anlegen)
   ═══════════════════════════════════════════════ */
.inline-form {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-end;
  padding: var(--space-md);
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-top: var(--space-sm);
}
.inline-form .form__group { margin-bottom: 0; flex: 1; }

/* ═══════════════════════════════════════════════
   FILTER CHIPS
   ═══════════════════════════════════════════════ */
.filter-chips {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  margin-bottom: var(--space-md);
}
.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.filter-chip:hover { border-color: var(--blue); }
.filter-chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ═══════════════════════════════════════════════
   INFO BOX
   ═══════════════════════════════════════════════ */
.info-box {
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  line-height: 1.5;
}
.info-box--blue  { background: var(--blue-light); color: var(--navy); }
.info-box--green { background: var(--green-light); color: var(--green); }
.info-box--red   { background: var(--red-light); color: var(--red); }
.info-box--gold  { background: var(--gold-light); color: var(--navy); }

/* ═══════════════════════════════════════════════
   SETTINGS SIDEBAR
   ═══════════════════════════════════════════════ */
.settings-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--space-lg);
}
.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-nav__link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  transition: var(--transition);
}
.settings-nav__link:hover { background: var(--card); }
.settings-nav__link.active { background: var(--card); color: var(--navy); box-shadow: var(--shadow-sm); }

/* ═══════════════════════════════════════════════
   PERMISSIONS TABLE
   ═══════════════════════════════════════════════ */
.perm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.perm-table th { padding: 8px 12px; font-size: .7rem; }
.perm-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: center;
}
.perm-table td:first-child { text-align: left; font-weight: 600; }
.perm-table input[type="radio"] {
  accent-color: var(--blue);
  width: 16px; height: 16px;
}

/* ═══════════════════════════════════════════════
   MOBILE TOPBAR (immer vorhanden, ab 768px sichtbar)
   ═══════════════════════════════════════════════ */
.topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--navy);
  color: #fff;
  align-items: center;
  padding: 0 var(--space-md);
  z-index: 200;
  gap: var(--space-md);
  border-bottom: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.topbar__hamburger {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.topbar__hamburger:hover { background: rgba(255,255,255,.1); }
.topbar__title {
  font-weight: 700;
  font-size: .95rem;
  flex: 1;
}

/* Backdrop for mobile sidebar */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 149;
  backdrop-filter: blur(2px);
}
.sidebar-backdrop.open { display: block; }

/* ═══════════════════════════════════════════════
   LANDING PAGE MOBILE NAV
   ═══════════════════════════════════════════════ */
.lp-nav__mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.lp-nav__mobile-toggle:hover { background: rgba(255,255,255,.1); }
.lp-nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.lp-nav__drawer {
  display: flex;          /* always rendered, never display:none */
  position: fixed;
  top: 0; right: 0;
  width: 280px;
  height: 100vh;
  background: var(--navy);
  z-index: 300;
  flex-direction: column;
  padding: var(--space-xl) var(--space-lg);
  gap: var(--space-sm);
  box-shadow: -4px 0 24px rgba(0,0,0,.3);
  overflow-y: auto;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform .3s cubic-bezier(.22,.68,0,1.2), visibility 0s linear .3s;
}
.lp-nav__drawer.open {
  transform: translateX(0);
  visibility: visible;
  transition: transform .3s cubic-bezier(.22,.68,0,1.2), visibility 0s linear 0s;
}
.lp-nav__drawer-close {
  background: none;
  border: none;
  color: rgba(255,255,255,.6);
  font-size: 1.4rem;
  cursor: pointer;
  align-self: flex-end;
  padding: 8px;
  margin-bottom: var(--space-md);
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.lp-nav__drawer-close:hover { background: rgba(255,255,255,.08); }
.lp-nav__drawer a {
  display: block;
  color: rgba(255,255,255,.75);
  font-weight: 600;
  font-size: 1rem;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: var(--transition);
}
.lp-nav__drawer a:hover { background: rgba(255,255,255,.08); color: #fff; }
.lp-nav__drawer .btn {
  margin-top: var(--space-md);
  width: 100%;
  justify-content: center;
}
.lp-nav__backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 299;
}
.lp-nav__backdrop.open { display: block; }

/* ═══════════════════════════════════════════════
   TABLET — 1024px
   ═══════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .pricing-grid   { grid-template-columns: repeat(3, 1fr); }
  .bld-grid       { grid-template-columns: repeat(2, 1fr); }
  .hero__content  { grid-template-columns: 1fr; text-align: center; }
  .hero__buttons  { justify-content: center; }
  .hero__visual   { display: none; }
  .trust-badges   { gap: var(--space-lg); flex-wrap: wrap; justify-content: center; }
}

/* ═══════════════════════════════════════════════
   MOBILE — 768px
   ═══════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── App Shell ── */
  .topbar { display: flex; }
  .app__main {
    margin-left: 0;
    padding: var(--space-md);
    padding-top: 72px;
    min-width: 0;
  }
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
    z-index: 150;
  }
  .sidebar.open { transform: translateX(0); }

  /* ── Page Header ── */
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    position: static;   /* v1.99.202: mobil nicht sticky (fixe Topbar oben würde sich sonst überlagern) */
  }
  .page-header > div:last-child,
  .page-header > .flex {
    flex-wrap: wrap;
  }
  /* Auf Mobile: Action-Buttons starten von links (natürliche Leserichtung
     bei voller Zeilenbreite). Die rechtsbündige Anordnung auf dem Desktop
     bleibt davon unberührt. */
  .page-header > div:last-child:not(:first-child) {
    justify-content: flex-start;
  }
  .page-header__title { font-size: 1.25rem; }

  /* ── Cards ── */
  .card { padding: var(--space-md); }

  /* ── Tables: horizontal scroll with touch indicator ── */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 calc(-1 * var(--space-md));
    padding: 0 var(--space-md);
    border-radius: 0;
  }
  .card .table-wrap {
    margin: 0 calc(-1 * var(--space-md));
    padding: 0;
  }
  .table { min-width: 540px; font-size: .82rem; }
  .table th, .table td { padding: 9px 10px; }

  /* ── Modals: Bottom Sheet Stil ── */
  .modal__overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal__box {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92vh;
    width: 100%;
    max-width: 100% !important;
    /* z242: Bottom-Sheet klebt am unteren Rand → unten Safe-Area einrechnen,
       damit Speichern-/Abschluss-Knöpfe nicht hinter dem iPhone-Home-Indicator
       liegen. env=0 (kein Notch) ⇒ unverändert var(--space-lg). */
    padding: var(--space-lg) var(--space-md) calc(var(--space-lg) + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
  }
  /* Handle-Linie oben am Modal */
  .modal__box::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    margin: 0 auto var(--space-md);
  }
  .modal__footer {
    flex-direction: column-reverse;
    gap: var(--space-sm);
  }
  .modal__footer .btn { width: 100%; justify-content: center; }

  /* ── Forms ── */
  .form__row { grid-template-columns: 1fr; gap: var(--space-sm); }
  .form__input, .form__select, .form__textarea {
    font-size: 16px; /* Prevents iOS zoom */
    min-height: 44px;
  }

  /* ── Buttons: Touch-freundlich ── */
  .btn { min-height: 44px; }
  .btn--sm { min-height: 36px; }

  /* ── Action Menu: immer nach links öffnen wenn am Rand ── */
  .action-menu__dropdown {
    right: 0;
    left: auto;
    min-width: 180px;
    z-index: 60;
  }
  /* Letzter Column: overflow verhindern */
  .table td:last-child { overflow: visible; position: relative; }

  /* ── Inline Form: Stapeln ── */
  .inline-form {
    flex-direction: column;
    gap: var(--space-sm);
  }
  .inline-form .form__group { min-width: 0; }
  .inline-form .btn { width: 100%; }

  /* ── Filter Chips: horizontal scroll ── */
  .filter-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .filter-chips::-webkit-scrollbar { display: none; }
  .filter-chip { flex-shrink: 0; }

  /* ── Settings Layout: Tabs oben ── */
  .settings-layout { grid-template-columns: 1fr; gap: var(--space-md); }
  .settings-nav {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-nav__link {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 8px 14px;
    font-size: .8rem;
  }

  /* ── Building Grid ── */
  .bld-grid { grid-template-columns: 1fr; }

  /* ── KPI Grid ── */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }

  /* ── Flex-Between Stack ── */
  .flex-between {
    flex-wrap: wrap;
    gap: var(--space-sm);
  }

  /* ── Login ── */
  .login-page { grid-template-columns: 1fr; }
  .login-page__brand { display: none; }
  .login-page__form-area { padding: var(--space-lg) var(--space-md); }

  /* ── Landing Page ── */
  .lp-nav__links { display: none !important; }
  .lp-nav__mobile-toggle { display: flex !important; }
  .lp-nav .container { position: relative; }
  .hero { padding: 60px 0 40px; }
  .hero__headline { font-size: 1.9rem; }
  .hero__sub { font-size: .95rem; }
  .hero__buttons { flex-direction: column; gap: var(--space-sm); align-items: stretch; }
  .hero__buttons .btn { width: 100%; justify-content: center; }
  .pricing-grid { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto; }
  .card--featured { transform: none; }
  .footer__grid { grid-template-columns: 1fr; gap: var(--space-lg); }
  .trust-badges { flex-direction: column; align-items: center; gap: var(--space-md); padding: var(--space-lg) 0; }

  /* ── Changelog Tabelle: scroll ── */
  .cl-table { font-size: .78rem; }
  .cl-table th:nth-child(1),
  .cl-table td:nth-child(1) { display: none; } /* "Bereich" ausblenden */

  /* ── Landingpage: Animations-Freeze-Schutz ── */
  /* Elemente mit animation-fill-mode:both + delay können auf Mobile einfrieren */
  .anim-1, .anim-2, .anim-3, .anim-4,
  .reveal {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  /* ── Schriften ── */
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.35rem; }
  .container { padding: 0 var(--space-md); }

  /* ── Dash-Grid ── */
  .dash-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-sm); }
  .dash-card { padding: 14px 14px 12px; }
  .dash-card__value { font-size: 1.6rem; }
  .heute-grid { grid-template-columns: 1fr; gap: var(--space-sm); }
  .dash-two-col { grid-template-columns: 1fr; gap: var(--space-md); }
}

/* ═══════════════════════════════════════════════
   SMALL MOBILE — 480px
   ═══════════════════════════════════════════════ */
@media (max-width: 480px) {
  .code-input__field { width: 40px; height: 48px; font-size: 1.2rem; }
  .container { padding: 0 var(--space-sm); }
  .app__main { padding: var(--space-sm); padding-top: 68px; }
  .card { padding: var(--space-sm) var(--space-md); }
  .page-header__title { font-size: 1.15rem; }
  .dash-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-xs); }
  .dash-card { padding: 12px 10px; }
  .dash-card__value { font-size: 1.4rem; }
  .dash-card__icon { font-size: 1.2rem; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  /* Buttons wrappen statt überlaufen */
  .flex.gap-sm, .flex.gap-md { flex-wrap: wrap; }
  .hero__headline { font-size: 1.65rem; }
  .pricing-grid { max-width: 100%; }
}

/* ═══════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════ */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: .85rem; }
.text-xs { font-size: .75rem; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.hidden { display: none; }
.fw-700 { font-weight: 700; }

/* ═══════════════════════════════════════════════
   FAB — Floating Action Button (Mobile First)
   Pattern: <button class="km-fab" onclick="...">+</button>
   - Default: nur ab <=768px sichtbar (auf Desktop verstecken wir, weil dort
     der Header-Button reicht). Mit .km-fab--always immer sichtbar machen.
   ═══════════════════════════════════════════════ */
.km-fab {
  position: fixed;
  /* Auf Mobile sitzt die kmbot-Chat-Bubble auch unten rechts.
     Wir setzen den FAB drüber (~78px hoch), damit er nicht verdeckt wird. */
  right: calc(20px + env(safe-area-inset-right));
  bottom: calc(86px + env(safe-area-inset-bottom));
  z-index: 200;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  border: none;
  font-size: 1.7rem; line-height: 1;
  cursor: pointer;
  display: none;        /* default: auf Desktop verbergen */
  align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(0,0,0,.28);
  transition: transform .12s, box-shadow .15s;
}
.km-fab:hover  { transform: scale(1.06); box-shadow: 0 8px 22px rgba(0,0,0,.32); }
.km-fab:active { transform: scale(.96); }
.km-fab--secondary { background: var(--navy); }
.km-fab--danger    { background: #C62828; }

/* FAB mit Label-Pille (nur auf >768px, falls --always) */
.km-fab__label {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,.78); color: #fff;
  padding: 6px 12px; border-radius: 6px;
  font-size: .82rem; font-weight: 600; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .15s;
}
.km-fab:hover .km-fab__label { opacity: 1; }

@media (max-width: 768px) {
  .km-fab { display: inline-flex; }
}
.km-fab--always { display: inline-flex; }

/* ═══════════════════════════════════════════════
   STICKY SAVE FOOTER
   Pattern: <div class="km-sticky-footer"><button>Speichern</button></div>
   - In langen Modals oder Settings-Sektionen am unteren Rand sticky
   - Auf Mobile am Viewport-Bottom mit Safe-Area-Padding
   ═══════════════════════════════════════════════ */
.km-sticky-footer {
  position: sticky;
  bottom: 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  z-index: 10;
  margin-top: var(--space-md);
}
.km-sticky-footer--left  { justify-content: flex-start; }
.km-sticky-footer--space { justify-content: space-between; }
@media (max-width: 768px) {
  .km-sticky-footer { padding-left: 12px; padding-right: 12px; }
  .km-sticky-footer .btn { flex: 1; min-height: 44px; }
  .km-sticky-footer .btn--outline { flex: 0 0 auto; }
}

/* ═══════════════════════════════════════════════
   MOBILE CARD LIST — Tabellen-Ersatz auf <=768px
   Pattern: <div class="km-mlist"><div class="km-mcard">…</div></div>
   ═══════════════════════════════════════════════ */
.km-mlist { display: flex; flex-direction: column; gap: 10px; }
.km-mcard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
  cursor: pointer;
  transition: border-color .12s, transform .1s, box-shadow .15s;
}
.km-mcard:hover { border-color: var(--green); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.km-mcard__title { font-weight: 700; font-size: .95rem; display: flex; align-items: center; gap: 8px; }
.km-mcard__sub   { font-size: .8rem; color: var(--text-muted); }
.km-mcard__row   { display: flex; align-items: center; gap: 8px; font-size: .82rem; }
.km-mcard__row .lbl { color: var(--text-muted); min-width: 90px; }
.km-mcard__actions {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 4px; padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.km-mcard__actions .btn { flex: 1; min-height: 38px; font-size: .82rem; padding: 6px 10px; }

/* ═══════════════════════════════════════════════
   BOTTOM SHEET — Action-Sheet von unten (Mobile)
   Pattern: <div class="km-sheet" id="..."><div class="km-sheet__panel">…</div></div>
   ═══════════════════════════════════════════════ */
.km-sheet {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: none;
  z-index: 9500;
  align-items: flex-end;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.km-sheet.is-open { display: flex; }
.km-sheet__panel {
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  padding: 8px 0 calc(12px + env(safe-area-inset-bottom));
  max-height: 80vh;
  overflow-y: auto;
  animation: km-sheet-up .22s ease;
}
@keyframes km-sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.km-sheet__handle {
  width: 38px; height: 4px;
  background: rgba(0,0,0,.18);
  border-radius: 2px;
  margin: 6px auto 14px;
}
.km-sheet__title {
  font-weight: 700; font-size: 1rem;
  padding: 4px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.km-sheet__item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  font-size: .95rem; font-weight: 500;
  cursor: pointer;
  border: none; background: transparent;
  width: 100%; text-align: left; color: var(--text);
  min-height: 48px;
}
.km-sheet__item:hover, .km-sheet__item:active { background: rgba(0,0,0,.04); }
.km-sheet__item--danger { color: #C62828; }
.km-sheet__item__icon { font-size: 1.2rem; width: 28px; text-align: center; flex-shrink: 0; }
.km-sheet__cancel {
  margin: 10px 14px 0;
  padding: 14px;
  background: rgba(0,0,0,.04);
  border: none; border-radius: 12px;
  font-weight: 600; font-size: .95rem;
  cursor: pointer;
  color: var(--text);
}
.km-sheet__cancel:hover { background: rgba(0,0,0,.08); }
.mono { font-family: 'Courier New', monospace; }

/* ═══════════════════════════════════════════════
   ── Mobile-Optimierung (Runde 39) ──
   Nur mobile Feinschliff; Desktop bleibt unberührt.
   ═══════════════════════════════════════════════ */
@media (max-width: 480px) {
  /* Toasts respektieren die Safe-Area auf Notch-iPhones,
     damit sie nicht unter der Hardware-Insel / Home-Indicator verschwinden. */
  .toast-container {
    right: calc(var(--space-md) + env(safe-area-inset-right));
    bottom: calc(var(--space-md) + env(safe-area-inset-bottom));
  }
}

@media (max-width: 390px) {
  /* FAB auf sehr kleinen Phones kompakter und sicherer positionieren.
     Der 86px-Offset (kmbot-Bubble) ist hier oft zu hoch bzw. kollidiert
     mit Floating-Elementen – wir setzen den FAB knapp über die Safe-Area. */
  .km-fab {
    width: 48px; height: 48px;
    font-size: 1.4rem;
    bottom: calc(20px + env(safe-area-inset-bottom));
  }
  /* Kleine Buttons auf Mini-Screens etwas größer für besseren Touch-Komfort. */
  .btn--sm { min-height: 40px; }
}

/* ═══════════════════════════════════════════════
   z118: MOBILE APP-NAVIGATION
   Bottom-Bar (Outlook/monday-Stil) + Vollbild-Modulübersicht
   + runder Zurück-Pfeil (iPhone-Stil).
   Ausschließlich @media ≤768px — Desktop bleibt unberührt.
   ═══════════════════════════════════════════════ */
.km-bottombar { display: none; }

@media (max-width: 768px) {

  /* ── Runder Zurück-Pfeil (iPhone-Stil) statt Hamburger ──
     Das ☰ aus dem HTML wird per font-size:0 versteckt und durch
     ein großes ‹ im Kreis ersetzt; bei offener Modulübersicht ✕. */
  .topbar__hamburger {
    width: 44px; height: 44px; min-width: 44px; min-height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.16);
    font-size: 0;
  }
  .topbar__hamburger::before {
    content: "‹";
    font-size: 1.9rem; font-weight: 700; line-height: 1;
    margin-top: -4px;
  }
  body.km-sidebar-open .topbar__hamburger::before {
    content: "✕";
    font-size: 1.15rem; margin-top: 0;
  }

  /* ── Sidebar als Vollbild-Modulübersicht mit großen Kacheln ── */
  .sidebar.open { width: 100vw; max-width: 100vw; padding-top: 56px; }
  .sidebar.open .sidebar__brand { display: none; }  /* Topbar (Pfeil/✕ + Titel) bleibt oben sichtbar */
  .sidebar.open .sidebar__nav {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
    align-content: start;
    padding: 16px 16px 96px;
  }
  .sidebar.open .sidebar__nav .sidebar__link {
    flex-direction: column; justify-content: center; text-align: center;
    gap: 10px; margin: 0; padding: 18px 8px; min-height: 96px;
    border: 1px solid rgba(255,255,255,.14); border-radius: 16px;
    background: rgba(255,255,255,.05);
    font-size: .92rem; color: #DCE6F5;
  }
  .sidebar.open .sidebar__nav .sidebar__link.active {
    background: var(--navy-mid);
    border-color: rgba(255,255,255,.30);
    color: #fff;
  }
  .sidebar.open .sidebar__nav .sidebar__link-icon { font-size: 2rem; width: auto; }
  .sidebar.open .sidebar__settings .sidebar__link {
    border: 1px solid rgba(255,255,255,.14); border-radius: 14px;
    justify-content: center; padding: 14px; margin: 10px 16px 0;
  }
  .sidebar.open .sidebar__footer { margin-bottom: 72px; }

  /* ── Bottom-Bar mit den wichtigsten Modulen ── */
  .km-bottombar {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 300;
    background: var(--card, #fff);
    border-top: 1px solid var(--border);
    /* z120: deutlich mehr Boden-Abstand — auf iPhones mit Home-Indicator
       (iPhone X…16) liegt die Gestenzone unten, sonst ist die Bar kaum tippbar */
    padding: 8px 6px calc(18px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
    box-shadow: 0 -4px 18px rgba(0,0,0,.09);
  }
  .km-bottombar__item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    flex: 1 1 0; min-width: 0; padding: 4px 2px;
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); text-decoration: none;
    font-family: inherit; font-size: .62rem; font-weight: 700; line-height: 1.15;
    border-radius: 10px;
  }
  .km-bottombar__item .km-bb-ico { font-size: 1.35rem; line-height: 1; }
  .km-bottombar__item .km-bb-lbl {
    max-width: 100%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .km-bottombar__item.active { color: var(--accent); }
  .km-bottombar__item:hover { text-decoration: none; color: var(--text); }
  [data-mode="dark"] .km-bottombar { background: #0F1826; }

  /* Inhalte über der Bottom-Bar freihalten (App-Seiten + Faktura-Workspace-iFrame).
     z239: + env(safe-area-inset-bottom), damit die letzte Zeile nicht hinter der (nun
     um die Safe-Area höheren) Bar verschwindet. Ohne Notch = env()=0 → 106px wie bisher. */
  body.km-has-bottombar .app__main { padding-bottom: calc(106px + env(safe-area-inset-bottom, 0px)); }
  body.km-has-bottombar .ws-content { bottom: 76px !important; }

  /* Schwebende Elemente (Bot-FAB, Update-Banner, PWA-Hinweis) über die Bottom-Bar heben */
  body.km-has-bottombar .kmbot-fab { bottom: calc(102px + env(safe-area-inset-bottom, 0px)) !important; }
  body.km-has-bottombar #kmUpdateBanner { bottom: calc(102px + env(safe-area-inset-bottom, 0px)) !important; }
  body.km-has-bottombar #kmPwaBanner { bottom: calc(102px + env(safe-area-inset-bottom, 0px)) !important; }

  /* z120: Schließen-✕ von Dialogen/Dokumenten in gleicher Größe wie der
     Zurück-Pfeil (44px-Kreis) — auf Touch sonst kaum treffbar */
  .modal__close {
    width: 44px; height: 44px; min-width: 44px; min-height: 44px;
    border-radius: 50%;
    background: rgba(0,0,0,.06);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.15rem; line-height: 1;
  }
  [data-mode="dark"] .modal__close { background: rgba(255,255,255,.10); }
  .ws-tab .ws-tab__close { min-width: 40px; min-height: 40px; font-size: 1.05rem; }

  /* z120: „Losgelöst"-Sektion in der Vollbild-Modulübersicht UNTERHALB der
     Modul-Kacheln über die volle Breite (sonst quetscht das 2-Spalten-Grid
     die ganze Sektion in EINE Zelle) */
  .sidebar.open .sidebar__nav .sidebar__detached-section { grid-column: 1 / -1; margin-top: 6px; }
  .sidebar.open .sidebar__detached-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
  .sidebar.open .sidebar__detached-list.collapsed { display: none; }
}
