/* ==========================================================================
   Stackshooter CRM · Modern Mobile-First Design System
   ========================================================================== */

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-subtle: #eef2ff;
  --primary-border: #c7d2fe;

  --emerald: #10b981;
  --emerald-hover: #059669;
  --emerald-subtle: #ecfdf5;
  --emerald-border: #a7f3d0;

  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-subtle: #eff6ff;
  --blue-border: #bfdbfe;

  --amber: #f59e0b;
  --amber-hover: #d97706;
  --amber-subtle: #fffbeb;
  --amber-border: #fde68a;

  --rose: #ef4444;
  --rose-hover: #dc2626;
  --rose-subtle: #fef2f2;
  --rose-border: #fecaca;

  --purple: #8b5cf6;
  --purple-subtle: #f5f3ff;

  --ink-900: #0f172a;
  --ink-800: #1e293b;
  --ink-700: #334155;
  --ink-600: #475569;
  --ink-500: #64748b;
  --ink-400: #94a3b8;
  --ink-300: #cbd5e1;

  --bg-app: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --border: #e2e8f0;
  --border-focus: #818cf8;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.03);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);

  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--ink-800);
  line-height: 1.5;
  font-size: 14px;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Typography & Universal Elements
   ========================================================================== */

h1, h2, h3, h4, h5 {
  color: var(--ink-900);
  font-weight: 700;
  line-height: 1.25;
}

h1 { font-size: 24px; letter-spacing: -0.02em; }
h2 { font-size: 18px; letter-spacing: -0.01em; }
h3 { font-size: 15px; }

p { color: var(--ink-600); }
small { font-size: 12px; color: var(--ink-500); }
a { color: var(--primary); text-decoration: none; }

button, input, select, textarea {
  font-family: inherit;
  font-size: 14px;
}

svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* Base Buttons */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-700);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

button:hover, .btn:hover {
  background: var(--surface-alt);
  border-color: var(--ink-300);
  color: var(--ink-900);
  transform: translateY(-1px);
}

button:active, .btn:active {
  transform: scale(0.97);
}

button:disabled, .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  transform: none;
}

/* Color Variant Buttons */
.btn-primary, button.primary, .primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover, button.primary:hover, .primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.btn-whatsapp {
  background: #25d366;
  border-color: #20ba5a;
  color: #ffffff !important;
}

.btn-whatsapp:hover {
  background: #1eb857;
  color: #ffffff !important;
}

.btn-call {
  background: var(--blue-subtle);
  border-color: var(--blue-border);
  color: var(--blue) !important;
}

.btn-call:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff !important;
}

.link {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.link:hover {
  text-decoration: underline;
  background: none;
  transform: none;
}

/* Badges & Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.pill-new { background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }
.pill-contacted { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.pill-interested { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.pill-follow-up { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.pill-converted { background: #ede9fe; color: #5b21b6; border: 1px solid #ddd6fe; }
.pill-not-interested { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.badge-locality {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.rating-badge {
  color: #b45309;
  font-weight: 700;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

/* Form Controls */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-700);
}

input, select, textarea {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--ink-900);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

/* ==========================================================================
   Auth Screen (Mobile-App Style Lock Screen)
   ========================================================================== */

.auth-wrapper {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 10%, #312e81 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.auth-card {
  width: 100%;
  max-width: 410px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45);
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==========================================================================
   Brand Logo Images
   ========================================================================== */

.brand-badge-img {
  display: inline-flex;
  padding: 6px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 14px;
  box-shadow: 0 8px 16px -4px rgba(79, 70, 229, 0.25);
}

.brand-img-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: contain;
}

.brand-img-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
}

.brand-icon-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.mobile-logo-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.auth-brand {
  text-align: center;
  margin-bottom: 24px;
}

.brand-badge {
  display: inline-flex;
  padding: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
  border-radius: 14px;
  color: #fff;
  margin-bottom: 14px;
  box-shadow: 0 8px 16px -4px rgba(79, 70, 229, 0.4);
}

