/* ══════════════════════════════════════════════════════════
   Terravo · AIoT Agriculture Dashboard — LIGHT THEME
   ══════════════════════════════════════════════════════════ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Greens */
  --g300: #6ee7a0;
  --g400: #34d769;
  --g500: #22c55e;
  --g600: #16a34a;
  --g700: #15803d;

  /* Light backgrounds */
  --bg: #f0f7f2;
  --bg-2: #e8f4ed;
  --surface: #ffffff;
  --surface-2: #f7fdf9;
  --border: rgba(22, 163, 74, 0.18);
  --border2: rgba(22, 163, 74, 0.32);

  /* Text */
  --text-primary: #0f2d1c;
  --text-secondary: #1a5c35;
  --text-muted: #5a8a6a;

  /* Accents */
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.10);
  --accent-med: rgba(34, 197, 94, 0.18);
  --warn: #f97316;
  --info: #3b82f6;
  --purple: #8b5cf6;

  /* Sidebar fixed width */
  --sidebar-w: 210px;

  --radius-card: 18px;
  --radius-sm: 10px;
  --shadow-card: 0 2px 20px rgba(0, 80, 30, 0.08), 0 0 0 1px var(--border);
  --shadow-hover: 0 6px 30px rgba(0, 80, 30, 0.14);
  --transition: 0.22s cubic-bezier(.4, 0, .2, 1);
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 10% 0%, rgba(34, 197, 94, 0.07) 0%, transparent 45%),
    radial-gradient(circle at 90% 100%, rgba(22, 163, 74, 0.05) 0%, transparent 45%);
}

/* ─── SCROLL ─── */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 99px;
}

/* ─── GLASS CARDS ─── */
.glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.glass-card-sm {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 8px rgba(0, 80, 30, 0.06);
}

/* ══════════════════════════════════
   LAYOUT
   ══════════════════════════════════ */
.app-shell {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

/* ══════════════════════════════════
   SIDEBAR — always-visible, fixed width
   ══════════════════════════════════ */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  gap: 4px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: 2px 0 16px rgba(0, 80, 30, 0.06);
  overflow: hidden;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.logo-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(34, 197, 94, 0.4));
}

.brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--g600);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border-radius: 12px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.855rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  width: 100%;
  text-align: left;
  font-family: 'Inter', sans-serif;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  transition: color var(--transition);
}

.nav-item:hover {
  background: var(--accent-soft);
  color: var(--g600);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.14), rgba(22, 163, 74, 0.08));
  color: var(--g600);
  border: 1px solid rgba(34, 197, 94, 0.28);
  font-weight: 600;
  box-shadow: 0 2px 10px rgba(34, 197, 94, 0.12);
}

.nav-item.active svg {
  color: var(--g500);
}

.sidebar-bottom {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.user-chip:hover {
  background: var(--accent-med);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--g500), var(--g700));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: white;
  flex-shrink: 0;
  border: 2px solid rgba(34, 197, 94, 0.4);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.user-role {
  font-size: 0.66rem;
  color: var(--text-muted);
}

/* ══════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════ */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 16px;
  overflow-y: auto;
  min-width: 0;
}

/* ─── TOP BAR ─── */
.top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.top-bar-left {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.page-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.status-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  letter-spacing: 0.02em;
}

.chip-live {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.chip-ai {
  background: rgba(139, 92, 246, 0.10);
  color: #7c3aed;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.chip-loc {
  background: rgba(59, 130, 246, 0.10);
  color: #1d4ed8;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.dot-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--g500);
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: pulse 1.6s infinite;
  display: inline-block;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  }

  70% {
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
  }
}

.top-bar-right {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.btn-outline {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
  box-shadow: 0 1px 6px rgba(0, 80, 30, 0.07);
}

.btn-outline:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--g600);
  box-shadow: 0 2px 12px rgba(34, 197, 94, 0.18);
}

.btn-primary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #34d769, #15803d);
  color: white;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(34, 197, 94, 0.45);
}

