/* ==========================================================================
   ERP Web Theme - Modern & Premium Stylesheet
   ========================================================================== */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

/* --- CSS Variables --- */
:root {
  /* Premium Colors (Solid #097174 for Agribliss - default theme).
     Companies can override --primary-orange / --primary-orange-gradient /
     --primary-shadow / --primary-shadow-light / --primary-shadow-lighter
     via an inline <style> block in the layout, based on their own
     theme_color / theme_gradient columns. */
  --primary-orange: #097174;
  --primary-orange-gradient: #097174;
  --primary-shadow: rgba(0, 158, 96, 0.35);
  --primary-shadow-light: rgba(255, 126, 6, 0.1);
  --primary-shadow-lighter: rgba(255, 126, 6, 0.08);
  --sidebar-bg: #ffffff;
  --bg-light: #F4F7FE; /* Soft cool grey/blue background */
  
  --text-main: #2B3674; /* Deep professional blue for text */
  --text-muted: #A3AED0;
  
  /* Modern Card Colors - Solid professional colors */
  --card-purple: #8A2BE2;
  --card-green: #05CD99;
  --card-teal: #00B5D8;
  --card-blue: #4318FF;
  --card-red: #EE5D50;
  
  /* Status Colors */
  --status-dark: #111C44;
  --status-success: #05CD99;
  --status-success-light: rgba(5, 205, 153, 0.15);
  --status-danger: #EE5D50;
  --status-danger-light: rgba(238, 93, 80, 0.15);
  --status-purple: #3B82F6;
  --status-purple-light: rgba(59, 130, 246, 0.15);

  /* Fonts */
  --font-main: 'Plus Jakarta Sans', sans-serif;
  
  /* Shadows & Borders */
  --shadow-soft: 0px 18px 40px rgba(112, 144, 176, 0.12);
  --shadow-hover: 0px 20px 50px rgba(112, 144, 176, 0.2);
  --border-radius-xl: 24px;
  --border-radius-lg: 16px;
  --border-radius-md: 10px;
}

/* --- Global Styles --- */
html, body {
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-light);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
}

/* --- Utilities --- */
.text-orange { color: var(--primary-orange) !important; }
.bg-orange { background: var(--primary-orange-gradient) !important; color: white !important; }
.text-success { color: var(--status-success) !important; }
.text-danger { color: var(--status-danger) !important; }
.text-primary { color: var(--status-purple) !important; }

/* Custom Cards */
.card {
  background: white;
  border-radius: var(--border-radius-xl) !important;
  box-shadow: var(--shadow-soft) !important;
  border: none !important;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* Custom Buttons */
.btn {
  border-radius: 12px;
  padding: 10px 20px;
  font-weight: 600;
  transition: all 0.3s ease;
  border: none;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

/* --- Header / Top App Bar --- */
.app-header {
  background: var(--primary-orange-gradient);
  color: white;
  padding: 20px 30px;
  border-bottom-left-radius: 30px;
  border-bottom-right-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 10px 30px var(--primary-shadow);
  margin-bottom: 30px;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.app-header .header-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.5px;
}

.app-header .header-actions i {
  font-size: 1.3rem;
  margin-left: 20px;
  cursor: pointer;
  transition: transform 0.2s;
}

.app-header .header-actions i:hover {
  transform: scale(1.15);
}

/* Filled circular icon buttons in the header (e.g. notification bell) */
.header-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.05rem;
  transition: background 0.2s ease, transform 0.2s ease;
}
.header-icon-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  color: white;
  transform: scale(1.06);
}

/* Notification unread-count badge - fixed circular size regardless of
   digit count, white ring so it "pops" off any per-company header color. */
.header-icon-btn .notif-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF6B6B 0%, #E11D48 100%);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* --- Sidebar (Desktop) --- */
.app-sidebar {
  width: 280px;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  background-color: var(--sidebar-bg);
  box-shadow: var(--shadow-soft);
  z-index: 1040;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px 15px 16px;
  color: var(--text-main);
  text-align: left;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 90px;
}
.sidebar-header img {
  max-height: 65px;
  max-width: 240px;
  object-fit: contain;
  border-radius: 8px;
  transition: opacity 0.3s ease;
}
.sidebar-header i {
  color: var(--primary-orange);
  font-size: 1.6rem;
}

