/* === Variables === */
:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-card: #1e2a4a;
  --bg-hover: #253a5e;
  --bg-input: #0f1628;
  --text-primary: #e8e8e8;
  --text-secondary: #8892a4;
  --text-muted: #5a6478;
  --accent: #6c5ce7;
  --accent-hover: #7c6ff7;
  --green: #00d68f;
  --red: #ff6b6b;
  --orange: #ffa502;
  --blue: #4facfe;
  --border: #2a3a5e;
  --sidebar-width: 220px;
  --radius: 10px;
  --radius-sm: 6px;
}

[data-theme="light"] {
  --bg-primary: #f5f5f5;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #fef6f0;
  --bg-input: #f5f5f5;
  --text-primary: #2d3436;
  --text-secondary: #636e72;
  --text-muted: #b2bec3;
  --accent: #f57c00;
  --accent-hover: #ef6c00;
  --green: #43a047;
  --red: #e53935;
  --orange: #f57c00;
  --blue: #1e88e5;
  --border: #e0e0e0;
}

/* === Reset === */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

/* === Auth === */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-primary), var(--bg-secondary));
}
.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 40px;
  width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.auth-logo {
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 30px;
  color: var(--accent);
}
.auth-logo i { margin-right: 10px; }
.auth-tabs {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
}
.auth-tab {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 15px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.auth-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form input {
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.auth-form input:focus { border-color: var(--accent); }
.auth-error { color: var(--red); font-size: 13px; min-height: 20px; }

/* === Buttons === */
.btn-primary {
  padding: 12px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-sm {
  padding: 6px 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}
.btn-outline {
  padding: 8px 16px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}
.btn-outline:hover { background: var(--accent); color: white; }
.btn-danger { background: var(--red); }

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

/* === Sidebar === */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}
.sidebar-logo {
  padding: 20px;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
}
.sidebar-logo i { margin-right: 8px; }
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--text-secondary);
  font-size: 14px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  color: var(--accent);
  background: var(--bg-hover);
  border-left-color: var(--accent);
}
.nav-item i { width: 20px; text-align: center; }
.nav-item.nav-locked { opacity: 0.5; cursor: not-allowed; }
.nav-item.nav-locked:hover { background: transparent; color: var(--text-secondary); }
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.theme-toggle {
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 18px;
  transition: color 0.2s;
}
.theme-toggle:hover { color: var(--orange); }
.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}
.btn-logout {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}
.btn-logout:hover { color: var(--red); }

/* === Content === */
.content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px;
}
.content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.project-selector {
  display: flex;
  align-items: center;
  gap: 8px;
}
.project-selector select {
  display: none;
}

/* Custom Project Dropdown */
.project-dropdown {
  position: relative;
  min-width: 200px;
}
.project-dropdown-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.project-dropdown-btn:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
}
.project-dropdown-btn .project-name {
  font-weight: 500;
  color: var(--text-primary);
}
.project-dropdown-btn .project-subdomain {
  font-size: 12px;
  color: var(--text-muted);
}
.project-dropdown-btn i {
  color: var(--text-muted);
  transition: transform 0.2s;
}
.project-dropdown.open .project-dropdown-btn i {
  transform: rotate(180deg);
}
.project-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 1000;
  display: none;
  max-height: 300px;
  overflow-y: auto;
}
.project-dropdown.open .project-dropdown-menu {
  display: block;
  animation: dropdownFade 0.15s ease;
}
@keyframes dropdownFade {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.project-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border);
}
.project-dropdown-item:last-child {
  border-bottom: none;
}
.project-dropdown-item:hover {
  background: var(--bg-hover);
}
.project-dropdown-item.active {
  background: var(--accent-alpha);
}
.project-dropdown-item .project-icon {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  flex-shrink: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
  font-size: 14px;
  text-transform: uppercase;
}
.project-dropdown-item .project-info {
  flex: 1;
}
.project-dropdown-item .project-info .name {
  font-weight: 500;
  color: var(--text-primary);
}
.project-dropdown-item .project-info .subdomain {
  font-size: 12px;
  color: var(--text-muted);
}
.project-dropdown-item .project-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--success-alpha);
  color: var(--success);
}
.project-dropdown-item .project-status.trial {
  background: var(--warning-alpha);
  color: var(--warning);
}

/* === Dashboard / Pulse === */
.pulse-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.pulse-tabs {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.pulse-tab {
  padding: 8px 18px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.pulse-tab.active { background: var(--accent); color: white; }
.period-selector {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-left: auto;
}
.period-btn {
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
}
.period-btn.active { background: var(--accent); color: white; }
.date-picker {
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
}

/* === Summary Cards === */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.summary-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.summary-card .label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.summary-card .value {
  font-size: 28px;
  font-weight: 700;
}
.summary-card.calls .value { color: var(--blue); }
.summary-card.sales .value { color: var(--green); }
.summary-card.invoices .value { color: var(--orange); }
.summary-card.payments .value { color: var(--accent); }

/* === Pulse Table === */
.pulse-table-wrapper {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow-x: auto;
}
.pulse-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.pulse-table th {
  padding: 12px 8px;
  text-align: center;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.pulse-table td {
  padding: 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.pulse-table tr:last-child td { border-bottom: none; }

/* === Multi-row dashboard === */
.pulse-table-multi .pulse-manager-header td {
  background: var(--bg-hover);
  border-bottom: none;
  padding: 0;
  border-top: 2px solid var(--border);
}
.pulse-table-multi .pulse-data-row {
  transition: background 0.15s;
}
.pulse-data-row .row-icon-cell {
  text-align: left !important;
  padding: 2px 4px !important;
  font-size: 11px;
  white-space: nowrap;
  color: var(--text-secondary);
  width: 24px;
  min-width: 24px;
  max-width: 24px;
}
.pulse-data-row .row-label-cell {
  text-align: left !important;
  padding-left: 12px !important;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  min-width: 150px;
}
.row-icon {
  font-size: 13px;
  margin-right: 2px;
}
.pulse-row-highlight {
  background: rgba(108, 92, 231, 0.12) !important;
}
.pulse-row-highlight .row-label-cell {
  color: var(--accent) !important;
  font-weight: 600;
}
.hour-value.payment-positive { color: var(--green); font-weight: 700; }
.hour-value.payment-zero { color: var(--red); opacity: 0.6; }
.totals-cell.payment-positive { color: var(--green) !important; }
.totals-cell.payment-zero { color: var(--red) !important; }
.totals-cell.month-total {
  background: rgba(108, 92, 231, 0.08);
  font-size: 13px;
}

/* Manager header row */
.pulse-table-multi .pulse-manager-header .manager-cell {
  vertical-align: middle;
  padding: 8px 12px !important;
}

.manager-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px !important;
  text-align: left !important;
  min-width: 180px;
}
.manager-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
  overflow: hidden;
}
.manager-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.manager-info { display: flex; flex-direction: column; }
.manager-name { font-weight: 600; font-size: 13px; white-space: nowrap; }
.manager-points {
  font-size: 11px;
  color: var(--orange);
}
.hour-cell {
  min-width: 50px;
  position: relative;
}
.hour-value {
  font-weight: 600;
  font-size: 14px;
}
.hour-value.high { color: var(--green); }
.hour-value.medium { color: var(--orange); }
.hour-value.low { color: var(--text-muted); }
.hour-value.zero { color: var(--text-muted); opacity: 0.3; }
.hour-current { background: rgba(108, 92, 231, 0.1); }
.totals-cell {
  font-weight: 700;
  color: var(--accent);
  min-width: 60px;
  background: rgba(108, 92, 231, 0.05);
}

/* === Managers Page === */
.managers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.manager-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.2s;
  min-width: 240px;
}
.manager-card:hover { transform: translateY(-2px); }
.manager-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
}
.manager-card-avatar {
  width: 56px;
  min-width: 56px;
  height: 56px;
  min-height: 56px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.manager-card-details { flex: 1; min-width: 0; overflow: hidden; }
.manager-card-name { font-size: 16px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.manager-card-email { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.manager-card-stats {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.stat { display: flex; flex-direction: column; align-items: center; min-width: 50px; }
.stat-value { font-size: 16px; font-weight: 700; word-break: break-all; text-align: center; }
.stat-label { font-size: 10px; color: var(--text-secondary); white-space: nowrap; }
.manager-card-actions {
  display: flex;
  gap: 8px;
}
.toggle-switch {
  position: relative;
  width: 44px;
  min-width: 44px;
  height: 24px;
  min-height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--text-muted);
  border-radius: 24px;
  transition: 0.3s;
}
.toggle-slider:before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--green); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(20px); }

/* === Gamification === */
.gamification-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
}
.gifts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.gift-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s;
}
.gift-card:hover { transform: translateY(-2px); }
.gift-image {
  height: 140px;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}
.gift-body { padding: 16px; }
.gift-title { font-weight: 600; margin-bottom: 4px; }
.gift-desc { font-size: 12px; color: var(--text-secondary); margin-bottom: 12px; }
.gift-price {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--orange);
}
.gift-price i { font-size: 14px; }

