/* ============================================================
   DreamCRM – Basis-Styles (ohne Frameworks)
   ============================================================ */

:root {
  /* Dream Marketing CI */
  --dm-primary: #d5b038;
  --dm-secondary: #000000;
  --dm-bg: #ffffff;
  --dm-text: #000000;
  --dm-muted: #666666;

  /* Abgeleitete Tokens (bestehende UI bleibt, nur Theme ändert sich) */
  --bg0: #ffffff;
  --bg1: #ffffff;
  --card: #ffffff;
  --card2: #f8fafc;
  --border: rgba(0, 0, 0, 0.12);
  --text: rgba(0, 0, 0, 0.92);
  --muted: rgba(0, 0, 0, 0.62);
  --primary: var(--dm-primary);
  --primaryHover: #c19a22;
  --danger: #ef4444;
  --success: #16a34a;
  --warning: #f59e0b;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.12);
  --radius: 16px;
}

/* Dark Mode: nur Variablen überschreiben (Layout bleibt gleich) */
html[data-theme="dark"] {
  --bg0: #000000;
  --bg1: #000000;
  --card: rgba(255, 255, 255, 0.06);
  --card2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.14);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.68);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica,
    Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  /* neutraler Hintergrund (kein Gelb im Background) */
  background: linear-gradient(180deg, #ffffff, #f6f7f8);
}

html[data-theme="dark"] body {
  background: #000000; /* Wunsch: echter schwarzer Hintergrund */
}

/* Logo im Dark Mode: Wordmark ohne Verzerrung sichtbar machen:
   - Gold-Icon links bleibt original
   - Text rechts wird weiß (separater Layer) */

a {
  color: inherit;
}

/* ============================================================
   Auth / Login
   ============================================================ */
.auth-shell {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: linear-gradient(180deg, var(--card), var(--card2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 22px 18px;
}

.auth-header {
  display: grid;
  grid-template-columns: auto 1fr auto; /* Platz für Theme-Toggle */
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.auth-badge {
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: rgba(0, 0, 0, 0.92);
  background: transparent; /* kein gelber Kasten hinter dem Logo */
  border: none; /* horizontaler Schriftzug: keine Box */
  padding: 0;
  height: 84px;
  width: 100%;
  overflow: hidden; /* darf oben/unten abschneiden */
}

.logo-wordmark {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
}

:root {
  --logo-split: 18%; /* Anteil links für Icon (ggf. feinjustieren) */
  /* Feintuning: Gold im Logo an DM-Gold angleichen (wirkt auf den Icon-Layer) */
  --logo-icon-filter: hue-rotate(-6deg) saturate(1.45) brightness(1.10) contrast(1.06);
}

.logo-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 140px; /* größer als Container -> Cropping */
  display: block;
  object-fit: cover;
  object-position: left 58%;
}

.logo-layer.icon {
  clip-path: inset(0 calc(100% - var(--logo-split)) 0 0);
  filter: var(--logo-icon-filter);
}

.logo-layer.text {
  clip-path: inset(0 0 0 var(--logo-split));
}

html[data-theme="dark"] .logo-layer.text {
  filter: brightness(0) invert(1); /* Schriftzug wird weiß */
}

.auth-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.auth-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.label {
  color: var(--muted);
  font-size: 13px;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="date"] {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

input::placeholder {
  color: rgba(0, 0, 0, 0.42);
}

html[data-theme="dark"] input::placeholder {
  color: rgba(255, 255, 255, 0.42);
}

input:focus {
  border-color: rgba(213, 176, 56, 0.9);
  box-shadow: 0 0 0 4px rgba(213, 176, 56, 0.22);
  background: var(--card);
}

.auth-actions {
  display: grid;
  margin-top: 4px;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 80ms ease, filter 120ms ease, opacity 120ms ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  color: rgba(0, 0, 0, 0.92);
  background: linear-gradient(135deg, var(--primary), rgba(213, 176, 56, 0.72));
}

html[data-theme="dark"] .btn-primary {
  color: rgba(0, 0, 0, 0.92);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primaryHover), rgba(193, 154, 34, 0.75));
}

/* ============================================================
   App Layout / Komponenten (Dashboard, Listen, Formulare)
   ============================================================ */

.app-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
}

