/* ==========================================================================
   HELTARA CRM - UI COMPONENTS
   KPI Cards, Tables, Badges, Kanban, Activity Timeline, Modals, Forms
   ========================================================================== */

/* Page Headers & Action Bars */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title-group h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--dark-slate);
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Primary, Secondary, and Outline Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(215, 25, 45, 0.25);
}
.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 10px rgba(215, 25, 45, 0.35);
  color: #FFF;
}

.btn-secondary {
  background: var(--secondary);
  color: #FFFFFF;
}
.btn-secondary:hover {
  background: var(--secondary-hover);
  color: #FFF;
}

.btn-outline {
  background: #FFFFFF;
  border-color: var(--border-color);
  color: var(--text-main);
}
.btn-outline:hover {
  background: var(--surface-alt);
  border-color: var(--border-strong);
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-whatsapp {
  background: #25D366;
  color: #FFFFFF;
}
.btn-whatsapp:hover {
  background: #1EBE5D;
  color: #FFF;
}

.btn-icon-only {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-md);
}

/* ==========================================================================
   KPI STATS CARDS
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--secondary);
}

.stat-card.primary::before { background: var(--primary); }
.stat-card.accent::before { background: var(--accent); }
.stat-card.danger::before { background: var(--color-danger); }
.stat-card.success::before { background: var(--color-success); }

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

.stat-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: var(--surface-alt);
  color: var(--secondary);
}

.stat-icon.red { background: var(--primary-light); color: var(--primary); }
.stat-icon.orange { background: var(--accent-light); color: var(--accent); }
.stat-icon.green { background: var(--color-success-bg); color: var(--color-success); }

.stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--dark-slate);
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-meta {
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-meta.pulse-danger {
  color: var(--color-danger);
  font-weight: 700;
  animation: pulseRed 2s infinite;
}

@keyframes pulseRed {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* ==========================================================================
   WHAT SHOULD I DO NEXT BANNER WIDGET
   ========================================================================== */
.next-action-banner {
  background: linear-gradient(135deg, #0F3D5E, #1A547E);
  color: #FFFFFF;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 14px rgba(15, 61, 94, 0.2);
  position: relative;
  overflow: hidden;
}

.next-action-banner::after {
  content: '';
  position: absolute;
  right: -20px;
  bottom: -20px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
}

.next-action-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.next-action-badge {
  background: var(--primary);
  color: #FFF;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
}

.next-action-content h4 {
  color: #FFFFFF;
  font-size: 15px;
  font-weight: 700;
}

.next-action-content p {
  color: #BAE6FD;
  font-size: 12.5px;
}

/* ==========================================================================
   PIPELINE FUNNEL WIDGET (DASHBOARD)
   ========================================================================== */
.funnel-container {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

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

.funnel-step {
  background: var(--surface-alt);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 12px;
  text-align: center;
  position: relative;
  transition: all var(--transition-fast);
}

.funnel-step:hover {
  border-color: var(--secondary);
  background: #FFFFFF;
  box-shadow: var(--shadow-md);
}

.funnel-step-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.funnel-step-count {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--dark-slate);
}

.funnel-step-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  margin-top: 2px;
}

.funnel-step-rate {
  font-size: 10.5px;
  color: var(--text-light);
  margin-top: 4px;
}

/* ==========================================================================
   DATA TABLES & CARD LISTS
   ========================================================================== */
