/* ============================================================
   LeadHunter Pro — NovaFlow Design System v2
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ── Backgrounds */
  --bg:      #f8fafc;
  --bg2:     #ffffff;
  --bg3:     #f1f5f9;
  --bg4:     #e2e8f0;

  /* ── Brand */
  --accent:  #1b73cd;
  --accent2: #64b2df;
  --dark:    #072049;

  /* ── Semantic */
  --green:   #16a34a;
  --amber:   #f59e0b;
  --red:     #dc2626;
  --purple:  #7c3aed;

  /* ── Text */
  --text:    #141f34;
  --text2:   #6b7280;
  --text3:   #94a3b8;

  /* ── Borders */
  --border:  #e5e7eb;
  --border2: #d1d5db;

  /* ── Radius */
  --radius:    8px;
  --radius-lg: 12px;

  /* ── Shadows */
  --shadow:    0 1px 4px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }

/* ── Layout ──────────────────────────────────────────────────── */
.app-layout { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg2); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.main-content { padding: 28px 32px; display: flex; flex-direction: column; gap: 24px; overflow-x: hidden; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.logo { padding: 18px 16px 14px; border-bottom: 1px solid var(--border); }
.logo-text { font-size: 15px; font-weight: 700; color: var(--dark); letter-spacing: -0.2px; }
.logo-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }

.nav { padding: 8px; overflow-y: auto; flex: 1; min-height: 0; }

.nav-group-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text3);
  padding: 12px 12px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  border-radius: var(--radius);
  border-left: 2px solid transparent;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active {
  color: var(--accent);
  background: rgba(27,115,205,0.08);
  font-weight: 600;
  border-left-color: var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding-left: 10px;
}
.nav-item i { width: 16px; text-align: center; font-size: 13px; opacity: 0.6; flex-shrink: 0; }
.nav-item.active i { opacity: 1; }
.nav-sep { height: 1px; background: var(--border); margin: 4px 4px; }

/* ── Sidebar User ────────────────────────────────────────────── */
.sidebar-user {
  padding: 10px 12px;
  margin: auto 8px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg3);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--text3); }
.sidebar-user-actions { display: flex; gap: 2px; flex-shrink: 0; }

.sidebar-icon-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: background 0.12s, color 0.12s;
}
.sidebar-icon-btn:hover { background: var(--bg3); color: var(--text); }
.sidebar-icon-btn.logout-btn:hover { color: var(--red); background: rgba(220,38,38,0.06); }

/* Legacy logout-btn (fallback) */
.logout-btn {
  background: none;
  border: none;
  color: var(--text3);
  cursor: pointer;
  font-size: 13px;
  transition: color 0.12s;
  padding: 4px 6px;
  border-radius: 6px;
  margin-left: auto;
}
.logout-btn:hover { color: var(--red); }

