/* ===========================================================
   FarmAI design system
   =========================================================== */
:root {
  --green-900: #0f3d24;
  --green-700: #1a6b3c;
  --green-600: #22894c;
  --green-500: #2faa5f;
  --green-100: #e3f5ea;
  --leaf: #7ac74f;
  --earth: #8a5a2b;
  --amber: #f4a825;
  --ink: #14231a;
  --muted: #5b6b61;
  --line: #e2ebe5;
  --bg: #f6faf7;
  --card: #ffffff;
  --danger: #d64545;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(15, 61, 36, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 61, 36, 0.14);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --max: 1180px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }
section { padding: 84px 0; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; }
h2.section-title { font-size: clamp(1.8rem, 3vw, 2.6rem); text-align: center; }
.section-sub { text-align: center; color: var(--muted); max-width: 620px; margin: 12px auto 0; font-size: 1.05rem; }
.eyebrow { color: var(--green-600); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 12px 22px; border-radius: 999px; font-weight: 600; font-size: 0.98rem;
  cursor: pointer; border: 1px solid transparent; transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--green-600), var(--green-500)); color: #fff; box-shadow: 0 8px 20px rgba(34,137,76,.28); }
.btn-primary:hover { box-shadow: 0 12px 26px rgba(34,137,76,.36); transform: translateY(-1px); }
.btn-ghost { background: #fff; color: var(--green-700); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--green-500); color: var(--green-600); }
.btn-light { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.3); }
.btn-light:hover { background: rgba(255,255,255,.26); }
.btn-block { width: 100%; }
.btn-lg { padding: 15px 30px; font-size: 1.05rem; }

/* ---------- Navbar ---------- */
.nav {
  position: sticky; top: 0; z-index: 50; background: rgba(246,250,247,.85);
  backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; color: var(--green-900); }
.brand .logo { width: 34px; height: 34px; }
.brand span b { color: var(--green-600); }
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a { color: var(--ink); font-weight: 500; font-size: .96rem; transition: color .15s; }
.nav-links a:hover { color: var(--green-600); }
.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; font-size: 1.6rem; color: var(--green-900); }
.app-toggle { display: none; background: none; border: 0; cursor: pointer; font-size: 1.6rem; color: var(--green-900); }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; background: radial-gradient(1200px 500px at 80% -10%, #d7f0e0 0%, transparent 60%), var(--bg); }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; padding: 72px 0 40px; }
.hero h1 { font-size: clamp(2.3rem, 5vw, 3.6rem); font-weight: 800; color: var(--green-900); }
.hero h1 em { color: var(--green-600); font-style: normal; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); margin: 18px 0 28px; max-width: 540px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 32px; margin-top: 36px; }
.hero-stats .stat b { display: block; font-size: 1.7rem; color: var(--green-900); font-weight: 800; }
.hero-stats .stat span { color: var(--muted); font-size: .9rem; }
.hero-visual { position: relative; }
.hero-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 22px; border: 1px solid var(--line);
}
.hero-card h4 { display: flex; align-items: center; gap: 8px; color: var(--green-900); }
.hero-card .metric { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.hero-card .metric:last-child { border-bottom: 0; }
.hero-card .metric span { color: var(--muted); }
.hero-card .metric b { color: var(--green-700); }
.badge-float {
  position: absolute; background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 14px; box-shadow: var(--shadow); font-weight: 600; font-size: .85rem; display: flex; gap: 8px; align-items: center;
}
.badge-float.b1 { top: -18px; right: 24px; }
.badge-float.b2 { bottom: -18px; left: -10px; }
.badge-float .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green-500); }

/* ---------- Trusted / logos ---------- */
.trusted { padding: 34px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; }
.trusted p { text-align: center; color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 16px; }
.trusted-row { display: flex; gap: 42px; justify-content: center; flex-wrap: wrap; opacity: .75; font-weight: 700; color: var(--green-900); }

