/* ==========================================================================
   Deluxe Estate Montenegro CRM — Dark Luxury / Real Estate
   ========================================================================== */

:root {
  --color-bg-deep: #f4ece0;
  --color-bg-surface: #ffffff;
  --color-bg-elevated: #fbf7f1;
  --color-border-subtle: rgba(61, 52, 44, 0.10);
  --color-border-gold: rgba(188, 146, 75, 0.45);
  --color-gold: #bc924b;
  --color-gold-light: #a97e39;
  --color-gold-dark: #8a6a34;
  --color-text-primary: #2e2721;
  --color-text-secondary: #6b5d4d;
  --color-text-muted: #9a8b78;
  /* Sidebar (dunkel, wie die Kopfleiste der Website) */
  --color-sidebar-bg-top: #241d16;
  --color-sidebar-bg-bottom: #17120d;
  --color-sidebar-text: #c9bfb0;
  --color-sidebar-text-strong: #f5eee7;
  --font-serif: 'Mulish', system-ui, sans-serif;
  --font-sans: 'Mulish', system-ui, sans-serif;
  --shadow-gold: 0 0 40px rgba(188, 146, 75, 0.12);
  --shadow-card: 0 6px 22px rgba(61, 52, 44, 0.08);
  --transition-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --space-section: 2rem;
  --space-card: 1.75rem;
  --space-table-x: 1.75rem;
  --space-table-y: 1.125rem;
}

/* --- Base --- */

body {
  color: var(--color-text-primary);
  background-color: var(--color-bg-deep);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(188, 146, 75, 0.10), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(188, 146, 75, 0.06), transparent);
}

h1, h2, .font-serif {
  font-feature-settings: 'liga' 1, 'kern' 1;
  letter-spacing: 0.02em;
}

.main-content {
  max-width: 1440px;
}

/* --- Sidebar --- */

.sidebar {
  background: linear-gradient(180deg, var(--color-sidebar-bg-top) 0%, var(--color-sidebar-bg-bottom) 100%);
  border-right: 1px solid rgba(188, 146, 75, 0.14);
}

.brand-mark {
  background: linear-gradient(135deg, rgba(188, 146, 75, 0.18) 0%, rgba(188, 146, 75, 0.05) 100%);
  border: 1px solid var(--color-border-gold);
  box-shadow: var(--shadow-gold);
}

.sidebar-brand--logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  position: relative;
}

.mobile-menu-btn,
.sidebar-close-btn,
.sidebar-backdrop {
  display: none;
}

.mobile-menu-btn,
.sidebar-close-btn {
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.625rem;
  background: rgba(250, 245, 237, 0.85);
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all var(--transition-smooth);
  flex-shrink: 0;
}

.mobile-menu-btn:hover,
.sidebar-close-btn:hover {
  border-color: var(--color-border-gold);
  color: var(--color-gold-dark);
}

.mobile-menu-btn svg,
.sidebar-close-btn svg {
  width: 1.375rem;
  height: 1.375rem;
}

.sidebar-close-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  border-color: rgba(188, 146, 75, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-sidebar-text-strong);
}

.top-bar__start {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  min-width: 0;
  flex: 1;
}

.top-bar__titles {
  min-width: 0;
}

.top-bar__actions .btn-label {
  white-space: nowrap;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.brand-logo--sidebar {
  max-width: 12rem;
}

.brand-logo--login {
  max-width: 16rem;
  margin: 0 auto;
  filter: brightness(0);
}

.brand-tagline {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: rgba(188, 146, 75, 0.75);
  text-align: center;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem 1.125rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-sidebar-text);
  transition: all var(--transition-smooth);
  border: 1px solid transparent;
}

.nav-link:hover {
  color: var(--color-sidebar-text-strong);
  background: rgba(188, 146, 75, 0.10);
  border-color: rgba(188, 146, 75, 0.1);
}

.nav-link--active {
  color: var(--color-gold-light);
  background: linear-gradient(90deg, rgba(188, 146, 75, 0.14) 0%, rgba(188, 146, 75, 0.04) 100%);
  border-color: rgba(188, 146, 75, 0.22);
  box-shadow: inset 3px 0 0 var(--color-gold);
}

.nav-icon {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  opacity: 0.65;
}

.nav-link--active .nav-icon {
  opacity: 1;
  color: var(--color-gold);
}

/* Sidebar — gruppierte Navigation */

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.875rem 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(188, 146, 75, 0.35) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 5px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(188, 146, 75, 0.35);
  border-radius: 999px;
}

.nav-link--top {
  margin-bottom: 0.25rem;
}

.nav-link--compact {
  padding: 0.6875rem 1rem;
  font-size: 0.8125rem;
}

.nav-section {
  margin-top: 0.25rem;
}

.nav-section--bottom {
  margin-top: 1rem;
  padding-top: 0.875rem;
  border-top: 1px solid rgba(188, 146, 75, 0.12);
}

.nav-section__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.625rem 0.75rem;
  border-radius: 0.625rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-sidebar-text);
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-smooth);
}

.nav-section__toggle:hover {
  color: var(--color-sidebar-text-strong);
  background: rgba(188, 146, 75, 0.08);
}

.nav-section--open .nav-section__toggle,
.nav-section--has-active .nav-section__toggle {
  color: var(--color-sidebar-text-strong);
  background: rgba(188, 146, 75, 0.06);
}

.nav-section--open .nav-section__toggle {
  color: var(--color-gold-light);
  border-color: rgba(188, 146, 75, 0.14);
}

.nav-section__title {
  text-align: left;
}

.nav-section__chevron {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
  opacity: 0.55;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.nav-section--open .nav-section__chevron {
  transform: rotate(180deg);
  opacity: 0.9;
  color: var(--color-gold);
}

.nav-section__items {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.24s ease;
}

.nav-section--open .nav-section__items {
  grid-template-rows: 1fr;
}

.nav-section__items[hidden] {
  display: none;
}

.nav-section--open .nav-section__items[hidden] {
  display: grid;
}

.nav-section__items-inner {
  min-height: 0;
  overflow: hidden;
  padding: 0.25rem 0 0.375rem 0.375rem;
}

.nav-sublink {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4375rem 0.75rem 0.4375rem 1.125rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-sidebar-text);
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition-smooth);
}

.nav-sublink:hover {
  color: var(--color-sidebar-text-strong);
  background: rgba(188, 146, 75, 0.08);
}

.nav-sublink--active {
  color: var(--color-gold-light);
  background: rgba(188, 146, 75, 0.12);
  border-color: rgba(188, 146, 75, 0.18);
  box-shadow: inset 2px 0 0 var(--color-gold);
}