.brand-badge svg {
  width: 28px;
  height: 28px;
}

.auth-brand h1 {
  font-size: 22px;
  color: var(--ink-900);
  margin-bottom: 4px;
}

.auth-brand p {
  font-size: 13px;
  color: var(--ink-500);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--rose-subtle);
  border: 1px solid var(--rose-border);
  color: var(--rose);
  font-size: 12.5px;
  font-weight: 600;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon .field-icon,
.input-with-icon i {
  position: absolute;
  left: 12px;
  color: var(--ink-400);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-with-icon .field-icon svg,
.input-with-icon i svg {
  width: 18px;
  height: 18px;
}

.input-with-icon input {
  padding-left: 38px;
  padding-right: 42px;
}

.btn-toggle-pwd {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%) !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 6px !important;
  margin: 0 !important;
  color: var(--ink-400);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s ease, background 0.15s ease;
}

.btn-toggle-pwd:hover {
  background: var(--surface-alt) !important;
  color: var(--ink-700) !important;
  transform: translateY(-50%) !important;
}

.btn-toggle-pwd:active {
  transform: translateY(-50%) scale(0.92) !important;
}

.btn-toggle-pwd svg {
  width: 19px;
  height: 19px;
  display: block;
}

/* Hide native Edge / Chrome password reveal icon */
input::-ms-reveal,
input::-ms-clear {
  display: none !important;
}

.btn-toggle-pwd:hover {
  background: none;
  color: var(--ink-700);
  transform: none;
}

.auth-demo-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-600);
  background: var(--surface-alt);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}

.auth-demo-hint code {
  background: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  color: var(--primary);
  border: 1px solid var(--border);
}

.btn-auth-submit {
  background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
  border: none;
  color: #fff;
  padding: 12px;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  margin-top: 6px;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  transition: all 0.2s ease;
}

.btn-auth-submit:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-auth-submit:active {
  transform: scale(0.98);
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.auth-footer p {
  font-size: 11px;
  color: var(--ink-400);
}

/* ==========================================================================
   Desktop Rail / Sidebar
   ========================================================================== */

aside#rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  z-index: 20;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.brand-mark {
  background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
  color: #fff;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.company-name {
  display: block;
  font-size: 17px;
  font-weight: 800;
  color: var(--ink-900);
  letter-spacing: -0.02em;
}

.app-sub {
  display: block;
  font-size: 11px;
  color: var(--ink-500);
  font-weight: 600;
}

.workspace-badge {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.badge-avatar {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 800;
  font-size: 12px;
  border-radius: 8px;
  padding: 6px 8px;
  border: 1px solid var(--primary-border);
}

.badge-details strong {
  display: block;
  font-size: 12px;
  color: var(--ink-800);
}

.badge-details small {
  display: block;
  font-size: 10.5px;
  color: var(--ink-500);
}

.nav-section-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--ink-400);
  padding: 0 10px;
  margin: 12px 0 6px;
}

.desktop-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-600);
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.nav-link i {
  color: var(--ink-500);
}

.nav-link:hover {
  background: var(--surface-alt);
  color: var(--ink-900);
}

.nav-link.active {
  background: var(--primary-subtle);
  color: var(--primary);
  font-weight: 700;
}

.nav-link.active i {
  color: var(--primary);
}

.nav-counter {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  background: var(--surface-alt);
  color: var(--ink-600);
}

.nav-link.active .nav-counter {
  background: #ffffff;
  color: var(--primary);
  box-shadow: var(--shadow-xs);
}

.nav-counter-amber {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  background: var(--amber-subtle);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}

.sidebar-user-card {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

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

.username-display {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--ink-500);
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--emerald);
  border-radius: 50%;
  display: inline-block;
}