/* Leaderboard */
.leaderboard {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
}
.leaderboard h3 {
  font-size: 16px;
  margin-bottom: 16px;
  color: var(--accent);
}
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.leaderboard-item:last-child { border-bottom: none; }
.leaderboard-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  background: var(--bg-hover);
}
.leaderboard-rank.gold { background: #ffd700; color: #333; }
.leaderboard-rank.silver { background: #c0c0c0; color: #333; }
.leaderboard-rank.bronze { background: #cd7f32; color: white; }
.leaderboard-name { flex: 1; font-size: 14px; }
.leaderboard-points { font-weight: 700; color: var(--orange); font-size: 14px; }

/* === Settings === */
.settings-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
}
.settings-section h3 {
  font-size: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-group input, .form-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
}
.form-group input:focus { border-color: var(--accent); }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 480px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
}
.modal-body { padding: 24px; }

/* === Responsive === */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar span { display: none; }
  .sidebar.open { width: 220px; }
  .sidebar.open span { display: inline; }
  .content { margin-left: 60px; }
  .gamification-layout { grid-template-columns: 1fr; }
  .summary-cards { grid-template-columns: repeat(2, 1fr); }
}

/* === Empty State === */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; color: var(--text-muted); }
.empty-state h3 { margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 20px; }

/* === Page Title === */
.page-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-title h2 { font-size: 20px; }

/* Plan bar */
.pulse-plan-row { border-bottom: 2px solid var(--border); }
.plan-cell { padding: 4px 12px !important; }
.plan-bar-wrapper {
  background: var(--bg-input);
  border-radius: 4px;
  height: 8px;
  width: 100%;
  overflow: hidden;
  display: inline-block;
  max-width: 300px;
  vertical-align: middle;
  margin-right: 10px;
}
.plan-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--orange), var(--green));
  border-radius: 4px;
  transition: width 0.5s ease;
}
.plan-text {
  font-size: 12px;
  color: var(--text-secondary);
  vertical-align: middle;
}

/* Light theme orange accents */
[data-theme="light"] .sidebar {
  background: #fff;
  border-right: 1px solid #e0e0e0;
}
[data-theme="light"] .pulse-row-highlight {
  background: rgba(245, 124, 0, 0.08) !important;
}
[data-theme="light"] .pulse-table th {
  background: #fafafa;
  color: #666;
}
[data-theme="light"] .summary-card {
  border: 1px solid #e0e0e0;
}
[data-theme="light"] .pulse-tab.active {
  background: #f57c00;
  color: #fff;
}
.sort-btn {
  padding: 6px 12px !important;
  font-size: 13px !important;
  min-width: auto;
}

.date-range-label {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 12px;
  background: var(--bg-hover);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* ===== Knowledge Base ===== */
.kb-layout {
  display: flex;
  height: calc(100vh - 120px);
  gap: 0;
}
.kb-sidebar {
  width: 260px;
  min-width: 260px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--bg-secondary);
  position: relative;
  z-index: 1;
}
.kb-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.kb-sidebar-header h3 { font-size: 16px; }
.kb-sidebar-actions { display: flex; gap: 4px; }
.kb-sidebar-actions .btn-sm {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
}
.kb-sidebar-actions .btn-sm:hover { background: var(--accent); color: #fff; }

.kb-tree { padding: 8px; }
.kb-empty-tree { padding: 20px; text-align: center; color: var(--text-muted); font-size: 13px; }

.kb-category { margin-bottom: 4px; }
.kb-category-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background 0.15s;
}
.kb-category-header:hover { background: var(--bg-hover); }
.kb-cat-arrow { font-size: 10px; color: var(--text-muted); width: 12px; }
.kb-cat-name { flex: 1; }
.kb-cat-actions { display: none; gap: 2px; }
.kb-category-header:hover .kb-cat-actions { display: flex; }
.kb-cat-actions button {
  background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 12px; padding: 2px 4px; border-radius: 3px;
}
.kb-cat-actions button:hover { color: var(--accent); background: var(--bg-card); }

.kb-category-items { padding-left: 16px; }

.kb-article-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-primary);
  transition: background 0.15s;
}
.kb-article-item:hover { background: var(--bg-hover); }
.kb-article-item.active { background: var(--accent); color: #fff; }
.kb-article-icon { font-size: 12px; }
.kb-article-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kb-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
}
.kb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--text-muted);
  text-align: center;
}
.kb-empty h3 { margin: 12px 0 4px; color: var(--text-secondary); }
.kb-empty p { font-size: 13px; }

.kb-article-h1 { font-size: 28px; margin-bottom: 8px; }
.kb-article-meta { color: var(--text-muted); font-size: 13px; display: flex; gap: 16px; margin-bottom: 16px; }
.kb-article-toolbar { margin-bottom: 20px; display: flex; gap: 8px; }
.kb-article-toolbar .btn-sm { padding: 6px 14px; border-radius: 6px; cursor: pointer; font-size: 13px; border: none; }
.kb-article-toolbar .btn-primary { background: var(--accent); color: #fff; }
.kb-article-toolbar .btn-danger { background: var(--red); color: #fff; }
.kb-article-body {
  line-height: 1.8;
  font-size: 15px;
}
.kb-article-body h1 { font-size: 24px; margin: 24px 0 12px; }
.kb-article-body h2 { font-size: 20px; margin: 20px 0 10px; }
.kb-article-body h3 { font-size: 17px; margin: 16px 0 8px; }
.kb-article-body img { max-width: 100%; border-radius: 8px; margin: 12px 0; }
.kb-article-body iframe { max-width: 100%; border-radius: 8px; margin: 12px 0; }
.kb-article-body blockquote { border-left: 4px solid var(--accent); padding: 12px 20px; margin: 16px 0; background: var(--bg-hover); border-radius: 0 8px 8px 0; font-style: italic; }
.kb-article-body hr { border: none; border-top: 2px solid var(--border); margin: 24px 0; }
.kb-article-body audio { width: 100%; max-width: 400px; margin: 12px 0; border-radius: 8px; }
.kb-article-body pre { background: var(--bg-input); padding: 12px; border-radius: 6px; overflow-x: auto; }
.kb-article-body ul, .kb-article-body ol { padding-left: 24px; }

.kb-toc {
  width: 220px;
  min-width: 220px;
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 16px;
  position: sticky;
  top: 0;
}
.kb-toc-title { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.kb-toc-item {
  display: block;
  padding: 4px 0;
  font-size: 12px;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kb-toc-item:hover { color: var(--accent); border-left-color: var(--accent); }
.kb-toc-empty { color: var(--text-muted); font-size: 12px; }

/* KB Editor */
.kb-editor { max-width: 800px; }
.kb-title-input { font-size: 20px; font-weight: 600; padding: 10px 14px; width: 100%; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary); }
.kb-editor-actions { margin-top: 16px; display: flex; gap: 10px; }
.kb-editor .btn-primary { padding: 8px 20px; }
.kb-editor .btn-outline { padding: 8px 20px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-primary); border-radius: 8px; cursor: pointer; }

/* TinyMCE editor */
#kb-editor-container { min-height: 300px; border-radius: 8px; overflow: hidden; }
.tox-tinymce { border-radius: 8px !important; border-color: var(--border) !important; }
/* Article content tables */
.kb-article-content table { border-collapse: collapse; width: 100%; margin: 16px 0; }
.kb-article-content table td, .kb-article-content table th { border: 1px solid var(--border); padding: 8px 12px; }
.kb-article-content table th { background: var(--bg-secondary); font-weight: 600; }
/* TinyMCE checklist in article view */
.kb-article-content .tox-checklist { list-style: none; padding-left: 1.5em; }
.kb-article-content .tox-checklist > li { position: relative; padding-left: 0.5em; margin: 0.25em 0; }
.kb-article-content .tox-checklist > li::before { 
  content: '☐'; 
  position: absolute; 
  left: -1.2em; 
  font-size: 1.1em;
  color: var(--text-secondary);
}
.kb-article-content .tox-checklist > li.tox-checklist--checked::before { content: '☑'; color: var(--accent); }
.kb-article-content .tox-checklist > li.tox-checklist--checked { text-decoration: line-through; opacity: 0.7; }
/* Text alignment */
.kb-article-content .align-center, .align-center { text-align: center; }
.ql-align-right { text-align: right; }
.ql-align-justify { text-align: justify; }
.ql-video { display: block; width: 560px; height: 315px; }
.ql-align-center .ql-video,
.ql-video.ql-align-center,
p.ql-align-center iframe { margin: 0 auto; }
.ql-editor .ql-video { margin: 10px 0; }
.ql-editor .ql-align-center { display: block; }
.ql-editor .ql-align-center iframe { margin: 0 auto; display: block; }

/* Quill toolbar tooltips */
.ql-toolbar button[class*="ql-"]::after,
.ql-toolbar .ql-picker-label::after { 
  content: attr(data-tooltip); 
  position: absolute; 
  bottom: -28px; 
  left: 50%; 
  transform: translateX(-50%); 
  background: var(--bg-card); 
  color: var(--text-primary); 
  padding: 4px 8px; 
  border-radius: 4px; 
  font-size: 11px; 
  white-space: nowrap; 
  opacity: 0; 
  pointer-events: none; 
  transition: opacity 0.2s;
  z-index: 1000;
  border: 1px solid var(--border);
}
.ql-toolbar button[class*="ql-"]:hover::after,
.ql-toolbar .ql-picker-label:hover::after { opacity: 1; }
.ql-toolbar button, .ql-toolbar .ql-picker-label { position: relative; }
.ql-bold::after { content: 'Жирный' !important; }
.ql-italic::after { content: 'Курсив' !important; }
.ql-underline::after { content: 'Подчёркнутый' !important; }
.ql-strike::after { content: 'Зачёркнутый' !important; }
.ql-list[value="ordered"]::after { content: 'Нумерованный список' !important; }
.ql-list[value="bullet"]::after { content: 'Маркированный список' !important; }
.ql-blockquote::after { content: 'Цитата' !important; }
.ql-code-block::after { content: 'Код' !important; }
.ql-link::after { content: 'Ссылка' !important; }
.ql-image::after { content: 'Изображение' !important; }
.ql-video::after { content: 'Видео' !important; }
.ql-clean::after { content: 'Очистить формат' !important; }
.ql-align .ql-picker-label::after { content: 'Выравнивание' !important; }
.ql-color .ql-picker-label::after { content: 'Цвет текста' !important; }
.ql-background .ql-picker-label::after { content: 'Цвет фона' !important; }
.ql-header .ql-picker-label::after { content: 'Заголовок' !important; }
.ql-editor { color: var(--text-primary); min-height: 300px; font-size: 15px; line-height: 1.8; }
.ql-editor.ql-blank::before { color: var(--text-muted); }
.ql-snow .ql-stroke { stroke: var(--text-secondary) !important; }
.ql-snow .ql-fill { fill: var(--text-secondary) !important; }
.ql-snow .ql-picker-label { color: var(--text-secondary) !important; }
.ql-snow .ql-picker-options { background: var(--bg-card) !important; border-color: var(--border) !important; }
.ql-snow .ql-picker-item { color: var(--text-primary) !important; }

/* Emoji nav icon */
.nav-icon-emoji { font-size: 16px; width: 20px; text-align: center; }

@media (max-width: 768px) {
  .kb-layout { flex-direction: column; height: auto; }
  .kb-sidebar { width: 100%; min-width: auto; max-height: 250px; border-right: none; border-bottom: 1px solid var(--border); }
  .kb-toc { display: none; }
  .kb-content { padding: 16px; }
}

/* ===== Gamification v2 ===== */
.gam-tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--bg-secondary); border-radius: 10px; padding: 4px; flex-wrap: wrap; }
.gam-tab { padding: 8px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text-muted); border: none; background: none; transition: all 0.2s; }
.gam-tab:hover { color: var(--text-primary); }
.gam-tab.active { background: var(--accent); color: #fff; }
.gam-panel { min-height: 200px; }
.gam-empty { text-align: center; padding: 40px; color: var(--text-muted); }
.gam-empty i { font-size: 40px; margin-bottom: 12px; display: block; color: var(--accent); }
.gam-error { color: var(--red); padding: 20px; }

/* Leaderboard */
.leaderboard-grid { display: flex; flex-direction: column; gap: 8px; max-width: 600px; }
.lb-card { display: flex; align-items: center; gap: 16px; padding: 14px 20px; background: var(--bg-card); border-radius: 10px; border: 1px solid var(--border); }
.lb-card.lb-top { border-color: var(--accent); }
.lb-medal { font-size: 24px; width: 40px; text-align: center; }
.lb-rank { font-size: 16px; font-weight: 700; color: var(--text-muted); }
.lb-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--bg-secondary); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.lb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lb-avatar i { color: var(--text-muted); }
.lb-info { flex: 1; }
.lb-name { font-weight: 600; font-size: 15px; }
.lb-points { color: var(--accent); font-size: 13px; margin-top: 2px; }

