/**
 * Sovereign B2B Sales Suite
 * Modern Vanilla CSS Design System (Dark/Light Mode)
 * Zero-Build, Zero-NPM, 100% Standalone
 */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  
  /* Tag Markets Cyber Palette (Dark Mode - Default) */
  --bg-body: #0f0f10;
  --bg-sidebar: #131313;
  --bg-card: #171717;
  --bg-card-hover: #212123;
  --bg-panel: #232324;
  --bg-panel2: #2b2b2c;
  --bg-input: #111112;
  --border-color: rgba(244, 244, 244, 0.10);
  --border-focus: #CBFD5F;
  
  --text-main: #f4f4f4;
  --text-muted: rgba(244, 244, 244, 0.68);
  --text-subtle: rgba(244, 244, 244, 0.42);
  
  /* Tag Markets Neon Lime & Deep Dark */
  --primary: #CBFD5F;
  --primary-hover: #b5ea4e;
  --primary-text: #0b0b0b;
  --primary-glow: rgba(203, 253, 95, 0.28);

  --accent: #CBFD5F;
  --accent-text: #0b0b0b;
  
  --success: #CBFD5F;
  --success-bg: rgba(203, 253, 95, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --info: #38bdf8;
  --info-bg: rgba(56, 189, 248, 0.15);
  --purple: #a855f7;
  --purple-bg: rgba(168, 85, 247, 0.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 60px rgba(0, 0, 0, 0.55);
}

[data-theme="light"] {
  /* Tag Markets Executive Light Palette */
  --bg-body: #f6f7f9;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f3f7;
  --bg-panel: #f8f9fa;
  --bg-panel2: #eef1f5;
  --bg-input: #ffffff;
  --border-color: rgba(15, 15, 16, 0.10);
  --border-focus: #0f0f10;
  
  --text-main: #0f0f10;
  --text-muted: rgba(15, 15, 16, 0.65);
  --text-subtle: rgba(15, 15, 16, 0.42);
  
  --primary: #0f0f10;
  --primary-hover: #232324;
  --primary-text: #ffffff;
  --primary-glow: rgba(15, 15, 16, 0.15);

  --accent: #CBFD5F;
  --accent-text: #0b0b0b;

  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.12);
  
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 14px -1px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 14px 34px -3px rgba(0, 0, 0, 0.10);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  background-image:
    radial-gradient(1100px 700px at 15% 0%, rgba(203, 253, 95, 0.09), transparent 55%),
    radial-gradient(900px 600px at 95% 15%, rgba(203, 253, 95, 0.05), transparent 55%),
    linear-gradient(180deg, #0b0b0c 0%, var(--bg-body) 40%, #0b0b0c 100%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[data-theme="light"] body {
  background-image:
    radial-gradient(1100px 700px at 15% 0%, rgba(203, 253, 95, 0.12), transparent 55%),
    radial-gradient(900px 600px at 95% 15%, rgba(15, 15, 16, 0.03), transparent 55%),
    linear-gradient(180deg, #f0f2f5 0%, #f6f7f9 40%, #ffffff 100%);
  background-attachment: fixed;
}

body.sidebar-open {
  overflow: hidden;
}

/* App Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
  z-index: 100;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), width 0.2s ease;
}

.brand-header {
  padding: 24px 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  position: relative;
}

.brand-header .mobile-sidebar-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
}

.mobile-sidebar-close {
  display: none !important;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  margin-left: auto;
}

.mobile-sidebar-close:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.mobile-menu-toggle {
  display: none !important;
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.mobile-menu-toggle:hover {
  border-color: rgba(203, 253, 95, 0.45);
  color: #CBFD5F;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, rgba(203, 253, 95, 0.22), rgba(203, 253, 95, 0.08));
  border: 1px solid rgba(203, 253, 95, 0.35);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #CBFD5F;
  font-weight: 700;
  font-size: 1.15rem;
  box-shadow: 0 0 16px rgba(203, 253, 95, 0.25);
}

.brand-logo-wrap {
  width: 78px;
  height: 78px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(203, 253, 95, 0.08);
  border: 1px solid rgba(203, 253, 95, 0.35);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 24px rgba(203, 253, 95, 0.20);
  transition: all 0.2s ease;
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  display: block;
}

[data-theme="light"] .brand-icon {
  background: #0f0f10;
  border-color: #0f0f10;
  color: #CBFD5F;
  box-shadow: 0 4px 12px rgba(15, 15, 16, 0.15);
}

[data-theme="light"] .brand-logo-wrap {
  background: #0f0f10;
  border-color: #0f0f10;
  box-shadow: 0 4px 16px rgba(15, 15, 16, 0.15);
}

.brand-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.brand-text h1,
.brand-title {
  font-size: 1.30rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin: 0;
  line-height: 1.2;
}

.brand-badge {
  display: inline-block;
  font-size: 0.70rem;
  text-transform: uppercase;
  font-weight: 700;
  padding: 3px 10px;
  background: rgba(203, 253, 95, 0.12);
  color: #CBFD5F;
  border: 1px solid rgba(203, 253, 95, 0.30);
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
  line-height: 1.25;
}

[data-theme="light"] .brand-badge {
  background: rgba(15, 15, 16, 0.06);
  color: #0f0f10;
  border-color: rgba(15, 15, 16, 0.16);
}

.nav-section {
  padding: 14px 12px;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.nav-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  font-weight: 700;
  padding: 0 12px 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: all 0.15s ease;
  margin-bottom: 4px;
}

.nav-link:hover {
  background-color: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-color);
}

.nav-link.active {
  background-color: rgba(203, 253, 95, 0.12);
  border-color: rgba(203, 253, 95, 0.35);
  color: #CBFD5F;
  font-weight: 700;
  box-shadow: 0 0 14px rgba(203, 253, 95, 0.15);
}

[data-theme="light"] .nav-link.active {
  background-color: #0f0f10;
  border-color: #0f0f10;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 15, 16, 0.15);
}

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

.nav-badge {
  margin-left: auto;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.15);
  font-weight: 600;
}

/* User Profile & Role Switcher - ALWAYS PINNED AT BOTTOM */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-sidebar);
  flex-shrink: 0;
  margin-top: auto;
  position: sticky;
  bottom: 0;
  z-index: 20;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.35);
}

