/* JSW ONE CRM - Core Design System & Styling */
/* Mobile-first, native Android app feel */

:root {
  --color-primary: #17469E;       /* Tory Blue (JSW Corporate) */
  --color-primary-dark: #0A2E70;
  --color-accent: #D72027;        /* Alizarin Crimson (JSW Accent) */
  --color-accent-light: #FDE8E8;
  --color-bg-dark: #0A1628;       /* Splash Background */
  
  --color-surface: #F5F7FA;       /* Page Background */
  --color-card: #FFFFFF;
  
  --color-text-primary: #1E293B;
  --color-text-secondary: #64748B;
  --color-text-light: #94A3B8;
  
  --color-border: #E2E8F0;
  
  --color-success: #16A34A;       /* WON status */
  --color-success-light: #DCFCE7;
  --color-warning: #D97706;       /* OPEN/Pending status */
  --color-warning-light: #FEF3C7;
  --color-danger: #DC2626;        /* LOST status */
  --color-danger-light: #FEE2E2;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(23, 70, 158, 0.08), 0 4px 6px -2px rgba(23, 70, 158, 0.04);
  --shadow-fab: 0 8px 16px rgba(215, 32, 39, 0.25);
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================
   GLOBAL RESET & BASICS
   ========================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent; /* Remove tap flash on Android */
}

html, body {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background-color: var(--color-surface);
  color: var(--color-text-primary);
  user-select: none; /* Disable text select for native app feel */
}

body.logged-in {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

body.logged-in .app-header {
  position: relative;
  top: auto;
  left: auto;
  width: 100%;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

body.logged-in .app-content-container {
  flex: 1;
  height: 100%;
  width: 100%;
  padding-top: 0;
  padding-bottom: 0;
  position: relative;
  overflow: hidden;
}

body.logged-in .app-tabbar {
  position: relative;
  bottom: auto;
  left: auto;
  width: 100%;
  flex-shrink: 0;
}

body.logged-in .app-page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

input, textarea, select {
  user-select: text; /* Re-enable input selection */
}

/* ==========================================
   SPLASH SCREEN
   ========================================== */
.splash-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--color-bg-dark);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity var(--transition-normal);
}

.splash-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.splash-logo {
  width: 140px;
  height: auto;
  opacity: 0;
  transform: scale(0.8);
  animation: logoIntro 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.splash-spinner {
  margin-top: 30px;
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255,255,255,0.1);
  border-radius: 50%;
  border-top-color: var(--color-accent);
  animation: spin 0.8s linear infinite;
}

