/* ===========================================================================
   FarmTwin — tema "Cultiva"
   Dark olive + lime, kartu besar rounded, angka tebal, aksen berbeda per kartu.
   Dimuat setelah styles.css; lapisan ini yang menentukan tampilan akhir.
   =========================================================================== */

/* ── Token ─────────────────────────────────────────────────────────────── */
:root,
body[data-theme="light"],
body[data-theme="dark"] {
  --bg: #0a0c09;
  --bg-2: #0e110d;
  --surface: #141712;
  --surface-2: #1a1e18;
  --surface-3: #22271f;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.14);
  --ink: #eef3e7;
  --muted: #8b9384;
  --accent: #cdf25a;
  --accent-soft: rgba(205, 242, 90, 0.14);
  --accent-ink: #10140c;
  --ok: #a8e063;
  --warn: #f3c969;
  --bad: #f07a6a;
  --sky: #7fc8e8;
  --violet: #b9a5f5;
  --shadow: 0 24px 48px -32px rgba(0, 0, 0, 0.95);
  --shadow-lg: 0 32px 64px -28px rgba(0, 0, 0, 0.9);
  --radius: 26px;
  --radius-sm: 18px;
  --radius-xs: 12px;
  --tint: var(--accent);
}

/* ── Dasar ─────────────────────────────────────────────────────────────── */
html { background: var(--bg); }

body {
  font-family: "Plus Jakarta Sans", "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 480px at 12% -8%, rgba(205, 242, 90, 0.10), transparent 62%),
    radial-gradient(760px 420px at 92% 4%, rgba(127, 200, 232, 0.07), transparent 60%),
    radial-gradient(680px 520px at 60% 110%, rgba(185, 165, 245, 0.06), transparent 65%);
  background-attachment: fixed;
  letter-spacing: -0.01em;
}

::selection { background: var(--accent); color: var(--accent-ink); }

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(205, 242, 90, 0.4); background-clip: content-box; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Sembunyikan toggle tema lama: aplikasi kini bertema gelap tunggal. */
#theme-toggle { display: none !important; }

