/* ─── CSS Variables ──────────────────────────────────────────────────────────── */
:root {
  --green-50:  #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --green-700: #15803d;
  --blue-50:   #eff6ff;
  --blue-400:  #60a5fa;
  --blue-500:  #3b82f6;
  --blue-600:  #2563eb;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --red-400:   #f87171;
  --red-500:   #ef4444;
  --red-600:   #dc2626;
  --purple-400:#c084fc;
  --purple-500:#a855f7;
  --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;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow:    0 4px 16px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);

  --nav-h: 64px;
  --sidebar-w: 240px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }
ul, ol { list-style: none; }

/* ─── Typography Utilities ───────────────────────────────────────────────────── */
.text-green  { color: var(--green-600); }
.text-blue   { color: var(--blue-500); }
.text-red    { color: var(--red-500); }
.text-muted  { color: var(--gray-500); }
.text-sm     { font-size: 0.875rem; }
.text-xs     { font-size: 0.75rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-3 { margin-bottom: 0.75rem; }
.p-0 { padding: 0 !important; }

/* ─── Navbar ─────────────────────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--green-700);
}
.brand-icon { font-size: 1.4rem; }

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-600);
  transition: background .15s, color .15s;
}
.nav-link:hover, .nav-link.active {
  background: var(--green-50);
  color: var(--green-700);
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}
.user-greeting { font-size: 0.875rem; color: var(--gray-600); }
.btn-logout {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: none;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--gray-600);
  transition: all .15s;
}
.btn-logout:hover { background: var(--red-500); color: #fff; border-color: var(--red-500); }

.navbar-toggle { display: none; background: none; border: none; font-size: 1.5rem; color: var(--gray-600); }

/* ─── Language Switcher (Premium) ────────────────────────────────────────────── */
.lang-switcher {
  position: relative;
  display: inline-block;
}

.lang-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-700);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.lang-btn:hover {
  background: #fff;
  border-color: var(--green-400);
  color: var(--green-700);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.08);
  transform: translateY(-1px);
}

.lang-flag-current {
  font-size: 1.1rem;
  line-height: 1;
}

.lang-label-current {
  display: inline-block;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 0.75rem);
  right: 0;
  min-width: 180px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  padding: 0.5rem;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px) scale(0.95);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: top right;
}

.lang-switcher:focus-within .lang-dropdown,
.lang-switcher:hover .lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.rtl .lang-dropdown {
  right: auto;
  left: 0;
  transform-origin: top left;
}

.lang-dropdown-header {
  padding: 0.5rem 0.75rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-400);
  pointer-events: none;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--gray-700);
  transition: all 0.15s ease;
}

.lang-option:hover {
  background: var(--green-50);
  color: var(--green-700);
  padding-left: 1rem;
}

.rtl .lang-option:hover {
  padding-left: 0.75rem;
  padding-right: 1rem;
}

.lang-option.active {
  background: var(--green-100);
  color: var(--green-800);
}

.lang-flag {
  font-size: 1.2rem;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
}

.lang-name {
  flex: 1;
}

.ms-1 { margin-left: 0.25rem; }
.ms-auto { margin-left: auto; }
.rtl .ms-1 { margin-left: 0; margin-right: 0.25rem; }
.rtl .ms-auto { margin-left: 0; margin-right: auto; }


/* ─── Main Content ───────────────────────────────────────────────────────────── */
.main-content { min-height: calc(100vh - var(--nav-h) - 56px); }

/* ─── Page Container ─────────────────────────────────────────────────────────── */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-title { font-size: 1.6rem; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.page-subtitle { color: var(--gray-500); margin-top: 0.25rem; font-size: 0.9rem; }
.header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ─── Card ───────────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  gap: 0.75rem;
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.card-body { padding: 1.25rem; }

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--green-600);
  color: #fff;
  border-color: var(--green-600);
}
.btn-primary:hover:not(:disabled) { background: var(--green-700); border-color: var(--green-700); }

.btn-outline {
  background: #fff;
  color: var(--gray-700);
  border-color: var(--gray-300);
}
.btn-outline:hover:not(:disabled) { background: var(--gray-50); }

.btn-danger {
  background: var(--red-500);
  color: #fff;
  border-color: var(--red-500);
}
.btn-danger:hover:not(:disabled) { background: var(--red-600); }