@keyframes logoIntro {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
.toast-container {
  position: fixed;
  bottom: 80px; /* Safe space above tab bar */
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  width: 90%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  background-color: #1E293B;
  color: #FFFFFF;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(20px);
  animation: toastIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: auto;
}

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

@keyframes toastIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.toast.toast-fade-out {
  animation: toastOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* ==========================================
   APP HEADER
   ========================================== */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 56px;
  background-color: var(--color-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
  color: #FFFFFF;
  box-shadow: var(--shadow-md);
}

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

.header-logo {
  height: 32px;
  width: auto;
  cursor: pointer;
}

.header-user-name {
  font-size: 14px;
  font-weight: 600;
  color: #FFFFFF;
  border-left: 1px solid rgba(255, 255, 255, 0.3);
  padding-left: 12px;
  white-space: nowrap;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-phone-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background-color: rgba(255,255,255,0.15);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
}

.phone-icon {
  width: 14px;
  height: 14px;
}

/* ==========================================
   SIDE DRAWER MENU
   ========================================== */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.app-drawer {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background-color: var(--color-card);
  z-index: 201;
  box-shadow: 10px 0 30px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  transition: left var(--transition-normal);
}

.app-drawer.active {
  left: 0;
}

.drawer-header {
  background-color: var(--color-primary);
  padding: 24px 16px;
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.drawer-logo {
  height: 36px;
  width: auto;
  align-self: flex-start;
}

.drawer-profile-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.drawer-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background-color: var(--color-accent);
  color: #FFFFFF;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 700;
  font-size: 16px;
  box-shadow: var(--shadow-sm);
}

.drawer-user-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.role-badge.admin { background-color: var(--color-accent); color: #FFFFFF; }
.role-badge.asm { background-color: #8B5CF6; color: #FFFFFF; }
.role-badge.aso { background-color: #06B6D4; color: #FFFFFF; }
.role-badge.cnf { background-color: #10B981; color: #FFFFFF; }
.role-badge.rsm { background-color: #F43F5E; color: #FFFFFF; }
.role-badge.company_head { background-color: #F43F5E; color: #FFFFFF; }
.role-badge.influencer { background-color: #3B82F6; color: #FFFFFF; }
.role-badge.sp { background-color: var(--color-success); color: #FFFFFF; }
.role-badge.engineer { background-color: #06B6D4; color: #FFFFFF; }

.drawer-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.drawer-nav-item {
  list-style: none;
}

.drawer-nav-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  color: var(--color-text-primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background-color var(--transition-fast);
}

.drawer-nav-link:active {
  background-color: var(--color-surface);
}

.drawer-nav-link.active {
  color: var(--color-primary);
  background-color: var(--color-accent-light);
  font-weight: 600;
}

.drawer-nav-link svg {
  width: 20px;
  height: 20px;
}

.drawer-nav-link.logout-link {
  color: var(--color-danger);
  border-top: 1px solid var(--color-border);
  margin-top: 16px;
  padding-top: 16px;
}

/* ==========================================
   APP CONTENT CONTAINER
   ========================================== */
.app-content-container {
  width: 100%;
  height: 100%;
  padding-top: 56px; /* Space for Header */
  padding-bottom: 60px; /* Space for Tabbar */
  position: relative;
  overflow: hidden;
}

.app-page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 68px 12px 72px 12px; /* 56px header + 12px gap at top, 60px tabbar + 12px gap at bottom */
  overflow-y: auto;
  background-color: var(--color-surface);
  display: none;
  /* Scroll acceleration for iOS */
  -webkit-overflow-scrolling: touch;
}

.app-page.active-page {
  display: block;
}

/* ==========================================
   AUTH COMPONENTS (Login / Password change)
   ========================================== */
#page-login, #page-force-password {
  height: 100dvh;
  width: 100%;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 24px;
  background-color: var(--color-surface);
}

#page-login.active-page, #page-force-password.active-page {
  display: flex !important;
}

.auth-card {
  background-color: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  height: 48px;
  width: auto;
  margin-bottom: 16px;
}

.auth-card h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-bottom: 24px;
}

.auth-form {
  text-align: left;
}

.form-group {
  margin-bottom: 20px;
}

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

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  height: 44px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0 12px;
  font-size: 14px;
  background-color: var(--color-card);
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-group textarea {
  height: 100px;
  padding: 12px;
  resize: none;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--color-primary);
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  height: 44px;
  padding: 0 24px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  outline: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

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

.btn-primary {
  background-color: var(--color-primary);
  color: #FFFFFF;
}

.btn-secondary {
  background-color: var(--color-card);
  border: 1px solid var(--color-border);
  color: var(--color-text-primary);
}

.btn-success {
  background-color: var(--color-success);
  color: #FFFFFF;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-sm {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.btn-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
}

.btn-clear {
  background: none;
  border: none;
  color: var(--color-primary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

/* ==========================================
   BOTTOM NAVIGATION TAB BAR
   ========================================== */
.app-tabbar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background-color: var(--color-card);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom); /* iOS support */
}

.tabbar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  text-decoration: none;
  flex: 1;
  height: 100%;
}

.tabbar-item.active {
  color: var(--color-primary);
}

.tabbar-icon {
  width: 20px;
  height: 20px;
  margin-bottom: 2px;
}

.tabbar-label {
  font-size: 10px;
  font-weight: 600;
}

/* Center Elevated FAB */
.tabbar-fab-container {
  width: 56px;
  height: 56px;
  position: relative;
  top: -16px; /* Elevate it above the bar */
  z-index: 105;
}

.tabbar-fab-btn {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-accent), #EF4444);
  color: #FFFFFF;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: var(--shadow-fab);
  cursor: pointer;
  outline: none;
  transition: transform var(--transition-fast);
}

.tabbar-fab-btn:active {
  transform: scale(0.9) rotate(45deg);
}

.fab-plus-icon {
  width: 24px;
  height: 24px;
}

/* ==========================================
   BOTTOM SHEET MODALS
   ========================================== */
.bottom-sheet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0,0,0,0.5);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.bottom-sheet-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.bottom-sheet {
  position: fixed;
  bottom: -100%;
  left: 0;
  width: 100%;
  max-height: 85%;
  background-color: var(--color-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  z-index: 301;
  box-shadow: 0 -8px 24px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  transition: bottom var(--transition-normal);
  padding-bottom: env(safe-area-inset-bottom);
}

.bottom-sheet.active {
  bottom: 0;
}

.bottom-sheet-header {
  padding: 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.bottom-sheet-drag-handle {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  background-color: var(--color-border);
  border-radius: var(--radius-full);
}

.bottom-sheet-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-primary);
}

.bottom-sheet-close-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.bottom-sheet-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}

/* ==========================================
   DASHBOARD COMPONENTS (KPIs, Circles, Grids)
   ========================================== */
.dashboard-area-selector-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--color-card);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.dashboard-area-selector-bar label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.area-select {
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
  outline: none;
}

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

.kpi-card {
  background-color: var(--color-card);
  border-radius: var(--radius-md);
  padding: 8px 4px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border-bottom: 3px solid var(--color-border);
}

.kpi-card.blue { border-bottom-color: var(--color-primary) !important; }
.kpi-card.green { border-bottom-color: var(--color-success) !important; }
.kpi-card.orange { border-bottom-color: var(--color-warning) !important; }
.kpi-card.red { border-bottom-color: var(--color-danger) !important; }

.kpi-number {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 2px;
}

.kpi-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
}

/* Progress bar container card */
.kpi-progress-container-card {
  background-color: var(--color-card);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.kpi-progress-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.kpi-progress-bar-bg {
  width: 100%;
  height: 10px;
  background-color: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 6px;
}

.kpi-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: var(--radius-full);
  width: 0;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-progress-subtext-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--color-text-secondary);
}

