/* Bauherrenportal - Admin Styles (Standalone)
   Dark theme matching portal.css
*/

:root {
  --brand-primary: #e8650a;
  --bp-bg: #0f0f0f;
  --bp-surface: #1a1a1a;
  --bp-surface-2: #222;
  --bp-border: #2e2e2e;
  --bp-orange: var(--brand-primary, #e8650a);
  --bp-orange-light: color-mix(in srgb, var(--brand-primary, #e8650a) 80%, #fff);
  --bp-text: #f0f0f0;
  /* A11y: #b0b0b0 gibt ~6.5:1 Kontrast auf --bp-surface (#1a1a1a), vorher #999 = nur ~4.7:1 */
  --bp-text-muted: #b0b0b0;
  --bp-radius: 8px;
  --bp-nav-h: 56px;
  --bp-transition: 0.18s ease;

  /* Status-Farben (VA-18, zentralisiert statt in jedem Modul neu) */
  --status-ok:        #22c55e;
  --status-warn:      #f59e0b;
  --status-err:       #ef4444;
  --status-info:      #3b82f6;
  --status-neutral:   #9ca3af;

  /* Severity (VA-18, einheitliche Mangel-/Formular-Schweregrade) */
  --sev-low:      #6b7280;
  --sev-medium:   #f59e0b;
  --sev-high:     #ef4444;
  --sev-critical: #dc2626;

  /* Spacing Tokens (VA-17) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Radius Tokens */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 999px;

  /* Shadow Tokens */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.2);
  --shadow-md: 0 4px 8px rgba(0,0,0,.3);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.4);

  /* Font-Sizes (VA-16 Basis — 7 Stufen) */
  --fs-xs:  .72rem;
  --fs-sm:  .82rem;
  --fs-md:  .9rem;
  --fs-base: 1rem;
  --fs-lg:  1.15rem;
  --fs-xl:  1.35rem;
  --fs-2xl: 1.75rem;
}

/* Font-Size-Utilities (VA-16: neue Komponenten nutzen Tokens statt Literale) */
.fs-xs   { font-size: var(--fs-xs); }
.fs-sm   { font-size: var(--fs-sm); }
.fs-md   { font-size: var(--fs-md); }
.fs-base { font-size: var(--fs-base); }
.fs-lg   { font-size: var(--fs-lg); }
.fs-xl   { font-size: var(--fs-xl); }
.fs-2xl  { font-size: var(--fs-2xl); }

/* Color-Utilities */
.text-muted { color: var(--bp-text-muted); }
.text-accent { color: var(--bp-orange); }
.text-ok { color: var(--status-ok); }
.text-warn { color: var(--status-warn); }
.text-err { color: var(--status-err); }

/* Severity-Badge Utility (VA-50: Icon + Farbe + Text statt nur Farbe) */
.sev-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
  line-height: 1.4;
}
.sev-badge::before { font-size: .85em; }
.sev-badge.sev-low      { background: color-mix(in srgb, var(--sev-low) 20%, transparent); color: var(--sev-low); }
.sev-badge.sev-low::before      { content: '○'; }
.sev-badge.sev-medium   { background: color-mix(in srgb, var(--sev-medium) 20%, transparent); color: var(--sev-medium); }
.sev-badge.sev-medium::before   { content: '!'; font-weight: 700; }
.sev-badge.sev-high     { background: color-mix(in srgb, var(--sev-high) 20%, transparent); color: var(--sev-high); }
.sev-badge.sev-high::before     { content: '!!'; font-weight: 700; }
.sev-badge.sev-critical { background: var(--sev-critical); color: #fff; }
.sev-badge.sev-critical::before { content: '⚠'; }

/* Status-Badge Utility */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--r-full);
  font-size: var(--fs-xs); font-weight: 600;
}
.status-badge.ok   { background: color-mix(in srgb, var(--status-ok) 20%, transparent); color: var(--status-ok); }
.status-badge.warn { background: color-mix(in srgb, var(--status-warn) 20%, transparent); color: var(--status-warn); }
.status-badge.err  { background: color-mix(in srgb, var(--status-err) 20%, transparent); color: var(--status-err); }
.status-badge.info { background: color-mix(in srgb, var(--status-info) 20%, transparent); color: var(--status-info); }