.btn-logout {
  background: none;
  border: none;
  color: var(--ink-400);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-logout:hover {
  color: var(--rose);
  background: var(--rose-subtle);
  transform: none;
}

.sidebar-footer {
  padding-top: 10px;
  text-align: center;
}

.sidebar-footer small {
  font-size: 10px;
  color: var(--ink-400);
}

/* ==========================================================================
   Shell & Top Header
   ========================================================================== */

.shell {
  margin-left: 240px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100%;
}

.top-header {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 15;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mobile-brand-mark {
  display: none;
  background: var(--primary);
  color: #fff;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mobile-brand-mark svg {
  width: 18px;
  height: 18px;
}

.header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-500);
  white-space: nowrap;
  min-width: 0;
}

.crumb-divider {
  color: var(--ink-300);
}

.crumb-current {
  color: var(--ink-900);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.location-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-600);
  background: var(--surface-alt);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.location-pill svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

.header-user-avatar {
  display: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  border: 1.5px solid #ffffff;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */

main#main {
  flex: 1;
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 32px 50px;
  box-sizing: border-box;
  overflow-x: hidden;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 14px;
  color: var(--ink-500);
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Hero Section */
.hero-card {
  position: relative;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 60%, #4338ca 100%);
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 22px;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(49, 46, 129, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.hero-glow {
  position: absolute;
  right: -50px;
  top: -80px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.4) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #a5b4fc;
  margin-bottom: 6px;
}

.hero-card h1 {
  color: #ffffff;
  font-size: 26px;
  margin-bottom: 4px;
}

.hero-card p {
  color: #c7d2fe;
  font-size: 13px;
}

.hero-btn {
  background: #ffffff;
  color: var(--primary);
  border: none;
  font-weight: 700;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  white-space: nowrap;
}

.hero-btn:hover {
  background: #f8fafc;
  color: var(--primary-hover);
  transform: translateY(-2px);
}

/* Metrics Row */
.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: block;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-border);
  box-shadow: var(--shadow-md);
}

.interactive-card {
  cursor: pointer;
  user-select: none;
}

.card-click-hint {
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0.85;
  transition: all 0.15s ease;
}

.interactive-card:hover .card-click-hint {
  opacity: 1;
  text-decoration: underline;
  transform: translateX(2px);
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.metric-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-600);
}

.metric-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}

.metric-icon-box.primary { background: var(--primary-subtle); color: var(--primary); }
.metric-icon-box.emerald { background: var(--emerald-subtle); color: var(--emerald); }
.metric-icon-box.amber { background: var(--amber-subtle); color: var(--amber); }
.metric-icon-box.purple { background: var(--purple-subtle); color: var(--purple); }

.metric-num {
  font-size: 30px;
  font-weight: 800;
  color: var(--ink-900);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* Cards & Grid Containers */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-xs);
}

.cardhead,
.team-cardhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.cardhead-title-group {
  flex: 1;
  min-width: 0;
}

.cardhead h2,
.team-cardhead h2 {
  font-size: 16px;
}

.caption {
  font-size: 12px;
  color: var(--ink-500);
  font-weight: 600;
}

.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

/* Pipeline Status Grid */
.status-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.stage-btn {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-top: 3.5px solid var(--tone);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.stage-btn:hover {
  background: #ffffff;
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.stage-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-600);
  margin-bottom: 4px;
}

.stage-count {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink-900);
}

/* Category & Locality Bars */
.barrow {
  margin: 12px 0;
}

.bar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 13px;
}

.bar-track {
  height: 7px;
  background: var(--surface-alt);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.areas .bar-fill {
  background: #0284c7;
}

/* Item Rows & Timelines */
.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}

.item-row:last-child {
  border-bottom: none;
}

.item-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.empty-state {
  text-align: center;
  padding: 24px 16px;
  color: var(--ink-500);
  font-size: 13px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

/* ==========================================================================
   Lead Directory & Dual Responsive View (Table / Mobile Cards)
   ========================================================================== */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 4px;
}

.controls-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  background: var(--surface-alt);
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.controls-bar label {
  flex: 1;
  min-width: 140px;
}

.controls-bar label.search-field {
  flex: 2;
  min-width: 200px;
}

.btn-clear {
  align-self: flex-end;
  height: 40px;
}

/* Desktop Data Table */
.desktop-table-container {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

table.lead-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: 13px;
  background: var(--surface);
}

