/* ── Reset ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design Tokens ────────────────────────────────────── */
:root {
  /* Primär */
  --color-primary:        #1A1A2E;
  --color-primary-hover:  #2D2D44;
  --color-bg:             #FFFFFF;
  --color-bg-subtle:      #F5F5F7;
  --color-border:         #E0E0E0;
  --color-border-focus:   #1A1A2E;
  --color-text:           #1A1A2E;
  --color-text-muted:     #6B7280;
  --color-text-inverse:   #FFFFFF;

  /* Status-Phasen */
  --color-status-interest: #9CA3AF;
  --color-status-planning: #F59E0B;
  --color-status-offer:    #3B82F6;
  --color-status-build:    #22C55E;
  --color-status-active:   #1A1A2E;

  /* Semantisch */
  --color-success:         #22C55E;
  --color-warning:         #F59E0B;
  --color-danger:          #EF4444;
  --color-info:            #DBEAFE;
  --color-info-border:     #93C5FD;
  --color-conflict-bg:     #FEF3C7;
  --color-conflict-border: #F59E0B;
  --color-match-badge:     #DBEAFE;

  /* FW-Netz */
  --color-fw-bestand:    #E91E63;
  --color-fw-projektiert:#E91E63;

  /* Typografie */
  --font-family:   'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --text-xs:   0.75rem;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;

  /* Zeilenhöhe */
  --leading-tight:   1.25;
  --leading-normal:  1.5;
  --leading-relaxed: 1.75;

  /* Spacing (4px-Raster) */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  20px;
  --sp-6:  24px;
  --sp-8:  32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Radius */
  --radius-sm:   4px;
  --radius-md:   6px;
  --radius-lg:   8px;
  --radius-full: 9999px;

  /* Schatten */
  --shadow-sm:    0 1px 2px rgba(0,0,0,0.05);
  --shadow-md:    0 4px 6px -1px rgba(0,0,0,0.1);
  --shadow-lg:    0 10px 15px -3px rgba(0,0,0,0.1);
  --shadow-panel: -4px 0 15px rgba(0,0,0,0.08);

  /* Layout */
  --navbar-height:    64px;
  --side-panel-width: 380px;
}

/* ── Base ─────────────────────────────────────────────── */
body {
  font-family: var(--font-family);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg-subtle);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}

/* ── App Layout ───────────────────────────────────────── */
.layout {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Navbar ───────────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--navbar-height);
  padding: 0 var(--sp-6);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.navbar-brand {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: var(--sp-2);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.navbar-brand-name {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
}
.navbar-brand-sub {
  font-size: var(--text-sm);
  font-weight: 400;
  color: var(--color-text-muted);
  letter-spacing: 0;
}

.navbar-nav {
  display: flex;
  align-items: stretch;
  height: 100%;
  margin: 0 var(--sp-8);
  flex: 1;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  padding: 0 var(--sp-3);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-bottom-color 0.15s;
  white-space: nowrap;
}
.nav-item.router-link-active,
.nav-item.active {
  color: var(--color-text);
  border-bottom-color: var(--color-primary);
}
.nav-item:hover { color: var(--color-text); }

.nav-badge {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-left: var(--sp-1);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

/* ── Breadcrumb ───────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.breadcrumb a {
  color: var(--color-text-muted);
  text-decoration: none;
}
.breadcrumb a:hover {
  color: var(--color-text);
  text-decoration: underline;
}
.breadcrumb .separator { margin: 0 var(--sp-2); }

/* ── Main Content ─────────────────────────────────────── */
main {
  flex: 1;
  padding: var(--sp-8);
  overflow-y: auto;
}

/* ── Typografie ───────────────────────────────────────── */
h1 { font-size: var(--text-2xl); font-weight: 700; line-height: var(--leading-tight); }
h2 { font-size: var(--text-xl);  font-weight: 600; line-height: var(--leading-tight); margin-bottom: var(--sp-4); }
h3 { font-size: var(--text-lg);  font-weight: 500; line-height: var(--leading-tight); }

/* ── Buttons ──────────────────────────────────────────── */
.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border: none;
  padding: var(--sp-2) var(--sp-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-family);
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--color-primary-hover); }

