/* ============================================================
   GLOBAL DIST MANAGER — Main Stylesheet
   Clean White + Green Gradient Theme | Mobile-First PWA
   ============================================================ */

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

/* ─── CSS Variables ─────────────────────────────────────── */
:root {
  --green-50:  #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --green-800: #166534;
  --green-900: #14532d;

  --grad-primary:   linear-gradient(135deg, #22c55e 0%, #16a34a 50%, #15803d 100%);
  --grad-secondary: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
  --grad-card:      linear-gradient(145deg, #ffffff 0%, #f0fdf4 100%);
  --grad-dark:      linear-gradient(135deg, #14532d 0%, #166534 100%);

  --white:    #ffffff;
  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  --red-500:    #ef4444;
  --orange-500: #f97316;
  --blue-500:   #3b82f6;
  --yellow-500: #eab308;
  --purple-500: #a855f7;

  --bronze:   #cd7f32;
  --silver:   #c0c0c0;
  --gold:     #ffd700;
  --platinum: #e5e4e2;
  --diamond:  #b9f2ff;

  --font-main: 'Plus Jakarta Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.07);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
  --shadow-xl: 0 16px 48px rgba(0,0,0,.15);
  --shadow-green: 0 4px 20px rgba(22,163,74,.25);
  --shadow-green-lg: 0 8px 32px rgba(22,163,74,.35);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --bottom-nav-h: 70px;
  --header-h: 64px;
  --sidebar-w: 260px;

  --transition: all .2s ease;
  --transition-slow: all .4s cubic-bezier(.4,0,.2,1);
}

/* ─── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green-600); text-decoration: none; }
a:hover { color: var(--green-700); }
img { max-width: 100%; display: block; }
ul { list-style: none; }

/* ─── Typography ────────────────────────────────────────── */
h1 { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 800; color: var(--gray-900); }
h2 { font-size: clamp(1.25rem, 3vw, 1.5rem); font-weight: 700; color: var(--gray-800); }
h3 { font-size: 1.125rem; font-weight: 600; color: var(--gray-800); }
h4 { font-size: 1rem; font-weight: 600; color: var(--gray-700); }
p  { color: var(--gray-600); }
small { font-size: .8rem; color: var(--gray-500); }

/* ─── Layout Wrapper ────────────────────────────────────── */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar (Desktop) ─────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--grad-dark);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  transition: var(--transition-slow);
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-logo .logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--grad-secondary);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  box-shadow: var(--shadow-green);
}

.sidebar-logo .logo-sub {
  font-size: .7rem;
  color: rgba(255,255,255,.5);
  font-weight: 400;
  margin-top: 2px;
}

.sidebar-nav { padding: 12px 12px; flex: 1; }

.nav-group-label {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.35);
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.7);
  font-size: .875rem;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(255,255,255,.08);
  color: var(--white);
}

.nav-item.active {
  background: var(--grad-secondary);
  color: var(--white);
  box-shadow: var(--shadow-green);
}

.nav-item .nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--red-500);
  color: white;
  font-size: .65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.sidebar-user {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: var(--grad-secondary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: white;
  font-size: .85rem;
  flex-shrink: 0;
}

.user-info { flex: 1; overflow: hidden; }
.user-info .user-name { font-size: .8rem; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .user-role { font-size: .7rem; color: rgba(255,255,255,.5); }

/* ─── Main Content ──────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: 0;
}

/* ─── Top Header ────────────────────────────────────────── */
.top-header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}

.header-title {
  flex: 1;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
}

.header-actions { display: flex; align-items: center; gap: 8px; }

.btn-icon {
  width: 38px; height: 38px;
  border: none;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  color: var(--gray-600);
  transition: var(--transition);
  position: relative;
}
.btn-icon:hover { background: var(--green-100); color: var(--green-600); }
.btn-icon .badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--red-500);
  border-radius: 50%;
  border: 1.5px solid white;
}