.dashboard-circle-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 8px;
  width: 100%;
}

.dashboard-circle-cards-grid .dashboard-circle-card {
  margin-bottom: 0;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center !important;
  padding: 8px 6px !important;
  gap: 6px !important;
  background-color: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
}

.dashboard-circle-cards-grid .circle-svg-container {
  width: 60px !important;
  height: 60px !important;
  order: unset !important;
}

.dashboard-circle-cards-grid .circle-svg {
  width: 60px !important;
  height: 60px !important;
}

.dashboard-circle-cards-grid .circle-percentage-text {
  font-size: 11px !important;
}

.dashboard-circle-cards-grid .circle-details-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  order: unset !important;
}

.dashboard-circle-cards-grid .circle-title {
  font-size: 8px !important;
  margin-bottom: 2px !important;
  white-space: nowrap;
}

.dashboard-circle-cards-grid .circle-qty-highlight {
  font-size: 14px !important;
  margin-bottom: 1px !important;
}

.dashboard-circle-cards-grid .circle-subtext {
  font-size: 9px !important;
  line-height: 1.2 !important;
}

/* Circular Progress Rings (Engineer Dashboard) */
.dashboard-circle-card {
  background-color: var(--color-card);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
}

.circle-svg-container {
  position: relative;
  width: 90px;
  height: 90px;
  order: 2;
  flex-shrink: 0;
}

.circle-svg {
  width: 90px;
  height: 90px;
  transform: rotate(-90deg);
}

.circle-bg {
  fill: none;
  stroke: var(--color-border);
  stroke-width: 8;
}

.circle-fill {
  fill: none;
  stroke: var(--color-success);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 251.2; /* 2 * PI * R where R = 40 */
  stroke-dashoffset: 251.2;
  transition: stroke-dashoffset 1s ease-in-out, stroke 0.3s;
}

.circle-fill.green { stroke: var(--color-success); }
.circle-fill.amber { stroke: var(--color-warning); }
.circle-fill.red { stroke: var(--color-danger); }

.circle-percentage-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.circle-details-box {
  flex: 1;
  order: 1;
}

.circle-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.circle-qty-highlight {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 2px;
}

.circle-subtext {
  font-size: 12px;
  color: var(--color-text-secondary);
}

/* More Menu Grid */
.more-grid-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  margin-bottom: 8px;
  margin-top: 16px;
}

.more-menu-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.more-grid-tile {
  background-color: var(--color-card);
  border-radius: var(--radius-md);
  padding: 16px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  color: var(--color-text-primary);
  transition: transform var(--transition-fast);
}