/* ---------- Feature cards ---------- */
.grid { display: grid; gap: 24px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px; box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card .icon {
  width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center;
  background: var(--green-100); color: var(--green-600); font-size: 1.5rem; margin-bottom: 16px;
}
.card h3 { font-size: 1.2rem; color: var(--green-900); margin-bottom: 8px; }
.card p { color: var(--muted); font-size: .97rem; }
.card .arrow { margin-top: 14px; color: var(--green-600); font-weight: 600; font-size: .9rem; }

/* ---------- Steps ---------- */
.steps { counter-reset: step; }
.step { position: relative; padding-left: 60px; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0; width: 42px; height: 42px; border-radius: 50%;
  background: var(--green-600); color: #fff; display: grid; place-items: center; font-weight: 700;
}
.step h3 { color: var(--green-900); margin-bottom: 6px; }
.step p { color: var(--muted); }

/* ---------- CTA band ---------- */
.cta-band { background: linear-gradient(135deg, var(--green-700), var(--green-900)); color: #fff; border-radius: 24px; padding: 54px; text-align: center; }
.cta-band h2 { font-size: clamp(1.8rem, 3vw, 2.4rem); }
.cta-band p { opacity: .9; max-width: 560px; margin: 12px auto 26px; }

/* ---------- Pricing ---------- */
.price-card { text-align: center; position: relative; }
.price-card.featured { border-color: var(--green-500); box-shadow: var(--shadow-lg); }
.price-card .tag { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); background: var(--amber); color: #4a2f00; font-weight: 700; font-size: .75rem; padding: 5px 12px; border-radius: 999px; }
.price { font-size: 2.6rem; font-weight: 800; color: var(--green-900); margin: 12px 0; }
.price span { font-size: 1rem; color: var(--muted); font-weight: 500; }
.price-list { list-style: none; text-align: left; margin: 20px 0; display: grid; gap: 10px; }
.price-list li { color: var(--muted); padding-left: 26px; position: relative; }
.price-list li::before { content: "✓"; position: absolute; left: 0; color: var(--green-500); font-weight: 800; }

/* ---------- Testimonials ---------- */
.quote { font-size: 1rem; color: var(--ink); }
.quote .who { margin-top: 16px; display: flex; align-items: center; gap: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--green-100); color: var(--green-700); display: grid; place-items: center; font-weight: 700; }
.who b { display: block; color: var(--green-900); }
.who small { color: var(--muted); }

/* ---------- FAQ ---------- */
.faq details { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px 20px; margin-bottom: 12px; }
.faq summary { font-weight: 600; color: var(--green-900); cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--green-600); font-size: 1.3rem; }
.faq details[open] summary::after { content: "–"; }
.faq p { color: var(--muted); margin-top: 12px; }