button.nav-sublink {
  margin-bottom: 0.0625rem;
}

body.sidebar-compact .sidebar-nav {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

body.sidebar-compact .nav-section {
  margin-top: 0.125rem;
}

body.sidebar-compact .nav-section__toggle,
body.sidebar-compact .nav-link {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

body.sidebar-compact .nav-sublink {
  padding-top: 0.3125rem;
  padding-bottom: 0.3125rem;
}

/* --- Einstellungen --- */

.settings-shell {
  padding: 0;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1.25rem 1.5rem 0;
  border-bottom: 1px solid var(--color-border-subtle);
}

.settings-tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--color-text-muted);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.625rem 0.875rem;
  border-radius: 0.625rem 0.625rem 0 0;
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.settings-tab:hover {
  color: var(--color-text);
  background: rgba(188, 146, 75, 0.06);
}

.settings-tab--active {
  color: var(--color-gold-dark);
  background: rgba(188, 146, 75, 0.1);
  border-color: rgba(188, 146, 75, 0.22);
  border-bottom-color: transparent;
  box-shadow: inset 0 -2px 0 var(--color-gold);
}

.settings-panels {
  padding: 1.5rem;
}

.settings-tab-panel {
  display: none;
}

.settings-tab-panel.settings-tab-panel--active {
  display: block;
}

.settings-panel__header {
  margin-bottom: 1.25rem;
}

.settings-panel__title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text);
}

.settings-panel__subtitle {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

.settings-form {
  max-width: 48rem;
}

.settings-form__actions {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border-subtle);
}

.settings-checklist {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.settings-check {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-size: 0.875rem;
  color: var(--color-text);
  cursor: pointer;
}

.settings-check input[type="checkbox"] {
  margin-top: 0.125rem;
  accent-color: var(--color-gold);
}

.settings-check__hint {
  display: block;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  font-weight: 400;
  margin-top: 0.125rem;
}

.settings-check--inline {
  align-self: end;
  padding-bottom: 0.5rem;
}

.module-placeholder {
  min-height: 18rem;
}

.module-placeholder__badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: rgba(188, 146, 75, 0.12);
  color: var(--color-gold-dark);
  border: 1px solid rgba(188, 146, 75, 0.28);
  margin-bottom: 0.5rem;
}

.module-placeholder__blueprint {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.75rem;
}

.user-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(188, 146, 75, 0.14);
}

/* --- Top Bar --- */

.top-bar {
  background: rgba(244, 236, 224, 0.82);
  border-bottom: 1px solid var(--color-border-subtle);
  backdrop-filter: blur(16px);
}

/* --- Buttons --- */

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6875rem 1.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #241d15;
  background: linear-gradient(135deg, var(--color-gold-light) 0%, var(--color-gold) 50%, var(--color-gold-dark) 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.625rem;
  cursor: pointer;
  transition: all var(--transition-smooth);
  box-shadow: 0 2px 16px rgba(188, 146, 75, 0.28);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(188, 146, 75, 0.38);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6875rem 1.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: rgba(250, 245, 237, 0.5);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.625rem;
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.btn-secondary:hover:not(:disabled) {
  color: var(--color-gold-light);
  border-color: var(--color-border-gold);
  background: rgba(188, 146, 75, 0.06);
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* --- Connection Error Banner --- */

.connection-error {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding: 1.5rem 1.75rem;
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.06) 0%, rgba(255, 255, 255, 0.95) 100%);
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: 1rem;
  box-shadow: var(--shadow-card);
}

.connection-error.hidden {
  display: none;
}

.connection-error__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.connection-error__body {
  flex: 1;
  min-width: 0;
}

.connection-error__title {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 600;
  color: #b91c1c;
  letter-spacing: 0.02em;
  margin-bottom: 0.375rem;
}

.connection-error__message {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--color-text-secondary);
}

.connection-error__url {
  font-family: ui-monospace, monospace;
  font-size: 0.8125rem;
  color: var(--color-gold-light);
  background: rgba(188, 146, 75, 0.08);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
}

.connection-error__retry {
  flex-shrink: 0;
  align-self: center;
}

/* --- KPI Grid & Cards --- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 1.25rem;
}

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

@media (min-width: 1280px) {
  .kpi-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem;
  }
}

.kpi-card {
  position: relative;
  padding: var(--space-card) 1.875rem;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.95) 0%, rgba(250, 245, 237, 0.98) 100%);
  border: 1px solid var(--color-border-subtle);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth), transform var(--transition-smooth);
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 1.5rem;
  right: 1.5rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(188, 146, 75, 0.45), transparent);
  opacity: 0;
  transition: opacity var(--transition-smooth);
}

.kpi-card:hover {
  border-color: var(--color-border-gold);
  box-shadow: var(--shadow-gold), var(--shadow-card);
  transform: translateY(-2px);
}

.kpi-card:hover::before {
  opacity: 1;
}

.kpi-card--accent {
  border-color: rgba(188, 146, 75, 0.22);
  background: linear-gradient(155deg, rgba(188, 146, 75, 0.12) 0%, rgba(255, 255, 255, 0.98) 100%);
}

.kpi-card--accent .kpi-card__value {
  color: var(--color-gold-light);
}

.kpi-card--success {
  border-color: rgba(134, 239, 172, 0.15);
}

.kpi-card--success .kpi-card__value {
  color: #86efac;
}

.kpi-card__icon--won {
  color: #86efac;
}

.kpi-card--loading .kpi-card__value {
  opacity: 0.4;
}

.kpi-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.125rem;
}

.kpi-card__label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-text-muted);
}

.kpi-card__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.375rem;
  height: 2.375rem;
  border-radius: 0.625rem;
  background: rgba(188, 146, 75, 0.1);
  color: var(--color-gold);
  border: 1px solid rgba(188, 146, 75, 0.12);
}

.kpi-card__icon--hot {
  background: rgba(252, 165, 165, 0.08);
  color: #fca5a5;
  border-color: rgba(252, 165, 165, 0.15);
}

.kpi-card__value {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 600;
  line-height: 1;
  color: var(--color-text-primary);
  letter-spacing: 0.01em;
  transition: opacity var(--transition-smooth);
}

.kpi-card__meta {
  margin-top: 0.625rem;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  line-height: 1.4;
}

.kunden-row__line {
  display: block;
}

.kunden-row__subline {
  display: block;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.125rem;
}

/* --- Panel & Table --- */

.panel {
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.92) 0%, rgba(250, 245, 237, 0.97) 100%);
  border: 1px solid var(--color-border-subtle);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.panel__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.875rem 2rem 1.5rem;
  border-bottom: 1px solid var(--color-border-subtle);
}