table.lead-table th {
  background: var(--surface-alt);
  color: var(--ink-700);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

table.lead-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--ink-800);
}

table.lead-table tbody tr:hover {
  background: #f8fafc;
}

table.lead-table tbody tr:last-child td {
  border-bottom: none;
}

/* Business name & category clean formatting */
.col-lead-info {
  min-width: 280px;
  max-width: 380px;
}

.lead-name-row {
  margin-bottom: 5px;
}

.lead-name-row .card-biz-name {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink-900);
  line-height: 1.35;
  display: block;
  text-align: left;
  white-space: normal;
  word-break: break-word;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.lead-name-row .card-biz-name:hover {
  color: var(--primary);
  text-decoration: underline;
}

.lead-cat-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cat-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  color: #4338ca;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.col-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.col-actions .btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* Mobile Lead Cards (App View for Phones) */
.mobile-cards-list {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.lead-card-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.2s ease;
}

.lead-card-item:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-md);
}

.card-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-title-box {
  flex: 1;
  min-width: 0;
}

.card-biz-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-900);
  line-height: 1.3;
  margin-bottom: 4px;
  cursor: pointer;
}

.card-biz-name:hover {
  color: var(--primary);
}

.card-category {
  font-size: 12px;
  color: var(--ink-500);
  display: block;
}

.card-badges-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.card-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-top: 4px;
}

.btn-card-action {
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 4px 4px;
  font-size: 13px;
  color: var(--ink-500);
}

/* Follow-ups Tabs */
.tabs-header {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.tab-pill {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-700);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-pill.selected {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

/* ==========================================================================
   Modals & Drawers (Bottom Sheet on Mobile)
   ========================================================================== */

dialog {
  border: none;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  outline: none;
  padding: 0;
  max-width: 100vw;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

/* Lead Profile Drawer */
#drawer.app-drawer {
  margin: 0 0 0 auto;
  width: min(580px, 100vw);
  height: 100vh;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
  border-left: 1px solid var(--border);
  overflow-y: auto;
}

.sheet-handle {
  display: none;
  width: 44px;
  height: 5px;
  background: var(--ink-300);
  border-radius: var(--radius-full);
  margin: 10px auto 4px;
}

.drawer-body {
  padding: 24px;
}

.drawer-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
  margin-bottom: 20px;
}

.drawer-header h2 {
  font-size: 22px;
  margin: 8px 0 4px;
}

.drawer-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.drawer-section:last-child {
  border-bottom: none;
}

.drawer-section h3 {
  font-size: 14.5px;
  margin-bottom: 12px;
  color: var(--ink-900);
}

/* Facts Grid */
.facts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.facts-grid .fact-item span {
  display: block;
  font-size: 11.5px;
  color: var(--ink-500);
  margin-bottom: 2px;
}

.facts-grid .fact-item b, .facts-grid .fact-item strong {
  font-size: 13px;
  color: var(--ink-800);
}

.fact-item.full-width {
  grid-column: 1 / -1;
}

/* WhatsApp Composer Modal */
#composer.app-composer {
  width: min(500px, 94vw);
  border-radius: var(--radius-lg);
  padding: 24px;
}

/* Global App Toast Notification */
.app-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e1b4b;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  display: none;
  z-index: 200;
  animation: toastFade 0.25s ease;
  white-space: nowrap;
}

@keyframes toastFade {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ==========================================================================
   Mobile Bottom Navigation Bar
   ========================================================================== */

.mobile-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(60px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  grid-template-columns: repeat(5, 1fr);
  z-index: 50;
}

/* ==========================================================================
   Sales Guide, SOP & User Management
   ========================================================================== */

.guide-container {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.policy-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-xs);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
              border-color 0.25s ease;
  position: relative;
  overflow: hidden;
}

.policy-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: transparent;
  transition: background 0.25s ease;
}