/* Standardisierte Dialog-Klassen (VA-22) — mobile bottom-sheet (VA-23) */
dialog.bp-dialog {
  padding: 0;
  border: 1px solid var(--bp-border);
  border-radius: var(--r-lg);
  background: var(--bp-surface);
  color: var(--bp-text);
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow: auto;
}
dialog.bp-dialog-sm { width: min(92vw, 420px); }
dialog.bp-dialog-md { width: min(92vw, 640px); }
dialog.bp-dialog-lg { width: min(94vw, 900px); }
dialog.bp-dialog::backdrop { background: rgba(0,0,0,.5); backdrop-filter: blur(3px); }
dialog.bp-dialog-head {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--bp-border);
  display: flex; justify-content: space-between; align-items: center;
}
dialog.bp-dialog-body { padding: var(--space-4); }
dialog.bp-dialog-foot {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--bp-border);
  display: flex; gap: var(--space-2); justify-content: flex-end;
}

/* Mobile: Bottom-Sheet-Style (VA-23) — dialog rutscht von unten rein */
@media (max-width: 640px) {
  dialog.bp-dialog {
    width: 100vw !important;
    max-width: none !important;
    max-height: 92vh;
    margin: 0;
    margin-top: auto;
    margin-bottom: 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    border-bottom: 0;
    animation: bp-dialog-slideup .25s ease-out;
  }
  dialog.bp-dialog::backdrop { animation: bp-dialog-fade .25s ease-out; }
  @keyframes bp-dialog-slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
  @keyframes bp-dialog-fade { from { opacity: 0; } to { opacity: 1; } }
}

/* Skeleton-Screens (VA-20): Placeholder-Animation waehrend Daten laden */
.bp-skel {
  display: inline-block;
  background: linear-gradient(90deg, var(--bp-surface-2) 0%, var(--bp-border) 50%, var(--bp-surface-2) 100%);
  background-size: 200% 100%;
  animation: bp-skel-pulse 1.5s ease-in-out infinite;
  border-radius: var(--r-sm);
  color: transparent;
  pointer-events: none;
}
@keyframes bp-skel-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.bp-skel-line { height: 12px; width: 100%; margin: 4px 0; }
.bp-skel-box { height: 80px; width: 100%; }
.bp-skel-text-lg { height: 24px; width: 60%; }
.bp-skel-text-sm { height: 10px; width: 40%; }


/* ── A11y-Basics (VA-47 bis VA-49) ─────────────────────────────────────── */
/* Sichtbarer Fokus-Ring fuer Tastatur-Navigation (mouse/touch unbeeinflusst) */
:focus-visible {
  outline: 2px solid var(--bp-orange);
  outline-offset: 2px;
  border-radius: 3px;
}
/* Skip-Link fuer Screenreader/Tastatur */
.bp-skip-link {
  position: absolute;
  top: -40px;
  left: 8px;
  z-index: 10000;
  background: var(--bp-orange);
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  border-radius: 4px;
  font-size: var(--fs-md);
}
.bp-skip-link:focus { top: 8px; }

