:root {
  /* Light glassmorphism palette */
  --bg: #f0f4f8;
  --bg-2: #e2e8f0;
  --surface: rgba(255, 255, 255, 0.85);
  --surface-2: rgba(255, 255, 255, 0.95);
  --line: rgba(148, 163, 184, 0.3);
  --ink: #1e293b;
  --muted: #64748b;
  --accent: #10b981;
  --accent-ink: #ffffff;
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #ef4444;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --radius: 20px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── topbar ────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: var(--shadow);
}

/* ── Utilities ──────────────────────────────────────────── */
.panel-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.alert-list {
  max-height: 180px;
  overflow-y: auto;
}
.camera-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.camera-actions .settings-btn {
  flex: 1;
  min-width: 100px;
}
.select-sm {
  min-height: 32px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 8px;
}
.text-muted {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.text-accent {
  color: var(--accent);
}
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 12px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 18px;
  color: var(--ink);
}
.brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), #059669);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.topbar-actions { display: flex; align-items: center; gap: 12px; }

select {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  min-height: 42px;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
  backdrop-filter: blur(10px);
}
select:hover { border-color: var(--accent); }

.badge {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(10px);
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .8;
}
.badge--muted { background: rgba(100, 116, 139, 0.15); color: var(--muted); }
.badge--ok { background: rgba(16, 185, 129, 0.15); color: var(--ok); }
.badge--warn { background: rgba(245, 158, 11, 0.15); color: var(--warn); }
.badge--bad { background: rgba(239, 68, 68, 0.15); color: var(--bad); }

/* ── layout ────────────────────────────────────────────── */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 20px;
}

/* ── Hero Section (Harvest AI) ─────────────────────────── */
.hero {
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.85));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
}

.hero-visual {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #10b981, #059669);
  display: grid;
  place-items: center;
}

.hero-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Raspberry Pi Board */
.pi-board {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #10b981, #059669);
  padding: 20px;
}

.pi-board-inner {
  position: relative;
  width: 260px;
  height: 200px;
  background: #228B22;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.2);
  display: grid;
  grid-template-columns: 40px 1fr 60px;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
  padding: 16px;
}

.pi-cpu {
  grid-column: 2;
  grid-row: 1;
  background: #1a1a1a;
  border-radius: 4px;
  box-shadow: inset 0 0 4px rgba(0,0,0,0.5);
}

.pi-ram {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 30px;
  height: 20px;
  background: #1a1a1a;
  border-radius: 2px;
}

.pi-usb {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 8px;
  height: 30px;
  background: #C0C0C0;
  border-radius: 2px;
}

.pi-ethernet {
  position: absolute;
  top: 55px;
  right: 20px;
  width: 40px;
  height: 16px;
  background: #C0C0C0;
  border-radius: 2px;
}

.pi-gpio {
  grid-column: 1;
  grid-row: 1 / 3;
  background: #C0C0C0;
  border-radius: 2px;
}

.pi-hdmi {
  position: absolute;
  bottom: 20px;
  left: 20px;
  width: 24px;
  height: 10px;
  background: #C0C0C0;
  border-radius: 1px;
}

.pi-power {
  position: absolute;
  bottom: 20px;
  right: 40px;
  width: 12px;
  height: 12px;
  background: #1a1a1a;
  border-radius: 50%;
}

.pi-sdcard {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 20px;
  height: 12px;
  background: #C0C0C0;
  border-radius: 1px;
}

.pi-led {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #333;
}

.pi-led.power-led {
  bottom: 8px;
  right: 20px;
}

.pi-led.act-led {
  bottom: 8px;
  right: 30px;
}

.pi-led.on {
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.pi-label {
  margin-top: 12px;
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  color: white;
}

.hero-content h2 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 800;
}

.hero-content p {
  margin: 0;
  opacity: .9;
  font-size: 14px;
}

.harvest-widget {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.harvest-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.harvest-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 800;
}

.harvest-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), #059669);
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 20px;
}

.harvest-score {
  font-size: 48px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #059669);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.harvest-label {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Metrics Grid ──────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.metric-card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: all .3s cubic-bezier(.2, 0, 0, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #059669);
  opacity: .8;
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(16, 185, 129, 0.3);
}