/* Gifts grid */
.gifts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.gift-card { background: var(--bg-card); border-radius: 12px; border: 1px solid var(--border); overflow: hidden; transition: border-color 0.2s; display: flex; flex-direction: column; }
.gift-card:hover { border-color: var(--accent); }
.gift-image { height: 140px; background: var(--bg-secondary); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.gift-image img { width: 100%; height: 100%; object-fit: cover; }
.gift-body { padding: 14px; display: flex; flex-direction: column; flex: 1; }
.gift-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; height: 40px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gift-desc { color: var(--text-muted); font-size: 12px; margin-bottom: 8px; height: 32px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gift-price { color: var(--accent); font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.gift-actions { display: flex; gap: 6px; margin-top: auto; }
.btn-danger-sm { background: var(--red); color: #fff; border: none; padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.btn-outline { border: 1px solid var(--border); background: var(--bg-card); color: var(--text-primary); padding: 4px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }

/* Rules table */
.rules-section { max-width: 800px; }
.rules-table { width: 100%; border-collapse: collapse; }
.rules-table th { padding: 10px 12px; text-align: center; color: var(--accent); font-size: 13px; border-bottom: 2px solid var(--border); }
.rules-table th:first-child { text-align: left; }
.rules-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.rule-cell { display: flex; align-items: center; gap: 8px; justify-content: center; }
.rule-input { width: 70px; padding: 6px 8px; text-align: center; background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; color: var(--text-primary); font-size: 14px; font-weight: 600; }
.rule-plan-row { border-top: 2px solid var(--accent); }

/* Toggle switch for rules */
.rule-toggle { position: relative; display: inline-block; width: 40px; height: 22px; vertical-align: middle; }
.rule-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.rule-toggle .toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: #3a3a4a; border-radius: 22px; transition: 0.2s; }
.rule-toggle .toggle-slider:before { content: ''; position: absolute; height: 16px; width: 16px; left: 3px; top: 3px; background: white; border-radius: 50%; transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.rule-toggle .toggle-slider:after { display: none !important; }
.rule-toggle input:checked + .toggle-slider { background: var(--accent); }
.rule-toggle input:checked + .toggle-slider:before { transform: translateX(18px); }

/* Manual points */
.manual-section { max-width: 700px; }
.manual-form { background: var(--bg-card); border-radius: 10px; padding: 20px; border: 1px solid var(--border); margin-bottom: 20px; }
.manual-form .form-group { margin-bottom: 14px; }
.manual-form label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.manual-form select, .manual-form input { width: 100%; padding: 8px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; color: var(--text-primary); font-size: 14px; }

.balance-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.balance-card { background: var(--bg-card); border-radius: 10px; padding: 16px; border: 1px solid var(--border); text-align: center; }
.balance-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--bg-secondary); margin: 0 auto 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.balance-avatar img { width: 100%; height: 100%; object-fit: cover; }
.balance-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.balance-points { color: var(--accent); font-weight: 700; font-size: 16px; }

/* History */
.history-list { display: flex; flex-direction: column; gap: 6px; max-width: 700px; }
.history-item { display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: var(--bg-card); border-radius: 8px; border: 1px solid var(--border); }
.history-icon { font-size: 18px; font-weight: 700; min-width: 60px; text-align: center; border-radius: 6px; padding: 4px 8px; }
.history-icon.positive { color: #66bb6a; background: rgba(102,187,106,0.1); }
.history-icon.negative { color: #ef5350; background: rgba(239,83,80,0.1); }
.history-info { flex: 1; }
.history-name { font-weight: 600; font-size: 14px; }
.history-reason { color: var(--text-muted); font-size: 12px; }
.history-meta { text-align: right; }
.history-type { font-size: 11px; color: var(--text-muted); }
.history-date { font-size: 11px; color: var(--text-muted); }

/* GC Import Progress */
.gc-import-progress { background: var(--bg-secondary); border-radius: 8px; height: 20px; overflow: hidden; margin-bottom: 8px; }
.gc-import-bar { background: linear-gradient(90deg, var(--accent), #ff9800); height: 100%; transition: width 0.3s; border-radius: 8px; }
.gc-import-bar.done { background: linear-gradient(90deg, #4caf50, #66bb6a); }
.gc-import-text { font-size: 13px; color: var(--text-muted); }
.gc-import-presets .btn-sm { font-size: 12px; padding: 4px 10px; }

/* Pulse Tooltip for Invoice/Payment details */
.pulse-tooltip {
  position: fixed;
  z-index: 9999;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  min-width: 180px;
  max-width: 300px;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%) translateY(5px);
  transition: opacity 0.15s, transform 0.15s;
}
.pulse-tooltip.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.pulse-tooltip.above {
  transform: translateX(-50%) translateY(0);
}
.tooltip-header {
  font-weight: 600;
  font-size: 13px;
  color: var(--accent);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.tooltip-items {
  max-height: 300px;
  overflow-y: auto;
}
.tooltip-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--bg-secondary);
}
.tooltip-item:last-child {
  border-bottom: none;
}
.tooltip-amount {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.tooltip-product {
  color: var(--text-muted);
  font-size: 11px;
  margin-left: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}
.tooltip-loading, .tooltip-empty, .tooltip-error {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 8px;
}
.tooltip-error {
  color: var(--red);
}
/* Cursor for cells with details */
[data-details] {
  cursor: pointer;
}
[data-details]:hover {
  background: var(--bg-hover) !important;
}

/* Analytics Page */
.analytics-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: 10px;
}
.analytics-tabs {
  display: flex;
  gap: 4px;
}
.analytics-tab {
  padding: 8px 16px;
  border: none;
  background: var(--bg-primary);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}
.analytics-tab:hover { color: var(--text); }
.analytics-tab.active { background: var(--accent); color: #fff; }
.date-range-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}
.date-range-picker .date-picker-input {
  padding: 8px 36px 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text);
  font-size: 14px;
  min-width: 200px;
  cursor: pointer;
}
.date-range-picker .date-picker-input:hover {
  border-color: var(--primary);
}
.date-range-picker .date-picker-icon {
  position: absolute;
  right: 12px;
  color: var(--text-secondary);
  pointer-events: none;
}
/* Flatpickr dark theme overrides */
.flatpickr-calendar {
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
}
.flatpickr-day {
  color: var(--text) !important;
}
.flatpickr-day:hover {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
}
.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
}
.flatpickr-day.inRange {
  background: rgba(138, 43, 226, 0.3) !important;
  border-color: transparent !important;
}
.flatpickr-months .flatpickr-month {
  background: var(--bg-secondary) !important;
  color: var(--text) !important;
}
.flatpickr-current-month .flatpickr-monthDropdown-months {
  background: var(--bg-secondary) !important;
  color: var(--text) !important;
}
.flatpickr-weekdays {
  background: var(--bg-secondary) !important;
}
span.flatpickr-weekday {
  color: var(--text-secondary) !important;
}
.period-presets {
  display: flex;
  gap: 4px;
}
.analytics-section {
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  overflow: hidden;
}
.analytics-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.daily-chart {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.analytics-section h3 {
  margin-bottom: 16px;
  color: var(--accent);
}
.section-desc {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
}
/* Funnel Chart */
.funnel-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 0;
}
.funnel-stage {
  display: flex;
  justify-content: center;
}
.funnel-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-radius: 6px;
  color: #fff;
  font-weight: 500;
  min-width: 150px;
  transition: width 0.3s;
}
.funnel-label { font-size: 14px; }
.funnel-value { font-size: 13px; opacity: 0.9; }
.funnel-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}
/* Analytics Table */
.analytics-table {
  width: 100%;
  border-collapse: collapse;
}
.analytics-table th, .analytics-table td {
  padding: 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.analytics-table th {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}
.analytics-table th:first-child, .analytics-table td:first-child {
  text-align: left;
}
.manager-name-sm { font-weight: 500; }
.stage-count { display: block; font-size: 16px; font-weight: 600; }
.stage-pct { display: block; font-size: 11px; color: var(--text-muted); }
.total-cell { font-weight: 600; color: var(--accent); }
.conv-cell { font-weight: 600; color: var(--green, #66bb6a); }
.totals-row { background: var(--bg-primary); }
/* Funnel Settings */
.funnel-stages-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 20px;
}
.funnel-stage-config {
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 16px;
  border: 1px solid var(--border);
}
.stage-header {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}
.stage-color {
  width: 40px;
  height: 36px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.stage-name-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 14px;
}
.stage-statuses label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.status-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.status-checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  padding: 4px 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  cursor: pointer;
}
.status-checkbox input { cursor: pointer; }
.funnel-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.btn-icon {
  padding: 8px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: var(--bg-secondary);
  color: var(--text-muted);
}
.btn-icon:hover { color: var(--text); }
.btn-icon.btn-danger:hover { color: var(--red, #e53935); }

/* Paid/Free Filter */
.paid-filter {
  display: flex;
  gap: 4px;
  margin-left: auto;
}
.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg-primary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  transition: all 0.2s;
}
.filter-checkbox:hover { color: var(--text); }
.filter-checkbox.active {
  background: var(--accent);
  color: #fff;
}
.filter-checkbox input { display: none; }

/* Analytics Table Fix */
.analytics-table {
  table-layout: fixed;
}
.analytics-table th:first-child,
.analytics-table td:first-child {
  width: 180px;
  min-width: 150px;
}
.analytics-table th:nth-child(2),
.analytics-table td:nth-child(2) {
  width: 80px;
}
.analytics-table th:last-child,
.analytics-table td:last-child {
  width: 100px;
}

/* Analytics Table Better Layout */
.analytics-table {
  table-layout: auto;
  width: 100%;
}
.analytics-table th,
.analytics-table td {
  padding: 12px 8px;
  text-align: center;
  white-space: nowrap;
}
.analytics-table th:first-child,
.analytics-table td:first-child {
  text-align: left;
  width: 150px;
  min-width: 120px;
}
.analytics-table th:nth-child(2),
.analytics-table td:nth-child(2) {
  width: 70px;
}
.analytics-table th:last-child,
.analytics-table td:last-child {
  width: 90px;
}
.stage-count {
  display: block;
  font-size: 15px;
  font-weight: 600;
}
.stage-pct {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.7;
}

/* Analytics Table Border Fix */
.analytics-table {
  border-collapse: collapse !important;
  border-spacing: 0;
}
.analytics-table thead tr {
  border-bottom: 1px solid var(--border);
}
.analytics-table tbody tr {
  border-bottom: 1px solid var(--border);
}
.analytics-table tbody tr:last-child {
  border-bottom: none;
}
.analytics-table th,
.analytics-table td {
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  vertical-align: middle;
}
.analytics-table tfoot tr {
  border-top: 2px solid var(--border);
}
.analytics-table tfoot td {
  border-bottom: none !important;
}

/* Remove extra underline from manager name */
.analytics-table .manager-name-sm {
  text-decoration: none !important;
  border-bottom: none !important;
}
.analytics-table .manager-cell {
  border-bottom: none !important;
}
.analytics-table tbody tr td {
  border-bottom: 1px solid var(--border) !important;
}

/* Funnel Left-Aligned */
.funnel-stage-row {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 8px;
}
.funnel-bar-left {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 6px;
  color: #fff;
  font-weight: 500;
  min-width: 200px;
  transition: width 0.3s;
}
.funnel-bar-left .funnel-label {
  font-size: 14px;
}
.funnel-bar-left .funnel-value {
  font-size: 14px;
  font-weight: 600;
}

/* Profile Page */
.profile-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 24px;
  max-width: 600px;
}
.profile-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-info {
  min-width: 0;
  overflow: hidden;
}
.profile-info h3 {
  margin: 0 0 4px 0;
  font-size: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-info p {
  margin: 0;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-role {
  margin-top: 4px !important;
  font-size: 13px;
}
.profile-section {
  margin-bottom: 20px;
}
.profile-section h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--accent);
}
.avatar-upload {
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar-upload input[type="file"] {
  display: none;
}
.upload-hint {
  font-size: 12px;
  color: var(--text-muted);
}
.profile-stats {
  display: flex;
  gap: 24px;
}
.stat-item {
  text-align: center;
}
.stat-item .stat-value {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
}
.stat-item .stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* Profile nav item fix */
.nav-profile {
  white-space: nowrap;
  font-size: 13px;
}
.nav-profile span {
  white-space: nowrap;
}
.sidebar-footer {
  flex-shrink: 0;
}
.sidebar-footer .nav-item {
  padding: 8px 12px;
  font-size: 13px;
}

/* Footer row layout */
.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
}

/* Center sidebar footer */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 12px;
}
.sidebar-footer .nav-item {
  justify-content: center;
  width: 100%;
  margin-bottom: 8px;
}
.footer-row {
  justify-content: center;
  gap: 16px;
  width: 100%;
}

/* Single row footer */
.footer-row-single {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  width: 100%;
}
.footer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.footer-btn:hover {
  background: var(--accent);
  color: #fff;
}
.footer-name {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Profile Page Enhanced */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  max-width: 1000px;
}
.profile-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 24px;
}
.profile-card h4 {
  margin: 0 0 16px 0;
  font-size: 15px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 8px;
}
.profile-avatar-wrapper {
  position: relative;
  width: 80px;
  height: 80px;
}
.avatar-edit-btn {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: transform 0.2s;
}
.avatar-edit-btn:hover {
  transform: scale(1.1);
}
.profile-stats-bar {
  display: flex;
  gap: 16px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 24px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(99, 102, 241, 0.05));
  border-radius: 12px;
  border: 1px solid rgba(139, 92, 246, 0.2);
  min-width: 120px;
}
.stat-icon {
  font-size: 28px;
}
.stat-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
}
.stat-txt {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.profile-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.profile-form .form-group {
  margin-bottom: 0;
}
.profile-form .form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.profile-form .form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text);
  font-size: 14px;
}
.profile-form .form-group input:focus {
  border-color: var(--accent);
  outline: none;
}