.panel__header-text {
  flex: 1;
  min-width: 12rem;
}

.panel__title {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: 0.02em;
}

.panel__subtitle {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-top: 0.375rem;
  line-height: 1.5;
}

.panel__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.panel__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.125rem 2rem;
  border-top: 1px solid var(--color-border-subtle);
  background: rgba(245, 238, 228, 0.45);
}

.panel__count {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.panel__count-meta {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead {
  background: rgba(245, 238, 228, 0.55);
}

.data-table th {
  padding: 1rem var(--space-table-x);
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border-subtle);
  white-space: nowrap;
}

.data-table th.col-actions {
  text-align: right;
}

.data-table td {
  padding: var(--space-table-y) var(--space-table-x);
  color: var(--color-text-secondary);
  border-bottom: 1px solid rgba(188, 146, 75, 0.06);
  vertical-align: middle;
}

.data-table td:last-child {
  text-align: right;
}

.data-table tbody tr {
  transition: background var(--transition-smooth);
}

.data-table tbody tr:hover {
  background: rgba(188, 146, 75, 0.045);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table .lead-name {
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--color-text-primary);
  letter-spacing: 0.01em;
}

/* --- Status Badges --- */

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3125rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-radius: 9999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status-badge--neu {
  color: #93c5fd;
  background: rgba(147, 197, 253, 0.1);
  border-color: rgba(147, 197, 253, 0.22);
}

.status-badge--kontaktiert {
  color: #fcd34d;
  background: rgba(252, 211, 77, 0.1);
  border-color: rgba(252, 211, 77, 0.22);
}

.status-badge--qualifiziert {
  color: var(--color-gold-light);
  background: rgba(188, 146, 75, 0.12);
  border-color: rgba(188, 146, 75, 0.28);
}

.status-badge--angebot {
  color: #c4b5fd;
  background: rgba(196, 181, 253, 0.1);
  border-color: rgba(196, 181, 253, 0.22);
}

.status-badge--gewonnen {
  color: #86efac;
  background: rgba(134, 239, 172, 0.1);
  border-color: rgba(134, 239, 172, 0.22);
}

.status-badge--hot {
  color: #fca5a5;
  background: rgba(252, 165, 165, 0.1);
  border-color: rgba(252, 165, 165, 0.28);
}

.status-badge--in-beratung,
.status-badge--in\ beratung {
  color: var(--color-gold-light);
  background: rgba(188, 146, 75, 0.12);
  border-color: rgba(188, 146, 75, 0.28);
}

.status-badge--wartend {
  color: #93c5fd;
  background: rgba(147, 197, 253, 0.1);
  border-color: rgba(147, 197, 253, 0.22);
}

.status-badge--besichtigung {
  color: #c4b5fd;
  background: rgba(167, 139, 250, 0.12);
  border-color: rgba(167, 139, 250, 0.28);
}

.status-badge--verhandlung {
  color: #fb923c;
  background: rgba(251, 146, 60, 0.12);
  border-color: rgba(251, 146, 60, 0.28);
}

.status-badge--reservierung {
  color: #5eead4;
  background: rgba(94, 234, 212, 0.12);
  border-color: rgba(94, 234, 212, 0.28);
}

.status-badge--lost {
  color: #78716c;
  background: rgba(120, 113, 108, 0.15);
  border-color: rgba(120, 113, 108, 0.3);
}

/* --- Form Controls --- */

.search-field {
  position: relative;
}

.search-field__icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-field__input,
.select-field {
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  color: var(--color-text-primary);
  background: rgba(245, 238, 228, 0.65);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.625rem;
  transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth), opacity var(--transition-smooth);
}

.search-field__input {
  padding-left: 2.5rem;
  min-width: 15rem;
}

.search-field__input:focus,
.select-field:focus {
  outline: none;
  border-color: var(--color-border-gold);
  box-shadow: 0 0 0 3px rgba(188, 146, 75, 0.1);
}

.search-field__input:disabled,
.select-field:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.search-field__input::placeholder {
  color: var(--color-text-muted);
}

.select-field {
  cursor: pointer;
  min-width: 10rem;
}

/* --- Edit Button --- */

.btn-edit {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4375rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
  background: rgba(245, 238, 228, 0.4);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.btn-edit:hover {
  color: var(--color-gold-light);
  border-color: var(--color-border-gold);
  background: rgba(188, 146, 75, 0.08);
  box-shadow: 0 2px 12px rgba(188, 146, 75, 0.12);
}

.btn-edit svg {
  width: 0.875rem;
  height: 0.875rem;
}

/* --- States --- */

.loading-state,
.empty-state,
.error-state-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.875rem;
  padding: 4rem 2rem;
  text-align: center;
}

.loading-state,
.empty-state {
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.error-state-block {
  gap: 1rem;
}

.error-state-block__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: rgba(252, 165, 165, 0.08);
  color: #fca5a5;
  border: 1px solid rgba(252, 165, 165, 0.18);
}

.error-state-block__title {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 600;
  color: #fecaca;
}

.error-state-block__text {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  max-width: 28rem;
  line-height: 1.6;
}

