/* ============================================================
   Riyansh Solar CRM - Professional Stylesheet
   Font: Poppins | Icons: Lucide | No Emojis
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #16a34a;
  --primary-dark: #15803d;
  --primary-light: #22c55e;
  --primary-bg: #f0fdf4;
  --primary-50: #f0fdf4;
  --primary-100: #dcfce7;
  --secondary: #1e293b;
  --accent: #f59e0b;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --success: #22c55e;
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;
  --border-radius: 10px;
  --border-radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0a0f1e 0%, #0d2818 40%, #0f4d2a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.login-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.3;
  pointer-events: none;
}

.login-bg-orb-1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #16a34a, transparent);
  top: -150px; right: -100px;
}

.login-bg-orb-2 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, #22c55e, transparent);
  bottom: -100px; left: -80px;
}

.login-container {
  display: flex;
  width: 100%;
  max-width: 900px;
  min-height: 560px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 32px 64px rgba(0,0,0,0.5);
  position: relative;
  z-index: 1;
}

.login-left {
  flex: 1;
  background: linear-gradient(160deg, #16a34a 0%, #0d5c2a 100%);
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.login-left::before {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  top: -80px; right: -80px;
}

.login-left::after {
  content: '';
  position: absolute;
  width: 200px; height: 200px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  bottom: -60px; left: -60px;
}

.login-left-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.login-left-logo img {
  height: 48px;
  filter: brightness(0) invert(1);
}

.login-left-logo-text h2 {
  font-size: 20px;
  font-weight: 700;
  color: white;
  line-height: 1.2;
}

.login-left-logo-text p {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
}

.login-left-content {
  position: relative;
  z-index: 1;
}

.login-left-content h1 {
  font-size: 28px;
  font-weight: 700;
  color: white;
  line-height: 1.3;
  margin-bottom: 12px;
}

.login-left-content p {
  font-size: 14px;
  color: rgba(255,255,255,0.75);
  line-height: 1.7;
}

.login-left-features {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.85);
  font-size: 13px;
}

.login-feature-item svg {
  width: 16px; height: 16px;
  color: #86efac;
  flex-shrink: 0;
}

.login-right {
  width: 420px;
  background: white;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-right-header {
  margin-bottom: 32px;
}

.login-right-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 6px;
}

.login-right-header p {
  font-size: 13px;
  color: #64748b;
}

.login-footer-text {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: #94a3b8;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 7px;
  letter-spacing: 0.01em;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Poppins', sans-serif;
  color: #1e293b;
  background: #fafafa;
  transition: all 0.2s;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(22,163,74,0.1);
}

.form-control.error { border-color: var(--danger); }
.form-control::placeholder { color: #94a3b8; font-size: 13px; }

.input-group { position: relative; }

.input-group .form-control { padding-left: 44px; }
.input-group .form-control.has-right { padding-right: 44px; }

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  display: flex;
  align-items: center;
  pointer-events: none;
}

.input-icon svg { width: 17px; height: 17px; }

.input-icon-right {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: color 0.2s;
}

.input-icon-right:hover { color: #475569; }
.input-icon-right svg { width: 17px; height: 17px; }

.form-select {
  width: 100%;
  padding: 11px 36px 11px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Poppins', sans-serif;
  color: #1e293b;
  background: #fafafa;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: all 0.2s;
}

.form-select:focus {
  border-color: var(--primary);
  background-color: white;
  box-shadow: 0 0 0 3px rgba(22,163,74,0.1);
}

.form-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Poppins', sans-serif;
  color: #1e293b;
  background: #fafafa;
  outline: none;
  resize: vertical;
  min-height: 88px;
  transition: all 0.2s;
}

.form-textarea:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(22,163,74,0.1);
}

.form-error { font-size: 12px; color: var(--danger); margin-top: 5px; display: flex; align-items: center; gap: 4px; }
.form-hint { font-size: 12px; color: #94a3b8; margin-top: 5px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
  line-height: 1;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(22,163,74,0.35);
}

.btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-secondary:hover:not(:disabled) { background: #e2e8f0; color: #1e293b; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #dc2626; transform: translateY(-1px); }

.btn-warning { background: var(--warning); color: white; }
.btn-info { background: var(--info); color: white; }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}
.btn-outline:hover:not(:disabled) { background: var(--primary-bg); }

.btn-ghost { background: transparent; color: #64748b; border: none; }
.btn-ghost:hover:not(:disabled) { background: #f1f5f9; color: #1e293b; }

.btn-sm { padding: 7px 14px; font-size: 12px; border-radius: 6px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: 13px 28px; font-size: 15px; border-radius: 10px; }
.btn-block { width: 100%; }

.btn-icon {
  padding: 8px;
  border-radius: 7px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 34px;
}
.btn-icon svg { width: 16px; height: 16px; }
.btn-icon:hover { background: #f1f5f9; color: #1e293b; }
.btn-icon.danger:hover { background: #fee2e2; color: var(--danger); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-error { background: #fee2e2; border: 1px solid #fecaca; color: #b91c1c; }
.alert-success { background: #dcfce7; border: 1px solid #bbf7d0; color: #15803d; }
.alert-warning { background: #fef3c7; border: 1px solid #fde68a; color: #b45309; }
.alert-info { background: #dbeafe; border: 1px solid #bfdbfe; color: #1d4ed8; }

/* ============================================================
   LAYOUT - SIDEBAR + MAIN
   ============================================================ */