/* Profile Tabs */
.profile-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 4px;
  max-width: 300px;
}
.profile-tab {
  flex: 1;
  padding: 8px 16px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  font-size: 13px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}
.profile-tab:hover { color: var(--text); }
.profile-tab.active {
  background: var(--accent);
  color: white;
}
.profile-tab-content { display: none; }
.profile-tab-content.active { display: block; }

/* Billing */
.billing-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 1000px;
}
@media (max-width: 600px) {
  .billing-top-row { grid-template-columns: 1fr; }
}
.billing-balance-card, .billing-sub-card {
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.billing-card-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.billing-card-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.btn-billing {
  width: 100%;
  margin-top: 16px;
}
.billing-balance-amount {
  font-size: 32px;
  font-weight: 700;
  color: var(--success);
  margin: 8px 0;
}
.billing-balance-amount.negative { color: var(--danger); }
.billing-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 8px;
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.status-dot.active { background: var(--success); }
.status-dot.trial { background: var(--warning, #f0ad4e); }
.status-dot.expired { background: var(--danger); }
.billing-detail {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-align: center;
}
.billing-calculation {
  background: var(--bg-primary);
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
}
.billing-calculation .calc-line {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.billing-calculation .calc-total {
  font-size: 18px;
  margin-bottom: 8px;
}
.billing-calculation .calc-balance {
  font-size: 13px;
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
}
.switch-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
}
.switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  transition: 0.3s;
  cursor: pointer;
}
.switch-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
}
.switch input:checked + .switch-slider {
  background: var(--accent);
}
.switch input:checked + .switch-slider::before {
  transform: translateX(20px);
}
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* Billing Transactions */
.billing-tx-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.billing-tx-item:last-child { border-bottom: none; }
.billing-tx-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.billing-tx-info {
  flex: 1;
  min-width: 0;
}
.billing-tx-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.billing-tx-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.billing-tx-right {
  text-align: right;
  flex-shrink: 0;
}
.billing-tx-amount {
  font-size: 15px;
  font-weight: 600;
}
.billing-tx-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Billing Filters */
.billing-filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.billing-filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.billing-filter-group label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.billing-filter-group input,
.billing-filter-group select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-primary);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.billing-filter-group input:focus,
.billing-filter-group select:focus {
  border-color: var(--accent);
}

