/* ── TOKENS ─────────────────────────────────────────────── */
:root {
  --green-deep: #1A3D0C;
  --green-mid:  #2D6017;
  --green-rich: #3D7A1E;
  --green-soft: #5FA34E;
  --green-pale: #A8D08A;
  --mint:       #D4ECC5;
  --mint2:      #E8F5DC;
  --cream:      #F5F2EB;
  --cream2:     #FDFCF8;
  --bark:       #5C3D1E;
  --soil:       #1C2B10;
  --gold:       #C9AA50;

  --danger:     #C0392B;
  --danger-bg:  #FDEEEC;
  --warn:       #C97A12;
  --warn-bg:    #FEF4E2;
  --safe:       #27864F;
  --safe-bg:    #E5F4EC;

  --shadow-sm:  0 2px 12px rgba(26,61,12,0.08);
  --shadow:     0 6px 28px rgba(26,61,12,0.12);
  --shadow-lg:  0 16px 56px rgba(26,61,12,0.16);
  --r-sm: 12px;
  --r:    20px;
  --r-lg: 28px;
}

/* ── RESET & BASE TYPOGRAPHY ────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #f8fafc;
  background-image: 
    linear-gradient(to right, rgba(226, 232, 240, 0.45) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(226, 232, 240, 0.45) 1px, transparent 1px);
  background-size: 32px 32px;
  color: #0f172a;
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ── BACKGROUND BLOBS DEPRECATED ────────────────────────── */
.bg-blobs { display: none !important; }

/* ── NAV ────────────────────────────────────────────────── */
#main-nav {
  position: sticky; top: 0; z-index: 200;
  background: rgba(245, 242, 235, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(61,122,30,0.18);
  transition: box-shadow 0.3s;
}
#main-nav.scrolled { box-shadow: var(--shadow-sm); }
.nav-inner {
  max-width: 1320px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; padding: 0 1.75rem;
  gap: 1.5rem;
}
.nav-logo {
  display: flex; align-items: center; gap: 8px;
  font-family: 'Lora', serif; font-size: 1.18rem; font-weight: 700;
  color: var(--green-deep); text-decoration: none; letter-spacing: -0.01em;
  white-space: nowrap; flex-shrink: 0;
}
.logo-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--green-mid), var(--green-rich));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(45,96,23,0.35);
  flex-shrink: 0;
}
.logo-mark svg { width: 22px; height: 22px; }
.nav-links {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: nowrap; flex-shrink: 0;
}
.nl {
  font-size: 0.85rem; font-weight: 500; color: var(--green-deep);
  padding: 8px 12px; border-radius: 100px;
  text-decoration: none; transition: all 0.2s;
  white-space: nowrap; display: inline-flex; align-items: center; line-height: 1;
}
.nl:hover, .nl.active { background: var(--mint); color: var(--green-deep); }
.nl.cta-login {
  background: rgba(45, 96, 23, 0.08); color: var(--green-deep);
  font-weight: 600; padding: 8px 14px;
}
.nl.cta-login:hover { background: rgba(45, 96, 23, 0.16); }
.nl.cta-nav {
  background: linear-gradient(135deg, var(--green-mid), var(--green-rich));
  color: #ffffff !important;
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; margin-left: 6px;
  border-radius: 100px;
  box-shadow: 0 2px 8px rgba(45,96,23,0.25);
  white-space: nowrap;
}
.nl.cta-nav:hover {
  background: linear-gradient(135deg, var(--green-rich), #4d9927);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(45,96,23,0.35);
}
.nl.cta-nav svg { width: 14px; height: 14px; }
.hamburger {
  display: none; width: 38px; height: 38px;
  background: none; border: none; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.hamburger span {
  width: 20px; height: 2px;
  background: var(--green-mid); border-radius: 2px; display: block;
  transition: all 0.25s;
}
@media(max-width:1024px) {
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .nav-links.open {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: 64px; left: 0; right: 0;
    background: rgba(245,242,235,0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(61,122,30,0.18);
    padding: 1.25rem 1.5rem 1.5rem; gap: 6px;
    box-shadow: var(--shadow);
    animation: navSlide 0.22s ease-out;
  }
  @keyframes navSlide { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }
  .nav-links.open .nl {
    padding: 10px 14px;
    font-size: 0.92rem;
    border-radius: 10px;
  }
  .nav-links.open .lang-dropdown {
    margin: 4px 0;
  }
  .nav-links.open .nl.cta-login {
    justify-content: center;
    height: 40px;
  }
  .nav-links.open .nl.cta-nav {
    justify-content: center; margin-left: 0; margin-top: 4px;
    height: 42px;
  }
}

/* ── WRAP ───────────────────────────────────────────────── */
.wrap {
  position: relative; z-index: 1;
  max-width: 960px; margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
}

/* ── HERO ───────────────────────────────────────────────── */
.hero { text-align: center; margin-bottom: 3rem; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: white; border: 1px solid rgba(61,122,30,0.2);
  padding: 6px 16px; border-radius: 100px;
  font-size: 0.77rem; font-weight: 600; color: var(--green-mid);
  letter-spacing: 0.02em; margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  animation: fadeUp 0.6s ease both;
}
.badge-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green-soft);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1);} 50%{opacity:0.5;transform:scale(0.8);} }
h1 {
  font-family: 'Lora', serif;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  font-weight: 700; color: var(--green-deep);
  letter-spacing: -0.04em; line-height: 1.1;
  margin-bottom: 1rem;
  text-shadow: 0 2px 20px rgba(26, 61, 12, 0.15);
  animation: fadeUp 0.7s 0.1s ease both;
}
h1 em { font-style: italic; color: var(--green-rich); }
.hero-desc {
  font-size: 1rem; color: var(--green-soft); font-weight: 400;
  line-height: 1.75; max-width: 520px; margin: 0 auto 1.75rem;
  animation: fadeUp 0.7s 0.2s ease both;
}
.hero-pills {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  animation: fadeUp 0.7s 0.3s ease both;
}
.btn-hero-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: 100px;
  background: white; border: 1.5px solid rgba(61, 122, 30, 0.3);
  color: var(--green-deep);
  font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 0.92rem;
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.btn-hero-secondary:hover {
  background: var(--mint); border-color: var(--green-soft);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74, 222, 128, 0.2);
}
.pill {
  display: flex; align-items: center; gap: 6px;
  background: white; border: 1px solid rgba(61,122,30,0.18);
  padding: 6px 14px; border-radius: 100px;
  font-size: 0.82rem; font-weight: 500; color: var(--green-mid);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}
.pill:hover { transform: translateY(-2px); }

@keyframes fadeUp { from{opacity:0;transform:translateY(18px);} to{opacity:1;transform:translateY(0);} }

/* ── UPLOAD ZONE ────────────────────────────────────────── */
.upload-zone {
  background: rgba(255,255,255,0.7);
  border: 2px dashed rgba(95,163,78,0.4);
  border-radius: var(--r-lg);
  overflow: hidden; position: relative;
  transition: all 0.3s;
}
.upload-zone.drag-over {
  border-color: var(--green-rich);
  border-style: solid;
  background: rgba(255,255,255,0.9);
  box-shadow: var(--shadow);
}
.uz-glow {
  position: absolute; top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(168,208,138,0.3), transparent 70%);
  pointer-events: none;
}

