/* Dunkle Ansicht. Wird nach main.css geladen und greift nur bei html[data-theme="dark"].
   main.css setzt viele Farben fest mit !important – deshalb hier dieselbe Härte,
   aber mit höherer Spezifität. */
html[data-theme="dark"] {
  color-scheme: dark;

  --bg-body: #0e1316;
  --bg-main: #0e1316;
  --bg-main-soft: #131a1e;
  --bg-sidebar: #12191c;
  --bg-sidebar-2: #12191c;
  --bg-card: #172024;
  --bg-card-soft: #1b262b;
  --bg-input: #1b262b;

  --text-main: #e6eeec;
  --text-muted: #a3b2af;
  --text-dim: #7d8d8a;
  --text-inverse: #0e1316;

  --line: rgba(230, 238, 236, 0.12);
  --line-strong: rgba(230, 238, 236, 0.22);
  --border: rgba(230, 238, 236, 0.16);

  --primary-soft: rgba(45, 190, 176, 0.14);
  --success: #2dbeb0 !important;
  --warning: #e0a04a;
  --danger: #e57b70;

  --dashboard-hover-from: #1b262b !important;
  --dashboard-hover-to: #1b262b !important;
  --dashboard-hover-shadow: rgba(0, 0, 0, 0.45) !important;
  --accent-ink: #7fe0d4 !important;
  --accent-ink-soft: #9ad8cf !important;

  --btn-secondary-from: #1b262b !important;
  --btn-secondary-to: #1b262b !important;
  --btn-secondary-hover-to: #22313a !important;
  --btn-secondary-text: #e6eeec !important;
  --btn-secondary-border: rgba(230, 238, 236, 0.22) !important;
  --btn-secondary-border-hover: #2dbeb0 !important;
  --btn-ghost-text: #e6eeec !important;
  --btn-ghost-border: rgba(230, 238, 236, 0.2) !important;
  --btn-ghost-bg: rgba(255, 255, 255, 0.04) !important;
  --btn-ghost-border-hover: rgba(45, 190, 176, 0.5) !important;
  --btn-ghost-bg-hover: rgba(255, 255, 255, 0.09) !important;
  --btn-soft-text: #7fe0d4 !important;

  --shadow-card: 0 12px 28px rgba(0, 0, 0, 0.4);
  --shadow-soft: 0 8px 18px rgba(0, 0, 0, 0.35);
  --shadow-hard: 0 24px 54px rgba(0, 0, 0, 0.6);
}

html[data-theme="dark"],
html[data-theme="dark"] body,
html[data-theme="dark"] body[data-mode="auth"],
html[data-theme="dark"] body[data-mode="team-select"],
html[data-theme="dark"] body[data-mode="pending"],
html[data-theme="dark"] body[data-mode="app"] #main,
html[data-theme="dark"] body[data-mode="app"] #view-container,
html[data-theme="dark"] #main,
html[data-theme="dark"] #view-container {
  background: #0e1316 !important;
  background-color: #0e1316 !important;
  color: var(--text-main);
}