.policy-card:hover {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 14px 30px -6px rgba(15, 23, 42, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
  transform: translateY(-2px);
}

.policy-card:hover::before {
  background: linear-gradient(180deg, var(--primary), #818cf8);
}

.policy-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.policy-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-subtle);
  color: var(--primary);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.policy-icon-box svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.2;
}

.policy-card:hover .policy-icon-box {
  transform: scale(1.08) rotate(-2deg);
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

.policy-intro {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink-700);
}

.policy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.policy-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.24s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.2s ease,
              border-color 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.policy-box:hover {
  background: #ffffff;
  border-color: rgba(99, 102, 241, 0.38);
  box-shadow: 0 10px 24px -4px rgba(79, 70, 229, 0.12), 0 2px 8px -1px rgba(15, 23, 42, 0.04);
  transform: translateY(-3px);
}

.policy-box-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.policy-box-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--primary);
  flex-shrink: 0;
  transition: all 0.22s ease;
}

.policy-box-icon svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}

.policy-box:hover .policy-box-icon {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(79, 70, 229, 0.3);
}

.policy-box h4 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink-900);
  margin: 0;
}

.policy-step-pill {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--primary-subtle);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  white-space: nowrap;
}

.policy-step-pill.success {
  background: var(--emerald-subtle);
  color: var(--emerald);
  border-color: var(--emerald-border);
}

.policy-box p {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-600);
  margin: 0;
}