.more-grid-tile:active {
  transform: scale(0.95);
  background-color: var(--color-border);
}

.tile-icon-wrapper {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background-color: var(--color-accent-light);
  color: var(--color-accent);
  display: flex;
  justify-content: center;
  align-items: center;
}

.tile-icon-wrapper.blue {
  background-color: #EEF2F6;
  color: var(--color-primary);
}

.tile-icon-wrapper.green {
  background-color: #F0FDF4;
  color: var(--color-success);
}

.tile-icon-wrapper.purple {
  background-color: #F5F3FF;
  color: #7C3AED;
}

.tile-icon-wrapper.cyan {
  background-color: #ECFEFF;
  color: #0891B2;
}

.more-grid-tile svg {
  width: 20px;
  height: 20px;
}

.more-grid-tile span {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

/* Activity feed */
.activity-feed-card {
  background-color: var(--color-card);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.activity-feed-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 8px;
}

.activity-item {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 12px;
}

.activity-item:last-child {
  margin-bottom: 0;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-primary);
  margin-top: 4px;
}

.activity-item.won .activity-dot { background-color: var(--color-success); }
.activity-item.lost .activity-dot { background-color: var(--color-danger); }
.activity-item.quote .activity-dot { background-color: var(--color-accent); }

.activity-body {
  flex: 1;
}

.activity-text {
  color: var(--color-text-primary);
  margin-bottom: 2px;
}

.activity-time {
  font-size: 10px;
  color: var(--color-text-light);
}

/* ==========================================
   CARDS & LISTS (Leads, Quotations, Engineers)
   ========================================== */
.filter-header {
  background-color: var(--color-card);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-container {
  display: flex;
  align-items: center;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0 10px;
  height: 38px;
}

.search-icon {
  width: 16px;
  height: 16px;
  color: var(--color-text-secondary);
  margin-right: 8px;
}

.search-container input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  height: 100%;
}

.filter-row {
  display: flex;
  gap: 8px;
}

.filter-select {
  flex: 1;
  height: 34px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0 6px;
  font-size: 12px;
  outline: none;
}

.tabs-container {
  display: flex;
  background-color: var(--color-surface);
  padding: 3px;
  border-radius: var(--radius-md);
}

.tab-btn {
  flex: 1;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.tab-btn.active {
  background-color: var(--color-card);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.cards-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 24px;
}

.item-card {
  background-color: var(--color-card);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--color-primary);
  position: relative;
}

.item-card.won { border-left-color: var(--color-success); }
.item-card.lost { border-left-color: var(--color-danger); }
.item-card.open { border-left-color: var(--color-primary); }

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.card-title-row h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.card-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.card-badge.won { background-color: var(--color-success-light); color: var(--color-success); }
.card-badge.lost { background-color: var(--color-danger-light); color: var(--color-danger); }
.card-badge.open { background-color: rgba(23, 70, 158, 0.1); color: var(--color-primary); }

.card-details-row {
  font-size: 12px;
  color: var(--color-text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-action-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Floating Action Button (FAB) Triggered Quick Sheets */
.quick-action-sheet-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background-color: var(--color-card);
  color: var(--color-text-primary);
  font-weight: 600;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.quick-action-btn:active {
  background-color: var(--color-surface);
}

/* ==========================================
   QUOTATION BUILDER & PREVIEW
   ========================================== */
.wizard-step {
  background-color: var(--color-card);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

.wizard-step-header {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 8px;
}

.search-dropdown-results {
  max-height: 150px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  background-color: var(--color-card);
  box-shadow: var(--shadow-sm);
  display: none;
}

.search-result-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  cursor: pointer;
}

.search-result-item:active {
  background-color: var(--color-surface);
}

.selected-item-card {
  background-color: var(--color-accent-light);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.selected-item-card strong {
  font-size: 11px;
  color: var(--color-accent);
  text-transform: uppercase;
}

.selected-item-card div {
  font-size: 14px;
  font-weight: 600;
  margin-top: 2px;
}

.btn-clear {
  position: absolute;
  top: 12px;
  right: 12px;
}

/* Products lists builder row */
.qb-product-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.qb-product-item-row .product-name {
  flex: 2;
  font-size: 13px;
  font-weight: 600;
}

.qb-product-item-row .product-inputs {
  flex: 3;
  display: flex;
  align-items: center;
  gap: 8px;
}

.qb-product-item-row input {
  width: 70px;
  height: 36px;
  text-align: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-size: 13px;
  outline: none;
}

.qb-product-item-row .unit-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-secondary);
}

.quote-totals-summary-box {
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 16px;
  border: 1px dashed var(--color-border);
}

.summary-line {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}

.summary-line.grand-total-line {
  margin-bottom: 0;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
  font-weight: 700;
  font-size: 14px;
  color: var(--color-primary);
}

/* QUOTATION SCREENSHOT DOCUMENT TEMPLATE */
.quote-document-container {
  background-color: #FFFFFF;
  padding: 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  color: #1E293B;
}

.quote-doc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.quote-doc-logo {
  height: 32px;
  width: auto;
}

.quote-doc-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: 0.5px;
}