html[data-theme="dark"] #sidebar {
  background: #12191c !important;
  border-right-color: rgba(230, 238, 236, 0.1) !important;
}
html[data-theme="dark"] .sidebar-header { border-bottom-color: rgba(230, 238, 236, 0.1) !important; }
html[data-theme="dark"] .sidebar-logo { color: #e6eeec !important; }
html[data-theme="dark"] .nav-section { color: #7d8d8a !important; }
html[data-theme="dark"] .nav-item { color: #cbd7d4 !important; }
html[data-theme="dark"] .nav-item:hover {
  background: rgba(45, 190, 176, 0.12) !important;
  border-color: rgba(45, 190, 176, 0.26) !important;
  color: #7fe0d4 !important;
}
html[data-theme="dark"] #sidebar .text-sm,
html[data-theme="dark"] #sidebar .text-dim { color: #a3b2af !important; }

html[data-theme="dark"] #topbar {
  background: rgba(18, 25, 28, 0.94) !important;
  border-bottom-color: rgba(230, 238, 236, 0.1) !important;
  box-shadow: none;
}

/* Flächen */
html[data-theme="dark"] .card,
html[data-theme="dark"] .auth-box,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .help-drawer-panel,
html[data-theme="dark"] .guided-tour-card,
html[data-theme="dark"] .dashboard-grid > .card,
html[data-theme="dark"] .dashboard-overview-shell > .card,
html[data-theme="dark"] .dashboard-hero-panel,
html[data-theme="dark"] .dashboard-summary-card,
html[data-theme="dark"] .dashboard-insight-card,
html[data-theme="dark"] .dashboard-mobile-card,
html[data-theme="dark"] .dashboard-problem-row,
html[data-theme="dark"] .page-hero-card,
html[data-theme="dark"] .page-hero-stat,
html[data-theme="dark"] .auth-pricing-card,
html[data-theme="dark"] .auth-workflow-preview,
html[data-theme="dark"] .auth-proof-grid > div,
html[data-theme="dark"] .onboarding-step-card,
html[data-theme="dark"] .onboarding-step-card--plan,
html[data-theme="dark"] .onboarding-plan-choice,
html[data-theme="dark"] .onboarding-plan-choice.is-selected,
html[data-theme="dark"] .table-container,
html[data-theme="dark"] .stock-card {
  background: #172024 !important;
  background-color: #172024 !important;
  background-image: none !important;
  border-color: rgba(230, 238, 236, 0.12) !important;
  color: var(--text-main);
}
html[data-theme="dark"] .dashboard-grid > .card:hover,
html[data-theme="dark"] .dashboard-overview-shell > .card.dashboard-hero-panel:hover,
html[data-theme="dark"] .dashboard-overview-shell > .card.dashboard-critical-card:hover,
html[data-theme="dark"] .dashboard-summary-card:hover,
html[data-theme="dark"] .dashboard-insight-card:hover,
html[data-theme="dark"] .dashboard-mobile-card:hover,
html[data-theme="dark"] .stock-card:hover,
html[data-theme="dark"] .auth-pricing-card:hover,
html[data-theme="dark"] .onboarding-plan-choice:hover,
html[data-theme="dark"] .auth-pricing-card.is-featured {
  background: #1b262b !important;
  border-color: rgba(45, 190, 176, 0.35) !important;
  color: var(--text-main) !important;
}

/* Eingaben */
html[data-theme="dark"] .form-control,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background-color: #1b262b !important;
  border-color: rgba(230, 238, 236, 0.2) !important;
  color: #e6eeec;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #7d8d8a; }

/* Knöpfe & Badges */
html[data-theme="dark"] .btn-primary,
html[data-theme="dark"] .tab-btn.active,
html[data-theme="dark"] .nav-item.active {
  background: #0f766e !important;
  border-color: #14968c !important;
  color: #ffffff !important;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35) !important;
}
html[data-theme="dark"] .btn-secondary,
html[data-theme="dark"] .btn-ghost,
html[data-theme="dark"] .btn-soft {
  background: #1b262b !important;
  border-color: rgba(230, 238, 236, 0.22) !important;
  color: #e6eeec !important;
}
html[data-theme="dark"] .btn-secondary:hover,
html[data-theme="dark"] .btn-ghost:hover,
html[data-theme="dark"] .btn-soft:hover {
  background: #22313a !important;
  border-color: rgba(45, 190, 176, 0.5) !important;
}
html[data-theme="dark"] .badge,
html[data-theme="dark"] .badge-green,
html[data-theme="dark"] .badge-yellow,
html[data-theme="dark"] .badge-amber,
html[data-theme="dark"] .badge-blue,
html[data-theme="dark"] .badge-gray,
html[data-theme="dark"] .badge-outline {
  background: rgba(45, 190, 176, 0.14) !important;
  border-color: rgba(45, 190, 176, 0.3) !important;
  color: #7fe0d4 !important;
}
html[data-theme="dark"] .badge-red,
html[data-theme="dark"] .btn-danger {
  background: #b9473e !important;
  border-color: #b9473e !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .btn-danger:disabled {
  background: rgba(185, 71, 62, 0.16) !important;
  border-color: rgba(185, 71, 62, 0.3) !important;
  color: rgba(255, 190, 184, 0.6) !important;
}

html[data-theme="dark"] .topbar-guide-btn {
  background: #1b262b;
  color: #e6eeec;
  border-color: rgba(230, 238, 236, 0.28);
}
html[data-theme="dark"] .topbar-guide-btn:hover {
  background: #22313a;
  border-color: rgba(230, 238, 236, 0.5);
}

/* Theme-Knopf in der Kopfzeile */
.topbar-theme-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.28);
  background: #ffffff;
  color: #111111;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.topbar-theme-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
html[data-theme="dark"] .topbar-theme-btn {
  background: #1b262b;
  color: #e6eeec;
  border-color: rgba(230, 238, 236, 0.28);
}

/* Auswahl in den Einstellungen */
.theme-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topbar-theme-btn .theme-ico { display: none; }
html:not([data-theme-mode]) .topbar-theme-btn .theme-ico-auto,
html[data-theme-mode="auto"] .topbar-theme-btn .theme-ico-auto,
html[data-theme-mode="light"] .topbar-theme-btn .theme-ico-light,
html[data-theme-mode="dark"] .topbar-theme-btn .theme-ico-dark { display: block; }

/* Heller Innenschatten oben an Eingaben (aus dem Hell-Design) wirkt im Dunkeln wie ein Rand. */
html[data-theme="dark"] .form-control:not(:focus),
html[data-theme="dark"] input:not(:focus),
html[data-theme="dark"] select:not(:focus),
html[data-theme="dark"] textarea:not(:focus) {
  box-shadow: none !important;
}