.sidebar-nav {
  list-style: none;
  padding: 0 15px;
  margin: 0;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  padding: 14px 20px;
  color: var(--text-muted);
  font-weight: 600;
  border-radius: 14px;
  margin-bottom: 8px;
}

.sidebar-nav li a i {
  margin-right: 15px;
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
  transition: color 0.3s;
}

.sidebar-nav li a:hover,
.sidebar-nav li a.active {
  background: var(--primary-orange-gradient);
  color: white;
  box-shadow: 0 8px 20px var(--primary-shadow);
}

.sidebar-nav li a:hover i,
.sidebar-nav li a.active i {
  color: white;
}

/* --- Main Layout Wrapper --- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.app-content {
  flex-grow: 1;
  padding: 0 30px 40px;
  margin-left: 280px; /* Offset for sidebar */
  transition: margin-left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0; /* Prevents overflow content from expanding the main page */
  width: 100%;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.show {
    transform: translateX(0);
  }
  .app-content {
    margin-left: 0;
    padding: 0 15px 30px;
  }
  .app-header {
    border-radius: 0 0 20px 20px;
  }
}

/* --- Dashboard Specific Styles --- */
.welcome-text {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-muted);
}

.welcome-name {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 30px;
  letter-spacing: -1px;
}

/* Dashboard Menu Cards */
.menu-card {
  background: white;
  border-radius: var(--border-radius-xl);
  display: flex;
  align-items: center;
  padding: 20px 25px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-soft);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  border: none;
}

.menu-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.menu-icon-box {
  width: 65px;
  height: 65px;
  border-radius: var(--border-radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 20px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.menu-icon-box i {
  font-size: 1.8rem;
  color: white;
}

/* Icon Box Colors */
.bg-purple { background: var(--card-purple); }
.bg-green { background: var(--card-green); }
.bg-teal { background: var(--card-teal); }
.bg-blue { background: var(--card-blue); }
.bg-red { background: var(--card-red); }

/* Soft teal icon circle (Dashboard "Orders" KPI) - bg-purple/bg-opacity-10
   don't combine (bg-purple is a solid !important background, opacity
   utilities need Bootstrap's own rgb-variable colors), which rendered as a
   solid purple blob instead of the soft pastel circle every other KPI uses. */
.icon-teal-soft {
  background: rgba(0, 181, 216, 0.12);
  color: var(--card-teal);
}

.menu-text h5 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.menu-text p {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.menu-arrow {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 1.2rem;
  transition: transform 0.3s;
}

.menu-card:hover .menu-arrow {
  transform: translateX(5px);
  color: var(--primary-orange);
}

/* --- Enquiry List Styles --- */
.enquiry-card {
  background: white;
  border-radius: var(--border-radius-xl);
  padding: 0;
  margin-bottom: 25px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.5);
  transition: all 0.3s ease;
}

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

.enquiry-card-header {
  background: #FFF8F1; /* Extremely soft orange */
  padding: 15px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-orange-dark);
  border-bottom: 1px solid rgba(255, 152, 0, 0.1);
}

.enquiry-card-body {
  padding: 25px;
}

.enquiry-detail-row {
  display: flex;
  align-items: flex-start;
  margin-bottom: 15px;
}

.enquiry-detail-row i {
  width: 30px;
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-top: 3px;
}

.enquiry-company {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.enquiry-location {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-weight: 500;
  color: var(--text-main);
}

/* Modern Status Badges */
.status-badges {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 25px;
}

.status-badge {
  padding: 12px 5px;
  border-radius: 14px;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 60px;
  text-align: center;
  transition: all 0.2s;
  cursor: default;
}

a.status-badge {
  cursor: pointer;
}

a.status-badge:hover {
  transform: scale(1.03);
}

/* Soft Modern Status Colors */
.status-dark { background-color: var(--status-dark); color: white; }
.status-success { background-color: var(--status-success-light); color: var(--status-success); }
.status-danger { background-color: var(--status-danger-light); color: var(--status-danger); }
.status-purple { background-color: var(--status-purple-light); color: var(--status-purple); }
.status-red-btn { background: var(--card-red); color: white; box-shadow: 0 4px 15px rgba(238, 93, 80, 0.4); }
.status-teal-btn { background: var(--primary-orange-gradient); color: white; box-shadow: 0 4px 15px var(--primary-shadow); }
.status-teal-btn:hover { color: white; }
.status-close-btn { background: var(--bg-light); color: var(--text-muted); }

.status-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: inherit;
  opacity: 0.8;
  margin-top: 6px;
  letter-spacing: 0.5px;
  font-weight: 600;
}

/* Floating Action Button (FAB) */
.fab-btn {
  position: fixed;
  bottom: 40px;
  right: 40px;
  width: 65px;
  height: 65px;
  border-radius: 50%;
  background: var(--card-green);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  box-shadow: 0 10px 25px rgba(5, 205, 153, 0.4);
  cursor: pointer;
  z-index: 1030;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
}

.fab-btn:hover {
  transform: scale(1.1) rotate(90deg);
}

/* Dropdown Menus (Notifications, Company Switcher, User Menu) */
.dropdown-menu {
  border: none;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-hover);
  padding: 0;
  margin-top: 10px !important;
}
.dropdown-menu .dropdown-item {
  cursor: pointer;
}
.dropdown-menu .dropdown-item:hover {
  background-color: var(--bg-light);
}