html[data-theme="dark"] .topbar {
  background: rgba(10, 16, 30, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.topbar-inner {
  max-width: none; /* Logo ganz links platzieren */
  margin: 0;       /* nicht zentrieren */
  padding: 14px 18px 14px 10px; /* etwas weiter links */
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap; /* wichtig bei großem horizontalem Logo */
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  flex: 0 0 auto;
}

.brand-badge {
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent; /* kein gelber Hintergrund */
  border: none;
  height: 76px; /* minimal mehr Platz -> weniger Crop */
  width: clamp(260px, 42vw, 760px); /* viel Breite für Wordmark */
  overflow: hidden; /* darf oben/unten abschneiden */
}

.auth-badge .logo-layer {
  height: 140px;
}

.brand-badge .logo-layer {
  height: 128px;
}

@media (max-width: 520px) {
  .brand-badge .logo-layer { height: 120px; }
  .auth-badge .logo-layer { height: 130px; }
  .brand-badge {
    height: 64px;
    width: min(92vw, 520px);
  }
  .auth-badge {
    height: 76px;
  }
}

/* ============================================================
   Dark Mode Toggle (iOS / Apple-like Switch)
   ============================================================ */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}

.theme-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.theme-switch {
  width: 46px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  background: rgba(0, 0, 0, 0.10);
  position: relative;
  transition: background 160ms ease, border-color 160ms ease;
}

html[data-theme="dark"] .theme-switch {
  border-color: rgba(255, 255, 255, 0.20);
  background: rgba(255, 255, 255, 0.10);
}

.theme-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  transition: transform 160ms ease, background 160ms ease;
}

html[data-theme="dark"] .theme-switch::after {
  background: #ffffff;
}

.theme-toggle input:checked + .theme-switch {
  background: rgba(213, 176, 56, 0.80);
  border-color: rgba(213, 176, 56, 0.85);
}

.theme-toggle input:checked + .theme-switch::after {
  transform: translateX(18px);
}

.theme-toggle input:focus-visible + .theme-switch {
  box-shadow: 0 0 0 4px rgba(213, 176, 56, 0.22);
}

.brand-title {
  display: grid;
  gap: 1px;
}

.brand-title strong {
  font-size: 14px;
  line-height: 1.1;
}

.brand-title span {
  font-size: 12px;
  color: var(--muted);
}

.nav {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-left: auto;
  justify-content: flex-end;
}

.nav a {
  text-decoration: none;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.78);
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: background 120ms ease, border-color 120ms ease;
}

html[data-theme="dark"] .nav a {
  color: rgba(255, 255, 255, 0.88);
}

html[data-theme="dark"] .nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.10);
}

html[data-theme="dark"] .nav a.is-active {
  background: rgba(213, 176, 56, 0.18);
  border-color: rgba(213, 176, 56, 0.40);
}

.nav a:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.08);
}

.nav a.is-active {
  background: rgba(213, 176, 56, 0.20);
  border-color: rgba(213, 176, 56, 0.50);
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px;
}

.page-title {
  margin: 10px 0 6px;
  font-size: 18px;
}

.page-subtitle {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 860px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.muted {
  color: var(--muted);
}

.btn-secondary {
  color: rgba(0, 0, 0, 0.88);
  background: var(--card);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--card2);
}

html[data-theme="dark"] .btn-secondary {
  color: rgba(255, 255, 255, 0.90);
}

.btn-small {
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 650;
  font-size: 13px;
}

.btn-danger {
  color: rgba(255, 255, 255, 0.95);
  background: rgba(239, 68, 68, 0.85);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.95);
}