/* ── Topbar ────────────────────────────────────────────────────────────── */
.topbar {
  background: rgba(10, 12, 9, 0.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
  padding: 14px 26px;
}
.brand { color: var(--ink); font-weight: 700; letter-spacing: -0.02em; }
.brand .brand-icon {
  background: linear-gradient(150deg, var(--accent), #8fd14f);
  color: var(--accent-ink);
  border-radius: 12px;
  box-shadow: 0 8px 20px -10px rgba(205, 242, 90, 0.8);
}
.brand-icon { background: linear-gradient(150deg, var(--accent), #8fd14f); color: var(--accent-ink); }

.topbar-actions select,
select {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 38px;
  padding: 8px 14px;
  font-size: 12.5px;
  font-weight: 600;
  backdrop-filter: none;
}
select:hover { border-color: rgba(205, 242, 90, 0.5); }
select option { background: var(--surface-2); color: var(--ink); }

.badge {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  padding: 7px 13px;
  backdrop-filter: none;
  letter-spacing: 0.01em;
}
.badge--muted { background: rgba(255, 255, 255, 0.04); color: var(--muted); }
.badge--ok { background: var(--accent-soft); border-color: rgba(205, 242, 90, 0.3); color: var(--accent); }
.badge--warn { background: rgba(243, 201, 105, 0.14); border-color: rgba(243, 201, 105, 0.3); color: var(--warn); }
.badge--bad { background: rgba(240, 122, 106, 0.14); border-color: rgba(240, 122, 106, 0.32); color: var(--bad); }
.badge::before { opacity: 1; }

.live-indicator { color: var(--accent); font-weight: 700; font-size: 12px; }
.live-indicator::after { content: ""; }

/* ── Sidebar ───────────────────────────────────────────────────────────── */
.sidebar {
  background: rgba(20, 23, 18, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  margin: 18px 0 18px 18px;
  padding: 18px 14px;
}
.sidebar-brand { padding: 4px 6px 18px; border-bottom: 1px solid var(--line); }
.brand-text { color: var(--ink); font-weight: 800; letter-spacing: -0.03em; }
.connection-dot { box-shadow: 0 0 0 4px rgba(205, 242, 90, 0.10); }

.sidebar-nav { gap: 6px; }

.nav-item {
  border-radius: 16px;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  padding: 11px 12px;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}
.nav-item svg { stroke-width: 1.9; }
.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  transform: translateX(2px);
}
.nav-item.active {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 12px 28px -16px rgba(205, 242, 90, 0.9);
}
.nav-item.active svg { stroke: var(--accent-ink); }
.sidebar-footer { border-top: 1px solid var(--line); padding-top: 12px; }

/* ── Layout & view ─────────────────────────────────────────────────────── */
main {
  max-width: 1440px;
  padding: 24px 26px 32px;
  gap: 22px;
}

.view { display: none; }
.view.active-view { display: grid; gap: 22px; animation: rise 420ms cubic-bezier(.2, .7, .2, 1) both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* Label kecil di atas blok — memecah kebosanan layout */
.eyebrow,
.quick-access-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Hero (Harvest AI + board) ─────────────────────────────────────────── */
.hero-card {
  background:
    radial-gradient(520px 260px at 88% 10%, rgba(205, 242, 90, 0.12), transparent 65%),
    linear-gradient(160deg, #171b14 0%, #10130e 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}
.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 40%);
}

.hero-visual { min-height: 250px; }
.hero-overlay {
  background: linear-gradient(90deg, rgba(10, 12, 9, 0.9) 8%, rgba(10, 12, 9, 0.15) 70%);
}
.hero-content h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
}
.hero-content p { color: var(--muted); font-size: 13px; margin: 0; max-width: 38ch; }

/* Ilustrasi papan Pi: dibuat lebih kontras & neon */
.pi-board {
  background: linear-gradient(150deg, #1f2a17, #0f1a0c);
  border: 1px solid rgba(205, 242, 90, 0.28);
  box-shadow: inset 0 0 40px rgba(205, 242, 90, 0.08), 0 30px 60px -30px #000;
  filter: saturate(1.05);
}
.pi-board-inner {
  background: linear-gradient(160deg, #23301a, #131a10);
  border-radius: 10px;
  border: 1px solid rgba(205, 242, 90, 0.16);
}
.pi-cpu {
  background: linear-gradient(140deg, #39432c, #1d2318);
  border: 1px solid rgba(205, 242, 90, 0.22);
  box-shadow: inset 0 0 12px rgba(205, 242, 90, 0.12);
}
.pi-ram, .pi-hdmi, .pi-ethernet, .pi-usb, .pi-sdcard, .pi-power {
  background: #2a3123;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.pi-gpio {
  background: repeating-linear-gradient(90deg, #3a4a2a 0 3px, #1a2015 3px 6px);
  border-radius: 4px;
}
.pi-label {
  color: var(--accent);
  background: rgba(10, 12, 9, 0.7);
  border: 1px solid rgba(205, 242, 90, 0.3);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
}
.pi-led.on { background: var(--accent); box-shadow: 0 0 12px var(--accent); }

/* Kartu skor AI */
.harvest-widget {
  background: linear-gradient(165deg, #1b2017, #12160f);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.harvest-header { border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.harvest-title { color: var(--muted); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 800; }
.harvest-icon {
  background: var(--accent-soft);
  border: 1px solid rgba(205, 242, 90, 0.25);
  border-radius: 12px;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  font-size: 18px;
}
.harvest-score {
  font-size: clamp(56px, 7vw, 76px);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
  color: var(--ink);
  background: linear-gradient(180deg, #f4fade, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.harvest-label { color: var(--muted); font-size: 13px; margin-top: 8px; font-weight: 600; }

/* ── Quick access (baris ikon ala aplikasi) ────────────────────────────── */
.quick-access {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.quick-access-label { margin-bottom: -6px; }
.qa-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}
.qa-item:hover {
  transform: translateY(-2px);
  border-color: rgba(205, 242, 90, 0.32);
  background: var(--surface-2);
}
.qa-icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  font-size: 17px;
  background: color-mix(in srgb, var(--tint) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--tint) 30%, transparent);
}
.qa-item:nth-child(2) { --tint: var(--sky); }
.qa-item:nth-child(3) { --tint: var(--warn); }
.qa-item:nth-child(4) { --tint: var(--violet); }
.qa-item:nth-child(5) { --tint: var(--bad); }
.qa-item:nth-child(6) { --tint: var(--ok); }

/* ── Quick stats (4 kartu metrik utama) ────────────────────────────────── */
.quick-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 14px; }

.stat-card {
  --tint: var(--accent);
  position: relative;
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 200ms ease, border-color 200ms ease;
}
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--tint), transparent 70%);
  opacity: 0.75;
}
.stat-card:nth-child(1) { --tint: var(--accent); }
.stat-card:nth-child(2) { --tint: var(--sky); }
.stat-card:nth-child(3) { --tint: var(--warn); }
.stat-card:nth-child(4) { --tint: var(--violet); }
.stat-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--tint) 35%, transparent); }

.stat-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.stat-icon {
  width: 34px; height: 34px;
  border-radius: 11px;
  display: grid; place-items: center;
  font-size: 16px;
  background: color-mix(in srgb, var(--tint) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--tint) 28%, transparent);
}
.stat-info { margin-top: 14px; }
.stat-value {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1;
  color: var(--ink);
}
.stat-value + .stat-label { margin-top: 4px; }
.stat-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.stat-freshness {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
  opacity: 0.9;
}
.stat-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(205, 242, 90, 0.24);
}
.stat-delta.down { background: rgba(240, 122, 106, 0.14); color: var(--bad); border-color: rgba(240, 122, 106, 0.28); }

.stat-card .spark-canvas,
.spark-canvas { width: 100%; margin-top: 6px; opacity: 0.9; }

/* Kartu statistik: susun vertikal agar angka besar jadi fokus */
.stat-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}
.stat-card .spark-canvas {
  width: 100%;
  height: 34px;
  margin: 8px 0 0;
}
.stat-card .stat-icon { font-size: 16px; }

