/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg:        #f0f2f5;
  --surface:   #ffffff;
  --border:    #e2e8f0;
  --primary:   #2563eb;
  --primary-h: #1d4ed8;
  --success:   #16a34a;
  --warning:   #d97706;
  --danger:    #dc2626;
  --text:      #1e293b;
  --muted:     #64748b;
  --sidebar-w: 220px;
  --top-h:     60px;
  --radius:    10px;
  --shadow:    0 1px 4px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
}
html, body { height: 100%; font-family: 'Segoe UI', system-ui, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }

/* ── Layout ── */
body { display: flex; }
.sidebar {
  width: var(--sidebar-w); min-height: 100vh; background: #03152b;
  display: flex; flex-direction: column; flex-shrink: 0;
  transition: transform .25s; z-index: 100;
}
.main-wrapper { flex: 1; display: flex; flex-direction: column; min-height: 100vh; overflow: hidden; }

/* ══════════════════════════════════════════════
   SIDEBAR – modernes Design
   ══════════════════════════════════════════════ */
.sidebar {
  background: #03152b;
}

/* Brand */
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
/* Logo-Modus: eigenes Bild statt Icon+Text */
.sidebar-brand-img {
  padding: 4px 0;
  display: flex; align-items: center;
}
.sidebar-brand-img img {
  max-height: 46px; max-width: 178px;
  object-fit: contain; display: block;
}