.card-container {
  background: var(--surface-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-header-bar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.card-header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--dark-slate);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

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

.data-table th {
  background: #F8FAFC;
  padding: 12px 16px;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

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

.data-table tbody tr {
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: #F1F5F9;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-hot { background: var(--priority-hot-bg); color: var(--priority-hot); }
.badge-warm { background: var(--priority-warm-bg); color: var(--priority-warm); }
.badge-cold { background: var(--priority-cold-bg); color: var(--priority-cold); }

.badge-status {
  background: #E2E8F0;
  color: var(--dark-slate);
  font-size: 11px;
  padding: 3px 8px;
}
.badge-status.new { background: #E0E7FF; color: #4338CA; }
.badge-status.contacted { background: #FEF3C7; color: #B45309; }
.badge-status.requirement { background: #FCE7F3; color: #BE185D; }
.badge-status.site_visit { background: #E0F2FE; color: #0369A1; }
.badge-status.quotation { background: #EDE9FE; color: #6D28D9; }
.badge-status.negotiation { background: #FFEDD5; color: #C2410C; }
.badge-status.won { background: #DCFCE7; color: #15803D; }
.badge-status.lost { background: #FEE2E2; color: #B91C1C; }

.badge-inactive {
  background: #FEF2F2;
  color: #DC2626;
  border: 1px dashed #EF4444;
}

.badge-model {
  background: #F1F5F9;
  border: 1px solid #CBD5E1;
  color: var(--secondary);
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ==========================================================================
   KANBAN PIPELINE BOARD
   ========================================================================== */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: calc(100vh - 180px);
}

.kanban-column {
  flex: 0 0 310px;
  background: #F1F5F9;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
}

.kanban-col-header {
  padding: 12px 16px;
  border-bottom: 2px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #FFFFFF;
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.kanban-col-title {
  font-weight: 800;
  font-size: 13.5px;
  color: var(--dark-slate);
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-cards-area {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kanban-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-xs);
  cursor: grab;
  transition: all var(--transition-fast);
  position: relative;
}

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

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

.kanban-business-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--dark-slate);
  margin-bottom: 4px;
  line-height: 1.3;
}

.kanban-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.kanban-card-price {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 15px;
  color: var(--primary);
}

.kanban-next-action-pill {
  background: var(--surface-alt);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--secondary);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  border-left: 3px solid var(--accent);
}

/* ==========================================================================
   ACTIVITY TIMELINE
   ========================================================================== */
.timeline {
  position: relative;
  padding: 16px 0 16px 28px;
}

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

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-dot {
  position: absolute;
  left: -28px;
  top: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 2px solid var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

.timeline-item.hot .timeline-dot {
  border-color: var(--primary);
  color: var(--primary);
}

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

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

.timeline-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--dark-slate);
}

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

.timeline-body {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ==========================================================================
   MODALS & FORMS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10500;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

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

.modal-dialog {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  transform: translateY(20px);
  transition: transform var(--transition-normal);
  overflow: hidden;
}

.modal-overlay.active .modal-dialog {
  transform: translateY(0);
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #F8FAFC;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--dark-slate);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: #F8FAFC;
}

/* Form Groups */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-grid.single {
  grid-template-columns: 1fr;
}

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

.form-group.col-span-2 {
  grid-column: span 2;
}

.form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
}

.form-label.required::after {
  content: ' *';
  color: var(--primary);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #FFFFFF;
  color: var(--text-main);
  outline: none;
  font-size: 13.5px;
  transition: all var(--transition-fast);
}

.form-textarea {
  height: auto;
  min-height: 80px;
  padding: 10px 12px;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(15, 61, 94, 0.1);
}

/* Filter Controls Bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: #F8FAFC;
  border-bottom: 1px solid var(--border-color);
}

.filter-input {
  height: 34px;
  padding: 0 10px;
  font-size: 12.5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: #FFFFFF;
  outline: none;
}

/* Tabs */
.tab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
  overflow-x: auto;
}

.tab-btn {
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--primary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Toast Container */
#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 120;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: #FFFFFF;
  border-left: 4px solid var(--secondary);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 400px;
  font-size: 13px;
  animation: slideInRight 0.3s ease-out;
}

.toast.success { border-left-color: var(--color-success); }
.toast.danger { border-left-color: var(--primary); }
.toast.warning { border-left-color: var(--color-warning); }

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 42px;
  margin-bottom: 12px;
  color: var(--text-light);
}
.empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--dark-slate);
  margin-bottom: 6px;
}

/* ==========================================================================
   PIPELINE STAGE TABS & RESPONSIVE KANBAN STYLES
   ========================================================================== */
.pipeline-stage-tabs-bar,
.mobile-kanban-tabs-bar {
  display: flex;
  overflow-x: auto;
  white-space: nowrap;
  gap: 8px;
  padding: 6px 2px 12px 2px;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.m-kanban-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.15s;
  touch-action: manipulation;
  flex-shrink: 0;
}
.m-kanban-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.m-kanban-pill.active {
  background: var(--dark-slate);
  color: #FFFFFF;
  border-color: var(--dark-slate);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25);
}
.m-pill-cnt {
  background: rgba(15, 23, 42, 0.08);
  color: var(--dark-slate);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.m-kanban-pill.active .m-pill-cnt {
  background: var(--primary);
  color: #FFFFFF;
}

.kanban-column.stage-hidden {
  display: none !important;
}

.kanban-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
  flex-wrap: wrap;
}
.btn-card-action {
  flex: 1;
  min-width: 70px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}
.btn-card-action:active {
  transform: scale(0.96);
}
.btn-card-action.call {
  background: #EFF6FF;
  color: #1D4ED8;
  border-color: #BFDBFE;
}
.btn-card-action.wa {
  background: #ECFDF5;
  color: #047857;
  border-color: #A7F3D0;
}
.btn-card-action.edit {
  background: #FEF3C7;
  color: #92400E;
  border-color: #FCD34D;
  font-weight: 700;
}
.btn-card-action.edit:active {
  background: #FDE68A;
  transform: scale(0.94);
}
.btn-card-action.move {
  background: #FFF7ED;
  color: #C2410C;
  border-color: #FED7AA;
}
.btn-card-action.view {
  background: #F8FAFC;
  color: var(--dark-slate);
  border-color: #CBD5E1;
}

.btn-mobile-edit {
  background: #FEF3C7 !important;
  color: #92400E !important;
  border: 1.5px solid #F59E0B !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.15) !important;
  touch-action: manipulation;
}
.btn-mobile-edit:active {
  background: #FDE68A !important;
  transform: scale(0.95);
}

/* ==========================================================================
   UNIVERSAL MOBILE CARDS DESIGN SYSTEM (Phone View for all modules)
   ========================================================================== */
.mobile-cards-container,
.mobile-followups-cards,
.mobile-leads-cards,
.mobile-quotes-cards,
.mobile-orders-cards,
.mobile-customers-cards,
.mobile-payments-cards,
.mobile-visits-cards,
.mobile-service-cards,
.show-on-mobile {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.m-card, .m-fu-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.m-card:active {
  transform: scale(0.99);
}

.m-card.highlight {
  border-left: 4px solid var(--primary);
}

.m-card-top, .m-fu-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.m-card-title, .m-fu-card-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--dark-slate);
  line-height: 1.3;
  cursor: pointer;
}

.m-card-title:hover {
  color: var(--primary);
}

.m-card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.m-card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  background: #F8FAFC;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  border: 1px solid #F1F5F9;
}

.m-card-row {
  display: flex;
  flex-direction: column;
}

.m-card-row-full {
  grid-column: 1 / -1;
}

.m-card-lbl {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.m-card-val {
  font-weight: 600;
  color: var(--dark-slate);
  margin-top: 1px;
}

.m-card-val.price {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 14px;
  color: var(--primary);
}

.m-card-val.price-success {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 14px;
  color: var(--color-success);
}

.m-card-next-action {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.m-card-actions, .m-fu-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.m-card-actions .btn {
  flex: 1;
  min-width: 80px;
  height: 34px;
  font-size: 12px;
  justify-content: center;
  padding: 0 8px;
}

/* Pipeline Stage Summary Banner (Mobile) */
.pipeline-mobile-summary {
  display: none;
  background: linear-gradient(135deg, #0F172A, #1E293B);
  color: #FFFFFF;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 12px;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
}

.pipeline-mobile-summary strong {
  font-family: 'Outfit', sans-serif;
  color: #F87171;
  font-size: 14px;
}

/* Stage Move Modal Sheet */
.stage-move-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.stage-move-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--dark-slate);
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
  text-align: left;
}

.stage-move-btn:active, .stage-move-btn.current {
  background: #EFF6FF;
  border-color: #3B82F6;
  color: #1D4ED8;
}

/* Modal Bottom Sheet Drag Handle */
.modal-drag-handle {
  width: 40px;
  height: 4px;
  background: #CBD5E1;
  border-radius: 2px;
  margin: 8px auto 4px auto;
  display: none;
}

/* --------------------------------------------------------------------------
 * MOBILE MEDIA QUERIES (TABLES -> CARDS, FILTER GRIDS, KANBAN)
 * -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .mobile-kanban-tabs-bar {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding-bottom: 8px;
    margin-bottom: 14px;
    scrollbar-width: none;
    position: sticky;
    top: 0;
    z-index: 15;
    background: var(--bg-app);
    padding-top: 4px;
  }
  .mobile-kanban-tabs-bar::-webkit-scrollbar {
    display: none;
  }

  .m-kanban-pill {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 700;
  }

  .pipeline-mobile-summary {
    display: flex;
  }

  .kanban-column.m-hidden {
    display: none !important;
  }
  .kanban-board {
    overflow-x: visible;
    flex-direction: column;
    padding-bottom: 20px;
  }
  .kanban-column {
    min-width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 16px;
  }

  /* Show mobile card containers, hide wide desktop tables */
  .mobile-cards-container,
  .mobile-followups-cards,
  .mobile-leads-cards,
  .mobile-quotes-cards,
  .mobile-orders-cards,
  .mobile-customers-cards,
  .mobile-payments-cards,
  .mobile-visits-cards,
  .mobile-service-cards,
  .show-on-mobile {
    display: flex !important;
  }

  .card-table-wrapper.hide-on-mobile {
    display: none !important;
  }

  /* 2-Column Compact Filter Grid on Mobile */
  .filter-bar {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  .filter-input, .filter-bar select, .filter-bar input {
    width: 100% !important;
    min-width: 0 !important;
    height: 36px !important;
    font-size: 12.5px !important;
    box-sizing: border-box;
  }
  .filter-bar input[type="text"],
  #lead-filter-search {
    grid-column: 1 / -1 !important;
  }
  .filter-bar .btn {
    height: 36px;
    font-size: 12px;
  }

  .modal-drag-handle {
    display: block;
  }
}

/* ==========================================================================
   MULTI-USER AUTHENTICATION & LOGIN UI
   ========================================================================== */
#login-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #0F172A 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
  box-sizing: border-box;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #FFFFFF;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  padding: 36px 32px;
  box-sizing: border-box;
  animation: loginFadeIn 0.35s ease-out;
}