.btn-secondary {
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  padding: var(--sp-2) var(--sp-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-family);
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--color-bg-subtle); }

.btn-success {
  background: var(--color-success);
  color: var(--color-text-inverse);
  border: none;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-family);
}

.btn-danger {
  background: var(--color-danger);
  color: var(--color-text-inverse);
  border: none;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-family);
}

.btn-icon {
  background: transparent;
  border: none;
  padding: var(--sp-2);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  font-family: var(--font-family);
  transition: background 0.15s, color 0.15s;
}
.btn-icon:hover {
  background: var(--color-bg-subtle);
  color: var(--color-text);
}

/* Suchfeld in der Navbar */
.navbar-search {
  display: flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  overflow: hidden;
  transition: border-color 0.15s;
}
.navbar-search:focus-within {
  border-color: var(--color-border-focus);
}
.navbar-search input {
  border: none;
  outline: none;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  font-family: var(--font-family);
  color: var(--color-text);
  background: transparent;
  width: 200px;
}
.navbar-search input::placeholder {
  color: var(--color-text-muted);
}
.navbar-search button {
  border: none;
  background: transparent;
  padding: var(--sp-2);
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.navbar-search button:hover {
  color: var(--color-text);
}

/* User/Logout-Button in der Navbar */
.nav-user {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  transition: background 0.15s, color 0.15s;
}
.nav-user:hover {
  background: var(--color-bg-subtle);
  color: var(--color-text);
}

/* ── Badges & Tags ────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  font-weight: 500;
}
.status-badge .dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
}

.source-badge {
  display: inline-block;
  padding: 2px var(--sp-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.source-badge--web   { background: #DBEAFE; color: #1D4ED8; }
.source-badge--email { background: #FEF3C7; color: #92400E; }
.source-badge--xls   { background: #D1FAE5; color: #065F46; }

.file-badge {
  display: inline-block;
  padding: 2px var(--sp-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.file-badge--pdf  { background: #FEE2E2; color: #991B1B; }
.file-badge--img  { background: #E0E7FF; color: #3730A3; }
.file-badge--xlsx { background: #D1FAE5; color: #065F46; }

/* ── Formularelemente ─────────────────────────────────── */
.form-label {
  display: block;
  margin-bottom: var(--sp-1);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}
.form-label.required::after {
  content: ' *';
  color: var(--color-danger);
}

.form-input {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  font-family: var(--font-family);
  transition: border-color 0.15s;
}
.form-input:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(26, 26, 46, 0.1);
}

.form-error {
  margin-top: var(--sp-1);
  font-size: var(--text-xs);
  color: var(--color-danger);
}

.form-hint {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-3);
  background: var(--color-conflict-bg);
  border-left: 3px solid var(--color-warning);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

/* ── Cards ────────────────────────────────────────────── */
.lead-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}
.lead-card:hover { box-shadow: var(--shadow-md); }