.quote-doc-headline {
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  color: var(--color-primary);
  margin-bottom: 12px;
}

.quote-doc-metadata {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--color-text-secondary);
  background-color: var(--color-surface);
  padding: 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.quote-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin-bottom: 12px;
}

.quote-doc-customer-box {
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.quote-doc-customer-box h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 6px;
}

.quote-doc-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
  font-size: 11px;
}

.quote-doc-table th {
  background-color: var(--color-primary);
  color: #FFFFFF;
  font-weight: 700;
  text-align: center;
  padding: 6px;
}

.quote-doc-table td {
  padding: 6px;
  border-bottom: 1px solid var(--color-border);
  text-align: center;
}

.quote-doc-table td:first-child {
  text-align: left;
  font-weight: 600;
}

.quote-doc-totals-box {
  background-color: var(--color-surface);
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  margin-bottom: 16px;
}

.total-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.total-row.grand-total {
  font-weight: 800;
  font-size: 14px;
  color: var(--color-accent);
  margin-top: 4px;
}

.quote-doc-footer {
  font-size: 11px;
  background-color: #F8FAFC;
  padding: 8px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.quote-doc-terms {
  font-size: 9px;
  color: var(--color-text-secondary);
  line-height: 1.3;
}

.quote-view-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
  padding-bottom: 24px;
}

/* ==========================================
   REPORTS & LEADERBOARDS
   ========================================== */
.report-section {
  background-color: var(--color-card);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.report-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 6px;
}

.reports-action-bar {
  display: flex;
  justify-content: flex-end;
}

/* Leaderboard Ranking list styling */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background-color: var(--color-surface);
  border-radius: var(--radius-md);
  font-size: 12px;
}

.leaderboard-rank {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: var(--color-border);
  color: var(--color-text-primary);
  font-weight: 700;
  display: flex;
  justify-content: center;
  align-items: center;
}