/* ─── CENTER GRID ─── */
.center-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  min-height: 420px;
}

/* ══════════════════════════════════
   PLANT PANEL
   ══════════════════════════════════ */
.plant-panel {
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 14px;
  position: relative;
}

.plant-panel::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(34, 197, 94, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.plant-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.panel-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.panel-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2px;
}

.health-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.71rem;
  font-weight: 600;
}

.health-good {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #15803d;
}

.health-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--g500);
  animation: pulse 2s infinite;
}

/* ─── PLANT SCENE ─── */
.plant-scene {
  flex: 1;
  min-height: 280px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #edfbf2 0%, #f4fef7 60%, #e8f7ef 100%);
  border-radius: 14px;
  border: 1px solid rgba(34, 197, 94, 0.18);
  overflow: hidden;
}

.scene-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(34, 197, 94, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 197, 94, 0.07) 1px, transparent 1px);
  background-size: 28px 28px;
  border-radius: 14px;
}

.glow-ring {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 30px;
  background: radial-gradient(ellipse, rgba(34, 197, 94, 0.25) 0%, transparent 70%);
  border-radius: 50%;
  animation: glowPulse 3s ease-in-out infinite;
}

@keyframes glowPulse {

  0%,
  100% {
    opacity: 0.6;
    transform: translateX(-50%) scaleX(1);
  }

  50% {
    opacity: 1;
    transform: translateX(-50%) scaleX(1.15);
  }
}

.plant-svg {
  width: 60%;
  max-width: 230px;
  height: auto;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 8px 24px rgba(34, 197, 94, 0.2)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.08));
  animation: plantSway 6s ease-in-out infinite;
}

@keyframes plantSway {

  0%,
  100% {
    transform: rotate(-1.2deg);
  }

  50% {
    transform: rotate(1.2deg);
  }
}

.leaf {
  animation: leafRust 4s ease-in-out infinite;
}

.leaf-r2,
.leaf-t2 {
  animation-delay: 1s;
}

.leaf-l2,
.leaf-t1 {
  animation-delay: 2s;
}

.leaf-t3 {
  animation-delay: 0.5s;
}

@keyframes leafRust {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.88;
  }
}

.tomato {
  animation: tomatoShine 3s ease-in-out infinite;
}

@keyframes tomatoShine {

  0%,
  100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.15);
  }
}

/* Paddy grain shimmer */
.grain {
  animation: grainShimmer 3.5s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.grain:nth-child(odd) {
  animation-delay: 0.5s;
}

.grain:nth-child(even) {
  animation-delay: 1.3s;
}

@keyframes grainShimmer {

  0%,
  100% {
    opacity: 0.85;
    filter: brightness(1);
  }

  50% {
    opacity: 1;
    filter: brightness(1.3) drop-shadow(0 0 3px rgba(245, 158, 11, 0.7));
  }
}

/* Panicle gentle drooping sway */
.panicle {
  transform-box: fill-box;
  transform-origin: bottom center;
  animation: panicleSway 5.5s ease-in-out infinite;
}

.panicle:nth-child(odd) {
  animation-delay: 0.9s;
}

.panicle:nth-child(even) {
  animation-delay: 2.1s;
}

@keyframes panicleSway {

  0%,
  100% {
    transform: rotate(-1.2deg);
  }

  50% {
    transform: rotate(1.5deg);
  }
}

/* grain branch subtle pulse */
.grain-branch {
  animation: branchPulse 4s ease-in-out infinite;
}

@keyframes branchPulse {

  0%,
  100% {
    opacity: 0.75;
  }

  50% {
    opacity: 1;
  }
}

.particle {
  animation: particleFloat 4s ease-in-out infinite;
}

.p2 {
  animation-delay: 1s;
}

.p3 {
  animation-delay: 2s;
}

.p4 {
  animation-delay: 0.5s;
}

.p5 {
  animation-delay: 1.5s;
}

@keyframes particleFloat {

  0%,
  100% {
    transform: translateY(0);
    opacity: 0.7;
  }

  50% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

.scan-line {
  animation: scanMove 4s linear infinite;
}

@keyframes scanMove {
  0% {
    y: 50px;
    opacity: 0;
  }

  10% {
    opacity: 0.4;
  }

  90% {
    opacity: 0.4;
  }

  100% {
    y: 290px;
    opacity: 0;
  }
}

/* Float chips */
.float-chip {
  position: absolute;
  z-index: 3;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.67rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--g700);
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px rgba(0, 80, 30, 0.1);
  pointer-events: none;
  animation: chipFloat 5s ease-in-out infinite;
  white-space: nowrap;
}

.fc-moisture {
  animation-delay: 0s;
}

.fc-light {
  animation-delay: 1.5s;
}

.fc-ph {
  animation-delay: 3s;
}

@keyframes chipFloat {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

/* ─── HEALTH BAR ─── */
.health-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.health-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.71rem;
  color: var(--text-muted);
}

.health-val {
  color: var(--g600);
  font-weight: 700;
}

.progress-track {
  height: 6px;
  background: rgba(34, 197, 94, 0.12);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(34, 197, 94, 0.15);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #16a34a, #34d769);
  border-radius: 999px;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.35);
}