.conflict-card {
  background: var(--color-conflict-bg);
  border: 1px solid var(--color-conflict-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
}

/* ── Tabs ─────────────────────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  gap: var(--sp-6);
}
.tab-item {
  padding: var(--sp-3) 0;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-bottom-color 0.15s;
}
.tab-item.active {
  color: var(--color-text);
  border-bottom-color: var(--color-primary);
}

/* ── Stepper ──────────────────────────────────────────── */
.stepper-dot {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  transition: transform 0.15s;
}
.stepper-dot.completed {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.stepper-dot.active {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  transform: scale(1.2);
  box-shadow: 0 0 0 4px rgba(26, 26, 46, 0.15);
}
.stepper-dot.pending {
  background: transparent;
  border: 2px solid var(--color-border);
  color: var(--color-text-muted);
}

/* ── Statuskasten ─────────────────────────────────────── */
.status-box {
  background: var(--color-info);
  border: 1px solid var(--color-info-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
}

/* ── Detail-Seitenpanel ───────────────────────────────── */
.side-panel {
  position: fixed;
  top: var(--navbar-height);
  right: 0;
  width: var(--side-panel-width);
  height: calc(100vh - var(--navbar-height));
  background: var(--color-bg);
  border-left: 1px solid var(--color-border);
  box-shadow: var(--shadow-panel);
  overflow-y: auto;
  z-index: 100;
  transform: translateX(100%);
  transition: transform 0.25s ease-in-out;
}
.side-panel.open { transform: translateX(0); }

/* ── Dropdown-Filter ──────────────────────────────────── */
.filter-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  background: var(--color-bg);
  cursor: pointer;
  font-family: var(--font-family);
  transition: background 0.15s;
}
.filter-dropdown-trigger:hover { background: var(--color-bg-subtle); }
.filter-dropdown-trigger .count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ── Kommunikations-Timeline ──────────────────────────── */
.timeline-entry {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
}
.timeline-entry .timestamp {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* ── Karten-Elemente ──────────────────────────────────── */
.map-pin {
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  border: 2px solid var(--color-bg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.map-popup {
  background: var(--color-bg);
  border-radius: 12px;
  padding: 10px 14px 12px;
  min-width: 160px;
  max-width: 210px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15), 0 1px 4px rgba(0,0,0,0.06);
  font-family: var(--font-family);
  font-size: var(--text-sm);
  pointer-events: none;
  position: relative;
}

.map-popup:has(div)::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-top-color: var(--color-bg);
  border-bottom: none;
}

.popup-name {
  font-weight: 600;
  color: var(--color-text);
  line-height: var(--leading-tight);
  margin-bottom: var(--sp-1);
}

.popup-address {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--sp-2);
}

.popup-badges {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.popup-badge-gray {
  display: inline-block;
  width: fit-content;
  padding: 2px var(--sp-2);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}

.popup-badge-phase {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
}

.popup-phase-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.map-legend {
  position: absolute;
  bottom: var(--sp-6);
  left: var(--sp-3);
  background: rgba(15, 15, 30, 0.85);
  color: #e0e8ff;
  font-size: var(--text-xs);
  line-height: 1.8;
  border-radius: var(--radius-md);
  border: 1px solid rgba(100, 180, 255, 0.2);
  z-index: 10;
  overflow: hidden;
  min-width: 130px;
}

.map-legend__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
  user-select: none;
}
.map-legend__header:hover { background: rgba(255, 255, 255, 0.05); }

.map-legend__title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  opacity: .7;
  text-transform: uppercase;
}

.map-legend__toggle {
  font-size: 10px;
  opacity: .5;
  transition: transform 0.2s;
}
.map-legend--collapsed .map-legend__toggle { transform: rotate(180deg); }

.map-legend__body {
  padding: 0 var(--sp-3) var(--sp-2);
}
.map-legend--collapsed .map-legend__body { display: none; }

.map-legend__section {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .05em;
  opacity: .6;
  text-transform: uppercase;
  margin: var(--sp-2) 0 2px;
}

.map-legend__item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.map-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 15, 30, 0.85);
  color: #e0e8ff;
  font-size: var(--text-xs);
  line-height: 1.6;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(100, 180, 255, 0.3);
  white-space: nowrap;
  z-index: 10;
}

.map-tooltip__sep {
  border: none;
  border-top: 1px solid rgba(100, 180, 255, 0.15);
  margin: 4px 0;
}

.map-tooltip__row {
  display: flex;
  gap: var(--sp-3);
}

.map-tooltip__label {
  opacity: .55;
  min-width: 76px;
  flex-shrink: 0;
}