.leaderboard-row.rank-1 .leaderboard-rank { background-color: #FEF08A; color: #854D0E; } /* Gold */
.leaderboard-row.rank-2 .leaderboard-rank { background-color: #E2E8F0; color: #475569; } /* Silver */
.leaderboard-row.rank-3 .leaderboard-rank { background-color: #FFEDD5; color: #9A3412; } /* Bronze */

.leaderboard-info {
  flex: 1;
}

.leaderboard-name { font-weight: 600; }
.leaderboard-sp { font-size: 10px; color: var(--color-text-secondary); }

.leaderboard-stats {
  text-align: right;
}

.leaderboard-vol { font-weight: 700; color: var(--color-primary); }
.leaderboard-pct { font-size: 10px; color: var(--color-success); font-weight: 600; }

/* CSS-only Bar Chart Container */
.bar-chart-container {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 160px;
  padding-top: 20px;
  padding-bottom: 10px;
}

.bar-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  flex: 1;
}

.bar-rect {
  width: 30px;
  background: linear-gradient(180deg, var(--color-primary), rgba(23,70,158,0.5));
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  position: relative;
  transition: height 0.5s ease-out;
}

.bar-column:nth-child(even) .bar-rect {
  background: linear-gradient(180deg, var(--color-accent), rgba(215,32,39,0.5));
}

.bar-val {
  position: absolute;
  top: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.bar-lbl {
  font-size: 9px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-top: 6px;
  text-align: center;
  white-space: nowrap;
}

/* ==========================================
   ENGINEER PROFILE / TARGET DISPLAY
   ========================================== */
.eng-detail-header-card {
  background-color: var(--color-primary);
  color: #FFFFFF;
  border-radius: var(--radius-md);
  padding: 20px 16px;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.eng-detail-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.eng-detail-title-row h3 { font-size: 18px; font-weight: 700; }
.eng-detail-area { font-size: 12px; opacity: 0.8; }

.eng-detail-phone {
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-card {
  background-color: var(--color-card);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.profile-card-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 6px;
}

.profile-info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #F8FAFC;
  font-size: 13px;
}

.profile-info-row:last-child { border-bottom: none; }
.profile-info-lbl { color: var(--color-text-secondary); }
.profile-info-val { font-weight: 600; color: var(--color-text-primary); }

.profile-action-box {
  background-color: var(--color-card);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.profile-action-box h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 16px;
}

/* ==========================================
   INITIAL MODALS (TARGET INITIALIZER)
   ========================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0,0,0,0.7);
  z-index: 500;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-card {
  width: 90%;
  max-width: 400px;
  background-color: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  text-align: center;
}

.modal-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 12px;
}

.modal-card p {
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

/* Skeleton Loading Screens */
.skeleton-loader {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-card {
  height: 90px;
  background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.no-data-msg {
  text-align: center;
  padding: 30px;
  color: var(--color-text-secondary);
  font-size: 13px;
}

/* Spinner helper */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: transparent;
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ==========================================
   NOTIFICATIONS PANEL & HEADER BELL
   ========================================== */
.header-notif-container {
  position: relative;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.notif-icon {
  width: 24px;
  height: 24px;
  color: #FFFFFF;
}

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: var(--color-accent);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  border-radius: var(--radius-full);
  min-width: 16px;
  height: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 4px;
  border: 2px solid var(--color-primary);
}

.notif-dropdown {
  position: fixed;
  top: 60px;
  right: 16px;
  width: 320px;
  max-height: 400px;
  background-color: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 999;
  display: none;
  flex-direction: column;
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.notif-dropdown.active {
  display: flex;
}

.notif-dropdown-header {
  padding: 12px 16px;
  background-color: #F8FAFC;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
}

.notif-dropdown-list {
  overflow-y: auto;
  flex: 1;
}

.notif-dropdown-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  cursor: pointer;
  background-color: #FFFFFF;
  transition: background-color var(--transition-fast);
}

.notif-dropdown-item:active {
  background-color: var(--color-surface);
}

.notif-dropdown-item.unread {
  background-color: #F0FDF4; /* Light success green for unread alerts */
}

.notif-item-title {
  font-weight: 700;
  color: var(--color-text-primary);
}

.notif-item-msg {
  color: var(--color-text-secondary);
  line-height: 1.4;
}

.notif-item-time {
  font-size: 9px;
  color: var(--color-text-light);
  align-self: flex-end;
}

.notif-empty-state {
  text-align: center;
  padding: 24px;
  color: var(--color-text-light);
  font-size: 12px;
}

/* ==========================================
   AREA MASTER & LOSS REASON STYLES
   ========================================== */
.table-container {
  width: 100%;
  overflow-x: auto;
  background-color: var(--color-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-top: 12px;
}

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

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

.data-table th {
  background-color: #F8FAFC;
  font-weight: 700;
  color: var(--color-text-secondary);
}

.data-table tr:hover {
  background-color: #FAFBFC;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-indicator::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-text-light);
}

.status-indicator.active { color: var(--color-success); }
.status-indicator.active::before { background-color: var(--color-success); }
.status-indicator.disabled { color: var(--color-danger); }
.status-indicator.disabled::before { background-color: var(--color-danger); }

/* Switch Slider */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--color-border);
  transition: .4s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--color-success);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.loss-reason-form-group {
  margin-top: 10px;
  animation: fadeIn 0.3s;
}

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

/* ==========================================
   DESKTOP RESPONSIVE SIDEBAR LAYOUT
   ========================================== */
@media screen and (min-width: 768px) {
  /* Desktop layout grid */
  body.logged-in {
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-rows: 56px 1fr;
    grid-template-areas: 
      "drawer header"
      "drawer main";
    height: 100vh;
    width: 100%;
    overflow: hidden;
  }
  
  body.logged-in .app-drawer {
    grid-area: drawer;
    display: flex !important;
    position: relative;
    height: 100%;
    width: 280px;
    left: auto !important;
    border-right: 1px solid var(--color-border);
    box-shadow: none;
    background-color: var(--color-card);
    z-index: 10;
  }
  
  body.logged-in .app-header {
    grid-area: header;
    position: relative;
    top: auto;
    left: auto !important;
    width: 100% !important;
    height: 56px;
    padding: 0 24px;
    z-index: 10;
  }
  
  body.logged-in .app-content-container {
    grid-area: main;
    position: relative;
    width: 100% !important;
    height: 100% !important;
    padding-left: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    overflow: hidden;
  }
  
  body.logged-in .app-page {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    padding: 24px 32px !important;
    overflow-y: auto !important;
  }
  
  .app-tabbar {
    display: none !important;
  }
  
  body:not(.logged-in) .app-drawer {
    display: none !important;
  }
  
  .drawer-overlay {
    display: none !important;
  }
  
  .app-header #header-menu-btn {
    pointer-events: none;
    display: none !important; /* Hide menu toggler on desktop */
  }

  /* Show header user name for ASO/above on desktop, hide for influencer on desktop */
  body.logged-in.role-influencer .app-header .header-user-name {
    display: none !important;
  }
  body.logged-in:not(.role-influencer) .app-header .header-user-name {
    display: inline-block !important;
  }
  
  /* Flexbox rules to expand chart on desktop */
  #page-dashboard {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    box-sizing: border-box !important;
  }
  #dashboard-content {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
  }
  #dashboard-content .activity-feed-card {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    margin-bottom: 0 !important;
  }
  #dashboard-content .bar-chart-container {
    flex: 1 !important;
    height: auto !important;
  }
  
  .kpi-cards-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)) !important;
    gap: 8px !important;
    margin-bottom: 8px !important;
  }
  
  .more-menu-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  
  .dashboard-circle-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px !important;
    margin-bottom: 8px !important;
    width: 100%;
  }
  
  .dashboard-circle-cards-grid .dashboard-circle-card {
    max-width: 100% !important;
    display: flex !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
  }
  
  .app-header .header-user-name {
    display: none !important;
  }

  /* Center Bottom Sheet Modal on Desktop */
  body.logged-in .bottom-sheet {
    left: calc(50% + 140px) !important;
    transform: translateX(-50%) !important;
    width: 500px !important;
    border-radius: var(--radius-lg) !important;
  }
  
  body.logged-in .bottom-sheet.active {
    bottom: 40px !important;
  }
  
  .quote-document-container {
    max-width: 650px;
    margin: 0 auto;
  }
  
  .notif-dropdown {
    right: 24px;
  }
}