/* ─── Page Content ──────────────────────────────────────── */
.page-content { padding: 24px; flex: 1; }

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

.page-header-left .page-title { font-size: 1.4rem; font-weight: 800; color: var(--gray-900); }
.page-header-left .page-sub   { font-size: .85rem; color: var(--gray-500); margin-top: 2px; }

/* ─── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  overflow: hidden;
}

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

.card-title { font-size: 1rem; font-weight: 700; color: var(--gray-800); }
.card-body  { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--gray-100); background: var(--gray-50); }

/* ─── Stat Cards ─────────────────────────────────────────── */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px;
  height: 100%;
}
.stat-card.green::before  { background: var(--grad-primary); }
.stat-card.blue::before   { background: var(--blue-500); }
.stat-card.orange::before { background: var(--orange-500); }
.stat-card.purple::before { background: var(--purple-500); }
.stat-card.red::before    { background: var(--red-500); }

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

.stat-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.stat-icon.green  { background: var(--green-100);  color: var(--green-600); }
.stat-icon.blue   { background: #eff6ff; color: var(--blue-500); }
.stat-icon.orange { background: #fff7ed; color: var(--orange-500); }
.stat-icon.purple { background: #faf5ff; color: var(--purple-500); }
.stat-icon.red    { background: #fef2f2; color: var(--red-500); }

.stat-info { flex: 1; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--gray-900); line-height: 1; }
.stat-label { font-size: .78rem; color: var(--gray-500); margin-top: 4px; }
.stat-change { font-size: .75rem; font-weight: 600; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.stat-change.up   { color: var(--green-600); }
.stat-change.down { color: var(--red-500); }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: .875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

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

.btn-primary {
  background: var(--grad-primary);
  color: white;
  box-shadow: var(--shadow-green);
}
.btn-primary:hover {
  box-shadow: var(--shadow-green-lg);
  transform: translateY(-1px);
  color: white;
}

.btn-secondary {
  background: var(--green-100);
  color: var(--green-700);
}
.btn-secondary:hover { background: var(--green-200); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--gray-300);
  color: var(--gray-700);
}
.btn-outline:hover { border-color: var(--green-500); color: var(--green-600); background: var(--green-50); }

.btn-danger  { background: var(--red-500);    color: white; }
.btn-warning { background: var(--orange-500); color: white; }
.btn-info    { background: var(--blue-500);   color: white; }

.btn-sm { padding: 6px 14px; font-size: .8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-full { width: 100%; }

.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ─── Forms ──────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-label .required { color: var(--red-500); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: .875rem;
  color: var(--gray-800);
  background: var(--white);
  transition: var(--transition);
  appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(34,197,94,.15);
}

.form-control::placeholder { color: var(--gray-400); }
.form-control:disabled { background: var(--gray-100); opacity: .7; cursor: not-allowed; }

textarea.form-control { resize: vertical; min-height: 90px; }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-hint { font-size: .75rem; color: var(--gray-500); margin-top: 4px; }
.form-error { font-size: .75rem; color: var(--red-500); margin-top: 4px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ─── Tables ─────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius-md); }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}

.table th {
  background: var(--gray-50);
  padding: 11px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--gray-500);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--green-50); transition: var(--transition); }

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