/* ── Login ────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-subtle);
}

.login-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--sp-10) var(--sp-8);
  width: 100%;
  max-width: 360px;
}
.login-card h1 {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: var(--sp-6);
  color: var(--color-text);
  line-height: var(--leading-tight);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin-bottom: var(--sp-4);
}
.field label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

input[type=text],
input[type=password] {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  font-family: var(--font-family);
  transition: border-color 0.15s;
}
input[type=text]:focus,
input[type=password]:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(26, 26, 46, 0.1);
}

button[type=submit] {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  margin-top: var(--sp-2);
  font-family: var(--font-family);
  transition: background 0.15s;
}
button[type=submit]:hover:not(:disabled) { background: var(--color-primary-hover); }
button[type=submit]:disabled { opacity: 0.55; cursor: not-allowed; }

.error {
  color: var(--color-danger);
  font-size: var(--text-sm);
  margin-top: var(--sp-3);
}

/* ── Map ─────────────────────────────────────────────── */
.map-container {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.map {
  width: 100%;
  height: calc(100vh - var(--navbar-height) - var(--sp-8) - var(--sp-8));
}

/* ── Map Filter Panel ─────────────────────────────────── */
.map-filter-wrap {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-2);
}

.map-filter-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-family);
  color: var(--color-text);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.map-filter-btn:hover { background: var(--color-bg-subtle); }
.map-filter-btn.is-active {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}

.map-filter-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-danger);
  border: 2px solid var(--color-bg);
}
.map-filter-btn.is-active .map-filter-badge {
  border-color: var(--color-primary);
}

.map-filter-spinner {
  display: inline-block;
  width: 8px;
  height: 8px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: var(--radius-full);
  animation: mapSpinnerRotate 0.6s linear infinite;
}
@keyframes mapSpinnerRotate {
  to { transform: rotate(360deg); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.map-filter-panel {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 232px;
  overflow: hidden;
  transform-origin: top right;
  animation: filterPanelIn 0.14s ease;
}
@keyframes filterPanelIn {
  from { opacity: 0; transform: scale(0.96) translateY(-4px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}

.map-filter-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
  font-weight: 600;
}

.map-filter-panel__close {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  padding: var(--sp-1);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
  font-family: var(--font-family);
  transition: background 0.15s, color 0.15s;
}
.map-filter-panel__close:hover {
  background: var(--color-bg-subtle);
  color: var(--color-text);
}

.map-filter-section {
  padding: var(--sp-3) var(--sp-4);
}
.map-filter-section + .map-filter-section {
  border-top: 1px solid var(--color-border);
}

.map-filter-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--sp-2);
}

.map-filter-select {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.15s;
  appearance: auto;
}
.map-filter-select:focus {
  outline: none;
  border-color: var(--color-border-focus);
}
.map-filter-select:disabled { opacity: 0.5; cursor: not-allowed; }

.map-filter-reset {
  margin-top: var(--sp-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-family);
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}
.map-filter-reset:hover { color: var(--color-text); }

.map-select-modes {
  display: flex;
  gap: var(--sp-2);
}

.map-select-mode-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.map-select-mode-btn:hover {
  background: var(--color-bg-subtle);
  color: var(--color-text);
}
.map-select-mode-btn.is-active {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-color: var(--color-primary);
}

.map-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  cursor: pointer;
  user-select: none;
}

.map-toggle-label {
  font-size: var(--text-sm);
  color: var(--color-text);
}

.map-toggle-switch {
  position: relative;
  display: inline-block;
  width: 32px;
  height: 18px;
  flex-shrink: 0;
}
.map-toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.map-toggle-track {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: var(--radius-full);
  transition: background 0.18s;
  cursor: pointer;
}
.map-toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s;
}
.map-toggle-switch input:checked + .map-toggle-track {
  background: var(--color-primary);
}
.map-toggle-switch input:checked + .map-toggle-track::after {
  transform: translateX(14px);
}

/* ── Search Dropdown ──────────────────────────────────── */
.search-wrap {
  position: relative;
}

.search-wrap .navbar-search {
  transition: border-color 0.15s;
}
.search-wrap .navbar-search.is-open {
  border-color: var(--color-border-focus);
}

.search-icon-left {
  display: flex;
  align-items: center;
  padding: 0 var(--sp-1) 0 var(--sp-3);
  color: var(--color-text-muted);
  flex-shrink: 0;
}