.btn-danger-outline {
  background: #fff;
  color: var(--red-500);
  border-color: var(--red-400);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  border-width: 1px;
  border-style: solid;
  transition: all .15s;
}
.btn-danger-outline:hover { background: var(--red-500); color: #fff; }

.btn-full { width: 100%; justify-content: center; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.8rem; }

/* ─── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  border: 1px solid transparent;
  margin-bottom: 1rem;
}
.alert-error   { background: #fef2f2; color: var(--red-600);   border-color: #fecaca; }
.alert-success { background: var(--green-50); color: var(--green-700); border-color: var(--green-200); }
.alert-info    { background: var(--blue-50); color: var(--blue-600); border-color: #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }

/* ─── Forms ──────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 0.4rem;
}
.form-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--gray-800);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-input:focus {
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(34,197,94,.15);
}
.form-input.input-error { border-color: var(--red-400); }
.form-error { font-size: 0.78rem; color: var(--red-500); margin-top: 0.25rem; display: block; min-height: 1em; }

.input-with-icon { position: relative; }
.input-with-icon .form-input { padding-right: 2.5rem; }
.input-icon-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--gray-400);
  font-size: 1rem;
  padding: 0.25rem;
  transition: color .15s;
}
.input-icon-btn:hover { color: var(--gray-700); }

/* Password strength */
.password-strength {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.strength-bar {
  flex: 1;
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  overflow: hidden;
}
.strength-fill {
  height: 100%;
  border-radius: 2px;
  transition: width .3s, background .3s;
}
#strengthLabel { font-size: 0.75rem; font-weight: 500; }

/* ─── Auth Layout ────────────────────────────────────────────────────────────── */
.auth-body { background: linear-gradient(135deg, var(--green-50) 0%, #fff 60%, var(--blue-50) 100%); }

.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--gray-100);
}

.auth-header { text-align: center; margin-bottom: 1.75rem; }
.auth-logo { font-size: 3rem; margin-bottom: 0.5rem; }
.auth-title { font-size: 1.5rem; font-weight: 700; color: var(--gray-900); }
.auth-subtitle { color: var(--gray-500); font-size: 0.875rem; margin-top: 0.25rem; }
.auth-footer { text-align: center; margin-top: 1.25rem; font-size: 0.875rem; color: var(--gray-500); }
.auth-link { color: var(--green-600); font-weight: 500; }
.auth-link:hover { text-decoration: underline; }

/* ─── Stats Grid ─────────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.stat-icon-green  { background: var(--green-100); color: var(--green-700); }
.stat-icon-blue   { background: var(--blue-50); color: var(--blue-600); }
.stat-icon-amber  { background: #fef3c7; color: #92400e; }
.stat-icon-purple { background: #faf5ff; color: var(--purple-500); }
.stat-value { font-size: 1.3rem; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.stat-label { font-size: 0.8rem; color: var(--gray-500); margin-top: 0.15rem; }

/* ─── Analyses List (Dashboard) ──────────────────────────────────────────────── */
.analyses-list { display: flex; flex-direction: column; gap: 0.75rem; }
.analysis-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--gray-100);
  background: var(--gray-50);
  transition: background .15s;
}
.analysis-item:hover { background: var(--green-50); }
.analysis-thumb {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--gray-200);
}
.analysis-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  color: var(--gray-400);
}
.analysis-info { flex: 1; min-width: 0; }
.analysis-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.analysis-meta { font-size: 0.78rem; color: var(--gray-500); margin-top: 0.2rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }
.analysis-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }

/* ─── Status Badges ──────────────────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.status-completed { background: var(--green-100); color: var(--green-700); }
.status-pending   { background: #fef3c7; color: #92400e; }
.status-failed    { background: #fef2f2; color: var(--red-600); }

.disease-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-healthy { background: var(--green-100); color: var(--green-700); }
.badge-disease { background: #fef2f2; color: var(--red-600); }
.badge-lg { padding: 0.3rem 0.75rem; font-size: 0.85rem; }

.badge-optional {
  background: var(--gray-100);
  color: var(--gray-500);
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-weight: 500;
}

.badge-count {
  background: var(--green-100);
  color: var(--green-700);
  font-size: 0.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-weight: 600;
}

/* ─── Empty State ────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--gray-500);
}
.empty-icon { font-size: 3.5rem; margin-bottom: 0.75rem; }
.empty-state h3 { font-size: 1.1rem; font-weight: 600; color: var(--gray-700); margin-bottom: 0.4rem; }
.empty-state p { font-size: 0.875rem; }

.empty-state-sm { text-align: center; padding: 1.5rem; color: var(--gray-500); font-size: 0.875rem; }
.empty-state-sm i { font-size: 1.5rem; display: block; margin-bottom: 0.5rem; }

/* ─── CTA Card ───────────────────────────────────────────────────────────────── */
.cta-card {
  background: linear-gradient(135deg, var(--green-50), #fff);
  border: 1px solid var(--green-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.cta-content { display: flex; align-items: center; gap: 1rem; }
.cta-icon { font-size: 2rem; }
.cta-content h3 { font-size: 1rem; font-weight: 600; color: var(--gray-800); }
.cta-content p { font-size: 0.85rem; color: var(--gray-500); margin-top: 0.1rem; }

/* ─── Upload Zone ────────────────────────────────────────────────────────────── */
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.drop-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--gray-50);
  position: relative;
}
.drop-zone:hover, .drop-zone:focus, .drop-zone.drag-over {
  border-color: var(--green-500);
  background: var(--green-50);
}
.drop-zone-inner { text-align: center; padding: 2rem; }
.drop-icon { font-size: 3rem; margin-bottom: 0.75rem; }
.drop-title { font-weight: 600; color: var(--gray-700); font-size: 1rem; }
.drop-hint { color: var(--gray-500); font-size: 0.875rem; margin-top: 0.25rem; }
.drop-link { color: var(--green-600); font-weight: 500; }
.drop-meta { font-size: 0.75rem; color: var(--gray-400); margin-top: 0.5rem; }

.drop-preview {
  width: 100%;
  height: 100%;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.drop-preview img {
  max-height: 280px;
  max-width: 100%;
  border-radius: var(--radius);
  object-fit: contain;
}
.preview-remove {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0,0,0,.5);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: background .15s;
}
.preview-remove:hover { background: var(--red-500); }

.location-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.location-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--green-700);
  background: var(--green-50);
  border: 1px solid var(--green-200);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  margin-top: 0.75rem;
}