/* Modern Modals */
.modal-content {
  border-radius: var(--border-radius-xl);
  border: none;
  box-shadow: 0 20px 50px rgba(0,0,0,0.15);
  overflow: hidden;
}

.modal-header.bg-orange {
  background: var(--primary-orange-gradient) !important;
  color: white;
  border-bottom: none;
  padding: 20px 25px;
}

.modal-body {
  padding: 30px;
}

/* Form Inputs */
.form-control, .form-select {
  border-radius: 12px;
  border: 1px solid #E2E8F0;
  padding: 12px 15px;
  font-weight: 500;
  color: var(--text-main);
  background-color: #F8FAFC;
  transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-orange);
  box-shadow: 0 0 0 4px var(--primary-shadow-light);
  background-color: white;
}

.form-label {
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

/* Selection Cards inside Modal */
.selection-card {
  background-color: white;
  color: var(--text-main);
  border-radius: var(--border-radius-lg);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  height: 100%;
  border: 2px solid transparent;
  box-shadow: var(--shadow-soft);
}

.selection-card:hover {
  border-color: var(--primary-orange);
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.selection-card i {
  font-size: 2.8rem;
  margin-bottom: 15px;
  color: var(--primary-orange);
}

.selection-card div {
  font-weight: 700;
  font-size: 1.1rem;
}

/* Reusable: table headers should never wrap onto a 2nd/3rd line, whatever
   the table's other styling - body cells are free to wrap where useful
   (e.g. Lead Manage's company/contact column), only headers must not. */
.nowrap-header-table thead th,
.leads-table thead th {
  white-space: nowrap;
}

/* Custom Table Styles */
.table-custom {
  margin-bottom: 0;
}

.table-custom th {
  background-color: transparent;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #E2E8F0;
  padding: 15px;
  white-space: nowrap;
}

.table-custom td {
  vertical-align: middle;
  padding: 15px;
  border-bottom: 1px solid #F1F5F9;
  font-weight: 500;
  white-space: nowrap;
}

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

.table-custom tr:hover td {
  background-color: #F8FAFC;
}

/* Badges */
.badge {
  padding: 8px 12px;
  border-radius: 30px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge.bg-success {
  background-color: var(--status-success-light) !important;
  color: var(--status-success);
}

.badge.bg-danger {
  background-color: var(--status-danger-light) !important;
  color: var(--status-danger);
}

/* Input Group styling */
.input-group-text {
  background-color: white;
  border: none;
  border-radius: 12px 0 0 12px;
}
.input-group .form-control {
  background-color: white;
  border: none;
  border-radius: 0 12px 12px 0;
  box-shadow: none;
}
.input-group {
  box-shadow: var(--shadow-soft);
  border-radius: 12px;
}

/* Custom scrollbar for scrollable elements */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: #F1F5F9;
  border-radius: 8px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 8px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--primary-orange);
}

/* --- Sidebar Submenu Styles --- */
.sidebar-nav li ul {
  padding-left: 15px;
  list-style: none;
}
.submenu-link {
  display: flex !important;
  align-items: center;
  padding: 8px 15px !important;
  color: var(--text-muted) !important;
  font-weight: 500 !important;
  font-size: 0.85rem !important;
  border-radius: 10px !important;
  margin-bottom: 4px !important;
  transition: all 0.2s ease;
  background: none !important;
  box-shadow: none !important;
}
.submenu-link:hover,
.submenu-link.active {
  color: var(--primary-orange) !important;
  background: var(--primary-shadow-lighter) !important;
}
.submenu-link i {
  font-size: 0.95rem !important;
  margin-right: 10px !important;
  width: 20px !important;
  text-align: center;
}
.submenu-arrow {
  transition: transform 0.2s ease;
}
a:not(.collapsed) .submenu-arrow {
  transform: rotate(180deg);
}

/* --- Profile Info Layout (Customer/Company detail pages) --- */
.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--primary-orange-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.15rem;
  flex-shrink: 0;
  box-shadow: 0 8px 20px var(--primary-shadow);
}