/* ---------- Footer ---------- */
.footer { background: var(--green-900); color: #cfe6d8; padding: 60px 0 26px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; }
.footer h5 { color: #fff; margin-bottom: 14px; font-size: .95rem; text-transform: uppercase; letter-spacing: .06em; }
.footer a { display: block; color: #cfe6d8; padding: 5px 0; font-size: .95rem; }
.footer a:hover { color: #fff; }
.footer .brand { color: #fff; margin-bottom: 12px; }
.footer .brand span b { color: var(--leaf); }
.footer p.small { font-size: .9rem; opacity: .8; max-width: 280px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 40px; padding-top: 20px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: .85rem; opacity: .8; }

/* ---------- Auth pages ---------- */
.auth-wrap { min-height: calc(100vh - 68px); display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: linear-gradient(160deg, var(--green-700), var(--green-900)); color: #fff; padding: 60px; display: flex; flex-direction: column; justify-content: center; }
.auth-side h2 { font-size: 2rem; margin-bottom: 16px; }
.auth-side ul { list-style: none; margin-top: 24px; display: grid; gap: 14px; }
.auth-side li { display: flex; gap: 12px; align-items: flex-start; opacity: .95; }
.auth-side li .tick { background: rgba(255,255,255,.2); border-radius: 8px; width: 26px; height: 26px; display: grid; place-items: center; flex-shrink: 0; }
.auth-main { display: grid; place-items: center; padding: 48px 24px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.8rem; color: var(--green-900); }
.auth-card .muted { color: var(--muted); margin-bottom: 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; color: var(--ink); }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 1rem; font-family: inherit; background: #fff; transition: border .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 3px rgba(47,170,95,.15); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.auth-alt { text-align: center; margin-top: 18px; color: var(--muted); }
.auth-alt a { color: var(--green-600); font-weight: 600; }
.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: .92rem; margin-bottom: 16px; display: none; }
.alert.error { background: #fdecec; color: var(--danger); border: 1px solid #f5c6c6; display: block; }
.alert.success { background: var(--green-100); color: var(--green-700); border: 1px solid #b8e2c7; display: block; }

/* ---------- Dashboard ---------- */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--green-900); color: #cfe6d8; padding: 22px 16px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { color: #fff; margin-bottom: 28px; font-size: 1.15rem; }
.sidebar .brand span b { color: var(--leaf); }
.side-nav { display: grid; gap: 4px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px; color: #cfe6d8; font-weight: 500; font-size: .95rem; transition: background .15s; }
.side-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-nav a.active { background: var(--green-600); color: #fff; }
.side-foot { position: absolute; bottom: 20px; left: 16px; right: 16px; }
.main { padding: 28px 34px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; }
.topbar h1 { font-size: 1.5rem; color: var(--green-900); }
.topbar .user { display: flex; align-items: center; gap: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 28px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.stat-card .icon { width: 44px; height: 44px; border-radius: 12px; background: var(--green-100); color: var(--green-600); display: grid; place-items: center; font-size: 1.3rem; margin-bottom: 12px; }
.stat-card b { font-size: 1.5rem; color: var(--green-900); display: block; }
.stat-card span { color: var(--muted); font-size: .88rem; }
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.panel h2 { font-size: 1.2rem; color: var(--green-900); margin-bottom: 16px; }

/* ---------- Tool UI ---------- */
.tool-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.tool-head .icon { width: 56px; height: 56px; border-radius: 16px; background: var(--green-100); color: var(--green-600); display: grid; place-items: center; font-size: 1.7rem; }
.tool-head h1 { font-size: 1.6rem; color: var(--green-900); }
.tool-head p { color: var(--muted); }
.tool-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.result-box { min-height: 200px; }
.result-empty { color: var(--muted); text-align: center; padding: 40px 0; }
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: .9rem; user-select: none; transition: all .15s; }
.chip.active { background: var(--green-600); color: #fff; border-color: var(--green-600); }
.bar { height: 10px; background: var(--green-100); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--green-500), var(--leaf)); }
.rank-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.rank-item:last-child { border-bottom: 0; }
.rank-item .top { display: flex; justify-content: space-between; font-weight: 600; color: var(--green-900); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line); font-size: .95rem; }
.table th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.trend-up { color: var(--green-600); font-weight: 600; }
.trend-down { color: var(--danger); font-weight: 600; }
.chat { display: flex; flex-direction: column; height: 460px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 6px; }
.msg { max-width: 80%; padding: 10px 14px; border-radius: 14px; font-size: .95rem; }
.msg.user { align-self: flex-end; background: var(--green-600); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--green-100); color: var(--ink); border-bottom-left-radius: 4px; white-space: pre-wrap; }
.chat-input { display: flex; gap: 10px; margin-top: 14px; }
.chat-input input { flex: 1; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.dark { border-color: var(--green-100); border-top-color: var(--green-600); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Page header (inner pages) ---------- */
.page-head { background: linear-gradient(135deg, var(--green-700), var(--green-900)); color: #fff; padding: 70px 0; text-align: center; }
.page-head h1 { font-size: clamp(2rem, 4vw, 2.8rem); }
.page-head p { opacity: .9; max-width: 620px; margin: 12px auto 0; }
.prose { max-width: 760px; margin: 0 auto; }
.prose h2 { color: var(--green-900); margin: 28px 0 12px; }
.prose p { color: var(--muted); margin-bottom: 14px; }

.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero-grid, .grid-3, .grid-4, .footer-grid, .tool-grid, .stat-grid, .tool-layout, .auth-wrap { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-side { display: none; }
  .nav-links, .nav-actions .btn-ghost { display: none; }
  .nav-toggle { display: block; }
  .nav-links.open { display: flex; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; background: #fff; padding: 18px 20px; border-bottom: 1px solid var(--line); gap: 14px; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; z-index: 60; transition: left .25s; width: 250px; }
  .sidebar.open { left: 0; }
  .app-toggle { display: block; }
  .main { padding: 20px; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .hero-stats { gap: 20px; }
  section { padding: 56px 0; }
}
