:root {
  --ink: #173128;
  --muted: #66766f;
  --paper: #f5f7f2;
  --surface: #ffffff;
  --line: #dfe6de;
  --green: #1f7a4c;
  --green-dark: #155c3a;
  --lime: #d8f06a;
  --shadow: 0 16px 42px rgba(25, 52, 42, .12);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--paper); overflow: hidden; }
button, select { font: inherit; }
button { cursor: pointer; }
.topbar { height: 72px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; background: #102a21; color: #fff; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px 11px 11px 3px; background: var(--lime); color: #173128; font-weight: 900; font-size: 1.1rem; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1rem; letter-spacing: .01em; }
.brand small { margin-top: 2px; color: #b8c7c0; font-size: .75rem; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.demo-pill { padding: 7px 11px; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; color: #c9d7d0; font-size: .75rem; }
.button { min-height: 40px; padding: 0 16px; border: 0; border-radius: 10px; font-weight: 750; }
.button-dark { color: #173128; background: var(--lime); }
.button-accent { color: #fff; background: var(--green); }
.button-accent.active { box-shadow: 0 0 0 3px rgba(31,122,76,.16); }
.workspace { height: calc(100vh - 72px); display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 0; }
.map-panel { position: relative; min-width: 0; }
.map-toolbar { height: 86px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 3px; color: var(--green); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 1.45rem; letter-spacing: -.03em; }
.toolbar-actions { display: flex; align-items: end; gap: 9px; }
.radius-field { display: grid; gap: 3px; color: var(--muted); font-size: .7rem; font-weight: 700; }
select { min-height: 40px; padding: 0 34px 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-size: 1.25rem; }
#map { height: calc(100% - 86px); background: #dce5dc; }
.map-hint { position: absolute; z-index: 500; left: 50%; bottom: 22px; transform: translateX(-50%); max-width: calc(100% - 32px); padding: 10px 15px; border: 1px solid rgba(255,255,255,.5); border-radius: 999px; color: #fff; background: rgba(16,42,33,.91); box-shadow: var(--shadow); font-size: .82rem; white-space: nowrap; }
.legend { position: absolute; z-index: 500; left: 16px; top: 102px; display: grid; gap: 8px; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.94); box-shadow: 0 8px 24px rgba(25,52,42,.14); font-size: .75rem; font-weight: 700; }
.legend span { display: flex; align-items: center; gap: 7px; }
.dot { width: 9px; height: 9px; border-radius: 50%; }
.rice { background: #2a8b57; } .corn { background: #d19a22; } .vegetables { background: #6857a6; } .onion { background: #c75d67; }
.sidebar { min-width: 0; padding: 24px 22px; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--line); }
.summary-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.summary-heading h2 { margin-bottom: 18px; font-size: 1.35rem; letter-spacing: -.03em; }
.text-button { padding: 4px; border: 0; color: var(--green); background: transparent; font-weight: 750; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats-grid article { padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #f9fbf8; }
.stats-grid span { display: block; margin-bottom: 6px; color: var(--muted); font-size: .78rem; }
.stats-grid strong { font-size: 1.55rem; letter-spacing: -.04em; }
.stats-grid small { color: var(--muted); font-size: .78rem; }
.crop-summary { margin: 18px 0 22px; display: grid; gap: 10px; }
.crop-row { display: grid; grid-template-columns: 88px 1fr 52px; align-items: center; gap: 9px; font-size: .78rem; }
.bar { height: 7px; overflow: hidden; border-radius: 99px; background: #edf1ec; }
.bar i { display: block; height: 100%; border-radius: inherit; }
.crop-row strong { text-align: right; font-size: .75rem; }
.list-heading { display: flex; align-items: baseline; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 18px; }
.list-heading h3 { margin-bottom: 12px; font-size: .94rem; }
.list-heading span { color: var(--muted); font-size: .75rem; }
.filter-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 0 0 10px; }
.filter-row select { min-width: 0; width: 100%; }
.button-outline { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.farm-list { display: grid; gap: 9px; }
.farm-card { width: 100%; padding: 13px; display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: start; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.farm-card:hover, .farm-card:focus-visible { border-color: #90bda5; box-shadow: 0 6px 18px rgba(24,78,55,.08); outline: none; }
.farm-card .crop-chip { width: 9px; height: 32px; border-radius: 5px; }
.farm-card strong, .farm-card span { display: block; }
.farm-card strong { margin-bottom: 4px; font-size: .86rem; }
.farm-card span { color: var(--muted); font-size: .73rem; }
.farm-card b { font-size: .82rem; }
.farm-card em { display: block; margin-top: 4px; color: #7c8a84; font-size: .68rem; font-style: normal; }
.empty-state { padding: 24px 10px; text-align: center; color: var(--muted); font-size: .85rem; }
.draw-bar { position: fixed; z-index: 900; left: 50%; bottom: 22px; transform: translateX(-50%); display: flex; align-items: center; gap: 9px; width: max-content; max-width: calc(100% - 28px); padding: 10px; border: 1px solid rgba(255,255,255,.18); border-radius: 14px; color: #fff; background: #102a21; box-shadow: var(--shadow); }
.draw-bar[hidden] { display: none; }
.draw-bar > span { min-width: 190px; padding-left: 6px; }
.draw-bar strong, .draw-bar small { display: block; }
.draw-bar small { margin-top: 2px; color: #b8c7c0; font-size: .7rem; }
.draw-bar .button-outline { color: #fff; border-color: rgba(255,255,255,.22); background: transparent; }
.draw-bar button:disabled { opacity: .45; cursor: not-allowed; }
.farm-dialog { width: min(620px, calc(100% - 26px)); padding: 0; border: 0; border-radius: 18px; color: var(--ink); box-shadow: 0 28px 90px rgba(9, 32, 23, .35); }
.farm-dialog::backdrop { background: rgba(10, 32, 24, .58); backdrop-filter: blur(3px); }
.farm-dialog form { padding: 24px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; }
.dialog-heading h2 { margin-bottom: 18px; font-size: 1.4rem; }
.dialog-close { width: 36px; height: 36px; border: 0; border-radius: 50%; color: var(--muted); background: #f1f4f0; font-size: 1.4rem; }
.boundary-status { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin-bottom: 18px; padding: 13px; border: 1px dashed #adc3b5; border-radius: 13px; background: #f7faf6; }
.boundary-status.ready { border-style: solid; border-color: #83b99c; background: #f0f8f3; }
.boundary-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--green); background: #e3f1e8; font-size: 1.2rem; }
.boundary-status strong, .boundary-status small { display: block; }
.boundary-status strong { margin-bottom: 3px; font-size: .82rem; }
.boundary-status small { color: var(--muted); font-size: .72rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.field { position: relative; display: grid; gap: 6px; color: #4d5f57; font-size: .78rem; font-weight: 700; }
.field.full { grid-column: 1 / -1; }
.field input, .field select { width: 100%; min-height: 43px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #fff; font: inherit; font-weight: 500; }
.field input:focus, .field select:focus { outline: 3px solid rgba(31,122,76,.13); border-color: #7daf93; }
.field input[readonly] { background: #f5f7f4; }
.input-suffix { position: absolute; right: 11px; bottom: 13px; color: var(--muted); font-size: .72rem; font-weight: 600; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.toast { position: fixed; z-index: 1000; right: 22px; bottom: 22px; padding: 12px 16px; border-radius: 10px; color: #fff; background: #102a21; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.leaflet-container { font-family: inherit; }
.leaflet-popup-content-wrapper { border-radius: 12px; }
.popup-title { margin-bottom: 5px; font-weight: 800; color: var(--ink); }
.popup-meta { color: var(--muted); font-size: .8rem; line-height: 1.5; }
@media (max-width: 900px) {
  body { overflow: auto; }
  .workspace { height: auto; min-height: calc(100vh - 72px); grid-template-columns: 1fr; }
  .map-panel { height: 62vh; min-height: 520px; }
  .sidebar { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
}
@media (max-width: 620px) {
  .topbar { height: 64px; padding: 0 14px; }
  .brand small, .demo-pill { display: none; }
  .workspace { min-height: calc(100vh - 64px); }
  .map-panel { height: 72vh; min-height: 560px; display: grid; grid-template-rows: max-content minmax(360px, 1fr); }
  .map-toolbar { height: auto; min-height: 148px; display: grid; align-content: start; gap: 12px; padding: 13px 14px 28px; }
  .toolbar-actions { position: static; width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: end; gap: 8px; }
  .radius-field { min-width: 0; }
  .radius-field select { width: 100%; }
  .toolbar-actions .button { padding-inline: 12px; white-space: nowrap; }
  #map { height: auto; min-height: 0; }
  .legend { top: auto; bottom: 68px; }
  .map-hint { bottom: 14px; font-size: .72rem; white-space: normal; text-align: center; }
  .sidebar { padding: 20px 15px; }
  .draw-bar { bottom: 10px; flex-wrap: wrap; justify-content: flex-end; }
  .draw-bar > span { width: 100%; }
  .draw-bar .button { min-height: 36px; padding: 0 11px; font-size: .75rem; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .boundary-status { grid-template-columns: auto 1fr; }
  .boundary-status .button { grid-column: 1 / -1; }
}