.info-box {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--gray-500);
  background: var(--blue-50);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
}

/* ─── Progress Steps ─────────────────────────────────────────────────────────── */
.progress-container { margin-bottom: 1rem; }
.progress-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  flex: 1;
  opacity: 0.4;
  transition: opacity .3s;
}
.progress-step.active { opacity: 1; }
.step-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: background .3s, color .3s;
}
.progress-step.active .step-icon { background: var(--green-500); color: #fff; }
.progress-step.done .step-icon { background: var(--green-600); color: #fff; }
.step-label { font-size: 0.72rem; color: var(--gray-500); text-align: center; }
.progress-step.active .step-label { color: var(--green-700); font-weight: 600; }

.progress-bar-track {
  height: 6px;
  background: var(--gray-200);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--green-500);
  border-radius: 3px;
  transition: width .5s ease;
}
.progress-message { text-align: center; font-size: 0.875rem; color: var(--gray-600); margin-top: 0.5rem; }

/* ─── How It Works ───────────────────────────────────────────────────────────── */
.how-it-works {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}
.how-it-works h3 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; color: var(--gray-800); }
.how-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.how-step { display: flex; align-items: flex-start; gap: 0.6rem; font-size: 0.85rem; }
.how-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green-500);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ─── Result Page ────────────────────────────────────────────────────────────── */
.result-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 1.5rem;
  align-items: flex-start;
}
.result-main, .result-side { display: flex; flex-direction: column; gap: 1rem; }

.result-image-wrap { max-height: 400px; overflow: hidden; display: flex; align-items: center; justify-content: center; background: var(--gray-50); }
.result-image { max-height: 400px; width: 100%; object-fit: contain; }
.image-placeholder { height: 200px; display: flex; align-items: center; justify-content: center; color: var(--gray-300); background: var(--gray-50); }

.status-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.status-banner.status-pending { background: #fffbeb; border: 1px solid #fde68a; }
.status-banner.status-failed  { background: #fef2f2; border: 1px solid #fecaca; }
.status-banner .status-icon { font-size: 1.5rem; }
.status-banner > div:nth-child(2) { flex: 1; }
.status-banner > div:nth-child(2) strong { display: block; font-size: 0.95rem; }
.status-banner > div:nth-child(2) p { font-size: 0.85rem; color: var(--gray-600); margin-top: 0.15rem; }

.detection-grid { display: grid; gap: 1rem; }
.detection-item { margin-bottom: 0.25rem; }
.detection-label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--gray-400); margin-bottom: 0.2rem; }
.detection-value { font-size: 1rem; font-weight: 600; color: var(--gray-800); }

.confidence-bar { height: 8px; background: var(--gray-200); border-radius: 4px; overflow: hidden; margin-top: 0.4rem; }
.confidence-fill { height: 100%; background: var(--green-500); border-radius: 4px; transition: width 1s ease; }
.confidence-pct { font-size: 0.85rem; color: var(--green-700); font-weight: 600; margin-top: 0.2rem; display: inline-block; }

.detection-description h4 { font-size: 0.875rem; font-weight: 600; color: var(--gray-700); margin-bottom: 0.4rem; }
.detection-description p { font-size: 0.875rem; color: var(--gray-600); line-height: 1.6; }

/* ─── Weather ────────────────────────────────────────────────────────────────── */
.weather-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.weather-item { text-align: center; padding: 0.75rem 0.5rem; background: var(--gray-50); border-radius: var(--radius); }
.weather-icon { font-size: 1.4rem; display: block; margin-bottom: 0.25rem; }
.weather-temp  { color: var(--red-400); }
.weather-humid { color: var(--blue-400); }
.weather-rain  { color: var(--blue-600); }
.weather-wind  { color: var(--gray-400); }
.weather-val { font-weight: 700; font-size: 1rem; color: var(--gray-800); }
.weather-label { font-size: 0.72rem; color: var(--gray-500); margin-top: 0.15rem; }
.weather-desc { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--gray-600); text-transform: capitalize; }