/* Remove left padding from input — icon provides it */
.search-wrap .navbar-search input {
  padding-left: var(--sp-1);
}

.search-clear-btn {
  border: none;
  background: transparent;
  padding: var(--sp-2);
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.search-clear-btn:hover { color: var(--color-text); }

.search-dropdown {
  position: absolute;
  top: calc(100% + var(--sp-2));
  right: 0;
  width: 520px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
}

.search-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.search-result {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background 0.1s;
}
.search-result:last-of-type { border-bottom: none; }
.search-result:hover { background: var(--color-bg-subtle); }

.search-result-icon {
  color: var(--color-text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}

.search-result-body {
  flex: 1;
  min-width: 0;
}

.search-result-name {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-base);
}

.search-result-badge {
  display: inline-block;
  padding: 1px var(--sp-2);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.search-result-address {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--sp-1);
}

.search-result-meta {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--sp-1);
}

.search-result-side {
  flex-shrink: 0;
  text-align: right;
  min-width: 90px;
}

.search-result-side-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

.search-result-side-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--sp-1);
}

.search-dropdown-footer {
  padding: var(--sp-3) var(--sp-4);
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  border-top: 1px solid var(--color-border);
  color: var(--color-text);
  transition: background 0.1s;
}
.search-dropdown-footer:hover { background: var(--color-bg-subtle); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar-nav { display: none; }
  main { padding: var(--sp-5); }
}

/* ── Dev: DB status badge ─────────────────────────────── */
.dev-db-badge {
  position: fixed;
  bottom: var(--sp-3);
  right: var(--sp-3);
  z-index: 9999;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-family: var(--font-family);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.75;
  background: #1e1e2e;
  color: #cdd6f4;
  border: 1px solid rgba(255,255,255,0.08);
  pointer-events: auto;
  cursor: default;
  user-select: none;
  transition: opacity 0.2s;
}
.dev-db-badge:hover { opacity: 1; }

.dev-db-badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #6b7280;
}
.dev-db-badge--loading .dev-db-badge__dot { background: #6b7280; }
.dev-db-badge--ok      .dev-db-badge__dot { background: #22c55e; }
.dev-db-badge--err     .dev-db-badge__dot { background: #ef4444; }

/* ── Kunden-Tab ───────────────────────────────────────── */
.kunden-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}

.kunden-phase-tabs {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex: 1;
  flex-wrap: wrap;
}

.kunden-phase-tab {
  background: transparent;
  border: none;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  font-family: var(--font-family);
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
}
.kunden-phase-tab:hover { background: var(--color-bg-subtle); color: var(--color-text); }
.kunden-phase-tab.active { background: var(--color-primary); color: var(--color-text-inverse); }

/* ── Kunden-Tabelle ───────────────────────────────────── */
.kunden-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.kunden-table th {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.kunden-table td {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.kunden-table tbody tr:last-child td { border-bottom: none; }
.kunden-table tbody tr { cursor: pointer; transition: background 0.1s; }
.kunden-table tbody tr:hover { background: var(--color-bg-subtle); }

.kunden-table-action {
  text-align: right;
  color: var(--color-text-muted);
  width: 36px;
}

/* ── Frist ────────────────────────────────────────────── */
.frist-badge         { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: var(--sp-1); }
.frist-badge--urgent { font-size: var(--text-xs); color: var(--color-warning); font-weight: 600; margin-top: var(--sp-1); }

/* ── Bearbeiter-Avatar ────────────────────────────────── */
.bearbeiter-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-size: var(--text-xs);
  font-weight: 600;
  flex-shrink: 0;
}

/* ── KPI-Kacheln ──────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

.kpi-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}

.kpi-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: var(--sp-2);
}

.kpi-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text);
  line-height: var(--leading-tight);
}

.kpi-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--sp-1);
}

/* ── Pagination ───────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  margin-top: var(--sp-6);
}

.pagination-info {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  min-width: 130px;
  text-align: center;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Profil ───────────────────────────────────────────── */
.profil-page {
  max-width: 860px;
  margin: 0 auto;
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

/* Header-Karte */
.profil-header {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
}

.profil-avatar {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-size: var(--text-xl);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.04em;
}

.profil-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.profil-name {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
  line-height: var(--leading-tight);
}

.profil-role-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.profil-email {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Sektionen */
.profil-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.profil-section-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

/* Schnellzugriff-Karten */
.profil-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-4);
}

.profil-link-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--sp-5);
  text-align: left;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.profil-link-card:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--color-primary);
}