.input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.input:focus,
select:focus,
textarea:focus {
  border-color: rgba(213, 176, 56, 0.9);
  box-shadow: 0 0 0 4px rgba(213, 176, 56, 0.22);
}

.form-row {
  display: grid;
  gap: 10px;
}

.actions-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.table-wrap {
  overflow: auto;
  border-radius: 16px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

html[data-theme="dark"] th,
html[data-theme="dark"] td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

th {
  color: rgba(0, 0, 0, 0.70);
  font-weight: 650;
  background: var(--card2);
}

html[data-theme="dark"] th {
  color: rgba(255, 255, 255, 0.78);
}

tbody tr:nth-child(odd) {
  background: rgba(0, 0, 0, 0.02);
}

tbody tr:hover {
  background: rgba(213, 176, 56, 0.10);
}

html[data-theme="dark"] tbody tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.02);
}

html[data-theme="dark"] tbody tr:hover {
  background: rgba(213, 176, 56, 0.10);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.03);
  color: rgba(0, 0, 0, 0.82);
}

html[data-theme="dark"] .badge {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
}

.badge.status-entwurf { border-color: rgba(148, 163, 184, 0.35); }
.badge.status-gesendet { border-color: rgba(59, 130, 246, 0.45); }
.badge.status-unterschrieben { border-color: rgba(34, 197, 94, 0.45); }
.badge.status-abgelehnt { border-color: rgba(239, 68, 68, 0.5); }

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 10px;
  z-index: 50;
  width: min(420px, calc(100vw - 32px));
}

.toast {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  padding: 10px 12px;
  box-shadow: var(--shadow);
}

html[data-theme="dark"] .toast {
  background: rgba(10, 16, 30, 0.88);
}

.toast strong {
  display: block;
  font-size: 13px;
  margin-bottom: 2px;
}

.toast p {
  margin: 0;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.66);
}

html[data-theme="dark"] .toast p {
  color: rgba(255, 255, 255, 0.74);
}

.toast.is-success { border-color: rgba(34, 197, 94, 0.35); }
.toast.is-error { border-color: rgba(239, 68, 68, 0.45); }

/* ============================================================
   Produkte (Kartenansicht)
   ============================================================ */
.produkte-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 980px) {
  .produkte-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .produkte-grid {
    grid-template-columns: 1fr;
  }
}

.produkt-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.produkt-card:hover {
  border-color: rgba(213, 176, 56, 0.55);
  background: rgba(213, 176, 56, 0.08);
}

.produkt-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 750;
}

.star {
  color: rgba(213, 176, 56, 0.95);
}

.produkt-price {
  margin-top: 6px;
  color: rgba(0, 0, 0, 0.72);
  font-size: 13px;
}

.produkt-img {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card2);
  object-fit: cover;
}

.produkt-actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============================================================
   Vertragsabschluss Wizard (Stepper + Progress + Signature)
   ============================================================ */
.wizard {
  display: grid;
  gap: 12px;
}

.stepper {
  display: grid;
  gap: 10px;
}

.progress-bar {
  height: 8px;
  width: 100%;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

html[data-theme="dark"] .progress-bar {
  background: rgba(255, 255, 255, 0.10);
}

.progress-bar > div {
  height: 100%;
  width: 0%;
  background: rgba(213, 176, 56, 0.90);
  border-radius: 999px;
  transition: width 160ms ease;
}

.steps {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.step-pill {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 12px;
  color: var(--muted);
}

.step-pill.is-active {
  color: rgba(0, 0, 0, 0.85);
  border-color: rgba(213, 176, 56, 0.70);
  background: rgba(213, 176, 56, 0.16);
}

html[data-theme="dark"] .step-pill.is-active {
  color: rgba(255, 255, 255, 0.90);
}

.wizard-panel {
  display: none;
}

.wizard-panel.is-active {
  display: block;
}

.choice-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 980px) {
  .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .choice-grid { grid-template-columns: 1fr; }
}

.choice-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  padding: 12px;
}

