:root {
  --bg: #07080a;
  --surface: #121619;
  --surface-2: #191e22;
  --border: rgba(255,255,255,0.10);
  --border-strong: rgba(255,255,255,0.20);
  --text: #eef2f1;
  --text-70: rgba(238,242,241,0.72);
  --text-45: rgba(238,242,241,0.46);
  --turq: #2fe7d6;
  --turq-soft: rgba(47,231,214,0.14);
  --danger: #e0605a;
  --warn: #d9a94a;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.5;
}
a { color: var(--turq); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1480px; margin: 0 auto; padding: 0 24px; }

/* ============================================================
   APP-SHELL — Seitenleiste + Inhaltsbereich, CRM-Look
   ============================================================ */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px; flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 20px; font-size: 0.98rem; font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand b { color: var(--turq); font-weight: 700; }
.sidebar-brand .brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  position: relative; flex-shrink: 0;
}
.sidebar-brand .brand-mark::before, .sidebar-brand .brand-mark::after {
  content: ""; position: absolute; background: var(--turq); border-radius: 1px;
}
.sidebar-brand .brand-mark::before { width: 11px; height: 2px; top: 12px; left: 7.5px; }
.sidebar-brand .brand-mark::after { width: 2px; height: 11px; top: 7.5px; left: 12px; }

.sidebar-nav { flex: 1; padding: 14px 12px; display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 9px;
  color: var(--text-70); font-size: 0.9rem; font-weight: 500;
  text-decoration: none; position: relative;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--turq-soft); color: var(--turq); }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item .nav-badge { margin-left: auto; }

.sidebar-footer { padding: 14px 12px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 6px; }
.user-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--turq); color: #06201c;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 0.75rem;
}
.user-name { font-size: 0.85rem; color: var(--text-70); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-item { color: var(--text-45); }
.logout-item:hover { color: var(--danger); background: rgba(224,96,90,0.1); }

.main-area { flex: 1; min-width: 0; }
main { padding: 40px 0 80px; }

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 30;
    flex-direction: row; align-items: center; border-right: none; border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .sidebar-brand { border-bottom: none; border-right: 1px solid var(--border); flex-shrink: 0; }
  .sidebar-nav { flex-direction: row; padding: 8px; flex: 0 0 auto; }
  .nav-item span:not(.nav-badge) { display: none; }
  .nav-item { padding: 10px; }
  .sidebar-footer { display: flex; align-items: center; border-top: none; border-left: 1px solid var(--border); flex-shrink: 0; }
  .user-chip { margin-bottom: 0; }
  .user-name { display: none; }
}

h1 { font-size: 1.6rem; margin: 0 0 6px; }
h2 { font-size: 1.15rem; margin: 0 0 14px; }
.subtitle { color: var(--text-45); margin-bottom: 30px; font-size: 0.95rem; }

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

.grid { display: grid; gap: 18px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.stat-box strong { display: block; font-size: 1.9rem; color: var(--turq); }
.stat-box span { color: var(--text-45); font-size: 0.85rem; }
.stat-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--turq-soft); color: var(--turq);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.stat-icon svg { width: 18px; height: 18px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { color: var(--text-45); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
tr:hover td { background: var(--surface-2); }

.badge {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 100px;
  font-size: 0.76rem; font-weight: 600; font-family: var(--font-mono);
}
.badge.neu { background: var(--turq-soft); color: var(--turq); }
.badge.in_bearbeitung, .badge.geprueft, .badge.in_vermittlung, .badge.kontaktiert { background: rgba(217,169,74,0.15); color: var(--warn); }
.badge.angebot { background: rgba(139,124,250,0.16); color: #8b7cfa; }
.badge.abgeschlossen, .badge.vermittelt, .badge.deal { background: rgba(47,231,214,0.22); color: var(--turq); }
.badge.abgelehnt, .badge.kein_interesse, .badge.verloren { background: rgba(224,96,90,0.15); color: var(--danger); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 100px; font-weight: 600; font-size: 0.88rem;
  border: 1px solid var(--border-strong); background: transparent; color: var(--text);
  cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--turq); color: var(--turq); text-decoration: none; }
.btn-primary { background: var(--turq); color: #06201c; border-color: transparent; }
.btn-primary:hover { background: #45f0e0; color: #06201c; }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }

.form-row { margin-bottom: 18px; }
.form-row label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 7px; color: var(--text); }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 11px 14px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); font-family: inherit; font-size: 0.92rem;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: none; border-color: var(--turq); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.filter-pills a {
  padding: 7px 14px; border-radius: 100px; font-size: 0.82rem; border: 1px solid var(--border-strong); color: var(--text-70);
}
.filter-pills a.active { background: var(--turq-soft); border-color: var(--turq); color: var(--turq); text-decoration: none; }

.alert { padding: 14px 18px; border-radius: 10px; margin-bottom: 22px; font-size: 0.9rem; }
.alert.success { background: rgba(47,231,214,0.12); border: 1px solid rgba(47,231,214,0.35); color: var(--turq); }
.alert.error { background: rgba(224,96,90,0.12); border: 1px solid rgba(224,96,90,0.35); color: var(--danger); }

.login-box { max-width: 380px; margin: 90px auto; }
.login-box .card { padding: 34px; }
.login-box h1 { text-align: center; margin-bottom: 6px; }
.login-box p.subtitle { text-align: center; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-45); }

@media (max-width: 720px) {
  .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  table { font-size: 0.82rem; }
  th, td { padding: 9px 8px; }
}

/* ============================================================
   KANBAN-BOARD — Anfragen-Pipeline
   ============================================================ */

.kanban-board {
  display: flex; gap: 16px; align-items: flex-start; width: 100%;
}
.kanban-col {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  flex: 1 1 0; min-width: 0; min-height: 200px; display: flex; flex-direction: column;
}
.kanban-col-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 0.88rem;
}
.kanban-count {
  background: var(--surface-2); color: var(--text-45);
  font-family: var(--font-mono); font-size: 0.75rem;
  padding: 2px 9px; border-radius: 100px;
}
.kanban-cards {
  padding: 10px; display: flex; flex-direction: column; gap: 10px;
  min-height: 120px; flex: 1;
  transition: background 0.2s ease;
}
.kanban-cards.is-dragover { background: var(--turq-soft); }
.kanban-card {
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 12px 14px; cursor: grab;
  display: flex; gap: 10px; font-size: 0.85rem;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.is-dragging { opacity: 0.4; }
.kanban-card-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border-strong);
  color: var(--turq); font-family: var(--font-mono); font-weight: 700; font-size: 0.72rem;
  display: flex; align-items: center; justify-content: center;
}
.kanban-card-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.kanban-card strong { font-size: 0.9rem; }
.kanban-card span { color: var(--text-45); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-card a { font-size: 0.78rem; margin-top: 6px; }
.kanban-card form { margin-top: 6px; }

@media (max-width: 900px) {
  .kanban-board { overflow-x: auto; padding-bottom: 12px; }
  .kanban-col { flex: 0 0 240px; }
}

/* ============================================================
   NAV-BADGE — Zähler für neue Eingänge im Menü
   ============================================================ */

.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 19px; height: 19px; padding: 0 5px;
  margin-left: 6px; border-radius: 100px;
  background: var(--turq); color: #06201c;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700;
  vertical-align: middle;
}