/* User Management Table */
.user-table-box {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 14px;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

.user-table th {
  background: var(--surface-alt);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-role-admin {
  background: #fdf2f8;
  color: #be185d;
  border: 1px solid #fbcfe8;
}

.badge-role-sales {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.badge-status-active {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-status-inactive {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* Modals & Dialogs (Centered on Desktop & Mobile) */
dialog.app-modal,
dialog#user-modal,
dialog#composer {
  position: fixed;
  inset: 0;
  margin: auto !important;
  width: min(480px, calc(100vw - 28px));
  max-width: 480px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: 0 25px 60px -10px rgba(15, 23, 42, 0.45);
  background: var(--surface);
  z-index: 100;
  padding: 0;
}

dialog.app-modal::backdrop,
dialog#user-modal::backdrop,
dialog#composer::backdrop {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.modal-pad {
  padding: 24px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.modal-sub {
  font-size: 12.5px;
  color: var(--ink-500);
  margin-bottom: 18px;
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

/* User Cards for Mobile in Settings */
.mobile-user-cards {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.mobile-user-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-user-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.mobile-user-details strong {
  display: block;
  font-size: 13.5px;
  color: var(--ink-900);
}

.mobile-user-details code {
  font-size: 12px;
  color: var(--primary);
}

.mobile-user-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mobile-user-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.mobile-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink-500);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  position: relative;
  transition: all 0.15s ease;
}

.mobile-tab svg {
  width: 20px;
  height: 20px;
  color: var(--ink-500);
}

.mobile-tab.active {
  color: var(--primary);
  font-weight: 700;
}

.mobile-tab.active svg {
  color: var(--primary);
}

.tab-icon-wrapper {
  position: relative;
  display: inline-flex;
}

.tab-badge {
  position: absolute;
  top: -6px;
  right: -10px;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  border-radius: var(--radius-full);
  padding: 1px 5px;
}

.tab-badge.amber {
  background: var(--amber);
}

/* ==========================================================================
   Responsive Adaptations (Tablets & Mobile Phones)
   ========================================================================== */

@media (max-width: 1024px) {
  aside#rail {
    width: 210px;
  }
  .shell {
    margin-left: 210px;
  }
  .metrics-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .status-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  /* Hide Desktop Sidebar */
  aside#rail {
    display: none;
  }

  /* Shell adjusts for no sidebar and bottom bar padding */
  .shell {
    margin-left: 0;
    padding-bottom: calc(70px + var(--safe-bottom));
  }

  /* Top Header on Mobile */
  .top-header {
    height: calc(56px + var(--safe-top));
    padding: var(--safe-top) 14px 0 14px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 25;
  }

  .crumb-parent,
  .crumb-divider {
    display: none !important;
  }

  .crumb-current {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -0.01em;
  }

  .location-pill {
    padding: 4px 8px;
    font-size: 11px;
    gap: 4px;
  }

  .location-pill svg {
    width: 12px;
    height: 12px;
  }

  .mobile-brand-mark {
    display: flex;
    width: 28px;
    height: 28px;
  }

  .header-user-avatar {
    display: flex;
    width: 30px;
    height: 30px;
  }

  /* Card Head on Mobile: Stack title and action button */
  .cardhead,
  .team-cardhead {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
  }

  .cardhead > div,
  .team-cardhead > div,
  .cardhead-title-group {
    width: 100% !important;
    min-width: 0 !important;
  }

  .cardhead button,
  .cardhead .btn,
  .team-cardhead button,
  .team-cardhead .btn,
  #btn-add-user {
    width: 100% !important;
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    white-space: nowrap !important;
    padding: 11px 16px !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    border-radius: var(--radius-sm) !important;
    box-sizing: border-box !important;
  }

  /* Page Header on Mobile */
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }

  .page-header > div {
    width: 100%;
  }

  .page-header h1 {
    font-size: 22px;
  }

  .page-header button,
  .page-header .btn {
    width: 100%;
    justify-content: center;
  }

  main#main {
    padding: 16px 16px 36px;
  }

  /* Hero Section */
  .hero-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 18px;
  }

  .hero-card h1 {
    font-size: 21px;
  }

  .hero-btn {
    width: 100%;
    text-align: center;
  }

  /* Metrics & Status */
  .metrics-row {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .metric-card {
    padding: 14px;
  }

  .metric-num {
    font-size: 24px;
  }

  .status-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .two-col-grid {
    grid-template-columns: 1fr;
  }

  /* Controls Bar on Mobile */
  .controls-bar {
    padding: 12px;
  }

  .controls-bar label {
    min-width: 100%;
  }

  /* Hide Desktop Table, Show Native Mobile Cards */
  .desktop-table-container {
    display: none !important;
  }

  .mobile-cards-list {
    display: flex !important;
  }

  /* User Management on Mobile */
  .desktop-user-table {
    display: none !important;
  }

  .mobile-user-cards {
    display: flex !important;
  }

  /* Bottom Nav visible */
  .mobile-bottom-bar {
    display: grid;
  }

  /* Bottom Sheet Drawer for Phones */
  #drawer.app-drawer {
    margin: auto 0 0 0;
    width: 100vw;
    height: 88vh;
    height: 88dvh;
    max-height: 88dvh;
    border-radius: 20px 20px 0 0;
    border-left: none;
    border-top: 1px solid var(--border);
    animation: sheetSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .sheet-handle {
    display: block;
  }

  .drawer-body {
    padding: 18px;
  }

  @keyframes sheetSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
}

/* ==========================================================================
   SweetAlert2 Custom Stackshooter Theme
   ========================================================================== */

.swal2-popup {
  font-family: var(--font-family) !important;
  border-radius: var(--radius-lg) !important;
  padding: 24px !important;
  box-shadow: 0 25px 60px -10px rgba(15, 23, 42, 0.45) !important;
  border: 1px solid var(--border) !important;
}

.swal2-title {
  font-size: 20px !important;
  font-weight: 750 !important;
  color: var(--ink-900) !important;
}

.swal2-html-container {
  font-size: 13.5px !important;
  color: var(--ink-600) !important;
  line-height: 1.55 !important;
}

.swal2-styled.swal2-confirm {
  background-color: var(--primary) !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 600 !important;
  font-size: 13.5px !important;
  padding: 9px 20px !important;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3) !important;
}

.swal2-styled.swal2-cancel {
  background-color: var(--surface-alt) !important;
  color: var(--ink-700) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 600 !important;
  font-size: 13.5px !important;
  padding: 9px 18px !important;
}

.swal2-toast {
  padding: 10px 16px !important;
  border-radius: var(--radius-full) !important;
  box-shadow: 0 10px 25px -4px rgba(15, 23, 42, 0.25) !important;
  border: 1px solid var(--border) !important;
}