.loading-spinner {
  width: 1.75rem;
  height: 1.75rem;
  border: 2px solid rgba(188, 146, 75, 0.15);
  border-top-color: var(--color-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Utility --- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.volume-cell {
  font-family: var(--font-serif);
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-gold-light);
  letter-spacing: 0.02em;
}

.datetime-cell {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pipeline-card__date {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.panel--disabled .panel__toolbar {
  opacity: 0.45;
  pointer-events: none;
}

/* --- Modal --- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal.hidden {
  display: none;
}

.modal--elevated {
  z-index: 140;
}

.modal--elevated .modal__backdrop {
  background: rgba(20, 16, 12, 0.82);
  backdrop-filter: blur(6px);
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.modal__panel {
  position: relative;
  width: 100%;
  max-width: 32rem;
  max-height: calc(100dvh - 3rem);
  display: flex;
  flex-direction: column;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.98) 0%, rgba(250, 245, 237, 0.99) 100%);
  border: 1px solid var(--color-border-gold);
  border-radius: 1rem;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), var(--shadow-gold);
  overflow: hidden;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid var(--color-border-subtle);
}

.modal__title {
  font-family: var(--font-serif);
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.modal__close:hover {
  color: var(--color-gold-light);
  background: rgba(188, 146, 75, 0.08);
}

.modal__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.75rem;
  -webkit-overflow-scrolling: touch;
}

form.modal__form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-shrink: 0;
  padding: 1rem 1.75rem 1.75rem;
  border-top: 1px solid var(--color-border-subtle);
  background: rgba(250, 245, 237, 0.99);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.form-input {
  width: 100%;
  padding: 0.6875rem 1rem;
  font-size: 0.875rem;
  color: var(--color-text-primary);
  background: rgba(245, 238, 228, 0.65);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.625rem;
  transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-border-gold);
  box-shadow: 0 0 0 3px rgba(188, 146, 75, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 5rem;
  line-height: 1.5;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.375rem;
}

.role-badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 9999px;
  border: 1px solid transparent;
}

.role-badge--admin {
  color: var(--color-gold-light);
  background: rgba(188, 146, 75, 0.12);
  border-color: rgba(188, 146, 75, 0.25);
}

.role-badge--manager {
  color: #93c5fd;
  background: rgba(147, 197, 253, 0.1);
  border-color: rgba(147, 197, 253, 0.2);
}

.role-badge--vertrieb {
  color: var(--color-text-secondary);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--color-border-subtle);
}

.team-self-badge {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-gold);
  margin-left: 0.375rem;
}

.btn-edit--danger:hover {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
}

/* --- Lead Detail Drawer --- */

.lead-detail {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.lead-detail.hidden {
  display: none;
}

.lead-detail__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.lead-detail__panel {
  position: relative;
  width: min(1160px, calc(100vw - 3rem));
  max-width: none;
  height: min(90vh, 940px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 1.25rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(249, 243, 235, 0.99) 100%);
  border: 1px solid var(--color-border-gold);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  animation: lead-detail-in 0.25s ease;
}

@keyframes slide-in {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes lead-detail-in {
  from { opacity: 0; transform: scale(0.98) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.lead-detail__body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.lead-detail__main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.lead-detail__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.75rem 1.75rem 1.25rem;
  border-bottom: 1px solid var(--color-border-subtle);
}

.lead-detail__eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--color-gold);
  margin-bottom: 0.375rem;
}

.lead-detail__name {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: 0.02em;
}

.lead-detail__meta {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.375rem;
}

.lead-detail__side {
  flex: 0 0 20rem;
  width: 20rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--color-border-subtle);
  background: rgba(245, 238, 228, 0.4);
}

.lead-detail__edit-btn {
  margin: 1.25rem 1.75rem 0;
  flex: 0 0 auto;
}

.lead-detail__info {
  flex: 1;
  padding: 1.25rem 1.75rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-content: start;
  gap: 1rem 1.25rem;
  overflow-y: auto;
}

.lead-detail__info-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.lead-detail__info-label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
}

.lead-detail__info-value {
  font-size: 0.9375rem;
  color: var(--color-text-secondary);
}

@media (max-width: 860px) {
  .lead-detail {
    padding: 0;
  }
  .lead-detail__panel {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
  .lead-detail__body {
    flex-direction: column;
    overflow-y: auto;
  }
  .lead-detail__side {
    flex: none;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--color-border-subtle);
  }
}

.lead-detail__tabs {
  display: flex;
  gap: 0.25rem;
  padding: 1rem 1.75rem 0;
  border-bottom: 1px solid var(--color-border-subtle);
}

.lead-detail__tab {
  padding: 0.625rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-smooth);
  margin-bottom: -1px;
}

.lead-detail__tab:hover {
  color: var(--color-text-primary);
}

.lead-detail__tab--active {
  color: var(--color-gold-light);
  border-bottom-color: var(--color-gold);
}

.lead-detail__content {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.75rem 1.75rem;
}

.lead-detail__section {
  display: none;
}

.lead-detail__section--active {
  display: block;
}

.lead-note-form {
  margin-bottom: 1.5rem;
}

.lead-note-form .btn-primary {
  margin-top: 0.75rem;
  width: 100%;
  justify-content: center;
}

.lead-notes-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lead-note-item {
  padding: 1rem;
  background: rgba(245, 238, 228, 0.5);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.625rem;
}

.lead-note-item__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.lead-note-item__text {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.55;
  white-space: pre-wrap;
}

.lead-note-item__time {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.lead-note-item__delete {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: color var(--transition-smooth), border-color var(--transition-smooth), background var(--transition-smooth);
}

.lead-note-item__delete:hover {
  color: #f87171;
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.2);
}

.lead-history-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  padding-left: 1.25rem;
}

.lead-history-list::before {
  content: '';
  position: absolute;
  left: 0.3125rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 1px;
  background: var(--color-border-subtle);
}

.lead-history-item {
  position: relative;
  padding: 0 0 1.25rem 1rem;
}

.lead-history-item::before {
  content: '';
  position: absolute;
  left: -1rem;
  top: 0.375rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--color-gold);
  border: 2px solid var(--color-bg-deep);
}

.lead-history-item--status::before {
  background: #93c5fd;
}

.lead-history-item--note::before {
  background: var(--color-gold-light);
}

.lead-history-item__text {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  line-height: 1.45;
}

.lead-history-item__time {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.lead-name--clickable,
.pipeline-card__name--clickable {
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  transition: color var(--transition-smooth);
}

.lead-name--clickable:hover,
.pipeline-card__name--clickable:hover {
  color: var(--color-gold-light);
}

.pipeline-card__name--clickable {
  display: block;
  width: 100%;
}

/* --- Login --- */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(188, 146, 75, 0.12) 0%, transparent 60%),
    var(--color-bg-deep);
}

.login-page__wrap {
  width: 100%;
  max-width: 26rem;
  padding: 2rem 1.5rem;
}

.login-card {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.98) 0%, rgba(249, 243, 235, 0.99) 100%);
  border: 1px solid var(--color-border-gold);
  border-radius: 1.25rem;
  padding: 2.5rem 2rem;
  box-shadow: 0 24px 64px rgba(61, 52, 44, 0.16);
}

.login-card__brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-card__subtitle {
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 1.75rem;
  line-height: 1.5;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.login-form__submit {
  width: 100%;
  margin-top: 0.25rem;
}

.login-form__error {
  font-size: 0.8125rem;
  color: #f87171;
  padding: 0.625rem 0.875rem;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.2);
  border-radius: 0.5rem;
}

.login-form__error.hidden {
  display: none;
}

.user-card__logout {
  margin-top: 0.75rem;
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: color var(--transition-smooth), border-color var(--transition-smooth);
}

.user-card__logout:hover {
  color: var(--color-gold-light);
  border-color: rgba(188, 146, 75, 0.35);
}

/* --- Toast --- */

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  pointer-events: none;
}

.toast {
  padding: 0.875rem 1.25rem;
  font-size: 0.875rem;
  color: var(--color-text-primary);
  background: rgba(250, 245, 237, 0.96);
  border: 1px solid var(--color-border-gold);
  border-radius: 0.625rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.3s ease;
}