/* ─── Recommendations ────────────────────────────────────────────────────────── */
.rec-section { margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--gray-100); }
.rec-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.rec-title { font-size: 0.85rem; font-weight: 600; color: var(--gray-700); margin-bottom: 0.4rem; display: flex; align-items: center; gap: 0.3rem; }
.rec-text { font-size: 0.85rem; color: var(--gray-600); line-height: 1.65; }
.crop-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.crop-tag {
  background: var(--green-100);
  color: var(--green-700);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

/* ─── Stores ─────────────────────────────────────────────────────────────────── */
.store-list { border-top: 1px solid var(--gray-100); }
.store-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
}
.store-item:last-child { border-bottom: none; }
.store-icon {
  width: 36px;
  height: 36px;
  background: var(--green-100);
  color: var(--green-700);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.store-info { flex: 1; min-width: 0; }
.store-name { font-weight: 600; font-size: 0.875rem; color: var(--gray-800); }
.store-address, .store-phone { font-size: 0.78rem; color: var(--gray-500); margin-top: 0.15rem; display: flex; align-items: center; gap: 0.3rem; }
.distance-badge {
  background: var(--blue-50);
  color: var(--blue-600);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}

.danger-zone { display: flex; justify-content: flex-end; }

/* ─── History Table ──────────────────────────────────────────────────────────── */
.history-table-wrap { overflow-x: auto; display: block; }
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.history-table th {
  text-align: left;
  padding: 0.65rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}
.history-table td { padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.history-table tr:hover td { background: var(--gray-50); }
.history-table tr:last-child td { border-bottom: none; }

.history-thumb { width: 48px; height: 48px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--gray-200); }
.history-thumb img { width: 100%; height: 100%; object-fit: cover; }
.history-plant { display: flex; flex-direction: column; gap: 0.25rem; }
.action-btns { display: flex; gap: 0.35rem; }

.mini-bar { height: 4px; background: var(--gray-200); border-radius: 2px; overflow: hidden; width: 60px; }
.mini-fill { height: 100%; background: var(--green-500); border-radius: 2px; }
.mini-pct { font-size: 0.75rem; color: var(--gray-600); font-weight: 500; }

/* History Cards (mobile only) */
.history-cards { display: none; flex-direction: column; gap: 0.75rem; }
.history-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: #fff;
}
.hcard-thumb { width: 56px; height: 56px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--gray-200); flex-shrink: 0; }
.hcard-thumb img { width: 100%; height: 100%; object-fit: cover; }
.hcard-body { flex: 1; min-width: 0; }
.hcard-plant { font-weight: 600; font-size: 0.875rem; }
.hcard-meta { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.25rem; flex-wrap: wrap; }
.hcard-actions { display: flex; flex-direction: column; gap: 0.35rem; }

/* ─── Pagination ─────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}
.page-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--gray-700);
  background: #fff;
  transition: all .15s;
}
.page-btn:hover { background: var(--green-50); border-color: var(--green-400); color: var(--green-700); }
.page-btn-disabled { opacity: .45; pointer-events: none; }
.page-numbers { display: flex; align-items: center; gap: 0.25rem; }
.page-num {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--gray-700);
  background: #fff;
  transition: all .15s;
}
.page-num:hover { background: var(--green-50); border-color: var(--green-400); color: var(--green-700); }
.page-num-active { background: var(--green-600); border-color: var(--green-600); color: #fff; pointer-events: none; }
.page-ellipsis { padding: 0 0.25rem; color: var(--gray-400); }
.pagination-info { text-align: center; font-size: 0.8rem; color: var(--gray-500); margin-top: 0.5rem; }

/* ─── Modal ──────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-box {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal-box h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.4rem; }
.modal-box p { font-size: 0.875rem; color: var(--gray-600); margin-bottom: 1.25rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }

/* ─── Toast ──────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn .25s ease;
  max-width: 320px;
}
.toast-success { background: var(--green-600); color: #fff; }
.toast-error   { background: var(--red-500);   color: #fff; }
.toast-warning { background: var(--amber-500); color: #fff; }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ─── Error Page ─────────────────────────────────────────────────────────────── */
.error-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}
.error-code { font-size: 6rem; font-weight: 800; color: var(--gray-200); line-height: 1; }
.error-icon { font-size: 3rem; margin: 0.5rem 0; }
.error-title { font-size: 1.5rem; font-weight: 700; color: var(--gray-800); margin-bottom: 0.5rem; }
.error-message { color: var(--gray-500); font-size: 0.95rem; max-width: 400px; margin-bottom: 1.5rem; }
.error-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; }

/* ─── Footer ─────────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--gray-200);
  padding: 1rem 1.5rem;
  background: #fff;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--gray-400);
  flex-wrap: wrap;
}
.footer-brand { font-weight: 600; color: var(--green-600); }

/* ─── PlantNet Alt Matches ───────────────────────────────────────────────────── */
.alt-matches { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.alt-match-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200);
}
.alt-match-name { font-size: 0.875rem; color: var(--gray-700); }
.alt-match-score {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green-600);
  background: var(--green-50);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* ─── Animations ─────────────────────────────────────────────────────────────── */
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .result-grid { grid-template-columns: 1fr; }
  .upload-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .navbar-menu { display: none; }
  .navbar-menu.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 0.5rem;
    box-shadow: var(--shadow);
    z-index: 99;
  }
  .navbar-toggle { display: flex; }
  .navbar-user .user-greeting { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .history-table-wrap { display: none; }
  .history-cards { display: flex; }
  .page-header { flex-direction: column; }
  .location-inputs { grid-template-columns: 1fr; }
  .how-steps { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 1.75rem 1.25rem; }
  .weather-grid { grid-template-columns: 1fr 1fr; }
  .page-container { padding: 1rem; }
  .hero { grid-template-columns: 1fr; padding: 2rem 1rem; }
  .hero-title { font-size: 1.8rem; }
  .hero-visual { display: none; }
  .steps-grid { grid-template-columns: 1fr; }
  .step-arrow { display: none; }
  .features-grid { grid-template-columns: 1fr; }
}

/* ─── Landing Page ──────────────────────────────────────────────────────────── */
.landing-body { background: #fff; }
.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 2rem; position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.95); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--gray-100);
}
.landing-nav-actions { display: flex; gap: 0.5rem; }

