:root {
  --bg: #0F2216;
  --card: #16301E;
  --surface: #1E3A25;
  --border: #2A4A31;
  --text: #F1F4EF;
  --mut: #A7B8A6;
  --y: #F2C500;
  --on-y: #13240F;
  --red: #F08A7C;
  --green: #2F5A36;
  --ok: #1B3A22;
  --tag: #3A3410;
  --nav-h: 64px;
  font-family: Inter, system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-height: 100dvh; }
a { color: var(--y); }
h1,h2,h3 { font-family: Oswald, Inter, sans-serif; font-weight: 700; letter-spacing: .02em; margin: 0 0 .4rem; }
.hidden { display: none !important; }

.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.app-main { flex: 1; width: 100%; max-width: 520px; margin: 0 auto; padding: 16px 16px calc(var(--nav-h) + 28px); }
.app-main.wide { max-width: 980px; }
.app-main.login-pad { max-width: 480px; padding-top: 36px; padding-bottom: 40px; }

/* Brand */
.brand-row { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 14px; }
.brand-logo { width: 34px; height: 34px; border-radius: 8px; border: 1.5px solid #fff; object-fit: cover; background: #10261A; }
.brand-name { font-family: Oswald, sans-serif; font-weight: 700; font-size: 1.35rem; letter-spacing: .5px; color: var(--text); }
.brand-pro { display: inline-block; margin-left: 6px; background: var(--y); color: var(--on-y); font-size: .85rem; font-weight: 800; padding: 2px 7px; border-radius: 4px; vertical-align: middle; letter-spacing: .04em; }

.hi { font-family: Oswald, sans-serif; font-weight: 600; font-size: 1.85rem; margin: 0 0 4px; line-height: 1.15; }
.sub { color: var(--mut); font-size: .95rem; margin: 0 0 4px; }

/* Buttons */
.btn { appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 6px; padding: 10px 14px; font-weight: 700; cursor: pointer; font-family: inherit; }
.btn:hover { filter: brightness(1.08); }
.btn-y { background: var(--y); color: var(--on-y); border-color: var(--y); }
.btn-g { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.mut { color: var(--mut); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--tag); color: var(--y); font-size: .75rem; font-weight: 700; }
.pill.warn { background: #4A221E; color: var(--red); }
.pill.ok { background: var(--ok); color: var(--y); }

input, textarea, select { width: 100%; background: #0c1c12; border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 10px 12px; font-family: inherit; }
input.code { letter-spacing: .35em; text-transform: uppercase; font-size: 1.4rem; text-align: center; font-weight: 800; }
label { display: block; font-size: .85rem; color: var(--mut); margin: 0 0 6px; }

.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 600px) { .g2.stack-sm { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--mut); font-size: .8rem; font-weight: 700; }
.stat { font-size: 1.6rem; font-weight: 800; color: var(--y); }
.list-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }

/* Ask bar */
.ask-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--y); color: var(--on-y);
  border-radius: 12px; height: 54px; padding: 0 14px;
  margin-top: 14px; cursor: pointer; border: 0; width: 100%;
  font-weight: 700; font-size: 1.05rem; font-family: inherit;
}
.ask-bar .ask-ico { font-size: 1.1rem; }
.ask-bar .ask-t { flex: 1; text-align: left; }
.ask-bar .ask-mic { opacity: .55; }

/* Quick 4 */
.row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.in-btn {
  height: 64px; border-radius: 10px; background: var(--card);
  border: 1px solid var(--border); color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; cursor: pointer; font-family: inherit; padding: 0;
}
.in-btn .e { font-size: 1.25rem; line-height: 1; }
.in-btn .t { font-size: .7rem; color: var(--text); }

/* Module tiles */
.mod-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.mod-tile {
  height: 56px; display: flex; align-items: center; gap: 10px;
  padding: 0 12px; border-radius: 10px; background: var(--card);
  border: 1px solid var(--border); color: var(--text); cursor: pointer;
  font-family: inherit; font-size: .95rem; font-weight: 600; text-align: left;
}
.mod-tile .e { font-size: 1.2rem; }

/* Spray / dash card */
.dash-bar {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  border-radius: 10px; background: var(--card); border: 1px solid var(--border);
  margin-top: 10px; cursor: pointer; width: 100%; color: inherit; font-family: inherit; text-align: left;
}
.dash-bar .dash-body { flex: 1; min-width: 0; }
.dash-bar .dash-title { font-weight: 600; font-size: .95rem; }
.dash-bar .dash-sub { color: var(--mut); font-size: .8rem; margin-top: 2px; }
.dash-bar .chev { color: var(--y); font-weight: 800; font-size: 1.1rem; }