.brand-logo {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(59,130,246,.4);
}
.brand-logo svg { width: 20px; height: 20px; color: #fff; }
.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-name { color: #f1f5f9; font-size: 15px; font-weight: 800; letter-spacing: -.2px; }
.brand-sub  { color: #475569; font-size: 10px; font-weight: 500; letter-spacing: .3px; text-transform: uppercase; }

/* Nav */
.sidebar-nav { flex: 1; padding: 10px 10px; overflow-y: auto; }

.nav-group-label {
  font-size: 9.5px; font-weight: 700; color: #334155;
  text-transform: uppercase; letter-spacing: .8px;
  padding: 12px 8px 4px;
}
.nav-group-label:first-child { padding-top: 4px; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; color: #64748b;
  text-decoration: none; font-size: 13px; font-weight: 500;
  transition: all .15s; border: none; margin-bottom: 1px;
  position: relative;
}
.nav-item:hover {
  background: rgba(255,255,255,.05);
  color: #cbd5e1;
}
.nav-item.active {
  background: rgba(59,130,246,.15);
  color: #93c5fd;
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%; background: #3b82f6;
  border-radius: 0 3px 3px 0;
}
.nav-icon {
  width: 20px; height: 20px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.nav-icon svg { width: 17px; height: 17px; }
.nav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Footer */
.sidebar-footer {
  padding: 12px 12px;
  border-top: 1px solid rgba(255,255,255,.05);
}
.sidebar-user {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px;
  border-radius: 10px; background: rgba(255,255,255,.04);
  margin-bottom: 8px; cursor: default;
  border: 1px solid rgba(255,255,255,.06);
}
.sidebar-user-avatar {
  width: 32px; height: 32px; border-radius: 8px; background: #2563eb;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
  text-transform: uppercase; letter-spacing: .5px;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 12.5px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 10px; color: #475569; margin-top: 1px; }
.sidebar-user-actions { display: flex; gap: 6px; }
.sidebar-user-actions button {
  flex: 1; padding: 7px 8px; font-size: 11px; font-weight: 600;
  border-radius: 7px; border: none; cursor: pointer; transition: all .15s;
}
.sidebar-btn-pw  { background: rgba(255,255,255,.08); color: #94a3b8; }
.sidebar-btn-pw:hover  { background: rgba(255,255,255,.14); color: #e2e8f0; }
.sidebar-btn-out { background: rgba(239,68,68,.12); color: #fca5a5; }
.sidebar-btn-out:hover { background: rgba(239,68,68,.24); color: #fecaca; }
.sidebar-version { font-size: 9.5px; color: #1e293b; text-align: center; padding-top: 6px; }

/* ── Topbar ── */
.topbar {
  height: var(--top-h); background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px; padding: 0 24px; flex-shrink: 0;
  box-shadow: var(--shadow);
}
.menu-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--muted); }
.page-title  { font-size: 17px; font-weight: 600; flex: 1; }

/* ── Globale Suche ── */
.global-search {
  position: relative;
  flex: 0 1 300px; min-width: 0;
  display: flex; align-items: center;
}
.global-search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 15px !important; height: 15px !important;
  flex-shrink: 0; stroke: var(--muted); pointer-events: none; z-index: 1;
}
.global-search input {
  width: 100%; padding: 7px 12px 7px 32px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 13.5px; background: var(--bg); color: var(--text);
  outline: none; transition: border-color .15s, box-shadow .15s;
  min-width: 0;
}
.global-search input:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1);
  background: #fff;
}
.global-search-results {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12); z-index: 500;
  max-height: 440px; overflow-y: auto;
}
.global-search-results.open { display: block; }
.search-group-label {
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px;
  padding: 10px 14px 4px;
}
.search-result-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; cursor: pointer; transition: background .1s;
}
.search-result-item:hover { background: var(--bg); }
.search-result-icon {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.search-result-title { font-size: 13.5px; font-weight: 600; }
.search-result-sub   { font-size: 11.5px; color: var(--muted); }
.search-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }

/* ── Nav Badge (Aufgaben) ── */
.nav-badge {
  margin-left: auto; min-width: 18px; height: 18px;
  background: #dc2626; color: #fff;
  border-radius: 9px; font-size: 10.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
}

/* ── Content ── */
.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 7px; font-size: 13.5px; font-weight: 500;
  cursor: pointer; border: 1px solid transparent; transition: all .15s; text-decoration: none;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-h); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-danger    { background: #fee2e2; color: var(--danger); border-color: #fca5a5; }
.btn-danger:hover  { background: #fca5a5; }
.btn-success   { background: #dcfce7; color: var(--success); border-color: #86efac; }
.btn-warning   { background: #fef3c7; color: var(--warning); border-color: #fcd34d; }
.btn-sm   { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

/* ── Cards ── */
.card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow); padding: 20px;
}
.card-header  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title   { font-size: 15px; font-weight: 600; }

/* ── KPI Grid ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow);
}
.kpi-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.kpi-sub   { font-size: 12px; color: var(--muted); }
.kpi-icon  { font-size: 22px; margin-bottom: 4px; }

/* ── Dashboard KPI cards ── */
.db-kpi-card { padding: 20px; gap: 0; transition: box-shadow .15s, transform .15s; cursor: default; }
.db-kpi-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.08); transform: translateY(-1px); }

/* ── Dashboard welcome banner ── */
.db-welcome {
  background: linear-gradient(135deg, #03152b 0%, #0f2847 100%);
  border-radius: 14px; padding: 24px 28px; margin-bottom: 20px;
  position: relative; overflow: hidden;
}
.db-welcome-deco1 {
  position: absolute; right: -40px; top: -40px; width: 220px; height: 220px;
  border-radius: 50%; background: rgba(37,99,235,.12); pointer-events: none;
}
.db-welcome-deco2 {
  position: absolute; right: 70px; bottom: -70px; width: 170px; height: 170px;
  border-radius: 50%; background: rgba(37,99,235,.07); pointer-events: none;
}
.db-welcome-inner {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 20px; position: relative;
}
.db-welcome-stats {
  display: flex; gap: 0; flex-wrap: wrap; align-items: center;
}
.db-welcome-stat {
  padding: 0 22px; text-align: right;
  border-left: 1px solid rgba(255,255,255,.1);
}
.db-welcome-stat:first-child { border-left: none; }

/* ── Dashboard layout grids ── */
.db-grid-3-1 { display: grid; grid-template-columns: 3fr 1.2fr; gap: 16px; }
.db-grid-2   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.db-kpi-row  { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead tr { background: #f8fafc; }
th { padding: 10px 14px; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border); }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* ── Toolbar ── */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box {
  display: flex; align-items: center; background: var(--surface);
  border: 1px solid var(--border); border-radius: 7px; padding: 0 12px; gap: 8px;
  flex: 1; min-width: 200px;
}
.search-box input { border: none; outline: none; padding: 8px 0; font-size: 13.5px; background: transparent; width: 100%; }
.search-icon { color: var(--muted); }
.search-input { border: 1px solid var(--border); border-radius: 7px; padding: 6px 10px; font-size: 13.5px; background: var(--surface); color: var(--text); outline: none; }

/* ── Badges ── */
.badge {
  display: inline-flex; align-items: center; padding: 3px 8px;
  border-radius: 99px; font-size: 11.5px; font-weight: 600;
}
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-purple { background: #f3e8ff; color: #7e22ce; }
.badge-orange { background: #ffedd5; color: #c2410c; }

/* ── Pipeline ── */
.pipeline { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.pipeline-col {
  min-width: 220px; flex-shrink: 0; background: #f8fafc;
  border-radius: var(--radius); border: 1px solid var(--border); padding: 12px;
}
.pipeline-col-header {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.pipeline-count { background: var(--border); color: var(--muted); border-radius: 99px; padding: 1px 7px; font-size: 11px; }
.lead-card {
  background: var(--surface); border-radius: 8px; border: 1px solid var(--border);
  padding: 12px; margin-bottom: 8px; cursor: pointer; transition: box-shadow .15s;
}
.lead-card:hover      { box-shadow: var(--shadow-md); }
.lead-card-title      { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.lead-card-sub        { font-size: 12px; color: var(--muted); }
.lead-card-value      { font-size: 13px; font-weight: 700; color: var(--primary); margin-top: 6px; }

/* ── Forms ── */
.form-grid   { display: grid; gap: 14px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-group  { display: flex; flex-direction: column; gap: 5px; }
label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
input, select, textarea {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 7px;
  font-size: 13.5px; outline: none; transition: border .15s;
  font-family: inherit; background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px #2563eb18;
}
textarea { resize: vertical; min-height: 80px; }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: none; align-items: center; justify-content: center; z-index: 1000;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius);
  width: 620px; max-width: 96vw; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-md);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body  { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); }
.modal-wide { width: 800px; }

/* ── Toast ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 2000; }
.toast {
  background: #1e293b; color: #f1f5f9; padding: 12px 18px; border-radius: 8px;
  font-size: 13.5px; box-shadow: var(--shadow-md); animation: slideIn .2s ease;
  display: flex; align-items: center; gap: 8px; min-width: 220px;
}
.toast.success { border-left: 4px solid #22c55e; }
.toast.error   { border-left: 4px solid #ef4444; }
@keyframes slideIn { from { transform: translateX(60px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes spin    { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── Splash Screen (Basis-Styles; kritische Styles stehen im <head> inline) ── */
.splash-spinner {
  width: 36px; height: 36px; position: relative;
}
.splash-spinner span {
  display: block; position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ── Detail Page ── */
.detail-back    { margin-bottom: 16px; }
.detail-hero {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  overflow: hidden; margin-bottom: 16px; box-shadow: var(--shadow);
}
.detail-hero-banner {
  height: 200px; background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 80px; position: relative; overflow: hidden;
}
.detail-hero-banner img { width: 100%; height: 100%; object-fit: cover; }
.detail-hero-body { padding: 24px; }
.detail-hero-title { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.detail-hero-sub   { font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.detail-hero-meta  { display: flex; gap: 10px; flex-wrap: wrap; }
.detail-tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.detail-tab {
  padding: 10px 20px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
  background: none; border-top: none; border-left: none; border-right: none;
}
.detail-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.detail-tab-content { display: none; }
.detail-tab-content.active { display: block; }
.detail-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 22px; }
.detail-field label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; display: block; }
.detail-field span  { font-size: 14px; font-weight: 500; }
.section-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; margin-top: 20px; }

/* ── Photo Gallery ── */
.photo-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-bottom: 14px; }
.photo-thumb {
  aspect-ratio: 4/3; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border); position: relative; cursor: grab;
  transition: opacity .15s, box-shadow .15s, transform .15s;
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.photo-thumb:hover .photo-del { opacity: 1; }
.photo-thumb.dragging { opacity: 0.35; transform: scale(0.95); cursor: grabbing; }
.photo-thumb.drag-over { border: 2px solid var(--primary); box-shadow: 0 0 0 3px #bfdbfe; }
.photo-thumb .photo-drag-hint {
  position: absolute; bottom: 4px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.55); color: #fff; font-size: 10px; padding: 2px 6px;
  border-radius: 4px; white-space: nowrap; opacity: 0; transition: opacity .15s;
  pointer-events: none;
}
.photo-gallery:hover .photo-thumb .photo-drag-hint { opacity: 1; }
.photo-del {
  position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,.6);
  color: #fff; border: none; border-radius: 50%; width: 24px; height: 24px;
  cursor: pointer; font-size: 13px; opacity: 0; transition: opacity .15s;
  display: flex; align-items: center; justify-content: center;
}
.photo-upload-zone {
  border: 2px dashed var(--border); border-radius: 8px; padding: 24px;
  text-align: center; color: var(--muted); cursor: pointer; transition: all .15s;
  background: #fafafa;
}
.photo-upload-zone:hover, .photo-upload-zone.dragover { border-color: var(--primary); background: #eff6ff; color: var(--primary); }
.photo-upload-zone input { display: none; }
.photo-upload-icon { font-size: 28px; margin-bottom: 6px; }
.photo-upload-text { font-size: 13px; }

/* ── Photo Lightbox ── */
.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.92);
  display: none; align-items: center; justify-content: center; z-index: 3000;
}
.lightbox.open { display: flex; }
.lightbox img  { max-width: 90vw; max-height: 85vh; border-radius: 8px; display: block; user-select: none; }
.lightbox-close {
  position: absolute; top: 18px; right: 22px; color: #fff;
  font-size: 32px; cursor: pointer; background: none; border: none; line-height: 1;
  opacity: .75; transition: opacity .15s;
}
.lightbox-close:hover { opacity: 1; }
.lightbox-prev, .lightbox-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.12); border: none; color: #fff;
  font-size: 44px; line-height: 1; cursor: pointer; padding: 10px 18px;
  border-radius: 10px; transition: background .15s; user-select: none;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(255,255,255,.28); }
.lightbox-prev:disabled, .lightbox-next:disabled { opacity: 0; pointer-events: none; }
.lightbox-counter {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,.85); font-size: 13px;
  background: rgba(0,0,0,.45); padding: 4px 14px; border-radius: 20px;
  pointer-events: none;
}
.lightbox-hint {
  position: absolute; bottom: 20px; right: 22px;
  color: rgba(255,255,255,.4); font-size: 11px; pointer-events: none;
}

/* ── Login ── */
@keyframes loginCardIn {
  from { opacity:0; transform:translateY(22px) scale(.98); }
  to   { opacity:1; transform:translateY(0)    scale(1);   }
}

.login-overlay {
  position:fixed; inset:0; z-index:9999;
  display:flex; align-items:center; justify-content:center;
  background: #e8edf5;
  padding: 24px;
}

/* Card */
.login-card {
  display:flex; width:100%; max-width:900px; min-height:520px;
  border-radius:22px; overflow:hidden;
  box-shadow: 0 24px 72px rgba(0,0,0,.18);
  animation: loginCardIn .5s cubic-bezier(.22,.68,0,1.15) both;
}

/* ── Left panel ── */
.login-left {
  flex:1.05; position:relative; overflow:hidden;
  background: linear-gradient(155deg,#1d4ed8 0%,#2563eb 60%,#1e40af 100%);
}
.login-left-img {
  position:absolute; inset:0;
  background-size:cover; background-position:center; background-repeat:no-repeat;
}
.login-left-fallback { position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0; }

/* ── Right panel ── */
.login-right {
  flex:1; background:#fff;
  display:flex; flex-direction:column; justify-content:center;
  padding:52px 52px 40px;
}
.login-greeting     { font-size:13px; color:var(--muted); margin-bottom:4px; }
.login-greeting-time{ font-size:18px; font-weight:700; color:var(--primary); margin-bottom:4px; }
.login-right-title  { font-size:22px; font-weight:800; color:var(--text); margin-bottom:32px; }
.login-right-title span { color:var(--primary); }

.login-field { margin-bottom:24px; }
.login-field label {
  display:block; font-size:11.5px; font-weight:600; color:var(--muted);
  margin-bottom:8px; letter-spacing:.2px;
}
.login-field input {
  width:100%; padding:10px 0; background:transparent;
  border:none; border-bottom:2px solid var(--border);
  font-size:15px; color:var(--text);
  transition:border-color .2s; box-sizing:border-box;
}
.login-field input::placeholder { color:#c0c8d4; }
.login-field input:focus { outline:none; border-bottom-color:var(--primary); }

.login-error {
  display:none; font-size:13px; margin-bottom:16px; color:#dc2626;
  padding:9px 13px; background:#fef2f2; border-radius:8px; border:1px solid #fecaca;
}

.login-btn {
  width:100%; padding:13px;
  background:var(--primary); color:#fff; border:none;
  border-radius:9px; font-size:14px; font-weight:700; letter-spacing:.5px;
  text-transform:uppercase; cursor:pointer;
  transition:background .15s, box-shadow .15s, transform .1s;
  box-shadow:0 4px 18px rgba(37,99,235,.35);
  margin-bottom:20px;
}
.login-btn:hover  { background:var(--primary-h); box-shadow:0 6px 24px rgba(37,99,235,.5); }
.login-btn:active { transform:scale(.98); }
.login-right-footer { font-size:11px; color:#c0c8d4; text-align:center; margin-top:auto; padding-top:24px; }

/* ── Mobile Login Brand Block ── */
.login-mobile-brand {
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  background: #111728;
  /* Ausdehnung über den padding des .login-right */
  margin: -40px -32px 32px;
  padding: 36px 24px;
  border-radius: 0;
}
/* Horizontales Logo (sidebarLogo) */
.login-mobile-logo-wide {
  max-width: 200px; max-height: 56px;
  width: auto; height: auto;
  object-fit: contain;
}
/* Fallback: nur Icon + Text wenn kein sidebarLogo gesetzt */
.login-mobile-logo-icon {
  width: 60px; height: 60px;
  object-fit: contain; border-radius: 14px;
  margin-bottom: 10px;
}
.login-mobile-name {
  font-size: 19px; font-weight: 800;
  color: #fff; letter-spacing: -.3px;
}

@media(max-width:768px){
  .login-left { display:none; }
  .login-right { padding: 40px 32px 36px; border-radius: 0; }
  .login-mobile-brand { display:flex; border-radius: 0; }
}

/* ── Detail Tabs ── */
.detail-tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  border-bottom: 2px solid var(--border); padding-bottom: 0;
}
.detail-tab {
  padding: 9px 20px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  border: none; background: none; color: var(--muted); border-radius: 8px 8px 0 0;
  border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all .15s;
  display: flex; align-items: center; gap: 6px;
}
.detail-tab:hover { color: var(--text); background: var(--hover); }
.detail-tab.active { color: var(--primary); border-bottom-color: var(--primary); background: #eff6ff; }
.detail-tab .tab-badge {
  background: var(--primary); color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 10px; line-height: 1.6;
}
.detail-tab.active .tab-badge { background: var(--primary); }
.detail-tab .tab-lock { font-size: 11px; opacity: .6; }

/* ── Avatar & Initials ── */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0; overflow: hidden;
}
.avatar img  { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg   { width: 72px; height: 72px; font-size: 24px; }

/* ── Fahrzeug Card Grid ── */
.vehicle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.vehicle-card {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  overflow: hidden; box-shadow: var(--shadow); transition: box-shadow .15s, transform .15s;
  cursor: pointer;
}
.vehicle-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.vehicle-card-img {
  height: 160px; background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 60px; overflow: hidden; position: relative;
}
.vehicle-card-img img { width: 100%; height: 100%; object-fit: cover; }
.vehicle-card-img-count {
  position: absolute; bottom: 6px; right: 8px;
  background: rgba(0,0,0,.55); color: #fff; border-radius: 99px;
  font-size: 11px; padding: 2px 8px;
}
.vehicle-card-body    { padding: 14px; }
.vehicle-card-title   { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.vehicle-card-sub     { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.vehicle-card-price   { font-size: 18px; font-weight: 800; color: var(--primary); margin-bottom: 10px; }
.vehicle-card-footer  { display: flex; align-items: center; justify-content: space-between; padding-top: 10px; border-top: 1px solid var(--border); }

/* ── Fahrzeuge Tab-Bar ── */
.fz-tabs-bar {
  display: flex; gap: 4px; margin-bottom: 16px;
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 4px; width: fit-content;
}
.fz-tab-btn {
  padding: 8px 20px; border-radius: 7px; font-size: 13.5px; font-weight: 600;
  border: none; cursor: pointer; background: transparent; color: var(--muted);
  display: flex; align-items: center; gap: 8px; transition: all .15s;
}
.fz-tab-btn:hover { background: var(--bg); color: var(--text); }
.fz-tab-btn.active { background: var(--primary); color: #fff; }
.fz-tab-btn.active .fz-tab-count { background: rgba(255,255,255,.25); color: #fff; }
.fz-tab-count {
  background: var(--border); color: var(--muted);
  border-radius: 99px; padding: 1px 8px; font-size: 11.5px; font-weight: 700;
}

/* ── Archiv-Banner ── */
.archiv-banner {
  background: linear-gradient(135deg, #1e293b, #334155);
  color: #94a3b8; border-radius: var(--radius);
  padding: 12px 18px; font-size: 13px; font-weight: 600;
  margin-bottom: 12px; letter-spacing: .2px;
}

/* ── View Toggle ── */
.view-toggle { display: flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.view-toggle button { background: var(--surface); border: none; padding: 7px 11px; cursor: pointer; color: var(--muted); font-size: 15px; }
.view-toggle button.active { background: var(--primary); color: #fff; }

/* ── Bar Chart ── */
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 100px; padding: 0 4px; }
.bar-wrap  { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; }
.bar       { width: 100%; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 4px; transition: height .4s ease; }
.bar-label { font-size: 10.5px; color: var(--muted); }

/* ── Tasks ── */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface); border-radius: 8px; border: 1px solid var(--border);
}
.task-item.done { opacity: .55; }
.task-item.done .task-title { text-decoration: line-through; }
.task-check    { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary); flex-shrink: 0; }
.task-info     { flex: 1; }
.task-title    { font-size: 13.5px; font-weight: 500; }
.task-meta     { font-size: 12px; color: var(--muted); margin-top: 2px; }
.task-actions  { display: flex; gap: 6px; }
.task-priority { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pri-hoch    { background: var(--danger); }
.pri-mittel  { background: var(--warning); }
.pri-niedrig { background: var(--success); }

/* ── Empty State ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .empty-icon { font-size: 44px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── Ankauf ── */
.ankauf-status-neu       { background:#fef9c3; color:#a16207; }
.ankauf-status-gebucht   { background:#dcfce7; color:#15803d; }
.ankauf-status-verkauft  { background:#f1f5f9; color:#475569; }

.ankauf-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  overflow: hidden; transition: box-shadow .15s;
}
.ankauf-card:hover { box-shadow: var(--shadow-md); }
.ankauf-card-header {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.ankauf-card-body { padding: 14px 16px; }
.ankauf-steps {
  display: flex; align-items: center; gap: 0; margin-bottom: 24px;
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden;
}
.ankauf-step {
  flex: 1; padding: 12px 16px; text-align: center;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  border-right: 1px solid var(--border); position: relative;
}
.ankauf-step:last-child { border-right: none; }
.ankauf-step.done  { background: #dcfce7; color: #15803d; }
.ankauf-step.active{ background: #dbeafe; color: #1d4ed8; }
.ankauf-step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; font-size: 11px;
  background: var(--border); color: var(--muted); margin-right: 6px;
}
.ankauf-step.done  .ankauf-step-num { background: #16a34a; color: #fff; }
.ankauf-step.active .ankauf-step-num { background: var(--primary); color: #fff; }

/* ── Verträge ── */
.vertrag-type-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.vertrag-type-card {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  padding: 22px; text-align: center; cursor: pointer; transition: all .15s; box-shadow: var(--shadow);
}
.vertrag-type-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.vertrag-type-icon  { font-size: 36px; margin-bottom: 10px; }
.vertrag-type-label { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.vertrag-type-desc  { font-size: 12px; color: var(--muted); }
.vertrag-badge-vk   { background: #dbeafe; color: #1d4ed8; }
.vertrag-badge-ak   { background: #dcfce7; color: #15803d; }
.vertrag-badge-pf   { background: #f3e8ff; color: #7e22ce; }

/* ── Settings ── */
.settings-section { margin-bottom: 28px; }
.settings-section-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* ── Adresse Autocomplete ── */
.addr-wrap { position: relative; }
.addr-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 500;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 0 0 8px 8px; box-shadow: var(--shadow-md);
  max-height: 230px; overflow-y: auto; display: none;
}
.addr-dropdown.open { display: block; }
.addr-item {
  padding: 9px 13px; font-size: 13px; cursor: pointer;
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px;
}
.addr-item:last-child { border-bottom: none; }
.addr-item:hover { background: #eff6ff; color: var(--primary); }
.addr-item-icon { font-size: 13px; color: var(--muted); flex-shrink: 0; }
.addr-loading { padding: 10px 13px; color: var(--muted); font-size: 12.5px; }

/* ── Form Section Header ── */
.form-section-title {
  font-size: 11.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px;
  margin: 18px 0 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.form-section-title:first-child { margin-top: 0; }

/* ── Activity ── */
.activity-list  { display: flex; flex-direction: column; gap: 10px; }
.activity-item  { display: flex; align-items: flex-start; gap: 12px; }
.activity-dot   { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); flex-shrink: 0; margin-top: 4px; }
.activity-text  { font-size: 13px; }
.activity-time  { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ════════════════════════════════
   RESPONSIVE – Tablet & Mobile
   ════════════════════════════════ */

/* ── Tablet (≤ 1024px) ── */
@media (max-width: 1024px) {
  :root { --sidebar-w: 200px; }

  .content { padding: 18px; }
  .vertrag-type-cards { grid-template-columns: repeat(2, 1fr); }
  .vehicle-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .photo-gallery { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .detail-hero-banner { height: 170px; }
  .kpi-value { font-size: 24px; }
  .detail-hero-title { font-size: 20px; }

  /* Login card: slightly tighter on tablet */
  .login-card { max-width: 820px; }
  .login-right { padding: 44px 40px 34px; }
}

/* ── Mobile (≤ 768px) ── */
@media (max-width: 768px) {

  /* Sidebar: slide-in overlay */
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100%;
    transform: translateX(-100%); z-index: 200;
    box-shadow: 4px 0 24px rgba(0,0,0,.18);
  }
  .sidebar.open { transform: none; }
  .sidebar-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.35); z-index: 199;
  }
  .sidebar-overlay.open { display: block; }

  .menu-toggle { display: block; }

  /* Topbar: kompakter, Button kürzer */
  .topbar { padding: 0 12px; gap: 8px; }
  .page-title { font-size: 15px; }
  #globalAddBtn { font-size: 12px; padding: 7px 11px; white-space: nowrap; }
  .global-search { flex: 0 1 160px; }
  .global-search input { font-size: 12.5px; padding: 6px 10px 6px 28px; }

  /* Content area */
  .content { padding: 10px; }

  /* Touch-friendly buttons */
  .btn { min-height: 40px; padding: 9px 14px; }
  .btn-sm { min-height: 34px; }

  /* Forms */
  .form-grid-2 { grid-template-columns: 1fr; }

  /* KPI grid: 2 gleichmässige Spalten, letzte Karte volle Breite wenn ungerade */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px; margin-bottom: 16px;
  }
  .kpi-grid .kpi-card:last-child:nth-child(odd) {
    grid-column: span 2;
  }
  .kpi-value { font-size: 20px; }
  .kpi-card  { padding: 13px 14px; }
  .kpi-icon  { font-size: 18px; }
  .kpi-label { font-size: 11px; }

  /* Vehicle grid: 1 column */
  .vehicle-grid { grid-template-columns: 1fr; }

  /* Detail hero */
  .detail-hero-banner { height: 140px; font-size: 60px; }
  .detail-hero-body   { padding: 14px; }
  .detail-hero-title  { font-size: 17px; }
  .detail-hero-sub    { font-size: 12.5px; margin-bottom: 10px; }
  .detail-hero-meta   { gap: 6px; }
  .detail-hero-meta .btn { font-size: 12px; padding: 7px 10px; }

  /* Detail tabs: horizontal scroll */
  .detail-tabs {
    overflow-x: auto; white-space: nowrap; gap: 0;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .detail-tabs::-webkit-scrollbar { display: none; }
  .detail-tab { padding: 9px 13px; font-size: 12px; flex-shrink: 0; }

  /* Detail grid */
  .detail-grid { grid-template-columns: 1fr; gap: 10px; margin-bottom: 14px; }

  /* Photo gallery */
  .photo-gallery { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 7px; }

  /* Toolbar */
  .toolbar { gap: 8px; }
  .search-box { min-width: 0; flex: 1 1 100%; order: -1; }
  .toolbar .btn { flex-shrink: 0; }

  /* Tabellen: scrollbar horizontal, aber kleinere min-width
     damit der Inhalt besser sichtbar ist */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 420px; }
  th, td { padding: 8px 9px; font-size: 12px; }

  /* Leere Zustände in Tabellen: Text nicht abschneiden */
  .empty-state { padding: 32px 12px; }
  .empty-state p { font-size: 13px; word-break: break-word; white-space: normal; }
  td .empty-state, td > div { overflow: visible; white-space: normal; }

  /* Cards */
  .card { padding: 12px; }
  .card-header { margin-bottom: 10px; gap: 8px; flex-wrap: wrap; }
  .card-title { font-size: 13.5px; }

  /* Pipeline: horizontal scroll */
  .pipeline { flex-direction: row; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .pipeline-col { min-width: 210px; flex-shrink: 0; }

  /* Vertrag type cards */
  .vertrag-type-cards { grid-template-columns: 1fr; gap: 10px; }
  .vertrag-type-card  { padding: 16px; display: flex; align-items: center; gap: 16px; text-align: left; }
  .vertrag-type-icon  { font-size: 28px; margin-bottom: 0; flex-shrink: 0; }

  /* Ankauf steps: horizontal scroll */
  .ankauf-steps { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ankauf-step  { min-width: 110px; flex-shrink: 0; padding: 10px 10px; font-size: 11px; }
  .ankauf-step-num { width: 18px; height: 18px; font-size: 10px; margin-right: 4px; }

  /* Modal: bottom-sheet style */
  .modal-backdrop { align-items: flex-end; }
  .modal {
    width: 100%; max-width: 100%;
    border-radius: 18px 18px 0 0;
    max-height: 92vh;
  }
  .modal-wide { width: 100%; }
  .modal-header { padding: 14px 16px; }
  .modal-body   { padding: 14px 16px; }
  .modal-footer { padding: 12px 16px; }

  /* Toast: full-width at bottom */
  .toast-container { bottom: 0; right: 0; left: 0; padding: 0 0 12px; align-items: center; }
  .toast { min-width: unset; width: calc(100% - 32px); justify-content: center; border-radius: 10px; }

  /* ALLE inline-grid Layouts auf 1 Spalte zwingen */
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:2fr 1fr"],
  [style*="grid-template-columns: 2fr 1fr"],
  [style*="grid-template-columns:1fr 2fr"],
  [style*="grid-template-columns: 1fr 2fr"] {
    grid-template-columns: 1fr !important;
  }
  .db-grid-3-1, .db-grid-2, .db-kpi-row { grid-template-columns: 1fr; }
  .db-welcome-stats { gap: 10px; }
  .db-welcome-stat  { border-left: none; padding: 0; text-align: left; }

  /* Sidebar user block: compact */
  .sidebar-footer { padding: 8px 12px; }
  .sidebar-user-actions { gap: 5px; }
  .sidebar-user-actions button { padding: 7px 6px; font-size: 11px; }

  /* Section titles */
  .section-title { font-size: 11px; }

  /* Detail-Buttons: umbrechen erlaubt */
  .detail-hero-body [style*="display:flex"][style*="gap:8px"],
  .detail-hero-body [style*="display: flex"][style*="gap: 8px"] {
    flex-wrap: wrap;
  }
}

/* ── Small Mobile (≤ 480px) ── */
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-value { font-size: 18px; }
  .kpi-card  { padding: 11px 12px; }
  .kpi-icon  { font-size: 16px; margin-bottom: 2px; }

  .content { padding: 8px; }
  .topbar  { padding: 0 10px; gap: 8px; }
  .page-title { font-size: 14px; }
  #globalAddBtn { font-size: 11.5px; padding: 6px 10px; }

  /* Vehicle card */
  .vehicle-card-img { height: 180px; }
  .vehicle-card-body { padding: 12px; }
  .vehicle-card-price { font-size: 16px; }

  /* Detail hero kompakter */
  .detail-hero-banner { height: 120px; font-size: 48px; }
  .detail-hero-body   { padding: 12px; }
  .detail-hero-title  { font-size: 15px; }

  /* Vertrag type cards */
  .vertrag-type-card { padding: 14px 12px; }

  /* Photo gallery: 2 Spalten */
  .photo-gallery { grid-template-columns: repeat(2, 1fr); }

  /* Login */
  .login-left { display: none; }
  .login-right { padding: 40px 32px 36px; border-radius: 0; }
  .login-right-title { font-size: 18px; margin-bottom: 22px; }
  .login-greeting-time { font-size: 14px; }
  .login-mobile-brand { display: flex; border-radius: 0; margin: -40px -32px 32px; }

  /* Tabs kompakter */
  .detail-tab { padding: 8px 10px; font-size: 11.5px; }

  /* Modal */
  .modal { max-height: 96vh; }

  /* Toolbar: Buttons kompakt */
  .toolbar .btn { padding: 8px 10px; font-size: 12px; }
  .search-box input { font-size: 13px; }

  /* Tabelle noch kompakter */
  table { min-width: 360px; }
  th, td { padding: 7px 7px; font-size: 11.5px; }
}

/* ════════════════════════════════
   DRUCKSTILE – @media print
   ════════════════════════════════ */
@media print {
  body { background: #fff; font-family: Arial, sans-serif; font-size: 11pt; }
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-wrapper { display: block; }
  .content { padding: 0; }
}