/* ── Cards ───────────────────────────────────────────────────── */
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.card-title { font-size: 13px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.card-body { padding: 24px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s, color 0.12s;
  border: none;
  letter-spacing: -0.1px;
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1562b0; box-shadow: 0 2px 8px rgba(27,115,205,0.3); }
.btn-ghost { background: transparent; border: 1px solid var(--border2); color: var(--text2); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: rgba(27,115,205,0.05); }
.btn-danger { background: rgba(220,38,38,0.07); border: 1px solid rgba(220,38,38,0.2); color: var(--red); }
.btn-danger:hover { background: rgba(220,38,38,0.12); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.btn-icon { width: 32px; height: 32px; padding: 0; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none !important; }

/* ── Form ────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { font-size: 12px; font-weight: 500; color: var(--text2); display: block; margin-bottom: 5px; }
.form-control {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.4;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(27,115,205,0.1); }
.form-control::placeholder { color: var(--text3); }
select.form-control option { background: var(--bg2); color: var(--text); }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Search Bar ──────────────────────────────────────────────── */
.search-bar { position: relative; width: 100%; }
.search-bar-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 13px;
  pointer-events: none;
}
.search-bar .form-control { padding-left: 36px; padding-right: 56px; }
.search-bar-kbd {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 10px;
  color: var(--text3);
  pointer-events: none;
  font-family: 'Inter', sans-serif;
}

/* ── Stats / KPI ─────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: border-color 0.15s;
}
.stat-card:hover { border-color: var(--accent); }
.stat-label { font-size: 11px; font-weight: 600; color: var(--text3); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.6px; }
.stat-value { font-size: 26px; font-weight: 700; font-family: 'Inter', sans-serif; letter-spacing: -0.5px; }
.sv-blue   { color: var(--accent); }
.sv-green  { color: var(--green); }
.sv-amber  { color: var(--amber); }
.sv-purple { color: var(--purple); }

/* ── Table ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 600px; }
thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text3);
  text-transform: uppercase;
  border-bottom: 2px solid var(--border);
  background: var(--bg3);
  position: sticky;
  top: 0;
  z-index: 1;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.08s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }
tbody td { padding: 14px 16px; vertical-align: middle; }

/* ── Status badges ───────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
}
.status-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status-select {
  border: none;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.s-neu            { background: rgba(27,115,205,0.10); color: #1b73cd; }
.s-kontaktiert    { background: rgba(22,163,74,0.10);  color: var(--green); }
.s-nicht_erreicht { background: rgba(245,158,11,0.10); color: var(--amber); }
.s-kein_interesse { background: rgba(220,38,38,0.10);  color: var(--red); }
.s-rueckruf       { background: rgba(124,58,237,0.10); color: var(--purple); }
.s-kunde          { background: rgba(22,163,74,0.15);  color: #15803d; }

/* ── Confidence bar ──────────────────────────────────────────── */
.conf-wrap { display: flex; align-items: center; gap: 6px; }
.conf-bar-bg { width: 48px; height: 3px; background: var(--bg4); border-radius: 2px; }
.conf-bar-fill { height: 100%; border-radius: 2px; }
.conf-val { font-size: 11px; color: var(--text3); font-family: 'JetBrains Mono', monospace; }

/* ── Badge ───────────────────────────────────────────────────── */
.badge { padding: 2px 8px; border-radius: 100px; font-size: 11px; font-weight: 600; background: rgba(27,115,205,0.10); color: var(--accent); }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(7,32,73,0.28); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg2); border: 1px solid var(--border2); border-radius: var(--radius-lg); padding: 28px; width: 100%; max-width: 480px; position: relative; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 20px; letter-spacing: -0.3px; }
.modal-close { position: absolute; top: 16px; right: 16px; background: var(--bg3); border: 1px solid var(--border); border-radius: 7px; padding: 5px 9px; color: var(--text3); cursor: pointer; transition: color 0.12s; }
.modal-close:hover { color: var(--text); }