.info-section-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--primary-orange);
  font-weight: 700;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid #F1F5F9;
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 22px;
}

.info-item .info-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--bg-light);
  color: var(--primary-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.info-item .info-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 3px;
}

.info-item .info-value {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.92rem;
  word-break: break-word;
}

.doc-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--bg-light);
  color: var(--primary-orange) !important;
  font-weight: 700;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}
.doc-chip:hover {
  background: var(--primary-shadow-lighter);
  transform: translateY(-2px);
}

/* --- Follow-up List Items (Follow Up Scheduler page) --- */
.followup-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 4px;
  border-bottom: 1px solid #F1F5F9;
  position: relative;
}
.followup-item:last-child {
  border-bottom: none;
}
.followup-item:hover {
  background: var(--bg-light);
}

.followup-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.88rem;
  color: #fff;
  flex-shrink: 0;
}
.followup-avatar.is-danger { background: #E85D5D; }
.followup-avatar.is-warning { background: #E8A93D; }
.followup-avatar.is-info { background: #3DA9D8; }

.followup-item-body {
  flex: 1;
  min-width: 0;
}

.followup-item-title {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.88rem;
  text-decoration: none;
  display: block;
}
.followup-item-title:hover {
  color: var(--primary-orange);
}

.followup-item-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 3px;
  flex-wrap: wrap;
}
.followup-item-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.followup-call-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  background: #16A34A;
  color: #fff !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.followup-call-btn:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 6px 14px rgba(22, 163, 74, 0.4);
  color: #fff !important;
}

/* --- Interaction Timeline (Lead detail page) --- */
.tl-item {
  position: relative;
  padding-left: 24px;
  padding-bottom: 18px;
}
.tl-item:last-child {
  padding-bottom: 0;
}
.tl-item::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 14px;
  bottom: -4px;
  width: 2px;
  background: #E2E8F0;
}
.tl-item:last-child::before {
  display: none;
}
.tl-marker {
  position: absolute;
  left: 0;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary-orange-gradient);
  box-shadow: 0 0 0 3px var(--primary-shadow-lighter);
}

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

.tl-time {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--primary-orange);
}

.tl-user {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  background: var(--bg-light);
  padding: 2px 9px;
  border-radius: 20px;
}

.tl-remark {
  background: var(--bg-light);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.82rem;
  color: var(--text-main);
  line-height: 1.45;
}

/* --- Dashboard: Monthly Targets card --- */
.target-row {
  margin-bottom: 20px;
}
.target-row:last-child {
  margin-bottom: 0;
}

.target-row-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.target-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.target-icon.is-success { background: var(--status-success-light); color: var(--status-success); }
.target-icon.is-info { background: var(--status-purple-light); color: var(--status-purple); }
.target-icon.is-warning { background: rgba(245, 158, 11, 0.15); color: #F59E0B; }

.target-row-text {
  flex: 1;
  min-width: 0;
}

.target-label {
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--text-main);
}