/* ─── ACTION CHIPS ─── */
.action-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-chip {
  padding: 7px 14px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--g700);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  font-family: 'Inter', sans-serif;
  box-shadow: 0 1px 6px rgba(0, 80, 30, 0.07);
}

.action-chip:hover {
  background: var(--accent-med);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(34, 197, 94, 0.2);
}

/* ══════════════════════════════════
   SENSOR PANEL
   ══════════════════════════════════ */
.sensor-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sensor-card {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  transition: all var(--transition);
  background: var(--surface);
}

.sensor-card:hover {
  border-color: rgba(34, 197, 94, 0.4);
  box-shadow: var(--shadow-hover);
  transform: translateX(-2px);
}

.sensor-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sensor-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.si-blue {
  background: rgba(59, 130, 246, 0.10);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.si-orange {
  background: rgba(249, 115, 22, 0.10);
  border: 1px solid rgba(249, 115, 22, 0.2);
}

.si-purple {
  background: rgba(139, 92, 246, 0.10);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.si-yellow {
  background: rgba(234, 179, 8, 0.10);
  border: 1px solid rgba(234, 179, 8, 0.2);
}

.sensor-info {
  flex: 1;
  min-width: 0;
}

.sensor-name {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.sensor-loc {
  display: block;
  font-size: 0.67rem;
  color: var(--text-muted);
}

/* Toggle */
.toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  transition: all var(--transition);
}

.toggle-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #94a3b8;
  transition: all var(--transition);
}

.toggle input:checked+.toggle-track {
  background: rgba(34, 197, 94, 0.2);
  border-color: var(--g500);
}

.toggle input:checked+.toggle-track::after {
  left: calc(100% - 19px);
  background: var(--g500);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.45);
}

/* Sensor values */
.sensor-value-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sensor-val {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.sensor-unit {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 2px;
}

.sparkline-wrap {
  width: 80px;
  height: 30px;
}

.sparkline {
  display: block;
}

/* Gauge */
.gauge-bar {
  height: 5px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 999px;
  overflow: hidden;
}

.gauge-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 1s ease;
}