/* Picker section */
.picker-section {
  padding: 1.75rem 1.75rem 0;
}
.picker-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem; flex-wrap: wrap; gap: 10px;
}
.picker-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; font-weight: 600; color: var(--green-deep);
}
.required-badge {
  background: var(--danger); color: white;
  font-size: 0.65rem; font-weight: 700;
  padding: 2px 8px; border-radius: 100px;
  letter-spacing: 0.06em;
}
.search-wrap { position: relative; }
.search-wrap svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--green-soft); pointer-events: none;
}
.search-input {
  font-family: 'DM Sans', sans-serif; font-size: 0.82rem;
  color: var(--soil); background: white;
  border: 1px solid rgba(95,163,78,0.25); border-radius: 100px;
  padding: 7px 14px 7px 32px; outline: none; width: 170px;
  transition: border-color 0.2s;
}
.search-input:focus { border-color: var(--green-soft); }

/* Selected banner */
.selected-banner {
  display: none; align-items: center; gap: 10px;
  background: linear-gradient(135deg, var(--green-mid), var(--green-rich));
  border-radius: var(--r-sm); padding: 11px 14px;
  margin-bottom: 1rem;
  animation: slideDown 0.3s cubic-bezier(0.16,1,0.3,1);
}
.selected-banner.show { display: flex; }
@keyframes slideDown { from{opacity:0;transform:translateY(-8px);} to{opacity:1;transform:translateY(0);} }
.sb-emoji { font-size: 1.5rem; flex-shrink: 0; }
.sb-info { flex: 1; }
.sb-name { font-size: 0.92rem; font-weight: 600; color: white; }
.sb-latin { font-size: 0.72rem; color: rgba(255,255,255,0.65); font-style: italic; }
.sb-check { width: 24px; height: 24px; flex-shrink: 0; }
.sb-change {
  font-family: 'DM Sans', sans-serif; font-size: 0.75rem; font-weight: 600;
  background: rgba(255,255,255,0.2); color: white;
  border: 1px solid rgba(255,255,255,0.3); border-radius: 100px;
  padding: 5px 14px; cursor: pointer; flex-shrink: 0;
  transition: background 0.2s;
  white-space: nowrap;
}
.sb-change:hover { background: rgba(255,255,255,0.35); }

/* ── COMMODITY FILTER & SELECTION SYSTEM ────────────────── */
.btn-manage-commodities {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1.5px solid rgba(45, 96, 23, 0.35);
  color: var(--green-deep);
  padding: 5px 13px;
  border-radius: 100px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  white-space: nowrap;
}
.btn-manage-commodities:hover {
  background: var(--mint2);
  border-color: var(--green-rich);
  transform: translateY(-1px);
}
.saved-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: #f0fdf4;
  border: 1.5px solid #86efac;
  border-radius: var(--r-sm);
  padding: 9px 14px;
  margin-bottom: 0.85rem;
  font-size: 0.82rem;
  box-shadow: 0 1px 4px rgba(22, 163, 74, 0.08);
}
.sfb-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sfb-badge {
  background: #15803d;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.sfb-text {
  font-weight: 600;
  color: #166534;
}
.sfb-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.sfb-btn {
  background: #ffffff;
  border: 1px solid #86efac;
  color: #15803d;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.sfb-btn:hover {
  background: #dcfce7;
}
.sfb-btn.edit {
  background: #15803d;
  color: #ffffff;
  border-color: #15803d;
}
.sfb-btn.edit:hover {
  background: #166534;
}
.cfm-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}
.cfm-quick-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.cfm-chip {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 4px 11px;
  border-radius: 100px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.cfm-chip:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}
.cfm-chip.primary {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}
.cfm-chip.primary:hover {
  background: #bbf7d0;
}
.cfm-chip.danger {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}
.cfm-plant-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  max-height: 270px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #f8fafc;
}
.cfm-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.cfm-item:hover {
  border-color: #86efac;
  background: #f0fdf4;
}
.cfm-item.checked {
  border-color: #16a34a;
  background: #dcfce7;
  box-shadow: 0 1px 4px rgba(22, 163, 74, 0.15);
}
.cfm-item input[type="checkbox"] {
  accent-color: #16a34a;
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.cfm-emoji {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}
.cfm-item-info {
  flex: 1;
  overflow: hidden;
}
.cfm-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}
.cfm-item-cat {
  font-size: 0.62rem;
  font-weight: 500;
  color: #64748b;
  background: #f1f5f9;
  padding: 1px 4px;
  border-radius: 4px;
}
.cfm-item-latin {
  font-size: 0.68rem;
  font-style: italic;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cfm-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}
.cfm-counter {
  font-size: 0.85rem;
  color: #475569;
}

/* Plant grid */
.plant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px; margin-bottom: 1rem;
  max-height: none;
}
.plant-card {
  background: white; border: 1.5px solid rgba(95,163,78,0.18);
  border-radius: var(--r-sm); padding: 10px 8px;
  text-align: center; cursor: pointer;
  transition: all 0.2s; position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.plant-card:hover {
  border-color: var(--green-soft);
  transform: translateY(-3px) scale(1.02); box-shadow: 0 0 20px rgba(74, 222, 128, 0.12);
}
.plant-card:focus-visible {
  outline: 2.5px solid #10b981;
  outline-offset: 2px;
  border-color: #10b981;
}
.plant-card.selected {
  border-color: var(--green-rich); border-width: 2px;
  background: var(--mint2);
}
.plant-card.hidden { display: none; }
.pc-emoji { font-size: 1.5rem; line-height: 1; }
.pc-name { font-size: 0.72rem; font-weight: 600; color: var(--green-deep); }
.pc-latin { font-size: 0.62rem; color: var(--green-soft); font-style: italic; line-height: 1.3; }
.pc-count {
  font-size: 0.6rem; color: white;
  background: var(--green-soft); border-radius: 100px;
  padding: 1px 7px; margin-top: 2px;
}
.pc-check {
  position: absolute; top: 5px; right: 5px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--green-rich); display: none;
  align-items: center; justify-content: center;
}
.pc-check svg { width: 10px; height: 10px; color: white; }
.plant-card.selected .pc-check { display: flex; }

.no-result {
  display: none; text-align: center; font-size: 0.85rem;
  color: var(--green-soft); padding: 1rem 0;
}

/* Drop area */
.drop-area {
  border-top: 1px solid rgba(95,163,78,0.12);
  padding: 1.75rem; text-align: center;
}
.drop-icon {
  width: 72px; height: 72px;
  background: var(--mint2); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem; color: var(--green-soft);
  transition: transform 0.3s;
}
.upload-zone.drag-over .drop-icon { transform: scale(1.1); }
.drop-icon svg { width: 36px; height: 36px; }
.drop-text {
  font-family: 'Lora', serif; font-size: 1.15rem; font-weight: 600;
  color: var(--green-deep); margin-bottom: 4px;
}
.drop-sub {
  font-size: 0.82rem; color: var(--green-soft); margin-bottom: 4px;
}
.scan-types {
  font-size: 0.8rem; color: var(--green-soft);
  background: var(--mint2); display: inline-block;
  padding: 4px 14px; border-radius: 100px; margin-bottom: 1.25rem;
}
.scan-types strong { color: var(--green-mid); }