/* Light Mode — gilt auch fuer Standalone-Seiten (Login, Register, Forum-AGB, Verify) */
body.light-mode {
  --bp-bg: #f5f5f5;
  --bp-surface: #ffffff;
  --bp-surface-2: #f0f0f0;
  --bp-border: #e0e0e0;
  --bp-text: #1a1a1a;
  --bp-text-muted: #666;
}
body.light-mode { background: var(--bp-bg); color: var(--bp-text); }
body.light-mode input, body.light-mode textarea, body.light-mode select {
  color: var(--bp-text);
}
/* Admin-Page-spezifische Overrides (Header, Nav etc.) wie bisher */
body.admin-page.light-mode {
  --bp-bg: #f5f5f5;
  --bp-surface: #ffffff;
  --bp-surface-2: #f0f0f0;
  --bp-border: #e0e0e0;
  --bp-text: #1a1a1a;
  --bp-text-muted: #666;
}
body.admin-page.light-mode .admin-header { background: rgba(255,255,255,.95); border-bottom-color: #e0e0e0; }
body.admin-page.light-mode .admin-nav-link { color: #555; }
body.admin-page.light-mode .admin-nav-link.active { color: var(--bp-orange); }
body.admin-page.light-mode .admin-footer { background: #fff; border-top-color: #e0e0e0; }
body.admin-page.light-mode .admin-table th { background: #f5f5f5; }
body.admin-page.light-mode .admin-modal-inner,
body.admin-page.light-mode .admin-section,
body.admin-page.light-mode .admin-card,
body.admin-page.light-mode .admin-detail-card { background: #fff; }
body.admin-page.light-mode .admin-form-input,
body.admin-page.light-mode .admin-form-select,
body.admin-page.light-mode .admin-form-textarea { background: #f8f8f8; color: #1a1a1a; }
body.admin-page.light-mode .admin-btn-ghost { color: #555; border-color: #ddd; }
body.admin-page.light-mode .admin-btn-ghost:hover { border-color: var(--bp-orange); color: #333; }

/* Theme select dropdown in header */
#themeSelect { -webkit-appearance:none; appearance:none; padding-right:20px; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 6px center; }
#themeSelect:focus { outline:none; border-color:var(--bp-orange); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow-x: hidden; }

body.admin-page {
  background: var(--bp-bg);
  color: var(--bp-text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: var(--fs-md);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ====================================================
   Header
   ==================================================== */
.admin-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15, 15, 15, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bp-border);
  height: var(--bp-nav-h);
}
.admin-header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; gap: 24px;
  height: 100%; padding: 0 20px;
}
.admin-logo {
  font-weight: 700;
  font-size: var(--fs-base);
  color: var(--bp-text);
  text-decoration: none;
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.admin-logo-badge {
  font-size: var(--fs-xs);
  background: var(--bp-orange);
  color: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 700;
  text-transform: uppercase;
}
.admin-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.admin-nav-link {
  color: var(--bp-text-muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: var(--bp-radius);
  font-size: var(--fs-md);
  font-weight: 500;
  transition: color var(--bp-transition), background var(--bp-transition);
}
.admin-nav-link:hover {
  color: var(--bp-text);
  background: rgba(255, 255, 255, .05);
}
.admin-nav-link.active {
  color: var(--bp-orange);
}
.admin-header-actions {
  margin-left: 12px;
}

/* ====================================================
   Buttons (shared)
   ==================================================== */
.admin-btn {
  padding: 8px 16px;
  border-radius: var(--bp-radius);
  font-size: var(--fs-md);
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--bp-transition);
  font-family: inherit;
}
.admin-btn-ghost {
  background: transparent;
  color: var(--bp-text-muted);
  border: 1px solid var(--bp-border);
}
.admin-btn-ghost:hover {
  color: var(--bp-text);
  border-color: var(--bp-text-muted);
}
.admin-btn-primary {
  background: var(--bp-orange);
  color: #fff;
  border: 1px solid transparent;
}
.admin-btn-primary:hover {
  filter: brightness(1.1);
}
.admin-btn-danger {
  background: rgba(220,53,69,.15);
  color: #f87171;
  border: 1px solid rgba(220,53,69,.3);
}
.admin-btn-danger:hover {
  background: rgba(220,53,69,.25);
}
.admin-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ====================================================
   Main layout
   ==================================================== */
.admin-main {
  flex: 1;
  padding: 32px 0;
}
.admin-container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}
.admin-heading {
  font-size: var(--fs-xl);
  font-weight: 700;
  margin-bottom: 6px;
}
.admin-subtext {
  color: var(--bp-text-muted);
  margin-bottom: 24px;
  font-size: var(--fs-md);
}

/* ====================================================
   Cards (dashboard overview)
   ==================================================== */
.admin-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 900px) {
  .admin-card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .admin-card-grid { grid-template-columns: 1fr; }
}
.admin-card {
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: 12px;
  padding: 22px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
body.admin-page.light-mode .admin-card {
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.admin-card-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--bp-orange);
  margin-bottom: 8px;
}
.admin-card-value {
  font-size: var(--fs-2xl);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
}
.admin-card-value-sm {
  font-size: var(--fs-lg);
}
.admin-card-meta {
  font-size: var(--fs-xs);
  color: var(--bp-text-muted);
  margin-top: 6px;
}
.admin-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--bp-transition), transform .18s ease, box-shadow .18s ease;
}
.admin-card-link:hover {
  border-color: var(--bp-orange);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(232,101,10,.1);
}

/* ====================================================
   Tables
   ==================================================== */
.admin-table-wrap {
  overflow-x: auto;
  margin-bottom: 24px;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-md);
}
.admin-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--bp-text-muted);
  border-bottom: 1px solid var(--bp-border);
  white-space: nowrap;
}
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--bp-border);
  vertical-align: middle;
}
.admin-table tr:hover td {
  background: rgba(255, 255, 255, .02);
}
.admin-table-actions {
  display: flex;
  gap: 6px;
}

/* ====================================================
   Status badges
   ==================================================== */
.admin-badge {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
}
.admin-badge-active {
  background: rgba(80, 200, 80, .12);
  color: #6de06d;
}
.admin-badge-inactive {
  background: rgba(255, 255, 255, .06);
  color: var(--bp-text-muted);
}
.admin-badge-primary {
  background: rgba(232, 101, 10, .15);
  color: var(--bp-orange);
}

/* ====================================================
   Forms
   ==================================================== */
