/* ==========================================================================
   Admin – Redesign-Layer 2026
   Lädt NACH admin.css, übersteuert dort wo nötig. Bringt:
     - moderneres Token-System (light + dark)
     - überarbeitete Sidebar
     - neue Top-Bar mit Breadcrumbs / User-Menü / Modus-Badge
     - ruhigere Panels, Buttons, Forms
     - „Simple"- vs. „Experienced"-Modus (.adv-only)
     - Dichte-Modi (compact / comfortable)
     - Light/Dark/Auto via [class=admin-scheme-*]
   ========================================================================== */

/* ---------- Tokens / Variablen --------------------------------------------- */
:root,
.admin-scheme-light {
  --bg:           #f6f7fb;
  --surface:      #ffffff;
  --surface-2:    #fafbfc;
  --surface-3:    #f1f4f8;
  --border:       #e4e8ee;
  --border-strong:#d4d8e0;
  --text:         #0f172a;
  --text-muted:   #5a6478;
  --text-faint:   #8a93a4;
  --primary:      #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light:#dbeafe;
  --primary-soft: #eff6ff;
  --accent:       #f59e0b;
  --success:      #16a34a;
  --success-soft: #ecfdf5;
  --danger:       #dc2626;
  --danger-soft:  #fef2f2;
  --warn:         #d97706;
  --warn-soft:    #fef3c7;
  --shadow-xs:    0 1px 2px rgba(15, 23, 42, .04);
  --shadow-sm:    0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md:    0 4px 14px rgba(15, 23, 42, .08), 0 2px 6px rgba(15, 23, 42, .04);
  --shadow-lg:    0 12px 32px rgba(15, 23, 42, .12);
  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    14px;
  --sidebar-bg:   #0f172a;
  --sidebar-fg:   #c7cdd9;
  --sidebar-active-bg: #1e293b;
  --sidebar-active-fg: #ffffff;
  --sidebar-rail: #2563eb;
  --topbar-bg:    rgba(255,255,255,.85);
  --topbar-border:#e4e8ee;
}

/* Dark-Mode: warmes, neutrales Dunkelgrau (kein navyblau).
   Überschreibt parallel die alten --admin-* Variablen aus admin.css —
   sonst blieben KPI-Karten, Tabellen-Header etc. weiß. */
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto {
    --bg:           #16181d;
    --surface:      #1e2127;
    --surface-2:    #252830;
    --surface-3:    #2c3038;
    --border:       #2e323a;
    --border-strong:#3a3f49;
    --text:         #e6e8eb;
    --text-muted:   #a0a4ad;
    --text-faint:   #6e7480;
    --primary:      #5b8def;
    --primary-dark: #4571d8;
    --primary-light:#26344e;
    --primary-soft: #1c2230;
    --success-soft: #133527;
    --danger-soft:  #341a1a;
    --warn-soft:    #332615;
    --shadow-xs:    0 1px 2px rgba(0,0,0,.4);
    --shadow-sm:    0 1px 3px rgba(0,0,0,.5);
    --shadow-md:    0 4px 14px rgba(0,0,0,.5);
    --shadow-lg:    0 12px 32px rgba(0,0,0,.6);
    --sidebar-bg:   #101216;
    --sidebar-fg:   #b6bac3;
    --sidebar-active-bg: #252830;
    --topbar-bg:    rgba(30,33,39,.92);
    --topbar-border:#2e323a;

    /* Legacy-Variablen aus admin.css gleich mit überschreiben,
       damit z. B. .stat-card (background: var(--admin-surface)) auch im
       Dark-Mode den Dunkel-Look bekommt. */
    --admin-bg:            #16181d;
    --admin-surface:       #1e2127;
    --admin-border:        #2e323a;
    --admin-text:          #e6e8eb;
    --admin-text-muted:    #a0a4ad;
    --admin-primary:       #5b8def;
    --admin-primary-dark:  #4571d8;
    --admin-primary-light: #26344e;
  }
}

.admin-scheme-dark {
  --bg:           #16181d;
  --surface:      #1e2127;
  --surface-2:    #252830;
  --surface-3:    #2c3038;
  --border:       #2e323a;
  --border-strong:#3a3f49;
  --text:         #e6e8eb;
  --text-muted:   #a0a4ad;
  --text-faint:   #6e7480;
  --primary:      #5b8def;
  --primary-dark: #4571d8;
  --primary-light:#26344e;
  --primary-soft: #1c2230;
  --success-soft: #133527;
  --danger-soft:  #341a1a;
  --warn-soft:    #332615;
  --shadow-xs:    0 1px 2px rgba(0,0,0,.4);
  --shadow-sm:    0 1px 3px rgba(0,0,0,.5);
  --shadow-md:    0 4px 14px rgba(0,0,0,.5);
  --shadow-lg:    0 12px 32px rgba(0,0,0,.6);
  --sidebar-bg:   #101216;
  --sidebar-fg:   #b6bac3;
  --sidebar-active-bg: #252830;
  --topbar-bg:    rgba(30,33,39,.92);
  --topbar-border:#2e323a;

  --admin-bg:            #16181d;
  --admin-surface:       #1e2127;
  --admin-border:        #2e323a;
  --admin-text:          #e6e8eb;
  --admin-text-muted:    #a0a4ad;
  --admin-primary:       #5b8def;
  --admin-primary-dark:  #4571d8;
  --admin-primary-light: #26344e;
}

/* ---------- Dark-Mode-spezifische Detail-Anpassungen ---------------------- */
/* Sidebar deutlicher abgrenzen — schmaler Rand zwischen Sidebar und Hintergrund. */
.admin-scheme-dark .admin-sidebar,
.admin-scheme-auto .admin-sidebar {
  border-right: 1px solid #2a2d34;
}
@media (prefers-color-scheme: light) { .admin-scheme-auto .admin-sidebar { border-right: 0; } }

/* Stat-Card: weiche Border + leichter Hover-Lift im Dunkel-Modus. */
.admin-scheme-dark .stat-card,
.admin-scheme-auto .stat-card {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.admin-scheme-dark .stat-card .stat-value,
.admin-scheme-auto .stat-card .stat-value {
  color: var(--primary);
}
.admin-scheme-dark .stat-card .stat-label,
.admin-scheme-auto .stat-card .stat-label {
  color: var(--text-muted);
}
@media (prefers-color-scheme: light) {
  .admin-scheme-auto .stat-card { background: #fff; }
}

/* Forms im Dark-Mode lesbarer machen. */
.admin-scheme-dark input[type="text"],
.admin-scheme-dark input[type="email"],
.admin-scheme-dark input[type="password"],
.admin-scheme-dark input[type="url"],
.admin-scheme-dark input[type="number"],
.admin-scheme-dark input[type="search"],
.admin-scheme-dark textarea,
.admin-scheme-dark select,
.admin-scheme-auto input[type="text"],
.admin-scheme-auto input[type="email"],
.admin-scheme-auto input[type="password"],
.admin-scheme-auto input[type="url"],
.admin-scheme-auto input[type="number"],
.admin-scheme-auto input[type="search"],
.admin-scheme-auto textarea,
.admin-scheme-auto select {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}
@media (prefers-color-scheme: light) {
  .admin-scheme-auto input[type="text"],
  .admin-scheme-auto input[type="email"],
  .admin-scheme-auto input[type="password"],
  .admin-scheme-auto input[type="url"],
  .admin-scheme-auto input[type="number"],
  .admin-scheme-auto input[type="search"],
  .admin-scheme-auto textarea,
  .admin-scheme-auto select {
    background: #fff;
    color: #1a1f2a;
    border-color: #e4e8ec;
  }
}

/* Tabellen-Header */
.admin-scheme-dark .data-table th,
.admin-scheme-auto .data-table th {
  background: var(--surface-2);
  color: var(--text);
  border-bottom-color: var(--border-strong);
}
.admin-scheme-dark .data-table td,
.admin-scheme-auto .data-table td {
  border-bottom-color: var(--border);
}
.admin-scheme-dark .data-table tr:hover td,
.admin-scheme-auto .data-table tr:hover td {
  background: var(--surface-2);
}
@media (prefers-color-scheme: light) {
  .admin-scheme-auto .data-table th { background: #f4f6f8; color: #1a1f2a; }
  .admin-scheme-auto .data-table tr:hover td { background: #f9fbfd; }
}

/* Tag-Muted: das hardcodierte #eef2f7 in admin.css wird hier neutralisiert. */
.admin-scheme-dark .tag-muted,
.admin-scheme-auto .tag-muted {
  background: var(--surface-3);
  color: var(--text-muted);
}
@media (prefers-color-scheme: light) {
  .admin-scheme-auto .tag-muted { background: #eef2f7; color: #6b7380; }
}

/* Dashboard-Sections + Cards */
.admin-scheme-dark .dashboard-section,
.admin-scheme-auto .dashboard-section,
.admin-scheme-dark .card,
.admin-scheme-auto .card {
  background: var(--surface);
  border-color: var(--border);
}
@media (prefers-color-scheme: light) {
  .admin-scheme-auto .dashboard-section,
  .admin-scheme-auto .card { background: #fff; }
}

/* Code-Blöcke und Inputs in Modals */
.admin-scheme-dark code,
.admin-scheme-auto code,
.admin-scheme-dark pre,
.admin-scheme-auto pre {
  background: var(--surface-2);
  color: var(--text);
}
@media (prefers-color-scheme: light) {
  .admin-scheme-auto code,
  .admin-scheme-auto pre { background: #f4f6f8; color: #1a1f2a; }
}

/* ---------- Globale Polituren --------------------------------------------- */
body {
  background: var(--bg);
  color: var(--text);
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.admin-main h1 { color: var(--text); }
.muted { color: var(--text-muted); }
hr { border: 0; border-top: 1px solid var(--border); }
::selection { background: var(--primary-light); color: var(--text); }

/* ---------- Layout-Grid mit Top-Bar --------------------------------------- */
.admin-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
  background: var(--bg);
  transition: grid-template-columns .25s ease;
}
body.sidebar-collapsed .admin-layout { grid-template-columns: 68px 1fr; }
@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: fixed !important;
    inset: 0 auto 0 0;
    width: 250px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-lg);
  }
  body.sidebar-open .admin-sidebar { transform: translateX(0); }
}

.admin-shell {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ---------- Sidebar -------------------------------------------------------- */
.admin-sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  border-right: 1px solid rgba(255,255,255,.04);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.2rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  gap: .5rem;
}
.brand-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  text-decoration: none;
  color: #fff;
  min-width: 0;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary) 0%, #6366f1 100%);
  color: #fff;
  font-weight: 800;
  font-size: .85rem;
  letter-spacing: .02em;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(37,99,235,.35);
  flex-shrink: 0;
  overflow: hidden;
}
.brand-mark-img {
  background: #fff;
  padding: 2px;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.brand-mark-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.brand-name {
  font-weight: 700;
  letter-spacing: .01em;
  font-size: .98rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-toggle {
  background: transparent;
  border: 0;
  color: var(--sidebar-fg);
  font-size: 1.05rem;
  cursor: pointer;
  width: 28px; height: 28px;
  border-radius: 6px;
  transition: background .15s, color .15s, transform .25s;
}
.sidebar-toggle:hover { background: rgba(255,255,255,.08); color: #fff; }
body.sidebar-collapsed .sidebar-toggle { transform: rotate(180deg); }
body.sidebar-collapsed .brand-name,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .sidebar-divider,
body.sidebar-collapsed .sidebar-langswitch { display: none; }
body.sidebar-collapsed .sidebar-nav a {
  justify-content: center;
  padding: .65rem .5rem;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: .8rem .55rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 999px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .85rem;
  color: var(--sidebar-fg);
  text-decoration: none;
  font-size: .92rem;
  border-radius: 8px;
  border-left: none;
  position: relative;
  transition: background .12s, color .12s;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}
.sidebar-nav a.is-active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-fg);
  font-weight: 600;
}
.sidebar-nav a.is-active::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 8px; bottom: 8px;
  width: 3px;
  background: var(--sidebar-rail);
  border-radius: 0 3px 3px 0;
}
.sidebar-nav .nav-icon {
  width: 22px; height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
  opacity: .92;
}

/* Tooltip wenn collapsed */
body.sidebar-collapsed .sidebar-nav a[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--text);
  color: var(--surface);
  padding: .25rem .55rem;
  border-radius: 4px;
  font-size: .78rem;
  white-space: nowrap;
  z-index: 50;
  pointer-events: none;
  box-shadow: var(--shadow-md);
}

.sidebar-divider {
  margin: 1rem .85rem .35rem;
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
  padding-top: .8rem;
  border-top: 1px solid rgba(255,255,255,.06);
}

/* Module-Sektion: kollabierbares Akkordeon ============================ */
.sidebar-modules {
  margin-top: .2rem;
}
.sidebar-modules > summary.sidebar-divider--toggle {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .8rem .55rem .35rem;
  padding: .55rem .55rem .5rem;
  border-top: 1px solid rgba(255,255,255,.06);
  border-radius: 4px;
  user-select: none;
  font-size: .7rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
  transition: color .15s, background .15s;
}
.sidebar-modules > summary.sidebar-divider--toggle::-webkit-details-marker { display: none; }
.sidebar-modules > summary.sidebar-divider--toggle:hover {
  color: var(--text);
  background: rgba(255,255,255,.04);
}
.sidebar-divider__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-divider__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 .4rem;
  border-radius: 9px;
  background: rgba(255,255,255,.08);
  color: var(--text-faint);
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: 0;
}
.sidebar-divider__chevron {
  font-size: .7rem;
  color: var(--text-faint);
  transition: transform .2s;
  width: 12px;
  text-align: center;
}
.sidebar-modules[open] > summary .sidebar-divider__chevron {
  transform: rotate(180deg);
  color: var(--text);
}
.sidebar-modules[open] > summary .sidebar-divider__count {
  background: rgba(255,154,60,.35);
  color: var(--text);
}
.sidebar-modules__list {
  display: flex;
  flex-direction: column;
}