.target-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.target-percent {
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.target-progress {
  height: 7px;
  border-radius: 4px;
}

/* --- Dashboard: leaderboard / ranked list rows --- */
.dash-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 4px;
  border-bottom: 1px solid #F1F5F9;
}
.dash-row:last-child {
  border-bottom: none;
}

.dash-rank {
  width: 20px;
  flex-shrink: 0;
  text-align: center;
  font-weight: 800;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.dash-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
  flex-shrink: 0;
  background: var(--primary-orange-gradient);
}

.dash-row-body {
  flex: 1;
  min-width: 0;
}

.dash-row-title {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.85rem;
}

.dash-row-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* ==========================================================================
   Responsive / Mobile Enhancements
   Applies across every page automatically (shared layout + shared classes).
   ========================================================================== */

/* Any flex card-header (page headers, report headers, list headers, etc.)
   wraps instead of overflowing horizontally when there isn't enough room
   for the title + action buttons on one line. */
.card-header.d-flex {
  flex-wrap: wrap;
  row-gap: 10px;
}

/* Small/narrow laptop screens - the sidebar is still visible (unlike below
   992px where it collapses), but 6 KPI cards across in that remaining width
   is too cramped: labels/values wrap awkwardly ("Revenue (This Month)"
   amount, "Orders" icon etc.). Drop to 3-per-row here instead, only for
   this dashboard KPI row (.col-lg-2 isn't used anywhere else in the app). */
@media (min-width: 992px) and (max-width: 1300px) {
  .col-lg-2 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
  }
  .kpi-card h3 {
    font-size: 1.4rem;
  }
  .kpi-card h6 {
    font-size: 0.7rem;
  }
  .kpi-card .card-body {
    padding: 1rem 0.75rem;
  }
}

/* Tablets & small laptops */
@media (max-width: 991.98px) {
  .welcome-name { font-size: 1.9rem; }
  .table-custom th, .table-custom td { padding: 12px; }
}