.app-layout { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-width);
  background: #0f172a;
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 200;
  transition: width 0.3s cubic-bezier(0.4,0,0.2,1), transform 0.3s cubic-bezier(0.4,0,0.2,1);
  overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-header {
  padding: 0 16px;
  height: var(--header-height);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.sidebar-logo-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  filter: brightness(0) invert(1);
}

.sidebar-brand { overflow: hidden; white-space: nowrap; }
.sidebar-brand h2 { font-size: 14px; font-weight: 700; color: white; line-height: 1.2; }
.sidebar-brand p { font-size: 10.5px; color: #64748b; margin-top: 1px; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); }

.nav-section { padding: 14px 20px 5px; }
.nav-section-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #475569;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  color: #94a3b8;
  text-decoration: none;
  border-radius: 8px;
  margin: 1px 8px;
  transition: all 0.18s;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  min-height: 42px;
}

.nav-item:hover { background: rgba(255,255,255,0.06); color: #e2e8f0; }

.nav-item.active {
  background: rgba(22,163,74,0.18);
  color: #4ade80;
}

.nav-item.active .nav-icon svg { color: #4ade80; }

.nav-icon {
  flex-shrink: 0;
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg { width: 18px; height: 18px; }

.nav-label { font-size: 13px; font-weight: 500; }

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  flex-shrink: 0;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 10px 8px 12px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  overflow: hidden;
}

.user-card:hover { background: rgba(255,255,255,0.06); }

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}

.user-info { overflow: hidden; flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: #64748b; white-space: nowrap; }

/* MOBILE OVERLAY */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 199;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.show { display: block; }

/* MAIN CONTENT */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.3s cubic-bezier(0.4,0,0.2,1);
  min-width: 0;
}

.main-content.expanded { margin-left: var(--sidebar-collapsed); }

/* TOP HEADER */
.top-header {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.header-toggle:hover { background: #f1f5f9; color: #1e293b; }
.header-toggle svg { width: 20px; height: 20px; }

.header-breadcrumb { flex: 1; min-width: 0; }
.header-breadcrumb h1 { font-size: 17px; font-weight: 700; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-breadcrumb p { font-size: 11.5px; color: #94a3b8; }

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

.header-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  color: #64748b;
  padding: 8px;
  border-radius: 8px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 38px;
}

.header-btn:hover { background: #f1f5f9; color: #1e293b; }
.header-btn svg { width: 20px; height: 20px; }

.header-btn .notif-badge {
  position: absolute;
  top: 5px; right: 5px;
  width: 15px; height: 15px;
  background: var(--danger);
  color: white;
  font-size: 9px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-avatar-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

.header-avatar-btn:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(22,163,74,0.3); }

/* DROPDOWN MENU */
.dropdown-menu {
  position: absolute;
  right: 0; top: calc(100% + 8px);
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 300;
  overflow: hidden;
  animation: dropIn 0.15s ease;
}

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

.dropdown-header {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
}

.dropdown-header .name { font-size: 13px; font-weight: 600; color: #1e293b; }
.dropdown-header .role { font-size: 11px; color: #94a3b8; margin-top: 2px; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: #374151;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.dropdown-item svg { width: 15px; height: 15px; color: #64748b; }
.dropdown-item:hover { background: #f8fafc; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger svg { color: var(--danger); }
.dropdown-item.danger:hover { background: #fef2f2; }
.dropdown-divider { height: 1px; background: #f1f5f9; margin: 4px 0; }

/* PAGE CONTENT */
.page-content { padding: 22px; flex: 1; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: white;
  border-radius: var(--border-radius-lg);
  border: 1px solid #e8edf2;
  box-shadow: var(--shadow-sm);
}

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

.card-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title svg { width: 18px; height: 18px; color: var(--primary); }

.card-body { padding: 20px; }

.card-footer {
  padding: 14px 20px;
  border-top: 1px solid #f1f5f9;
  background: #fafbfc;
  border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: white;
  border-radius: var(--border-radius-lg);
  padding: 18px 20px;
  border: 1px solid #e8edf2;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: default;
}

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

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.green { background: #dcfce7; color: var(--primary); }
.stat-icon.blue { background: #dbeafe; color: #3b82f6; }
.stat-icon.orange { background: #fef3c7; color: #f59e0b; }
.stat-icon.red { background: #fee2e2; color: #ef4444; }
.stat-icon.purple { background: #ede9fe; color: #8b5cf6; }
.stat-icon.teal { background: #ccfbf1; color: #14b8a6; }
.stat-icon.pink { background: #fce7f3; color: #ec4899; }

.stat-info { flex: 1; min-width: 0; }
.stat-value { font-size: 24px; font-weight: 800; color: #1e293b; line-height: 1; letter-spacing: -0.5px; }
.stat-label { font-size: 12px; color: #64748b; margin-top: 4px; font-weight: 500; }
.stat-change { font-size: 11px; font-weight: 600; margin-top: 3px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 600px;
}

.table th {
  background: #f8fafc;
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.table td {
  padding: 13px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #374151;
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #fafbfc; }
.table-actions { display: flex; gap: 2px; align-items: center; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.badge svg { width: 11px; height: 11px; }

.badge-green { background: #dcfce7; color: #15803d; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-orange { background: #fef3c7; color: #b45309; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-purple { background: #ede9fe; color: #6d28d9; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-teal { background: #ccfbf1; color: #0f766e; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.badge-pink { background: #fce7f3; color: #9d174d; }

/* Lead status */
.status-new { background: #dbeafe; color: #1d4ed8; }
.status-contacted { background: #fef3c7; color: #b45309; }
.status-site_visit { background: #ede9fe; color: #6d28d9; }
.status-quoted { background: #ccfbf1; color: #0f766e; }
.status-negotiation { background: #fef9c3; color: #854d0e; }
.status-won { background: #dcfce7; color: #15803d; }
.status-lost { background: #fee2e2; color: #b91c1c; }
.status-on_hold { background: #f1f5f9; color: #475569; }

/* Priority */
.priority-low { background: #f1f5f9; color: #475569; }
.priority-medium { background: #fef3c7; color: #b45309; }
.priority-high { background: #fee2e2; color: #b91c1c; }
.priority-urgent { background: #fce7f3; color: #9d174d; }

/* Roles */
.role-founder { background: #fce7f3; color: #9d174d; }
.role-director { background: #ede9fe; color: #6d28d9; }
.role-manager { background: #dbeafe; color: #1d4ed8; }
.role-receptionist { background: #ccfbf1; color: #0f766e; }
.role-support_head { background: #fef3c7; color: #b45309; }
.role-team_leader { background: #dcfce7; color: #15803d; }
.role-franchise_expert { background: #fee2e2; color: #b91c1c; }
.role-relationship_manager { background: #f0fdf4; color: #166534; }
.role-franchise_partner { background: #f1f5f9; color: #475569; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.6);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(3px);
}

.modal {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 32px 64px rgba(0,0,0,0.25);
  animation: modalIn 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.93) translateY(-12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
  border-radius: 16px 16px 0 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title svg { width: 20px; height: 20px; color: var(--primary); }

.modal-close {
  background: #f1f5f9;
  border: none;
  cursor: pointer;
  color: #64748b;
  width: 32px; height: 32px;
  border-radius: 8px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-close:hover { background: #e2e8f0; color: #1e293b; }
.modal-close svg { width: 16px; height: 16px; }

.modal-body { padding: 20px 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  position: sticky;
  bottom: 0;
  background: white;
  border-radius: 0 0 16px 16px;
}

/* ============================================================
   TOASTS
   ============================================================ */
.toast-container {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
  width: calc(100vw - 32px);
}

.toast {
  background: white;
  border-radius: 10px;
  padding: 13px 15px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: flex-start;
  gap: 11px;
  border-left: 4px solid;
  animation: toastIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}

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

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast.info { border-color: var(--info); }

.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast-icon svg { width: 18px; height: 18px; }
.toast.success .toast-icon svg { color: var(--success); }
.toast.error .toast-icon svg { color: var(--danger); }
.toast.warning .toast-icon svg { color: var(--warning); }
.toast.info .toast-icon svg { color: var(--info); }

.toast-content { flex: 1; min-width: 0; }
.toast-title { font-size: 13px; font-weight: 600; color: #1e293b; }
.toast-message { font-size: 12px; color: #64748b; margin-top: 2px; }

.toast-close {
  background: none; border: none; cursor: pointer;
  color: #94a3b8; flex-shrink: 0; padding: 0;
  display: flex; align-items: center;
}
.toast-close svg { width: 14px; height: 14px; }
.toast-close:hover { color: #475569; }

/* ============================================================
   SEARCH & FILTERS
   ============================================================ */
.search-bar {
  position: relative;
  flex: 1;
  max-width: 300px;
}

.search-bar input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Poppins', sans-serif;
  outline: none;
  transition: all 0.2s;
  background: #f8fafc;
  color: #1e293b;
}

.search-bar input:focus { border-color: var(--primary); background: white; box-shadow: 0 0 0 3px rgba(22,163,74,0.1); }
.search-bar input::placeholder { color: #94a3b8; }

.search-bar .search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  display: flex;
  pointer-events: none;
}

.search-bar .search-icon svg { width: 15px; height: 15px; }

.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  padding: 16px 0;
  flex-wrap: wrap;
}

.page-btn {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: white;
  cursor: pointer;
  font-size: 13px;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.page-btn:hover { background: #f1f5f9; }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  padding: 56px 20px;
}

.empty-state .empty-icon {
  width: 64px; height: 64px;
  background: #f1f5f9;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.empty-state .empty-icon svg { width: 28px; height: 28px; color: #94a3b8; }
.empty-state h3 { font-size: 15px; font-weight: 700; color: #475569; margin-bottom: 6px; }
.empty-state p { font-size: 13px; color: #94a3b8; margin-bottom: 20px; }

/* ============================================================
   LOADING
   ============================================================ */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

.spinner-lg { width: 36px; height: 36px; border-width: 3px; }
.spinner-white { border-color: rgba(255,255,255,0.3); border-top-color: white; }

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

.loading-overlay {
  position: absolute; inset: 0;
  background: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  z-index: 10;
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex;
  border-bottom: 2px solid #e2e8f0;
  gap: 0;
  margin-bottom: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  padding: 10px 18px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Poppins', sans-serif;
  color: #64748b;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.tab-btn svg { width: 15px; height: 15px; }
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ============================================================
   PIPELINE / KANBAN
   ============================================================ */
.pipeline {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}

.pipeline-col {
  min-width: 230px;
  background: #f8fafc;
  border-radius: 10px;
  padding: 12px;
  flex-shrink: 0;
}

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

.pipeline-col-title { font-size: 12.5px; font-weight: 700; color: #475569; }

.pipeline-count {
  background: #e2e8f0;
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.pipeline-card {
  background: white;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.pipeline-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(22,163,74,0.12);
  transform: translateY(-1px);
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .sidebar, .top-header, .no-print, .toast-container { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  .print-doc { box-shadow: none !important; border: none !important; }
}

.print-doc {
  background: white;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
}

/* ============================================================
   SOLAR CALCULATOR
   ============================================================ */
.calc-result-card {
  background: linear-gradient(135deg, #0f172a, #1e3a2f);
  color: white;
  border-radius: 14px;
  padding: 24px;
}

.calc-result-value {
  font-size: 36px;
  font-weight: 800;
  color: var(--primary-light);
  letter-spacing: -1px;
}

.calc-result-label { font-size: 12px; color: #94a3b8; margin-top: 4px; }

/* ============================================================
   QR CODE
   ============================================================ */
.qr-display {
  text-align: center;
  padding: 28px;
  background: white;
  border-radius: 16px;
  border: 2px dashed #e2e8f0;
}

.qr-display canvas, .qr-display img {
  max-width: 200px;
  margin: 0 auto;
  display: block;
}

/* ============================================================
   WELCOME BANNER
   ============================================================ */
.welcome-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a2f 50%, #15803d 100%);
  border-radius: 16px;
  padding: 26px 28px;
  margin-bottom: 22px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.welcome-banner::before {
  content: '';
  position: absolute;
  width: 300px; height: 300px;
  background: rgba(255,255,255,0.03);
  border-radius: 50%;
  top: -100px; right: -80px;
}

.welcome-banner h2 { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.welcome-banner p { color: rgba(255,255,255,0.65); font-size: 13px; }

/* ============================================================
   UTILITIES
   ============================================================ */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 12px; }
.text-muted { color: #94a3b8; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.relative { position: relative; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ============================================================
   RESPONSIVE — TABLET (max 1024px)
   ============================================================ */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   RESPONSIVE — MOBILE (max 768px)
   ============================================================ */
@media (max-width: 768px) {
  /* Sidebar becomes slide-in drawer */
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
    box-shadow: none;
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  }

  .main-content {
    margin-left: 0 !important;
  }

  .page-content { padding: 14px; }

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

  .stat-card { padding: 14px; }
  .stat-value { font-size: 20px; }
  .stat-icon { width: 40px; height: 40px; border-radius: 10px; }
  .stat-icon svg { width: 18px; height: 18px; }

  .filter-bar { flex-direction: column; align-items: stretch; }
  .search-bar { max-width: 100%; }

  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

  .welcome-banner { padding: 18px 20px; }
  .welcome-banner h2 { font-size: 17px; }

  .card-header { flex-direction: column; align-items: flex-start; }

  .modal { border-radius: 16px 16px 0 0; max-height: 95vh; }
  .modal-overlay { align-items: flex-end; padding: 0; }

  .header-breadcrumb h1 { font-size: 15px; }
  .header-breadcrumb p { display: none; }

  /* Login page mobile */
  .login-container { flex-direction: column; min-height: auto; border-radius: 16px; }
  .login-left { display: none; }
  .login-right { width: 100%; padding: 32px 24px; }

  /* Table mobile */
  .table { min-width: 500px; }
}

/* ============================================================
   RESPONSIVE — SMALL MOBILE (max 480px)
   ============================================================ */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .btn-lg { padding: 12px 20px; font-size: 14px; }
  .page-content { padding: 12px; }
  .top-header { padding: 0 14px; }
  .header-actions .btn { display: none; }
  .header-actions .btn-primary { display: inline-flex; }
}