.metric-target {
  min-height: 18px;
}

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

.metric-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.1));
  color: var(--accent);
}

.metric-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}
.metric-trend.up { background: rgba(16, 185, 129, 0.15); color: var(--ok); }
.metric-trend.down { background: rgba(239, 68, 68, 0.15); color: var(--bad); }

.metric-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 4px;
}

.metric-unit {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
}

.metric-chart {
  margin-top: 12px;
  height: 60px;
  position: relative;
}

.metric-chart canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── Charts Section ────────────────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

.chart-panel {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.chart-title {
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

canvas {
  width: 100%;
  max-width: 100%;
  display: block;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 220px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,255,255,0.95));
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-right: 1px solid rgba(255, 255, 255, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 12px;
  gap: 8px;
  z-index: 90;
  box-shadow: 4px 0 30px rgba(0, 0, 0, 0.08);
}

.sidebar-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--muted);
  cursor: pointer;
  transition: all .2s;
  position: relative;
}

.sidebar-icon:hover {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent);
  transform: scale(1.05);
}

.sidebar-icon.active {
  background: linear-gradient(135deg, var(--accent), #059669);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* ── Sidebar Extended Styles ───────────────────────────── */
.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--ink);
  position: relative;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  margin-top: 4px;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
  animation: pulse-dot 2s ease infinite;
}

.connection-dot.warn {
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.connection-dot.error {
  background: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.brand-text {
  font-weight: 800;
  font-size: 12px;
  text-align: center;
  line-height: 1.2;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  flex: 1;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 10px 4px;
  border-radius: 12px;
  color: var(--muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  transition: all 200ms;
}

.nav-item:hover {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent);
}

.nav-item.active {
  background: linear-gradient(135deg, var(--accent), #059669);
  color: white;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

/* ── Main Content ───────────────────────────────────────── */
main {
  margin-left: 240px;
  max-width: none;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.view { display: none; }
.view.active-view { display: block; }

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-title {
  height: 20px;
  width: 60%;
  margin-bottom: 12px;
}

.skeleton-card {
  height: 100px;
  margin-bottom: 12px;
}

/* View transitions */
.view {
  animation: fade-in 300ms ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 13px;
  max-width: 320px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 300ms;
}

.loading-overlay.show {
  opacity: 1;
  visibility: visible;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Hero Section ───────────────────────────────────────── */
.hero-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hero-card {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  align-items: stretch;
}

.hero-visual {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  display: grid;
  place-items: center;
}

.hero-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.55), transparent);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  color: white;
}

.hero-content h2 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 800;
}

.hero-content p {
  margin: 0;
  opacity: .9;
  font-size: 13px;
}

/* ── Quick Stats ────────────────────────────────────────── */
.quick-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 300ms cubic-bezier(.2, 0, 0, 1);
  animation: fade-in-up 500ms cubic-bezier(.2, 0, 0, 1) both;
}

.stat-card:nth-child(1) { animation-delay: 0ms; }
.stat-card:nth-child(2) { animation-delay: 60ms; }
.stat-card:nth-child(3) { animation-delay: 120ms; }
.stat-card:nth-child(4) { animation-delay: 180ms; }

.stat-card:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: var(--shadow-lg);
  border-color: rgba(16, 185, 129, 0.35);
}

.spark-canvas {
  width: 80px;
  height: 32px;
  margin-left: auto;
  flex-shrink: 0;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.1));
  color: var(--accent);
  flex-shrink: 0;
}

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.stat-freshness {
  font-size: 10px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 2px;
  opacity: 0.8;
}

/* ── Section Titles ─────────────────────────────────────── */
.section-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin: 0 0 4px;
}

/* ── Charts Section ─────────────────────────────────────── */
.charts-section {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 200ms;
}

.chip.active {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent);
  border-color: rgba(16, 185, 129, 0.4);
}

/* ── Grid Section (Controls + Alerts) ──────────────────── */
.grid-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.panel {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: all 300ms;
}