.gf-blue {
  background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.gf-orange {
  background: linear-gradient(90deg, #ea580c, #fb923c);
}

.gf-purple {
  background: linear-gradient(90deg, #7c3aed, #a78bfa);
}

.gf-yellow {
  background: linear-gradient(90deg, #b45309, #facc15);
}

/* Footer */
.sensor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tag {
  font-size: 0.64rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  letter-spacing: 0.02em;
}

.tag-ok {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.tag-warn {
  background: rgba(249, 115, 22, 0.12);
  color: #b45309;
  border: 1px solid rgba(249, 115, 22, 0.25);
}

.sensor-time {
  font-size: 0.64rem;
  color: var(--text-muted);
}

/* ══════════════════════════════════
   BOTTOM BAR
   ══════════════════════════════════ */
.bottom-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.bottom-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  transition: all var(--transition);
}

.bottom-stat:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--border2);
}

.bs-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.bs-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.bs-label {
  font-size: 0.64rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bs-val {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}

.mini-ring {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.mini-ring svg {
  width: 34px;
  height: 34px;
}

.btn-mini {
  padding: 5px 12px;
  border-radius: 7px;
  border: 1px solid var(--border2);
  background: var(--accent-soft);
  color: var(--g700);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  font-family: 'Inter', sans-serif;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-mini:hover {
  background: var(--accent-med);
}

/* ══════════════════════════════════
   MOBILE HEADER
   ══════════════════════════════════ */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(0, 80, 30, 0.07);
  position: sticky;
  top: 0;
  z-index: 200;
}

.mobile-header-left,
.mobile-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hamburger {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border2);
  background: var(--accent-soft);
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all var(--transition);
}

.hamburger span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--g700);
  border-radius: 2px;
  transition: all var(--transition);
}

.hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
}

.hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.hamburger:hover {
  background: var(--accent-med);
}

.ai-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(139, 92, 246, 0.1);
  color: #7c3aed;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

/* ══════════════════════════════════
   OVERLAY NAV (mobile only)
   ══════════════════════════════════ */
.overlay-nav {
  position: fixed;
  inset: 0;
  background: rgba(240, 247, 242, 0.97);
  backdrop-filter: blur(20px);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transform: translateX(-100%);
  transition: transform 0.32s cubic-bezier(.4, 0, .2, 1);
}

.overlay-nav.open {
  transform: translateX(0);
}

.close-nav {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: var(--accent-soft);
  color: var(--g700);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
}

.close-nav:hover {
  background: var(--accent-med);
}

.overlay-links {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 280px;
  gap: 6px;
}

.overlay-links .nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all var(--transition);
  box-shadow: 0 1px 6px rgba(0, 80, 30, 0.05);
}

.overlay-links .nav-link:hover,
.overlay-links .nav-link.active {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.14), rgba(22, 163, 74, 0.08));
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--g600);
}

.nav-icon {
  font-size: 1.2rem;
}

/* ══════════════════════════════════
   TOAST
   ══════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface);
  border: 1px solid var(--border2);
  color: var(--g700);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: 0 4px 24px rgba(0, 80, 30, 0.15);
  transition: transform 0.4s cubic-bezier(.4, 0, .2, 1), opacity 0.4s;
  opacity: 0;
  z-index: 1000;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ══════════════════════════════════
   RESPONSIVE — TABLET (≤ 900px)
   ══════════════════════════════════ */