/* Judul bagian sebagai eyebrow, bukan judul tebal */
.section-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.hero-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.5;
  filter: saturate(0.85) contrast(1.05) brightness(0.95);
}
.hero-photo.ready { display: block; }
.hero-photo.ready + .pi-board { display: none; }
.hero-photo.ready ~ .hero-overlay {
  background: linear-gradient(90deg, rgba(8, 10, 7, 0.94) 6%, rgba(8, 10, 7, 0.45) 62%, rgba(8, 10, 7, 0.2));
}

.hero-visual {
  background:
    radial-gradient(420px 240px at 50% 15%, rgba(205, 242, 90, 0.16), transparent 70%),
    linear-gradient(160deg, #151b12, #0b0e09);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: relative;
}
.hero-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image:
    linear-gradient(rgba(205, 242, 90, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(205, 242, 90, 0.07) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at 50% 45%, #000 35%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 45%, #000 35%, transparent 78%);
  pointer-events: none;
}
.pi-board {
  filter: drop-shadow(0 18px 40px rgba(205, 242, 90, 0.16));
  transform: scale(1.08);
}
.pi-board .pi-label {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

/* ── Panel umum ────────────────────────────────────────────────────────── */
.panel,
.chart-panel,
.growth-panel {
  background: linear-gradient(170deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  transition: border-color 200ms ease;
}
.panel:hover, .chart-panel:hover, .growth-panel:hover { border-color: var(--line-strong); }

.panel-head, .chart-header, .growth-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-title, .chart-title, .section-title {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 9px;
}
.panel-title svg, .chart-title svg { color: var(--accent); }

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

.metric-card {
  --tint: var(--accent);
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: none;
  overflow: hidden;
  transition: transform 200ms ease, background 200ms ease, border-color 200ms ease;
}
.metric-card::before {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  border-radius: 99px;
  background: var(--tint);
  opacity: 0.85;
}
.metric-card[data-metric="ph"] { --tint: var(--accent); }
.metric-card[data-metric="ec"] { --tint: var(--sky); }
.metric-card[data-metric="water_temp"] { --tint: var(--warn); }
.metric-card[data-metric="level_pct"] { --tint: var(--violet); }
.metric-card[data-metric="air_temp"] { --tint: var(--bad); }
.metric-card[data-metric="humidity"] { --tint: #7ad9c3; }
.metric-card[data-metric="light"] { --tint: #e8d56b; }
.metric-card:hover {
  transform: translateY(-2px);
  background: var(--surface-3);
  border-color: color-mix(in srgb, var(--tint) 30%, transparent);
}

.metric-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.metric-icon {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 15px;
  background: color-mix(in srgb, var(--tint) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--tint) 25%, transparent);
}
.metric-trend {
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border: 1px solid var(--line);
}
.metric-trend.up { color: var(--accent); background: var(--accent-soft); border-color: rgba(205, 242, 90, 0.22); }
.metric-trend.down { color: var(--bad); background: rgba(240, 122, 106, 0.13); border-color: rgba(240, 122, 106, 0.24); }

.metric-value {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-top: 12px;
}
.metric-unit { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.metric-chart { margin-top: 10px; height: 44px; }

/* ── Chips ─────────────────────────────────────────────────────────────── */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 180ms ease;
}
.chip:hover { color: var(--ink); border-color: var(--line-strong); }
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 10px 24px -14px rgba(205, 242, 90, 0.9);
}

/* ── Kontrol aktuator ──────────────────────────────────────────────────── */
.controls-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.control-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: border-color 180ms ease, background 180ms ease;
}
.control-card:hover { background: var(--surface-3); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.control-info { display: flex; flex-direction: column; gap: 3px; }
.control-info h4 { margin: 0; font-size: 13px; font-weight: 700; color: var(--ink); }
.control-info p { margin: 0; font-size: 11px; color: var(--muted); font-weight: 600; }
.control-info p span { color: var(--accent); font-weight: 800; }

.toggle {
  width: 46px; height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--line);
  position: relative;
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #d7dccb;
  transition: transform 220ms cubic-bezier(.2, .8, .2, 1), background 220ms ease;
}
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle.on::after { transform: translateX(20px); background: var(--accent-ink); }

/* ── Alert list ────────────────────────────────────────────────────────── */
.alerts-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 12px 14px;
  transition: background 180ms ease, transform 180ms ease;
}
.alert-item:hover { background: var(--surface-3); transform: translateX(2px); }
.alert-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex: 0 0 auto;
  background: var(--muted);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.04);
}
.alert-dot.warning { background: var(--warn); box-shadow: 0 0 0 4px rgba(243, 201, 105, 0.14); }
.alert-dot.critical { background: var(--bad); box-shadow: 0 0 0 4px rgba(240, 122, 106, 0.16); }
.alert-dot.info { background: var(--sky); box-shadow: 0 0 0 4px rgba(127, 200, 232, 0.14); }
.alert-title { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.45; }
.alert-time { font-size: 11px; color: var(--muted); margin-top: 3px; }
.alert-list { max-height: 220px; }