/* Bei eingeklappter Sidebar (icon-only): Toggle-Header verstecken,
   Modul-Liste sichtbar lassen damit Icons erreichbar sind */
body.sidebar-collapsed .sidebar-modules > summary.sidebar-divider--toggle { display: none; }
body.sidebar-collapsed .sidebar-modules .sidebar-modules__list { display: flex !important; }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.06);
  padding: .6rem .55rem .8rem;
}
.sidebar-langswitch {
  display: flex;
  gap: .35rem;
  padding: 0 .3rem;
  border: 0 !important;
}
.sidebar-langswitch .lang-link {
  flex: 1;
  text-align: center;
  padding: .35rem 0;
  border-radius: 6px;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .05em;
  opacity: .55;
  background: rgba(255,255,255,.05);
  color: #fff;
  text-decoration: none;
}
.sidebar-langswitch .lang-link:hover  { opacity: .9; }
.sidebar-langswitch .lang-link.is-active { opacity: 1; background: rgba(255,255,255,.18); }

/* ---------- Top-Bar ------------------------------------------------------- */
.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .65rem 1.5rem;
  background: var(--topbar-bg);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--topbar-border);
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 56px;
}
.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: .8rem;
  min-width: 0;
}
.topbar-burger {
  display: none;
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  width: 36px; height: 36px;
  border-radius: 8px;
}
.topbar-burger:hover { background: var(--surface-3); }
@media (max-width: 900px) {
  .topbar-burger { display: inline-flex; align-items: center; justify-content: center; }
}
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem;
  font-size: .9rem;
  min-width: 0;
}
.breadcrumb .crumb {
  color: var(--text-muted);
  text-decoration: none;
  padding: .15rem .35rem;
  border-radius: 4px;
  transition: background .12s, color .12s;
}
.breadcrumb a.crumb:hover {
  background: var(--surface-3);
  color: var(--text);
}
.breadcrumb .crumb.is-current {
  color: var(--text);
  font-weight: 600;
}
.breadcrumb .crumb-sep {
  color: var(--text-faint);
  font-size: .85rem;
}

.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: .35rem .65rem;
  border-radius: 6px;
  font-size: .85rem;
  transition: background .12s, color .12s;
}
.topbar-link:hover { background: var(--surface-3); color: var(--text); }
@media (max-width: 700px) {
  .topbar-link-label { display: none; }
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .78rem;
  font-weight: 600;
  padding: .35rem .7rem;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  transition: background .12s, border-color .12s;
}
.mode-pill:hover { background: var(--surface-3); border-color: var(--border-strong); }
.mode-pill-simple      { background: var(--success-soft); color: var(--success); border-color: rgba(22,163,74,.3); }
.mode-pill-experienced { background: var(--primary-soft); color: var(--primary); border-color: rgba(37,99,235,.3); }

/* User-Menü */
.topbar-user {
  position: relative;
}
.topbar-user > summary {
  display: flex;
  align-items: center;
  gap: .5rem;
  list-style: none;
  cursor: pointer;
  padding: .3rem .55rem .3rem .35rem;
  border-radius: 8px;
  transition: background .12s;
}
.topbar-user > summary::-webkit-details-marker { display: none; }
.topbar-user > summary::marker { content: none; }
.topbar-user > summary:hover { background: var(--surface-3); }
.topbar-user .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  color: #fff;
  font-weight: 700;
  font-size: .82rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.topbar-user .user-name {
  font-size: .85rem;
  font-weight: 500;
  color: var(--text);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-user .caret { color: var(--text-faint); font-size: .7rem; }
@media (max-width: 700px) {
  .topbar-user .user-name, .topbar-user .caret { display: none; }
}
.topbar-user .user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 240px;
  padding: .35rem;
  z-index: 100;
  animation: tb-pop .15s ease-out;
}
@keyframes tb-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.topbar-user .user-menu a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .75rem;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  font-size: .87rem;
}
.topbar-user .user-menu a:hover { background: var(--surface-3); }
.topbar-user .user-menu .mi-icon { width: 22px; text-align: center; }
.topbar-user .user-menu hr { margin: .35rem 0; border-color: var(--border); }
.topbar-user .user-menu .logout { color: var(--danger); }
.topbar-user .user-menu .logout:hover { background: var(--danger-soft); }

/* ---------- Main-Content -------------------------------------------------- */
.admin-main {
  padding: 2rem 2.4rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}
@media (max-width: 700px) {
  .admin-main { padding: 1.2rem 1rem; }
}

/* ---------- Dichte-Modus: kompakt vs komfortabel ------------------------- */
/* Komfortabel ist die Default-Darstellung (siehe oben) – kompakt schrumpft alles spürbar. */
body.admin-density-compact {
  font-size: 13.5px;
  line-height: 1.42;
}
.admin-density-compact .admin-main { padding: 1rem 1.4rem; }
.admin-density-compact .admin-topbar { min-height: 46px; padding: .35rem 1.2rem; }
.admin-density-compact .topbar-user .avatar { width: 24px; height: 24px; font-size: .72rem; }
.admin-density-compact .breadcrumb { font-size: .82rem; }
.admin-density-compact .page-header { margin-bottom: .8rem; }
.admin-density-compact .page-header h1 { font-size: 1.25rem; }
.admin-density-compact .page-header .muted { font-size: .82rem; }
.admin-density-compact .panel { margin-bottom: .8rem; }
.admin-density-compact .panel-head { padding: .55rem .9rem; }
.admin-density-compact .panel-head h2 { font-size: .88rem; }
.admin-density-compact .panel-body { padding: .8rem 1rem; }
.admin-density-compact h2 { font-size: 1rem; }
.admin-density-compact h3 { font-size: .92rem; }
.admin-density-compact .data-table th,
.admin-density-compact .data-table td { padding: .5rem .8rem; font-size: .85rem; }
.admin-density-compact .kpi-grid { gap: .6rem; margin-bottom: .8rem; }
.admin-density-compact .kpi-card { padding: .7rem .9rem; gap: .65rem; }
.admin-density-compact .kpi-icon { width: 36px; height: 36px; font-size: 1.15rem; border-radius: 7px; }
.admin-density-compact .kpi-value { font-size: 1.3rem; }
.admin-density-compact .kpi-label { font-size: .76rem; margin-top: .1rem; }
.admin-density-compact .kpi-meta  { font-size: .72rem; margin-top: .25rem; }
.admin-density-compact .content-tiles { gap: .5rem; margin-bottom: 1rem; }
.admin-density-compact .content-tile { padding: .65rem .55rem; }
.admin-density-compact .ct-icon { font-size: 1.15rem; }
.admin-density-compact .ct-value { font-size: 1.15rem; }
.admin-density-compact .ct-label { font-size: .72rem; }
.admin-density-compact .list-row { padding: .5rem .9rem; gap: .55rem; }
.admin-density-compact .lr-title { font-size: .85rem; }
.admin-density-compact .lr-meta  { font-size: .76rem; }
.admin-density-compact .lr-date { width: 36px; padding: .2rem; }
.admin-density-compact .lr-day  { font-size: .92rem; }
.admin-density-compact .action-grid { gap: .45rem; padding: .8rem .9rem; }
.admin-density-compact .action-tile { padding: .55rem .75rem; font-size: .82rem; }
.admin-density-compact .action-tile span { width: 24px; height: 24px; font-size: .9rem; }
.admin-density-compact .module-list .mod-row,
.admin-density-compact .mod-row { padding: .55rem .9rem; }
.admin-density-compact .mod-icon { width: 28px; height: 28px; font-size: .9rem; }
.admin-density-compact .mod-name { font-size: .85rem; }
.admin-density-compact .mod-desc { font-size: .72rem; }
.admin-density-compact .sys-list { padding: .8rem 1rem; gap: .45rem; }
.admin-density-compact .sys-list > div { font-size: .8rem; }
.admin-density-compact .btn-primary,
.admin-density-compact .btn-secondary,
.admin-density-compact .btn-danger { padding: .42rem .9rem; font-size: .85rem; }
.admin-density-compact .btn-sm,
.admin-density-compact .btn-danger-sm { padding: .28rem .65rem; font-size: .76rem; }
.admin-density-compact input[type=text],
.admin-density-compact input[type=email],
.admin-density-compact input[type=password],
.admin-density-compact input[type=search],
.admin-density-compact input[type=url],
.admin-density-compact input[type=tel],
.admin-density-compact input[type=number],
.admin-density-compact select,
.admin-density-compact textarea { padding: .42rem .65rem; font-size: .85rem; }
.admin-density-compact .alert { padding: .55rem .85rem; font-size: .82rem; }
.admin-density-compact .sidebar-nav { padding: .55rem .45rem .8rem; }
.admin-density-compact .sidebar-nav a { padding: .42rem .75rem; font-size: .85rem; gap: .55rem; }
.admin-density-compact .sidebar-nav .nav-icon { width: 20px; height: 20px; font-size: .9rem; }
.admin-density-compact .sidebar-brand { padding: .8rem 1rem .7rem; }
.admin-density-compact .brand-mark { width: 28px; height: 28px; font-size: .72rem; }
.admin-density-compact .dash-hero { padding: 1.1rem 1.4rem; }
.admin-density-compact .dash-hero h1 { font-size: 1.25rem; }
.admin-density-compact .dash-cols { gap: .8rem; }
.admin-density-compact .dash-col { gap: .8rem; }
.admin-density-compact .choice-card { padding: .75rem .9rem; gap: .7rem; }
.admin-density-compact .choice-icon { width: 36px; height: 36px; font-size: 1.25rem; }
.admin-density-compact .choice-body h3 { font-size: .9rem; }
.admin-density-compact .choice-body p  { font-size: .78rem; }

