:root {
  --brand: #1f6b54;
  --brand-dark: #174f3f;
  --brand-light: #e8f4f0;
  --accent: #2563eb;
  --accent-light: #eff6ff;

  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;

  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;

  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);

  /* Legacy aliases */
  --primary: var(--brand);
  --secondary: var(--muted);
  --green: var(--success);
  --gold: var(--warning);
  --purple: var(--brand);
  --blue: var(--accent);
  --orange: var(--warning);
  --pink: var(--danger);
}

[x-cloak] { display: none !important; }
* {
  box-sizing: border-box;
  max-width: 100%;
}
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100%;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

* {
  max-width: 100%;
  box-sizing: border-box;
}
a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: #1d4ed8; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-top));
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border-bottom: 1px solid var(--border);
}
.topbar-start {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.menu-toggle {
  background: var(--surface);
  border: 1px solid #bfdbfe;
  cursor: pointer;
  padding: 8px 10px;
  margin-right: 8px;
  color: #2563eb;
  border-radius: var(--radius);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
}
.menu-toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: #2563eb;
}
.menu-toggle:hover {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
}
.menu-toggle svg {
  width: 22px;
  height: 22px;
  display: block;
  stroke: currentColor;
}
.brand { display: flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; min-width: 0; }
.brand:hover { color: var(--ink); }
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.brand-text strong {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand small { 
  display: none;
  opacity: .7; 
  font-size: 10px; 
  letter-spacing: .08em; 
  text-transform: uppercase; 
  color: var(--muted);
}
.mark {
  width: 36px; height: 36px; border-radius: var(--radius);
  background: var(--brand); color: white; display: grid; place-items: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.quick { 
  display: flex; 
  gap: 8px; 
  align-items: center;
  flex-shrink: 0;
}

.install-btn {
  display: none;
  padding: 6px 12px;
  font-size: 12px;
  white-space: nowrap;
  border-radius: var(--radius);
  flex-shrink: 0;
  background: var(--brand);
  color: white;
  border: none;
  font-weight: 600;
  cursor: pointer;
}
.install-btn:hover { background: var(--brand-dark); }

.install-btn.visible {
  display: inline-block;
}

.live-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--success);
  cursor: pointer;
  white-space: nowrap;
}
.live-toggle input { accent-color: var(--success); }

.nav-link {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: var(--radius);
  white-space: nowrap;
}
.nav-link:hover { background: var(--bg); color: var(--ink); }

@media (min-width: 480px) {
  .live-toggle { font-size: 12px; }
  .nav-link { font-size: 13px; }
  .install-btn { padding: 8px 14px; font-size: 13px; }
}

@media (min-width: 768px) {
  .brand small { display: block; }
  .install-btn { padding: 8px 16px; font-size: 13px; }
  .mark { width: 40px; height: 40px; border-radius: var(--radius); }
  .brand { gap: 12px; }
  .topbar { padding: 14px 24px calc(14px + env(safe-area-inset-top)); }
  .menu-toggle { padding: 8px; margin-right: 10px; }
  .quick { gap: 10px; }
  .quick { flex-wrap: nowrap; }
}
.page {
  padding: 20px 16px 40px;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 57px);
  min-height: calc(100dvh - 57px);
  overflow-x: hidden;
}
.page.with-sidebar { margin-left: 0; }

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 1024px) {
  .page { padding: 28px 32px 48px; }
  .page.with-sidebar { margin-left: 280px; }
  .sidebar {
    transform: translateX(0) !important;
    top: 65px;
    height: calc(100vh - 65px);
    height: calc(100dvh - 65px);
  }
  .sidebar-overlay { display: none !important; }
}

/* Hero text white system-wide */

/* Gamification System Styles */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Gradient backgrounds */
.bg-gradient-to-r {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}

.bg-gradient-to-br {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}