.btn-row {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
  margin-bottom: 1rem;
}
.btn-upload {
  font-family: 'DM Sans', sans-serif; font-size: 0.88rem; font-weight: 600;
  background: linear-gradient(135deg, var(--green-mid), var(--green-rich));
  color: white; border: none; border-radius: 100px;
  padding: 0.7rem 1.6rem; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: all 0.2s; box-shadow: 0 4px 14px rgba(45,96,23,0.3);
}
.btn-upload:hover:not(:disabled) {
  transform: translateY(-2px); box-shadow: 0 6px 20px rgba(45,96,23,0.4);
}
.btn-upload:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-upload svg { width: 16px; height: 16px; }
.btn-camera {
  font-family: 'DM Sans', sans-serif; font-size: 0.88rem; font-weight: 500;
  background: white; color: var(--green-mid);
  border: 1.5px solid rgba(95,163,78,0.3); border-radius: 100px;
  padding: 0.7rem 1.4rem; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: all 0.2s;
}
.btn-camera:hover:not(:disabled) { background: var(--mint); border-color: var(--green-soft); }
.btn-camera:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-camera svg { width: 16px; height: 16px; }

#file-input { display: none; }
.upload-hint {
  display: flex; align-items: center; gap: 7px; justify-content: center;
  font-size: 0.8rem; color: var(--warn);
  background: var(--warn-bg); border-radius: 100px;
  padding: 6px 16px; max-width: 340px; margin: 0 auto;
  transition: all 0.3s;
}
.upload-hint.hidden { display: none; }
.upload-hint svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ── RESULT LAYOUT ──────────────────────────────────────── */
.result-layout {
  display: grid; grid-template-columns: 1fr 1.5fr;
  gap: 1.25rem; align-items: start;
}
@media(max-width:680px) {
  .result-layout { grid-template-columns: 1fr; }
}

/* Preview card */
.preview-card {
  background: white; border-radius: var(--r);
  border: 1px solid rgba(95,163,78,0.15);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.preview-img-wrap {
  position: relative; aspect-ratio: 4/3; background: var(--mint2); overflow: hidden;
}
.preview-img-wrap img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.img-tag {
  position: absolute; top: 10px; left: 10px;
  background: rgba(26,61,12,0.85); backdrop-filter: blur(6px);
  border-radius: 100px; padding: 4px 10px;
  display: flex; align-items: center; gap: 5px;
  font-size: 0.72rem; font-weight: 600; color: white;
}
.img-tag span:first-child { font-size: 0.85rem; }
.scan-overlay {
  position: absolute; inset: 0;
  pointer-events: none; overflow: hidden;
}
.scan-line {
  position: absolute; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--green-pale), transparent);
  animation: scanMove 2.5s ease-in-out infinite;
}
@keyframes scanMove {
  0%   { top: 0%; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
.scan-overlay.done { display: none; }
.img-status-badge {
  position: absolute; bottom: 10px; right: 10px;
  background: rgba(26,61,12,0.8); backdrop-filter: blur(6px);
  color: white; font-size: 0.7rem; font-weight: 600;
  padding: 3px 10px; border-radius: 100px;
}
.preview-meta {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
}
.meta-fname {
  font-size: 0.78rem; font-weight: 500; color: var(--green-deep);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px;
}
.meta-fsize { font-size: 0.72rem; color: var(--green-soft); }
.change-photo-btn {
  font-family: 'DM Sans', sans-serif; font-size: 0.75rem; font-weight: 500;
  background: var(--mint2); color: var(--green-mid);
  border: none; border-radius: 100px;
  padding: 5px 12px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; gap: 5px;
  transition: background 0.2s;
}
.change-photo-btn:hover { background: var(--mint); }
.change-photo-btn svg { width: 13px; height: 13px; }

/* Tips box */
.tips-box {
  background: white; border-radius: var(--r);
  border: 1px solid rgba(95,163,78,0.15); box-shadow: var(--shadow-sm);
  padding: 1rem 1.1rem; margin-top: 0.9rem;
}
.tips-header {
  font-size: 0.8rem; font-weight: 600; color: var(--green-deep);
  margin-bottom: 0.7rem;
}
.tip-row {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 0.77rem; color: var(--green-soft); padding: 3px 0; line-height: 1.5;
}
.tip-num {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  background: var(--mint); color: var(--green-mid);
  font-size: 0.65rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; margin-top: 1px;
}

/* Result card */
.result-card {
  background: white; border-radius: var(--r);
  border: 1px solid rgba(95,163,78,0.15);
  box-shadow: var(--shadow-sm); overflow: hidden;
}

/* Loading panel */
.loading-panel {
  padding: 2.5rem 1.5rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem;
}
.loader-anim {
  position: relative; width: 64px; height: 64px; margin-bottom: 4px;
}
.loader-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid var(--mint);
  border-top-color: var(--green-rich);
  animation: spin 0.9s linear infinite;
}
.loader-ring.r2 {
  inset: 8px;
  border-color: var(--mint2);
  border-right-color: var(--green-soft);
  animation: spin 1.4s linear infinite reverse;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-leaf {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  font-size: 22px;
  animation: breathe 2s ease-in-out infinite;
}
@keyframes breathe { 0%,100%{transform:translate(-50%,-50%) scale(1);} 50%{transform:translate(-50%,-50%) scale(0.88);} }
.loader-title {
  font-family: 'Lora', serif; font-size: 1rem; font-weight: 600; color: var(--green-deep);
}
.loader-step { font-size: 0.8rem; color: var(--green-soft); }
.progress-track {
  width: 180px; height: 5px;
  background: var(--mint); border-radius: 5px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--green-soft), var(--green-rich));
  border-radius: 5px; width: 0%; transition: width 0.6s ease;
}
.loader-note { font-size: 0.72rem; color: var(--green-pale); }

/* Diagnosis content */
.diag-head {
  background: linear-gradient(135deg, var(--green-deep), var(--green-mid));
  padding: 1.4rem 1.4rem 1.25rem;
}
.diag-sev-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 100px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em;
  margin-bottom: 0.8rem;
}
.sev-danger { background: rgba(192,57,43,0.3); color: #FF9C9C; }
.sev-warn   { background: rgba(201,122,18,0.3); color: #FFD082; }
.sev-safe   { background: rgba(39,134,79,0.3);  color: #7DEBB4; }
.diag-disease-name {
  font-family: 'Lora', serif; font-size: 1.4rem; font-weight: 700;
  color: white; line-height: 1.2; margin-bottom: 5px;
}
.diag-plant-label {
  font-size: 0.77rem; color: rgba(255,255,255,0.6); font-style: italic;
}
.diag-scan-type {
  font-size: 0.72rem; color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.1); border-radius: 100px;
  padding: 2px 10px; display: inline-block; margin-top: 4px;
}

.diag-body {
  padding: 1.25rem 1.4rem;
  display: flex; flex-direction: column; gap: 1.1rem;
}

/* Confidence */
.conf-section {}
.conf-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 7px;
}
.conf-label { font-size: 0.77rem; color: var(--green-soft); }
.conf-val { font-size: 1rem; font-weight: 700; color: var(--green-mid); }
.conf-track {
  height: 8px; background: var(--mint); border-radius: 8px; overflow: hidden;
}
.conf-bar {
  height: 100%; border-radius: 8px;
  background: linear-gradient(90deg, var(--green-soft), var(--green-rich));
  width: 0%; transition: width 1.4s cubic-bezier(0.16,1,0.3,1);
}

/* Info blocks */
.info-block {
  background: var(--mint2); border-radius: var(--r-sm);
  padding: 0.9rem 1rem;
}
.info-block-title {
  font-size: 0.7rem; font-weight: 700; color: var(--green-mid);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 0.5rem;
  display: flex; align-items: center; gap: 5px;
}
.info-block-body {
  font-size: 0.83rem; color: var(--soil); line-height: 1.7;
}

/* Recommendations */
.rec-block {
  background: linear-gradient(135deg, var(--mint), var(--mint2));
  border-left: 3px solid var(--green-rich);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  padding: 1rem 1.1rem;
}
.rec-title {
  font-size: 0.72rem; font-weight: 700; color: var(--green-deep);
  text-transform: uppercase; letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 6px; margin-bottom: 0.6rem;
}
.rec-title svg { width: 13px; height: 13px; }
.rec-steps { display: flex; flex-direction: column; gap: 6px; }
.rec-step {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 0.82rem; color: var(--soil); line-height: 1.55;
}
.rec-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green-rich); flex-shrink: 0; margin-top: 7px;
}