@keyframes loginFadeIn {
  from { opacity: 0; transform: translateY(15px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-badge {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--primary, #D7192D);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 900;
  box-shadow: 0 6px 16px rgba(215, 25, 45, 0.4);
  margin-bottom: 12px;
}

.login-brand-title {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 900;
  color: #0F172A;
  margin: 0;
  letter-spacing: -0.5px;
}

.login-brand-sub {
  font-size: 13px;
  color: var(--text-muted, #64748B);
  font-weight: 500;
  margin-top: 4px;
}

.login-form .form-group {
  margin-bottom: 18px;
}

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper .form-input {
  padding-right: 42px;
}

.btn-toggle-password {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #64748B;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

.btn-toggle-password:hover {
  color: #0F172A;
}

.login-options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #475569;
  margin-bottom: 22px;
}

.login-options-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.login-btn-submit {
  width: 100%;
  height: 44px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* ADMIN VIEW BANNER */
#admin-view-banner {
  background: linear-gradient(90deg, #D97706 0%, #B45309 100%);
  color: #FFFFFF;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 900;
}

#admin-view-banner .btn-exit-view {
  background: #FFFFFF;
  color: #B45309;
  border: none;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

#admin-view-banner .btn-exit-view:hover {
  background: #FEF3C7;
}

/* User Profile Menu Dropdown */
.user-profile {
  position: relative;
  cursor: pointer;
}

.user-profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: #FFFFFF;
  border: 1px solid var(--border-color, #E2E8F0);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
  width: 220px;
  padding: 8px 0;
  display: none;
  z-index: 1000;
  animation: menuDrop 0.2s ease;
}

.user-profile-menu.open {
  display: block;
}

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

.user-profile-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: #1E293B;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.user-profile-menu-item:hover {
  background: #F8FAFC;
  color: var(--primary, #D7192D);
}

.forgot-password-link {
  color: var(--primary, #D7192D);
  font-weight: 600;
  font-size: 12.5px;
  text-decoration: none;
  transition: color 0.15s ease;
}

.forgot-password-link:hover {
  text-decoration: underline;
  color: #B91C1C;
}

.login-help-footer {
  margin-top: 22px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted, #64748B);
  padding-top: 16px;
  border-top: 1px solid #F1F5F9;
}

.login-help-footer a {
  color: var(--secondary, #0F172A);
  font-weight: 700;
  text-decoration: none;
  margin-left: 4px;
}

.login-help-footer a:hover {
  text-decoration: underline;
  color: var(--primary, #D7192D);
}

/* ==========================================================================
   ROLE & PERMISSION MASTER STYLES
   ========================================================================== */
.role-matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.role-card {
  background: #FFFFFF;
  border: 1px solid var(--border-color, #E2E8F0);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.role-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.role-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.role-badge-pill {
  font-family: monospace;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  background: #EFF6FF;
  color: #1E40AF;
  border: 1px solid #BFDBFE;
}

.role-perm-group {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.perm-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: #F1F5F9;
  color: #334155;
  border: 1px solid #E2E8F0;
}

.perm-pill.active {
  background: #ECFDF5;
  color: #065F46;
  border-color: #A7F3D0;
}

.perm-pill.full-admin {
  background: #FEF2F2;
  color: #991B1B;
  border-color: #FECACA;
  font-weight: 700;
}

/* ==========================================================================
   PASSWORD RECOVERY & HELPDESK MODAL STYLES
   ========================================================================== */
.recovery-box {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 18px;
}

.recovery-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 12px;
  margin: 12px 0;
}

.helpdesk-contact-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.btn-whatsapp {
  background: #25D366;
  color: #FFFFFF;
  border: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-whatsapp:hover {
  opacity: 0.9;
  color: #FFFFFF;
}

.btn-phone {
  background: #0F172A;
  color: #FFFFFF;
  border: none;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-phone:hover {
  opacity: 0.9;
  color: #FFFFFF;
}

/* ==========================================================================
   MOBILE COMFORT & TOUCH OPTIMIZATIONS
   ========================================================================== */
@media (max-width: 768px) {
  .login-card {
    padding: 28px 20px;
    border-radius: 16px;
    max-width: 95%;
  }

  .login-brand-title {
    font-size: 22px;
  }

  .form-input, .form-select, .form-textarea, .btn {
    min-height: 44px;
    font-size: 14px;
  }

  .tab-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 6px;
    margin-bottom: 16px;
  }

  .tab-nav::-webkit-scrollbar {
    display: none;
  }

  .tab-nav .tab-btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 8px 14px;
    font-size: 12.5px;
    border-radius: 20px;
  }

  .modal-dialog {
    width: 95% !important;
    max-width: 95% !important;
    margin: 10px auto;
    max-height: 90vh;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
  }

  .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
  }

  .card-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-fab {
    bottom: calc(68px + env(safe-area-inset-bottom, 0px)) !important;
    right: 16px !important;
    width: 52px;
    height: 52px;
  }

  .role-matrix-grid {
    grid-template-columns: 1fr;
  }

  .helpdesk-contact-row {
    flex-direction: column;
  }
}