[data-theme="light"] .sidebar-footer {
  background: var(--bg-sidebar);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  background: #334155;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: #60a5fa;
  text-transform: capitalize;
}

.role-switcher-form select {
  width: 100%;
  padding: 6px 10px;
  font-size: 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
}

.top-bar {
  height: 68px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  position: sticky;
  top: 0;
  z-index: 20;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.theme-toggle-btn {
  background: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.15s ease;
}

.theme-toggle-btn:hover {
  border-color: var(--primary);
}

/* Tag Markets Segmented Theme Pill Control */
.theme-segmented-control {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
  transition: all 0.2s ease;
}

[data-theme="light"] .theme-segmented-control {
  background: rgba(15, 15, 16, 0.05);
  border-color: rgba(15, 15, 16, 0.12);
}

.theme-seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  line-height: 1;
  font-family: inherit;
  user-select: none;
}

.theme-seg-btn svg {
  flex-shrink: 0;
}

.theme-seg-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .theme-seg-btn:hover {
  background: rgba(15, 15, 16, 0.06);
}

.theme-seg-btn.active {
  background: var(--primary);
  color: var(--primary-text);
  border-color: rgba(203, 253, 95, 0.45);
  font-weight: 700;
  box-shadow: 0 0 12px var(--primary-glow);
}

[data-theme="light"] .theme-seg-btn.active {
  background: #0f0f10;
  color: #ffffff;
  border-color: #0f0f10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Tag Markets Live Pulse Dot & Chips */
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-size: 12.5px;
}

[data-theme="light"] .tag-chip {
  background: rgba(15, 15, 16, 0.04);
}

.tag-pulse-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #CBFD5F;
  box-shadow: 0 0 0 5px rgba(203, 253, 95, 0.16);
  animation: tagPulse 1.35s ease-in-out infinite;
  vertical-align: middle;
}