/* Action row */
.act-row { display: flex; gap: 8px; }
.btn-scan-again {
  flex: 1;
  font-family: 'DM Sans', sans-serif; font-size: 0.88rem; font-weight: 600;
  background: linear-gradient(135deg, var(--green-mid), var(--green-rich));
  color: white; border: none; border-radius: 100px;
  padding: 0.7rem 1.4rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all 0.2s; box-shadow: 0 4px 14px rgba(45,96,23,0.3);
}
.btn-scan-again:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(45,96,23,0.4); }
.btn-scan-again svg { width: 15px; height: 15px; }
.btn-share {
  width: 44px; height: 44px; flex-shrink: 0;
  background: white; color: var(--green-soft);
  border: 1.5px solid rgba(95,163,78,0.3); border-radius: 100px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.btn-share:hover { background: var(--mint); }
.btn-share svg { width: 16px; height: 16px; }

/* Error state */
.error-state {
  padding: 2rem 1.5rem; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
}
.error-icon { font-size: 2.5rem; }
.error-title { font-family: 'Lora', serif; font-size: 1rem; font-weight: 600; color: var(--danger); }
.error-msg { font-size: 0.83rem; color: var(--green-soft); line-height: 1.6; max-width: 280px; }
.btn-retry {
  font-family: 'DM Sans', sans-serif; font-size: 0.85rem; font-weight: 600;
  background: var(--danger); color: white; border: none; border-radius: 100px;
  padding: 8px 20px; cursor: pointer; transition: opacity 0.2s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-retry:hover { opacity: 0.9; }

/* Non-Plant Anti-Hallucination Warning Card */
.non-plant-card {
  padding: 2rem 1.5rem;
  text-align: center;
  background: rgba(239, 68, 68, 0.05);
  border: 1.5px dashed rgba(239, 68, 68, 0.35);
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeUp 0.3s ease;
}
.non-plant-icon {
  font-size: 2.8rem;
  margin-bottom: 0.5rem;
}
.non-plant-title {
  font-family: 'Lora', serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--danger);
  margin-bottom: 0.5rem;
}
.non-plant-desc {
  font-size: 0.86rem;
  color: var(--soil);
  line-height: 1.6;
  max-width: 440px;
  margin: 0 auto 1.25rem;
}
.non-plant-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

/* ── FEATURES ───────────────────────────────────────────── */
.sec-title {
  font-family: 'Lora', serif; font-size: 1.65rem; font-weight: 700;
  color: var(--green-deep); text-align: center;
  margin: 3.5rem 0 0.5rem; letter-spacing: -0.02em;
}
.sec-sub {
  text-align: center; font-size: 0.9rem;
  color: var(--green-soft); margin-bottom: 1.75rem;
}
.feat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media(max-width:640px) { .feat-grid { grid-template-columns: 1fr; } }
@media(min-width:641px) and (max-width:800px) { .feat-grid { grid-template-columns: repeat(2,1fr); } }
.feat-card {
  background: white; border-radius: var(--r);
  border: 1px solid rgba(95,163,78,0.15);
  box-shadow: var(--shadow-sm); padding: 1.4rem;
  transition: transform 0.25s, box-shadow 0.25s;
}
.feat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feat-card.fc-highlight {
  background: linear-gradient(135deg, var(--green-deep), var(--green-mid));
  border-color: transparent;
}
.feat-card.fc-highlight h3 { color: white; }
.feat-card.fc-highlight p { color: rgba(255,255,255,0.72); }
.feat-icon { font-size: 1.6rem; margin-bottom: 0.75rem; }
.feat-card h3 {
  font-family: 'Lora', serif; font-size: 1rem; font-weight: 600;
  color: var(--green-deep); margin-bottom: 0.4rem;
}
.feat-card p { font-size: 0.82rem; color: var(--green-soft); line-height: 1.65; }

/* ── HOW TO ─────────────────────────────────────────────── */
.howto-list {
  display: flex; flex-direction: column; gap: 0;
  margin-top: 1.5rem; position: relative;
}
.howto-list::before {
  content: ''; position: absolute; left: 19px; top: 24px; bottom: 24px;
  width: 2px; background: linear-gradient(to bottom, var(--green-rich), var(--mint));
}
.howto-item {
  display: flex; gap: 1.25rem; align-items: flex-start;
  background: white; border-radius: var(--r);
  border: 1px solid rgba(95,163,78,0.12);
  padding: 1.1rem 1.25rem; margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}
.howto-item:hover { transform: translateX(4px); }
.howto-num {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%;
  background: linear-gradient(135deg, var(--green-mid), var(--green-rich));
  color: white; font-size: 0.88rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px rgba(45,96,23,0.3); position: relative; z-index: 1;
}
.howto-body { padding-top: 8px; }
.howto-body h4 {
  font-family: 'Lora', serif; font-size: 0.95rem; font-weight: 600;
  color: var(--green-deep); margin-bottom: 3px;
}
.howto-body p { font-size: 0.82rem; color: var(--green-soft); line-height: 1.6; }

/* ── FOOTER ─────────────────────────────────────────────── */
footer {
  text-align: center; margin-top: 4rem;
  padding-top: 2rem; border-top: 1px solid rgba(95,163,78,0.15);
}
.footer-brand {
  font-family: 'Lora', serif; font-size: 1.05rem; font-weight: 700;
  color: var(--green-mid); margin-bottom: 0.6rem;
}
.footer-desc {
  font-size: 0.77rem; color: var(--green-soft);
  line-height: 1.8; max-width: 440px; margin: 0 auto;
}
.footer-links {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 12px;
}
.footer-admin-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--green-mid);
  text-decoration: none;
  background: var(--mint);
  border: 1px solid rgba(95, 163, 78, 0.25);
  padding: 6px 14px;
  border-radius: 100px;
  transition: all 0.2s;
}
.footer-admin-link:hover {
  background: var(--mint2);
  border-color: var(--green-soft);
  transform: translateY(-1px);
}

/* ── CAMERA MODAL ───────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: rgba(26,61,12,0.65); backdrop-filter: blur(6px);
  align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: white; border-radius: var(--r-lg);
  padding: 1.5rem; width: 100%; max-width: 420px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.25s cubic-bezier(0.16,1,0.3,1);
}
@keyframes modalIn { from{transform:scale(0.9);opacity:0;} to{transform:scale(1);opacity:1;} }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.modal-head h3 {
  font-family: 'Lora', serif; font-size: 1.05rem;
  font-weight: 600; color: var(--green-deep);
}
.modal-close-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--mint); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.modal-close-btn:hover { background: var(--mint2); }
.modal-close-btn svg { width: 14px; height: 14px; color: var(--green-soft); }
#cam-video {
  width: 100%; border-radius: var(--r-sm);
  background: var(--soil); display: block; aspect-ratio: 4/3;
  object-fit: cover;
}
.modal-actions {
  display: flex; gap: 8px; margin-top: 1rem;
}
#login-form {
  display: flex; flex-direction: column; gap: 12px;
}
.modal-desc {
  color: var(--green-soft); font-size: 14px; margin-bottom: 20px;
}
.modal-input {
  width: 100%; padding: 12px 14px; border-radius: 8px;
  border: 1px solid var(--mint2); background: #f4f6f4;
  color: #000000; font-family: inherit; font-size: 14px;
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.modal-input:focus {
  border-color: var(--green-mid);
  box-shadow: 0 0 0 3px rgba(45,90,39,0.15);
}
.modal-input::placeholder {
  color: #777777;
}

/* ── TOAST ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(12, 28, 8, 0.92);
  backdrop-filter: blur(16px);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 14px;
  font-size: 0.88rem;
  font-family: 'DM Sans', sans-serif;
  z-index: 20000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(74, 222, 128, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  max-width: 90vw;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ── SCROLL ANIMATIONS ──────────────────────────────────── */