.panel:hover {
  box-shadow: var(--shadow-lg);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

/* ── Growth Panel ───────────────────────────────────────── */
.growth-panel {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.growth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.growth-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.growth-stat {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  transition: all 300ms;
}

.growth-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
}

.growth-stat-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
}

.growth-stat-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 2px;
}

/* ── Footer ─────────────────────────────────────────────── */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
  margin-top: 8px;
}

/* ── Controls Section ───────────────────────────────────── */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.control-card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: all .3s;
}

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

.control-info h4 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
}

.control-info p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.toggle {
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  position: relative;
  cursor: pointer;
  transition: all .3s;
  flex-shrink: 0;
}

.toggle::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: all .3s cubic-bezier(.2, 0, 0, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

.toggle.on {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle.on::after {
  left: 26px;
}

/* ── Alerts ────────────────────────────────────────────── */
.alerts-list {
  display: grid;
  gap: 12px;
}

.alert-item {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: var(--shadow);
  transition: all .2s;
}

.alert-item:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-lg);
}

.alert-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

.alert-dot.critical { background: var(--bad); box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2); }
.alert-dot.warning { background: var(--warn); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.2); }
.alert-dot.info { background: var(--accent); box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2); }

.alert-content { flex: 1; }
.alert-title { font-weight: 700; margin-bottom: 4px; }
.alert-time { font-size: 11px; color: var(--muted); }

/* ── Growth Section ────────────────────────────────────── */
.growth-panel {
  background: var(--surface);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.growth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.growth-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.growth-stat {
  text-align: center;
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.growth-stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
}

.growth-stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Footer ────────────────────────────────────────────── */
.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  color: var(--muted);
  font-size: 12px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ── Animations ────────────────────────────────────────── */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
}

.metric-card, .chart-panel, .control-card, .alert-item {
  animation: fade-in-up 500ms cubic-bezier(.2, 0, 0, 1) both;
}

.metric-card:nth-child(1) { animation-delay: 0ms; }
.metric-card:nth-child(2) { animation-delay: 50ms; }
.metric-card:nth-child(3) { animation-delay: 100ms; }
.metric-card:nth-child(4) { animation-delay: 150ms; }
.metric-card:nth-child(5) { animation-delay: 200ms; }
.metric-card:nth-child(6) { animation-delay: 250ms; }

/* Theme toggle */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 300ms;
  backdrop-filter: blur(10px);
}

.theme-toggle:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.05);
}

/* Dark mode */
[data-theme="dark"] {
  --bg: #0f172a;
  --bg-2: #1e293b;
  --surface: rgba(30, 41, 59, 0.85);
  --surface-2: rgba(30, 41, 59, 0.95);
  --line: rgba(148, 163, 184, 0.2);
  --ink: #f1f5f9;
  --muted: #94a3b8;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] body {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  background-attachment: fixed;
}

[data-theme="dark"] .topbar {
  background: rgba(30, 41, 59, 0.95);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.98), rgba(30, 41, 59, 0.95));
  border-right: 1px solid rgba(148, 163, 184, 0.2);
}

[data-theme="dark"] .hero {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(30, 41, 59, 0.85));
  border: 1px solid rgba(148, 163, 184, 0.2);
}