.toast--success {
  border-color: rgba(134, 239, 172, 0.35);
}

.toast--error {
  border-color: rgba(252, 165, 165, 0.35);
  color: #fecaca;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(0.5rem); }
  to { opacity: 1; transform: translateY(0); }
}

.nav-link--disabled {
  opacity: 0.45;
  pointer-events: none;
}

button.nav-link {
  width: 100%;
  text-align: left;
  background: none;
  cursor: pointer;
  font-family: inherit;
}

/* --- Utilities --- */

.hidden {
  display: none !important;
}

/* --- Views --- */

.view {
  display: none;
}

.view.view--active {
  display: block !important;
}

.view-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.875rem;
  padding: 4rem 2rem;
  text-align: center;
}

.view-placeholder__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 1rem;
  background: rgba(188, 146, 75, 0.08);
  color: var(--color-gold);
  border: 1px solid var(--color-border-subtle);
}

.view-placeholder__title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.view-placeholder__text {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  max-width: 24rem;
  line-height: 1.6;
}

/* --- Aufgaben --- */

.aufgaben-list {
  padding: 0.5rem 0;
}

.aufgabe-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.125rem 2rem;
  border-bottom: 1px solid rgba(188, 146, 75, 0.06);
  transition: background var(--transition-smooth);
}

.aufgabe-item:hover {
  background: rgba(188, 146, 75, 0.04);
}

.aufgabe-item:last-child {
  border-bottom: none;
}

.aufgabe-item__check {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 0.375rem;
  border: 2px solid var(--color-border-gold);
  background: transparent;
}

.aufgabe-item__check--done {
  background: var(--color-gold);
  border-color: var(--color-gold);
}

.aufgabe-item__body {
  flex: 1;
  min-width: 0;
}

.aufgabe-item__title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-text-primary);
}

.aufgabe-item__meta {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-top: 0.125rem;
}

.aufgabe-item__badge {
  flex-shrink: 0;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 9999px;
  color: var(--color-gold-light);
  background: rgba(188, 146, 75, 0.1);
  border: 1px solid rgba(188, 146, 75, 0.2);
}

.aufgabe-item__badge--high {
  color: #fca5a5;
  background: rgba(252, 165, 165, 0.1);
  border-color: rgba(252, 165, 165, 0.25);
}

.aufgabe-item__badge--medium {
  color: var(--color-gold-light);
  background: rgba(188, 146, 75, 0.1);
  border-color: rgba(188, 146, 75, 0.2);
}

.aufgabe-item__badge--low {
  color: var(--color-text-muted);
  background: rgba(120, 113, 108, 0.15);
  border-color: rgba(120, 113, 108, 0.25);
}

.aufgabe-item__auto {
  display: inline-block;
  margin-left: 0.375rem;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: middle;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  background: rgba(188, 146, 75, 0.14);
  color: var(--color-gold-dark);
  border: 1px solid rgba(188, 146, 75, 0.28);
}

.aufgabe-item--done .aufgabe-item__title {
  text-decoration: line-through;
  opacity: 0.5;
}

.aufgabe-item__check-btn {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 0.375rem;
  border: 2px solid var(--color-border-gold);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.aufgabe-item__check-btn:hover {
  background: rgba(188, 146, 75, 0.12);
}

.aufgabe-item__check-btn--done {
  background: var(--color-gold);
  border-color: var(--color-gold);
}

.aufgabe-item__edit {
  flex-shrink: 0;
  padding: 0.375rem 0.625rem;
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.aufgabe-item__edit:hover {
  color: var(--color-gold-light);
  border-color: var(--color-border-gold);
}

.aufgaben-empty-done {
  padding: 1.5rem 1.75rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-align: center;
}

.aufgaben-done-toggle {
  display: block;
  width: 100%;
  padding: 0.875rem 1.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-top: 1px solid var(--color-border-subtle);
  cursor: pointer;
  text-align: center;
  transition: color var(--transition-smooth);
}

.aufgaben-done-toggle:hover {
  color: var(--color-gold-light);
}

.aufgaben-done-section {
  border-top: 1px solid var(--color-border-subtle);
  opacity: 0.65;
}

/* --- Pipeline / Kanban --- */

.panel--pipeline {
  overflow: hidden;
}

.pipeline-view-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem;
  background: rgba(245, 238, 228, 0.55);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.625rem;
}

.pipeline-view-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: color var(--transition-smooth), background var(--transition-smooth);
  white-space: nowrap;
}

.pipeline-view-tab:hover {
  color: var(--color-text-secondary);
}

.pipeline-view-tab--active {
  color: var(--color-gold-light);
  background: rgba(188, 146, 75, 0.12);
}

.pipeline-view-tab__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  margin-left: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9999px;
}

.pipeline-view-tab--active .pipeline-view-tab__badge {
  color: var(--color-gold-light);
  background: rgba(188, 146, 75, 0.18);
}

.pipeline-view-tab svg {
  width: 1rem;
  height: 1rem;
}

.pipeline-list {
  padding: 0 1.5rem 1.5rem;
}

.pipeline-list.hidden {
  display: none;
}

.pipeline-list .pipeline-card__status-select {
  min-width: 11rem;
}

/* Neuer Lead — Zeile komplett gelb hervorheben */
.pipeline-list-row--alert > td {
  background: rgba(250, 204, 21, 0.18);
}

.pipeline-list-row--alert > td:first-child {
  box-shadow: inset 4px 0 0 #eab308;
}

.pipeline-list-row--alert .lead-name {
  color: #854d0e;
  font-weight: 600;
}

.pipeline-archive {
  padding: 0 1.5rem 1.5rem;
}

.pipeline-archive.hidden {
  display: none;
}

.pipeline-board.hidden {
  display: none;
}

.pipeline-board {
  display: flex;
  gap: 1rem;
  padding: 1.25rem 1.5rem 1.5rem;
  overflow-x: auto;
  min-height: 28rem;
  align-items: flex-start;
}

.pipeline-column {
  flex: 0 0 17rem;
  min-width: 17rem;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 16rem);
  background: rgba(245, 238, 228, 0.45);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.875rem;
  transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth);
}

.pipeline-column--drag-over {
  border-color: var(--color-border-gold);
  box-shadow: 0 0 24px rgba(188, 146, 75, 0.15);
}

/* Neuer Lead vorhanden — Spalte komplett gelb hervorheben */
.pipeline-column--alert {
  background: rgba(250, 204, 21, 0.16);
  border-color: rgba(234, 179, 8, 0.55);
  box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.35), 0 8px 24px rgba(234, 179, 8, 0.12);
}