/* ==========================================
   PULL TO REFRESH COMPONENT
   ========================================== */
.pull-to-refresh-container {
  position: fixed;
  top: 56px; /* Place directly below header */
  left: 50%;
  transform: translate3d(-50%, -60px, 0) scale(0);
  width: 40px;
  height: 40px;
  background-color: var(--color-card);
  border-radius: var(--radius-full);
  box-shadow: 0 4px 10px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.05);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.15s ease-out, opacity 0.15s ease-out;
}

.pull-to-refresh-container.pulling {
  transition: none; /* No transition while dragging for instant feedback */
}

.pull-to-refresh-container.refreshing {
  transform: translate3d(-50%, 16px, 0) scale(1);
  opacity: 1;
}

.pull-to-refresh-circle {
  width: 24px;
  height: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--color-primary);
}

.pull-to-refresh-icon {
  width: 18px;
  height: 18px;
  transform: rotate(0deg);
  transition: transform 0.1s linear;
}

.pull-to-refresh-container.refreshing .pull-to-refresh-icon {
  animation: spin 0.8s linear infinite;
}

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

/* Adjust center position on desktop screens since sidebar is 280px */
@media (min-width: 768px) {
  .pull-to-refresh-container {
    left: calc(50% + 140px);
  }
}

/* Card Pen Edit Button (Influencer Lead Card) */
.card-pen-edit-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background-color: #E2E8F0;
  color: #64748B;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
}

.card-pen-edit-btn:active {
  transform: scale(0.9);
  background-color: #CBD5E1;
}

.card-pen-edit-btn svg {
  width: 12px;
  height: 12px;
}

/* ==========================================
   MONTHLY SALES VIEW & PAGINATION
   ========================================== */
