/* Core Design System Variables - Default White / Clean Light Theme */
:root {
  --primary-blue: #2563eb;
  --primary-blue-hover: #1d4ed8;
  --primary-green: #10b981;
  --primary-red: #ef4444;
  --primary-yellow: #f59e0b;
  --primary-purple: #8b5cf6;
  --bg-color: #ffffff;
  --card-bg: #ffffff;
  --body-backdrop: #f1f5f9;
  --text-dark: #0f172a;
  --text-grey: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Dark Mode Theme Variables */
[data-theme="dark"],
body.dark-theme {
  --primary-blue: #3b82f6;
  --primary-blue-hover: #60a5fa;
  --primary-green: #10b981;
  --primary-red: #ef4444;
  --primary-yellow: #f59e0b;
  --primary-purple: #a855f7;
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --body-backdrop: #030712;
  --text-dark: #f8fafc;
  --text-grey: #94a3b8;
  --border-color: #334155;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.6);
}

/* Reset and Globals - Compact Mobile Zero-Overflow */
*, *::before, *::after {
  box-sizing: border-box !important;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  max-width: 100vw !important;
  overflow-x: hidden !important;
  background-color: var(--body-backdrop);
  color: var(--text-dark);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0;
  padding: 0;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.app-container {
  max-width: 480px;
  width: 100%;
  height: 100%;
  max-height: 960px;
  background-color: var(--bg-color);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow-x: hidden !important;
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: 960px;
  background-color: var(--bg-color);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (max-width: 480px) {
  .app-container {
    max-width: 100%;
    max-height: 100%;
    height: 100vh;
    box-shadow: none;
  }
}

/* App Header */
.app-header {
  height: 56px;
  background-color: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 10;
}

.app-header h2 {
  font-size: 18px;
  font-weight: 600;
  transition: color 0.3s ease;
}

/* Title colors dynamically based on active tab */
.theme-dialer .app-header h2 { color: var(--primary-blue); }
.theme-calls .app-header h2 { color: var(--primary-yellow); }
.theme-add-lead .app-header h2 { color: var(--primary-green); }
.theme-leads .app-header h2 { color: var(--primary-blue); }
.theme-tasks .app-header h2 { color: var(--primary-red); }
.theme-login .app-header h2 { color: var(--primary-blue); }
.theme-setup .app-header h2 { color: var(--primary-blue); }
.theme-auto-sms .app-header h2 { color: var(--primary-blue); }
.theme-salary .app-header h2 { color: var(--primary-green); }
.theme-attendance .app-header h2 { color: var(--primary-purple); }
.theme-invoice .app-header h2 { color: var(--primary-blue); }
.theme-focus .app-header h2 { color: var(--primary-red); }

.icon-btn {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn svg {
  width: 24px;
  height: 24px;
}

.header-actions {
  display: flex;
  gap: 8px;
}

/* Main Scrollable Content Container */
.app-main {
  flex: 1;
  overflow-y: auto;
  position: relative;
  padding: 16px;
  padding-bottom: 80px; /* Safe padding for bottom nav */
}

/* Dynamic Views */
.view-section {
  display: none;
  height: 100%;
  animation: fadeIn 0.2s ease-in-out;
}

.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Bottom Navigation Bar */
.app-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 64px;
  background-color: var(--card-bg);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 10;
}

.nav-tab-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 100%;
  cursor: pointer;
  color: var(--text-grey);
  transition: all 0.2s ease;
}

.nav-tab-btn svg {
  width: 22px;
  height: 22px;
  fill: var(--text-grey);
  padding: 4px;
  border-radius: 20px;
  transition: all 0.2s ease;
}

.nav-tab-btn span {
  font-size: 10px;
  font-weight: 500;
  margin-top: 2px;
}

/* Bottom Nav highlight colors based on active state */
.nav-tab-btn.active {
  font-weight: bold;
}

.theme-dialer .nav-tab-btn[data-view="dialer"] { color: var(--primary-blue); }
.theme-dialer .nav-tab-btn[data-view="dialer"] svg { fill: var(--primary-blue); background-color: #ebf5fb; }

.theme-calls .nav-tab-btn[data-view="calls"] { color: var(--primary-yellow); }
.theme-calls .nav-tab-btn[data-view="calls"] svg { fill: var(--primary-yellow); background-color: #fef9e7; }

.theme-add-lead .nav-tab-btn[data-view="add-lead"] { color: var(--primary-green); }
.theme-add-lead .nav-tab-btn[data-view="add-lead"] svg { fill: var(--primary-green); background-color: #e8f8f5; }

.theme-leads .nav-tab-btn[data-view="leads"] { color: var(--primary-blue); }
.theme-leads .nav-tab-btn[data-view="leads"] svg { fill: var(--primary-blue); background-color: #ebf5fb; }

.theme-tasks .nav-tab-btn[data-view="tasks"] { color: var(--primary-red); }
.theme-tasks .nav-tab-btn[data-view="tasks"] svg { fill: var(--primary-red); background-color: #fdebd0; }


/* Sidebar/Drawer Navigation */
.sidebar-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar {
  position: absolute;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background-color: var(--card-bg);
  z-index: 101;
  box-shadow: 5px 0 15px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  transition: left 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
}

.sidebar.open {
  left: 0;
}

.sidebar-header {
  padding: 24px 16px;
  background-color: #f8f9fa;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--primary-blue);
}

.sidebar-title-group h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-dark);
}

.sidebar-title-group .user-role {
  font-size: 11px;
  color: var(--text-grey);
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  text-decoration: none;
  color: var(--text-dark);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s ease;
}

.menu-item:hover, .menu-item.active {
  background-color: #f1f3f6;
}

.menu-icon {
  width: 20px;
  height: 20px;
}

.logout-btn {
  border-top: 1px solid var(--border-color);
  margin-top: 10px;
}


/* Reusable Search Container */
.search-container {
  position: relative;
  width: 100%;
  margin-bottom: 12px;
}

.search-container input {
  width: 100%;
  height: 44px;
  padding: 0 16px 0 44px;
  border: 1px solid var(--border-color);
  border-radius: 22px;
  font-size: 14px;
  outline: none;
  background-color: var(--card-bg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
}

.search-container input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 4px 6px rgba(52, 152, 219, 0.1);
}

.search-icon {
  position: absolute;
  top: 10px;
  left: 14px;
  width: 24px;
  height: 24px;
}


/* Dialer View Styles */
.dialer-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 24px 8px;
}

.dialer-hint {
  font-size: 13px;
  color: var(--text-grey);
  margin-bottom: 8px;
}

.dialer-screen {
  width: 100%;
  display: flex;
  align-items: center;
  position: relative;
  margin-bottom: 24px;
}

.dialer-screen input {
  width: 100%;
  border: none;
  background: none;
  font-size: 32px;
  font-weight: 500;
  text-align: center;
  color: var(--text-dark);
  outline: none;
  padding-right: 48px;
}

.backspace-btn {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  cursor: pointer;
  display: none; /* Shown dynamically when text is present */
}

.backspace-btn svg {
  width: 28px;
  height: 28px;
}

.dialer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px 30px;
  width: 100%;
  max-width: 320px;
  margin-bottom: 30px;
}

.dial-key {
  height: 64px;
  border: none;
  background-color: var(--card-bg);
  border-radius: 12px;
  font-size: 24px;
  font-weight: 500;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  transition: background 0.15s ease, transform 0.1s ease;
}

.dial-key:active {
  background-color: #eef2f7;
  transform: scale(0.95);
}

.dialer-actions {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  max-width: 280px;
}

.dialer-action-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: #f1f3f6;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.dialer-action-btn svg {
  width: 22px;
  height: 22px;
}

.call-btn-main {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background-color: var(--primary-green);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(46, 204, 113, 0.4);
  transition: transform 0.2s ease;
}

.call-btn-main:active {
  transform: scale(0.92);
}

.call-btn-main svg {
  width: 32px;
  height: 32px;
}


/* Calls View Styles */
.stats-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  width: 100%;
}

.stat-card {
  flex: 1;
  padding: 8px 4px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--card-bg);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.stat-card.tot { background: linear-gradient(135deg, #3498db, #2980b9); }
.stat-card.in { background: linear-gradient(135deg, #2ecc71, #27ae60); }
.stat-card.out { background: linear-gradient(135deg, #3498db, #2980b9); }
.stat-card.mis { background: linear-gradient(135deg, #e74c3c, #c0392b); }

.stat-num {
  font-size: 16px;
  font-weight: 700;
}

.stat-label {
  font-size: 10px;
  opacity: 0.9;
}

.stat-card-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-action-btn {
  background-color: var(--card-bg);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid var(--border-color);
}

.stat-action-btn svg {
  width: 16px;
  height: 16px;
}

.period-btn {
  width: 100%;
  height: 38px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 16px;
  cursor: pointer;
}

.period-btn svg {
  width: 18px;
  height: 18px;
}


/* List Styles (Calls & Leads) */
.calls-list, .leads-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.call-item, .lead-item {
  background-color: var(--card-bg);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
  border: 1px solid var(--border-color);
}

.call-header, .lead-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.contact-name-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.contact-index {
  font-size: 12px;
  color: var(--text-grey);
}

.arrow-icon {
  width: 12px;
  height: 12px;
}

.contact-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
}

.direction-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-grey);
}

.phone-num {
  font-size: 13px;
  color: var(--text-grey);
  margin-bottom: 10px;
}

.datetime-stamp {
  font-size: 11px;
  color: var(--text-grey);
}

/* Call Item actions row */
.action-buttons-row {
  display: flex;
  gap: 8px;
  border-top: 1px dashed var(--border-color);
  padding-top: 10px;
  margin-top: 8px;
}

.item-action-btn {
  flex: 1;
  height: 32px;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.item-action-btn:hover {
  background-color: #edf2f7;
}

.item-action-btn svg {
  width: 14px;
  height: 14px;
}


/* Leads View Styles */
.filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.filter-btn {
  flex: 1;
  height: 38px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.filter-btn svg {
  width: 18px;
  height: 18px;
}

.lead-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lead-id {
  font-size: 12px;
  font-weight: bold;
  color: var(--text-dark);
}

.lead-badge-square {
  background-color: #f1f3f6;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: bold;
  color: var(--text-grey);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 8px;
}

.status-badge.interested {
  background-color: #d4efdf;
  color: #196f3d;
}

.status-badge.no-answer {
  background-color: #ebf5fb;
  color: #1f618d;
}

.status-badge.not-interested {
  background-color: #fadbd8;
  color: #78281f;
}

.status-badge svg {
  width: 10px;
  height: 10px;
}

.action-icons-grid {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  border-top: 1px dashed var(--border-color);
  padding-top: 10px;
  margin-top: 8px;
}

.icon-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-action-btn svg {
  width: 14px;
  height: 14px;
}


/* Add Lead Form Styles */
.form-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.form-card-field {
  background-color: var(--card-bg);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.01);
}

.field-icon {
  width: 24px;
  height: 24px;
  opacity: 0.8;
}

.field-input-group {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.field-input-group label {
  font-size: 10px;
  color: var(--text-grey);
  font-weight: 600;
  margin-bottom: 2px;
  text-transform: uppercase;
}

.field-input-group input, .field-input-group select {
  border: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
  outline: none;
  background: none;
  width: 100%;
}

.submit-lead-btn {
  width: 100%;
  height: 48px;
  background-color: #b2bec3; /* Default greyed submit state */
  color: var(--card-bg);
  border: none;
  border-radius: 24px;
  font-size: 15px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.add-lead-valid .submit-lead-btn {
  background-color: var(--primary-green);
  box-shadow: 0 4px 8px rgba(46, 204, 113, 0.3);
}

.submit-lead-btn svg {
  width: 20px;
  height: 20px;
}


/* Tasks View Styles */
.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 180px;
  color: var(--text-grey);
  font-size: 14px;
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-item {
  background-color: var(--card-bg);
  border-radius: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
  transition: opacity 0.2s ease;
}

.task-item.completed {
  opacity: 0.6;
}

.task-item.completed .task-title {
  text-decoration: line-through;
  color: var(--text-grey);
}

.task-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.task-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid var(--primary-red);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.task-checkbox.checked {
  background-color: var(--primary-red);
}

.task-checkbox.checked::after {
  content: "✓";
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.task-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
}

.task-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
}

.task-delete-btn svg {
  width: 18px;
  height: 18px;
}

/* Floating Action Button (FAB) */
.fab-btn {
  position: absolute;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  background-color: var(--primary-blue);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(52, 152, 219, 0.4);
  cursor: pointer;
  z-index: 5;
  transition: transform 0.2s ease;
}

.fab-btn:active {
  transform: scale(0.92);
}

.fab-btn svg {
  width: 24px;
  height: 24px;
}


/* Modal dialog styling */
.modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.open {
  display: flex;
}

.modal-content {
  background-color: var(--card-bg);
  padding: 20px;
  border-radius: 16px;
  width: 85%;
  max-width: 360px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  animation: modalScale 0.25s cubic-bezier(0.1, 0.9, 0.2, 1);
}

@keyframes modalScale {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-content h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-dark);
}

.modal-content input, .modal-content textarea {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.modal-btn {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
}

.cancel-btn {
  background-color: #f1f3f6;
  color: var(--text-grey);
}

.confirm-btn {
  background-color: var(--primary-blue);
  color: white;
}


/* Toast Notification */
.toast {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(50px);
  background-color: #2d3436;
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.1, 0.9, 0.2, 1);
  z-index: 2000;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Premium Filter Select boxes */
.filter-select {
  flex: 1;
  height: 38px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%237f8c8d'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 18px;
  padding-right: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  transition: all 0.15s ease;
}

.filter-select:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.15);
}

/* Custom switch checkbox */
.custom-switch {
  appearance: none;
  -webkit-appearance: none;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background-color: #d1d8e0;
  position: relative;
  outline: none;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.custom-switch:checked {
  background-color: var(--primary-green);
}

.custom-switch::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 10px;
  background-color: white;
  top: 2px;
  left: 2px;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.custom-switch:checked::after {
  transform: translateX(20px);
}

/* Login Panel styling */
#view-login {
  padding: 24px;
  background: linear-gradient(135deg, var(--card-bg) 0%, var(--bg-color) 100%);
  display: none;
  flex-direction: column;
  justify-content: center;
}

.login-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.login-logo-area {
  text-align: center;
  margin-bottom: 40px;
}

.logo-txt {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--primary-blue);
  display: block;
  text-shadow: 0 4px 10px rgba(52, 152, 219, 0.15);
}

.logo-sub {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--text-grey);
  text-transform: uppercase;
}

.login-tabs {
  display: flex;
  background-color: rgba(0,0,0,0.03);
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 24px;
}

.login-tab {
  flex: 1;
  height: 36px;
  border: none;
  background: none;
  font-size: 12px;
  font-weight: bold;
  color: var(--text-grey);
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.login-tab.active {
  background-color: var(--card-bg);
  color: var(--primary-blue);
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

.login-form-box {
  display: none;
}

.login-form-box.active {
  display: block;
}

.login-btn-submit {
  width: 100%;
  height: 48px;
  background-color: var(--primary-blue);
  color: white;
  border: none;
  border-radius: 24px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.25);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-btn-submit:active {
  transform: scale(0.97);
}

/* History Row cards */
.history-row-item {
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  color: var(--text-dark);
}

.history-sub {
  font-size: 11px;
  color: var(--text-grey);
}

/* Hide header and footer navigation when on login screen */
.app-container.theme-login .app-header,
.app-container.theme-login .app-nav {
  display: none !important;
}

.app-container.theme-login .app-main {
  height: 100vh !important;
  margin-top: 0 !important;
  padding-bottom: 0 !important;
}

#view-login.active {
  display: flex !important;
  height: 100%;
}

/* Lightbox overlay styling */
.login-lightbox {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  padding: 20px;
}

.login-lightbox.open {
  display: flex !important;
}

.login-modal-card {
  width: 100%;
  max-width: 400px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 32px 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: modalFadeIn 0.3s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
  color: var(--text-dark);
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.login-instructions {
  font-size: 13.5px;
  color: var(--text-grey);
  margin-top: 12px;
  margin-bottom: 24px;
  line-height: 1.5;
  text-align: center;
}

.login-email-highlight {
  color: var(--primary-blue);
  font-weight: 700;
  font-size: 15px;
  display: inline-block;
  margin-top: 6px;
}

.form-card-field {
  display: flex;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 10px 14px;
  gap: 12px;
  transition: all 0.2s ease;
}

.form-card-field:focus-within {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
  background-color: var(--card-bg);
}

.field-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.field-input-group {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.field-input-group label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-grey);
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.login-resend-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-blue);
  text-decoration: none;
  transition: opacity 0.2s;
  display: inline-block;
  margin-top: 10px;
}

.login-resend-link:hover {
  opacity: 0.8;
}

/* Header Actions & Universal Home Navigation */
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-home-pill {
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 20px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.header-home-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
}

.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s ease;
  color: var(--text-dark);
}

.theme-toggle-btn:hover {
  background-color: var(--border-color);
  transform: scale(1.05);
}

/* Sidebar Custom Enhancements */
.sidebar-home-link {
  background: rgba(37, 99, 235, 0.08);
  border-radius: 8px;
  margin: 4px 12px 10px 12px !important;
  color: var(--primary-blue) !important;
  font-weight: 700 !important;
  border-left: 4px solid var(--primary-blue) !important;
}

.sidebar-theme-item {
  margin: 8px 12px !important;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.03);
  font-weight: 600;
  cursor: pointer;
}

[data-theme="dark"] .sidebar-theme-item,
body.dark-theme .sidebar-theme-item {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-footer-info {
  margin-top: auto;
  padding: 14px;
  font-size: 11px;
  color: var(--text-grey);
  text-align: center;
  border-top: 1px solid var(--border-color);
  line-height: 1.5;
}

/* Mobile full height override */
@media (max-width: 480px) {
  .app-container {
    max-width: 100vw !important;
    width: 100vw !important;
    border-radius: 0 !important;
    border: none !important;
    height: 100vh !important;
    max-height: 100vh !important;
  }
}

/* 2-Column Form Row for Agent Name and Agent Mobile */
.form-row-2col {
  display: flex;
  gap: 10px;
  width: 100%;
}
.form-row-2col .form-card-field {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  gap: 8px;
}
@media (max-width: 340px) {
  .form-row-2col {
    flex-direction: column;
    gap: 12px;
  }
}

/* Toggle Agent Button */
.toggle-agent-btn {
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.25);
  color: var(--primary-blue);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  transition: all 0.2s ease;
}
.toggle-agent-btn:hover {
  background: var(--primary-blue);
  color: #ffffff;
}

/* Captcha Anti-Bot Verification Styling */
.captcha-form-card {
  background: rgba(248, 250, 252, 0.95);
  border: 1.5px dashed rgba(37, 99, 235, 0.35) !important;
  border-radius: 12px;
  transition: all 0.25s ease;
}
[data-theme="dark"] .captcha-form-card,
body.dark-theme .captcha-form-card {
  background: rgba(30, 41, 59, 0.75) !important;
  border-color: rgba(56, 189, 248, 0.4) !important;
}

.captcha-badge-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.35);
}