.reveal {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ── HISTORY UI ─────────────────────────────────────────── */
#history-section {
  background: white; border-radius: var(--r);
  border: 1px solid rgba(95,163,78,0.15); box-shadow: var(--shadow-sm);
  padding: 1.5rem; margin-top: 2rem;
}
.hist-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
}
.btn-clear-hist {
  font-family: 'DM Sans', sans-serif; font-size: 0.8rem; font-weight: 600;
  background: var(--danger-bg); color: var(--danger);
  border: 1px solid rgba(192,57,43,0.3); border-radius: 100px;
  padding: 6px 14px; cursor: pointer; display: flex; align-items: center; gap: 6px;
  transition: all 0.2s;
}
.btn-clear-hist:hover { background: rgba(192,57,43,0.15); transform: translateY(-1px); }
.btn-clear-hist svg { width: 14px; height: 14px; }
.history-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem;
  max-height: 400px; overflow-y: auto; padding-right: 5px;
}
.history-list::-webkit-scrollbar { width: 6px; }
.history-list::-webkit-scrollbar-track { background: transparent; }
.history-list::-webkit-scrollbar-thumb { background: var(--mint); border-radius: 10px; }
.hist-card {
  display: flex; gap: 12px; align-items: center;
  background: var(--cream2); border-radius: var(--r-sm);
  border: 1px solid rgba(95,163,78,0.12); padding: 10px;
  transition: transform 0.2s, box-shadow 0.2s;
}
.hist-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); border-color: var(--green-pale); }
.hist-img {
  width: 60px; height: 60px; border-radius: 8px; object-fit: cover;
  background: var(--mint2); border: 1px solid rgba(95,163,78,0.2);
}
.hist-img-placeholder {
  width: 60px; height: 60px; border-radius: 8px;
  background: var(--mint2); border: 1px solid rgba(95,163,78,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; flex-shrink: 0;
}
.hist-info { flex: 1; overflow: hidden; }
.hist-title { font-size: 0.85rem; font-weight: 700; color: var(--green-deep); margin-bottom: 2px; }
.hist-disease { font-size: 0.78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-date { font-size: 0.7rem; color: var(--green-soft); margin-top: 4px; }
.no-history { font-size: 0.85rem; color: var(--green-soft); font-style: italic; text-align: center; padding: 2rem 0; width: 100%; }

/* Language Dropdown Styles */
.lang-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 2px;
}
.lang-btn {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(26, 61, 12, 0.15);
  backdrop-filter: blur(8px);
  padding: 0 12px;
  height: 38px;
  border-radius: 100px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.83rem;
  color: var(--green-deep);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.lang-btn:hover {
  background: #ffffff;
  border-color: var(--green-rich);
  transform: translateY(-1px);
}
.lang-btn svg {
  opacity: 0.8;
}
.lang-btn .chevron {
  transition: transform 0.3s ease;
}
.lang-dropdown.open .chevron {
  transform: rotate(180deg);
}
.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(26, 61, 12, 0.1);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(26, 61, 12, 0.1);
  min-width: 140px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 100;
  overflow: hidden;
}
.lang-dropdown.open .lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.lang-option {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 12px 16px;
  font-family: \'DM Sans\', sans-serif;
  font-size: 0.95rem;
  color: var(--text-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.2s ease;
}
.lang-option:hover {
  background: rgba(26, 61, 12, 0.05);
  color: var(--primary);
}
.lang-flag {
  font-size: 1.2rem;
}

/* ─────────────────────────────────────────────────────────────
   PDF EXPORT BUTTON
   ───────────────────────────────────────────────────────────── */
.btn-pdf-export {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(16, 185, 129, 0.25));
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #4ade80;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.1);
}
.btn-pdf-export:hover {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.25), rgba(16, 185, 129, 0.4));
  border-color: #4ade80;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(34, 197, 94, 0.25);
  color: #ffffff;
}
.btn-pdf-export svg {
  width: 18px;
  height: 18px;
}

/* Open Chat Prompt Card in Diagnosis Result */
.chat-open-prompt {
  margin-top: 24px;
  background: linear-gradient(135deg, rgba(18, 38, 14, 0.85), rgba(12, 28, 8, 0.92));
  backdrop-filter: blur(16px);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 20px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  color: #ffffff;
}
.chat-open-prompt:hover {
  transform: translateY(-2px);
  border-color: rgba(74, 222, 128, 0.6);
  box-shadow: 0 12px 32px rgba(16, 185, 129, 0.25);
  background: linear-gradient(135deg, rgba(24, 48, 18, 0.9), rgba(16, 36, 10, 0.95));
}
.chat-open-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #10b981, #059669);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
  flex-shrink: 0;
}
.chat-open-info {
  flex: 1;
}
.chat-open-title {
  font-family: 'Lora', serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: #ffffff;
}
.chat-open-desc {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 2px;
}

/* ─────────────────────────────────────────────────────────────
   AI PLANT DOCTOR CHATBOT WIDGET
   ───────────────────────────────────────────────────────────── */
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 998;
  padding: 11px 18px;
  height: 48px;
  border-radius: 100px;
  background: linear-gradient(135deg, var(--green-mid), var(--green-rich));
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(26, 61, 12, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.chat-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 26px rgba(26, 61, 12, 0.45);
}
.chat-fab.open {
  width: 48px;
  padding: 0;
  border-radius: 50%;
}
.fab-content {
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}
.chat-fab.open .fab-content {
  opacity: 0;
  display: none;
}
.fab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 6px var(--mint);
}
.chat-fab .fab-icon-close {
  display: none;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.chat-fab.open .fab-icon-close {
  display: flex;
}
.fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid white;
  display: none;
}
.fab-badge.show { display: block; }

.chat-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 61, 12, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.chat-drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.chat-drawer {
  position: fixed;
  bottom: 86px;
  right: 24px;
  z-index: 1000;
  width: 410px;
  height: 580px;
  max-height: calc(100vh - 110px);
  background: #ffffff;
  border: 1px solid rgba(61, 122, 30, 0.2);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(16px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: bottom right;
}
.chat-drawer.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Maximized State on Desktop */
.chat-drawer.maximized {
  width: min(840px, 92vw);
  height: 86vh;
  max-height: 86vh;
  bottom: 7vh;
  right: calc((100vw - min(840px, 92vw)) / 2);
  border-radius: var(--r-lg);
}

.chat-drawer-handle {
  display: none;
}

.chat-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--green-deep), var(--green-mid));
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
  gap: 10px;
}
.chat-drawer-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.chat-drawer-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
}
.chat-drawer-avatar svg {
  width: 18px;
  height: 18px;
}
.chat-drawer-header-text {
  flex: 1;
  min-width: 0;
}
.chat-drawer-title {
  font-family: 'Lora', serif;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  line-height: 1.2;
}
.chat-drawer-badge {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 2px 8px;
  border-radius: 100px;
  display: inline-block;
  margin-top: 3px;
  font-weight: 500;
}