[data-theme="dark"] .metric-card,
[data-theme="dark"] .chart-panel,
[data-theme="dark"] .control-card,
[data-theme="dark"] .alert-item,
[data-theme="dark"] .harvest-widget,
[data-theme="dark"] .growth-panel {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(30, 41, 59, 0.85));
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .metric-value {
  background: linear-gradient(135deg, #f1f5f9, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Dark mode extended text/background fixes */
[data-theme="dark"] body {
  color: var(--ink);
}

[data-theme="dark"] .hero-content h2,
[data-theme="dark"] .hero-content p,
[data-theme="dark"] .harvest-label,
[data-theme="dark"] .stat-value,
[data-theme="dark"] .stat-label,
[data-theme="dark"] .section-title,
[data-theme="dark"] .chart-title,
[data-theme="dark"] .panel-head h3,
[data-theme="dark"] .control-info h4,
[data-theme="dark"] .control-info p,
[data-theme="dark"] .alert-title,
[data-theme="dark"] .alert-time,
[data-theme="dark"] .growth-stat-value,
[data-theme="dark"] .growth-stat-label,
[data-theme="dark"] .footer,
[data-theme="dark"] .settings-label,
[data-theme="dark"] .settings-value,
[data-theme="dark"] .settings-group-title,
[data-theme="dark"] .brand,
[data-theme="dark"] .brand-text,
[data-theme="dark"] .nav-item,
[data-theme="dark"] .sidebar-brand,
[data-theme="dark"] .harvest-status,
[data-theme="dark"] .metric-unit,
[data-theme="dark"] .metric-target,
[data-theme="dark"] .alert-message,
[data-theme="dark"] .control-card h4,
[data-theme="dark"] .growth-panel h3,
[data-theme="dark"] .chart-legend,
[data-theme="dark"] .toast,
[data-theme="dark"] .settings-description,
[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .badge-warning,
[data-theme="dark"] .badge-success,
[data-theme="dark"] .badge-danger,
[data-theme="dark"] .badge-info,
[data-theme="dark"] .harvest-title,
[data-theme="dark"] .harvest-score,
[data-theme="dark"] .settings-title,
[data-theme="dark"] .settings-header,
[data-theme="dark"] .pi-label,
[data-theme="dark"] .pi-cpu,
[data-theme="dark"] .pi-ram,
[data-theme="dark"] .pi-sdcard,
[data-theme="dark"] .pi-ethernet,
[data-theme="dark"] .pi-hdmi,
[data-theme="dark"] .pi-usb,
[data-theme="dark"] .pi-gpio,
[data-theme="dark"] .pi-power,
[data-theme="dark"] .live-indicator,
[data-theme="dark"] .settings-close,
[data-theme="dark"] .topbar-actions,
[data-theme="dark"] .stat-freshness,
[data-theme="dark"] .alert-item {
  color: var(--ink);
}

[data-theme="dark"] .muted,
[data-theme="dark"] .stat-label,
[data-theme="dark"] .section-title,
[data-theme="dark"] .settings-group-title,
[data-theme="dark"] .alert-time,
[data-theme="dark"] .growth-stat-label {
  color: var(--muted);
}

[data-theme="dark"] .hero-content p {
  color: rgba(241, 245, 249, 0.85);
}

[data-theme="dark"] .stat-icon {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(5, 150, 105, 0.15));
  color: var(--accent);
}

[data-theme="dark"] .chip {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--muted);
}

[data-theme="dark"] .chip.active {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent);
  border-color: rgba(16, 185, 129, 0.5);
}

[data-theme="dark"] select {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}

[data-theme="dark"] .theme-toggle {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}

[data-theme="dark"] .theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

[data-theme="dark"] .sidebar-icon {
  color: var(--muted);
}

[data-theme="dark"] .sidebar-icon:hover {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent);
}

[data-theme="dark"] .nav-item {
  color: var(--muted);
}

[data-theme="dark"] .nav-item:hover {
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent);
}

[data-theme="dark"] .nav-item.active {
  color: white;
}