.sec { font-size: .8rem; font-weight: 700; color: var(--mut); letter-spacing: .6px; margin: 16px 0 8px; }

/* Specialists */
.sp-scroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }
.sp-card {
  flex: 0 0 48%; min-width: 150px; max-width: 200px;
  padding: 14px; min-height: 156px; border-radius: 8px;
  background: var(--card); border: 1px solid var(--border);
  cursor: pointer; display: flex; flex-direction: column;
  font-family: inherit; color: inherit; text-align: left;
}
.sp-av { width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 1.35rem; margin-bottom: 9px; }
.sp-h { font-size: 1.05rem; font-weight: 700; }
.sp-p { font-size: .75rem; color: var(--mut); margin-top: 3px; margin-bottom: 8px; line-height: 1.35; flex: 1; }

.demo-badge { display: inline-block; margin-top: 12px; padding: 4px 10px; border-radius: 999px; background: #3A3410; color: var(--y); font-size: .72rem; font-weight: 700; }

/* Bottom nav */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #0c1c12; border-top: 1px solid var(--border);
  display: grid; grid-template-columns: repeat(5, 1fr);
  max-width: 520px; margin: 0 auto;
}
.bottom-nav.wide-nav { max-width: 980px; }
.bn-item {
  appearance: none; background: transparent; border: 0; color: var(--mut);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; cursor: pointer; font-size: .65rem; font-weight: 700; font-family: inherit; padding: 6px 2px 8px;
}
.bn-item .bn-ico { font-size: 1.2rem; line-height: 1; }
.bn-item.on { color: var(--y); }

/* Section header for non-home */
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.sec-head h2 { margin: 0; font-size: 1.45rem; }
.back-link { background: transparent; border: 0; color: var(--y); font-weight: 700; cursor: pointer; font-family: inherit; padding: 0; }