/* ── Slide panel ─────────────────────────────────────────────── */
.slide-panel { position: fixed; right: 0; top: 0; bottom: 0; width: 560px; background: var(--bg2); border-left: 1px solid var(--border2); z-index: 150; transform: translateX(100%); transition: transform 0.22s cubic-bezier(0.4,0,0.2,1); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.slide-panel.open { transform: translateX(0); }
.slide-overlay { position: fixed; inset: 0; z-index: 149; background: rgba(7,32,73,0.18); backdrop-filter: blur(2px); display: none; }
.slide-overlay.open { display: block; }

/* ── Toast ───────────────────────────────────────────────────── */
.toast { position: fixed; bottom: 24px; right: 24px; z-index: 300; background: var(--dark); border-radius: var(--radius); padding: 11px 16px; font-size: 13px; font-weight: 500; color: #fff; display: none; align-items: center; gap: 8px; box-shadow: var(--shadow-lg); }

/* ── Notification bell ───────────────────────────────────────── */
.notif-bell { position: relative; }
.notif-dot { position: absolute; top: -3px; right: -3px; width: 7px; height: 7px; background: var(--red); border-radius: 50%; border: 2px solid var(--bg2); }

/* ── Tracking pulse ──────────────────────────────────────────── */
.pulse { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.pulse.online { animation: pulse 2s infinite; }
.pulse.idle { background: var(--amber); }
.pulse.offline { background: var(--text3); animation: none; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ── Decorative (unused) ─────────────────────────────────────── */
.grid-bg { display: none; }
.glow    { display: none; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ── Dark mode ───────────────────────────────────────────────── */
body.dark {
  --bg:      #0f172a;
  --bg2:     #1e293b;
  --bg3:     #263347;
  --bg4:     #334155;
  --text:    #f1f5f9;
  --text2:   #94a3b8;
  --text3:   #64748b;
  --border:  #2d3e52;
  --border2: #374151;
  --shadow:    0 1px 4px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.50);
}
body.dark .logo img {
  background: rgba(255,255,255,0.90);
  border-radius: 8px;
  padding: 6px;
}
body.dark select.form-control option { background: var(--bg3); }
body.dark tbody tr:hover { background: rgba(255,255,255,0.03); }
body.dark .search-bar-kbd { background: var(--bg3); border-color: var(--border2); }

/* ── Mobile topbar + Sidebar-Drawer (nur sichtbar <=800px) ──────── */
.mobile-topbar { display: none; }
.mobile-nav-overlay { position: fixed; inset: 0; z-index: 299; background: rgba(7,32,73,0.35); display: none; }
.mobile-nav-overlay.open { display: block; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 800px) {
  .mobile-topbar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 120;
    background: var(--bg2); border-bottom: 1px solid var(--border);
    padding: 0 14px; height: 52px; flex-shrink: 0;
  }
  .mobile-topbar img { height: 26px; }
  .mobile-topbar-title { font-size: 14px; font-weight: 700; color: var(--text); }
  .hamburger-btn {
    width: 44px; height: 44px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; color: var(--text); font-size: 18px; cursor: pointer;
  }

  .app-layout { grid-template-columns: 1fr; display: flex; flex-direction: column; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 260px; z-index: 300;
    transform: translateX(-100%); transition: transform 0.22s ease; box-shadow: var(--shadow-lg);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { padding: 14px; gap: 14px; }

  /* ── Stats: 2 Spalten statt automatisch eng ──────────────── */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  /* ── Tabellen → kompakte Karten, kein horizontales Scrollen ── */
  .table-wrap { overflow-x: visible; }
  table { min-width: 0; width: 100%; }
  thead { display: none; }
  tbody, tbody tr, tbody td { display: block; width: 100%; }
  tbody tr {
    border: 1px solid var(--border); border-radius: 10px;
    margin-bottom: 10px; padding: 12px 14px; background: var(--bg2);
  }
  tbody td { padding: 4px 0; border-bottom: none; }
  tbody td:first-child { display: none; } /* Zeilennummer: nicht relevant auf Mobile */
  tbody td:nth-child(2) {
    font-size: 14px; font-weight: 700; padding-bottom: 8px; margin-bottom: 6px;
    border-bottom: 1px solid var(--border);
  }
  tbody td:last-child { padding-top: 8px; text-align: right; }

  /* ── Buttons & Inputs: mind. 44px Höhe für Daumenbedienung ──── */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 40px; }
  .btn-icon { width: 44px; min-height: 44px; }
  .sidebar-icon-btn { width: 40px; height: 40px; font-size: 14px; }
  .form-control { min-height: 44px; }
  select.status-select { min-height: 38px; padding: 6px 10px; }

  /* ── Lead-Detail-Panel: Vollbild auf Mobile ──────────────── */
  .slide-panel { width: 100%; }

  /* ── Modal: volle Breite, nichts abgeschnitten ───────────── */
  .modal { width: 100%; max-width: 100%; padding: 20px; }
}

@media (max-width: 480px) {
  /* ── Extra-schmale Screens: Toolbar-Inputs/Selects volle Breite ── */
  input.form-control, select.form-control { width: 100% !important; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 12px 14px; }
}