.chat-drawer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.chat-drawer-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.chat-drawer-btn:hover {
  background: rgba(255, 255, 255, 0.26);
  transform: scale(1.04);
}
.chat-drawer-btn.chat-drawer-back {
  display: none; /* Only shown in mobile */
}
.chat-drawer-btn.chat-drawer-close:hover {
  background: rgba(192, 57, 43, 0.85);
  border-color: rgba(192, 57, 43, 1);
  color: #ffffff;
}
.chat-drawer-btn svg {
  width: 15px;
  height: 15px;
}

.chat-context-banner {
  padding: 8px 18px;
  background: var(--mint2);
  border-bottom: 1px solid rgba(61, 122, 30, 0.15);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.chat-context-banner .ctx-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--mint);
  border: 1px solid rgba(61, 122, 30, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.chat-context-banner .ctx-info {
  flex: 1;
  min-width: 0;
}
.chat-context-banner .ctx-label {
  font-size: 0.64rem;
  color: var(--green-mid);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.chat-context-banner .ctx-value {
  font-size: 0.82rem;
  color: var(--green-deep);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-suggestions {
  padding: 10px 18px 4px;
  background: var(--cream2);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}
.chip-btn {
  background: #ffffff;
  border: 1px solid rgba(61, 122, 30, 0.2);
  color: var(--green-deep);
  padding: 6px 13px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'DM Sans', sans-serif;
  text-align: left;
  line-height: 1.3;
  box-shadow: 0 1px 3px rgba(26, 61, 12, 0.04);
}
.chip-btn:hover {
  background: var(--mint);
  border-color: var(--green-soft);
  color: var(--green-deep);
  transform: translateY(-1px);
}

.chat-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  background: var(--cream2);
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  min-height: 0;
}
.chat-drawer-body::-webkit-scrollbar {
  width: 5px;
}
.chat-drawer-body::-webkit-scrollbar-track {
  background: transparent;
}
.chat-drawer-body::-webkit-scrollbar-thumb {
  background: var(--mint);
  border-radius: 10px;
}

.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: chatMsgIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) both;
  align-items: flex-start;
}
.chat-msg.ai {
  align-self: flex-start;
}
.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.chat-msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--mint);
  border: 1px solid rgba(61, 122, 30, 0.2);
  color: var(--green-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  margin-top: 2px;
  flex-shrink: 0;
}
.chat-msg.user .chat-msg-avatar {
  display: none;
}
.msg-bubble {
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.55;
  position: relative;
  word-break: break-word;
}
.chat-msg.ai .msg-bubble {
  background: #ffffff;
  border: 1px solid rgba(61, 122, 30, 0.15);
  color: var(--soil);
  border-top-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(26, 61, 12, 0.04);
}
.chat-msg.ai .msg-bubble strong {
  color: var(--green-deep);
  font-weight: 600;
}
.chat-msg.user .msg-bubble {
  background: linear-gradient(135deg, var(--green-mid), var(--green-rich));
  color: #ffffff;
  border-top-right-radius: 4px;
  box-shadow: 0 3px 12px rgba(45, 96, 23, 0.2);
}

@keyframes chatMsgIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.typing-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
}
.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green-soft);
  animation: dotBounce 1.4s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dotBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.chat-drawer-footer {
  padding: 12px 18px;
  border-top: 1px solid rgba(61, 122, 30, 0.12);
  background: #ffffff;
  flex-shrink: 0;
}
.chat-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
#chat-input {
  flex: 1;
  background: var(--cream2);
  border: 1.5px solid rgba(61, 122, 30, 0.2);
  border-radius: 14px;
  padding: 10px 14px;
  color: var(--soil);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-height: 44px;
  max-height: 120px;
  line-height: 1.45;
  resize: none;
  box-sizing: border-box;
}
#chat-input::placeholder {
  color: #889988;
}
#chat-input:focus {
  border-color: var(--green-soft);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(95, 163, 78, 0.15);
}
.btn-send-chat {
  background: linear-gradient(135deg, var(--green-mid), var(--green-rich));
  border: none;
  border-radius: 12px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 3px 10px rgba(45, 96, 23, 0.25);
  flex-shrink: 0;
}
.btn-send-chat:hover {
  background: var(--green-rich);
  transform: translateY(-1px);
}
.btn-send-chat:active {
  transform: scale(0.95);
}
.btn-send-chat svg {
  width: 18px;
  height: 18px;
}

/* ─────────────────────────────────────────────────────────────
   MOBILE RESPONSIVE TWEAKS FOR CHAT DRAWER (< 640px)
   ───────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .chat-drawer-handle {
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.45);
    margin: 8px auto 2px;
    flex-shrink: 0;
    cursor: pointer;
  }
  /* Mobile State: Docked Native Fullscreen Experience */
  .chat-drawer {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    background: #ffffff;
    border-radius: 0;
    bottom: 0;
    right: 0;
    left: 0;
    margin: 0;
    border: none;
    box-shadow: none;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1000;
  }
  .chat-drawer.open {
    transform: translateY(0);
  }
  .chat-drawer.maximized {
    /* Same fullscreen on mobile */
    inset: 0;
    width: 100%;
    height: 100dvh;
    border-radius: 0;
  }
  .chat-drawer-header {
    padding: 8px 12px 10px;
    gap: 8px;
  }
  .chat-drawer-btn.chat-drawer-back {
    display: flex;
  }
  .chat-drawer-btn.chat-drawer-expand,
  .chat-drawer-btn.chat-drawer-close {
    display: none !important; /* Back button replaces close & maximize */
  }
  .chat-drawer-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }
  .chat-drawer-avatar svg {
    width: 16px;
    height: 16px;
  }
  .chat-drawer-title {
    font-size: 0.94rem;
  }
  .chat-drawer-badge {
    font-size: 0.65rem;
    padding: 1px 6px;
  }
  .chat-context-banner {
    padding: 6px 12px;
    gap: 8px;
  }
  .chat-context-banner .ctx-icon {
    width: 24px;
    height: 24px;
    font-size: 13px;
    border-radius: 6px;
  }
  .chat-context-banner .ctx-label {
    font-size: 0.6rem;
  }
  .chat-context-banner .ctx-value {
    font-size: 0.76rem;
  }
  .chat-suggestions {
    padding: 6px 12px 2px;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .chat-suggestions::-webkit-scrollbar {
    display: none;
  }
  .chip-btn {
    white-space: nowrap;
    font-size: 0.75rem;
    padding: 5px 11px;
    flex-shrink: 0;
  }
  .chat-drawer-body {
    padding: 12px;
    gap: 10px;
  }
  .chat-msg {
    max-width: 93%;
  }
  .chat-msg-avatar {
    width: 24px;
    height: 24px;
    font-size: 11px;
    margin-top: 1px;
  }
  .msg-bubble {
    padding: 9px 13px;
    font-size: 0.88rem;
    line-height: 1.5;
    border-radius: 14px;
  }
  .chat-drawer-footer {
    padding: 8px 12px max(10px, env(safe-area-inset-bottom));
    background: #ffffff;
    border-top: 1px solid rgba(61, 122, 30, 0.12);
  }
  #chat-input {
    font-size: 16px !important; /* Prevents auto-zoom on iOS */
    min-height: 42px;
    max-height: 100px;
    padding: 9px 12px;
    border-radius: 12px;
  }
  .btn-send-chat {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }
  .chat-fab {
    bottom: 18px;
    right: 18px;
    height: 44px;
    padding: 8px 14px;
    font-size: 0.84rem;
  }
  .chat-fab.open {
    width: 44px;
    padding: 0;
  }
  .chat-open-prompt {
    padding: 12px 14px;
    gap: 10px;
    border-radius: 16px;
  }
  .chat-open-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
    border-radius: 10px;
  }
  .chat-open-title {
    font-size: 0.95rem;
  }
  .chat-open-desc {
    font-size: 0.78rem;
  }
  .wrap {
    padding-bottom: 75px;
  }
  .act-row {
    margin-bottom: 12px;
  }
}