/* Billing Pagination */
.billing-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.billing-pagination-info {
  font-size: 12px;
  color: var(--text-muted);
}
.billing-pagination-btns {
  display: flex;
  gap: 8px;
}

/* AI Assistants Page */
.ai-section {
  margin-bottom: 32px;
}
.ai-section h3 {
  margin-bottom: 16px;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-category {
  margin-bottom: 24px;
}
.ai-category h4 {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.ai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.ai-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 16px;
  border: 2px solid transparent;
  transition: all 0.2s;
}
.ai-card:hover {
  border-color: var(--accent);
}
.ai-card.connected {
  border-color: #22c55e;
}
.ai-card.disabled {
  opacity: 0.6;
  border-color: var(--text-muted);
}
.ai-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.ai-icon {
  font-size: 32px;
}
.ai-status {
  font-size: 16px;
}
.ai-card-body h4 {
  margin: 0 0 8px 0;
  font-size: 16px;
}
.ai-card-body p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}
.ai-card-footer {
  margin-top: 16px;
  display: flex;
  gap: 8px;
}
.ai-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-radius: 8px;
  grid-column: 1 / -1;
}
.ai-admin {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}
.btn-sm.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-sm.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-sm.btn-danger {
  background: #ef4444;
  color: #fff;
}
.btn-sm:hover {
  opacity: 0.8;
}
.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* AI Assistants - New Layout */
.ai-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  height: calc(100vh - 120px);
}
.ai-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ai-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-shrink: 0;
}
.ai-header h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  padding: 4px;
  border-radius: 8px;
}
.ai-tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}
.ai-tab:hover { background: var(--bg-primary); }
.ai-tab.active {
  background: var(--accent);
  color: #fff;
}
.ai-content {
  flex: 1;
  overflow-y: auto;
}
.ai-tab-content {
  display: none;
}
.ai-tab-content.active {
  display: block;
}

/* AI Cards */
.ai-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  padding-top: 4px;
}
.ai-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 16px;
  border: 2px solid transparent;
  transition: all 0.2s;
}
.ai-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.ai-card.connected {
  border-color: #22c55e;
}
.ai-card.connected:hover {
  border-color: #22c55e;
}
.ai-card-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}
.ai-card-icon {
  font-size: 32px;
}
.ai-card-type {
  font-size: 14px;
  opacity: 0.7;
}
.ai-card-body h4 {
  margin: 0 0 8px 0;
  font-size: 15px;
}
.ai-card-body p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ai-card-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
}
.btn-chat, .btn-connect, .btn-disconnect {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}
.btn-chat {
  background: var(--accent);
  color: #fff;
  flex: 1;
}
.btn-connect {
  background: #22c55e;
  color: #fff;
  flex: 1;
}
.btn-disconnect {
  background: var(--bg-primary);
  color: var(--text-muted);
}
.btn-chat:hover, .btn-connect:hover { opacity: 0.9; }
.btn-disconnect:hover { background: #ef4444; color: #fff; }

/* AI Sidebar (Dialogs) */
.ai-sidebar {
  background: var(--bg-secondary);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ai-sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.ai-sidebar-header h3 {
  margin: 0;
  font-size: 14px;
}
.ai-dialogs-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}
.dialog-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.2s;
}
.dialog-item:hover {
  background: var(--bg-primary);
}
.dialog-item.active {
  background: var(--accent);
  color: #fff;
}
.dialog-icon {
  font-size: 20px;
}
.dialog-info {
  flex: 1;
  min-width: 0;
}
.dialog-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dialog-assistant {
  font-size: 11px;
  opacity: 0.7;
}
.dialog-delete {
  opacity: 0;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 4px;
}
.dialog-item:hover .dialog-delete {
  opacity: 0.5;
}
.dialog-delete:hover {
  opacity: 1 !important;
  color: #ef4444;
}

/* Chat Modal */
.chat-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.chat-modal.hidden {
  display: none;
}
.chat-container {
  width: 600px;
  max-width: 90vw;
  height: 70vh;
  background: var(--bg-primary);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}
.chat-assistant-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-icon {
  font-size: 24px;
}
.chat-name {
  font-weight: 600;
}
.chat-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  font-size: 18px;
}
.chat-close:hover {
  color: var(--text);
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.chat-welcome {
  text-align: center;
  padding: 40px 20px;
}
.welcome-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 16px;
}
.chat-welcome h3 {
  margin: 0 0 8px 0;
}
.chat-welcome p {
  color: var(--text-muted);
  margin: 0;
}
.chat-message {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.chat-message.user {
  justify-content: flex-end;
}
.chat-message.user .msg-content {
  background: var(--accent);
  color: #fff;
}
.msg-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.msg-content {
  background: var(--bg-secondary);
  padding: 12px 16px;
  border-radius: 12px;
  max-width: 80%;
  line-height: 1.5;
  font-size: 14px;
}
.msg-content code {
  background: rgba(0,0,0,0.2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}
.typing-dots {
  animation: typing 1s infinite;
}
@keyframes typing {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
.chat-input-area {
  display: flex;
  gap: 10px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}
#chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-primary);
  color: var(--text);
  font-size: 14px;
  resize: none;
  font-family: inherit;
}
#chat-input:focus {
  outline: none;
  border-color: var(--accent);
}
.chat-send {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 16px;
  transition: transform 0.2s;
}
.chat-send:hover {
  transform: scale(1.05);
}

/* Create Options */
.create-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  max-width: 500px;
  padding-top: 6px; /* Space for hover lift effect */
}
.create-card {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}
.create-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
}
.create-icon {
  font-size: 40px;
  margin-bottom: 12px;
}
.create-card h4 {
  margin: 0 0 8px 0;
}
.create-card p {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* Settings */
.settings-form-inner {
  max-width: 400px;
}
.settings-form-inner h3 {
  margin-top: 0;
}
.hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Empty states */
.ai-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.ai-empty-small {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 13px;
}

/* Category */
.ai-category {
  margin-bottom: 24px;
}
.ai-category h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

@media (max-width: 768px) {
  .ai-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .ai-sidebar {
    max-height: 300px;
  }
}

/* Webhook URL Row */
.webhook-url-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.webhook-url-row input {
  flex: 1;
  font-size: 11px;
  font-family: monospace;
  padding: 10px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.webhook-url-row input:focus {
  outline: none;
  border-color: var(--accent);
  color: var(--text);
  overflow: auto;
}
.btn-copy {
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-copy:hover {
  opacity: 0.9;
}

/* Automation Page */
.automation-section {
  max-width: 1200px;
}
.automation-section .section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.automation-section .section-header h2 {
  margin: 0;
}
.settings-card {
  background: var(--bg-secondary);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.toggle-label {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* Toggle Switch - iOS style */
.switch-container {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  line-height: 24px;
}
.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  min-width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: rgba(120, 120, 128, 0.32);
  transition: background-color .25s ease;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  top: 2px;
  background-color: white;
  transition: transform .25s ease;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15), 0 1px 1px rgba(0,0,0,0.1);
}
.switch input:checked + .slider {
  background-color: #8b5cf6;
}
.switch input:checked + .slider:before {
  transform: translateX(18px);
}
/* Light theme toggle */
[data-theme="light"] .switch input:checked + .slider {
  background-color: #22c55e;
}
.managers-distribution-table {
  overflow-x: auto;
}
.managers-distribution-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.managers-distribution-table th,
.managers-distribution-table td {
  padding: 8px 6px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.managers-distribution-table th {
  background: var(--bg-tertiary);
  font-weight: 600;
  font-size: 12px;
}
.managers-distribution-table input[type="text"],
.managers-distribution-table select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-primary);
  color: var(--text);
  font-size: 12px;
}
.managers-distribution-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

/* Distribution Manager Cards */
.distribution-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dist-manager-card {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--border);
}
.dist-manager-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.dist-manager-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #9333ea);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: white;
  flex-shrink: 0;
}
.dist-manager-info {
  flex: 1;
}
.dist-manager-name {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 8px;
}
.dist-manager-fields {
  display: flex;
  gap: 12px;
}
.dist-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dist-field label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}
.dist-field input,
.dist-field select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text);
  font-size: 13px;
  width: 80px;
}
.btn-save {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-save:hover {
  opacity: 0.9;
  transform: scale(1.05);
}
.dist-schedule {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.dist-day {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-primary);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 12px;
  font-weight: 500;
}
.dist-day input {
  display: none;
}
.dist-day.active,
.dist-day:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.dist-day:hover {
  border-color: var(--accent);
}

/* Registration form styles */
.subdomain-input {
  display: flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.subdomain-input input {
  border: none !important;
  border-radius: 0 !important;
  flex: 1;
  background: transparent;
}
.subdomain-suffix {
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 14px;
  white-space: nowrap;
  background: var(--bg-tertiary);
}
.subdomain-status {
  font-size: 13px;
  min-height: 20px;
  margin-top: 4px;
}
.subdomain-status.available {
  color: var(--green);
}
.subdomain-status.unavailable {
  color: var(--red);
}
.subdomain-status.checking {
  color: var(--text-muted);
}
.register-step h3 {
  font-size: 16px;
  font-weight: 600;
}
.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.btn-secondary:hover {
  background: var(--bg-secondary);
}

/* Import Filters Section */
.import-filters-section .filter-block {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 16px 20px;
  border: 1px solid var(--border);
}
.import-filters-section .filter-block-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 14px;
  color: var(--text);
}
.import-filters-section .filter-block-header i {
  color: var(--accent);
  font-size: 16px;
}
.import-filters-section .filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.import-filters-section .filter-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 13px;
}
.import-filters-section .filter-chip:hover {
  border-color: var(--accent);
}
.import-filters-section .filter-chip.active {
  background: rgba(108, 92, 231, 0.2);
  border-color: var(--accent);
  color: var(--accent);
}
.import-filters-section .filter-chip input {
  display: none;
}
.import-filters-section .filter-reasons-input textarea {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  font-size: 13px;
  resize: vertical;
  font-family: inherit;
}
.import-filters-section .filter-reasons-input textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.import-filters-section .filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.import-filters-section .filter-tag {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-muted);
}