.profil-link-label {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
}

.profil-link-sub {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Nutzerverwaltung */
.profil-table-wrap {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.profil-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.profil-table thead tr {
  background: var(--color-bg-subtle);
}

.profil-table th {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  text-align: left;
}

.profil-table td {
  padding: var(--sp-3) var(--sp-4);
  border-top: 1px solid var(--color-border);
  color: var(--color-text);
  vertical-align: middle;
}

.profil-table tbody tr:hover td {
  background: var(--color-bg-subtle);
}

.profil-table-muted {
  color: var(--color-text-muted) !important;
}

.profil-table-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-size: var(--text-xs);
  font-weight: 700;
  margin-right: var(--sp-2);
  vertical-align: middle;
}

/* Badges */
.profil-badge {
  display: inline-block;
  padding: 2px var(--sp-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--color-bg-subtle);
  color: var(--color-text-muted);
}

.profil-badge--admin {
  background: #EEF2FF;
  color: #4F46E5;
}

.profil-badge--active {
  background: #DCFCE7;
  color: #16A34A;
}

.profil-badge--inactive {
  background: #FEE2E2;
  color: #DC2626;
}

/* ── Kunden-Detail-Page ───────────────────────────────── */

/* ── Page skeleton ── */
.kd-page {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* ── Header card ── */
.kd-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-6);
  padding: var(--sp-5) var(--sp-6) !important;
}

.kd-header-left { flex: 1; min-width: 0; }

.kd-name {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text);
  line-height: var(--leading-tight);
  margin-bottom: var(--sp-2);
}

.kd-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.kd-meta-item {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
}

.kd-mwh {
  text-align: right;
  flex-shrink: 0;
}

.kd-mwh-value {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}

.kd-mwh-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-top: var(--sp-1);
}

/* ── Stepper ── */
.kd-stepper-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-sm);
}

.kd-stepper-label {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--sp-3);
}

.kd-stepper {
  display: flex;
  gap: 3px;
}

.kd-step {
  flex: 1;
  min-width: 0;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 18px;
  background: #E5E7EB;
  color: #9CA3AF;
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 12px 100%, 0 50%);
}

.kd-step:first-child {
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%);
  padding-left: 12px;
}

.kd-step:last-child {
  clip-path: polygon(12px 0, 100% 0, 100% 100%, 12px 100%, 0 50%);
  padding-right: 12px;
}

.kd-step--done {
  background: #374151;
  color: #D1D5DB;
  font-weight: 500;
}

.kd-step--active {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  font-weight: 600;
}

/* ── 2-column body ── */
.kd-body {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: var(--sp-4);
  align-items: start;
}

/* ── Timeline panel (left) ── */
.kd-timeline-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.kd-timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--color-border);
}

.kd-timeline-header h3 { margin: 0; }

.kd-timeline-list { padding: 0 var(--sp-5); }

.kd-timeline-entry {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--color-border);
  font-size: var(--text-sm);
}

.kd-timeline-entry:last-child { border-bottom: none; }

