:root {
  --green: #16a34a;
  --green-dark: #166534;
  --green-soft: #dcfce7;
  --bg: #f8fafc;
  --text: #1f2937;
  --muted: #64748b;
  --line: #e5e7eb;
  --white: #ffffff;
  --yellow: #facc15;
  --red: #dc2626;
  --shadow: 0 20px 45px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
code { background: var(--green-soft); color: var(--green-dark); padding: 2px 6px; border-radius: 6px; }

.navbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 6vw;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: var(--green-dark);
  letter-spacing: 0;
}
.brand span {
  background: var(--green);
  color: var(--white);
  padding: 8px 10px;
  border-radius: 8px;
}
.nav-links { display: flex; align-items: center; gap: 24px; color: #334155; font-weight: 600; }
.nav-links a:hover { color: var(--green); }
.nav-toggle { display: none; border: 0; background: var(--green-soft); color: var(--green-dark); border-radius: 8px; padding: 10px 12px; font-size: 20px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 800;
  cursor: pointer;
  transition: 0.2s ease;
}
.btn-primary { background: var(--green); color: var(--white); box-shadow: 0 12px 24px rgba(22, 163, 74, 0.24); }
.btn-primary:hover { background: var(--green-dark); }
.btn-outline { border-color: #bbf7d0; color: var(--green-dark); background: var(--white); }
.btn-light { background: var(--white); color: var(--green-dark); }
.btn-danger { background: var(--red); color: var(--white); }
.btn.full { width: 100%; }
.btn.big { min-height: 54px; font-size: 15px; }

.hero {
  min-height: calc(100vh - 72px);
  display: grid;
  align-items: center;
  padding: 7vw 6vw;
  color: var(--white);
  background:
    linear-gradient(90deg, rgba(20, 83, 45, 0.9), rgba(22, 101, 52, 0.58), rgba(22, 163, 74, 0.25)),
    url("https://images.unsplash.com/photo-1534766555764-ce878a5e3a2b?auto=format&fit=crop&w=1800&q=80") center/cover;
}
.hero-copy { max-width: 760px; }
.eyebrow, .section-kicker { margin: 0 0 12px; color: var(--green); font-weight: 900; text-transform: uppercase; font-size: 12px; letter-spacing: 0.08em; }
.hero .eyebrow { color: #bbf7d0; }
.hero h1 { margin: 0; font-size: clamp(38px, 6vw, 76px); line-height: 1.02; letter-spacing: 0; }
.hero-subtitle { max-width: 620px; margin: 22px 0 0; color: #ecfdf5; font-size: clamp(18px, 2.2vw, 24px); line-height: 1.5; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 34px; }

.section { padding: 76px 6vw; }
.section-muted { background: var(--white); }
.section-heading { max-width: 760px; margin-bottom: 34px; }
.section h1, .section h2 { margin: 0 0 12px; font-size: clamp(30px, 4vw, 46px); line-height: 1.1; letter-spacing: 0; }
.section p { color: var(--muted); line-height: 1.7; }
.feature-grid, .product-grid, .stats-grid, .sensor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.feature-card, .product-card, .stat-card, .panel, .auth-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.feature-card { padding: 24px; }
.feature-card span { color: var(--green); font-weight: 900; }
.feature-card h3 { margin: 12px 0 8px; }
.product-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.product-card { overflow: hidden; }
.product-card img { width: 100%; height: 210px; object-fit: cover; }
.product-content { padding: 18px; }
.product-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 14px; }
.product-price { color: var(--green-dark); font-weight: 900; font-size: 20px; }
.toolbar { display: grid; grid-template-columns: 1fr 220px; gap: 14px; margin-bottom: 24px; }
.input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--white);
  color: var(--text);
}
.two-column { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 50px; align-items: center; }
.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 34px 6vw;
  background: #052e16;
  color: #dcfce7;
}
.footer p { color: #bbf7d0; margin: 8px 0 0; }

.auth-page {
  min-height: 100vh;
  background:
    linear-gradient(rgba(240, 253, 244, 0.88), rgba(248, 250, 252, 0.96)),
    url("https://images.unsplash.com/photo-1510130387422-82bed34b37e9?auto=format&fit=crop&w=1600&q=80") center/cover;
}
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-panel { width: min(440px, 100%); padding: 28px; }
.auth-panel h1 { margin: 30px 0 8px; }
.form { display: grid; gap: 16px; margin-top: 24px; }
.form label, .form-grid label { display: grid; gap: 8px; font-weight: 700; color: #334155; }
.auth-links { display: flex; justify-content: space-between; margin-top: 18px; }
.link-button { border: 0; background: transparent; color: var(--green-dark); font-weight: 800; cursor: pointer; }

.dashboard-body { min-height: 100vh; display: grid; grid-template-columns: 282px 1fr; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  background: #052e16;
  color: #dcfce7;
}
.sidebar .brand { margin-bottom: 26px; color: #dcfce7; }
.side-link {
  width: 100%;
  display: block;
  text-align: left;
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 5px 0;
  background: transparent;
  color: #dcfce7;
  cursor: pointer;
  font-weight: 750;
}
.side-link.active, .side-link:hover { background: rgba(220, 252, 231, 0.14); }
.side-link.danger { color: #fecaca; }
.dashboard-main { padding: 28px; min-width: 0; }
.dashboard-topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 24px; }
.dashboard-topbar h1 { margin: 0; font-size: clamp(26px, 3vw, 38px); }
.dash-view { display: none; }
.dash-view.active { display: block; }
.stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-card { padding: 20px; }
.stat-card span, .stat-card small { display: block; color: var(--muted); }
.stat-card strong { display: block; margin: 10px 0; font-size: 30px; color: var(--green-dark); }
.panel { padding: 22px; margin-bottom: 18px; }
.manual-feed-panel { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: end; }
.manual-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 16px 0; }
.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.button-row.end { justify-content: flex-end; }
.note { padding: 12px; border-left: 4px solid var(--green); background: var(--green-soft); border-radius: 8px; color: var(--green-dark) !important; }
.sensor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sensor-number { display: block; font-size: 48px; color: var(--green-dark); }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 900;
}
.badge.green { background: var(--green-soft); color: var(--green-dark); }
.badge.yellow { background: #fef9c3; color: #854d0e; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.gray { background: #e2e8f0; color: #334155; }
.active-schedule { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.active-schedule span { background: var(--green-soft); color: var(--green-dark); border-radius: 8px; padding: 10px 12px; font-weight: 900; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 620px; }
th, td { padding: 13px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: #475569; background: #f1f5f9; }
.switch-row { align-content: center; grid-template-columns: auto 1fr !important; }
.hidden { display: none !important; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.52);
}
.modal-card { width: min(420px, 100%); background: var(--white); border-radius: 8px; padding: 24px; box-shadow: var(--shadow); }
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: none;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--green-dark);
  color: var(--white);
  box-shadow: var(--shadow);
  font-weight: 800;
}
.toast.show { display: block; }

@media (max-width: 1000px) {
  .feature-grid, .product-grid, .product-grid.compact, .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-body { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .sidebar .brand { grid-column: 1 / -1; }
  .manual-feed-panel, .two-column, .sensor-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .navbar { padding: 0 18px; }
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none;
    position: absolute;
    left: 18px;
    right: 18px;
    top: 72px;
    flex-direction: column;
    align-items: stretch;
    padding: 18px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
  }
  .nav-links.open { display: flex; }
  .section, .hero { padding-left: 20px; padding-right: 20px; }
  .feature-grid, .product-grid, .product-grid.compact, .stats-grid, .form-grid, .toolbar { grid-template-columns: 1fr; }
  .footer, .dashboard-topbar { flex-direction: column; align-items: flex-start; }
  .dashboard-main { padding: 18px; }
  .sidebar { grid-template-columns: 1fr; padding: 16px; }
  .hero { min-height: 760px; align-items: end; }
}