/* AI Assistants Edit Button */
.ai-card-actions .btn-edit {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.ai-card-actions .btn-edit:hover {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}
.btn-danger {
  background: var(--red) !important;
  color: white !important;
}
.btn-danger:hover {
  opacity: 0.9;
}

/* Catalog delete button */
.ai-card-actions .btn-delete {
  background: transparent;
  border: 1px solid var(--red);
  color: var(--red);
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.ai-card-actions .btn-delete:hover {
  background: var(--red);
  color: white;
}

/* Unified card height */
.ai-card {
  display: flex;
  flex-direction: column;
  min-height: 180px;
}
.ai-card .ai-card-body {
  flex: 1;
}
.ai-card .ai-card-actions {
  margin-top: auto;
}

/* Fix modal overflow */
.modal-form {
  overflow-x: hidden;
}
.modal-content {
  overflow-x: hidden;
  max-width: 100%;
}
.modal-form textarea {
  max-width: 100%;
  box-sizing: border-box;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
  transition: background 0.2s;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg-secondary);
}

/* Icon picker */
.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  max-height: 150px;
  overflow-y: auto;
}
.icon-picker-btn {
  width: 40px;
  height: 40px;
  font-size: 20px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--bg-secondary);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-picker-btn:hover {
  border-color: var(--blue);
  transform: scale(1.1);
}
.icon-picker-btn.selected {
  border-color: var(--green);
  background: rgba(46, 204, 113, 0.2);
}

/* Chat file attachment */
.chat-file-preview {
  padding: 8px 12px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border);
}
.chat-file-preview.hidden {
  display: none;
}
.file-attached {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  font-size: 13px;
}
.file-attached i:first-child {
  color: var(--blue);
}
.file-attached span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-attached button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}
.file-attached button:hover {
  color: var(--red);
}

/* Chat attach button */
.chat-attach {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  transition: all 0.15s;
  flex-shrink: 0;
}
.chat-attach:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--bg-primary);
}

/* Drag & drop */
.chat-content.drag-over {
  background: rgba(52, 152, 219, 0.1);
  border: 2px dashed var(--blue);
}
.chat-content.drag-over::after {
  content: '📎 Перетащите файл сюда';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  color: var(--blue);
  pointer-events: none;
}

/* Trial Banner */
#trial-banner .trial-btn {
  background: rgba(255,255,255,0.2);
  color: white;
  padding: 6px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  transition: background 0.2s;
}
#trial-banner .trial-btn:hover {
  background: rgba(255,255,255,0.3);
}
#trial-banner .trial-close {
  background: none;
  border: none;
  color: white;
  font-size: 18px;
  cursor: pointer;
  padding: 0 8px;
  opacity: 0.8;
}
#trial-banner .trial-close:hover {
  opacity: 1;
}

/* Knowledge Base Upload Section */
.kb-section { margin-bottom: 20px; }
.kb-box {
  background: var(--bg-tertiary);
  border-radius: 12px;
  padding: 16px;
}
.kb-upload-zone {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(168, 85, 247, 0.08) 100%);
  border: 2px dashed rgba(99, 102, 241, 0.3);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.kb-upload-zone:hover, .kb-upload-zone.dragover {
  border-color: var(--blue);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
}
.kb-upload-zone i {
  font-size: 24px;
  color: #a855f7;
}
.kb-upload-zone .upload-text {
  text-align: left;
}
.kb-upload-zone .upload-text span {
  display: block;
  color: var(--text-primary);
  font-size: 14px;
}
.kb-upload-zone .upload-text small {
  color: var(--text-muted);
  font-size: 12px;
}
.btn-link-danger {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  padding: 8px 0;
  font-size: 13px;
  margin-top: 12px;
}
.btn-link-danger:hover { text-decoration: underline; }

/* Toggle Switch */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.toggle-label input { display: none; }

/* Type Card Selector */
.type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.type-card:hover {
  border-color: var(--blue);
}
.type-card.selected {
  border-color: #a855f7;
  background: rgba(168, 85, 247, 0.1);
}
.type-card .type-icon {
  font-size: 28px;
  margin-bottom: 8px;
}
.type-card .type-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}
.type-card .type-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Count badge for pulse cells */
.count-badge {
  display: inline-block;
  background: var(--blue);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 8px;
  margin-right: 4px;
  vertical-align: middle;
}

/* Analytics stage sum */
.stage-sum {
  display: block;
  font-size: 11px;
  color: #22c55e;
  font-weight: 600;
}
.show-sum-checkbox {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  white-space: nowrap;
}
.show-sum-checkbox input {
  margin: 0;
}

/* Analytics change indicators */
.change-up {
  display: inline-block;
  font-size: 10px;
  color: #22c55e;
  margin-left: 4px;
}
.change-down {
  display: inline-block;
  font-size: 10px;
  color: #ef4444;
  margin-left: 4px;
}

/* Cancel reasons list */
.cancel-reasons-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 600px;
}
.cancel-reason-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border-radius: 8px;
  border-left: 3px solid #ef4444;
}
.reason-rank {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 20px;
}
.reason-text {
  flex: 1;
  font-size: 14px;
}
.reason-count {
  font-size: 14px;
  font-weight: 600;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  padding: 4px 10px;
  border-radius: 12px;
}

/* Daily chart */
.daily-chart {
  padding: 16px 0;
}
.chart-legend {
  display: flex;
  gap: 20px;
  margin-bottom: 12px;
  font-size: 13px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}
.legend-color.deals {
  background: #64b5f6;
}
.legend-color.completed {
  background: #66bb6a;
}
.chart-container {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 200px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.chart-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  cursor: pointer;
}
.chart-bars {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 170px;
}
.chart-bar {
  width: 16px;
  border-radius: 3px 3px 0 0;
  transition: opacity 0.2s;
  min-height: 2px;
}
.chart-bar.deals {
  background: #64b5f6;
}
.chart-bar.completed {
  background: #66bb6a;
}
.chart-bar-group:hover .chart-bar {
  opacity: 0.8;
}
.chart-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: nowrap;
}

/* Product filter dropdown */
.product-filter select {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13px;
  cursor: pointer;
  max-width: 200px;
}
.product-filter select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Product filter multi-select */
.product-filter,
.manager-filter {
  position: relative;
}
.product-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  z-index: 9999;
  min-width: 250px;
  max-height: 300px;
  overflow-y: auto;
}
.product-dropdown.hidden {
  display: none;
}
.product-dropdown-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.product-dropdown-header label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.product-list {
  padding: 8px 0;
}
.product-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
}
.product-item:hover {
  background: var(--bg-secondary);
}
#product-count-badge {
  font-size: 11px;
  color: var(--accent);
}

.product-dropdown-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  text-align: right;
}