.kd-timeline-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.kd-timeline-icon--telefonat { background: #EFF6FF; border-color: #BFDBFE; color: #2563EB; }
.kd-timeline-icon--email     { background: #F0FDF4; border-color: #BBF7D0; color: #16A34A; }
.kd-timeline-icon--notiz     { background: #FFFBEB; border-color: #FDE68A; color: #D97706; }
.kd-timeline-icon--system    { background: #F3F4F6; border-color: #D1D5DB; color: #6B7280; }

.kd-timeline-body { flex: 1; min-width: 0; }

.kd-timeline-ts {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--sp-1);
}

.kd-timeline-text {
  color: var(--color-text);
  line-height: var(--leading-relaxed);
  word-break: break-word;
}

.kd-timeline-footer {
  padding: var(--sp-3) var(--sp-5);
  text-align: center;
  border-top: 1px solid var(--color-border);
}

.kd-load-more {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-family);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-md);
  transition: background 0.1s, color 0.1s;
}
.kd-load-more:hover { background: var(--color-bg-subtle); color: var(--color-text); }

/* ── Right panel (status + tabs) ── */
.kd-right {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

/* ── Status box ── */
.kd-status-card {
  background: var(--color-info);
  border: 1px solid var(--color-info-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
}

.kd-status-section-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #2563EB;
  margin-bottom: var(--sp-2);
}

.kd-status-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-3);
}

.kd-status-code-value {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
}

.kd-status-actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  align-items: flex-end;
}

.kd-frist {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--sp-4);
}

.kd-frist--urgent { color: var(--color-warning); font-weight: 600; }
.kd-frist--overdue { color: var(--color-danger); font-weight: 600; }

/* ── Tabs card ── */
.kd-tabs-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.kd-tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  padding: 0 var(--sp-5);
  gap: var(--sp-6);
}

.kd-tab-btn {
  padding: var(--sp-3) 0;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: var(--font-family);
  transition: color 0.15s, border-bottom-color 0.15s;
}
.kd-tab-btn.active {
  color: var(--color-text);
  border-bottom-color: var(--color-primary);
}

.kd-tab-content {
  padding: var(--sp-5);
}

/* ── Stammdaten table ── */
.kd-field-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0;
}

.kd-field-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  padding: var(--sp-3) var(--sp-4) var(--sp-3) 0;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: flex-start;
}

.kd-field-value {
  font-size: var(--text-sm);
  color: var(--color-text);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: var(--sp-1);
}

.kd-field-label:last-of-type,
.kd-field-value:last-of-type { border-bottom: none; }

.kd-notiz-area {
  width: 100%;
  padding: var(--sp-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg);
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.15s;
}
.kd-notiz-area:focus {
  outline: none;
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(26,26,46,0.1);
}

/* ── Modal ── */
.kd-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
}

.kd-modal {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  padding: var(--sp-6);
}

.kd-modal-title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--sp-5);
}

.kd-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}

.kd-form-field {
  margin-bottom: var(--sp-4);
}

.kd-select {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.15s;
  appearance: auto;
}
.kd-select:focus {
  outline: none;
  border-color: var(--color-border-focus);
}

/* ── Docs placeholder ── */
.kd-empty-state {
  text-align: center;
  padding: var(--sp-10) var(--sp-6);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.kd-empty-state svg {
  margin: 0 auto var(--sp-3);
  display: block;
  opacity: 0.3;
}

/* ── Comm type selector (radio pills) ── */
.kd-type-pills {
  display: flex;
  gap: var(--sp-2);
}

.kd-type-pill {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.kd-type-pill:hover { background: var(--color-bg-subtle); }
.kd-type-pill.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-inverse);
}

/* ── Loading skeleton ── */
.kd-loading {
  padding: var(--sp-12);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* ── Kunden-Detail: Lageplan ─────────────────────────────── */
.kd-lageplan-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.kd-lageplan-header {
  padding: var(--sp-2) var(--sp-4);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
}

.kd-lageplan-map {
  height: 240px;
  width: 100%;
  position: relative;
  /* Static preview — no user interaction */
  pointer-events: none;
}

/* Hide OL attribution (no UI controls, but attribution injected by OL internals) */
.kd-lageplan-map .ol-attribution {
  display: none;
}

.kd-lageplan-nocoords {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  background: var(--color-bg-subtle);
}

/* ── Kunden-Detail: Two-column main layout ───────────────── */
.kd-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: var(--sp-4);
  align-items: start;
}

.kd-left-col {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.kd-right-col {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