.hero {
  display: grid; grid-template-columns: 1fr 1fr; gap: 3rem;
  align-items: center; max-width: 1200px; margin: 0 auto; padding: 4rem 2rem;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: var(--green-50); color: var(--green-700);
  font-size: 0.8rem; font-weight: 600; padding: 0.35rem 0.85rem;
  border-radius: 999px; border: 1px solid var(--green-200); margin-bottom: 1rem;
}
.hero-title { font-size: 3rem; font-weight: 800; line-height: 1.15; color: var(--gray-900); margin-bottom: 1.25rem; }
.hero-subtitle { font-size: 1.1rem; color: var(--gray-500); line-height: 1.7; max-width: 520px; margin-bottom: 1.75rem; }
.hero-cta { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 1.5rem; margin-top: 2.5rem; padding-top: 2rem; border-top: 1px solid var(--gray-200); }
.hero-stat { text-align: center; }
.hero-stat-value { font-size: 1.5rem; margin-bottom: 0.2rem; }
.hero-stat-label { font-size: 0.75rem; color: var(--gray-500); font-weight: 500; }

/* Hero Mockup */
.hero-visual { display: flex; justify-content: center; }
.hero-mockup {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: 100%; max-width: 380px; overflow: hidden;
}
.mockup-header {
  display: flex; gap: 6px; padding: 0.75rem 1rem;
  background: var(--gray-50); border-bottom: 1px solid var(--gray-200);
}
.mockup-dot { width: 10px; height: 10px; border-radius: 50%; }
.mockup-dot.red { background: #ef4444; }
.mockup-dot.yellow { background: #f59e0b; }
.mockup-dot.green { background: #22c55e; }
.mockup-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.6rem; }
.mockup-step {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.85rem; border-radius: var(--radius-sm);
  font-size: 0.85rem; color: var(--gray-500); background: var(--gray-50);
  border: 1px solid var(--gray-100); transition: all .2s;
}
.mockup-step.active { background: var(--green-50); color: var(--green-700); border-color: var(--green-200); font-weight: 600; }
.mockup-num {
  width: 22px; height: 22px; border-radius: 50%; background: var(--gray-200);
  color: var(--gray-600); display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; flex-shrink: 0;
}
.mockup-step.active .mockup-num { background: var(--green-500); color: #fff; }
.mockup-result {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem;
  background: var(--green-50); border: 1px solid var(--green-200);
  border-radius: var(--radius-sm); margin-top: 0.35rem;
}
.mockup-result-icon { font-size: 1.5rem; }

/* Landing Sections */
.landing-section { padding: 4rem 2rem; }
.landing-section-alt { background: var(--gray-50); }
.section-inner { max-width: 1100px; margin: 0 auto; text-align: center; }
.section-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.78rem; font-weight: 600; padding: 0.3rem 0.75rem;
  border-radius: 999px; background: var(--blue-50); color: var(--blue-600);
  border: 1px solid #bfdbfe; margin-bottom: 0.75rem;
}
.section-badge-green { background: var(--green-50); color: var(--green-700); border-color: var(--green-200); }
.section-title { font-size: 2rem; font-weight: 800; color: var(--gray-900); margin-bottom: 0.5rem; }
.section-subtitle { font-size: 1rem; color: var(--gray-500); max-width: 600px; margin: 0 auto 2rem; }
.cta-section { padding: 3rem 0; }

/* Problem Grid */
.problem-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; text-align: left; }
.problem-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  padding: 1.5rem; box-shadow: var(--shadow-sm); transition: transform .2s, box-shadow .2s;
}
.problem-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.problem-icon { font-size: 2rem; margin-bottom: 0.75rem; }
.problem-card h3 { font-size: 1rem; font-weight: 700; color: var(--gray-800); margin-bottom: 0.35rem; }
.problem-card p { font-size: 0.85rem; color: var(--gray-500); line-height: 1.55; }

/* Features Grid */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; text-align: left; }
.feature-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  padding: 1.5rem; box-shadow: var(--shadow-sm); transition: transform .2s, box-shadow .2s;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feature-icon {
  width: 44px; height: 44px; border-radius: var(--radius); display: flex;
  align-items: center; justify-content: center; font-size: 1.2rem;
  background: var(--green-50); color: var(--green-700); margin-bottom: 0.75rem;
}
.feature-card h3 { font-size: 0.95rem; font-weight: 700; color: var(--gray-800); margin-bottom: 0.3rem; }
.feature-card p { font-size: 0.85rem; color: var(--gray-500); line-height: 1.55; }

/* Steps Grid */
.steps-grid {
  display: flex; align-items: flex-start; justify-content: center;
  gap: 0.5rem; flex-wrap: wrap;
}
.step-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  padding: 1.5rem; width: 200px; box-shadow: var(--shadow-sm); text-align: center;
}
.step-number {
  width: 28px; height: 28px; border-radius: 50%; background: var(--green-500); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; margin-bottom: 0.5rem;
}
.step-icon-big { font-size: 1.8rem; color: var(--green-600); margin-bottom: 0.5rem; }
.step-card h3 { font-size: 0.9rem; font-weight: 700; color: var(--gray-800); margin-bottom: 0.25rem; }
.step-card p { font-size: 0.8rem; color: var(--gray-500); line-height: 1.5; }
.step-arrow { display: flex; align-items: center; color: var(--gray-300); font-size: 1.2rem; padding-top: 2rem; }