/* Comparison arrows with tooltip */
.comp-arrow {
  display: inline;
  font-size: 18px;
  font-weight: bold;
  margin-left: 6px;
  cursor: help;
  vertical-align: middle;
}
.comp-arrow.comp-up {
  color: #22c55e;
}
.comp-arrow.comp-down {
  color: #ef4444;
}

/* Tooltip box */
#comp-tooltip-box {
  position: fixed;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  min-width: 220px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 10000;
  transform: translate(-50%, -100%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
  pointer-events: none;
}
#comp-tooltip-box.visible {
  opacity: 1;
  visibility: visible;
}
#comp-tooltip-box .comp-tooltip-title {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
#comp-tooltip-box .comp-tooltip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin: 6px 0;
}
#comp-tooltip-box .comp-tooltip-row span:first-child {
  color: var(--text-secondary);
  min-width: 60px;
}
#comp-tooltip-box .comp-tooltip-sub {
  color: var(--text-secondary);
  font-size: 12px;
}
#comp-tooltip-box .comp-tooltip-diff {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-weight: 700;
  font-size: 16px;
  text-align: center;
}
#comp-tooltip-box .comp-tooltip-diff.comp-up {
  color: #22c55e;
}
#comp-tooltip-box .comp-tooltip-diff.comp-down {
  color: #ef4444;
}

/* Link Telegram Modal */
.link-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.link-modal {
  background: var(--bg-primary);
  border-radius: 16px;
  padding: 24px 32px;
  max-width: 400px;
  text-align: center;
}
.link-modal h3 {
  margin: 0 0 16px;
  font-size: 20px;
}
.link-modal p {
  margin: 8px 0;
  color: var(--text-secondary);
}
.link-modal a {
  color: var(--accent);
}
.link-code-box {
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.link-code-box code {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
}
.link-code-box .btn-copy {
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  white-space: nowrap;
}
.link-code-box .btn-copy:hover {
  opacity: 0.9;
}
.link-hint {
  font-size: 13px;
  color: var(--text-muted) !important;
}

/* Cancel Reasons Pie Chart */
.cancel-reasons-container {
  display: flex;
  gap: 40px;
  align-items: center;
}
.cancel-reasons-container > .cancel-reasons-list {
  flex: 0 0 auto;
  min-width: 400px;
}
.cancel-pie-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cancel-pie-chart {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.pie-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 130px;
  height: 130px;
  background: var(--bg-primary);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.pie-center span {
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
}
.pie-center small {
  font-size: 14px;
  color: var(--text-muted);
}
.cancel-reasons-list {
  flex: 1;
}
.cancel-reason-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.cancel-reason-item:last-child {
  border-bottom: none;
}
.reason-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
.reason-rank {
  width: 24px;
  height: 24px;
  background: var(--bg-tertiary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
}
.reason-text {
  flex: 1;
  font-size: 14px;
}
.reason-count {
  font-weight: 600;
  color: var(--red);
  background: rgba(239, 68, 68, 0.15);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 13px;
}

.reason-pct {
  font-size: 13px;
  color: var(--text-muted);
  min-width: 40px;
  text-align: right;
}

/* Display settings grid */
.display-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.display-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.display-toggle:hover {
  background: var(--bg-tertiary);
}
.display-toggle input {
  width: 18px;
  height: 18px;
}
.display-toggle span {
  font-size: 14px;
}

/* ========== MOBILE RESPONSIVE ========== */

/* Mobile menu button */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1001;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 10px 12px;
  color: white;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Mobile overlay */
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
}
.mobile-overlay.active {
  display: block;
}

/* Tablet: < 1024px */
@media (max-width: 1024px) {
  .cancel-reasons-container {
    flex-direction: column;
  }
  .cancel-reasons-container > .cancel-reasons-list {
    min-width: 100%;
  }
  .cancel-pie-wrapper {
    margin-top: 20px;
  }
  .display-settings-grid {
    grid-template-columns: 1fr;
  }
  .analytics-filters {
    flex-wrap: wrap;
    gap: 8px;
  }
}

/* Mobile: < 768px */
@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block;
  }
  
  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    bottom: 0;
    width: 260px;
    z-index: 1000;
    transition: left 0.3s ease;
  }
  .sidebar.open {
    left: 0;
  }
  
  .app-layout {
    grid-template-columns: 1fr;
  }
  
  .content {
    padding: 60px 12px 20px;
  }
  
  .page-title h2 {
    font-size: 20px;
  }
  
  /* Auth */
  .auth-card {
    width: 95%;
    padding: 24px;
    margin: 20px;
  }
  
  /* Tables - horizontal scroll */
  .analytics-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .analytics-table {
    min-width: 600px;
  }
  
  /* Filters */
  .analytics-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .analytics-tabs {
    width: 100%;
    justify-content: center;
  }
  .filter-row {
    flex-wrap: wrap;
  }
  
  /* Cards grid */
  .managers-grid,
  .gifts-grid,
  .ai-cards-grid {
    grid-template-columns: 1fr;
  }
  
  /* Dashboard pulse grid */
  .pulse-grid {
    grid-template-columns: 1fr;
  }
  
  /* Forms */
  .form-row {
    flex-direction: column;
  }
  .form-row .form-group {
    width: 100%;
  }
  
  /* Modal */
  .modal {
    width: 95%;
    max-width: none;
    margin: 10px;
    max-height: 90vh;
    overflow-y: auto;
  }
  
  /* Project selector */
  .content-header {
    padding: 0 0 12px;
  }
  .project-selector {
    flex-direction: column;
    gap: 8px;
  }
  .project-selector select {
    width: 100%;
  }
  
  /* Funnel chart */
  .funnel-chart {
    padding: 12px;
  }
  .funnel-bar-label {
    font-size: 12px;
  }
  
  /* Daily chart */
  .daily-chart {
    overflow-x: auto;
  }
  
  /* Settings sections */
  .settings-section {
    padding: 16px;
  }
  
  /* Gamification */
  .leaderboard-item {
    padding: 12px;
  }
  
  /* AI Assistants */
  .ai-layout {
    grid-template-columns: 1fr;
    height: auto;
  }
  .ai-sidebar {
    max-height: 250px;
    order: -1;
  }
  .chat-area {
    height: 60vh;
  }
  .ai-grid {
    grid-template-columns: 1fr;
  }
  .ai-tabs {
    flex-wrap: wrap;
  }
  .create-options {
    grid-template-columns: 1fr;
  }
  
  /* KB */
  .kb-layout {
    flex-direction: column;
  }
  .kb-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  
  /* Automation */
  .distribution-managers {
    grid-template-columns: 1fr;
  }
}

/* Small mobile: < 480px */
@media (max-width: 480px) {
  .content {
    padding: 56px 8px 16px;
  }
  
  .analytics-tabs button {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  .btn-primary, .btn-secondary, .btn-outline {
    padding: 10px 16px;
    font-size: 14px;
  }
  
  .cancel-pie-chart {
    width: 180px;
    height: 180px;
  }
  .pie-center {
    width: 100px;
    height: 100px;
  }
  .pie-center span {
    font-size: 24px;
  }
  
  /* Stats cards */
  .stat-card {
    padding: 12px;
  }
  .stat-value {
    font-size: 24px;
  }
}

/* Admin Error Logs */
.error-badge {
  background: var(--red);
  color: white;
  border-radius: 10px;
  padding: 2px 8px;
  font-size: 12px;
  margin-left: 6px;
}
.error-item {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  border-left: 4px solid var(--border);
}
.error-item.unread {
  border-left-color: var(--red);
  background: rgba(255,107,107,0.1);
}
.error-header {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.error-type {
  font-weight: 600;
  font-size: 14px;
}
.error-project {
  color: var(--accent);
  font-size: 13px;
}
.error-time {
  color: var(--text-muted);
  font-size: 12px;
  margin-left: auto;
}
.error-message {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 12px;
  word-break: break-word;
}
.error-actions {
  display: flex;
  gap: 8px;
}

/* Onboarding Wizard */
.onboarding-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}
.onboarding-modal {
  background: var(--bg-card);
  border-radius: 16px;
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.onboarding-header {
  padding: 24px;
  border-bottom: 1px solid var(--border);
}
.onboarding-header h2 {
  margin-bottom: 16px;
  font-size: 22px;
}
.onboarding-progress {
  display: flex;
  align-items: center;
  gap: 12px;
}
.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.3s ease;
}
.onboarding-progress span {
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
}
.onboarding-content {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
.onboarding-step {
  text-align: center;
}
.step-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.onboarding-step h3 {
  font-size: 20px;
  margin-bottom: 8px;
}
.onboarding-step p {
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.setup-list {
  text-align: left;
  list-style: none;
  padding: 0;
  margin: 0 auto;
  max-width: 320px;
}
.setup-list li {
  padding: 8px 0;
  color: var(--text-secondary);
}
.onboarding-form {
  text-align: left;
  max-width: 400px;
  margin: 0 auto;
}
.onboarding-form .form-group {
  margin-bottom: 16px;
}
.onboarding-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
}
.onboarding-form input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
}
.onboarding-form small {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 12px;
}
.onboarding-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 20px;
}
.option-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 24px 20px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.option-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
.option-card .option-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}
.option-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
}
.option-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  color: var(--text-muted);
}
.finish-summary {
  text-align: left;
  max-width: 300px;
  margin: 20px auto;
}
.summary-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-bottom: 8px;
}
.summary-item.done {
  background: rgba(0,214,143,0.1);
}
.summary-icon {
  font-size: 20px;
}
.finish-action {
  margin-top: 20px;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  justify-content: center;
}
.checkbox-label input {
  width: 18px;
  height: 18px;
}
.onboarding-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.onboarding-footer-right {
  display: flex;
  gap: 12px;
  align-items: center;
}
.btn-text {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
}
.btn-text:hover {
  color: var(--text-primary);
}

