:root {
  --ink: #173429;
  --muted: #708277;
  --line: #e5ece6;
  --cream: #f7f7f2;
  --green: #1d6949;
  --soft-green: #e7f2e9;
  --card: #ffffff;
  --shadow: 0 12px 30px rgba(29, 71, 49, 0.07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--cream); font-family: "DM Sans", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 242px; background: #174d37; color: #eff9f0; padding: 32px 20px 20px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 8px; align-items: center; color: white; text-decoration: none; margin: 0 11px 58px; font-size: 24px; font-weight: 700; letter-spacing: -1px; }
.brand span span { color: #9cd38e; }
.brand-mark { width: 30px; height: 30px; background: #8bcf83; color: #174d37; display: grid; place-items: center; font-size: 26px; line-height: 1; border-radius: 11px 11px 11px 2px; transform: rotate(-13deg); }
.nav-links { display: grid; gap: 8px; }
.nav-link { color: #c5ddcc; padding: 13px 14px; border-radius: 10px; text-decoration: none; font-size: 14px; font-weight: 500; transition: .2s ease; }
.nav-link span { display: inline-block; color: #add9a8; font-size: 19px; width: 27px; vertical-align: -2px; }
.nav-link:hover, .nav-link.active { color: white; background: rgba(255,255,255,.13); }
.nav-link.active span { color: #b7e7a8; }
.farmer-card { margin-top: auto; border-top: 1px solid rgba(255,255,255,.15); padding: 20px 4px 0; display: flex; align-items: center; gap: 10px; }
.avatar { width: 37px; height: 37px; border-radius: 50%; display: grid; place-items: center; background: #f4c49b; color: #734023; font-size: 11px; font-weight: 700; }
.farmer-card strong, .farmer-card small { display: block; }
.farmer-card strong { font-size: 12px; }
.farmer-card small { font-size: 10px; color: #aaccb2; margin-top: 2px; }
.more-btn { margin-left: auto; color: #b7d4be; background: transparent; border: 0; letter-spacing: 1px; }

.content { width: min(1220px, calc(100% - 242px)); margin: 0 auto; padding: 32px 44px 25px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 25px; }
.eyebrow, .section-tag { margin: 0; color: #799083; letter-spacing: 1.2px; font-size: 10px; font-weight: 700; }
.topbar h1 { margin: 5px 0 0; font-family: "Playfair Display", serif; font-size: 30px; letter-spacing: -.7px; }
.topbar h1 span { font-family: sans-serif; font-size: 22px; }
.header-actions { display: flex; align-items: center; gap: 13px; }
.icon-btn { width: 42px; height: 42px; position: relative; border: 1px solid var(--line); border-radius: 50%; color: #46735b; background: #fff; font-size: 24px; line-height: 0; }
.icon-btn i { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #dd7759; top: 9px; right: 10px; border: 1px solid white; }
.weather-pill { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 14px; padding: 8px 12px; color: var(--ink); background: #fff; text-align: left; }
.weather-pill span { font-size: 20px; color: #eca630; }.weather-pill b { font-size: 14px; }.weather-pill small { color: var(--muted); font-size: 11px; }

.hero { background: #dfeee0; min-height: 236px; overflow: hidden; display: grid; grid-template-columns: 1fr 42%; border-radius: 18px; position: relative; }
.hero-copy { position: relative; padding: 38px 40px; z-index: 2; }.hero-copy .section-tag { color: #43745a; }.hero h2 { font-family: "Playfair Display", serif; font-size: 36px; line-height: 1.05; margin: 9px 0; max-width: 390px; letter-spacing: -1.3px; }.hero h2 em { color: #36794d; font-style: italic; }.hero-copy p { font-size: 13px; color: #527260; max-width: 380px; margin: 0 0 22px; line-height: 1.55; }
.primary-btn, .calculate-btn { display: inline-flex; align-items: center; gap: 15px; border: 0; background: #1c6948; color: #fff; padding: 12px 16px; border-radius: 9px; font-weight: 700; font-size: 13px; text-decoration: none; box-shadow: 0 7px 16px rgba(30, 91, 58, .17); }.primary-btn span, .calculate-btn span { font-size: 18px; line-height: 0; }
.hero-art { position: relative; overflow: hidden; background: linear-gradient(130deg, #cae7dc 0%, #e5f1d0 100%); }
.sun { position: absolute; top: 32px; right: 68px; background: #ffcc66; width: 47px; height: 47px; border-radius: 50%; box-shadow: 0 0 0 11px rgba(255, 219, 133, .28); }.cloud { position: absolute; background: rgba(255,255,255,.9); width: 67px; height: 15px; border-radius: 20px; }.cloud:before, .cloud:after { content: ""; position:absolute; background:inherit; border-radius: 50%; }.cloud:before { width: 25px; height: 25px; left: 13px; bottom: 5px; }.cloud:after { width: 19px; height: 19px; right: 12px; bottom: 5px; }.cloud-one { top: 36px; left: 26px; transform: scale(.65); }.cloud-two { top: 78px; left: 96px; transform: scale(.5); opacity: .8; }
.hill { position: absolute; border-radius: 50% 50% 0 0; bottom: -69px; }.hill-back { width: 360px; height: 195px; left: 7px; background: #a7ce89; transform: rotate(-4deg); }.hill-front { width: 420px; height: 190px; left: -24px; background: #70ad5a; transform: rotate(5deg); }.field-lines { position: absolute; z-index: 2; bottom: -12px; left: 28px; width: 330px; height: 119px; border-top: 2px solid rgba(244, 234, 153, .8); border-radius: 50%; transform: rotate(4deg); box-shadow: 0 -25px 0 -1px rgba(244, 234, 153, .62), 0 -52px 0 -1px rgba(244, 234, 153, .47), 0 -78px 0 -1px rgba(244, 234, 153, .36); }.plant { position: absolute; z-index: 3; bottom: 31px; width: 23px; height: 57px; }.plant b { position: absolute; bottom: 0; left: 10px; height: 45px; width: 3px; border-radius: 5px; background: #216644; }.plant i { position: absolute; height: 20px; width: 10px; background: #468f4e; border-radius: 90% 0 90% 0; }.plant i:nth-of-type(1) { left: 0; top: 14px; transform: rotate(-23deg); }.plant i:nth-of-type(2) { right: 0; top: 3px; transform: rotate(45deg) scale(.9); }.plant-one { right: 45px; transform: scale(1.18); }.plant-two { right: 115px; bottom: 22px; transform: scale(.75); }.plant-three { left: 105px; bottom: 19px; transform: scale(.66); }

.metric-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 15px; margin: 20px 0; }.metric-card { background: var(--card); padding: 17px 15px; min-width: 0; display: grid; grid-template-columns: 38px 1fr; gap: 10px; border: 1px solid #edf1ed; border-radius: 13px; box-shadow: 0 5px 16px rgba(34, 70, 48, .035); }.metric-icon { width: 37px; height: 37px; display: grid; place-items:center; border-radius: 11px; font-size: 21px; font-weight: 700; }.mint { color: #27815c; background: #e5f4e9; }.blue { color: #367e9b; background: #e4f3f7; }.amber { color: #bd7b24; background: #fff1db; }.coral { color: #c7644e; background: #fbe8e1; }.metric-card p { font-size: 11px; color: var(--muted); margin: 1px 0 3px; }.metric-card strong { color: #294433; font-size: 20px; letter-spacing: -.5px; }.metric-card strong span { font-size: 11px; color: #799083; font-weight: 500; letter-spacing: 0; }.metric-status { grid-column: 2; align-self: end; justify-self: start; border-radius: 11px; padding: 3px 7px; font-size: 9px; font-weight: 700; }.good { background: #e4f5e9; color: #2d8153; }.neutral { background: #eff0ec; color: #6f7f76; }

.work-area { display: grid; grid-template-columns: minmax(0, 1.67fr) minmax(285px, .85fr); gap: 20px; }.calculator-panel, .result-panel, .advice-card, .nutrient-card { background: #fff; border: 1px solid #e8eee9; border-radius: 15px; box-shadow: var(--shadow); }.calculator-panel { padding: 26px; }.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }.panel-heading h2 { font-family: "Playfair Display", serif; font-size: 21px; letter-spacing: -.4px; margin: 5px 0 0; }.ai-badge { background: #f0eaf9; color: #7655a6; font-size: 10px; font-weight: 700; padding: 6px 8px; border-radius: 7px; white-space: nowrap; }.ai-badge b { font-size: 13px; }.panel-intro { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 13px 0 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 15px 16px; }.form-grid label { color: #52695b; font-size: 11px; font-weight: 700; }.form-grid select, .input-wrap { display: flex; margin-top: 6px; border: 1px solid #dfe8e1; color: #234534; background: #fbfcfa; border-radius: 7px; height: 37px; width: 100%; transition: border .15s ease, box-shadow .15s ease; }.form-grid select { padding: 0 11px; outline: none; }.input-wrap:focus-within, .form-grid select:focus { border-color: #6eac85; box-shadow: 0 0 0 3px rgba(91, 158, 108, .13); }.input-wrap input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; padding: 0 10px; color: var(--ink); font-size: 12px; }.input-wrap span { border-left: 1px solid #e5ece6; padding: 10px 8px; color: #839389; font-size: 10px; white-space: nowrap; }.form-error { min-height: 17px; color: #bf4f45; font-size: 11px; margin: 10px 0 0; }.calculate-btn { margin-top: 7px; width: 100%; justify-content: center; padding: 12px; border-radius: 8px; }
.result-panel { padding: 25px 22px; }.text-btn { color: #41845b; padding: 3px; border: 0; background: transparent; font-weight: 700; font-size: 11px; }.score-row { display: flex; align-items:center; gap: 16px; margin: 22px 0 20px; }.score-ring { width: 86px; height: 86px; flex: 0 0 86px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(closest-side, #fff 77%, transparent 78% 100%), conic-gradient(#56a966 78%, #edf2ea 0); }.score-ring strong { font-size: 25px; letter-spacing: -1px; }.score-ring span { color: #829187; font-size: 9px; margin-top: -2px; }.score-row > div:last-child strong { font-size: 15px; }.score-row p { color: var(--muted); font-size: 11px; margin: 4px 0 0; line-height: 1.4; }.divider { height: 1px; background: var(--line); }.result-list { display: grid; gap: 13px; padding: 18px 0; }.result-list > div { display: flex; align-items: center; gap: 8px; }.dot { width: 8px; height: 8px; border-radius: 50%; }.dot.green { background:#54a96a; }.dot.yellow { background:#e8aa40; }.dot.purple { background:#9a77ba; }.result-list p { font-size: 12px; font-weight: 700; margin: 0; }.result-list small { display: block; color: var(--muted); font-size: 10px; font-weight: 500; margin-top: 2px; }.yield-box { background: #f0f7ee; border-radius: 10px; padding: 13px 14px; }.yield-box span { color: #688b72; font-size: 9px; letter-spacing: .7px; font-weight: 700; }.yield-box strong { display: block; font-size: 24px; line-height: 1.15; margin: 4px 0; letter-spacing: -.6px; }.yield-box strong small { font-size: 11px; font-weight: 500; letter-spacing: 0; }.yield-box p { font-size: 10px; color: #668070; margin: 0; }
.lower-grid { margin-top: 20px; display:grid; grid-template-columns: 1fr 1fr; gap: 20px; }.advice-card, .nutrient-card { padding: 22px 24px; min-height: 177px; }.compact-heading h2 { font-size: 19px; }.round-icon { color: #fff; background:#65a86b; width: 29px; height: 29px; display:grid; place-items:center; border-radius:50%; font-size: 17px; }.advice-card > p { color:#536c5d; line-height:1.55; font-size:12px; max-width:470px; margin:18px 0 16px; }.recommendation-meta { border-top:1px solid var(--line); padding-top:12px; color:#4b865d; font-size:11px; font-weight:700; display:flex; gap:7px; align-items:center; }.leaf-dot { color:#4d9a63; font-size:18px; }.overall-label { color:#5d8667; background:#e7f4e9; font-weight:700; font-size:10px; padding:4px 7px; border-radius:5px; }.bar-group { margin-top: 16px; }.bar-group > div:first-child { display:flex; align-items:center; justify-content:space-between; color:#546a5c; font-size:11px; }.bar-group b { color:#365643; font-size:10px; }.track { height:7px; background:#edf1ec; margin-top:7px; border-radius:5px; overflow:hidden; }.track i { height:100%; display:block; border-radius:5px; transition: width .4s ease; }.n-bar { width:74%; background:#5ca56b; }.p-bar { width:63%; background:#a178bf; }.legend { color:#839289; margin:13px 0 0; font-size:10px; }.legend-dot { width:7px; height:7px; display:inline-block; border-radius:50%; margin-left:9px; }.legend-dot:first-child { margin-left:0; }.nitrogen { background:#5ca56b; }.phosphorus { background:#a178bf; }
footer { color:#839188; text-align:center; font-size:10px; padding:24px 0 2px; } footer span { padding:0 6px; color:#a6b3aa; }

.flash-stack { display:grid; gap:8px; margin:0 0 18px; }
.flash { margin:0; border-radius:9px; padding:11px 14px; font-size:12px; font-weight:600; }
.flash.success { color:#2d7046; background:#e4f5e9; border:1px solid #c9e9d0; }
.flash.error { color:#a94b42; background:#fff0ec; border:1px solid #f1d1c9; }
.storage-notice { margin:16px 0; padding:12px 15px; color:#587260; background:#edf5eb; border:1px solid #dcebdc; border-radius:9px; font-size:11px; line-height:1.5; }
.storage-notice strong { color:#315c3f; }
#formMessage { margin:0 0 16px; }
#formMessage[hidden] { display:none; }
.history-section { margin-top:20px; padding:24px; background:#fff; border:1px solid #e8eee9; border-radius:15px; box-shadow:var(--shadow); }
.history-count { color:#5d8667; background:#e7f4e9; padding:5px 8px; border-radius:6px; font-size:10px; font-weight:700; }
.history-table { margin-top:18px; }
.history-head, .history-row { display:grid; grid-template-columns:1.1fr 1.2fr .9fr 1.2fr auto; gap:14px; align-items:center; padding:11px 12px; }
.history-head { color:#87958c; border-bottom:1px solid var(--line); font-size:10px; font-weight:700; letter-spacing:.5px; text-transform:uppercase; }
.history-row { color:#52695b; border-bottom:1px solid #f0f3f0; font-size:12px; }
.history-row:last-child { border-bottom:0; }
.history-row strong { color:#294433; }
.history-row small { display:block; color:#87958c; font-size:10px; margin-top:3px; }
.health-pill { display:inline-block; border-radius:10px; padding:4px 7px; font-size:10px; }
.health-pill.healthy { color:#2d8153; background:#e4f5e9; }
.health-pill.watch { color:#a97725; background:#fff1db; }
.empty-history { color:var(--muted); margin:18px 0 0; font-size:12px; }
.guide-row { display:grid; grid-template-columns:30px 1fr; gap:0 9px; margin-top:13px; align-items:center; }
.guide-row > span { grid-row:1/3; color:#65a86b; font-size:11px; font-weight:700; }
.guide-row b { color:#365643; font-size:11px; }
.guide-row small { color:#839289; font-size:10px; margin-top:2px; }
.error-page { width:min(560px, calc(100% - 40px)); margin:15vh auto; padding:42px; background:#fff; border-radius:18px; box-shadow:var(--shadow); text-align:center; }
.error-page h1 { font-family:"Playfair Display",serif; margin:10px 0 24px; }
.history-actions { display:flex; align-items:center; gap:7px; flex-wrap:wrap; justify-content:flex-end; }
.small-action { border:1px solid #dfe8e1; color:#36794d; background:#fff; border-radius:7px; padding:6px 8px; font-size:10px; font-weight:700; cursor:pointer; }
.small-action:hover:not(:disabled) { background:#f0f7ee; }
.small-action:disabled { opacity:.5; cursor:not-allowed; }
.danger-action { color:#a94b42; }
.danger-action:hover:not(:disabled) { background:#fff0ec; }

@media (max-width: 980px) { .sidebar { width: 185px; }.content { width: calc(100% - 185px); padding: 27px 24px; }.hero { grid-template-columns: 1.2fr .8fr; }.metric-grid { grid-template-columns: repeat(2,1fr); }.work-area { grid-template-columns: 1fr; }.result-panel { display:grid; grid-template-columns: 1fr 1fr; gap:0 20px; }.result-header,.divider { grid-column:1/-1; }.score-row { margin-bottom:14px; }.result-list { align-content:center; }.yield-box { grid-column:1/-1; } }
@media (max-width: 680px) { .app-shell { display:block; }.sidebar { width:100%; height:auto; min-height:0; padding:16px 18px; position:static; flex-direction:row; align-items:center; }.brand { margin:0; font-size:21px; }.nav-links { display:flex; margin-left:auto; gap:1px; }.nav-link { padding:8px; font-size:0; }.nav-link span { width:auto; font-size:18px; }.farmer-card { display:none; }.content { width:100%; padding:23px 15px; }.topbar { margin-bottom:18px; }.topbar h1 { font-size:25px; }.eyebrow { font-size:8px; }.weather-pill small { display:none; }.weather-pill { padding:8px; gap:4px; }.icon-btn { width:36px; height:36px; }.hero { grid-template-columns:1fr; min-height:0; }.hero-copy { padding:29px 25px; }.hero h2 { font-size:30px; }.hero-art { height:125px; }.sun { top:20px; }.metric-grid { gap:10px; margin:14px 0; }.metric-card { padding:12px 10px; grid-template-columns:32px 1fr; gap:7px; }.metric-icon { width:32px; height:32px; }.metric-card strong { font-size:18px; }.calculator-panel { padding:20px 16px; }.form-grid { grid-template-columns:1fr; gap:11px; }.lower-grid { grid-template-columns:1fr; gap:14px; }.result-panel { display:block; margin-top:0; }.result-list { grid-template-columns:1fr; }.score-row { margin-top:17px; }.advice-card, .nutrient-card { padding:19px; }.history-section { padding:18px 14px; }.history-head { display:none; }.history-row { grid-template-columns:1fr 1fr; gap:7px 10px; padding:13px 4px; }.history-row > span:last-child { text-align:right; }.history-row > button { justify-self:start; }.history-actions { gap:5px; }.storage-notice { font-size:10px; } }