/* Komfortabel: lichter und großzügiger als Default */
.admin-density-comfortable .admin-main { padding: 2.2rem 2.6rem; }
.admin-density-comfortable .panel { margin-bottom: 1.2rem; }
.admin-density-comfortable .panel-head { padding: 1rem 1.4rem; }
.admin-density-comfortable .panel-body { padding: 1.3rem 1.5rem; }
.admin-density-comfortable .kpi-grid { gap: 1.1rem; }
.admin-density-comfortable .data-table th,
.admin-density-comfortable .data-table td { padding: .9rem 1.15rem; }
.admin-density-comfortable .list-row { padding: .85rem 1.2rem; }
.admin-density-comfortable .sidebar-nav a { padding: .65rem .9rem; }

/* ---------- Panels (überarbeitet) ----------------------------------------- */
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.panel-head {
  padding: .9rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.panel-head h2 { color: var(--text); }
.panel-link {
  color: var(--primary);
  font-weight: 500;
}

/* ---------- Buttons ------------------------------------------------------- */
.btn-primary, .btn-secondary, .btn-sm, .btn-danger, .btn-danger-sm {
  font-family: inherit;
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: .005em;
  transition: background .12s, color .12s, border-color .12s, transform .05s, box-shadow .15s;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  font-size: .9rem;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(37,99,235,.25), 0 4px 10px rgba(37,99,235,.18);
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 1px 3px rgba(37,99,235,.3), 0 6px 16px rgba(37,99,235,.22); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:focus-visible { outline: 3px solid var(--primary-light); outline-offset: 2px; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn-danger {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 1px 2px rgba(220,38,38,.25);
}
.btn-danger:hover { background: #b91c1c; }

.btn-sm {
  padding: .35rem .75rem;
  font-size: .82rem;
  background: var(--surface-3);
  color: var(--text);
}
.btn-sm:hover { background: var(--border); }
.btn-danger-sm {
  background: var(--danger-soft) !important;
  color: var(--danger) !important;
}

/* ---------- Forms --------------------------------------------------------- */
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=url], input[type=tel], input[type=number], select, textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: .55rem .75rem;
  font-family: inherit;
  font-size: .92rem;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
input[type=text]:focus, input[type=email]:focus, input[type=password]:focus,
input[type=search]:focus, input[type=url]:focus, input[type=tel]:focus,
input[type=number]:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.alert {
  border-radius: var(--radius);
  padding: .85rem 1.1rem;
  font-size: .9rem;
}
.alert-success { background: var(--success-soft); color: var(--success); border: 1px solid rgba(22,163,74,.25); }
.alert-error   { background: var(--danger-soft);  color: var(--danger);  border: 1px solid rgba(220,38,38,.25); }
.alert-info    { background: var(--primary-soft); color: var(--primary); border: 1px solid rgba(37,99,235,.2); }

/* ---------- Data-Table ---------------------------------------------------- */
.data-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.data-table th {
  background: var(--surface-2);
  color: var(--text-muted);
}
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tr:last-child td { border-bottom: 0; }

/* ---------- Modus-Sichtbarkeit ------------------------------------------- */
.admin-mode-simple .adv-only { display: none !important; }
.admin-mode-experienced .simple-only { display: none !important; }

/* Modus-Hinweis-Banner */
.mode-hint {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: var(--primary-soft);
  border: 1px solid var(--primary-light);
  color: var(--primary);
  padding: .5rem .85rem;
  border-radius: var(--radius);
  font-size: .82rem;
  margin-bottom: 1rem;
}
.mode-hint a { color: inherit; font-weight: 600; text-decoration: underline; }

/* ---------- Choice-Cards (Admin-Settings & Wizard) ------------------------ */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.choice-grid-small {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
.choice-card {
  display: flex;
  gap: .9rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, transform .12s, box-shadow .15s, background .15s;
  position: relative;
}
.choice-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.choice-card.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* Empfohlen-Badge auf einer Choice-Card */
.choice-card-recommended {
  border-color: #f59e0b;
}
.choice-card-recommended:hover {
  border-color: #d97706;
}
.choice-card-recommended.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.choice-recommended-badge {
  position: absolute;
  top: -10px;
  left: 14px;
  background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
  color: #1f2937;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .2rem .55rem;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(245,158,11,.4);
  white-space: nowrap;
  pointer-events: none;
}
.choice-card input[type=radio] { display: none; }
.choice-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  width: 44px; height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  border-radius: 10px;
}
.choice-card.is-selected .choice-icon { background: var(--primary-light); }
.choice-body { flex: 1; min-width: 0; }
.choice-body h3 {
  margin: 0 0 .25rem;
  font-size: 1rem;
  color: var(--text);
}
.choice-body p {
  margin: 0;
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.45;
}
.choice-body ul {
  margin: .5rem 0 0 1rem;
  padding: 0;
  font-size: .78rem;
}
.choice-body li { margin-bottom: .15rem; }

/* ---------- Hero auf Dashboard (Tweak) ------------------------------------ */
.dash-hero {
  background: linear-gradient(135deg, var(--primary) 0%, #6366f1 50%, #8b5cf6 100%);
  border: 0;
}

/* ==========================================================================
   Dashboard – Notizen & Todos
   ========================================================================== */
.todo-count-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: .68rem;
  padding: .1rem .5rem;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-left: .4rem;
  vertical-align: middle;
}
.todo-panel-body { padding: 0; }

.todo-add-form {
  padding: .75rem 1rem .8rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.todo-add-row {
  display: flex;
  gap: .4rem;
  align-items: stretch;
  flex-wrap: wrap;
}
.todo-add-title { flex: 1 1 200px; min-width: 0; }
.todo-add-vis { flex-shrink: 0; }

/* Share-Picker (Multi-Select mit Type-Ahead) */
.share-picker {
  position: relative;
  margin-top: .35rem;
}
.share-picker-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  padding: .35rem .4rem;
  min-height: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  align-items: center;
}
.share-picker-chip {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-light);
  border-radius: 999px;
  padding: .15rem .35rem .15rem .65rem;
  font-size: .78rem;
  font-weight: 500;
  line-height: 1.4;
}
.share-picker-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 0;
  background: rgba(0,0,0,.06);
  color: inherit;
  border-radius: 50%;
  cursor: pointer;
  font-size: .85rem;
  line-height: 1;
  padding: 0;
  margin-left: .15rem;
}
.share-picker-chip button:hover { background: rgba(0,0,0,.15); }
.share-picker-empty {
  font-size: .76rem;
  color: var(--text-faint);
  padding-left: .15rem;
}
.share-picker-input-wrap {
  position: relative;
}
.share-picker-input-wrap input {
  width: 100%;
  padding: .42rem .65rem;
  font-size: .85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top: 0;
  background: var(--surface-2);
}
.share-picker-input-wrap input:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.share-picker-suggestions {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 30;
  list-style: none;
  margin: 0;
  padding: .25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 240px;
  overflow-y: auto;
}
.share-picker-suggestions li {
  padding: .4rem .55rem;
  cursor: pointer;
  border-radius: 4px;
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.share-picker-suggestions li:hover,
.share-picker-suggestions li.is-active {
  background: var(--primary-soft);
}
.share-picker-suggestions .share-picker-email {
  font-size: .76rem;
  color: var(--text-muted);
}
.share-picker[hidden] { display: none; }

.todo-share-toggle {
  margin-top: .5rem;
}
.todo-share-toggle > summary {
  cursor: pointer;
  font-size: .78rem;
  color: var(--primary);
  list-style: none;
  user-select: none;
}
.todo-share-toggle > summary::-webkit-details-marker { display: none; }
.todo-share-toggle > summary::before { content: '+ '; font-weight: 700; }
.todo-share-toggle[open] > summary::before { content: '− '; }
.todo-share-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .35rem;
  margin-top: .5rem;
  padding: .5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.todo-share-list legend {
  font-size: .76rem;
  color: var(--text-muted);
  font-weight: 600;
  padding: 0 .3rem;
}
.todo-share-item {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
  padding: .25rem .35rem;
  border-radius: 4px;
}
.todo-share-item:hover { background: var(--surface-3); }
.todo-share-item input { margin: 0; }

.todo-filter {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  padding: .55rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.todo-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .55rem;
  font-size: .76rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  background: var(--surface-2);
}
.todo-filter-pill:hover {
  background: var(--surface-3);
  color: var(--text);
}
.todo-filter-pill.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.todo-filter-pill.is-active .muted { color: rgba(255,255,255,.7); }

.todo-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.todo-item {
  border-bottom: 1px solid var(--border);
}
.todo-item:last-child { border-bottom: 0; }
.todo-item.is-done { opacity: .55; }
.todo-item.is-done .todo-title { text-decoration: line-through; color: var(--text-muted); }
.todo-item-row {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .65rem .9rem;
}

.todo-toggle-form { margin: 0; flex-shrink: 0; }
.todo-checkbox {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: .15rem;
  padding: 0;
  transition: background .12s, border-color .12s;
}
.todo-checkbox:hover { border-color: var(--primary); }
.todo-item.is-done .todo-checkbox {
  background: var(--success);
  border-color: var(--success);
}

.todo-content {
  flex: 1;
  min-width: 0;
}
.todo-title {
  font-size: .9rem;
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}
.todo-body {
  font-size: .82rem;
  color: var(--text-muted);
  margin-top: .25rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.todo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: center;
  margin-top: .35rem;
}
.todo-vis-pill {
  display: inline-block;
  font-size: .68rem;
  padding: .1rem .45rem;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: .02em;
}
.todo-vis-private  { background: #f1f5f9; color: #475569; }
.todo-vis-shared   { background: #fef3c7; color: #92400e; }
.todo-vis-incoming { background: #dbeafe; color: #1e40af; }
.todo-vis-public   { background: #dcfce7; color: #166534; }

/* Priority/Due/Recurrence Pills */
.todo-prio-pill,
.todo-due-pill,
.todo-rec-pill {
  display: inline-block;
  font-size: .68rem;
  padding: .1rem .45rem;
  border-radius: 999px;
  font-weight: 600;
}
.todo-prio-high   { background: #fee2e2; color: #991b1b; }
.todo-prio-low    { background: #f1f5f9; color: #64748b; }
.todo-due-future  { background: #f1f5f9; color: #475569; }
.todo-due-today   { background: #fef3c7; color: #92400e; }
.todo-due-overdue { background: #fee2e2; color: #991b1b; animation: todo-pulse 1.6s ease-in-out infinite; }
.todo-rec-pill    { background: #ede9fe; color: #5b21b6; }
@keyframes todo-pulse {
  50% { background: #fecaca; }
}

/* Add-Form Extras (Priority + Datum + Wiederholung) */
.todo-add-extras {
  display: flex;
  gap: .35rem;
  margin-top: .45rem;
  flex-wrap: wrap;
}
.todo-add-extras select,
.todo-add-extras input[type=date] {
  flex: 1 1 110px;
  min-width: 0;
  padding: .35rem .5rem;
  font-size: .8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Dashboard – Nachrichten/Feed-Panel
   ========================================================================== */
.feed-panel-body { padding: 0; }

.feed-source-filter {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  align-items: center;
  padding: .55rem .9rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: .82rem;
}
.feed-filter-label {
  color: var(--text-muted);
  font-weight: 500;
  font-size: .76rem;
  margin-right: .2rem;
}
.feed-source-pill {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .22rem .55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: .76rem;
  transition: background .12s, color .12s, border-color .12s;
  user-select: none;
}
.feed-source-pill input { display: none; }
.feed-source-pill.is-visible {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: var(--primary-light);
}
.feed-source-pill.is-hidden {
  opacity: .5;
  text-decoration: line-through;
}
.feed-source-pill:hover { border-color: var(--primary); }

.feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.feed-item {
  border-bottom: 1px solid var(--border);
}
.feed-item:last-child { border-bottom: 0; }
.feed-item-link {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .65rem .9rem;
  text-decoration: none;
  color: inherit;
  transition: background .1s;
}
.feed-item-link:hover { background: var(--surface-3); }
.feed-item-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  border-radius: 6px;
  font-size: .95rem;
}
.feed-item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.feed-item-title {
  font-size: .87rem;
  font-weight: 500;
  color: var(--text);
}
.feed-item-excerpt {
  font-size: .8rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.feed-item-meta {
  font-size: .74rem;
  color: var(--text-muted);
}
.panel-link-group { margin-left: auto; }

/* Sort-Trenner in der Filter-Leiste */
.todo-sort-divider {
  flex: 0 0 1px;
  margin: 0 .25rem;
  align-self: stretch;
  background: var(--border);
}
.todo-sort-pill {
  background: transparent !important;
  border-style: dashed !important;
}
.todo-sort-pill.is-active {
  background: var(--success-soft) !important;
  border-color: var(--success) !important;
  color: var(--success) !important;
  border-style: solid !important;
}

.todo-actions {
  display: flex;
  gap: .25rem;
  flex-shrink: 0;
  align-items: center;
}
/* Edit-Toggle: pure CSS (Checkbox + Label) — keine Position-Tricks, kein Clipping */
.todo-edit-checkbox { display: none; }
.todo-edit-btn-label {
  cursor: pointer;
  user-select: none;
  font-size: .82rem;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.todo-edit-btn-label .todo-edit-icon-close { display: none; }
.todo-edit-checkbox:checked ~ .todo-item-row .todo-edit-btn-label .todo-edit-icon-edit  { display: none; }
.todo-edit-checkbox:checked ~ .todo-item-row .todo-edit-btn-label .todo-edit-icon-close { display: inline; }
.todo-edit-checkbox:checked ~ .todo-item-row .todo-edit-btn-label {
  background: var(--primary);
  color: #fff;
}

.todo-edit-area {
  display: none;
  padding: .8rem 1rem 1rem;
  background: var(--surface-2);
  border-top: 1px dashed var(--border);
}
.todo-edit-checkbox:checked ~ .todo-edit-area {
  display: block;
  animation: todo-edit-slide .2s ease-out;
}
@keyframes todo-edit-slide {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

.todo-edit-form {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.todo-edit-form .welcome-field { margin-bottom: 0; }
.todo-edit-form fieldset.todo-share-list {
  margin: 0;
  padding: .5rem .65rem;
}
.todo-edit-actions {
  display: flex;
  gap: .4rem;
  margin-top: .3rem;
}
.todo-edit-actions label.btn-sm {
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
}

@media (max-width: 540px) {
  .todo-add-row { flex-direction: column; }
  .todo-edit-area { padding: .7rem .8rem .8rem; }
}

/* Dashboard-Warnung für rechtliche Pflichten */
.dash-legal-warning {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, #fef2f2 0%, #fff5f5 100%);
  border: 1px solid #fecaca;
  border-left: 4px solid var(--danger);
  border-radius: var(--radius);
  color: #1c2330;
}
.admin-scheme-dark .dash-legal-warning,
.admin-scheme-auto .dash-legal-warning {
  background: linear-gradient(135deg, #2a1212 0%, #1f0a0a 100%);
  border-color: rgba(220,38,38,.45);
  color: #fee2e2;
}
.dlw-icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
}
.dlw-body { flex: 1; min-width: 0; }
.dlw-body strong { color: var(--danger); font-size: 1rem; }
.admin-scheme-dark .dlw-body strong,
.admin-scheme-auto .dlw-body strong { color: #fca5a5; }
.dlw-body p { margin: .25rem 0; font-size: .88rem; line-height: 1.5; }
.dlw-body ul { margin: .5rem 0 0; padding: 0 0 0 0; list-style: none; }
.dlw-body li {
  padding: .45rem .65rem;
  margin-bottom: .35rem;
  background: #fff;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.admin-scheme-dark .dlw-body li,
.admin-scheme-auto .dlw-body li {
  background: rgba(0,0,0,.3);
  border-color: rgba(220,38,38,.35);
}
.dlw-pending-icon { font-size: 1.1rem; }
.dlw-fix {
  margin-left: auto;
  background: var(--danger);
  color: #fff !important;
  padding: .25rem .65rem;
  border-radius: 5px;
  font-size: .8rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.dlw-fix:hover { background: #b91c1c; }
.dlw-ok {
  font-size: .82rem !important;
  color: var(--text-muted) !important;
  margin-top: .8rem !important;
}
.dlw-ok-pill {
  display: inline-block;
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(22,163,74,.25);
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  margin-right: .35rem;
}

/* Sub-Navigation im Recht-Tab */
.legal-subnav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .6rem;
  margin-bottom: 1.4rem;
}
.legal-subnav-item {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .12s, background .12s, transform .08s;
  position: relative;
}
.legal-subnav-item:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}
.legal-subnav-item.is-active {
  background: var(--primary-soft);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.legal-subnav-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}
.legal-subnav-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}
.legal-subnav-label {
  font-weight: 600;
  font-size: .95rem;
}
.legal-subnav-hint {
  font-size: .78rem;
  color: var(--text-muted);
}

/* Status-Karte für Datenschutz/Impressum */
.legal-status {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 1rem;
  flex-wrap: wrap;
}
.legal-status-icon { flex-shrink: 0; }
.legal-status-body { flex: 1; min-width: 200px; }
.legal-status-body strong { font-size: 1rem; color: var(--text); }
.legal-status-body p { margin: .15rem 0 0; font-size: .82rem; }
.legal-status-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

/* Simple-Mode Hinweis innerhalb der Settings-Tabs */
.settings-tab-hint {
  margin-top: 1rem;
  background: var(--primary-soft);
  border: 1px dashed var(--primary);
  color: var(--primary);
  border-radius: var(--radius-sm);
  padding: .55rem .75rem !important;
  text-align: left;
  font-weight: 500;
}
.settings-tab-hint:hover { background: var(--primary-light); }
.admin-mode-experienced .settings-tab-hint { display: none; }

/* ---------- Misc small polish --------------------------------------------- */
.page-header { margin-bottom: 1.25rem; }
.page-header h1 {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -.015em;
}

/* ==========================================================================
   Welcome / First-Run-Setup  (kalmes Editorial-Layout)
   ========================================================================== */
body.welcome-body {
  background: #fafaf7;
  background-image:
    radial-gradient(circle at 20% -10%, rgba(37,99,235,.06), transparent 50%),
    radial-gradient(circle at 110% 110%, rgba(99,102,241,.05), transparent 50%);
  min-height: 100vh;
  margin: 0;
  padding: 4rem 1.2rem 3rem;
  color: #1c2330;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.welcome-shell {
  max-width: 460px;
  margin: 0 auto;
  display: block;
}

.welcome-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.4rem;
}
.welcome-mark {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: #1c2330;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
}
.welcome-step {
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #6b7380;
  font-weight: 600;
}

.welcome-intro {
  margin-bottom: 2.2rem;
}
.welcome-intro h1 {
  margin: 0 0 .5rem;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -.025em;
  color: #1c2330;
  line-height: 1.15;
}
.welcome-intro p {
  margin: 0;
  color: #5a6478;
  font-size: .95rem;
  line-height: 1.55;
  max-width: 38ch;
}

.welcome-alert {
  background: #fff5f5;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: .85rem 1rem;
  border-radius: 8px;
  font-size: .85rem;
  margin-bottom: 1.6rem;
}
.welcome-alert strong { font-weight: 600; }
.welcome-alert ul { margin: .4rem 0 0 1rem; padding: 0; }
.welcome-alert li { margin-bottom: .15rem; }

.welcome-form {
  background: #fff;
  border: 1px solid #ebebe5;
  border-radius: 12px;
  padding: 1.8rem 1.7rem 1.5rem;
  box-shadow:
    0 1px 2px rgba(0,0,0,.03),
    0 8px 24px -8px rgba(0,0,0,.08);
}
.welcome-section + .welcome-section { display: none; } /* nur falls jemals zwei direkt aufeinander */

.welcome-section h2 {
  margin: 0 0 1.1rem;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #6b7380;
}

.welcome-divider {
  border: 0;
  border-top: 1px solid #ebebe5;
  margin: 1.6rem 0;
}

.welcome-field {
  display: block;
  margin-bottom: .9rem;
}
.welcome-field > span {
  display: block;
  font-size: .82rem;
  font-weight: 500;
  color: #2a3142;
  margin-bottom: .35rem;
}
.welcome-field > span em {
  font-style: normal;
  font-weight: 400;
  color: #8a93a4;
  margin-left: .15rem;
}
.welcome-field > input {
  display: block;
  width: 100%;
  padding: .6rem .85rem;
  background: #fafafa;
  border: 1px solid #e4e4dd;
  border-radius: 7px;
  font-size: .92rem;
  font-family: inherit;
  color: #1c2330;
  transition: border-color .12s, background .12s, box-shadow .12s;
}
.welcome-field > input::placeholder { color: #b3b9c4; }
.welcome-field > input:hover  { background: #fff; border-color: #d4d8e0; }
.welcome-field > input:focus  {
  outline: 0;
  background: #fff;
  border-color: #1c2330;
  box-shadow: 0 0 0 3px rgba(28,35,48,.08);
}

.welcome-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .7rem;
}
@media (max-width: 540px) {
  .welcome-row { grid-template-columns: 1fr; }
  .welcome-shell { padding-top: 0; }
  .welcome-form { padding: 1.5rem 1.3rem 1.2rem; }
  .welcome-intro h1 { font-size: 1.6rem; }
  body.welcome-body { padding: 2.5rem 1rem 2rem; }
}

.welcome-cta {
  display: block;
  width: 100%;
  margin-top: 1.5rem;
  padding: .85rem 1.2rem;
  background: #1c2330;
  color: #fff;
  border: 0;
  border-radius: 8px;
  font-size: .95rem;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: -.005em;
  cursor: pointer;
  transition: background .15s, transform .05s;
}
.welcome-cta:hover { background: #2563eb; }
.welcome-cta:active { transform: translateY(1px); }
.welcome-cta:focus-visible {
  outline: 3px solid rgba(37,99,235,.3);
  outline-offset: 2px;
}

.welcome-foot {
  text-align: center;
  font-size: .76rem;
  color: #8a93a4;
  margin-top: 1.6rem;
}

/* ==========================================================================
   First-Run-Splash (riesiges „Willkommen") — Overlay über dem Dashboard
   ========================================================================== */
.fr-splash {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #fafaf7;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 2rem;
  animation: fr-fade-in .4s ease-out;
}
.fr-splash.is-leaving { animation: fr-fade-out .6s ease-in forwards; }
@keyframes fr-fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes fr-fade-out { to   { opacity: 0; visibility: hidden; pointer-events: none; } }

.fr-splash-title {
  font-size: clamp(2.6rem, 9vw, 5.5rem);
  font-weight: 700;
  letter-spacing: -.035em;
  color: #1c2330;
  margin: 0;
  line-height: 1.05;
  animation: fr-rise .55s cubic-bezier(.2,.8,.3,1.05) both;
}
.fr-splash-sub {
  margin-top: 1rem;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  color: #5a6478;
  max-width: 36ch;
  animation: fr-rise .55s cubic-bezier(.2,.8,.3,1.05) both;
  animation-delay: .15s;
}
@keyframes fr-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* First-Run-Banner über die nächsten Seiten (Admin-Settings, Setup-Wizard) */
.fr-banner {
  background: linear-gradient(90deg, #eff6ff 0%, #f5f3ff 100%);
  border: 1px solid #c7d2fe;
  border-left: 4px solid #6366f1;
  border-radius: 10px;
  padding: 1rem 1.2rem;
  margin-bottom: 1.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.fr-banner-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
}
.fr-banner-text { flex: 1; min-width: 200px; }
.fr-banner-text strong { color: #312e81; }
.fr-banner-text p { margin: .15rem 0 0; font-size: .85rem; color: #4338ca; }
.fr-banner-step {
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 700;
  color: #6366f1;
  background: #fff;
  padding: .25rem .55rem;
  border-radius: 999px;
  border: 1px solid #c7d2fe;
}

/* ==========================================================================
   Collapsible Panels (auf dem Dashboard)
   ========================================================================== */
.panel-collapsible {
  /* details inheriten panel-Styles, aber ohne extra display-Eigenheiten */
}
.panel-collapsible > summary.panel-head {
  cursor: pointer;
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
  position: relative;
  padding-right: 2.6rem; /* Platz für Chevron */
  transition: background .12s;
}
.panel-collapsible > summary.panel-head::-webkit-details-marker { display: none; }
.panel-collapsible > summary.panel-head::marker { content: ''; }
.panel-collapsible > summary.panel-head:hover {
  background: var(--surface-3);
}
.panel-collapsible > summary.panel-head::after {
  content: '';
  position: absolute;
  right: 1.1rem;
  top: 50%;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: translateY(-65%) rotate(45deg);
  transition: transform .2s ease;
  pointer-events: none;
}
.panel-collapsible[open] > summary.panel-head::after {
  transform: translateY(-30%) rotate(-135deg);
}
.panel-collapsible[open] > summary.panel-head {
  border-bottom: 1px solid var(--border);
}
/* Smooth-Open: kleine Fade-Animation für den Body */
.panel-collapsible:not([open]) > :not(summary) { display: none; }
.panel-collapsible[open] > :not(summary) {
  animation: panel-slide-in .2s ease-out;
}
@keyframes panel-slide-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
/* Wenn collapsed: keine Bottom-Border am Head */
.panel-collapsible:not([open]) > summary.panel-head { border-bottom: 0; }

/* Toggle-Leiste über den Panels */
.dash-toggles {
  display: flex;
  gap: .4rem;
  justify-content: flex-end;
  margin-bottom: .8rem;
  flex-wrap: wrap;
}
.dash-toggles .btn-sm {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .75rem;
  letter-spacing: .03em;
  padding: .3rem .65rem;
}
.dash-toggles .btn-sm:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border-strong);
}

/* ==========================================================================
   Sidebar-Lock & Permissions
   ========================================================================== */
.sidebar-nav .is-locked {
  opacity: .55;
  position: relative;
}
.sidebar-nav .nav-lock {
  margin-left: auto;
  font-size: .85rem;
}
.sidebar-nav .is-locked:hover {
  background: rgba(255,255,255,.04) !important;
}
body.sidebar-collapsed .sidebar-nav .nav-lock { display: none; }

/* Permission-Grid in der User-Edit-Form */
.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .55rem;
  margin: .8rem 0;
}
.perm-item {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem .75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: .85rem;
  transition: background .12s, border-color .12s;
}
.perm-item:hover { border-color: var(--border-strong); }
.perm-item input[type=checkbox] { margin: 0; }
.perm-item input[type=checkbox]:checked + .perm-icon + .perm-label,
.perm-item:has(input:checked) {
  background: #fef2f2;
  border-color: #fca5a5;
}
.perm-icon {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  border-radius: 6px;
  font-size: .9rem;
  flex-shrink: 0;
}

/* ============================================================
   3-Zustands-Permission-Grid (show / lock / hide)
   Eine Zeile pro Bereich, rechts der Segmented-Control.
   ============================================================ */
.perm-tri-grid {
  display: flex;
  flex-direction: column;
  gap: .45rem;
  margin: .85rem 0;
}
.perm-tri-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: .55rem .75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  transition: border-color .12s;
}
.perm-tri-row:hover { border-color: var(--border-strong); }

.perm-tri-row__label {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  min-width: 0;
}
.perm-tri-row__label > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

/* Segmented Control (3 Radio-Buttons als Pill-Gruppe) */
.perm-tri-seg {
  display: inline-flex;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.perm-tri-seg input[type="radio"] {
  position: absolute;
  width: 0; height: 0;
  opacity: 0;
  pointer-events: none;
}
.perm-tri-seg__btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .75rem;
  cursor: pointer;
  font-size: .82rem;
  color: var(--text-muted);
  border-right: 1px solid var(--border);
  background: transparent;
  transition: background .12s, color .12s;
  user-select: none;
  line-height: 1.2;
  white-space: nowrap;
}
.perm-tri-seg__btn:last-of-type { border-right: 0; }
.perm-tri-seg__btn:hover {
  background: var(--surface-2);
  color: var(--text);
}
.perm-tri-seg__icon {
  font-size: 1em;
  line-height: 1;
}

/* Aktive Zustände — Farb-kodiert pro Modus */
.perm-tri-seg input[value="show"]:checked + .perm-tri-seg__btn--show {
  background: #ecfdf5;
  color: #166534;
  font-weight: 600;
}
.perm-tri-seg input[value="lock"]:checked + .perm-tri-seg__btn--lock {
  background: #fef3c7;
  color: #92400e;
  font-weight: 600;
}
.perm-tri-seg input[value="hide"]:checked + .perm-tri-seg__btn--hide {
  background: #fee2e2;
  color: #991b1b;
  font-weight: 600;
}

/* Focus-Outline für Tastatur-Navigation */
.perm-tri-seg input[type="radio"]:focus-visible + .perm-tri-seg__btn {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: -2px;
  z-index: 1;
}

/* Mobile: Label oben, Segmented Control unten */
@media (max-width: 600px) {
  .perm-tri-row {
    grid-template-columns: 1fr;
    gap: .45rem;
  }
  .perm-tri-seg {
    width: 100%;
  }
  .perm-tri-seg__btn {
    flex: 1;
    justify-content: center;
  }
  .perm-tri-seg__text {
    font-size: .75rem;
  }
}
.perm-label {
  flex: 1;
  color: var(--text);
  font-weight: 500;
}

/* ---------- RESET / GENERATE-Knöpfe (rechts unten am Dashboard) -------- */
.reset-corner {
  margin-top: 2rem;
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Generate-Knopf — dezent, klare Form, Site-grün als Akzent */
.generate-corner-btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .5rem .95rem;
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: #fff;
  background: #16a34a;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  line-height: 1.2;
  transition: background .15s ease, box-shadow .15s ease, transform .12s ease;
  box-shadow: 0 1px 2px rgba(22,163,74,.25), 0 0 0 1px rgba(22,163,74,.15) inset;
}
.generate-corner-btn:hover {
  background: #15803d;
  box-shadow: 0 4px 12px rgba(22,163,74,.35), 0 0 0 1px rgba(22,163,74,.25) inset;
  transform: translateY(-1px);
}
.generate-corner-btn:active { transform: translateY(0); }
.generate-corner-btn:focus-visible {
  outline: 2px solid #16a34a;
  outline-offset: 2px;
}
.generate-corner-btn:disabled {
  opacity: .65;
  cursor: progress;
  transform: none;
}
.generate-corner-btn svg { flex-shrink: 0; }
.generate-corner-btn--big {
  padding: .75rem 1.4rem;
  font-size: .98rem;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(22,163,74,.3), 0 0 0 1px rgba(22,163,74,.15) inset;
}

/* ---------- Native <dialog> — echtes Top-Layer Popup ------------------ */
/* Renders in der Top-Layer des Browsers, escaped jeden CSS-Container
   (transform/filter/clip-path). Backdrop kommt vom Browser via ::backdrop. */
.generate-dialog {
  width: min(680px, 94vw);
  max-height: 88vh;
  padding: 0;
  border: 1px solid var(--border, #e4e8ee);
  border-radius: 14px;
  background: var(--surface, #fff);
  color: var(--text, #0f172a);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .35);
  overflow: hidden;
  font-family: inherit;
}
.generate-dialog::backdrop {
  background: rgba(15, 23, 42, .58);
  backdrop-filter: blur(3px);
}
.generate-dialog[open] {
  /* Sanftes Erscheinen */
  animation: dlg-pop .18s ease-out;
}
@keyframes dlg-pop {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.generate-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.05rem 1.4rem;
  border-bottom: 1px solid var(--border, #e4e8ee);
  background: linear-gradient(180deg, #f0fdf4 0%, #fff 100%);
}
.generate-dialog__title-row {
  display: flex;
  align-items: center;
  gap: .7rem;
}
.generate-dialog__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: #16a34a;
  color: #fff;
  border-radius: 8px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(22,163,74,.4);
}
.generate-dialog__head h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text, #0f172a);
  letter-spacing: -.01em;
}
.generate-dialog__x {
  background: transparent;
  border: 0;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--text-muted, #5a6478);
  cursor: pointer;
  padding: .15rem .55rem;
  border-radius: 6px;
  font-family: inherit;
}
.generate-dialog__x:hover { background: var(--surface-2, #f4f6f8); color: var(--text, #0f172a); }

.generate-dialog__body {
  padding: 1.2rem 1.4rem;
  line-height: 1.55;
  overflow-y: auto;
  max-height: calc(88vh - 180px);
}
.generate-dialog__lead {
  margin: 0 0 1rem;
  font-size: .98rem;
  color: var(--text, #0f172a);
}

.generate-dialog__cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
@media (max-width: 560px) {
  .generate-dialog__cols { grid-template-columns: 1fr; }
}
.generate-dialog__col {
  background: var(--surface-2, #fafbfc);
  border: 1px solid var(--border, #e4e8ee);
  border-radius: 8px;
  padding: .85rem 1rem;
}
.generate-dialog__col h3 {
  margin: 0 0 .45rem;
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.generate-dialog__col--ok h3 { color: #15803d; }
.generate-dialog__col--no h3 { color: #b45309; }
.generate-dialog__col ul {
  margin: 0;
  padding-left: 1.1rem;
  font-size: .88rem;
}
.generate-dialog__col li {
  margin: .35rem 0;
  color: var(--text, #0f172a);
}
.generate-dialog__col--ok li::marker { color: #16a34a; }
.generate-dialog__col--no li::marker { color: #d97706; }
.generate-dialog__col li small {
  display: block;
  font-size: .78rem;
  color: var(--text-muted, #5a6478);
  font-style: italic;
}

.generate-dialog__hint {
  margin: 0;
  padding: .75rem 1rem;
  background: #ecfdf5;
  border-left: 3px solid #16a34a;
  border-radius: 0 6px 6px 0;
  font-size: .88rem;
  color: #166534;
}

.generate-dialog__foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .65rem;
  padding: .9rem 1.4rem;
  border-top: 1px solid var(--border, #e4e8ee);
  background: var(--surface-2, #fafbfc);
}
.generate-dialog__foot .btn-secondary {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e4e8ee);
  color: var(--text, #0f172a);
  padding: .55rem 1rem;
  border-radius: 7px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  font-size: .92rem;
}
.generate-dialog__foot .btn-secondary:hover { background: var(--surface-2, #f4f6f8); }
.reset-corner-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .7rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--danger);
  background: transparent;
  border: 1px solid rgba(220,38,38,.35);
  border-radius: 6px;
  text-decoration: none;
  opacity: .7;
  transition: opacity .15s, background .15s, color .15s, border-color .15s;
}
.reset-corner-btn:hover {
  opacity: 1;
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

/* Reset-Bestätigungs-Seite */
.reset-warn-panel { border: 2px solid var(--danger); }
.reset-final-btn {
  background: var(--danger) !important;
  color: #fff !important;
  font-weight: 700 !important;
  font-size: .95rem !important;
  padding: .8rem 1.4rem !important;
  box-shadow: 0 4px 14px rgba(220,38,38,.35), 0 0 0 1px rgba(220,38,38,.6) inset !important;
}
.reset-final-btn:hover { background: #b91c1c !important; box-shadow: 0 6px 18px rgba(220,38,38,.5) !important; }

/* ---------- Sidebar-Backdrop Mobile -------------------------------------- */
@media (max-width: 900px) {
  body.sidebar-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.55);
    z-index: 150;
  }
}

/* ==========================================================================
   DARK-MODE: Komplett-Layer für Legacy-Elemente in admin.css
   --------------------------------------------------------------------------
   admin.css (älter, ~5000 Zeilen) hat 50+ hartkodierte `background: #fff`
   und ein hartes Rot (#c0392b auf #fdecea). Im Dunkel-Modus sahen viele
   Bereiche weiß/rot-grell aus. Wir kappen das hier zentral, sodass alle
   Stellen automatisch im Dark-Look erscheinen.
   ========================================================================== */

/* ---------- Tokens für Dark-Mode anpassen -------------------------------- */
.admin-scheme-dark {
  /* Rot-Töne dezenter: hellrote Schrift auf gedämpftem dunklem Hintergrund.
     Vorher: #c0392b auf #fdecea → grell und unleserlich auf dunkler Seite. */
  --admin-danger:        #f87171;
  --admin-danger-light:  #3a1c1c;
  --admin-success:       #4ade80;
  --admin-success-light: #14302a;
  --admin-accent:        #fbbf24;
  --admin-sidebar:        #101216;
  --admin-sidebar-hover:  #1f232b;
  --admin-sidebar-active: #5b8def;

  /* Surface-Untervarianten für Modals/Inputs */
  --admin-surface-2: #252830;
  --admin-surface-3: #2c3038;
}
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto {
    --admin-danger:        #f87171;
    --admin-danger-light:  #3a1c1c;
    --admin-success:       #4ade80;
    --admin-success-light: #14302a;
    --admin-accent:        #fbbf24;
    --admin-sidebar:        #101216;
    --admin-sidebar-hover:  #1f232b;
    --admin-sidebar-active: #5b8def;
    --admin-surface-2: #252830;
    --admin-surface-3: #2c3038;
  }
}

/* Helper: Selector-Block, der für BEIDE Schemes greift (.dark + .auto im
   System-Dark-Mode). Da CSS keine Variablen in Selektoren erlaubt, listen
   wir die Selektoren paarweise. Wir benutzen `:where()` um die Specificity
   gering zu halten — sonst überschreiben die Regeln Komponenten-Resets,
   die im Light-Mode zugleich greifen sollen. */

/* ---------- Hartkodierte weiße Hintergründe abfangen --------------------- */
:where(.admin-scheme-dark) .btn-secondary,
:where(.admin-scheme-dark) .theme-card,
:where(.admin-scheme-dark) .theme-check,
:where(.admin-scheme-dark) .color-hex-input,
:where(.admin-scheme-dark) .cp-body,
:where(.admin-scheme-dark) .editor-toolbar button,
:where(.admin-scheme-dark) .media-picker-dialog,
:where(.admin-scheme-dark) table,
:where(.admin-scheme-dark) .settings-section,
:where(.admin-scheme-dark) .message-card,
:where(.admin-scheme-dark) .empty-state,
:where(.admin-scheme-dark) .stat-card,
:where(.admin-scheme-dark) .dashboard-section,
:where(.admin-scheme-dark) .form-main .sidebar-box,
:where(.admin-scheme-dark) .form-sidebar .sidebar-box,
:where(.admin-scheme-dark) .media-item,
:where(.admin-scheme-dark) .module-card,
:where(.admin-scheme-dark) .settings-tabs,
:where(.admin-scheme-dark) #quill-editor-wrap,
:where(.admin-scheme-dark) .fw-fontsize-popover,
:where(.admin-scheme-dark) .fw-fontsize-popover .fw-fs-preset,
:where(.admin-scheme-dark) .fw-fontsize-popover .fw-fs-reset,
:where(.admin-scheme-dark) .fw-textcolor-popover .fw-tc-input,
:where(.admin-scheme-dark) .fw-fontfamily-popover .fw-ff-item,
:where(.admin-scheme-dark) .scroll-menu-item,
:where(.admin-scheme-dark) .bulk-bar,
:where(.admin-scheme-dark) .hero-img-row,
:where(.admin-scheme-dark) .hero-tabs__btn.is-active,
:where(.admin-scheme-dark) .hero-field-group,
:where(.admin-scheme-dark) .tf-section,
:where(.admin-scheme-dark) .tf-repeater-row,
:where(.admin-scheme-dark) .action-tile span,
:where(.admin-scheme-dark) .img-preview,
:where(.admin-scheme-dark) .wizard-error-popup,
:where(.admin-scheme-dark) .pro-group > summary,
:where(.admin-scheme-dark) .pro-group {
  background: var(--surface) !important;
  color: var(--text);
  border-color: var(--border);
}

/* Identische Regel für admin-scheme-auto, aber NUR im System-Dark.
   Wir wiederholen die Liste mit prefers-color-scheme: dark, sonst greift
   der Block auch im hellen Auto-Mode und macht alles dunkel. */
@media (prefers-color-scheme: dark) {
  :where(.admin-scheme-auto) .btn-secondary,
  :where(.admin-scheme-auto) .theme-card,
  :where(.admin-scheme-auto) .theme-check,
  :where(.admin-scheme-auto) .color-hex-input,
  :where(.admin-scheme-auto) .cp-body,
  :where(.admin-scheme-auto) .editor-toolbar button,
  :where(.admin-scheme-auto) .media-picker-dialog,
  :where(.admin-scheme-auto) table,
  :where(.admin-scheme-auto) .settings-section,
  :where(.admin-scheme-auto) .message-card,
  :where(.admin-scheme-auto) .empty-state,
  :where(.admin-scheme-auto) .stat-card,
  :where(.admin-scheme-auto) .dashboard-section,
  :where(.admin-scheme-auto) .form-main .sidebar-box,
  :where(.admin-scheme-auto) .form-sidebar .sidebar-box,
  :where(.admin-scheme-auto) .media-item,
  :where(.admin-scheme-auto) .module-card,
  :where(.admin-scheme-auto) .settings-tabs,
  :where(.admin-scheme-auto) #quill-editor-wrap,
  :where(.admin-scheme-auto) .fw-fontsize-popover,
  :where(.admin-scheme-auto) .fw-fontsize-popover .fw-fs-preset,
  :where(.admin-scheme-auto) .fw-fontsize-popover .fw-fs-reset,
  :where(.admin-scheme-auto) .fw-textcolor-popover .fw-tc-input,
  :where(.admin-scheme-auto) .fw-fontfamily-popover .fw-ff-item,
  :where(.admin-scheme-auto) .scroll-menu-item,
  :where(.admin-scheme-auto) .bulk-bar,
  :where(.admin-scheme-auto) .hero-img-row,
  :where(.admin-scheme-auto) .hero-tabs__btn.is-active,
  :where(.admin-scheme-auto) .hero-field-group,
  :where(.admin-scheme-auto) .tf-section,
  :where(.admin-scheme-auto) .tf-repeater-row,
  :where(.admin-scheme-auto) .action-tile span,
  :where(.admin-scheme-auto) .img-preview,
  :where(.admin-scheme-auto) .wizard-error-popup,
  :where(.admin-scheme-auto) .pro-group > summary,
  :where(.admin-scheme-auto) .pro-group {
    background: var(--surface) !important;
    color: var(--text);
    border-color: var(--border);
  }
}

/* ---------- Tabellen + Tabellen-Header ----------------------------------- */
.admin-scheme-dark table,
.admin-scheme-dark thead,
.admin-scheme-dark tbody,
.admin-scheme-dark tr {
  border-color: var(--border);
  color: var(--text);
}
.admin-scheme-dark th {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
.admin-scheme-dark td { background: transparent; color: var(--text); }
.admin-scheme-dark tbody tr:hover td { background: var(--surface-2); }
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto th {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
  }
  .admin-scheme-auto tbody tr:hover td { background: var(--surface-2); }
}

/* ---------- Alerts: alle 4 Varianten dunkel-tauglich --------------------- */
.admin-scheme-dark .alert,
.admin-scheme-dark .alert-success,
.admin-scheme-dark .alert-error,
.admin-scheme-dark .alert-warning,
.admin-scheme-dark .alert-info {
  border-width: 1px;
}
.admin-scheme-dark .alert-success {
  background: var(--success-soft) !important;
  color: #4ade80 !important;
  border-color: #1f4a36 !important;
}
.admin-scheme-dark .alert-error {
  background: var(--danger-soft) !important;
  color: #fca5a5 !important;
  border-color: #5a2828 !important;
}
.admin-scheme-dark .alert-warning {
  background: var(--warn-soft) !important;
  color: #fcd34d !important;
  border-color: #5a4416 !important;
}
.admin-scheme-dark .alert-info {
  background: var(--primary-soft) !important;
  color: #93c5fd !important;
  border-color: #2a3a5a !important;
}
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto .alert-success {
    background: var(--success-soft) !important;
    color: #4ade80 !important;
    border-color: #1f4a36 !important;
  }
  .admin-scheme-auto .alert-error {
    background: var(--danger-soft) !important;
    color: #fca5a5 !important;
    border-color: #5a2828 !important;
  }
  .admin-scheme-auto .alert-warning {
    background: var(--warn-soft) !important;
    color: #fcd34d !important;
    border-color: #5a4416 !important;
  }
  .admin-scheme-auto .alert-info {
    background: var(--primary-soft) !important;
    color: #93c5fd !important;
    border-color: #2a3a5a !important;
  }
}

/* ---------- Danger-Buttons: nicht mehr knall-rosa auf dunkel ------------- */
.admin-scheme-dark .btn-danger,
.admin-scheme-dark .btn-danger-sm {
  background: var(--admin-danger-light) !important;
  color: var(--admin-danger) !important;
  border-color: #5a2828 !important;
}
.admin-scheme-dark .btn-danger:hover,
.admin-scheme-dark .btn-danger-sm:hover {
  background: #4a2424 !important;
  color: #ffb4b4 !important;
}
.admin-scheme-dark .btn-secondary {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
.admin-scheme-dark .btn-secondary:hover {
  background: var(--surface-3) !important;
}
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto .btn-danger,
  .admin-scheme-auto .btn-danger-sm {
    background: var(--admin-danger-light) !important;
    color: var(--admin-danger) !important;
    border-color: #5a2828 !important;
  }
  .admin-scheme-auto .btn-danger:hover,
  .admin-scheme-auto .btn-danger-sm:hover {
    background: #4a2424 !important;
    color: #ffb4b4 !important;
  }
  .admin-scheme-auto .btn-secondary {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
  }
}

/* ---------- Reset-Bestätigungs-Box: weniger grell ------------------------ */
.admin-scheme-dark .danger-form,
.admin-scheme-dark .reset-warn-panel {
  background: var(--surface) !important;
  border-color: #5a2828 !important;
}
.admin-scheme-dark .reset-final-btn {
  background: var(--admin-danger) !important;
  color: #1a1a1a !important;
  box-shadow: 0 4px 14px rgba(248,113,113,.25), 0 0 0 1px rgba(248,113,113,.4) inset !important;
}
.admin-scheme-dark .reset-final-btn:hover {
  background: #ff8f8f !important;
}
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto .danger-form,
  .admin-scheme-auto .reset-warn-panel {
    background: var(--surface) !important;
    border-color: #5a2828 !important;
  }
  .admin-scheme-auto .reset-final-btn {
    background: var(--admin-danger) !important;
    color: #1a1a1a !important;
  }
}

/* ---------- Quill-Editor + Toolbar -------------------------------------- */
.admin-scheme-dark #quill-editor-wrap,
.admin-scheme-dark .ql-toolbar,
.admin-scheme-dark .ql-container {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
.admin-scheme-dark .ql-toolbar button { color: var(--text); }
.admin-scheme-dark .ql-toolbar button:hover,
.admin-scheme-dark .ql-toolbar button.ql-active {
  background: var(--surface-2) !important;
  color: var(--primary) !important;
}
.admin-scheme-dark .ql-toolbar .ql-stroke { stroke: currentColor; }
.admin-scheme-dark .ql-toolbar .ql-fill   { fill:   currentColor; }
.admin-scheme-dark .ql-editor { color: var(--text); background: var(--surface); }
.admin-scheme-dark .ql-editor.ql-blank::before { color: var(--text-faint); }
.admin-scheme-dark .ql-toolbar .ql-picker-label,
.admin-scheme-dark .ql-toolbar .ql-picker-options {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto #quill-editor-wrap,
  .admin-scheme-auto .ql-toolbar,
  .admin-scheme-auto .ql-container {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
  }
  .admin-scheme-auto .ql-editor { color: var(--text); background: var(--surface); }
  .admin-scheme-auto .ql-editor.ql-blank::before { color: var(--text-faint); }
  .admin-scheme-auto .ql-toolbar button:hover,
  .admin-scheme-auto .ql-toolbar button.ql-active {
    background: var(--surface-2) !important;
    color: var(--primary) !important;
  }
  .admin-scheme-auto .ql-toolbar .ql-picker-label,
  .admin-scheme-auto .ql-toolbar .ql-picker-options {
    background: var(--surface) !important;
    color: var(--text) !important;
  }
}

/* ---------- Modals + Picker-Popovers ------------------------------------ */
.admin-scheme-dark .media-picker-dialog,
.admin-scheme-dark .fw-fontsize-popover,
.admin-scheme-dark .fw-textcolor-popover,
.admin-scheme-dark .fw-fontfamily-popover,
.admin-scheme-dark .sc-picker-dialog,
.admin-scheme-dark .wizard-error-popup {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow-lg) !important;
}
.admin-scheme-dark .fw-fontsize-popover .fw-fs-preset,
.admin-scheme-dark .fw-fontsize-popover .fw-fs-reset,
.admin-scheme-dark .fw-fontfamily-popover .fw-ff-item {
  background: var(--surface-2) !important;
  color: var(--text) !important;
}
.admin-scheme-dark .fw-fontsize-popover .fw-fs-preset:hover,
.admin-scheme-dark .fw-fontfamily-popover .fw-ff-item:hover {
  background: var(--surface-3) !important;
}
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto .media-picker-dialog,
  .admin-scheme-auto .fw-fontsize-popover,
  .admin-scheme-auto .fw-textcolor-popover,
  .admin-scheme-auto .fw-fontfamily-popover,
  .admin-scheme-auto .sc-picker-dialog,
  .admin-scheme-auto .wizard-error-popup {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
  }
}

/* ---------- Theme/Module-Cards + Pro-Toggle ----------------------------- */
.admin-scheme-dark .theme-card,
.admin-scheme-dark .module-card {
  background: var(--surface) !important;
  border-color: var(--border) !important;
}
.admin-scheme-dark .theme-card.is-selected,
.admin-scheme-dark .module-card.is-active {
  border-color: var(--primary) !important;
  background: var(--primary-soft) !important;
}
.admin-scheme-dark .theme-card h3,
.admin-scheme-dark .theme-card p { color: var(--text); }
.admin-scheme-dark .theme-card .theme-slug {
  background: var(--surface-2);
  color: var(--text-muted);
}
.admin-scheme-dark .pro-group {
  background: var(--surface) !important;
  border-color: var(--border) !important;
}
.admin-scheme-dark .pro-group > summary {
  background: var(--surface-2) !important;
  color: var(--text) !important;
}
.admin-scheme-dark .pro-group > summary:hover {
  background: var(--surface-3) !important;
}
.admin-scheme-dark .pro-toggle-track { background: #3a3f49; }
.admin-scheme-dark .pro-toggle input:checked ~ .pro-toggle-track { background: var(--primary); }
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto .theme-card,
  .admin-scheme-auto .module-card {
    background: var(--surface) !important;
    border-color: var(--border) !important;
  }
  .admin-scheme-auto .pro-group {
    background: var(--surface) !important;
    border-color: var(--border) !important;
  }
  .admin-scheme-auto .pro-group > summary {
    background: var(--surface-2) !important;
  }
  .admin-scheme-auto .pro-toggle-track { background: #3a3f49; }
}

/* ---------- Hero-Editor (Page-Edit) ------------------------------------- */
.admin-scheme-dark .hero-img-row,
.admin-scheme-dark .hero-field-group,
.admin-scheme-dark .hero-tabs__btn,
.admin-scheme-dark .tf-section,
.admin-scheme-dark .tf-repeater-row,
.admin-scheme-dark .img-preview {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text);
}
.admin-scheme-dark .hero-tabs__btn.is-active {
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
  border-color: var(--primary) !important;
}
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto .hero-img-row,
  .admin-scheme-auto .hero-field-group,
  .admin-scheme-auto .hero-tabs__btn,
  .admin-scheme-auto .tf-section,
  .admin-scheme-auto .tf-repeater-row,
  .admin-scheme-auto .img-preview {
    background: var(--surface) !important;
    border-color: var(--border) !important;
  }
  .admin-scheme-auto .hero-tabs__btn.is-active {
    background: var(--primary-soft) !important;
    color: var(--primary) !important;
  }
}

/* ---------- Code/Pre + Bestätigungs-Boxen ------------------------------- */
.admin-scheme-dark .danger-form .confirm-box code,
.admin-scheme-dark .preset-summary code {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border-color: var(--border);
}
.admin-scheme-dark .alt-warning {
  background: var(--warn-soft) !important;
  color: #fcd34d !important;
  border-color: #5a4416 !important;
}
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto .danger-form .confirm-box code,
  .admin-scheme-auto .preset-summary code {
    background: var(--surface-2) !important;
    color: var(--text) !important;
  }
  .admin-scheme-auto .alt-warning {
    background: var(--warn-soft) !important;
    color: #fcd34d !important;
    border-color: #5a4416 !important;
  }
}

/* ---------- Menu-Tree + Color-Hex-Input + Switches ---------------------- */
.admin-scheme-dark .menu-tree-item:hover,
.admin-scheme-dark .mti-label:focus {
  background: var(--surface-2) !important;
  color: var(--text) !important;
}
.admin-scheme-dark .color-hex-input {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
.admin-scheme-dark .color-hex-input.is-invalid {
  background: #3a1c1c !important;
  color: #fca5a5 !important;
  border-color: #7a3838 !important;
}
.admin-scheme-dark .slider:before,
.admin-scheme-dark .switch-slider::before { background: #cbd5e1; }
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto .menu-tree-item:hover,
  .admin-scheme-auto .mti-label:focus {
    background: var(--surface-2) !important;
    color: var(--text) !important;
  }
  .admin-scheme-auto .color-hex-input {
    background: var(--surface-2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
  }
}

/* ---------- Dashboard-Hero + Action-Tiles ------------------------------- */
.admin-scheme-dark .dash-hero-actions .btn-primary,
.admin-scheme-dark .action-tile span {
  background: var(--primary) !important;
  color: #fff !important;
}
.admin-scheme-dark .action-tile {
  background: var(--surface) !important;
  border-color: var(--border) !important;
}
.admin-scheme-dark .action-tile:hover {
  background: var(--surface-2) !important;
}
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto .action-tile {
    background: var(--surface) !important;
    border-color: var(--border) !important;
  }
}

/* ---------- Scrollbar im Dark-Look (nur Webkit) ------------------------- */
.admin-scheme-dark ::-webkit-scrollbar { width: 12px; height: 12px; }
.admin-scheme-dark ::-webkit-scrollbar-track { background: var(--bg); }
.admin-scheme-dark ::-webkit-scrollbar-thumb {
  background: #3a3f49;
  border-radius: 6px;
  border: 2px solid var(--bg);
}
.admin-scheme-dark ::-webkit-scrollbar-thumb:hover { background: #4a4f59; }

/* ==========================================================================
   FEIN-TUNING: schwarz-auf-schwarz und Hover-Hintergründe
   --------------------------------------------------------------------------
   Diverse Stellen in admin.css haben `color: #1a1a1a` / `#333` und Hover-
   Hintergründe wie `#f8fafc`, `#f1f5f9`, `#eef2f7`. Bei einer leicht
   höheren Specificity (zwei Klassen) bleiben die im Dark-Mode aktiv und
   produzieren unleserliche Inhalte. Wir kontern hier zentral.
   ========================================================================== */

/* ----- Settings-Sidebar (Hauptbeschwerde: schwarz auf schwarz) ----------- */
.admin-scheme-dark .settings-tabs,
.admin-scheme-dark .settings-tabs a,
.admin-scheme-dark .settings-tab {
  color: var(--text) !important;
}
.admin-scheme-dark .settings-tabs a:hover,
.admin-scheme-dark .settings-tab:hover {
  background: var(--surface-2) !important;
  color: var(--text) !important;
}
.admin-scheme-dark .settings-tabs a.active,
.admin-scheme-dark .settings-tab.is-active,
.admin-scheme-dark .settings-tab.active {
  background: var(--primary-soft) !important;
  color: var(--primary) !important;
  border-left-color: var(--primary) !important;
}
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto .settings-tabs,
  .admin-scheme-auto .settings-tabs a,
  .admin-scheme-auto .settings-tab {
    color: var(--text) !important;
  }
  .admin-scheme-auto .settings-tabs a:hover,
  .admin-scheme-auto .settings-tab:hover {
    background: var(--surface-2) !important;
    color: var(--text) !important;
  }
  .admin-scheme-auto .settings-tabs a.active,
  .admin-scheme-auto .settings-tab.is-active,
  .admin-scheme-auto .settings-tab.active {
    background: var(--primary-soft) !important;
    color: var(--primary) !important;
    border-left-color: var(--primary) !important;
  }
}

/* ----- Universelle Hover-Hintergründe abfangen --------------------------- */
/* admin.css setzt diverse :hover auf #f8fafc / #f1f5f9 / #eef2f7 / #fafbfc.
   Im Dark-Mode flackern diese plötzlich grell auf. Auf var(--surface-2). */
.admin-scheme-dark .btn-secondary:hover,
.admin-scheme-dark .btn-sm:hover,
.admin-scheme-dark .pro-group > summary:hover,
.admin-scheme-dark .editor-toolbar button:hover,
.admin-scheme-dark .radio-option:hover,
.admin-scheme-dark .data-table tbody tr:hover,
.admin-scheme-dark .data-table tbody tr:hover td,
.admin-scheme-dark .menu-tree-item:hover,
.admin-scheme-dark .theme-card:hover,
.admin-scheme-dark .module-card:hover,
.admin-scheme-dark .media-item:hover,
.admin-scheme-dark .picker-item:hover,
.admin-scheme-dark .stat-card:hover,
.admin-scheme-dark .action-tile:hover,
.admin-scheme-dark .dashboard-section:hover,
.admin-scheme-dark .nav-link:hover,
.admin-scheme-dark .dropdown-item:hover {
  background: var(--surface-2) !important;
  color: var(--text) !important;
}
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto .btn-secondary:hover,
  .admin-scheme-auto .btn-sm:hover,
  .admin-scheme-auto .pro-group > summary:hover,
  .admin-scheme-auto .editor-toolbar button:hover,
  .admin-scheme-auto .radio-option:hover,
  .admin-scheme-auto .data-table tbody tr:hover,
  .admin-scheme-auto .data-table tbody tr:hover td,
  .admin-scheme-auto .menu-tree-item:hover,
  .admin-scheme-auto .theme-card:hover,
  .admin-scheme-auto .module-card:hover,
  .admin-scheme-auto .media-item:hover,
  .admin-scheme-auto .picker-item:hover,
  .admin-scheme-auto .stat-card:hover,
  .admin-scheme-auto .action-tile:hover,
  .admin-scheme-auto .dashboard-section:hover,
  .admin-scheme-auto .nav-link:hover,
  .admin-scheme-auto .dropdown-item:hover {
    background: var(--surface-2) !important;
    color: var(--text) !important;
  }
}

/* ----- Light-Backgrounds in nicht-hover Zustand ------------------------- */
.admin-scheme-dark .data-table thead,
.admin-scheme-dark .data-table th,
.admin-scheme-dark .tag-muted,
.admin-scheme-dark .tag-info,
.admin-scheme-dark .tag-secondary,
.admin-scheme-dark .form-card,
.admin-scheme-dark .info-box,
.admin-scheme-dark .panel-info,
.admin-scheme-dark .well,
.admin-scheme-dark .sidebar-box,
.admin-scheme-dark .code-block,
.admin-scheme-dark .bg-light,
.admin-scheme-dark .toolbar-row,
.admin-scheme-dark fieldset {
  background: var(--surface-2) !important;
  color: var(--text);
  border-color: var(--border);
}
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto .data-table thead,
  .admin-scheme-auto .data-table th,
  .admin-scheme-auto .tag-muted,
  .admin-scheme-auto .tag-info,
  .admin-scheme-auto .tag-secondary,
  .admin-scheme-auto .form-card,
  .admin-scheme-auto .info-box,
  .admin-scheme-auto .panel-info,
  .admin-scheme-auto .well,
  .admin-scheme-auto .sidebar-box,
  .admin-scheme-auto .code-block,
  .admin-scheme-auto .bg-light,
  .admin-scheme-auto .toolbar-row,
  .admin-scheme-auto fieldset {
    background: var(--surface-2) !important;
    color: var(--text);
    border-color: var(--border);
  }
}

/* ----- Schwarze und dunkelgraue Texte aufhellen ------------------------- */
/* `color: #1a1a1a`, `color: #333`, `color: #1a1f2a` werden von einigen
   Komponenten direkt gesetzt und überschreiben var(--admin-text). */
.admin-scheme-dark .btn-sm,
.admin-scheme-dark .btn-secondary,
.admin-scheme-dark .fw-fontsize-popover,
.admin-scheme-dark .fw-fontsize-popover .fw-fs-step,
.admin-scheme-dark .fw-fontsize-popover .fw-fs-preset,
.admin-scheme-dark .fw-fontsize-popover .fw-fs-reset,
.admin-scheme-dark .fw-fontfamily-popover .fw-ff-item,
.admin-scheme-dark .fw-textcolor-popover,
.admin-scheme-dark .fw-textcolor-popover label,
.admin-scheme-dark .ql-editor,
.admin-scheme-dark .ql-editor p,
.admin-scheme-dark .ql-editor .fw-image__side,
.admin-scheme-dark .menu-tree-item,
.admin-scheme-dark .menu-tree-item .mti-label,
.admin-scheme-dark .form-label,
.admin-scheme-dark legend,
.admin-scheme-dark fieldset legend {
  color: var(--text) !important;
}
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto .btn-sm,
  .admin-scheme-auto .btn-secondary,
  .admin-scheme-auto .fw-fontsize-popover,
  .admin-scheme-auto .fw-fontsize-popover .fw-fs-step,
  .admin-scheme-auto .fw-fontsize-popover .fw-fs-preset,
  .admin-scheme-auto .fw-fontsize-popover .fw-fs-reset,
  .admin-scheme-auto .fw-fontfamily-popover .fw-ff-item,
  .admin-scheme-auto .fw-textcolor-popover,
  .admin-scheme-auto .fw-textcolor-popover label,
  .admin-scheme-auto .ql-editor,
  .admin-scheme-auto .ql-editor p,
  .admin-scheme-auto .ql-editor .fw-image__side,
  .admin-scheme-auto .menu-tree-item,
  .admin-scheme-auto .menu-tree-item .mti-label,
  .admin-scheme-auto .form-label,
  .admin-scheme-auto legend,
  .admin-scheme-auto fieldset legend {
    color: var(--text) !important;
  }
}

/* ----- Headings in Dashboard- und Settings-Boxen ------------------------ */
/* `.dashboard-section h2 { color: #0a6ebd }` ist im Dark-Mode okay (Blau
   liest sich auf dunklem BG noch), aber heller Akzent wirkt schöner. */
.admin-scheme-dark .dashboard-section h2,
.admin-scheme-dark .settings-section h2,
.admin-scheme-dark .section-head h2,
.admin-scheme-dark .form-card h2,
.admin-scheme-dark .empty-state h2 {
  color: var(--primary) !important;
}
.admin-scheme-dark .section-subtitle,
.admin-scheme-dark .form-hint,
.admin-scheme-dark .help-text,
.admin-scheme-dark .stat-label,
.admin-scheme-dark .empty-state p,
.admin-scheme-dark .message-header,
.admin-scheme-dark .media-info,
.admin-scheme-dark .media-name,
.admin-scheme-dark .module-body p,
.admin-scheme-dark .theme-card-inner p,
.admin-scheme-dark .slug-prefix {
  color: var(--text-muted) !important;
}
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto .dashboard-section h2,
  .admin-scheme-auto .settings-section h2,
  .admin-scheme-auto .section-head h2,
  .admin-scheme-auto .form-card h2,
  .admin-scheme-auto .empty-state h2 {
    color: var(--primary) !important;
  }
  .admin-scheme-auto .section-subtitle,
  .admin-scheme-auto .form-hint,
  .admin-scheme-auto .help-text,
  .admin-scheme-auto .stat-label,
  .admin-scheme-auto .empty-state p,
  .admin-scheme-auto .message-header,
  .admin-scheme-auto .media-info,
  .admin-scheme-auto .media-name,
  .admin-scheme-auto .module-body p,
  .admin-scheme-auto .theme-card-inner p,
  .admin-scheme-auto .slug-prefix {
    color: var(--text-muted) !important;
  }
}

/* ----- Form-Elemente: Border und disabled-State ------------------------- */
.admin-scheme-dark input:disabled,
.admin-scheme-dark textarea:disabled,
.admin-scheme-dark select:disabled,
.admin-scheme-dark .input-disabled {
  background: var(--surface-3) !important;
  color: var(--text-faint) !important;
  border-color: var(--border) !important;
}
.admin-scheme-dark hr,
.admin-scheme-dark .divider {
  border-color: var(--border) !important;
}
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto input:disabled,
  .admin-scheme-auto textarea:disabled,
  .admin-scheme-auto select:disabled,
  .admin-scheme-auto .input-disabled {
    background: var(--surface-3) !important;
    color: var(--text-faint) !important;
    border-color: var(--border) !important;
  }
  .admin-scheme-auto hr,
  .admin-scheme-auto .divider { border-color: var(--border) !important; }
}

/* ----- Tag-Bubbles farbig aber dezent im Dark-Mode --------------------- */
.admin-scheme-dark .tag-success {
  background: var(--success-soft) !important;
  color: #4ade80 !important;
}
.admin-scheme-dark .kpi-pages .kpi-icon,
.admin-scheme-dark .kpi-icon.kpi-pages {
  background: #1e2a4a !important;
  color: #93c5fd !important;
}
.admin-scheme-dark .kpi-media .kpi-icon,
.admin-scheme-dark .kpi-icon.kpi-media {
  background: #2a1e4a !important;
  color: #c4b5fd !important;
}
.admin-scheme-dark .kpi-messages .kpi-icon,
.admin-scheme-dark .kpi-icon.kpi-messages {
  background: #1e3a2a !important;
  color: #86efac !important;
}
.admin-scheme-dark .mti-type.url.is-internal {
  background: #1e3a3a !important;
  color: #67e8f9 !important;
}
.admin-scheme-dark .mti-type.separator {
  background: var(--surface-3) !important;
  color: var(--text-muted) !important;
}
@media (prefers-color-scheme: dark) {
  .admin-scheme-auto .tag-success {
    background: var(--success-soft) !important;
    color: #4ade80 !important;
  }
  .admin-scheme-auto .mti-type.url.is-internal {
    background: #1e3a3a !important;
    color: #67e8f9 !important;
  }
  .admin-scheme-auto .mti-type.separator {
    background: var(--surface-3) !important;
    color: var(--text-muted) !important;
  }
}

/* ---------- Dashboard-Panels per Drag anordnen -------------------------- */
.dash-cols .panel-collapsible > summary.panel-head { padding-left: 2.4rem; }
.dash-drag {
  position: absolute;
  left: .55rem;
  top: 50%;
  transform: translateY(-50%);
  cursor: grab;
  color: var(--text-faint);
  font-size: 14px;
  line-height: 1;
  letter-spacing: -2px;
  padding: 4px 3px;
  border-radius: 6px;
  opacity: .35;
  transition: opacity .12s, background .12s, color .12s;
}
.panel-collapsible > summary.panel-head:hover .dash-drag { opacity: 1; }
.dash-drag:hover { background: var(--surface-3); color: var(--text-muted); }
.dash-drag:active { cursor: grabbing; }
details.panel-collapsible.dragging {
  opacity: .55;
  box-shadow: var(--shadow-lg);
}
.dash-col.drop-target {
  outline: 2px dashed var(--primary);
  outline-offset: 4px;
  border-radius: var(--radius-lg);
}