[data-theme="dark"] .hero-visual {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

[data-theme="dark"] .hero-overlay {
  background: linear-gradient(to top, rgba(15, 23, 42, 0.7), transparent);
}

[data-theme="dark"] .harvest-score {
  background: linear-gradient(135deg, #10b981, #059669);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 4px rgba(16, 185, 129, 0.3));
}

[data-theme="dark"] .toggle {
  background: var(--bg-2);
  border-color: var(--line);
}

[data-theme="dark"] .toggle::after {
  background: #e2e8f0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .settings-toggle {
  background: var(--bg-2);
  border-color: var(--line);
}

[data-theme="dark"] .settings-toggle::after {
  background: #e2e8f0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .sensor-stats,
[data-theme="dark"] #sensor-stats {
  color: var(--muted);
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 1024px) {
  .hero { grid-template-columns: 1fr; }
  .hero-card { grid-template-columns: 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .charts-section { grid-template-columns: 1fr; }
  .grid-section { grid-template-columns: 1fr; }
  .quick-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  main { 
    padding: 16px; 
    margin-left: 0;
    padding-bottom: 80px;
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }
  .metrics-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .hero-content h2 { font-size: 20px; }
  .harvest-score { font-size: 32px; }
  .quick-stats { grid-template-columns: 1fr; }
  .chart-panel { padding: 12px; }
  .metric-card { padding: 12px; }
  canvas { max-width: 100%; height: auto !important; }
  .stat-card { padding: 12px; }
  .panel { padding: 12px; }
  .settings-panel { width: 100%; right: -100%; }
}

@media (max-width: 480px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .hero-content h2 { font-size: 18px; }
  .harvest-score { font-size: 28px; }
  .quick-stats { grid-template-columns: 1fr; }
  .stat-value { font-size: 20px; }
  .metric-value { font-size: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Mobile bottom navigation */
.mobile-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  z-index: 90;
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.mobile-nav-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 3px 3px;
  transition: width 0.25s ease;
}

.mobile-nav-item.active,
.mobile-nav-item:hover {
  color: var(--accent);
}

.mobile-nav-item.active::before {
  width: 24px;
}

.mobile-nav-item:active {
  transform: scale(0.95);
  transition: transform 0.1s ease;
}

.mobile-nav-item svg {
  width: 22px;
  height: 22px;
  transition: transform 0.2s ease;
}

.mobile-nav-item.active svg {
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  .mobile-nav {
    display: flex;
  }
}

/* Pull to refresh */
.pull-indicator {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  background: linear-gradient(180deg, var(--accent), transparent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  z-index: 85;
  transition: height 0.2s ease;
}

.pull-indicator.visible {
  height: 48px;
}

.pull-indicator.refreshing {
  height: 48px;
}

.pull-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Scroll to top button */
.scroll-top {
  position: fixed;
  bottom: 80px;
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(12px);
  color: var(--accent);
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.scroll-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: translateY(-2px);
}

.scroll-top:active {
  transform: scale(0.95);
}

@media (max-width: 768px) {
  .scroll-top {
    bottom: calc(80px + env(safe-area-inset-bottom, 0px) + 8px);
  }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.4); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* Settings Panel */
.settings-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100vh;
  background: var(--surface);
  backdrop-filter: blur(20px);
  border-left: 1px solid var(--line);
  padding: 24px;
  overflow-y: auto;
  transition: right 300ms cubic-bezier(.2, 0, 0, 1);
  z-index: 200;
  box-shadow: var(--shadow-lg);
}
.settings-panel.open {
  right: 0;
}
.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.settings-title {
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}
.settings-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 18px;
  transition: all .2s;
}
.settings-close:hover {
  background: var(--bad);
  color: white;
  border-color: var(--bad);
}
.settings-group {
  margin-bottom: 24px;
}
.settings-group-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin-bottom: 12px;
}
.settings-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.settings-item:last-child {
  border-bottom: none;
}
.settings-label {
  font-size: 14px;
  font-weight: 600;
}
.settings-value {
  font-size: 13px;
  color: var(--muted);
}
.settings-toggle {
  width: 48px;
  height: 26px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  position: relative;
  cursor: pointer;
  transition: all .3s;
  flex-shrink: 0;
}
.settings-toggle::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: all .3s cubic-bezier(.2, 0, 0, 1);
  box-shadow: 0 2px 4px rgba(0,0,0,.1);
}
.settings-toggle.on {
  background: var(--accent);
  border-color: var(--accent);
}
.settings-toggle.on::after {
  left: 24px;
}
.settings-btn {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  margin-top: 8px;
}
.settings-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(145, 246, 12, .08);
}

/* Overlay */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .3);
  opacity: 0;
  visibility: hidden;
  transition: all 300ms;
  z-index: 150;
}
.settings-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Offline indicator */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--warn);
  color: var(--accent-ink);
  padding: 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  z-index: 300;
  transform: translateY(-100%);
  transition: transform 300ms;
}
.offline-banner.show {
  transform: translateY(0);
}