/* ── Kamera & tombol ───────────────────────────────────────────────────── */
.cam-preview {
  position: relative;
  min-height: 210px;
  border-radius: var(--radius-sm);
  background:
    radial-gradient(320px 180px at 50% 0%, rgba(205, 242, 90, 0.10), transparent 70%),
    var(--bg-2);
  border: 1px dashed rgba(255, 255, 255, 0.14);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
}
.cam-preview::after {
  content: "● REC";
  position: absolute;
  top: 12px; left: 14px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--bad);
  opacity: 0.75;
}
#cam-stream { max-height: 320px; }

.settings-btn, .btn {
  background: var(--surface-3);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 14px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 180ms ease;
}
.settings-btn:hover, .btn:hover { border-color: rgba(205, 242, 90, 0.4); background: var(--surface-2); transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: #d8fb70; }

/* ── Grafik ────────────────────────────────────────────────────────────── */
canvas { max-width: 100%; }
#sensor-chart, #growth-chart { margin-top: 6px; }
.growth-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.growth-stat {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 14px;
}
.growth-stat-value { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }
.growth-stat-label { font-size: 11px; color: var(--muted); font-weight: 700; margin-top: 2px; }

/* ── Penampil 3D ───────────────────────────────────────────────────────── */
.viewer3d {
  position: relative;
  height: 380px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background:
    radial-gradient(420px 240px at 50% 0%, rgba(205, 242, 90, 0.08), transparent 70%),
    #0d110c;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.viewer3d canvas { display: block; width: 100% !important; height: 100% !important; }
.viewer-hint {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  margin: 0;
  padding: 16px;
}

@media (max-width: 820px) {
  .viewer3d { height: 300px; }
}

/* ── Footer ────────────────────────────────────────────────────────────── */
.footer {
  background: transparent;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11.5px;
  padding: 18px 26px 26px;
}
.footer strong { color: var(--accent) !important; }

/* ── Toast & overlay ───────────────────────────────────────────────────── */
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 10px; z-index: 400; }
.toast {
  background: rgba(26, 30, 24, 0.96);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  color: var(--ink);
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  font-weight: 600;
  backdrop-filter: blur(12px);
}
.toast.error { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }

.loading-overlay { background: rgba(8, 10, 7, 0.86); backdrop-filter: blur(6px); }
.loading-spinner {
  border-color: rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
}
.pull-indicator { background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); border-radius: 999px; }
.pull-spinner { border-color: rgba(255, 255, 255, 0.15); border-top-color: var(--accent); }

.scroll-top {
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  color: var(--accent);
  box-shadow: var(--shadow);
  border-radius: 14px;
}
.scroll-top:hover { background: var(--accent); color: var(--accent-ink); }