.admin-form {
  max-width: 560px;
}
.admin-form-row {
  margin-bottom: 16px;
}
.admin-form-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--bp-text-muted);
  margin-bottom: 6px;
}
.admin-form-input,
.admin-form-select,
.admin-form-textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  background: var(--bp-surface);
  color: var(--bp-text);
  font: inherit;
  font-size: var(--fs-md);
  transition: border-color var(--bp-transition);
}
.admin-form-input:focus,
.admin-form-select:focus,
.admin-form-textarea:focus {
  outline: none;
  border-color: var(--bp-orange);
}
.admin-form-textarea {
  resize: vertical;
  min-height: 80px;
}
.admin-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.admin-form-hint {
  font-size: var(--fs-xs);
  color: var(--bp-text-muted);
  margin-top: 4px;
}

/* ====================================================
   Color picker preview
   ==================================================== */
.admin-color-preview {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.admin-color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--bp-border);
  cursor: pointer;
}
.admin-color-swatch::-webkit-color-swatch-wrapper { padding: 0; }
.admin-color-swatch::-webkit-color-swatch { border: none; border-radius: 5px; }

/* ====================================================
   Modals
   ==================================================== */
.admin-modal {
  border: none;
  border-radius: var(--bp-radius);
  background: var(--bp-bg);
  color: var(--bp-text);
  padding: 0;
  max-width: 520px;
  width: 92vw;
  margin: auto;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
}
.admin-modal::backdrop {
  background: rgba(0,0,0,.55);
}
.admin-modal-inner {
  padding: 24px;
}
.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.admin-modal-header h2 {
  font-size: var(--fs-lg);
  font-weight: 700;
  margin: 0;
}
.admin-modal-close {
  background: none;
  border: none;
  color: var(--bp-text-muted);
  font-size: var(--fs-xl);
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.admin-modal-close:hover {
  color: var(--bp-text);
}

/* ====================================================
   Section dividers
   ==================================================== */
.admin-section {
  margin-top: 32px;
}
.admin-detail-card {
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  padding: 24px 28px;
}
.admin-section-heading {
  font-size: var(--fs-lg);
  font-weight: 600;
  margin-bottom: 16px;
}
.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 24px;
}

/* ====================================================
   Messages / alerts
   ==================================================== */
.admin-alert {
  padding: 12px 16px;
  border-radius: var(--bp-radius);
  font-size: var(--fs-sm);
  margin-bottom: 16px;
}
.admin-alert-success {
  background: rgba(40,167,69,.12);
  color: #4ade80;
  border: 1px solid rgba(40,167,69,.25);
}
.admin-alert-error {
  background: rgba(220,53,69,.12);
  color: #f87171;
  border: 1px solid rgba(220,53,69,.25);
}
.admin-alert[hidden] {
  display: none;
}

/* ====================================================
   Loading / Spinner
   ==================================================== */
.admin-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 0;
  color: var(--bp-text-muted);
}
.admin-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--bp-border);
  border-top-color: var(--bp-orange);
  border-radius: 50%;
  animation: admin-spin .6s linear infinite;
}
@keyframes admin-spin { to { transform: rotate(360deg); } }

/* ====================================================
   Notification Bell
   ==================================================== */
.notif-bell-btn {
  position: relative;
  padding: 6px 8px !important;
}
.notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  background: #dc2626;
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  border-radius: 100px;
  padding: 0 4px;
}
.notif-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 340px;
  max-height: 400px;
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  z-index: 1000;
  overflow: hidden;
}
.notif-dropdown[hidden] { display: none; }
.notif-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--bp-border);
  font-size: var(--fs-sm);
}
.notif-mark-all {
  background: none;
  border: none;
  color: var(--bp-orange);
  font-size: var(--fs-xs);
  cursor: pointer;
  padding: 0;
}
.notif-dropdown-list {
  max-height: 340px;
  overflow-y: auto;
}
.notif-item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--bp-border);
  text-decoration: none;
  color: var(--bp-text);
  font-size: var(--fs-sm);
  transition: background var(--bp-transition);
}
.notif-item:hover { background: var(--bp-surface-2); }
.notif-item.unread { border-left: 3px solid var(--bp-orange); }
.notif-item-title { font-weight: 600; margin-bottom: 2px; }
.notif-item-time { color: var(--bp-text-muted); font-size: var(--fs-xs); }
.notif-empty {
  padding: 24px;
  text-align: center;
  color: var(--bp-text-muted);
  font-size: var(--fs-sm);
}

/* ====================================================
   Footer
   ==================================================== */