.badge-green    { background: var(--green-100); color: var(--green-700); }
.badge-blue     { background: #eff6ff;           color: #1d4ed8; }
.badge-orange   { background: #fff7ed;           color: #c2410c; }
.badge-red      { background: #fef2f2;           color: #b91c1c; }
.badge-gray     { background: var(--gray-100);   color: var(--gray-600); }
.badge-purple   { background: #faf5ff;           color: #7c3aed; }
.badge-yellow   { background: #fefce8;           color: #a16207; }

/* Order status badges */
.badge-draft      { background: var(--gray-100); color: var(--gray-600); }
.badge-submitted  { background: #eff6ff; color: #1d4ed8; }
.badge-approved   { background: var(--green-100); color: var(--green-700); }
.badge-processing { background: #fff7ed; color: #c2410c; }
.badge-dispatched { background: #faf5ff; color: #7c3aed; }
.badge-delivered  { background: var(--green-100); color: var(--green-800); }
.badge-cancelled  { background: #fef2f2; color: #b91c1c; }

/* ─── Circular Progress (Target Ring) ────────────────────── */
.target-ring-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.target-ring {
  position: relative;
  width: 120px; height: 120px;
}

.target-ring svg { transform: rotate(-90deg); }

.target-ring circle.bg {
  fill: none;
  stroke: var(--gray-100);
  stroke-width: 10;
}

.target-ring circle.progress {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  stroke: url(#ringGrad);
  transition: stroke-dashoffset 1.5s cubic-bezier(.4,0,.2,1);
}

.target-ring .ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.ring-pct { font-size: 1.3rem; font-weight: 800; color: var(--gray-900); line-height: 1; }
.ring-label { font-size: .65rem; color: var(--gray-500); margin-top: 2px; }

/* ─── Achievement Tier Badges ────────────────────────────── */
.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: .8rem;
  font-weight: 700;
}
.tier-bronze  { background: linear-gradient(135deg, #cd7f32, #a0522d); color: white; }
.tier-silver  { background: linear-gradient(135deg, #c0c0c0, #909090); color: white; }
.tier-gold    { background: linear-gradient(135deg, #ffd700, #ffa500); color: #7c4700; }
.tier-platinum{ background: linear-gradient(135deg, #e5e4e2, #a8a9ad); color: #333; }
.tier-diamond { background: linear-gradient(135deg, #b9f2ff, #6ecbf5); color: #006080; }

/* ─── Alerts ─────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}
.alert-success { background: var(--green-100); color: var(--green-800); border-left: 4px solid var(--green-500); }
.alert-error   { background: #fef2f2; color: #991b1b; border-left: 4px solid var(--red-500); }
.alert-warning { background: #fff7ed; color: #9a3412; border-left: 4px solid var(--orange-500); }
.alert-info    { background: #eff6ff; color: #1e40af; border-left: 4px solid var(--blue-500); }

/* ─── Modals ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s ease;
  backdrop-filter: blur(2px);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
  background: var(--white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  padding-bottom: calc(env(safe-area-inset-bottom) + 16px);
}
.modal-overlay.active .modal { transform: translateY(0); }

.modal-handle {
  width: 40px; height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  margin: 12px auto 0;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 1rem; font-weight: 700; color: var(--gray-900); }
.modal-close {
  width: 32px; height: 32px;
  border: none;
  background: var(--gray-100);
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  color: var(--gray-600);
}
.modal-close:hover { background: var(--gray-200); }

.modal-body   { padding: 20px; }
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Desktop Modal (center) */
@media (min-width: 768px) {
  .modal-overlay { align-items: center; }
  .modal {
    border-radius: var(--radius-xl);
    transform: scale(.9);
    max-width: 560px;
  }
  .modal-overlay.active .modal { transform: scale(1); }
  .modal-handle { display: none; }
}

/* ─── Toast Notifications ────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  max-width: 360px;
  pointer-events: all;
  animation: slideIn .3s ease;
  border-left: 4px solid var(--green-500);
}

.toast.error  { border-left-color: var(--red-500); }
.toast.warning{ border-left-color: var(--orange-500); }
.toast.info   { border-left-color: var(--blue-500); }

.toast-icon { font-size: 1.2rem; }
.toast-msg  { flex: 1; font-size: .85rem; font-weight: 500; color: var(--gray-800); }

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

/* ─── Restock Popup ──────────────────────────────────────── */
.restock-popup {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 16px);
  left: 16px; right: 16px;
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 2px solid var(--orange-500);
  padding: 16px;
  z-index: 900;
  animation: popUp .4s cubic-bezier(.4,0,.2,1);
  display: none;
}
.restock-popup.show { display: flex; gap: 12px; align-items: flex-start; }

.restock-icon {
  width: 44px; height: 44px;
  background: #fff7ed;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.restock-info { flex: 1; }
.restock-title { font-weight: 700; color: var(--gray-900); font-size: .9rem; }
.restock-msg   { font-size: .8rem; color: var(--gray-600); margin-top: 2px; }
.restock-actions { display: flex; gap: 8px; margin-top: 10px; }

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

/* ─── World Map ──────────────────────────────────────────── */
#worldMap {
  height: 420px;
  border-radius: var(--radius-lg);
  z-index: 1;
  border: 1px solid var(--gray-200);
}

.leaflet-popup-content-wrapper {
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-lg) !important;
  padding: 0 !important;
  overflow: hidden;
}
.leaflet-popup-content { margin: 0 !important; }
.map-popup { padding: 14px 16px; min-width: 200px; }
.map-popup .popup-name { font-weight: 700; color: var(--gray-900); font-size: .9rem; }
.map-popup .popup-country { font-size: .75rem; color: var(--gray-500); }
.map-popup .popup-stats { margin-top: 8px; display: flex; gap: 12px; }
.map-popup .popup-stat { text-align: center; }
.map-popup .popup-stat-val { font-weight: 700; font-size: .95rem; color: var(--green-600); }
.map-popup .popup-stat-lbl { font-size: .65rem; color: var(--gray-500); }

/* ─── Bottom Navigation (Mobile PWA) ────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
}

.bottom-nav-inner {
  display: flex;
  height: 100%;
  align-items: center;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  text-decoration: none;
  padding: 6px 4px;
  position: relative;
  transition: var(--transition);
}

.bottom-nav-item .nav-icon {
  font-size: 1.25rem;
  color: var(--gray-400);
  transition: var(--transition);
}
.bottom-nav-item .nav-label {
  font-size: .62rem;
  font-weight: 600;
  color: var(--gray-400);
  transition: var(--transition);
}

.bottom-nav-item.active .nav-icon,
.bottom-nav-item.active .nav-label { color: var(--green-600); }

.bottom-nav-item.active .nav-icon {
  transform: translateY(-2px);
  filter: drop-shadow(0 2px 4px rgba(22,163,74,.3));
}

.bottom-nav-center {
  width: 56px; height: 56px;
  background: var(--grad-primary);
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  color: white;
  box-shadow: var(--shadow-green);
  margin-top: -16px;
  border: 3px solid white;
  flex-shrink: 0;
  transition: var(--transition);
}
.bottom-nav-center:hover { transform: scale(1.05); }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }

  .main-content { margin-left: 0; padding-bottom: var(--bottom-nav-h); }
  .bottom-nav { display: flex; }
  .page-content { padding: 16px; }

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

  .stat-cards { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card  { padding: 14px; }
  .stat-value { font-size: 1.2rem; }

  .table th { padding: 8px 12px; }
  .table td { padding: 10px 12px; }

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

  #worldMap { height: 300px; }
  .toast-container { left: 8px; right: 8px; }
  .toast { min-width: auto; max-width: 100%; }
}

@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr; }
}

/* ─── Sidebar Overlay (Mobile) ───────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* ─── Animations ─────────────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .4s ease forwards; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}
.pulse { animation: pulse 2s ease infinite; }

@keyframes confetti-fall {
  0%   { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

@keyframes bounce-in {
  0%   { transform: scale(0); }
  60%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}
.bounce-in { animation: bounce-in .5s cubic-bezier(.4,0,.2,1) forwards; }

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ─── Charts placeholder ─────────────────────────────────── */
.chart-wrapper { position: relative; width: 100%; }
.chart-canvas  { width: 100% !important; }

/* ─── Empty State ────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { color: var(--gray-700); margin-bottom: 8px; }
.empty-state p  { color: var(--gray-500); font-size: .875rem; }

/* ─── Pagination ─────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; align-items: center; justify-content: center; padding: 16px; flex-wrap: wrap; }
.page-btn {
  min-width: 36px; height: 36px;
  border: 1.5px solid var(--gray-200);
  background: var(--white);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
  color: var(--gray-700);
  font-family: var(--font-main);
}
.page-btn:hover    { border-color: var(--green-500); color: var(--green-600); }
.page-btn.active   { background: var(--grad-primary); border-color: transparent; color: white; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ─── Login Page Specific ────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--green-50) 0%, white 50%, var(--green-100) 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(34,197,94,.12) 0%, transparent 70%);
  border-radius: 50%;
}

.login-page::after {
  content: '';
  position: absolute;
  bottom: -100px; left: -100px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(22,163,74,.1) 0%, transparent 70%);
  border-radius: 50%;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
  animation: fadeIn .5s ease;
  border: 1px solid var(--gray-100);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.login-logo-icon {
  width: 48px; height: 48px;
  background: var(--grad-primary);
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  box-shadow: var(--shadow-green);
}

.login-logo-text h1 { font-size: 1.3rem; font-weight: 800; color: var(--gray-900); }
.login-logo-text p  { font-size: .75rem; color: var(--gray-500); }

.login-title { font-size: 1.5rem; font-weight: 800; color: var(--gray-900); margin-bottom: 6px; }
.login-sub   { font-size: .875rem; color: var(--gray-500); margin-bottom: 28px; }

.lang-selector {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.lang-btn {
  padding: 4px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-full);
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--gray-600);
  font-family: var(--font-main);
  transition: var(--transition);
}
.lang-btn.active, .lang-btn:hover {
  border-color: var(--green-500);
  color: var(--green-600);
  background: var(--green-50);
}

.input-with-icon {
  position: relative;
}
.input-with-icon .form-control { padding-left: 42px; }
.input-with-icon .input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 1rem;
  pointer-events: none;
}
.input-with-icon .eye-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--gray-400);
  font-size: .9rem;
}

/* ─── Dashboard Leaderboard ──────────────────────────────── */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}
.leaderboard-item:last-child { border-bottom: none; }
.lb-rank { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 800; flex-shrink: 0; }
.lb-rank.r1 { background: var(--gold); color: #7c4700; }
.lb-rank.r2 { background: var(--silver); color: #333; }
.lb-rank.r3 { background: var(--bronze); color: white; }
.lb-rank.other { background: var(--gray-100); color: var(--gray-600); }
.lb-name  { flex: 1; font-weight: 600; font-size: .85rem; color: var(--gray-800); }
.lb-country { font-size: .75rem; color: var(--gray-500); }
.lb-amount { font-weight: 700; color: var(--green-600); font-size: .9rem; }

/* ─── Progress Bar ───────────────────────────────────────── */
.progress-bar { height: 6px; background: var(--gray-100); border-radius: 3px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--grad-primary); border-radius: 3px; transition: width 1s ease; }

/* ─── Confetti canvas ────────────────────────────────────── */
#confettiCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 9998;
}

/* ─── Data table search/filter bar ──────────────────────── */
.table-toolbar {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-100);
  flex-wrap: wrap;
  align-items: center;
}
.table-search { position: relative; flex: 1; min-width: 200px; }
.table-search input { padding-left: 36px; }
.table-search .search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: .9rem;
  pointer-events: none;
}

/* ─── Utilities ──────────────────────────────────────────── */
.text-green  { color: var(--green-600); }
.text-red    { color: var(--red-500); }
.text-orange { color: var(--orange-500); }
.text-gray   { color: var(--gray-500); }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.font-bold   { font-weight: 700; }
.font-mono   { font-family: var(--font-mono); }
.mt-1 { margin-top: 4px; }   .mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }  .mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }  .mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.rounded-full { border-radius: var(--radius-full); }
.overflow-hidden { overflow: hidden; }