/* Data table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.data-table th {
  font-weight: 700;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.data-table tr:hover {
  background: var(--surface-2);
}
.data-table .severity-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.severity-critical { background: rgba(239, 68, 68, .15); color: var(--bad); }
.severity-warning { background: rgba(245, 158, 11, .15); color: var(--warn); }
.severity-info { background: rgba(16, 185, 129, .15); color: var(--ok); }

/* ── Premium Animations ──────────────────────────────────── */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-6px); }
}

@keyframes glow-pulse {
  0%, 100% { 
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3),
                0 0 40px rgba(16, 185, 129, 0.1);
  }
  50% { 
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.5),
                0 0 60px rgba(16, 185, 129, 0.2);
  }
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes border-glow {
  0%, 100% { border-color: rgba(16, 185, 129, 0.3); }
  50% { border-color: rgba(16, 185, 129, 0.6); }
}

@keyframes slide-in-right {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Enhanced body background */
body {
  background: linear-gradient(135deg, #f0f4f8 0%, #e8eef6 50%, #f0f4f8 100%);
  background-attachment: fixed;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: 
    radial-gradient(circle at 15% 85%, rgba(16, 185, 129, 0.10) 0%, transparent 45%),
    radial-gradient(circle at 85% 15%, rgba(102, 126, 234, 0.10) 0%, transparent 45%);
  pointer-events: none;
  z-index: 0;
}

/* Enhanced topbar */
.topbar {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 
    0 4px 30px rgba(0, 0, 0, 0.1),
    0 1px 3px rgba(0, 0, 0, 0.08);
  animation: slide-in-right 600ms cubic-bezier(.2, 0, 0, 1) both;
}

.brand-icon {
  animation: glow-pulse 3s ease-in-out infinite;
}

/* Enhanced hero */
.hero {
  background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(255,255,255,0.9));
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  animation: scale-in 700ms cubic-bezier(.2, 0, 0, 1) both;
}

.hero-visual {
  position: relative;
  overflow: hidden;
}

.hero-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(102, 126, 234, 0.15));
}

/* Enhanced harvest widget */
.harvest-widget {
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.85));
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 
    0 10px 40px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.3) inset;
  transition: all 400ms cubic-bezier(.2, 0, 0, 1);
}

.harvest-widget:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(16, 185, 129, 0.4) inset;
}

.harvest-score {
  background: linear-gradient(135deg, #10b981, #059669);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 4px rgba(16, 185, 129, 0.3));
}

/* Enhanced metric cards */
.metric-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.85));
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  animation: fade-in-up 600ms cubic-bezier(.2, 0, 0, 1) both;
  transition: all 400ms cubic-bezier(.2, 0, 0, 1);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #059669);
  opacity: 0.9;
}

.metric-card::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 400ms;
  pointer-events: none;
}

.metric-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(16, 185, 129, 0.3) inset,
    0 0 30px rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.4);
}

.metric-card:hover::after {
  opacity: 1;
}

.metric-card:nth-child(1) { animation-delay: 0ms; }
.metric-card:nth-child(2) { animation-delay: 80ms; }
.metric-card:nth-child(3) { animation-delay: 160ms; }
.metric-card:nth-child(4) { animation-delay: 240ms; }
.metric-card:nth-child(5) { animation-delay: 320ms; }
.metric-card:nth-child(6) { animation-delay: 400ms; }
.metric-card:nth-child(7) { animation-delay: 480ms; }

/* Enhanced metric value */
.metric-value {
  background: linear-gradient(135deg, var(--ink), #334155);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Enhanced chart panels */
.chart-panel {
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.88));
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  animation: scale-in 800ms cubic-bezier(.2, 0, 0, 1) both;
  animation-delay: 200ms;
  transition: all 400ms cubic-bezier(.2, 0, 0, 1);
}

.chart-panel:hover {
  transform: translateY(-4px);
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(16, 185, 129, 0.3) inset;
  border-color: rgba(16, 185, 129, 0.3);
}

/* Enhanced sidebar */
.sidebar {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,255,255,0.95));
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  border-right: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 
    4px 0 30px rgba(0, 0, 0, 0.08),
    1px 0 3px rgba(0, 0, 0, 0.05);
}