.admin-footer {
  padding: 20px 0;
  border-top: 1px solid var(--bp-border);
  font-size: var(--fs-xs);
  color: var(--bp-text-muted);
  text-align: center;
}

/* ====================================================
   Toolbar row (heading + action button)
   ==================================================== */
.admin-back-link {
  display: inline-block;
  color: var(--bp-text-muted);
  text-decoration: none;
  font-size: var(--fs-sm);
  margin-bottom: 16px;
  transition: color var(--bp-transition);
}
.admin-back-link:hover {
  color: var(--bp-text);
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

/* ====================================================
   Feature flag toggles
   ==================================================== */
.admin-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--bp-border);
  font-size: var(--fs-md);
}
.admin-toggle-label {
  font-weight: 500;
}
.admin-toggle {
  position: relative;
  width: 40px;
  height: 22px;
}
.admin-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.admin-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bp-border);
  border-radius: 11px;
  cursor: pointer;
  transition: background var(--bp-transition);
}
.admin-toggle-slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--bp-transition);
}
.admin-toggle input:checked + .admin-toggle-slider {
  background: var(--bp-orange);
}
.admin-toggle input:checked + .admin-toggle-slider::before {
  transform: translateX(18px);
}

/* ====================================================
   Hamburger Button (hidden on desktop)
   ==================================================== */
.admin-hamburger { display: none; }

/* ====================================================
   Bottom Tab Bar (hidden on desktop)
   ==================================================== */
.bp-bottom-nav { display: none; }

/* ====================================================
   MOBILE  (max-width: 768px)
   ==================================================== */
@media (max-width: 768px) {
  :root {
    --bp-bottom-nav-h: 56px;
  }

  body.admin-page {
    padding-bottom: calc(var(--bp-bottom-nav-h) + env(safe-area-inset-bottom, 0px));
    font-size: var(--fs-md);
  }

  /* ── Header ── */
  .admin-header { height: auto; min-height: var(--bp-nav-h); }
  .admin-header-inner { padding: 0 12px; gap: 8px; flex-wrap: wrap; }
  .admin-logo { font-size: var(--fs-md); }

  /* Nav ausblenden */
  .admin-nav {
    display: none;
    position: fixed; top: var(--bp-nav-h); left: 0; right: 0; bottom: 0;
    background: var(--bp-bg); z-index: 200;
    flex-direction: column; padding: 16px; gap: 4px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: slideDown .2s ease;
  }
  @keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
  .admin-nav.is-open { display: flex; }
  .admin-nav-link { font-size: var(--fs-base); padding: 14px 16px; border-radius: var(--bp-radius); }
  .admin-nav-link:hover, .admin-nav-link.active { background: var(--bp-surface); }

  /* Hamburger oben ausgeblendet — Navigation läuft ausschließlich über Bottom-Nav.
     Das DOM-Element bleibt, damit "Mehr"-Button unten via hamburger.click() weiterhin
     das Seitenmenü togglen kann (Portal + Logout erscheinen als Overlay). */
  .admin-hamburger { display: none !important; }
  .admin-hamburger span {
    display: block; height: 2px; width: 20px;
    background: var(--bp-text); border-radius: 1px;
    transition: transform .2s, opacity .2s;
  }
  .admin-hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .admin-hamburger.is-open span:nth-child(2) { opacity: 0; }
  .admin-hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* Header-Actions im Hamburger */
  .admin-header-actions { display: none; }
  .admin-nav.is-open ~ .admin-header-actions,
  .admin-header-inner:has(.admin-nav.is-open) .admin-header-actions {
    display: flex; flex-direction: column; gap: 8px;
    position: fixed; bottom: 80px; left: 16px; right: 16px; z-index: 201;
  }

  /* ── Main & Container ── */
  .admin-main { padding: 16px 0; }
  .admin-container { padding: 0 12px; }
  .admin-heading { font-size: var(--fs-lg); }
  .admin-subtext { font-size: var(--fs-sm); margin-bottom: 16px; }

  /* ── Toolbar ── */
  .admin-toolbar {
    flex-direction: column; align-items: stretch; gap: 10px;
  }
  .admin-toolbar > div { display: flex; gap: 8px; flex-wrap: wrap; }

  /* ── Cards ── */
  .admin-card-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .admin-card { padding: 14px; }
  .admin-card-value { font-size: var(--fs-xl); }

  /* ── Tables ── */
  .admin-table-wrap { -webkit-overflow-scrolling: touch; }
  .admin-table { font-size: var(--fs-xs); }
  .admin-table th { padding: 8px 10px; font-size: var(--fs-xs); }
  .admin-table td { padding: 10px; }

  /* ── Forms ── */
  .admin-form { max-width: 100%; }
  .admin-form-grid { grid-template-columns: 1fr; }
  .admin-detail-card { padding: 18px 16px; }
  .admin-form-actions { flex-direction: column; }
  .admin-form-actions .admin-btn { width: 100%; text-align: center; }
  .admin-form-input, .admin-form-select, .admin-form-textarea {
    font-size: 16px; /* Verhindert iOS-Zoom */
    min-height: 44px;
  }

  /* ── Buttons Touch-Targets ── */
  .admin-btn { min-height: 44px; padding: 10px 16px; }

  /* ── Modals ── */
  .admin-modal {
    width: 100vw; max-width: 100vw; height: 100vh; max-height: 100dvh;
    border-radius: 0; top: 0; left: 0; transform: none;
  }
  .admin-modal-inner { padding: 16px; padding-top: env(safe-area-inset-top, 16px); }

  /* ── Back-Link ── */
  .admin-back-link { margin-bottom: 10px; }

  /* ── Section ── */
  .admin-section { margin-top: 20px; }


  /* ── Footer ── */
  .admin-footer { padding: 14px 0; margin-bottom: 60px; }

  /* ── Badges ── */
  .admin-badge { font-size: var(--fs-xs); }

  /* ── Bottom Tab Bar ── */
  .bp-bottom-nav {
    display: flex; position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bp-bottom-nav-h);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--bp-surface);
    border-top: 1px solid var(--bp-border);
    z-index: 300;
    justify-content: space-around; align-items: center;
  }
  .bp-bottom-nav-item {
    display: flex; flex-direction: column; align-items: center;
    gap: 2px; text-decoration: none;
    color: var(--bp-text-muted); font-size: var(--fs-xs); font-weight: 500;
    padding: 6px 0; min-width: 56px; min-height: 44px;
    justify-content: center; transition: color .15s;
  }
  .bp-bottom-nav-item.active { color: var(--bp-orange); }
  .bp-bottom-nav-icon { font-size: var(--fs-lg); line-height: 1; }
}