.choice-card:hover {
  border-color: rgba(213, 176, 56, 0.55);
}

.choice-card.is-selected {
  border-color: rgba(213, 176, 56, 0.85);
  background: rgba(213, 176, 56, 0.10);
}

.sig-pad {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
  overflow: hidden;
}

.sig-pad canvas {
  width: 100%;
  height: 220px;
  display: block;
  touch-action: none;
  background: #ffffff; /* damit Unterschrift (schwarz) auch im Dark Mode sichtbar bleibt */
}

.contract-preview {
  width: 100%;
  height: 520px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
}

.sig-head {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 10px;
}

.sig-head h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

@media (max-width: 768px) {
  .contract-preview {
    height: 460px;
  }
}

/* Produktberater (Step 1) */
.advisor-intro {
  max-width: 780px;
  margin: 6px auto 18px;
  text-align: center;
}

.advisor-intro h2 {
  font-size: 1.9rem;
  color: var(--text);
  font-weight: 750;
  margin-bottom: 10px;
}

.advisor-intro p {
  font-size: 1.05rem;
  color: var(--muted);
}

.advisor-container {
  max-width: 980px;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 18px;
}

.advisor-container h1 {
  font-size: 1.35rem;
  color: var(--text);
  text-align: center;
  margin-bottom: 16px;
  font-weight: 750;
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.option-tile {
  display: flex;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  position: relative;
  background: var(--card);
  text-align: left;
}

.option-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(213, 176, 56, 0.65);
  box-shadow: 0 10px 22px rgba(213, 176, 56, 0.08);
}

.option-tile input {
  display: none;
}

.option-tile .icon {
  flex-shrink: 0;
  margin-right: 12px;
  color: var(--dm-primary, #d5b038);
}

.option-tile .content-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

.option-tile .option-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.option-tile input:checked + .content-wrapper::after {
  content: "✓";
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  background-color: var(--dm-primary, #d5b038);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
}

.option-tile.selected {
  border-color: rgba(213, 176, 56, 0.85);
  background: rgba(213, 176, 56, 0.06);
}

#recommendation {
  margin-top: 18px;
  padding: 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  display: none;
}

html[data-theme="dark"] #recommendation {
  background: rgba(255, 255, 255, 0.03);
}

#recommendation.visible {
  opacity: 1;
  transform: translateY(0);
  display: block;
}

#recommendation h3 {
  color: var(--text);
  font-size: 1.25rem;
  margin-bottom: 6px;
}

#recommendation p {
  color: var(--muted);
  margin-bottom: 14px;
}

#recommendation .btn {
  display: inline-block;
  padding: 12px 28px;
  background: var(--dm-primary, #d5b038);
  color: #fff;
  font-size: 1rem;
  font-weight: 750;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: filter 0.2s ease, transform 0.15s ease;
}

#recommendation .btn:hover {
  filter: brightness(0.95);
  transform: translateY(-2px);
}

#recommendation .rec-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

#recommendation .btn.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

#recommendation .btn.btn-secondary:hover {
  filter: none;
  background: rgba(213, 176, 56, 0.10);
}

@media (max-width: 768px) {
  .advisor-intro h2 {
    font-size: 1.55rem;
  }
  .advisor-container {
    padding: 14px;
  }
}


.btn[disabled] {
  opacity: 0.7;
  cursor: not-allowed;
}

.form-msg {
  min-height: 18px;
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.form-msg.is-error {
  color: rgba(239, 68, 68, 0.95);
}

.form-msg.is-success {
  color: rgba(22, 163, 74, 0.95);
}

.auth-footer {
  margin-top: 14px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 420px) {
  .auth-card {
    padding: 18px 16px 14px;
    border-radius: 14px;
  }
}