.swal2-toast .swal2-title {
  font-size: 13px !important;
  font-weight: 600 !important;
}

@media (max-width: 600px) {
  .swal2-popup {
    width: calc(100vw - 32px) !important;
    padding: 20px 16px !important;
    border-radius: 18px !important;
  }
  .swal2-actions {
    width: 100% !important;
    flex-direction: column-reverse !important;
    gap: 8px !important;
  }
  .swal2-actions button {
    width: 100% !important;
    margin: 0 !important;
    min-height: 44px !important;
  }
}

/* ==========================================================================
   Sweet App Preloader
   ========================================================================== */

.app-preloader {
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.4s ease;
}

.app-preloader.fade-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
  max-width: 320px;
}

.preloader-brand-box {
  position: relative;
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
}

.preloader-pulse-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.35) 0%, rgba(79, 70, 229, 0) 70%);
  animation: preloaderPulse 1.8s infinite ease-out;
}

.preloader-icon {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 25px -4px rgba(79, 70, 229, 0.45);
  position: relative;
  z-index: 2;
}

.preloader-icon img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.preloader-text-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.preloader-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink-900);
  margin: 0;
}

.preloader-loader-bar {
  width: 140px;
  height: 4px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.preloader-loader-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, #4f46e5, #10b981);
  border-radius: 4px;
  animation: preloaderSlide 1.2s infinite ease-in-out;
}

.preloader-sub {
  font-size: 11.5px;
  color: var(--ink-400);
  font-weight: 600;
  margin: 0;
}

@keyframes preloaderPulse {
  0% { transform: scale(0.85); opacity: 0.8; }
  50% { transform: scale(1.25); opacity: 0.25; }
  100% { transform: scale(1.4); opacity: 0; }
}

@keyframes preloaderSlide {
  0% { left: -40%; width: 30%; }
  50% { width: 50%; }
  100% { left: 100%; width: 25%; }
}

/* ==========================================================================
   Revenue, Deals & Payment Tracking Styles
   ========================================================================== */

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
}

.revenue-card {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid rgba(79, 70, 229, 0.2);
  border-radius: var(--radius-md);
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: 0 4px 18px -2px rgba(79, 70, 229, 0.06);
}

.revenue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.revenue-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.revenue-title-group h2 {
  font-size: 16px;
  font-weight: 750;
  color: var(--ink-900);
  margin: 0;
}

.revenue-badge-live {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--emerald-subtle);
  color: var(--emerald);
  border: 1px solid var(--emerald-border);
  text-transform: uppercase;
}

.revenue-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

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

.revenue-stat-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.revenue-stat-box:hover {
  border-color: var(--primary-border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-xs);
}

.revenue-stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-400);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.revenue-stat-val {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink-900);
}

.revenue-stat-val.emerald {
  color: var(--emerald);
}

.revenue-stat-val.indigo {
  color: var(--primary);
}

.revenue-stat-val.amber {
  color: var(--amber);
}

.revenue-stat-sub {
  font-size: 11px;
  color: var(--ink-500);
}

/* Deal Summary inside Drawer */
.drawer-deal-section {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

.drawer-deal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
  flex-wrap: wrap;
}

.drawer-deal-head h3 {
  font-size: 14px;
  font-weight: 750;
  color: var(--ink-900);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.deal-numbers-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

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

.deal-num-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.deal-num-card span {
  display: block;
  font-size: 10.5px;
  color: var(--ink-500);
  font-weight: 600;
}

.deal-num-card strong {
  display: block;
  font-size: 16px;
  font-weight: 800;
  margin-top: 2px;
}

.deal-history-item {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.deal-history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.deal-tag-advance {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 700;
  background: var(--emerald-subtle);
  color: var(--emerald);
  border: 1px solid var(--emerald-border);
}

.deal-tag-quote {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 700;
  background: var(--primary-subtle);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

/* Lead Table Deal Pill */
.lead-deal-badge {
  display: inline-block;
  margin-top: 3px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