@keyframes tagPulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.72;
  }
}

/* Dashboard Content */
.content-body {
  padding: 28px 32px;
}

/* Tag Markets Executive KPI Kacheln */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}

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

.stat-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035) 0%, rgba(255, 255, 255, 0.008) 100%), var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.stat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(203, 253, 95, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 18px rgba(203, 253, 95, 0.12);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.stat-card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.stat-card:hover .stat-card-icon {
  background: rgba(203, 253, 95, 0.14);
  border-color: rgba(203, 253, 95, 0.35);
  color: #CBFD5F;
}

[data-theme="light"] .stat-card {
  background: #ffffff;
  border: 1px solid rgba(15, 15, 16, 0.09);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .stat-card:hover {
  border-color: #0f0f10;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .stat-card-icon {
  background: rgba(15, 15, 16, 0.04);
  border-color: rgba(15, 15, 16, 0.08);
  color: #0f0f10;
}

.stat-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0;
}

.stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.stat-card.highlight-lime .stat-value {
  color: #CBFD5F;
  text-shadow: 0 0 16px rgba(203, 253, 95, 0.22);
}

[data-theme="light"] .stat-card.highlight-lime .stat-value {
  color: #0f0f10;
  text-shadow: none;
}

.stat-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
}

/* Controls & Filter Bar */
.filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-input-wrapper {
  position: relative;
  min-width: 260px;
}

.search-input-wrapper input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.search-input-wrapper input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}

.select-filter {
  padding: 9px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
}

.select-filter:focus {
  border-color: var(--border-focus);
}