.monthly-sales-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 4px 24px 4px;
}

.monthly-sales-hero {
  position: relative;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  color: #ffffff;
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(23, 70, 158, 0.15);
}

.monthly-sales-hero .hero-subtitle {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  opacity: 0.8;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}

.monthly-sales-hero .hero-title {
  font-size: 26px;
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.month-navigator-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--color-card);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.nav-arrow-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-arrow-btn:active {
  transform: scale(0.9);
  background-color: var(--color-border);
}

.nav-arrow-btn svg {
  width: 16px;
  height: 16px;
}

.nav-month-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-text-primary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sales-table-card {
  background: var(--color-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.sales-list-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.sales-list-table th {
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
}

.sales-list-table td {
  padding: 14px 16px;
  color: var(--color-text-primary);
  font-size: 13px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.sales-list-table tr:last-child td {
  border-bottom: none;
}

.sales-list-table tr:active {
  background: var(--color-surface);
}

.sales-list-table .text-right {
  text-align: right;
}

.sales-list-table .sales-qty-badge {
  font-weight: 700;
  color: var(--color-text-primary);
}

.sales-list-table .sales-date-col {
  font-weight: 600;
  color: var(--color-text-secondary);
}

.sales-list-table .sales-customer-name {
  font-weight: 700;
  color: var(--color-text-primary);
}

.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.pagination-btn {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagination-btn:active:not(:disabled) {
  background: var(--color-surface);
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin: 0 8px;
}

/* Collapsible profile box styling */
.collapsible-box {
  transition: all var(--transition-normal);
}

.collapsible-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.collapsible-header h3 {
  margin: 0;
}

.collapsible-box .chevron-icon {
  width: 20px;
  height: 20px;
  color: var(--color-text-secondary);
  transition: transform var(--transition-fast);
}

.collapsible-box.open-box .chevron-icon {
  transform: rotate(180deg);
}

/* ==========================================
   ASO POLISH ADDITIONS (V3)
   ========================================== */

/* 1. Hide Sidebar completely on mobile viewports */
@media (max-width: 767px) {
  .app-drawer, .drawer-overlay {
    display: none !important;
  }
}

/* 2. Floating More Menu Card */
.more-menu-card {
  position: fixed;
  bottom: calc(60px + env(safe-area-inset-bottom));
  left: 12px;
  right: 12px;
  background-color: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.15);
  z-index: 99;
  padding: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
}
.more-menu-card.active {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.more-menu-card-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-secondary);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 6px;
}
.more-menu-grid-content {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.more-menu-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--color-text-secondary);
  font-size: 9px;
  font-weight: 600;
  text-align: center;
  padding: 8px 4px;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
  cursor: pointer;
}
.more-menu-item:active {
  background-color: var(--color-background-subtle);
  transform: scale(0.95);
}
.more-menu-item svg {
  width: 22px;
  height: 22px;
  margin-bottom: 6px;
  color: var(--color-text-primary);
}
.more-menu-item.logout-item svg {
  color: var(--color-danger);
}
.more-menu-item.logout-item {
  color: var(--color-danger);
}

/* 3. Range Status Slider custom styling */
.status-range-input {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border-radius: 5px;
  background: #E5E7EB;
  outline: none;
  margin: 16px 0;
}
.status-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  border: 2px solid #ffffff;
  transition: transform 0.1s ease;
}
.status-range-input::-webkit-slider-thumb:active {
  transform: scale(1.2);
}
.status-slider-labels span {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all 0.2s ease;
  padding: 4px 8px;
  border-radius: 4px;
}
.status-slider-labels span.active-status {
  font-size: 13px;
  font-weight: 700;
  transform: scale(1.1);
  color: #ffffff !important;
}
.status-slider-labels span.active-status.blue {
  background-color: var(--color-primary);
}
.status-slider-labels span.active-status.green {
  background-color: var(--color-success);
}
.status-slider-labels span.active-status.red {
  background-color: var(--color-danger);
}

/* 4. Sales Table Viewport Height lock */
#page-reports {
  overflow: hidden !important;
}
#page-reports.active-page {
  display: flex !important;
  flex-direction: column;
}
#page-reports .monthly-sales-container {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 4px 12px 4px;
}
#page-reports .sales-table-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#page-reports .table-responsive {
  flex: 1;
  overflow-y: auto;
}