.pipeline-column--alert .pipeline-column__header {
  background: rgba(250, 204, 21, 0.22);
  border-top-color: #eab308;
  border-bottom-color: rgba(234, 179, 8, 0.4);
}

.pipeline-column--alert .pipeline-column__title {
  color: #854d0e;
}

.pipeline-column--alert .pipeline-column__count {
  color: #854d0e;
  background: rgba(234, 179, 8, 0.28);
}

.pipeline-column__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.125rem;
  border-bottom: 1px solid var(--color-border-subtle);
  border-top: 3px solid transparent;
  border-radius: 0.875rem 0.875rem 0 0;
}

.pipeline-column--hot .pipeline-column__header { border-top-color: #fca5a5; }
.pipeline-column--beratung .pipeline-column__header { border-top-color: var(--color-gold); }
.pipeline-column--wartend .pipeline-column__header { border-top-color: #93c5fd; }
.pipeline-column--gewonnen .pipeline-column__header { border-top-color: #86efac; }
.pipeline-column--verloren .pipeline-column__header { border-top-color: #78716c; }

.pipeline-column__title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-secondary);
}

.pipeline-column__count {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.375rem;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--color-gold-light);
  background: rgba(188, 146, 75, 0.12);
  border-radius: 9999px;
}

.pipeline-column__cards {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  min-height: 6rem;
}

.pipeline-column__empty {
  padding: 1.5rem 0.75rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.pipeline-card {
  padding: 1rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95) 0%, rgba(250, 245, 237, 0.98) 100%);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.75rem;
  cursor: grab;
  transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth), transform var(--transition-smooth), opacity var(--transition-smooth);
}

.pipeline-card:hover {
  border-color: var(--color-border-gold);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.pipeline-card:active {
  cursor: grabbing;
}

.pipeline-card--dragging {
  opacity: 0.45;
  transform: scale(0.97);
}

.pipeline-card--hidden {
  opacity: 0.25;
  pointer-events: none;
}

.pipeline-card__name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 0.375rem;
  letter-spacing: 0.01em;
}

.pipeline-card__email {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-bottom: 0.625rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.pipeline-card__engagement {
  font-family: var(--font-serif);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-gold-light);
}

.pipeline-card__actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding-top: 0.625rem;
  border-top: 1px solid rgba(188, 146, 75, 0.08);
}

.pipeline-card__status-select {
  flex: 1;
  padding: 0.375rem 0.5rem;
  font-size: 0.6875rem;
  color: var(--color-text-secondary);
  background: rgba(245, 238, 228, 0.6);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.375rem;
  cursor: pointer;
}

.pipeline-card__status-select:focus {
  outline: none;
  border-color: var(--color-border-gold);
}

.pipeline-card__edit {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  color: var(--color-text-muted);
  background: transparent;
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.pipeline-card__edit:hover {
  color: var(--color-gold-light);
  border-color: var(--color-border-gold);
  background: rgba(188, 146, 75, 0.08);
}

.pipeline-card__edit svg {
  width: 0.75rem;
  height: 0.75rem;
}

/* --- Scrollbar --- */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-deep);
}

::-webkit-scrollbar-thumb {
  background: rgba(188, 146, 75, 0.22);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(188, 146, 75, 0.38);
}

/* --- Analytics --- */

.analytics-page {
  padding-bottom: 2rem;
}

.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
}

@media (max-width: 1280px) {
  .analytics-kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .analytics-kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

.analytics-kpi {
  padding: 1.25rem 1.375rem;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.95) 0%, rgba(249, 243, 235, 0.98) 100%);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.875rem;
}

.analytics-kpi__label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.analytics-kpi__value {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.1;
}

.analytics-kpi__meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.375rem;
}

.analytics-charts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 1200px) {
  .analytics-charts-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .analytics-charts-grid { grid-template-columns: 1fr; }
}

.analytics-card {
  padding: 1.25rem 1.375rem 1.375rem;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.95) 0%, rgba(249, 243, 235, 0.98) 100%);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.875rem;
  display: flex;
  flex-direction: column;
  min-height: 18rem;
}

.analytics-card__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.analytics-card__subtitle {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
  margin-bottom: 1rem;
}

.analytics-card__chart {
  flex: 1;
  position: relative;
  min-height: 11rem;
}

.analytics-card__chart--compact {
  min-height: 9rem;
}

.analytics-card__stats {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  justify-content: center;
}

.analytics-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(245, 238, 228, 0.45);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.5rem;
}

.analytics-stat-row__label {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}

.analytics-stat-row__value {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-gold-light);
  font-variant-numeric: tabular-nums;
}

.analytics-tables-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 1024px) {
  .analytics-tables-grid { grid-template-columns: 1fr; }
}

.analytics-table-panel {
  margin: 0;
}

/* --- Projekte (Block 2) --- */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
  padding: var(--space-card);
}

@media (max-width: 640px) {
  .projects-grid { grid-template-columns: 1fr; padding: 1.25rem; }
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  padding: 1.5rem;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.98) 0%, rgba(250, 245, 237, 0.98) 100%);
  border: 1px solid var(--color-border-subtle);
  border-radius: 1rem;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: border-color var(--transition-smooth), box-shadow var(--transition-smooth), transform var(--transition-smooth);
}

.project-card:hover {
  border-color: var(--color-border-gold);
  box-shadow: var(--shadow-gold), var(--shadow-card);
  transform: translateY(-2px);
}