@media (max-width: 900px) {
  :root {
    --sidebar-w: 64px;
  }

  .sidebar {
    padding: 16px 8px;
  }

  .sidebar-logo {
    padding: 4px 6px 14px;
  }

  .brand-name {
    display: none;
  }

  .nav-item span {
    display: none;
  }

  .nav-item {
    padding: 11px;
    justify-content: center;
    border-radius: 12px;
  }

  .user-info {
    display: none;
  }

  .user-chip {
    justify-content: center;
    padding: 8px;
  }

  .center-grid {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .sensor-panel {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    overflow: visible;
  }

  .bottom-bar {
    grid-template-columns: repeat(2, 1fr);
  }

  .plant-scene {
    min-height: 210px;
  }
}

/* ══════════════════════════════════
   RESPONSIVE — MOBILE (≤ 640px)
   ══════════════════════════════════ */
@media (max-width: 640px) {
  .sidebar {
    display: none;
  }

  .mobile-header {
    display: flex;
  }

  .app-shell {
    display: block;
    height: auto;
  }

  .main-content {
    padding: 12px;
    gap: 12px;
    height: auto;
    overflow: visible;
  }

  .top-bar {
    gap: 8px;
  }

  .top-bar-right {
    width: 100%;
    justify-content: flex-end;
  }

  .page-title {
    font-size: 1rem;
  }

  .center-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .sensor-panel {
    grid-template-columns: 1fr;
  }

  .plant-scene {
    min-height: 250px;
  }

  .plant-svg {
    width: 55%;
  }

  .float-chip {
    font-size: 0.61rem;
    padding: 4px 8px;
  }

  .bottom-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .bottom-stat {
    padding: 10px 12px;
  }

  .action-chips {
    gap: 7px;
  }

  .action-chip {
    font-size: 0.7rem;
    padding: 6px 11px;
  }

  .sensor-card {
    padding: 12px;
  }
}

@media (max-width: 380px) {
  .bottom-bar {
    grid-template-columns: 1fr;
  }

  .chip-loc {
    display: none;
  }
}

/* ══════════════════════════════════════════════════════════
   GROWTH STAGE TRACKER
   ══════════════════════════════════════════════════════════ */
.growth-strip {
  margin-bottom: 16px;
  padding: 18px 22px 14px;
}

.gs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.gs-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gs-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.gs-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.gs-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.gs-day-badge {
  background: rgba(22, 163, 74, 0.1);
  color: var(--g600);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
}

.gs-track {
  position: relative;
  padding-bottom: 4px;
}

.gs-bar-bg {
  position: absolute;
  top: 13px;
  left: calc(100% / 16);
  right: calc(100% / 16);
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  z-index: 0;
}

.gs-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--g500), var(--g700));
  border-radius: 4px;
  transition: width 0.6s ease;
}

.gs-stages {
  display: flex;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.gs-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.gs-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  transition: all 0.3s;
}

.gs-node.done .gs-dot {
  background: var(--g600);
  border-color: var(--g600);
}

.gs-node.active .gs-dot {
  background: var(--surface);
  border-color: var(--g500);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2);
  width: 34px;
  height: 34px;
}

.gs-node span {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.gs-node.done span,
.gs-node.active span {
  color: var(--g600);
}

.gs-node small {
  font-size: 9px;
  color: var(--text-muted);
}

.gs-footer {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.gs-footer span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.gs-footer strong {
  color: var(--text-primary);
}

/* ══════════════════════════════════════════════════════════
   AI PREDICTION CARDS
   ══════════════════════════════════════════════════════════ */
.ai-pred-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.pred-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pred-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.pred-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pi-blue {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.pi-green {
  background: rgba(34, 197, 94, 0.12);
  color: var(--g500);
}

.pi-amber {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
}

.pred-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.pred-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.pred-conf {
  margin-left: auto;
  text-align: center;
  flex-shrink: 0;
}

.conf-ring {
  position: relative;
  width: 40px;
  height: 40px;
}

.conf-ring svg {
  width: 40px;
  height: 40px;
}

.conf-ring span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-primary);
}

.pred-conf small {
  font-size: 9px;
  color: var(--text-muted);
}

.pred-action-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text-primary);
}

.pi-blue-bg {
  background: rgba(59, 130, 246, 0.08);
}

.pi-green-bg {
  background: rgba(34, 197, 94, 0.08);
}

.pi-amber-bg {
  background: rgba(245, 158, 11, 0.08);
}

.pred-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pred-metric {
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border-radius: 8px;
  padding: 8px 10px;
}

.pm-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
}

.pm-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.pm-warn {
  color: #f59e0b;
}

/* NPK bars */
.npk-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.npk-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.npk-row>span:first-child {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  width: 14px;
  flex-shrink: 0;
}

.npk-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.npk-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s;
}

.npk-row small {
  font-size: 10px;
  color: var(--text-muted);
  width: 24px;
}

/* Risk list */
.risk-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.risk-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.risk-name {
  font-size: 11px;
  color: var(--text-secondary);
  width: 90px;
  flex-shrink: 0;
}

.risk-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.risk-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.5s;
}

.risk-tag {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
}

.risk-tag.low {
  background: rgba(34, 197, 94, 0.12);
  color: var(--g600);
}