/* Phones (portrait & landscape) */
@media (max-width: 767.98px) {
  .app-header {
    padding: 14px 16px;
    row-gap: 10px;
  }
  .app-header .header-title { display: none; }
  .app-header .header-actions i { font-size: 1.1rem; margin-left: 14px; }
  .app-header .btn.btn-light { padding: 6px 10px; font-size: 0.8rem; }
  .app-header .btn.btn-light span { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }

  .app-content { padding: 0 12px 24px; }

  .card { border-radius: var(--border-radius-lg) !important; }
  .card-body { padding: 1rem !important; }
  .card-header { padding: 0.85rem 1rem !important; }
  .card-header h5 { font-size: 1rem !important; }

  /* Every modal, app-wide - long forms (Add Lead, Add Customer, Add
     Product, Enquiry forms, etc.) should scroll within the modal body
     instead of stretching the whole page. Bootstrap centers the dialog
     vertically already; this just stops it exceeding the viewport. */
  .modal-body { padding: 18px; max-height: 75vh; overflow-y: auto; }
  .modal-header.bg-orange { padding: 14px 18px; }

  /* Button/filter clusters (e.g. "All Executives" + Report + Adjust Targets)
     wrap instead of overflowing off the right edge of the screen. */
  div.d-flex.align-items-center.gap-2 { flex-wrap: wrap; }

  /* Title/name + badge rows (e.g. salesperson name + "Target Period" badge)
     wrap onto their own line instead of squeezing the title text. */
  div.d-flex.justify-content-between.align-items-center { flex-wrap: wrap; row-gap: 6px; }

  .app-content h5 { font-size: 1rem; }
  .badge { padding: 6px 10px; font-size: 0.72rem; }

  .table-custom th, .table-custom td {
    padding: 10px;
    font-size: 0.82rem;
  }

  .enquiry-card-header { padding: 10px 16px; font-size: 0.8rem; }
  .enquiry-card-body { padding: 16px; }
  .enquiry-company { font-size: 1.05rem; }

  .status-badges { gap: 8px; margin-top: 16px; }
  .status-badge { font-size: 0.72rem; padding: 8px 4px; min-height: 52px; }
  .status-label { font-size: 0.6rem; }

  .welcome-name { font-size: 1.6rem; margin-bottom: 20px; }
  .welcome-text { font-size: 0.95rem; }

  .menu-card { padding: 14px 16px; }
  .menu-icon-box { width: 48px; height: 48px; margin-right: 14px; }
  .menu-icon-box i { font-size: 1.2rem; }
  .menu-text h5 { font-size: 0.95rem; }
  .menu-text p { font-size: 0.78rem; }

  .btn { padding: 8px 14px; font-size: 0.9rem; }
  .btn-sm { padding: 6px 10px; font-size: 0.8rem; }

  .form-control, .form-select { padding: 10px 12px; font-size: 0.9rem; }

  .input-group { width: 100% !important; }

  /* Fixed-width filter/search boxes should never force horizontal overflow. */
  [style*="width: 240px"], [style*="width:240px"] { width: 100% !important; }

  /* CRM Sales Report table - keep every cell on one line and let the
     existing .table-responsive wrapper scroll horizontally, instead of
     each cell wrapping its text onto 2-3 lines and bloating row height. */
  .crm-orders-table th, .crm-orders-table td {
    white-space: nowrap;
    font-size: 0.78rem;
    padding: 8px 10px;
  }

  /* Sales page order-card status/payment/view-items row - 3 equal columns
     are too narrow on a phone and wrap awkwardly. Stack Status+Payment
     side by side, View Items full width below. */
  .order-status-row .col-4:nth-child(1),
  .order-status-row .col-4:nth-child(2) {
    flex: 0 0 50%;
    max-width: 50%;
  }
  .order-status-row .col-4:nth-child(3) {
    flex: 0 0 100%;
    max-width: 100%;
    margin-top: 8px;
  }
  .order-status-row span { font-size: 0.72rem; }

  /* Enquiry Add New/Existing Company modals - many stacked fields make
     these very tall on a phone; tighten spacing (the scroll-within-modal
     fix itself is now global, see .modal-body above). */
  #newCompanyEnquiryModal .row.g-3 > div {
    margin-bottom: 2px;
  }
  #newCompanyEnquiryModal .form-label,
  #existingCompanyEnquiryModal .form-label {
    margin-bottom: 3px;
    font-size: 0.82rem;
  }
  #newCompanyEnquiryModal .mb-3,
  #existingCompanyEnquiryModal .mb-3 {
    margin-bottom: 10px !important;
  }

  /* "Select Enquiry Type" modal - the two selection cards are oversized
     on a phone (big icon, large text, tall padding). Shrink both. */
  #enquiryTypeModal .modal-body {
    padding: 16px 12px !important;
  }
  #enquiryTypeModal .bg-light.p-4 {
    padding: 14px !important;
  }
  .selection-card {
    padding: 16px 10px;
  }
  .selection-card i {
    font-size: 1.8rem;
    margin-bottom: 8px;
  }
  .selection-card div {
    font-size: 0.85rem;
  }

  /* Salespersons Leaderboard / any card header with a longer h6 title -
     keep icon + text on one line instead of wrapping onto 2-3 lines. */
  .card-header h6 {
    font-size: 0.85rem;
  }

  /* Lead Manage table - smaller header/cell font so columns aren't as cramped. */
  .leads-table thead th {
    font-size: 0.68rem;
    padding: 8px 6px;
  }
  .leads-table td {
    font-size: 0.78rem;
    padding: 8px 6px;
  }
}

/* Small phones */
@media (max-width: 420px) {
  .app-header .btn.btn-light span { display: none; }
  .app-sidebar { width: 85vw; }
  .status-badge { font-size: 0.66rem; padding: 6px 3px; min-height: 46px; }
  .menu-icon-box { width: 42px; height: 42px; margin-right: 10px; }
}
.pagination {
  flex-wrap: wrap;
  justify-content: center;
  row-gap: 6px;
}

@media (max-width: 767.98px) {
  .pagination { gap: 4px; }
  .pagination .page-link {
    padding: 6px 11px;
    font-size: 0.82rem;
    min-width: 34px;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .pagination .page-link {
    padding: 5px 9px;
    font-size: 0.76rem;
    min-width: 30px;
  }
}