.project-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.project-card__title {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.project-card__location {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin-top: 0.25rem;
}

.project-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.project-tag {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.625rem;
  border-radius: 0.5rem;
  background: rgba(188, 146, 75, 0.12);
  color: var(--color-gold-dark);
  border: 1px solid rgba(188, 146, 75, 0.22);
}

.project-status-badge {
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.6rem;
  border-radius: 0.5rem;
  white-space: nowrap;
}

/* Grün = Verfügbar (Einheit) / In Vermarktung (Projekt) */
.project-status-badge--verfuegbar { background: rgba(47, 158, 95, 0.15); color: #2f7d4a; border: 1px solid rgba(47, 158, 95, 0.38); }
.project-status-badge--vermarktung { background: rgba(47, 158, 95, 0.15); color: #2f7d4a; border: 1px solid rgba(47, 158, 95, 0.38); }
/* Gelb = Reserviert (Einheit) / In Vorbereitung (Projekt) */
.project-status-badge--reserviert { background: rgba(224, 168, 74, 0.20); color: #9a6b15; border: 1px solid rgba(224, 168, 74, 0.45); }
.project-status-badge--vorbereitung { background: rgba(224, 168, 74, 0.20); color: #9a6b15; border: 1px solid rgba(224, 168, 74, 0.45); }
/* Rot = Verkauft (Einheit) / Ausverkauft (Projekt) */
.project-status-badge--ausverkauft { background: rgba(176, 69, 62, 0.15); color: #a5403a; border: 1px solid rgba(176, 69, 62, 0.4); }
/* Blau = Gesperrt (Einheit) / Pausiert (Projekt) */
.project-status-badge--pausiert { background: rgba(59, 110, 160, 0.15); color: #2f6aa0; border: 1px solid rgba(59, 110, 160, 0.38); }

.project-card__stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  padding-top: 0.875rem;
  border-top: 1px solid var(--color-border-subtle);
}

.project-stat__label {
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
}

.project-stat__value {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-top: 0.125rem;
}

.project-stat__value--price {
  color: var(--color-gold-dark);
}

.project-card__desc {
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--color-text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Formular-Abschnitte & breites Modal */

.form-section-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-gold-dark);
  margin: 0.5rem 0 0.25rem;
  padding-bottom: 0.375rem;
  border-bottom: 1px solid var(--color-border-subtle);
}

.form-section-label:first-child { margin-top: 0; }

.modal__panel--wide {
  max-width: 44rem;
}

/* --- Datencenter (Nur-Lese-Übersicht) --- */

.datacenter-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem;
}

.datacenter-filter {
  min-width: 10rem;
  cursor: pointer;
}

.datacenter-table-wrap {
  overflow-x: auto;
  border-radius: 0.75rem;
  border: 1px solid var(--color-border-subtle);
}

.datacenter-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.datacenter-table thead th {
  position: sticky;
  top: 0;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  background: rgba(243, 236, 225, 0.96);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border-subtle);
}

.datacenter-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border-subtle);
  color: var(--color-text-primary);
}

.datacenter-table tbody tr:last-child td {
  border-bottom: none;
}

.datacenter-table tbody tr:hover td {
  background: rgba(188, 146, 75, 0.06);
}

.datacenter-table__name {
  font-weight: 600;
}

.datacenter-table__num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.datacenter-table__price {
  font-weight: 700;
  color: var(--color-gold-dark);
}

.datacenter-table__inhalt {
  white-space: normal;
  min-width: 16rem;
  max-width: 22rem;
  color: var(--color-text-muted);
}

.datacenter-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-style: italic;
}

.datacenter-row--clickable {
  cursor: pointer;
}

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

/* --- Datencenter: Projekt-Detail-Modal --- */

#dc-detail-modal .modal__panel {
  max-width: min(76rem, calc(100vw - 2rem));
}

.modal__subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

.dc-open-hint {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--color-gold-dark);
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}

.datacenter-row--clickable:hover .dc-open-hint {
  opacity: 1;
}

.dc-detail-section {
  margin-bottom: 1.75rem;
}

.dc-detail-section:last-child {
  margin-bottom: 0;
}

.dc-detail-heading {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin: 0 0 0.75rem;
}

.dc-detail-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.dc-detail-section__head .dc-detail-heading {
  margin: 0;
}

.dc-detail-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.dc-unit-legend {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.dc-unit-legend .dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  display: inline-block;
}

.dot--verfuegbar { background: #2f9e5f; }
.dot--reserviert { background: #d99a2b; }
.dot--ausverkauft { background: #b0453e; }

.btn-secondary--sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.75rem;
}

.dc-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.75rem 1.5rem;
  margin: 0;
}

.dc-info-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.85rem;
  background: rgba(250, 245, 237, 0.6);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.6rem;
}

.dc-info-item--full {
  grid-column: 1 / -1;
}

.dc-info-item dt {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  font-weight: 700;
}

.dc-info-item dd {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-text-primary);
}

/* Dokumente */

.dc-doc-upload {
  padding: 1rem;
  background: rgba(250, 245, 237, 0.6);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.75rem;
  margin-bottom: 1rem;
}

.dc-doc-upload__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.dc-doc-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.dc-doc-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.7rem;
  background: rgba(255, 255, 255, 0.6);
}

.dc-doc-icon {
  flex-shrink: 0;
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  border-radius: 0.5rem;
  background: rgba(188, 146, 75, 0.12);
  color: var(--color-gold-dark);
}

.dc-doc-icon svg { width: 1.15rem; height: 1.15rem; }

.dc-doc-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}

.dc-doc-title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dc-doc-sub {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.dc-doc-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.dc-doc-actions a { text-decoration: none; }

.dc-doc-del {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 0.5rem;
  border: 1px solid var(--color-border-subtle);
  background: transparent;
  color: var(--color-text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dc-doc-del:hover {
  color: #b0453e;
  border-color: #b0453e;
  background: rgba(176, 69, 62, 0.08);
}

.dc-doc-empty {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin: 0;
}

/* --- Band VIII: Kartenqualität, Handlungsbedarf, Interaktion --- */

.modal__panel--sm {
  max-width: 30rem;
}

.lead-completeness {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
}
.lead-completeness--high { color: #166534; background: rgba(34, 197, 94, 0.15); }
.lead-completeness--mid { color: #854d0e; background: rgba(234, 179, 8, 0.18); }
.lead-completeness--low { color: #991b1b; background: rgba(239, 68, 68, 0.15); }

.lead-detail__flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.5rem;
}
.lead-flag {
  padding: 0.1rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: #991b1b;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
}
.lead-flag--stale { color: #854d0e; background: rgba(234, 179, 8, 0.14); border-color: rgba(234, 179, 8, 0.3); }

.lead-flags {
  display: inline-flex;
  gap: 0.2rem;
  vertical-align: middle;
  margin-left: 0.35rem;
}
.lead-flag-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  display: inline-block;
  background: #ef4444;
}
.lead-flag-dot--no-task { background: #ef4444; }
.lead-flag-dot--stale { background: #eab308; }
.lead-flag-dot--overdue-contact { background: #f97316; }
.lead-flag-dot--overdue-task { background: #dc2626; }

.lead-interaction-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border-subtle);
}

.lead-history-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.lead-history-item__badge {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}
.lead-history-item__channel {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--color-gold-light);
  background: rgba(188, 146, 75, 0.14);
  padding: 0.05rem 0.5rem;
  border-radius: 9999px;
}
.lead-history-item__line {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin-top: 0.15rem;
}
.lead-history-item__line span {
  font-weight: 600;
  color: var(--color-text-muted);
}
.lead-detail__side-actions {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 1.25rem;
}

.lead-detail__email-btn {
  width: 100%;
  justify-content: center;
}

.email-compose__body {
  min-height: 14rem;
  font-family: var(--font-sans);
  line-height: 1.6;
}

.email-compose__panel {
  max-width: 40rem;
  border-radius: 1.125rem;
  overflow: hidden;
}

.email-compose__hero {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.5rem 1.75rem 1.25rem;
  background: linear-gradient(135deg, rgba(188, 146, 75, 0.14) 0%, rgba(255, 255, 255, 0.98) 55%);
  border-bottom: 1px solid var(--color-border-subtle);
  position: relative;
}

.email-compose__hero .modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.email-compose__hero-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.875rem;
  background: rgba(188, 146, 75, 0.16);
  border: 1px solid rgba(188, 146, 75, 0.28);
  color: var(--color-gold-dark);
}

.email-compose__hero-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.email-compose__eyebrow {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-gold-dark);
  margin-bottom: 0.25rem;
}

.email-compose__title {
  margin: 0;
  font-size: 1.25rem;
}

.email-compose__lead {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.email-compose__from {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  background: rgba(245, 238, 228, 0.65);
  border: 1px solid var(--color-border-subtle);
  border-radius: 0.625rem;
}

.email-compose__from-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
}

.email-compose__from-value {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-primary);
}

.email-compose__templates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.email-compose__templates-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-right: 0.25rem;
}

.email-compose__template-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-gold-dark);
  background: rgba(188, 146, 75, 0.1);
  border: 1px solid rgba(188, 146, 75, 0.25);
  border-radius: 9999px;
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.email-compose__template-btn:hover {
  background: rgba(188, 146, 75, 0.18);
  border-color: var(--color-border-gold);
}

.email-compose__footer {
  flex-direction: column;
  align-items: stretch;
  gap: 0.875rem;
}

.email-compose__footer-hint {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin: 0;
}

.email-compose__footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .email-compose__footer-actions {
    flex-direction: column-reverse;
  }

  .email-compose__footer-actions .btn-primary,
  .email-compose__footer-actions .btn-secondary {
    width: 100%;
    justify-content: center;
  }
}