.risk-tag.med {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.risk-tag.high {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

/* Prediction footer buttons */
.pred-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.btn-pred {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  background: var(--g600);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-pred:hover {
  background: var(--g700);
}

.btn-pred-outline {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--text-secondary);
}

.btn-pred-outline:hover {
  background: var(--bg-2);
}

.btn-pred-amber {
  background: rgba(245, 158, 11, 0.15);
  color: #92400e;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-pred-amber:hover {
  background: rgba(245, 158, 11, 0.25);
}

.pred-timestamp {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: auto;
}

/* ══════════════════════════════════════════════════════════
   FIELD INTELLIGENCE GRID
   ══════════════════════════════════════════════════════════ */
.field-intel-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.fi-card {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fi-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fi-big-val {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.fi-unit {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.fi-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fi-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 2px;
}

.fi-metric {
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border-radius: 7px;
  padding: 7px 9px;
}

.fi-metric span {
  font-size: 10px;
  color: var(--text-muted);
}

.fi-metric strong {
  font-size: 12px;
  color: var(--text-primary);
}

/* Weather widget */
.weather-now {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.w-temp {
  font-size: 36px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.w-temp span {
  font-size: 16px;
}

.w-detail {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.w-detail span {
  font-size: 11px;
  color: var(--text-muted);
}

.weather-forecast {
  display: flex;
  gap: 4px;
}

.wf-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: var(--bg-2);
  border-radius: 8px;
  padding: 6px 4px;
  font-size: 10px;
  color: var(--text-muted);
}

.wf-day span:last-child {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 10px;
}

.fi-sub-row {
  margin-top: 2px;
}

/* GDD bar */
.gdd-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gdd-bar-track {
  height: 6px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.gdd-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #22c55e);
  border-radius: 6px;
  transition: width 0.6s;
}

.gdd-labels {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════════════════
   ALERTS & QUICK STATS
   ══════════════════════════════════════════════════════════ */
.alerts-row {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 14px;
  margin-bottom: 16px;
}

.alerts-panel {
  padding: 16px;
}

.alerts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.alerts-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.alert-count {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.alert-feed {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border-left: 3px solid transparent;
}

.alert-item.alert-warn {
  background: rgba(245, 158, 11, 0.06);
  border-left-color: #f59e0b;
}

.alert-item.alert-info {
  background: rgba(59, 130, 246, 0.06);
  border-left-color: #3b82f6;
}

.alert-item.alert-ok {
  background: rgba(34, 197, 94, 0.06);
  border-left-color: var(--g500);
}

.alert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.alert-dot-warn {
  background: #f59e0b;
}

.alert-dot-info {
  background: #3b82f6;
}

.alert-dot-ok {
  background: var(--g500);
}

.alert-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.alert-msg {
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
}

.alert-time {
  font-size: 10px;
  color: var(--text-muted);
}

.alert-action {
  padding: 4px 12px;
  border-radius: 7px;
  border: 1px solid var(--border2);
  background: var(--surface);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.alert-action:hover {
  background: var(--bg-2);
}

/* Quick stats */
.quick-stats-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.qs-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}

.qs-icon {
  flex-shrink: 0;
  display: flex;
}

.qs-info {
  display: flex;
  flex-direction: column;
}

.qs-label {
  font-size: 10px;
  color: var(--text-muted);
}

.qs-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — NEW SECTIONS
   ══════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .ai-pred-grid {
    grid-template-columns: 1fr 1fr;
  }

  .field-intel-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 860px) {
  .ai-pred-grid {
    grid-template-columns: 1fr;
  }

  .field-intel-grid {
    grid-template-columns: 1fr 1fr;
  }

  .alerts-row {
    grid-template-columns: 1fr;
  }

  .gs-stages {
    overflow-x: auto;
  }

  .gs-node span,
  .gs-node small {
    display: none;
  }
}

@media (max-width: 600px) {
  .field-intel-grid {
    grid-template-columns: 1fr;
  }

  .growth-strip {
    padding: 14px;
  }
}