/* ── SCROLL ANIMATIONS ──────────────────────────────────── */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.animate-on-scroll.show {
  opacity: 1;
  transform: translateY(0);
}

/* ══════════════════════════════════════════════════════════════
   🏆 PKM-KI EXTENSION STYLES — BLOK LAHAN, GIS MAP & DOSIS PRESISI
   ══════════════════════════════════════════════════════════════ */

/* PKM Nav Badge */
.pkm-nav-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #15803d, #166534);
  color: #fef08a;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.5px;
  margin-left: 6px;
  border: 1px solid rgba(254, 240, 138, 0.4);
}

/* PKM Hero Badge */
.hero-pkm-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(45, 96, 23, 0.12);
  border: 1px solid rgba(45, 96, 23, 0.3);
  color: var(--green-deep);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
  backdrop-filter: blur(8px);
}
.hero-pkm-tag .tag-dot {
  width: 8px;
  height: 8px;
  background: #16a34a;
  border-radius: 50%;
  box-shadow: 0 0 8px #16a34a;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* ── SECTION BLOK LAHAN ───────────────────────────────────── */
.section-block-mgmt {
  margin: 2rem 0;
}
.block-card-active {
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(245,249,240,0.95));
  border: 1.5px solid rgba(45, 96, 23, 0.25);
  border-radius: var(--r);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  transition: all 0.3s ease;
}
.block-card-active:hover {
  box-shadow: var(--shadow);
  border-color: rgba(45, 96, 23, 0.45);
}
.bca-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.bca-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--green-deep);
  background: var(--mint);
  padding: 4px 10px;
  border-radius: 6px;
}
.bca-actions {
  display: flex;
  gap: 8px;
}
.btn-block-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  background: white;
  border: 1px solid rgba(45, 96, 23, 0.2);
  color: var(--green-deep);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-block-action:hover {
  background: var(--mint2);
  border-color: var(--green-rich);
}
.btn-block-action.primary {
  background: var(--green-mid);
  color: white;
  border-color: var(--green-mid);
}
.btn-block-action.primary:hover {
  background: var(--green-rich);
}
.bca-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.bca-item {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(45, 96, 23, 0.12);
  padding: 10px 14px;
  border-radius: 12px;
}
.bca-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 2px;
}
.bca-val {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--green-deep);
}
.bca-subval {
  font-size: 0.75rem;
  color: #64748b;
}

/* ── SECTION GIS MAP ─────────────────────────────────────── */
#peta-gis {
  margin: 3.5rem 0 2rem;
}
.gis-wrapper {
  background: #ffffff;
  border-radius: var(--r-lg);
  border: 1px solid rgba(45, 96, 23, 0.15);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.gis-header-bar {
  padding: 1.2rem 1.5rem;
  background: linear-gradient(to right, #fbfdf9, #f2f7ec);
  border-bottom: 1px solid rgba(45, 96, 23, 0.12);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.gis-title-group h3 {
  font-family: 'Lora', serif;
  font-size: 1.3rem;
  color: var(--green-deep);
  margin-bottom: 4px;
}
.gis-title-group p {
  font-size: 0.82rem;
  color: #475569;
}
.gis-controls-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.gis-filter-select {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(45,96,23,0.25);
  background: white;
  font-size: 0.82rem;
  color: var(--green-deep);
  font-weight: 500;
  outline: none;
}
.gis-stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  background: #f8fafc;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.gis-stat-box {
  padding: 10px 16px;
  text-align: center;
  border-right: 1px solid rgba(0,0,0,0.05);
}
.gis-stat-box:last-child {
  border-right: none;
}
.gis-stat-num {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
}
.gis-stat-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #64748b;
  font-weight: 600;
}
#gis-map-container {
  height: 440px;
  width: 100%;
  position: relative;
  z-index: 10;
}
.gis-legend {
  padding: 10px 16px;
  background: #ffffff;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: #475569;
  border-top: 1px solid rgba(0,0,0,0.06);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.legend-dot.red { background: #dc2626; box-shadow: 0 0 6px rgba(220, 38, 38, 0.6); }
.legend-dot.yellow { background: #d97706; box-shadow: 0 0 6px rgba(217, 119, 6, 0.6); }
.legend-dot.green { background: #16a34a; box-shadow: 0 0 6px rgba(22, 163, 74, 0.6); }

/* Custom Leaflet Pulsing Markers */
.leaflet-pkm-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: white;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  cursor: pointer;
  border: 2px solid white;
}
.leaflet-pkm-marker.sev-danger {
  background: #dc2626;
  animation: pulse-danger 1.5s infinite;
}
.leaflet-pkm-marker.sev-warn {
  background: #d97706;
}
.leaflet-pkm-marker.sev-safe {
  background: #16a34a;
}
@keyframes pulse-danger {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
  border-radius: 14px !important;
  box-shadow: 0 12px 28px -4px rgba(15, 23, 42, 0.18), 0 4px 12px -2px rgba(15, 23, 42, 0.08) !important;
  padding: 2px !important;
}
.leaflet-popup-content {
  margin: 12px 14px !important;
  line-height: 1.4 !important;
}

/* ── KALKULATOR DOSIS PRESISI WIDGET (IN RESULT) ──────────── */
.dose-calc-card {
  margin: 1.5rem 0;
  background: linear-gradient(145deg, #f0fdf4, #fbfdf9);
  border: 1.5px solid #86efac;
  border-radius: 16px;
  padding: 1.4rem;
  box-shadow: 0 4px 16px rgba(22, 163, 74, 0.08);
}
.dcc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  border-bottom: 1px dashed rgba(22, 163, 74, 0.3);
  padding-bottom: 8px;
}
.dcc-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #14532d;
  font-family: 'Lora', serif;
}
.dcc-badge {
  font-size: 0.7rem;
  font-weight: 700;
  background: #bbf7d0;
  color: #166534;
  padding: 2px 8px;
  border-radius: 99px;
  text-transform: uppercase;
}
.dcc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.dcc-stat {
  background: white;
  border: 1px solid #dcfce7;
  border-radius: 10px;
  padding: 10px 12px;
}
.dcc-stat-lbl {
  font-size: 0.72rem;
  font-weight: 600;
  color: #4b5563;
  text-transform: uppercase;
}
.dcc-stat-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: #15803d;
  margin-top: 2px;
}
.dcc-prescription {
  background: white;
  border-radius: 12px;
  padding: 12px 14px;
  border-left: 4px solid #16a34a;
  margin-bottom: 10px;
}
.dcc-prescription.chemical {
  border-left-color: #f59e0b;
}
.dcc-presc-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #1f2937;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.dcc-presc-body {
  font-size: 0.8rem;
  color: #4b5563;
  line-height: 1.5;
}