/* Status Pills Bar */
.status-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.status-tab {
  padding: 7px 14px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.status-tab:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.status-tab.active {
  background: #CBFD5F;
  border-color: #CBFD5F;
  color: #0b0b0b;
  box-shadow: 0 2px 10px rgba(203, 253, 95, 0.25);
  font-weight: 700;
}

.status-tab.active .status-tab-count {
  background: rgba(0, 0, 0, 0.22);
  color: #0b0b0b;
  font-weight: 800;
}

[data-theme="light"] .status-tab.active {
  background: #0f0f10;
  border-color: #0f0f10;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 15, 16, 0.18);
}

[data-theme="light"] .status-tab.active .status-tab-count {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

/* Contacts Table */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background: rgba(0, 0, 0, 0.15);
  color: var(--text-muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table tr:hover td {
  background-color: var(--bg-card-hover);
}

.contact-name {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.95rem;
}

.contact-company {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.contact-phone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  transition: color 0.15s ease;
}

.contact-phone:hover {
  color: var(--primary);
  text-decoration: underline;
}

.direct-call-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(203, 253, 95, 0.12);
  color: #CBFD5F;
  border: 1px solid rgba(203, 253, 95, 0.35);
  border-radius: var(--radius-full);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.82rem;
  transition: all 0.15s ease;
}

.direct-call-pill:hover {
  background: #CBFD5F;
  color: #0b0b0b;
  transform: scale(1.03);
  box-shadow: 0 0 12px rgba(203, 253, 95, 0.35);
}

[data-theme="light"] .direct-call-pill {
  background: rgba(5, 150, 105, 0.12);
  color: #065f46;
  border-color: rgba(5, 150, 105, 0.35);
  font-weight: 700;
}

[data-theme="light"] .direct-call-pill:hover {
  background: #065f46;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.30);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-blue    { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.35); }
.badge-indigo  { background: rgba(99, 102, 241, 0.15); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.35); }
.badge-purple  { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.35); }
.badge-emerald { background: rgba(203, 253, 95, 0.15); color: #CBFD5F; border: 1px solid rgba(203, 253, 95, 0.35); }
.badge-amber   { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.35); }
.badge-green   { background: rgba(203, 253, 95, 0.20); color: #CBFD5F; border: 1px solid rgba(203, 253, 95, 0.45); }
.badge-slate   { background: rgba(244, 244, 244, 0.08); color: rgba(244, 244, 244, 0.7); border: 1px solid rgba(244, 244, 244, 0.15); }

/* Light Mode Badges - High Contrast */
[data-theme="light"] .badge-blue    { background: rgba(2, 132, 199, 0.10); color: #0369a1; border: 1px solid rgba(2, 132, 199, 0.30); }
[data-theme="light"] .badge-indigo  { background: rgba(79, 70, 229, 0.10); color: #4338ca; border: 1px solid rgba(79, 70, 229, 0.30); }
[data-theme="light"] .badge-purple  { background: rgba(147, 51, 234, 0.10); color: #6b21a8; border: 1px solid rgba(147, 51, 234, 0.30); }
[data-theme="light"] .badge-emerald { background: rgba(5, 150, 105, 0.12); color: #065f46; border: 1px solid rgba(5, 150, 105, 0.35); font-weight: 700; }
[data-theme="light"] .badge-amber   { background: rgba(217, 119, 6, 0.12); color: #92400e; border: 1px solid rgba(217, 119, 6, 0.30); }
[data-theme="light"] .badge-green   { background: rgba(22, 101, 52, 0.12); color: #166534; border: 1px solid rgba(22, 101, 52, 0.35); font-weight: 700; }
[data-theme="light"] .badge-slate   { background: rgba(15, 15, 16, 0.06); color: #334155; border: 1px solid rgba(15, 15, 16, 0.18); }

/* Auto-Stop Indicator Tag */
.auto-stop-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.auto-stop-tag.stopped {
  background: var(--danger-bg);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.auto-stop-tag.active {
  background: rgba(203, 253, 95, 0.12);
  color: #CBFD5F;
  border: 1px solid rgba(203, 253, 95, 0.35);
}

[data-theme="light"] .auto-stop-tag.active {
  background: rgba(5, 150, 105, 0.12);
  color: #065f46;
  border: 1px solid rgba(5, 150, 105, 0.35);
  font-weight: 700;
}

[data-theme="light"] .auto-stop-tag.stopped {
  background: rgba(220, 38, 38, 0.10);
  color: #b91c1c;
  border: 1px solid rgba(220, 38, 38, 0.30);
}

/* Action Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s ease, filter 0.12s ease, background-color 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  line-height: 1.25;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
  border: 1px solid rgba(203, 253, 95, 0.4);
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  color: var(--primary-text);
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.btn-primary:active {
  transform: translateY(0);
}

[data-theme="light"] .btn-primary {
  background: #0f0f10;
  color: #ffffff;
  border-color: #0f0f10;
  box-shadow: 0 4px 14px rgba(15, 15, 16, 0.18);
}

[data-theme="light"] .btn-primary:hover {
  background: #232324;
  color: #ffffff;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: rgba(203, 253, 95, 0.35);
  color: var(--text-main);
  transform: translateY(-1px);
}

[data-theme="light"] .btn-secondary {
  background: rgba(15, 15, 16, 0.04);
  border-color: var(--border-color);
}

[data-theme="light"] .btn-secondary:hover {
  background: rgba(15, 15, 16, 0.08);
  border-color: rgba(15, 15, 16, 0.25);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  border-color: var(--primary);
  color: var(--text-main);
}

/* Modals & Slide-Over */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.96);
  transition: transform 0.2s ease;
  max-height: calc(90vh - 20px);
  max-height: calc(90dvh - 20px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  margin: auto;
}

.modal-overlay.open .modal-content {
  transform: scale(1);
}

/* Wichtig für Modals mit Formularen: Formular muss Flex-Container sein! */
.modal-content > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.modal-body {
  padding: 20px 22px;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  flex: 1 1 auto;
  min-height: 0;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(0, 0, 0, 0.1);
}

/* Form Controls in Modal */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Call Result Selection Buttons */
.call-results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.call-result-option {
  position: relative;
}

.call-result-option input[type="radio"] {
  position: absolute;
  opacity: 0;
}

.call-result-card {
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: all 0.15s ease;
}

.call-result-option input[type="radio"]:checked + .call-result-card {
  border-color: var(--primary);
  background: rgba(203, 253, 95, 0.12);
  box-shadow: 0 0 0 2px var(--primary);
}

.call-result-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-main);
}

.call-result-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Timeline Drawer */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  padding-left: 24px;
}

.timeline-list::before {
  content: '';
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 7px;
  width: 2px;
  background: var(--border-color);
}

.timeline-item {
  position: relative;
}

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background: var(--primary);
  border: 3px solid var(--bg-card);
  box-shadow: 0 0 8px var(--primary-glow);
}

.timeline-content {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.timeline-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.timeline-time {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-subtle);
}

.timeline-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  animation: slideIn 0.2s ease-out;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error   { border-left: 4px solid var(--danger); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* Responsive Breakpoints & Mobile Optimization */
@media (min-width: 861px) {
  .sidebar-backdrop {
    display: none !important;
  }
}

@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.7);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .mobile-menu-toggle {
    display: inline-flex !important;
  }

  .mobile-sidebar-close {
    display: inline-flex !important;
  }

  .top-bar {
    height: auto;
    min-height: 60px;
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .page-title {
    font-size: 1.05rem;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
  }

  .content-body {
    padding: 16px 14px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 18px;
  }

  .stats-grid .stat-card:last-child {
    grid-column: span 2;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px;
  }

  .filter-group {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 8px;
  }

  .search-input-wrapper {
    min-width: 100%;
    width: 100%;
  }

  .select-filter {
    width: 100%;
  }

  .status-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 6px;
    scrollbar-width: none;
    gap: 6px;
  }

  .status-tabs::-webkit-scrollbar {
    display: none;
  }

  .status-tab {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
  }

  .data-table {
    min-width: 680px;
  }

  .modal-overlay {
    padding: 10px;
    align-items: flex-start !important; /* Verhindert Abschneiden oben bei langen Formularen auf Smartphones */
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .modal-content {
    max-width: 100% !important;
    max-height: calc(100vh - 20px) !important;
    max-height: calc(100dvh - 20px) !important;
    margin: 10px auto;
    border-radius: var(--radius-md);
  }

  .modal-header {
    padding: 14px 16px;
  }

  .modal-body {
    padding: 16px 14px;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .modal-footer {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .modal-footer .btn {
    flex: 1 1 auto;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid .stat-card:last-child {
    grid-column: auto;
  }

  .stat-card {
    padding: 12px 14px;
  }

  .stat-value {
    font-size: 1.45rem;
  }

  .top-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .top-actions .btn,
  .top-actions .theme-segmented-control {
    width: 100%;
    justify-content: center;
  }

  .top-actions .theme-seg-btn {
    flex: 1;
    justify-content: center;
  }

  .page-title {
    font-size: 0.95rem;
  }

  .brand-header {
    padding: 16px 14px;
  }

  .call-results-grid {
    grid-template-columns: 1fr;
  }

  .funnel-stage-row {
    grid-template-columns: 100px 1fr 40px;
    gap: 8px;
  }

  .modal-overlay {
    padding: 6px;
  }

  .modal-content {
    max-height: calc(100vh - 12px) !important;
    max-height: calc(100dvh - 12px) !important;
    margin: 6px auto;
  }

  .modal-body {
    padding: 14px 12px;
  }
}

/* Pipeline & KPI Modal Styling */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.kpi-metric-card {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  text-align: center;
}
.kpi-metric-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: #CBFD5F;
  margin-bottom: 2px;
}
[data-theme="light"] .kpi-metric-val {
  color: #0f0f10;
}
.kpi-metric-title {
  font-size: 0.74rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.funnel-container {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin-bottom: 20px;
}
.funnel-stage-row {
  display: grid;
  grid-template-columns: 140px 1fr 60px;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.funnel-stage-row:last-child {
  margin-bottom: 0;
}
.funnel-stage-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}
.funnel-bar-bg {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9999px;
  height: 8px;
  overflow: hidden;
}
.funnel-bar-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #CBFD5F, #84cc16);
  transition: width 0.4s ease;
}
.funnel-stage-count {
  font-size: 0.85rem;
  font-weight: 700;
  text-align: right;
  color: var(--text-main);
}

.terminal-box {
  background: #020617;
  color: #38bdf8;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid #1e293b;
  max-height: 240px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