/* Light mode mobile overrides */
@media (max-width: 768px) {
  body.admin-page.light-mode .admin-nav.is-open { background: #fff; }
  body.admin-page.light-mode .bp-bottom-nav { background: #fff; border-top-color: #e0e0e0; }
  body.admin-page.light-mode .admin-hamburger span { background: #333; }
}

/* ═════════════════════════════════════════════════════════════════════════════
   Dashboard Widgets
   ═════════════════════════════════════════════════════════════════════════════ */

/* Welcome Banner */
.dash-welcome {
  background: linear-gradient(135deg, var(--bp-surface) 0%, #1f1f1f 60%, rgba(232,101,10,.08) 100%);
  border: 1px solid var(--bp-border);
  border-radius: 12px;
  padding: 32px 32px 28px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.dash-welcome::after {
  content: '';
  position: absolute; top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(232,101,10,.1) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.dash-welcome-greeting {
  font-size: var(--fs-xl); font-weight: 800; color: var(--bp-text); margin: 0 0 6px;
  letter-spacing: -.01em;
}
.dash-welcome-date { font-size: var(--fs-sm); color: var(--bp-text-muted); margin: 0 0 6px; }
.dash-welcome-summary { font-size: var(--fs-sm); color: var(--bp-orange); margin: 0; font-weight: 600; }

body.admin-page.light-mode .dash-welcome {
  background: linear-gradient(135deg, #fff 0%, #fafafa 60%, rgba(232,101,10,.04) 100%);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* Quick-Action Leiste */
.dash-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.dash-quick-btn {
  display: flex; align-items: center; gap: 10px;
  background: var(--bp-surface); border: 1px solid var(--bp-border);
  border-radius: 10px; padding: 16px 18px;
  color: var(--bp-text); text-decoration: none; font-size: var(--fs-md); font-weight: 600;
  transition: border-color .18s, box-shadow .18s, background .18s;
  justify-content: center; text-align: center;
}
.dash-quick-btn:hover {
  border-color: var(--bp-orange);
  background: rgba(232,101,10,.05);
  box-shadow: 0 2px 12px rgba(232,101,10,.12);
}
.dash-quick-btn--accent {
  border-color: var(--bp-orange);
  color: var(--bp-orange);
  background: rgba(232,101,10,.06);
}
.dash-quick-btn--accent:hover {
  background: rgba(232,101,10,.12);
}
.dash-quick-icon { font-size: var(--fs-lg); }
body.admin-page.light-mode .dash-quick-btn {
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

/* Widgets Row (2 columns) */
.dash-widgets-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px;
}
@media (max-width: 768px) {
  .dash-widgets-row { grid-template-columns: 1fr; }
}
.dash-widgets-row .admin-card {
  border-radius: 12px;
}
body.admin-page.light-mode .dash-widgets-row .admin-card {
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

/* Storage Widget */
.dash-storage-bar-wrap { margin-top: 16px; }
.dash-storage-bar {
  height: 10px; background: var(--bp-border); border-radius: 5px; overflow: hidden;
}
body.admin-page.light-mode .dash-storage-bar { background: #eee; }
.dash-storage-bar-fill {
  height: 100%; background: linear-gradient(90deg, var(--bp-orange), #f59e0b); border-radius: 5px;
  transition: width .8s ease;
}
.dash-storage-text {
  font-size: var(--fs-sm); color: var(--bp-text-muted); margin-top: 8px; text-align: right;
  font-weight: 500;
}
.dash-storage-breakdown {
  display: flex; gap: 16px; margin-top: 12px; flex-wrap: wrap;
}
.dash-storage-item {
  display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--bp-text-muted);
}
.dash-storage-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

/* Donut Chart */
.dash-donut-wrap {
  position: relative; width: 120px; height: 120px; margin: 12px auto 8px;
}
.dash-donut-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dash-donut-bg { opacity: .3; }
.dash-donut-segment {
  fill: none; stroke-width: 16; stroke-linecap: butt;
  transition: stroke-dasharray .8s ease, stroke-dashoffset .8s ease;
}
.dash-donut-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  text-align: center; font-size: var(--fs-xl); font-weight: 700; color: var(--bp-text);
}
.dash-donut-center-label { font-size: var(--fs-xs); font-weight: 400; color: var(--bp-text-muted); display: block; }
.dash-donut-legend {
  display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-top: 4px;
}
.dash-donut-legend-item {
  display: flex; align-items: center; gap: 5px; font-size: var(--fs-xs); color: var(--bp-text-muted);
}

/* Activity Timeline */
.dash-timeline { margin-top: 12px; max-height: 320px; overflow-y: auto; }
.dash-timeline-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--bp-border); font-size: var(--fs-sm);
}
.dash-timeline-item:last-child { border-bottom: none; }
.dash-timeline-icon {
  width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center;
  justify-content: center; font-size: var(--fs-sm); flex-shrink: 0;
  background: rgba(232,101,10,.1); color: var(--bp-orange);
}
body.admin-page.light-mode .dash-timeline-icon {
  background: rgba(232,101,10,.08);
}
.dash-timeline-content { flex: 1; min-width: 0; }
.dash-timeline-action { font-weight: 600; color: var(--bp-text); }
.dash-timeline-resource { color: var(--bp-text-muted); font-size: var(--fs-xs); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-timeline-meta { font-size: var(--fs-xs); color: var(--bp-text-muted); margin-top: 3px; }

/* Due Dates */
.dash-due-item {
  display: flex; align-items: center; gap: 10px; padding: 6px 0;
  border-bottom: 1px solid var(--bp-border);
}
.dash-due-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.dash-due-date { font-weight: 600; min-width: 80px; }
.dash-due-name { flex: 1; color: var(--bp-text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-due-project { font-size: var(--fs-xs); color: var(--bp-text-muted); }

@media (max-width: 900px) {
  .dash-quick-actions { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .dash-quick-actions { grid-template-columns: repeat(2, 1fr); }
  .dash-welcome { padding: 20px 20px 18px; border-radius: 10px; }
  .dash-welcome-greeting { font-size: var(--fs-lg); }
  .admin-card { border-radius: 10px; }
}
@media (max-width: 480px) {
  .dash-quick-actions { grid-template-columns: 1fr; }
}

/* ====================================================
   Onboarding Wizard
   ==================================================== */
.onboarding-wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}

/* Stepper progress bar */
.onboarding-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 40px;
}
.onboarding-stepper-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 1;
}
.onboarding-step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  font-weight: 700;
  border: 2px solid var(--bp-border);
  color: var(--bp-text-muted);
  background: var(--bp-surface);
  transition: all .3s ease;
}
.onboarding-stepper-item.active .onboarding-step-circle,
.onboarding-stepper-item.done .onboarding-step-circle {
  border-color: var(--bp-orange);
  background: var(--bp-orange);
  color: #fff;
}
.onboarding-step-label {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--bp-text-muted);
  transition: color .3s ease;
}
.onboarding-stepper-item.active .onboarding-step-label {
  color: var(--bp-text);
}
.onboarding-stepper-line {
  flex: 1;
  height: 2px;
  background: var(--bp-border);
  min-width: 24px;
  max-width: 80px;
  margin: 0 4px;
  margin-bottom: 22px;
  transition: background .3s ease;
}
.onboarding-stepper-line.done {
  background: var(--bp-orange);
}

/* Step panels */
.onboarding-step {
  display: none;
  text-align: center;
  animation: onboardFadeIn .35s ease;
}
.onboarding-step.active {
  display: block;
}
@keyframes onboardFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.onboarding-step-icon {
  font-size: var(--fs-2xl);
  margin-bottom: 16px;
  line-height: 1;
}
.onboarding-step-title {
  font-size: var(--fs-xl);
  font-weight: 700;
  margin-bottom: 8px;
}
.onboarding-step-text {
  color: var(--bp-text-muted);
  font-size: var(--fs-md);
  margin-bottom: 28px;
  line-height: 1.6;
}

/* Actions row */
.onboarding-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 24px;
}
.onboarding-btn {
  min-width: 140px;
  padding: 12px 24px;
  font-size: var(--fs-md);
}

/* Skip link */
.onboarding-skip {
  display: inline-block;
  margin-top: 20px;
  font-size: var(--fs-sm);
  color: var(--bp-text-muted);
  text-decoration: none;
  transition: color var(--bp-transition);
}
.onboarding-skip:hover {
  color: var(--bp-text);
}

/* Form alignment in wizard */
.onboarding-step .admin-form {
  text-align: left;
  margin: 0 auto;
}
.onboarding-row-grid {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 0 12px;
}

/* Tips cards on finish step */
.onboarding-tips {
  margin-top: 32px;
  text-align: left;
}
.onboarding-tips-heading {
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--bp-text-muted);
  margin-bottom: 12px;
  text-align: center;
}
.onboarding-tips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.onboarding-tip-card {
  background: var(--bp-surface);
  border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius);
  padding: 16px;
  text-align: center;
}
.onboarding-tip-icon {
  font-size: var(--fs-xl);
  margin-bottom: 8px;
}
.onboarding-tip-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: 4px;
}
.onboarding-tip-text {
  font-size: var(--fs-xs);
  color: var(--bp-text-muted);
  line-height: 1.4;
}

/* Mobile onboarding */
@media (max-width: 768px) {
  .onboarding-wrap { padding: 20px 12px 40px; }
  .onboarding-step-title { font-size: var(--fs-lg); }
  .onboarding-step-text { font-size: var(--fs-sm); }
  .onboarding-step-label { display: none; }
  .onboarding-stepper-line { margin-bottom: 0; }
  .onboarding-stepper-item { gap: 0; }
  .onboarding-tips-grid { grid-template-columns: 1fr; }
  .onboarding-row-grid { grid-template-columns: 1fr; }
  .onboarding-actions { flex-direction: column; }
  .onboarding-btn { width: 100%; min-width: auto; }
}

/* ── Offline-Banner ── */
.bp-offline-banner {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(234,179,8,.15);
  border: 1px solid rgba(234,179,8,.3);
  color: #facc15;
  font-size: var(--fs-sm);
  border-radius: var(--bp-radius);
  margin: 12px 16px 0;
}
.bp-offline-banner.visible {
  display: flex;
}

/* ── Offline-Toast ── */
.bp-offline-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bp-surface);
  color: var(--bp-text);
  border: 1px solid var(--bp-border);
  padding: 10px 20px;
  border-radius: var(--bp-radius);
  font-size: var(--fs-sm);
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  opacity: 0;
  transition: opacity .3s, transform .3s;
  z-index: 10000;
  pointer-events: none;
}
.bp-offline-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Upload-Queue Badge ── */
.bp-queue-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--bp-orange);
  color: #fff;
  font-size: var(--fs-xs);
  font-weight: 700;
  position: absolute;
  top: -4px;
  right: -6px;
}

/* ── Draft-Indikator ── */
.bp-draft-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(34,197,94,.1);
  border: 1px solid rgba(34,197,94,.25);
  color: #4ade80;
  font-size: var(--fs-xs);
  border-radius: var(--bp-radius);
  margin-bottom: 12px;
}
.bp-draft-indicator.saving {
  color: #facc15;
  background: rgba(234,179,8,.1);
  border-color: rgba(234,179,8,.25);
}

/* ── Sync-Status Card ── */
.bp-sync-stat { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: var(--fs-sm); }
.bp-sync-stat-label { color: var(--bp-text-muted); min-width: 160px; }
.bp-sync-stat-value { font-weight: 600; }