@media (max-width: 480px) {
  .onboarding-modal {
    max-height: 95vh;
  }
  .onboarding-options {
    grid-template-columns: 1fr;
  }
  .onboarding-header, .onboarding-content, .onboarding-footer {
    padding: 16px;
  }
}

/* =========================
   CALLS ANALYTICS (Speech)
   ========================= */

.calls-analytics {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.calls-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.summary-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 20px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.summary-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.summary-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.summary-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: -4px;
}

.best-hour-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(59, 130, 246, 0.1));
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
}

.best-hour-icon {
  font-size: 24px;
}

.best-hour-text {
  font-size: 15px;
  color: var(--text);
}

.best-hour-stats {
  color: var(--accent);
  font-weight: 600;
}

.calls-section {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border);
}

.calls-section h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
}

.calls-table {
  width: 100%;
  border-collapse: collapse;
}

.calls-table th,
.calls-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.calls-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 13px;
}

.calls-table td {
  font-size: 14px;
}

.conversion-badge {
  background: var(--accent);
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

/* Hourly Chart */
.hourly-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 180px;
  padding: 40px 0 20px 0;
  margin-top: 10px;
}

.hourly-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  height: 100%;
}

.hourly-bar .bar-fill {
  width: 100%;
  max-width: 40px;
  background: var(--accent);
  border-radius: 6px 6px 0 0;
  transition: height 0.3s ease;
  position: absolute;
  bottom: 40px;
}

.hourly-bar.best .bar-fill {
  background: linear-gradient(180deg, #22c55e, #16a34a);
}

.hourly-bar .bar-value {
  position: absolute;
  bottom: 45px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  transform: translateY(-100%);
}

.hourly-bar .bar-label {
  position: absolute;
  bottom: 0;
  font-size: 11px;
  color: var(--text-muted);
}

.hourly-bar .bar-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 10;
}

.hourly-bar:hover .bar-tooltip {
  display: block;
}

/* Heatmap */
.heatmap-container {
  overflow-x: auto;
}

.heatmap-header {
  display: flex;
  gap: 2px;
  margin-bottom: 2px;
}

.heatmap-corner {
  width: 40px;
  flex-shrink: 0;
}

.heatmap-hour {
  flex: 1;
  min-width: 40px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 0;
}

.heatmap-row {
  display: flex;
  gap: 2px;
  margin-bottom: 2px;
}

.heatmap-day {
  width: 40px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
}

.heatmap-cell {
  flex: 1;
  min-width: 40px;
  height: 36px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  cursor: default;
  transition: transform 0.1s;
}

.heatmap-cell:hover {
  transform: scale(1.05);
}

.heatmap-cell.empty {
  background: var(--bg-tertiary);
  color: transparent;
}

.heatmap-cell.low {
  background: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.heatmap-cell.medium {
  background: rgba(251, 191, 36, 0.3);
  color: #f59e0b;
}

.heatmap-cell.high {
  background: rgba(34, 197, 94, 0.3);
  color: #22c55e;
}

/* Daily Chart */
.daily-chart-calls {
  padding: 10px 0;
}

.chart-legend {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.legend-color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-color.dials {
  background: var(--accent);
}

.legend-color.conversations {
  background: #22c55e;
}

.chart-bars {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  height: 150px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.daily-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 40px;
}

.daily-bars {
  display: flex;
  gap: 2px;
  align-items: flex-end;
  height: 120px;
}

.daily-bar {
  width: 14px;
  border-radius: 3px 3px 0 0;
  transition: height 0.3s ease;
}

.daily-bar.dials {
  background: var(--accent);
}

.daily-bar.conversations {
  background: #22c55e;
}

.daily-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 6px;
}

.no-data {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

/* Light theme adjustments */
[data-theme="light"] .heatmap-cell.low {
  background: rgba(239, 68, 68, 0.2);
}
[data-theme="light"] .heatmap-cell.medium {
  background: rgba(251, 191, 36, 0.2);
}
[data-theme="light"] .heatmap-cell.high {
  background: rgba(34, 197, 94, 0.2);
}

@media (max-width: 768px) {
  .calls-summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .hourly-chart {
    overflow-x: auto;
    min-width: 600px;
  }
  .calls-section {
    overflow-x: auto;
  }
}

/* Calls Direction Filter */
.calls-direction-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.calls-direction-filter label {
  padding: 8px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}

.calls-direction-filter label:hover {
  border-color: var(--accent);
}

.calls-direction-filter label.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Light theme fixes for analytics */
[data-theme="light"] .summary-icon {
  background: linear-gradient(135deg, #f97316, #fb923c);
  color: #fff;
}

[data-theme="light"] .summary-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

[data-theme="light"] .best-hour-card {
  background: linear-gradient(135deg, #fef3c7, #fef9c3);
  border: 1px solid #fbbf24;
}

[data-theme="light"] .best-hour-text {
  color: #78350f;
}

[data-theme="light"] .best-hour-stats {
  color: #d97706;
}

[data-theme="light"] .period-btn {
  color: #6b7280;
  border: 1px solid transparent;
}

[data-theme="light"] .period-btn:hover {
  background: #f3f4f6;
}

[data-theme="light"] .period-btn.active {
  background: #f97316;
  color: #fff;
}

[data-theme="light"] .calls-direction-filter label {
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #374151;
}

[data-theme="light"] .calls-direction-filter label:hover {
  border-color: #f97316;
}

[data-theme="light"] .calls-direction-filter label.active {
  background: #f97316;
  color: #fff;
}

/* Light theme flatpickr */
[data-theme="light"] .flatpickr-calendar {
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

[data-theme="light"] .flatpickr-day {
  color: #374151;
}

[data-theme="light"] .flatpickr-day:hover {
  background: #f3f4f6;
}

[data-theme="light"] .flatpickr-day.selected,
[data-theme="light"] .flatpickr-day.startRange,
[data-theme="light"] .flatpickr-day.endRange {
  background: #f97316;
  border-color: #f97316;
}

[data-theme="light"] .flatpickr-day.inRange {
  background: #fed7aa;
  border-color: #fed7aa;
}

[data-theme="light"] .flatpickr-months .flatpickr-month,
[data-theme="light"] .flatpickr-current-month .flatpickr-monthDropdown-months,
[data-theme="light"] .flatpickr-weekdays,
[data-theme="light"] span.flatpickr-weekday {
  background: #fff;
  color: #374151;
}

[data-theme="light"] .flatpickr-current-month input.cur-year,
[data-theme="light"] .flatpickr-current-month .numInputWrapper {
  color: #374151;
}

[data-theme="light"] .flatpickr-prev-month,
[data-theme="light"] .flatpickr-next-month {
  fill: #6b7280;
}

[data-theme="light"] .flatpickr-prev-month:hover,
[data-theme="light"] .flatpickr-next-month:hover {
  fill: #f97316;
}

/* Light theme flatpickr - stronger selectors */
[data-theme="light"] .flatpickr-day.selected,
[data-theme="light"] .flatpickr-day.startRange,
[data-theme="light"] .flatpickr-day.endRange,
[data-theme="light"] .flatpickr-day.selected:hover,
[data-theme="light"] .flatpickr-day.startRange:hover,
[data-theme="light"] .flatpickr-day.endRange:hover {
  background: #f97316 !important;
  border-color: #f97316 !important;
  color: #fff !important;
}

[data-theme="light"] .flatpickr-day.inRange,
[data-theme="light"] .flatpickr-day.inRange:hover {
  background: #ffedd5 !important;
  border-color: #ffedd5 !important;
  color: #9a3412 !important;
  box-shadow: none !important;
}

[data-theme="light"] .flatpickr-day.today {
  border-color: #f97316 !important;
}

[data-theme="light"] .flatpickr-day.today:hover {
  background: #fff7ed !important;
}

/* Light theme flatpickr month navigation arrows */
[data-theme="light"] .flatpickr-months .flatpickr-prev-month,
[data-theme="light"] .flatpickr-months .flatpickr-next-month {
  fill: #374151 !important;
  color: #374151 !important;
}

[data-theme="light"] .flatpickr-months .flatpickr-prev-month:hover,
[data-theme="light"] .flatpickr-months .flatpickr-next-month:hover {
  fill: #f97316 !important;
  color: #f97316 !important;
}

[data-theme="light"] .flatpickr-months .flatpickr-prev-month svg,
[data-theme="light"] .flatpickr-months .flatpickr-next-month svg {
  fill: #374151 !important;
}

[data-theme="light"] .flatpickr-months .flatpickr-prev-month:hover svg,
[data-theme="light"] .flatpickr-months .flatpickr-next-month:hover svg {
  fill: #f97316 !important;
}