/* ── MODAL BLOK LAHAN ─────────────────────────────────────── */
.block-modal-list {
  max-height: 240px;
  overflow-y: auto;
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.block-modal-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.block-modal-item:hover, .block-modal-item.active {
  border-color: #16a34a;
  background: #f0fdf4;
}
.block-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
@media (max-width: 600px) {
  .block-form-grid { grid-template-columns: 1fr; }
}

/* ── PRINT & OFFICIAL PKM REPORT STYLES ──────────────────── */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  .bg-blobs, #main-nav, .chat-fab, .chat-drawer, .btn-row, .modal-overlay,
  .act-row, .tips-box, .picker-section, .drop-area, #fitur, #cara-pakai, footer {
    display: none !important;
  }
  .wrap {
    max-width: 100% !important;
    padding: 0 !important;
  }
  #deteksi, #result-section {
    display: block !important;
  }
  .result-card, .preview-card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
}

/* ── STANDALONE DOSAGE CALCULATOR (PKM-KI STANDARD) ────── */
.section-dose-calculator {
  margin-top: 3.5rem;
  padding: 2.5rem 0;
  border-top: 1px solid #e2e8f0;
}
.calc-box-wrapper {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 1.75rem;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
}
.calc-form-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}
.calc-input-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.5rem;
}
.calc-select, .calc-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  font-size: 0.95rem;
  font-family: inherit;
  color: #0f172a;
  min-height: 48px;
  transition: all 0.2s ease;
}
.calc-select:focus, .calc-input:focus {
  outline: none;
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}
.calc-block-badge-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: #f1f5f9;
  border-radius: 10px;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  color: #475569;
}
.calc-block-badge-info .badge {
  background: #0f172a;
  color: #ffffff;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  font-weight: 600;
}
.calc-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.calc-kpi-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem 1rem;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.calc-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -2px rgba(15, 23, 42, 0.08);
}
.calc-kpi-card.highlight {
  background: #f0fdf4;
  border-color: #86efac;
}
.calc-kpi-card.highlight .calc-val {
  color: #15803d;
}
.calc-kpi-card .calc-label {
  font-size: 0.8rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.calc-kpi-card .calc-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}
.calc-kpi-card .calc-unit {
  font-size: 0.8rem;
  color: #64748b;
  font-weight: 500;
  margin-left: 0.25rem;
}
.calc-sop-box {
  background: #f8fafc;
  border-left: 4px solid #16a34a;
  border-radius: 0 10px 10px 0;
  padding: 1rem 1.25rem;
  font-size: 0.88rem;
  line-height: 1.6;
}
.calc-sop-box.warn {
  border-left-color: #f59e0b;
  background: #fffbeb;
}
.sop-title {
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── GIS CADASTRAL & SATELLITE TOGGLE ─────────────────────── */
.gis-pill-btn {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  padding: 0.5rem 1rem;
  border-radius: 100px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 40px;
}
.gis-pill-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}
.gis-pill-btn.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}
.gis-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.gis-stat-box.clickable {
  cursor: pointer;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.75rem;
  text-align: center;
  transition: all 0.2s ease;
}
.gis-stat-box.clickable:hover {
  border-color: #16a34a;
  background: #f0fdf4;
}
.gis-stat-box.clickable:active {
  transform: scale(0.98);
}
.gis-stat-box.clickable.active-filter {
  border-color: #16a34a;
  background: #f0fdf4;
  box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}
.gis-stat-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.3rem;
  font-weight: 700;
  display: block;
}
.gis-stat-lbl {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}

/* ── FOOTER EXPORT BUTTON ─────────────────────────────────── */
.footer-export-btn {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  padding: 0.65rem 1.25rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 0.75rem;
  min-height: 48px;
}
.footer-export-btn:hover {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

/* ── CHAT DRAWER CLEAR BUTTON ────────────────────────────── */
.chat-drawer-clear:hover {
  background: rgba(239, 68, 68, 0.28) !important;
  border-color: rgba(239, 68, 68, 0.45) !important;
  color: #fca5a5 !important;
}

/* ── GIS BOUNDARY EDITING & HANDLES ──────────────────────── */
.btn-block-action.editing-active {
  background: #15803d !important;
  color: #ffffff !important;
  border-color: #166534 !important;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.55);
  animation: pulseEdit 2s infinite ease-in-out;
}
@keyframes pulseEdit {
  0%, 100% { box-shadow: 0 0 8px rgba(34, 197, 94, 0.4); }
  50% { box-shadow: 0 0 16px rgba(34, 197, 94, 0.8); }
}

.boundary-corner-handle {
  width: 20px;
  height: 20px;
  background: #ffffff;
  border: 3px solid #16a34a;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  cursor: grab;
  transition: transform 0.15s ease, background 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}
.boundary-corner-handle:hover,
.boundary-corner-handle:active {
  transform: scale(1.3);
  background: #22c55e;
  border-color: #ffffff;
  cursor: grabbing;
}

.boundary-corner-handle::after {
  content: '';
  width: 6px;
  height: 6px;
  background: #15803d;
  border-radius: 50%;
}

/* ── BLOCK DIMENSION INPUT GRID ──────────────────────────── */
@media (max-width: 480px) {
  .block-dim-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .block-dim-grid input#nb-area {
    grid-column: 1 / -1;
  }
}

/* ── BLOCK DELETE BUTTON IN MODAL ────────────────────────── */
.btn-block-delete {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  color: #ef4444;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}
.btn-block-delete:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
  transform: scale(1.05);
}

/* ── OFFLINE SURVEY QUEUE BAR ────────────────────────────── */
.offline-queue-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(240, 253, 244, 0.95));
  border: 1.5px solid rgba(22, 163, 74, 0.35);
  border-radius: 12px;
  padding: 10px 16px;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(22, 163, 74, 0.12);
  gap: 12px;
  flex-wrap: wrap;
}
.oqb-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.oqb-pill {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  background: #dcfce7;
  color: #15803d;
  padding: 4px 10px;
  border-radius: 99px;
  letter-spacing: 0.4px;
}
.oqb-text {
  font-size: 0.85rem;
  color: #1e293b;
}
.oqb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #ffffff;
  border: none;
  border-radius: 9px;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(22, 163, 74, 0.3);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.oqb-btn:hover {
  background: linear-gradient(135deg, #15803d, #166534);
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(22, 163, 74, 0.45);
}
.oqb-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ── LIVE GPS TRACKER RADAR DOT ──────────────────────────── */
.btn-block-action.tracking-active {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #1d4ed8 !important;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.5);
  animation: pulseTracking 2s infinite;
}
@keyframes pulseTracking {
  0%, 100% { box-shadow: 0 0 8px rgba(37, 99, 235, 0.4); }
  50% { box-shadow: 0 0 16px rgba(37, 99, 235, 0.75); }
}

.live-user-dot {
  width: 16px;
  height: 16px;
  background: #2563eb;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.75);
  position: relative;
}
.live-user-dot::after {
  content: '';
  position: absolute;
  width: 36px;
  height: 36px;
  background: rgba(37, 99, 235, 0.28);
  border-radius: 50%;
  top: -13px;
  left: -13px;
  animation: liveUserPulse 2s infinite ease-out;
}
@keyframes liveUserPulse {
  0% { transform: scale(0.5); opacity: 1; }
  100% { transform: scale(2.0); opacity: 0; }
}

/* ── NUMBERED OFFLINE SURVEY PINS ────────────────────────── */
.offline-seq-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #0f172a, #1e293b);
  border: 2.5px solid #10b981;
  border-radius: 50%;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45), 0 0 8px rgba(16, 185, 129, 0.5);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.offline-seq-pin:hover {
  transform: scale(1.25);
  border-color: #34d399;
}