/* ── Pengaturan (sheet) ────────────────────────────────────────────────── */
.settings-overlay { background: rgba(6, 8, 5, 0.6); backdrop-filter: blur(4px); }
.settings-panel {
  background: linear-gradient(170deg, #171b14, #0e110d);
  border-left: 1px solid var(--line);
  box-shadow: -30px 0 80px -40px #000;
  border-radius: 28px 0 0 28px;
}
.settings-header { border-bottom: 1px solid var(--line); }
.settings-title { font-weight: 800; letter-spacing: -0.01em; }
.settings-title svg { color: var(--accent); }
.settings-close { background: rgba(255, 255, 255, 0.06); color: var(--ink); border-radius: 10px; }
.settings-close:hover { background: rgba(240, 122, 106, 0.2); color: var(--bad); }
.settings-group { background: rgba(255, 255, 255, 0.02); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; }
.settings-group-title { color: var(--muted); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 800; }
.settings-item { border-bottom-color: var(--line); }
.settings-label { color: var(--ink); font-weight: 600; font-size: 13px; }
.settings-value { color: var(--accent); font-weight: 800; }
.settings-toggle { background: rgba(255, 255, 255, 0.12); border: 1px solid var(--line); }
.settings-toggle::after { background: #d7dccb; }
.settings-toggle.on { background: var(--accent); border-color: var(--accent); }
.settings-toggle.on::after { background: var(--accent-ink); }
.settings-panel .settings-btn { width: 100%; margin-top: 8px; text-align: left; }

/* ── Navigasi mobile ───────────────────────────────────────────────────── */
.mobile-nav {
  background: rgba(18, 21, 16, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  left: 12px; right: 12px;
  padding: 8px;
}
.mobile-nav-item {
  color: var(--muted);
  border-radius: 16px;
  font-weight: 700;
  font-size: 10.5px;
  gap: 4px;
}
.mobile-nav-item.active,
.mobile-nav-item:hover { color: var(--accent); background: transparent; }
.mobile-nav-item.active::before { background: var(--accent); }
.mobile-nav-item.active svg { stroke: var(--accent); }

/* ── Skeleton & empty state ────────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  background-size: 200% 100%;
  border-radius: 8px;
  animation: shimmer 1.4s ease-in-out infinite;
}
.skeleton-card { min-height: 132px; border: 1px solid var(--line); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.empty-state { color: var(--muted); }
.empty-state-icon { font-size: 26px; opacity: 0.8; }
.empty-state-title { color: var(--ink); font-weight: 700; }
.empty-state-desc { color: var(--muted); font-size: 12px; }

/* ── Animasi masuk: transform saja, supaya konten tak pernah opacity 0 ── */
.metric-card, .chart-panel, .control-card, .alert-item, .stat-card, .panel, .growth-panel {
  animation: rise-card 420ms cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes rise-card {
  from { transform: translateY(10px); }
  to { transform: none; }
}

/* ── Responsif ─────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .sidebar { margin: 12px 0 12px 12px; }
  main { padding: 18px; }
}

@media (max-width: 820px) {
  html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
  .sidebar { display: none; }
  main,
  .topbar,
  .view,
  .hero-card,
  .quick-stats,
  .quick-access,
  .metrics-grid,
  .controls-grid,
  .panel,
  .chart-panel,
  .growth-panel,
  .harvest-widget,
  .hero-visual { width: 100%; max-width: 100%; }
  .view > *,
  .hero-card > *,
  .quick-stats > *,
  .quick-access > *,
  .metrics-grid > *,
  .controls-grid > *,
  .growth-stats > * { min-width: 0; max-width: 100%; }
  main { padding: 14px 14px 96px; }
  .topbar { padding: 12px 14px; flex-wrap: wrap; row-gap: 10px; }
  .topbar-actions { flex-wrap: wrap; gap: 8px; width: 100%; }
  .topbar-actions .settings-btn { display: none; }
  .topbar select { max-width: 62vw; }
  #conn-badge, .live-indicator { font-size: 10.5px; padding: 6px 10px; }
  #pwa-install { display: none !important; }
  .stat-value { font-size: 32px; }
  .hero-card { grid-template-columns: 1fr; }
  .hero-content h2 { font-size: 20px; }
  .hero-content p { font-size: 12px; max-width: 100%; }
  .hero-visual { aspect-ratio: auto; min-height: 210px; }
  .quick-access { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-access .qa-item { padding: 12px; font-size: 12px; gap: 9px; }
  .qa-icon { width: 32px; height: 32px; font-size: 15px; }
  .growth-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mobile-nav { padding: 6px; left: 8px; right: 8px; }
  .mobile-nav-item {
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 2px;
    font-size: 9px;
    gap: 2px;
  }
  .mobile-nav-item span { font-size: 9px; white-space: nowrap; }
  .mobile-nav-item svg { width: 18px; height: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