/* Tech Grid */
.tech-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.25rem; }
.tech-item {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem; min-width: 110px; box-shadow: var(--shadow-sm);
  transition: transform .2s;
}
.tech-item:hover { transform: translateY(-2px); }
.tech-logo { font-size: 1.5rem; color: var(--green-600); }
.tech-item span { font-size: 0.8rem; font-weight: 600; color: var(--gray-700); }

/* Landing Footer */
.landing-footer { border-top: 1px solid var(--gray-200); padding: 1.25rem 2rem; background: #fff; }
.landing-footer-inner {
  max-width: 1100px; margin: 0 auto; display: flex;
  align-items: center; justify-content: space-between;
  font-size: 0.8rem; color: var(--gray-400);
}

/* Nav icon links */
.nav-link-icon { padding: 0.4rem 0.5rem; font-size: 1.1rem; }

/* ─── Profile Page ──────────────────────────────────────────────────────────── */
.profile-grid { display: grid; grid-template-columns: 320px 1fr; gap: 1.5rem; align-items: flex-start; }
.profile-sidebar { display: flex; flex-direction: column; }
.profile-main { display: flex; flex-direction: column; }
.profile-avatar-wrap { position: relative; display: inline-block; margin: 0 auto 0.5rem; }
.profile-avatar {
  width: 96px; height: 96px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--green-200);
}
.profile-avatar-placeholder {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--gray-100); color: var(--gray-400);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; border: 3px solid var(--gray-200);
}
.avatar-edit-btn {
  position: absolute; bottom: 0; right: 0;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--green-500); color: #fff; border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; cursor: pointer; transition: background .15s;
}
.avatar-edit-btn:hover { background: var(--green-700); }
.profile-name { font-size: 1.15rem; font-weight: 700; color: var(--gray-900); }
.profile-badges { display: flex; gap: 0.4rem; justify-content: center; flex-wrap: wrap; }
.profile-stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 0; border-bottom: 1px solid var(--gray-100);
  font-size: 0.875rem;
}
.profile-stat-row:last-child { border-bottom: none; }