/* Login */
.hero-login { padding: 22px; }
.hero-login h1 { font-size: 1.7rem; margin-top: 8px; }
.login-logo-wrap { display: flex; justify-content: center; margin-bottom: 6px; }
.login-logo { width: 64px; height: 64px; border-radius: 16px; border: 2px solid #fff; }

/* AI panel / soon */
.panel-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
.panel {
  width: 100%; max-width: 520px; background: var(--bg);
  border: 1px solid var(--border); border-bottom: 0;
  border-radius: 16px 16px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  max-height: 80dvh; overflow: auto;
}
.panel h3 { margin-bottom: 8px; }
.panel-close { float: right; background: transparent; border: 0; color: var(--mut); font-size: 1.4rem; cursor: pointer; }

.toast {
  position: fixed; bottom: calc(var(--nav-h) + 18px); right: 18px; left: 18px;
  margin: 0 auto; max-width: 360px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 12px 14px; border-radius: 8px; box-shadow: 0 8px 30px rgba(0,0,0,.35); z-index: 50;
}
.toast.err { border-color: var(--red); }

.footer-mini { margin: 28px 0 8px; color: var(--mut); font-size: .75rem; text-align: center; }

.top-actions { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }


/* Chat panel */
.chat-overlay { align-items: stretch; }
.chat-panel {
  max-height: 92dvh; height: 92dvh; display: flex; flex-direction: column;
  overflow: hidden; padding: 0; border-radius: 16px 16px 0 0;
}
.chat-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--border);
}
.chat-head h3 { margin: 0; }
.chat-sub { font-size: .78rem; margin-top: 2px; }
.chat-head .panel-close { float: none; }
.chat-msgs {
  flex: 1; overflow: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
}
.chat-bubble {
  max-width: 92%; padding: 10px 12px; border-radius: 12px; font-size: .95rem; line-height: 1.4;
  white-space: pre-wrap; word-break: break-word;
}
.chat-bubble.me { align-self: flex-end; background: var(--y); color: var(--on-y); }
.chat-bubble.bot { align-self: flex-start; background: var(--card); border: 1px solid var(--border); }
.chat-thumb { display: block; max-width: 180px; max-height: 140px; border-radius: 8px; margin-bottom: 6px; object-fit: cover; }
.chat-compose { border-top: 1px solid var(--border); padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px)); background: #0c1c12; }
.chat-photo-row { margin-bottom: 8px; }
.chat-photo-preview { font-size: .85rem; margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chat-mic-note { font-size: .78rem; margin: 0 0 8px; }
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-input-row textarea { flex: 1; resize: none; min-height: 44px; max-height: 120px; }
.chat-input-row .btn { flex-shrink: 0; height: 44px; }
.btn.mic-on { background: var(--red); color: #fff; border-color: var(--red); }


/* Weather */
.wx-today { display: flex; align-items: center; gap: 14px; }
.wx-today-ico { font-size: 3.2rem; line-height: 1; }
.wx-temp { font-family: Oswald, sans-serif; font-size: 2.6rem; font-weight: 700; line-height: 1; color: var(--text); }
.wx-kicker { color: var(--y); font-weight: 800; font-size: .78rem; letter-spacing: .6px; }
.wx-win-title { font-family: Oswald, sans-serif; font-size: 1.35rem; font-weight: 700; margin-top: 4px; }
.wx-window { border-color: #3a5a3a; }
.wx-day { display: flex; align-items: center; gap: 10px; padding-top: 12px; padding-bottom: 12px; margin-bottom: 6px; }
.wx-day-l { display: flex; align-items: center; gap: 8px; width: 92px; flex-shrink: 0; }
.wx-day-name { width: 46px; font-weight: 700; font-size: .9rem; }
.wx-day-ico { font-size: 1.35rem; }
.wx-day-m { flex: 1; min-width: 0; font-size: .9rem; }
.wx-day-tags { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.loc-card { margin-top: 12px; }


/* Markets + Map */
.mk-link {
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
  text-decoration: none; color: inherit; padding: 14px;
}
.mk-link .mk-ico { font-size: 1.4rem; }
.mk-link .mk-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mk-link .mk-title { font-weight: 700; }
.mk-link .chev { color: var(--y); font-weight: 800; }
.fs-map { width: 100%; height: 360px; background: #0c1c12; }
.leaflet-container { font: inherit; background: #0c1c12; }


/* Location field + map picker */
.loc-field { display: flex; flex-direction: column; gap: 0; }
.loc-current {
  background: #0c1c12; border: 1px solid var(--border); border-radius: 6px;
  padding: 10px 12px; margin-bottom: 8px;
}
.loc-current-label { font-weight: 700; font-size: .95rem; }
.loc-picker-overlay { align-items: stretch; z-index: 45; }
.loc-picker-panel {
  max-height: 94dvh; height: 94dvh; display: flex; flex-direction: column;
  overflow: hidden; padding: 0; border-radius: 16px 16px 0 0;
}
.loc-pick-search {
  display: flex; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.loc-pick-search input { flex: 1; }
.loc-pick-search .btn { flex-shrink: 0; }
.loc-pick-results {
  max-height: 140px; overflow: auto; border-bottom: 1px solid var(--border);
  background: #0c1c12; flex-shrink: 0;
}
.loc-pick-hit {
  display: block; width: 100%; text-align: left; background: transparent;
  border: 0; border-bottom: 1px solid var(--border); color: var(--text);
  padding: 10px 14px; font-family: inherit; font-size: .9rem; cursor: pointer;
}
.loc-pick-hit:last-child { border-bottom: 0; }
.loc-pick-hit:hover, .loc-pick-hit:active { background: var(--surface); }
.loc-pick-map {
  flex: 1; min-height: 220px; width: 100%; background: #0c1c12;
}
.loc-pick-actions {
  padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border); background: #0c1c12;
  display: flex; flex-direction: column; gap: 8px; flex-shrink: 0;
}

/* Integrations / services */
.svc-card {
  display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap;
  padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
}
.svc-card.sel { border-color: var(--y); }
.svc-logo {
  width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; flex-shrink: 0;
}
.svc-body { flex: 1; min-width: 160px; }
.svc-title { font-weight: 700; color: var(--text); }
.svc-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.btn-sm { padding: 6px 10px; font-size: .82rem; }

/* Operation type chips (build your farm) */
.op-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 8px; }
.op-chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  text-align: left; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  font-family: inherit; cursor: pointer;
}
.op-chip .e { font-size: 1.25rem; }
.op-chip .lab { font-weight: 700; font-size: .92rem; }
.op-chip .hint { font-size: .72rem; color: var(--mut); }
.op-chip.on { border-color: var(--y); background: #1a2e1c; box-shadow: inset 0 0 0 1px var(--y); }

.panel.wide-panel { max-width: min(720px, 100%); }
.csv-preview table { font-size: .78rem; }
.csv-preview th, .csv-preview td { white-space: nowrap; }

/* Locked Photo / Scan — always visible on Free with lock mark */
.in-btn.locked { opacity: .92; position: relative; }
.in-btn.locked .lock-ico { font-size: .65rem; margin-left: 2px; }
.in-btn.locked .t { display: inline-flex; align-items: center; gap: 2px; }
.btn.photo-ai-btn.locked { border-style: dashed; opacity: .95; }
.photo-lock-hint { color: var(--mut); }