.captcha-code-text {
  font-family: 'Courier New', Courier, monospace;
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 5px;
  color: #38bdf8;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  user-select: none;
}

.captcha-refresh-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #ffffff;
  cursor: pointer;
  border-radius: 4px;
  padding: 5px 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, background-color 0.2s ease;
}
.captcha-refresh-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(180deg);
}
.captcha-refresh-btn svg {
  width: 14px;
  height: 14px;
}

.captcha-text-input {
  width: 100%;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text-dark);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.captcha-text-input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.captcha-action-btn:hover {
  background: #e4e4e7 !important;
}
.captcha-action-btn:active {
  background: #d4d4d8 !important;
}

/* Header Action Badges & Pills */
.header-admin-pill {
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  padding: 5px 9px;
  border-radius: 20px;
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #ffffff !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.2px;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.header-admin-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.45);
}

.header-sheet-pill {
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  padding: 5px 9px;
  border-radius: 20px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.2px;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}
.header-sheet-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.45);
}

/* Multi-Mode Login Tabs */
.login-tabs-nav {
  display: flex;
  gap: 4px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 20px;
  border: 1px solid #e2e8f0;
}
[data-theme="dark"] .login-tabs-nav,
body.dark-theme .login-tabs-nav {
  background: #1e293b;
  border-color: #334155;
}
.login-tab-btn {
  flex: 1;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 700;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.2s ease;
}
[data-theme="dark"] .login-tab-btn,
body.dark-theme .login-tab-btn {
  color: #94a3b8;
}
.login-tab-btn.active {
  background: #ffffff;
  color: #2563eb;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
[data-theme="dark"] .login-tab-btn.active,
body.dark-theme .login-tab-btn.active {
  background: #0f172a;
  color: #38bdf8;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Password Input with Visibility Toggle */
.pass-input-wrap {
  display: flex;
  align-items: center;
  width: 100%;
}
.pass-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  color: #64748b;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
}
.pass-toggle-btn:hover {
  color: #2563eb;
}

/* Password Reset / Link styling */
.forgot-pass-link {
  font-size: 12px;
  color: #2563eb;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}
.forgot-pass-link:hover {
  color: #1d4ed8;
}

/* Cloud Storage Status Banner in CRM */
.cloud-sync-banner {
  background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
[data-theme="dark"] .cloud-sync-banner,
body.dark-theme .cloud-sync-banner {
  background: linear-gradient(135deg, #064e3b 0%, #022c22 100%);
  border-color: #059669;
}

/* =========================================================
   STRICT FULL-SCREEN CRM LOCKDOWN GATE (PRE-AUTH ISOLATION)
   ========================================================= */
.login-lightbox {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at 50% 20%, #1e293b 0%, #0f172a 100%);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  overflow-y: auto;
}

.login-modal-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
  padding: 28px 24px 22px;
  box-sizing: border-box;
  animation: cardFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  margin: auto;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.login-logo-area {
  text-align: center;
  margin-bottom: 20px;
}

.login-logo-area .logo-txt {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #1e293b;
  display: block;
}

.login-logo-area .logo-sub {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #2563eb;
  text-transform: uppercase;
  display: block;
  margin-top: 3px;
}

.login-tabs-nav {
  display: flex;
  gap: 6px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.login-tab-btn {
  flex: 1;
  padding: 9px 4px;
  font-size: 12px;
  font-weight: 700;
  border: none;
  background: transparent;
  color: #64748b;
  border-radius: 9px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.login-tab-btn.active {
  background: #ffffff;
  color: #2563eb;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.login-instructions {
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
  margin: 0 0 16px 0;
  text-align: center;
}

.login-btn-submit {
  width: 100%;
  padding: 13px 18px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border: none;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transition: all 0.2s ease;
}

.login-btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.login-btn-submit:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.login-resend-link {
  font-size: 13px;
  color: #2563eb;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.pass-input-wrap {
  display: flex;
  align-items: center;
  width: 100%;
}

.pass-toggle-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  color: #64748b;
}

.pass-toggle-btn:hover {
  color: #1e293b;
}