/* ─── Admin Page ────────────────────────────────────────────────────────────── */
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.admin-stat {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  padding: 1rem 1.25rem; display: flex; align-items: center; gap: 0.75rem;
  box-shadow: var(--shadow-sm);
}
.admin-stat-icon {
  width: 40px; height: 40px; border-radius: var(--radius); display: flex;
  align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0;
}
.admin-stat-val { font-size: 1.2rem; font-weight: 700; color: var(--gray-900); }
.admin-stat-lbl { font-size: 0.75rem; color: var(--gray-500); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th {
  text-align: left; padding: 0.6rem 0.85rem; font-size: 0.75rem;
  font-weight: 600; color: var(--gray-500); text-transform: uppercase;
  letter-spacing: .04em; background: var(--gray-50); border-bottom: 1px solid var(--gray-200);
}
.admin-table td { padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
.admin-table tr:hover td { background: var(--gray-50); }
.admin-table tr:last-child td { border-bottom: none; }

/* ─── Settings Page ─────────────────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; align-items: flex-start; }
.settings-nav { display: flex; flex-direction: column; gap: 0.25rem; }
.settings-nav-link {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 500;
  color: var(--gray-600); transition: all .15s;
}
.settings-nav-link:hover, .settings-nav-link.active {
  background: var(--green-50); color: var(--green-700);
}
.settings-main { display: flex; flex-direction: column; gap: 1rem; }

/* Toggle Switch */
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 0; border-bottom: 1px solid var(--gray-100);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-label { font-size: 0.875rem; color: var(--gray-700); }
.toggle-desc { font-size: 0.78rem; color: var(--gray-500); }
.toggle-switch {
  position: relative; width: 44px; height: 24px;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--gray-300);
  border-radius: 12px; cursor: pointer; transition: background .2s;
}
.toggle-slider::before {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--green-500); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Responsive overrides for new pages */
@media (max-width: 768px) {
  .profile-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-nav { flex-direction: row; overflow-x: auto; }
  .steps-grid { flex-direction: column; align-items: center; }
  .step-arrow { transform: rotate(90deg); padding: 0; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero-subtitle { margin-left: auto; margin-right: auto; }
  .hero-cta { justify-content: center; }
  .hero-stats { justify-content: center; }
  .hero-visual { display: none; }
}

/* ─── Pagination ────────────────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 0.5rem; padding: 1.25rem 0; margin-top: 1rem;
}
.page-btn {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.4rem 0.85rem; border-radius: var(--radius-sm);
  font-size: 0.8rem; font-weight: 500; color: var(--gray-600);
  border: 1px solid var(--gray-200); background: #fff; transition: all .15s;
}
.page-btn:hover { border-color: var(--green-500); color: var(--green-700); }
.page-btn-disabled { opacity: 0.4; pointer-events: none; }
.page-numbers { display: flex; align-items: center; gap: 0.25rem; }
.page-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  font-size: 0.8rem; font-weight: 500; color: var(--gray-600);
  border: 1px solid var(--gray-200); background: #fff; transition: all .15s;
}
.page-num:hover { border-color: var(--green-500); color: var(--green-700); }
.page-num-active { background: var(--green-500); color: #fff; border-color: var(--green-500); }
.page-ellipsis { padding: 0 0.25rem; color: var(--gray-400); }

/* ─── Admin Stat Icon Colors ────────────────────────────────────────────────── */
.stat-icon-green { background: var(--green-50); color: var(--green-600); }
.stat-icon-blue { background: var(--blue-50); color: var(--blue-600); }
.stat-icon-purple { background: #f3e8ff; color: #7c3aed; }
.stat-icon-amber { background: #fffbeb; color: #d97706; }

/* ─── Action Buttons ────────────────────────────────────────────────────────── */
.action-btns { display: flex; gap: 0.35rem; }
.btn-danger-outline {
  padding: 0.3rem 0.5rem; border-radius: var(--radius-sm);
  font-size: 0.78rem; background: #fff; color: var(--red-500);
  border: 1px solid #fecaca; cursor: pointer; transition: all .15s;
}
.btn-danger-outline:hover { background: #fef2f2; border-color: var(--red-500); }
.btn-sm { padding: 0.3rem 0.5rem; font-size: 0.78rem; }

/* ─── Empty State ───────────────────────────────────────────────────────────── */
.empty-state-sm {
  padding: 2rem; text-align: center; color: var(--gray-400);
  font-size: 0.875rem;
}
.empty-state-sm i { font-size: 1.5rem; display: block; margin-bottom: 0.5rem; }

/* ─── Utilities ─────────────────────────────────────────────────────────────── */
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.p-0 { padding: 0; }
.text-sm { font-size: 0.8rem; }
.text-muted { color: var(--gray-500); }
.text-green { color: var(--green-600); }
.badge-healthy { background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-200); padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.75rem; }
.badge-disease { background: #fef2f2; color: var(--red-500); border: 1px solid #fecaca; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.75rem; }
.disease-badge { display: inline-block; }
.btn-lg { padding: 0.65rem 1.35rem; font-size: 0.95rem; }

/* ─── Irrigation Page ───────────────────────────────────────────────────────── */
.irrigation-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 1.5rem; }
.location-row { display: flex; gap: 0.5rem; align-items: center; }
.location-row .form-input { flex: 1; }
.form-hint { font-size: 0.75rem; color: var(--gray-400); margin-top: 0.2rem; }

.irrig-weather-bar {
  display: flex; flex-wrap: wrap; gap: 0.75rem; padding: 0.75rem 1rem;
  background: var(--green-50); border-radius: var(--radius-sm); margin-bottom: 1.25rem;
}
.irrig-weather-item { display: flex; align-items: center; gap: 0.3rem; font-size: 0.82rem; color: var(--gray-700); font-weight: 500; }
.irrig-weather-item i { color: var(--green-600); }

.irrig-section { margin-bottom: 1.5rem; }
.irrig-section:last-child { margin-bottom: 0; }
.irrig-section-title { font-size: 0.95rem; font-weight: 600; color: var(--gray-800); margin-bottom: 0.6rem; display: flex; align-items: center; gap: 0.4rem; }
.irrig-section-title i { color: var(--green-500); }

.irrig-schedule-text { font-size: 0.88rem; color: var(--gray-600); line-height: 1.6; margin-bottom: 0.75rem; }
.irrig-water-stat { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; background: #eff6ff; border-radius: var(--radius-sm); }
.irrig-water-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--blue-100); color: var(--blue-600); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.irrig-water-value { font-size: 1.4rem; font-weight: 700; color: var(--blue-600); }
.irrig-water-label { font-size: 0.78rem; color: var(--gray-500); margin-left: 0.3rem; }

.irrig-alerts-list { display: flex; flex-direction: column; gap: 0.4rem; }
.irrig-alert-item { padding: 0.6rem 0.8rem; background: #fef2f2; border: 1px solid #fecaca; border-radius: var(--radius-sm); font-size: 0.82rem; color: var(--red-600); display: flex; align-items: center; gap: 0.4rem; }
.irrig-alert-item i { color: var(--red-500); }

.irrig-weekly-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.6rem; }
.irrig-day-card {
  padding: 0.75rem; border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200); background: #fff; text-align: center;
}
.irrig-day-name { font-weight: 600; font-size: 0.82rem; color: var(--green-700); margin-bottom: 0.3rem; }
.irrig-day-action { font-size: 0.78rem; color: var(--gray-600); margin-bottom: 0.4rem; min-height: 2rem; }
.irrig-day-meta { font-size: 0.72rem; color: var(--gray-500); display: flex; align-items: center; justify-content: center; gap: 0.2rem; }
.irrig-day-meta i { font-size: 0.7rem; }

.irrig-tips-list { padding-left: 1.2rem; margin: 0; }
.irrig-tips-list li { font-size: 0.85rem; color: var(--gray-600); line-height: 1.6; margin-bottom: 0.3rem; }

.badge-success { background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-200); padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 500; }
.badge-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 500; }
.badge-danger { background: #fef2f2; color: var(--red-600); border: 1px solid #fecaca; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.75rem; font-weight: 500; }
.badge-low { background: var(--green-50); color: var(--green-700); padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.75rem; }
.badge-medium { background: #fffbeb; color: #b45309; padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.75rem; }
.badge-high { background: #fef2f2; color: var(--red-600); padding: 0.15rem 0.5rem; border-radius: 999px; font-size: 0.75rem; }

@media (max-width: 768px) {
  .irrigation-grid { grid-template-columns: 1fr; }
  .irrig-weekly-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
}

/* ─── Crop Advisor Page ─────────────────────────────────────────────────────── */
.crop-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 1.5rem; }

.crop-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; }
.crop-card {
  padding: 1rem; border-radius: var(--radius); border: 1px solid var(--gray-200);
  background: #fff; position: relative; transition: box-shadow .15s;
}
.crop-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.crop-card-rank {
  position: absolute; top: 0.6rem; right: 0.6rem;
  font-size: 0.7rem; font-weight: 700; color: var(--green-600);
  background: var(--green-50); padding: 0.15rem 0.45rem; border-radius: var(--radius-sm);
}
.crop-card-name { font-size: 1rem; font-weight: 600; color: var(--gray-800); margin: 0 0 0.5rem; }
.crop-card-score { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; }
.score-bar { flex: 1; height: 6px; background: var(--gray-100); border-radius: 3px; overflow: hidden; }
.score-fill { height: 100%; background: var(--green-500); border-radius: 3px; transition: width .3s; }
.crop-card-score span { font-size: 0.75rem; font-weight: 600; color: var(--green-600); white-space: nowrap; }
.crop-card-reason { font-size: 0.8rem; color: var(--gray-500); line-height: 1.5; margin-bottom: 0.5rem; }
.crop-card-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.4rem; align-items: center; }
.crop-card-yield { font-size: 0.78rem; color: var(--gray-600); display: flex; align-items: center; gap: 0.3rem; }
.crop-card-yield i { color: var(--green-500); }

.crop-calendar-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.crop-cal-item { text-align: center; padding: 0.75rem; border-radius: var(--radius-sm); background: var(--green-50); }
.crop-cal-label { font-size: 0.72rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 0.25rem; }
.crop-cal-value { font-size: 0.88rem; font-weight: 600; color: var(--green-700); }

@media (max-width: 768px) {
  .crop-grid { grid-template-columns: 1fr; }
  .crop-cards-grid { grid-template-columns: 1fr; }
  .crop-calendar-grid { grid-template-columns: 1fr; }
}

/* ─── Decision Engine Card ──────────────────────────────────────────────────── */
.decision-card { border-left: 4px solid var(--green-500); }
.decision-badges { display: flex; gap: 0.4rem; align-items: center; }
.decision-summary {
  padding: 0.75rem 1rem; background: var(--green-50); border-radius: var(--radius-sm);
  font-size: 0.88rem; color: var(--gray-700); line-height: 1.5; margin-bottom: 1rem;
  display: flex; align-items: flex-start; gap: 0.5rem;
}
.decision-summary i { color: var(--green-600); margin-top: 0.15rem; flex-shrink: 0; }

.health-score-bar { margin-bottom: 1.25rem; }
.health-score-label { font-size: 0.78rem; color: var(--gray-500); margin-bottom: 0.35rem; }
.health-bar-track { height: 10px; background: var(--gray-100); border-radius: 5px; overflow: hidden; margin-bottom: 0.25rem; }
.health-bar-fill { height: 100%; border-radius: 5px; transition: width .5s ease; }
.health-score-value { font-size: 0.78rem; font-weight: 600; color: var(--gray-600); text-align: right; }

.decision-section-title {
  font-size: 0.9rem; font-weight: 600; color: var(--gray-800);
  margin: 1rem 0 0.6rem; display: flex; align-items: center; gap: 0.4rem;
}
.decision-section-title i { color: var(--green-500); }

.decision-list { display: flex; flex-direction: column; gap: 0.6rem; }
.decision-item { display: flex; gap: 0.75rem; align-items: flex-start; padding: 0.6rem 0; border-bottom: 1px solid var(--gray-100); }
.decision-item:last-child { border-bottom: none; }
.decision-priority { flex-shrink: 0; }
.priority-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%; font-size: 0.75rem; font-weight: 700;
  background: var(--green-50); color: var(--green-700); border: 1px solid var(--green-200);
}
.decision-action { font-size: 0.88rem; font-weight: 600; color: var(--gray-800); margin-bottom: 0.2rem; }
.decision-reason { font-size: 0.8rem; color: var(--gray-500); line-height: 1.5; }
.decision-timing { font-size: 0.75rem; color: var(--gray-400); margin-top: 0.25rem; display: flex; align-items: center; gap: 0.25rem; }

.decision-next-steps { padding-left: 1.2rem; margin: 0; }
.decision-next-steps li { font-size: 0.85rem; color: var(--gray-600); line-height: 1.6; margin-bottom: 0.25rem; }

/* ─── Quick Actions Grid ────────────────────────────────────────────────────── */
.quick-actions-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 768px) { .quick-actions-grid { grid-template-columns: 1fr; } }

/* ─── Charts Grid ───────────────────────────────────────────────────────────── */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.charts-grid canvas { max-height: 220px; }
@media (max-width: 768px) { .charts-grid { grid-template-columns: 1fr; } }