.lead-history-item--email {
  border-left: 3px solid #3b82f6;
  padding-left: 0.75rem;
}

.analytics-kpi--alert {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.06);
}
.analytics-kpi--alert .analytics-kpi__value { color: #b91c1c; }

/* ==========================================================================
   Mobile / Responsive
   ========================================================================== */

@media (max-width: 1023px) {
  .mobile-menu-btn {
    display: inline-flex;
  }

  .sidebar-close-btn {
    display: inline-flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 190;
    background: rgba(0, 0, 0, 0.52);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-smooth);
  }

  body.mobile-nav-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    width: min(18rem, 88vw);
    max-width: none;
    transform: translateX(-105%);
    transition: transform var(--transition-smooth);
    box-shadow: none;
  }

  body.mobile-nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0, 0, 0, 0.35);
  }

  .top-bar {
    padding: 0.875rem 1rem !important;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .top-bar__start {
    width: 100%;
  }

  .top-bar__titles h1 {
    font-size: 1.25rem !important;
    line-height: 1.25;
  }

  .top-bar__titles p {
    font-size: 0.8125rem;
    margin-top: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .top-bar__actions {
    width: 100%;
    justify-content: flex-end;
    gap: 0.5rem !important;
  }

  .main-content {
    padding: 1rem !important;
    gap: 1.25rem !important;
  }

  .kpi-card {
    padding: 1.25rem 1.375rem;
  }

  .panel__header,
  .panel__footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .panel__header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding-top: 1.25rem;
    padding-bottom: 1rem;
  }

  .panel__toolbar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .search-field__input {
    min-width: 0;
    width: 100%;
  }

  .select-field {
    width: 100%;
  }

  .data-table th,
  .data-table td {
    padding-left: 0.875rem;
    padding-right: 0.875rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .modal {
    padding: 0;
    align-items: stretch;
  }

  .modal__panel {
    max-width: none;
    max-height: none;
    height: 100dvh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .modal__panel--wide,
  .modal__panel--sm {
    max-width: none;
  }

  .modal__header,
  .modal__body,
  .modal__footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .modal__footer {
    flex-wrap: wrap;
    justify-content: stretch;
  }

  .modal__footer .btn-primary,
  .modal__footer .btn-secondary {
    flex: 1;
    justify-content: center;
    min-width: 0;
  }

  .lead-detail {
    padding: 0;
  }

  .lead-detail__panel {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
  }

  .lead-detail__tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-left: 1rem;
    padding-right: 1rem;
    -webkit-overflow-scrolling: touch;
  }

  .lead-detail__tab {
    flex-shrink: 0;
  }

  .lead-detail__content {
    padding: 1rem;
  }

  .pipeline-board {
    padding: 1rem;
    min-height: 20rem;
  }

  .pipeline-column {
    flex: 0 0 14.5rem;
    min-width: 14.5rem;
    max-height: calc(100dvh - 12rem);
  }

  .pipeline-list,
  .pipeline-archive {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .pipeline-view-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  .settings-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .settings-panels {
    padding: 1rem;
  }

  .connection-error {
    flex-direction: column;
    padding: 1.25rem;
  }

  .connection-error__retry {
    align-self: stretch;
    width: 100%;
  }

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

  .projects-grid {
    padding: 1rem;
  }

  .nav-link,
  .nav-section__toggle,
  .nav-sublink {
    min-height: 2.75rem;
  }
}

@media (max-width: 640px) {
  .top-bar__actions .btn-label {
    display: none;
  }

  .top-bar__actions .btn-primary,
  .top-bar__actions .btn-secondary {
    padding: 0.625rem;
    min-width: 2.75rem;
    justify-content: center;
  }

  .panel__footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.375rem;
  }

  .datacenter-kpis {
    grid-template-columns: 1fr;
  }

  .analytics-kpi-grid {
    grid-template-columns: 1fr 1fr;
  }

  .kpi-card__value {
    font-size: 1.75rem;
  }

  .modal__title {
    font-size: 1.125rem;
  }

  .lead-detail__header {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .lead-detail__side-actions .btn-primary,
  .lead-detail__side-actions .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  .aufgabe-item {
    padding: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .aufgabe-item__badge {
    margin-left: 2rem;
  }
}

@supports (padding: max(0px)) {
  @media (max-width: 1023px) {
    .top-bar {
      padding-top: max(0.875rem, env(safe-area-inset-top)) !important;
    }

    .sidebar {
      padding-top: env(safe-area-inset-top);
      padding-bottom: env(safe-area-inset-bottom);
    }

    .modal__panel,
    .lead-detail__panel {
      padding-bottom: env(safe-area-inset-bottom);
    }
  }
}