.from-purple-500 { --gradient-from: #8b5cf6; }
.to-blue-500 { --gradient-to: #3b82f6; }
.from-yellow-400 { --gradient-from: #facc15; }
.to-orange-500 { --gradient-to: #f97316; }
.from-purple-600 { --gradient-from: #9333ea; }
.to-blue-600 { --gradient-to: #2563eb; }

/* Text utilities */
.text-3xl { font-size: 1.875rem; font-weight: bold; }
.text-2xl { font-size: 1.5rem; font-weight: bold; }
.text-xl { font-size: 1.25rem; font-weight: 600; }
.text-lg { font-size: 1.125rem; font-weight: 500; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

.text-white { color: white; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-900 { color: #111827; }
.text-purple-600 { color: var(--brand); }
.text-blue-600 { color: var(--accent); }
.text-green-600 { color: var(--green); }
.text-yellow-600 { color: var(--gold); }
.text-red-600 { color: var(--danger); }

/* Background utilities */
.bg-white { background: white; }
.bg-gray-50 { background: #f9fafb; }
.bg-purple-50 { background: var(--brand-light); }
.bg-blue-50 { background: var(--accent-light); }
.bg-yellow-50 { background: #fefce8; }
.bg-green-50 { background: #f0fdf4; }

/* Spacing */
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }

/* Flexbox utilities */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Border utilities */
.border { border: 1px solid #e5e7eb; }
.border-2 { border: 2px solid #e5e7eb; }
.border-t { border-top: 1px solid #e5e7eb; }
.border-b { border-bottom: 1px solid #e5e7eb; }
.border-purple-300 { border-color: #c4b5fd; }
.border-yellow-200 { border-color: #fef9c3; }
.border-green-500 { border-color: var(--green); }
.border-yellow-400 { border-color: var(--gold); }
.rounded { border-radius: 0.5rem; }
.rounded-lg { border-radius: 0.75rem; }
.rounded-full { border-radius: 9999px; }

/* Shadow utilities */
.shadow { box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }

/* Other utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: bold; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.opacity-90 { opacity: 0.9; }
.opacity-60 { opacity: 0.6; }
.w-full { width: 100%; }
.max-w-2xl { max-width: 42rem; }
.h-4 { height: 1rem; }
.h-3 { height: 0.75rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.inline-block { display: inline-block; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }
.transition { transition: all 0.2s; }
.hover\:shadow-md:hover { box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.hover\:bg-purple-700:hover { background: #7c3aed; }
.hover\:bg-gray-100:hover { background: #f3f4f6; }
.hover\:bg-purple-50:hover { background: #faf5ff; }
.hover\:underline:hover { text-decoration: underline; }
.hover\:bg-orange-500:hover { background: #f97316; }
.cursor-not-allowed { cursor: not-allowed; }
.cursor-pointer { cursor: pointer; }

/* Progress bars */
.bg-gray-200 { background: #e5e7eb; }
.bg-blue-500 { background: var(--blue); }
.bg-green-500 { background: var(--green); }
.bg-purple-500 { background: var(--purple); }
.bg-yellow-500 { background: var(--gold); }

/* Table styles */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  background: #f8f9fa;
  padding: 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid #e5e7eb;
}
.data-table td {
  padding: 12px;
  border-bottom: 1px solid #e5e7eb;
}
.data-table tr:hover {
  background: #f9fafb;
}

/* Status badges */
.status-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.status-active { background: #d1fae5; color: #065f46; }
.status-inactive { background: #fee2e2; color: #991b1b; }
.status-prospect { background: #fef3c7; color: #92400e; }
.status-recruited { background: #dbeafe; color: #1e40af; }
.status-verified { background: #e0e7ff; color: #3730a3; }
.status-approved { background: #d1fae5; color: #065f46; }
.status-active { background: #d1fae5; color: #065f46; }
.status-paused { background: #fef3c7; color: #92400e; }
.status-suspended { background: #fee2e2; color: #991b1b; }

/* Tier badges */
.tier-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.tier-bronze { background: #fef3c7; color: #92400e; }
.tier-silver { background: #e5e7eb; color: #374151; }
.tier-gold { background: #fef9c3; color: #854d0e; }
.tier-platinum { background: #e0e7ff; color: #3730a3; }

/* Card styles */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

/* Form styles */
input[type="text"], input[type="email"], input[type="password"], 
input[type="number"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 107, 84, 0.12);
}

button {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary {
  background: var(--brand);
  color: white;
}

.btn-primary:hover {
  background: var(--brand-dark);
}

/* Utility classes for text truncation */
.truncatewords {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hero p {
  color: white !important;
}
.flashes { list-style: none; padding: 0; margin: 0 0 20px; }
.flashes li {
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--brand); box-shadow: var(--shadow-sm);
  margin-bottom: 8px; font-size: 14px;
}
.flashes li.success { border-left-color: var(--success); background: var(--success-bg); }
.flashes li.error { border-left-color: var(--danger); background: var(--danger-bg); }
.flashes li.warning { border-left-color: var(--warning); background: var(--warning-bg); }
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (min-width: 800px) { .grid.kpi { grid-template-columns: repeat(4, 1fr); } }

/* Page headers */
.page-header {
  margin-bottom: 24px;
}
.page-header h1 {
  margin: 0 0 4px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.page-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* Force 2 columns on mobile for ALL grid layouts system-wide */
@media (max-width: 767px) {
  .grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  
  .grid.kpi {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  
  /* Product catalogue specific */
  .product-catalogue {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  
  /* Product list specific */
  .product-list {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  
  /* Cards in general */
  .card {
    padding: 12px !important;
  }
  
  .card h2, .card h3 {
    font-size: 0.9em !important;
    margin-bottom: 6px !important;
  }
  
  .card .n {
    font-size: 18px !important;
  }
  
  .card p {
    font-size: 0.8em !important;
  }
  
  .card .muted {
    font-size: 0.75em !important;
  }
  
  /* KPI cards specific */
  .kpi-card {
    padding: 12px !important;
  }
  
  .kpi-content h3 {
    font-size: 0.7em !important;
  }
  
  .kpi-value {
    font-size: 16px !important;
  }
  
  .kpi-icon {
    font-size: 24px !important;
  }
  
  /* Make clickable cards work better on mobile */
  .clickable-card {
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  
  .metric-card {
    min-height: 80px;
  }
  
  /* Data table responsive - scroll instead of hiding columns */
  .card:has(.data-table),
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .data-table {
    font-size: 0.85em !important;
    min-width: 640px;
  }
  
  .data-table th,
  .data-table td {
    padding: 10px 8px !important;
    white-space: nowrap;
  }
  
  /* Form grid: single column on mobile */
  .form-grid {
    grid-template-columns: 1fr !important;
  }
  
  /* Status badges mobile optimization */
  .status-badge {
    font-size: 0.65em !important;
    padding: 2px 6px !important;
  }
}

/* PWA install bottom sheet */
body.pwa-sheet-open { overflow: hidden; }

.pwa-install-sheet {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.pwa-install-sheet[hidden] {
  display: none !important;
  pointer-events: none;
}

.pwa-install-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  animation: pwaFadeIn 0.12s ease;
}

.pwa-install-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 28px 24px calc(24px + env(safe-area-inset-bottom));
  text-align: center;
  box-shadow: 0 -8px 40px rgba(15, 23, 42, 0.15);
  animation: pwaSlideUp 0.15s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes pwaFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

.pwa-install-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  color: var(--muted);
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.pwa-install-icon {
  border-radius: 16px;
  margin: 0 auto 16px;
  box-shadow: var(--shadow);
}

.pwa-install-title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.pwa-install-desc {
  margin: 0 0 20px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.pwa-install-steps {
  text-align: left;
  margin: 0 0 20px;
  padding-left: 20px;
  font-size: 14px;
  color: var(--ink);
  line-height: 1.6;
}

.pwa-install-steps li {
  margin-bottom: 8px;
}

.pwa-install-action {
  display: block;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius);
  background: var(--brand);
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}

.pwa-install-action:hover:not(:disabled) {
  background: var(--brand-dark);
}

.pwa-install-action:disabled {
  opacity: 0.7;
  cursor: wait;
}

.pwa-install-dismiss {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.pwa-install-dismiss:hover {
  color: var(--ink);
}

@media (min-width: 769px) {
  .pwa-install-sheet {
    align-items: center;
  }
  .pwa-install-panel {
    border-radius: var(--radius-lg);
    max-width: 380px;
    padding-bottom: 28px;
    animation: pwaPopIn 0.3s ease;
  }
  @keyframes pwaPopIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
  }
}

/* Legacy PWA modal (kept for compatibility) */
.pwa-install-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: white;
  border-radius: 16px;
  max-width: 400px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.3s ease-out;
}

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

.modal-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 24px 16px;
  text-align: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.app-icon {
  width: 56px;
  height: 56px;
  background: var(--brand);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: white;
}

.app-icon svg {
  width: 32px;
  height: 32px;
}

.modal-header h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.close-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

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

.modal-body p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 15px;
}

.feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.feature-list li {
  padding: 8px 0;
  color: var(--ink);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-footer {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.modal-footer .btn {
  flex: 1;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-footer .btn.primary {
  background: var(--brand);
  color: white;
}

.modal-footer .btn.primary:hover {
  background: var(--brand-dark);
}

.modal-footer .btn.secondary {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
}

.modal-footer .btn.secondary:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* Mobile bottom-sheet install popup */
.pwa-install-modal.mobile-bottom-sheet {
  align-items: flex-end;
}

.pwa-install-modal.mobile-bottom-sheet .modal-content {
  width: 100%;
  max-width: none;
  border-radius: 20px 20px 0 0;
  animation: slideUpMobile 0.35s ease-out;
  padding-bottom: env(safe-area-inset-bottom);
}

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

.install-btn.visible {
  animation: installPulse 2s infinite;
}

@keyframes installPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(31, 107, 84, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(31, 107, 84, 0);
  }
}

/* Mobile-specific modal adjustments */
@media (max-width: 480px) {
  .modal-content {
    width: 95%;
    max-width: none;
  }
  
  .modal-header {
    padding: 20px 20px 16px;
  }
  
  .modal-body {
    padding: 16px 20px;
  }
  
  .modal-footer {
    padding: 12px 20px;
  }
  
  .modal-footer .btn {
    padding: 10px 16px;
    font-size: 14px;
  }
}

/* iOS Install Steps Styles */
.install-steps {
  margin-top: 16px;
}

.step {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: flex-start;
}

.step:last-child {
  margin-bottom: 0;
}

.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.step-content {
  flex: 1;
}

.step-content strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
}

.step-content small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.card, .neu {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card:hover { border-color: #cbd5e1; }
.card[onclick], .clickable-card { cursor: pointer; }
.clickable-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow);
}
.kpi-card:hover { box-shadow: var(--shadow); }
.metric-card:hover { box-shadow: var(--shadow); }
.card h3 {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.card .n {
  font-size: 26px;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.btn, button.btn, input[type=submit] {
  display: inline-block; text-align: center;
  background: var(--brand); color: white; border: 0;
  border-radius: var(--radius); padding: 10px 18px; font-weight: 600;
  font-size: 14px; width: auto; margin: 4px 0; cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: var(--brand-dark); }
.btn:active { transform: none; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--border); }
.btn.secondary:hover { background: var(--bg); border-color: #cbd5e1; }
.btn.gold { background: var(--warning); color: white; }
.btn.gold:hover { background: #b45309; }
.btn.success { background: var(--success); }
.btn.success:hover { background: #047857; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #b91c1c; }
.input, select, textarea {
  width: 100%; padding: 12px 16px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.1);
  margin: 8px 0 16px; font-size: 15px; background: white; color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 107, 84, 0.12);
}
.input[type="checkbox"] {
  width: 20px; padding: 0; margin: 0 12px 0 0; height: 20px; cursor: pointer;
  accent-color: var(--primary);
}
.form-group label {
  display: flex; align-items: center; font-weight: 500; margin-bottom: 8px; color: var(--ink);
  cursor: pointer;
  font-size: 14px;
}
.form-group {
  margin-bottom: 20px;
}
.form-group label:hover { color: var(--brand); }
.form-group textarea {
  width: 100%; padding: 12px 16px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.1);
  margin: 8px 0 0; font-size: 15px; background: white; color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s; resize: vertical;
}
.form-group textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 107, 84, 0.12);
}
.linkish { background: none; border: 0; color: var(--accent); font-weight: 600; cursor: pointer; }
.linkish:hover { color: #1d4ed8; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.hero {
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.muted { color: var(--muted); }
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}
.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.login-card h1 {
  margin: 8px 0 12px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.login-card .brand-mark {
  width: 48px; height: 48px; border-radius: var(--radius);
  background: var(--brand); color: white;
  display: grid; place-items: center;
  font-weight: 700; font-size: 20px;
  margin-bottom: 20px;
}
.badge { display: inline-block; border-radius: 999px; padding: 4px 12px; font-size: 11px; font-weight: 600; background: var(--brand-light); color: var(--brand-dark); }
.leaflet-wrap { height: 260px; border-radius: 20px; overflow: hidden; box-shadow: var(--press); margin: 10px 0 16px; }
.leaflet-wrap.tall { height: 420px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; display: inline-block; }
.more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.more-grid a { padding: 18px 12px; border-radius: 20px; box-shadow: var(--light); background: var(--bg); color: var(--ink); font-weight: 700; }
.live-toggle {
  display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--green);
}
.live-toggle input { width: auto; margin: 0; box-shadow: var(--press); }
#id_latitude, #id_longitude, #id_last_lat, #id_last_lng { font-variant-numeric: tabular-nums; }

/* Sidebar */
.sidebar {
  position: fixed;
  top: 57px;
  left: 0;
  bottom: 0;
  width: 280px;
  max-width: 88vw;
  background: var(--surface);
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  z-index: 1050;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 57px);
  height: calc(100dvh - 57px);
  border-right: 1px solid var(--border);
  overflow: hidden;
  max-width: 100%;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1040;
  border: 0;
  padding: 0;
  margin: 0;
}

.sidebar-overlay[hidden] {
  display: none !important;
}

body.sidebar-open {
  overflow: hidden;
}

body.sidebar-open .sidebar-overlay {
  display: block !important;
}

.sidebar.open {
  transform: translateX(0);
}
.sidebar-header {
  padding: 20px 16px; border-bottom: 1px solid var(--border);
  flex-shrink: 0; background: var(--surface);
}
.user-info { font-weight: 600; font-size: 14px; color: var(--ink); }
.user-role {
  font-size: 11px; color: var(--brand);
  margin-top: 2px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.sidebar-nav { 
  padding: 8px; 
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}
.nav-section {
  padding: 16px 12px 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.sidebar-nav a {
  display: block; padding: 9px 12px; border-radius: var(--radius);
  color: var(--ink); margin-bottom: 2px;
  transition: background 0.15s, color 0.15s;
  font-weight: 500; font-size: 13px;
}
.sidebar-nav a:hover { background: var(--brand-light); color: var(--brand-dark); }
.sidebar-nav a.active {
  background: var(--brand);
  color: white;
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(0,0,0,0.08);
  flex-shrink: 0;
  background: white;
  margin-top: auto;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(220, 53, 69, 0.2);
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  text-align: left;
  justify-content: flex-start;
}

.logout-btn:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

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

.logout-btn svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

/* Status and Tier Badges */
.status-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.status-prospect { background: #e9ecef; color: #6c757d; }
.status-recruited { background: #cce5ff; color: #004085; }
.status-verified { background: #d4edda; color: #155724; }
.status-approved { background: #d1ecf1; color: #0c5460; }
.status-onboarded { background: #fff3cd; color: #856404; }
.status-active { background: #d4edda; color: #155724; }
.status-inactive { background: #f8d7da; color: #721c24; }
.status-paused { background: #fff3cd; color: #856404; }
.status-suspended { background: #f8d7da; color: #721c24; }
.status-deactivated { background: #e2e3e5; color: #383d41; }
.status-new { background: #cce5ff; color: #004085; }
.status-contacted { background: #fff3cd; color: #856404; }
.status-converted { background: #d4edda; color: #155724; }
.status-lost { background: #f8d7da; color: #721c24; }
.status-planned { background: #cce5ff; color: #004085; }
.status-submitted { background: #fff3cd; color: #856404; }
.status-published { background: #c3e6cb; color: #155724; }
.status-rejected { background: #f8d7da; color: #721c24; }
.status-calculated { background: #cce5ff; color: #004085; }
.status-pending { background: #fff3cd; color: #856404; }
.status-held { background: #ffeeba; color: #856404; }
.status-paid { background: #d4edda; color: #155724; }

.tier-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.tier-high_performer { background: #d4edda; color: #155724; }
.tier-normal_performer { background: #cce5ff; color: #004085; }
.tier-low_performer { background: #fff3cd; color: #856404; }
.tier-under_review { background: #f8d7da; color: #721c24; }

/* Data Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.data-table th {
  text-align: left;
  padding: 16px;
  background: #f8f9fa;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 2px solid rgba(0,0,0,0.05);
}
.data-table td {
  padding: 16px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.data-table tr:hover {
  background: #f8f9fa;
}
.data-table tr:last-child td {
  border-bottom: none;
}

/* Status Section */
.status-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(0,0,0,0.1);
}
.status-section h3 {
  font-size: 14px;
  margin: 12px 0 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Big Number for Performance */
.big-number {
  font-size: 28px;
  font-weight: 700;
  color: var(--brand);
  margin: 8px 0;
  letter-spacing: -0.02em;
}

/* Feature list (PWA modal) */
.feature-list li::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand);
  margin-right: 10px;
  flex-shrink: 0;
}
.feature-list li {
  padding: 6px 0;
  display: flex;
  align-items: center;
}

/* Promo banner & quick links */
.promo-banner {
  background: var(--brand);
  color: white;
  border: none;
}
.promo-banner h2 { color: white; margin: 0; font-size: 1.1rem; }
.promo-banner p { margin: 4px 0 0; opacity: 0.9; font-size: 14px; }
.promo-banner .btn-promo {
  background: white;
  color: var(--brand);
  padding: 10px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.promo-banner .btn-promo:hover { background: var(--brand-light); }

.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.quick-link {
  display: block;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.quick-link:hover {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand-dark);
}

/* Stat banner for dashboards */
.stat-banner {
  background: var(--brand);
  color: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}
.stat-banner h1 { margin: 0 0 16px; font-size: 1.4rem; font-weight: 700; }
.stat-pills { display: flex; flex-wrap: wrap; gap: 12px; }
.stat-pill {
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius);
  padding: 10px 16px;
}
.stat-pill span { display: block; font-size: 11px; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-pill strong { display: block; font-size: 1.1rem; margin-top: 2px; }

.competition-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.competition-card.active { border-color: var(--brand); }
.competition-header {
  background: var(--brand);
  color: white;
  padding: 20px;
}
.competition-header.upcoming { background: var(--accent); }
.competition-header.completed { background: var(--success); }
.competition-header.other { background: var(--muted); }

.location-search-wrapper {
  position: relative;
}

.location-input-group {
  display: flex;
  gap: 12px;
}

.location-input-group .input {
  flex: 1;
}

.location-btn {
  white-space: nowrap;
  padding: 12px 16px;
}

.location-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  max-height: 300px;
  overflow-y: auto;
  z-index: 100;
  margin-top: 8px;
  border: 1px solid rgba(0,0,0,0.1);
}

.location-result {
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  transition: background 0.2s;
}

.location-result:hover {
  background: #f8f9fa;
}

.location-result:last-child {
  border-bottom: none;
}

.result-name {
  font-weight: 600;
  color: var(--ink);
}

.result-coordinates {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.no-results {
  padding: 16px;
  color: var(--muted);
  text-align: center;
}

.selected-location {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  background: rgba(40, 167, 69, 0.1);
  border-radius: 8px;
  margin-top: 12px;
  border: 1px solid rgba(40, 167, 69, 0.2);
}

.location-info {
  display: flex;
  gap: 8px;
  align-items: center;
}

.coordinates {
  font-size: 12px;
  color: var(--muted);
}

/* Hamburger Menu - mobile only */
@media (max-width: 1023px) {
  .menu-toggle {
    display: flex !important;
    color: #2563eb !important;
    background: var(--surface) !important;
    border: 1px solid #bfdbfe !important;
    font-size: inherit;
  }
  .menu-toggle svg {
    stroke: #2563eb !important;
    color: #2563eb !important;
    width: 20px;
    height: 20px;
  }
  .menu-toggle-label {
    display: inline;
  }
}

@media (min-width: 1024px) {
  .menu-toggle {
    display: none !important;
  }
  .menu-toggle-label {
    display: none;
  }
}

/* Mobile Responsiveness */
@media (max-width: 1023px) {
  .live-toggle,
  .nav-link {
    display: inline-flex !important;
  }

  .sidebar {
    top: 0;
    height: 100vh;
    height: 100dvh;
    padding-top: calc(57px + env(safe-area-inset-top));
  }

  .page {
    padding: 16px 16px 32px;
    margin-left: 0 !important;
    width: 100%;
  }

  .sidebar-footer {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    z-index: 10;
    padding: 12px 16px;
  }

  .sidebar-header {
    padding: 16px;
  }

  .sidebar-nav {
    padding: 8px;
  }

  .grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  .grid.kpi {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

  .card {
    margin: 0 !important;
  }

  .product-catalogue,
  .product-list,
  .more-grid,
  .review-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }

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

@media (min-width: 1024px) {
  .sidebar {
    transform: translateX(0) !important;
    top: 65px;
    height: calc(100vh - 65px);
    height: calc(100dvh - 65px);
    padding-top: 0;
  }

  .page.with-sidebar {
    margin-left: 280px;
  }

  .sidebar-overlay {
    display: none !important;
  }
}

/* Responsive grid adjustments */
@media (max-width: 640px) {
  .grid.kpi { grid-template-columns: 1fr; }
  .card .n { font-size: 24px; }
}