.sidebar-icon {
  transition: all 300ms cubic-bezier(.2, 0, 0, 1);
  position: relative;
}

.sidebar-icon::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #059669);
  opacity: 0;
  transition: opacity 300ms;
  z-index: -1;
}

.sidebar-icon:hover {
  transform: scale(1.1) translateX(4px);
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent);
}

.sidebar-icon.active {
  background: linear-gradient(135deg, var(--accent), #059669);
  color: white;
  box-shadow: 
    0 4px 15px rgba(16, 185, 129, 0.4),
    0 0 0 2px rgba(16, 185, 129, 0.2);
  animation: glow-pulse 2s ease-in-out infinite;
}

/* Enhanced control cards */
.control-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.88));
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
  animation: slide-in-right 500ms cubic-bezier(.2, 0, 0, 1) both;
  transition: all 300ms cubic-bezier(.2, 0, 0, 1);
}

.control-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 
    0 15px 40px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(16, 185, 129, 0.3) inset;
}

/* Enhanced toggle */
.toggle {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 300ms cubic-bezier(.2, 0, 0, 1);
}

.toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toggle.on {
  box-shadow: 0 2px 12px rgba(16, 185, 129, 0.4);
}

/* Enhanced alert items */
.alert-item {
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.9));
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
  animation: slide-in-right 400ms cubic-bezier(.2, 0, 0, 1) both;
  transition: all 300ms cubic-bezier(.2, 0, 0, 1);
}

.alert-item:hover {
  transform: translateX(6px) scale(1.01);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}

/* Enhanced growth panel */
.growth-panel {
  background: linear-gradient(135deg, rgba(255,255,255,0.95), rgba(255,255,255,0.88));
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset;
  animation: scale-in 800ms cubic-bezier(.2, 0, 0, 1) both;
  animation-delay: 300ms;
}

.growth-stat {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
  border: 1px solid rgba(16, 185, 129, 0.2);
  transition: all 300ms;
}

.growth-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
}

/* Enhanced settings panel */
.settings-panel {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(255,255,255,0.95));
  backdrop-filter: blur(30px) saturate(180%);
  border-left: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 
    -10px 0 40px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.3) inset;
}

.settings-btn {
  position: relative;
  overflow: hidden;
  transition: all 300ms cubic-bezier(.2, 0, 0, 1);
}

.settings-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
  opacity: 0;
  transition: opacity 300ms;
}

.settings-btn:hover::before {
  opacity: 1;
}

.settings-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.2);
}

/* Enhanced badges */
.badge {
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 300ms;
}

.badge:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Live indicator */
.live-indicator {
  animation: pulse-glow 2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
}

/* Ripple effect */
.metric-card:active, .control-card:active, .chart-panel:active {
  transform: scale(0.98);
}

/* Focus styles for accessibility */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
[role="switch"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nav-item:focus-visible,
.mobile-nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Custom scrollbar for settings */
.settings-panel::-webkit-scrollbar {
  width: 6px;
}

.settings-panel::-webkit-scrollbar-track {
  background: transparent;
}

.settings-panel::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 3px;
}

.settings-panel::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Loading shimmer for cards */
.metric-card.loading {
  background: linear-gradient(90deg, 
    rgba(255,255,255,0.9) 25%, 
    rgba(255,255,255,0.6) 50%, 
    rgba(255,255,255,0.9) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

/* Responsive enhancements */
@media (max-width: 768px) {
  .hero {
    padding: 20px;
    gap: 16px;
  }
  
  .harvest-score {
    font-size: 36px;
  }
  
  .metric-value {
    font-size: 24px;
  }
  
  .metric-card {
    padding: 16px;
  }
  
  .chart-panel {
    padding: 16px;
  }
}

/* Print styles */
@media print {
  .sidebar, .topbar, .settings-panel, .settings-overlay {
    display: none !important;
  }
  
  main {
    margin-left: 0 !important;
  }
  
  .metric-card, .chart-panel, .control-card, .alert-item {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }
}
