:root {
  --chalk: #f4f1e7;
  --paper: #fbfaf4;
  --paper-raised: #ffffff;
  --furrow: #ddd8c8;
  --furrow-strong: #c4bdab;
  --soil: #29281f;
  --soil-soft: #5e5a4d;
  --soil-muted: #6f6a5e;
  --leaf: #244b36;
  --leaf-hover: #193e2b;
  --leaf-wash: #e1eadf;
  --sun: #d9a441;
  --sun-wash: #f6ead0;
  --clay: #9d553f;
  --clay-wash: #f3dfd8;
  --sky-wash: #dfe9ea;
  --focus: #0b6fba;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow: 0 0 0 1px rgba(41, 40, 31, .05), 0 1px 2px rgba(41, 40, 31, .05), 0 8px 24px rgba(63, 57, 41, .06);
  --display: Rockwell, "Roboto Slab", Cambria, Georgia, serif;
  --body: Aptos, "Segoe UI", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--chalk); }
body { margin: 0; min-height: 100vh; background: var(--chalk); color: var(--soil); font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 70%, transparent); outline-offset: 3px; }
.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; transform: translateY(-160%); padding: 10px 14px; background: var(--paper-raised); border-radius: var(--radius-sm); }
.skip-link:focus { transform: translateY(0); }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 16px 16px; border-right: 1px solid var(--furrow); background: var(--chalk); }
.brand { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 4px 6px 20px; text-decoration: none; }
.brand img { border-radius: 10px; }
.brand span { display: grid; line-height: 1.15; }
.brand strong { font-family: var(--display); font-size: 17px; letter-spacing: -.02em; }
.brand small { margin-top: 5px; color: var(--soil-muted); font-size: 11px; }
.main-nav { display: grid; gap: 4px; }
.nav-item { min-height: 44px; display: flex; align-items: center; gap: 11px; width: 100%; border: 0; border-radius: var(--radius-sm); padding: 0 11px; background: transparent; color: var(--soil-soft); cursor: pointer; text-align: left; font-weight: 550; }
.nav-item:hover { background: rgba(36, 75, 54, .06); color: var(--soil); }
.nav-item[aria-current="page"] { background: var(--leaf-wash); color: var(--leaf); font-weight: 700; }
.nav-icon { width: 18px; height: 18px; display: inline-grid; place-items: center; font-size: 16px; }
.nav-count { margin-left: auto; min-width: 22px; height: 22px; display: grid; place-items: center; padding: 0 6px; background: var(--sun-wash); border-radius: 11px; color: #76500d; font-size: 11px; font-variant-numeric: tabular-nums; }
.sidebar-foot { margin-top: auto; padding: 16px 8px 4px; border-top: 1px solid var(--furrow); color: var(--soil-muted); font-size: 12px; }
.sidebar-foot p { margin: 0 0 8px; }
.privacy-dot { width: 7px; height: 7px; display: inline-block; margin-right: 5px; border-radius: 50%; background: var(--leaf); }
.workspace { min-width: 0; }
.topbar { min-height: 96px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px clamp(20px, 4vw, 56px); border-bottom: 1px solid var(--furrow); background: color-mix(in srgb, var(--chalk) 92%, transparent); }
.topbar h1 { margin: 1px 0 0; font: 700 clamp(22px, 3vw, 30px)/1.1 var(--display); letter-spacing: -.025em; }
.topbar-actions { display: flex; gap: 8px; }
.eyebrow { margin: 0; color: var(--soil-muted); font-size: 11px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.demo-banner { align-items: center; justify-content: space-between; gap: 16px; min-height: 52px; padding: 10px clamp(20px, 4vw, 56px); background: var(--sun-wash); color: #67460b; font-size: 13px; }
.demo-banner:not([hidden]) { display: flex; }
.text-button { min-height: 40px; border: 0; padding: 4px 0; background: transparent; color: var(--leaf); cursor: pointer; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
#main-content { max-width: 1440px; margin: 0 auto; padding: 32px clamp(20px, 4vw, 56px) 80px; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-head h2 { margin: 2px 0 5px; font: 700 clamp(27px, 4vw, 38px)/1.08 var(--display); letter-spacing: -.035em; text-wrap: balance; }
.page-head p:last-child { max-width: 680px; margin: 0; color: var(--soil-soft); text-wrap: pretty; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 9px 15px; cursor: pointer; font-weight: 700; transition: background-color 140ms, border-color 140ms, color 140ms, transform 100ms; }
.button:active { transform: scale(.97); }
.button-primary { background: var(--leaf); color: white; }
.button-primary:hover { background: var(--leaf-hover); }
.button-secondary { border-color: var(--furrow-strong); background: var(--paper); color: var(--soil); }
.button-secondary:hover { background: var(--paper-raised); border-color: #aaa28e; }
.button-danger { background: var(--clay); color: white; }
.button-quiet { min-height: 38px; padding: 6px 10px; border-color: transparent; background: transparent; color: var(--leaf); }
.button-quiet:hover { background: var(--leaf-wash); }
.button-block { width: 100%; }
.stack-gap { margin-top: 8px; }
.button[disabled] { cursor: not-allowed; opacity: .5; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(290px, .75fr); gap: 28px; align-items: start; }
.section { margin-bottom: 32px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h3, .panel h3 { margin: 0; font: 700 19px/1.2 var(--display); letter-spacing: -.02em; }
.section-head p { margin: 0; color: var(--soil-muted); font-size: 13px; }
.panel { background: var(--paper); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 20px; }
.agenda { background: var(--paper); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.agenda-date { display: grid; grid-template-columns: 68px minmax(0, 1fr) auto; gap: 16px; align-items: center; min-height: 74px; padding: 12px 18px; border-bottom: 1px solid var(--furrow); }
.agenda-date:last-child { border-bottom: 0; }
.date-tile { display: grid; justify-items: center; line-height: 1; }
.date-tile strong { font: 700 25px/1 var(--display); font-variant-numeric: tabular-nums; }
.date-tile small { margin-top: 5px; color: var(--soil-muted); font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.agenda-main { min-width: 0; }
.agenda-main strong { display: block; text-wrap: pretty; }
.agenda-main small { display: block; margin-top: 3px; color: var(--soil-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-toggle { width: 44px; height: 44px; border: 1px solid var(--furrow-strong); border-radius: 50%; background: var(--paper-raised); color: var(--leaf); cursor: pointer; font-size: 18px; }
.task-toggle:hover { border-color: var(--leaf); background: var(--leaf-wash); }
.field-strip { display: grid; gap: 7px; }
.field-row { position: relative; min-height: 68px; display: grid; grid-template-columns: minmax(140px, .8fr) minmax(160px, 1.2fr) auto; gap: 16px; align-items: center; padding: 10px 14px 10px 18px; overflow: hidden; border: 1px solid var(--furrow); border-radius: var(--radius-md); background: var(--paper); }
.field-row::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--leaf); }
.field-row[data-status="attention"]::before { background: var(--sun); }
.field-row[data-status="missing"]::before { background: var(--clay); }
.field-name strong { display: block; }
.field-name small, .field-crop small { color: var(--soil-muted); }
.field-crop strong { display: block; font-weight: 600; }
.field-status { min-width: 86px; text-align: right; font-size: 12px; font-weight: 700; color: var(--soil-soft); }
.signal-stack { display: grid; gap: 8px; margin-top: 16px; }
.signal { display: grid; grid-template-columns: 8px 1fr; gap: 10px; align-items: start; }
.signal-dot { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--sun); }
.signal[data-level="high"] .signal-dot { background: var(--clay); }
.signal[data-level="low"] .signal-dot { background: var(--sky-wash); box-shadow: inset 0 0 0 1px #71898b; }
.signal p { margin: 0; font-size: 13px; }
.signal small { color: var(--soil-muted); }
.metric-line { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--furrow); }
.metric-line:last-child { border: 0; }
.metric-line span { color: var(--soil-soft); }
.metric-line strong { font: 700 21px/1 var(--display); font-variant-numeric: tabular-nums; }
.alert-list { display: grid; gap: 10px; }
.alert-card { border-radius: var(--radius-md); background: var(--paper); box-shadow: var(--shadow); overflow: hidden; }
.alert-card summary { min-height: 84px; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 18px; cursor: pointer; list-style: none; }
.alert-card summary::-webkit-details-marker { display: none; }
.alert-marker { width: 10px; height: 48px; border-radius: 5px; background: var(--sun); }
.alert-card[data-level="high"] .alert-marker { background: var(--clay); }
.alert-card[data-level="low"] .alert-marker { background: #769294; }
.alert-title strong { display: block; }
.alert-title small { display: block; margin-top: 4px; color: var(--soil-muted); }
.level-label { padding: 4px 8px; border-radius: 12px; background: var(--sun-wash); color: #75500c; font-size: 11px; font-weight: 750; text-transform: uppercase; }
.alert-card[data-level="high"] .level-label { background: var(--clay-wash); color: #743523; }
.alert-card[data-level="low"] .level-label { background: var(--sky-wash); color: #385e60; }
.irrigation-card .alert-marker { background: var(--leaf); }
.alert-detail { padding: 0 18px 18px 42px; }
.alert-detail h4 { margin: 18px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .07em; }
.alert-detail ul { margin: 0; padding-left: 18px; color: var(--soil-soft); }
.alert-detail .recommendation { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--leaf-wash); color: var(--leaf); }
.disclaimer { color: var(--soil-muted); font-size: 12px; }
.list-table { width: 100%; border-collapse: collapse; }
.list-table th { padding: 10px 12px; border-bottom: 1px solid var(--furrow-strong); color: var(--soil-muted); font-size: 11px; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
.list-table td { padding: 14px 12px; border-bottom: 1px solid var(--furrow); vertical-align: middle; }
.list-table tbody tr:last-child td { border-bottom: 0; }
.list-table td:last-child, .list-table th:last-child { text-align: right; }
.numeric { font-variant-numeric: tabular-nums; }
.status-pill { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 8px; border-radius: 12px; background: var(--leaf-wash); color: var(--leaf); font-size: 11px; font-weight: 700; }
.status-pill.pending { background: var(--sun-wash); color: #75500c; }
.task-done { color: var(--soil-muted); text-decoration: line-through; }
.cards-list { display: grid; gap: 10px; }
.parcel-card { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(170px, .8fr) auto; align-items: center; gap: 24px; min-height: 100px; padding: 18px 20px; border-radius: var(--radius-md); background: var(--paper); box-shadow: var(--shadow); }
.parcel-card h3 { margin: 0 0 4px; font: 700 18px var(--display); }
.parcel-card p { margin: 0; color: var(--soil-muted); }
.parcel-meta { display: flex; gap: 18px; }
.parcel-meta span { display: grid; }
.parcel-meta strong { font-variant-numeric: tabular-nums; }
.parcel-meta small { color: var(--soil-muted); }
.empty-state { display: grid; justify-items: center; padding: 48px 24px; border: 1px dashed var(--furrow-strong); border-radius: var(--radius-lg); background: color-mix(in srgb, var(--paper) 55%, transparent); text-align: center; }
.empty-mark { width: 64px; height: 42px; margin-bottom: 16px; border-block: 4px solid var(--leaf); border-radius: 45%; transform: rotate(-8deg); opacity: .65; }
.empty-state h3 { margin: 0 0 6px; font: 700 19px var(--display); }
.empty-state p { max-width: 460px; margin: 0 0 18px; color: var(--soil-muted); }
.cost-layout, .data-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .65fr); gap: 24px; align-items: start; }
.savings-grid { display: grid; grid-template-columns: minmax(260px, .7fr) minmax(0, 1.3fr); gap: 18px; align-items: stretch; }
.saving-outcome { display: grid; align-content: center; min-height: 230px; padding: 28px; border-radius: var(--radius-lg); background: var(--leaf); color: white; box-shadow: var(--shadow); }
.saving-outcome.negative { background: var(--clay); }
.saving-outcome span { font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }
.saving-outcome strong { margin: 8px 0; font: 700 clamp(34px, 5vw, 52px)/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.saving-outcome small { font-size: 14px; }
.empty-state.compact { min-height: 230px; padding: 28px; }
.cost-bars { display: grid; gap: 14px; margin-top: 20px; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 74px; gap: 12px; align-items: center; font-size: 13px; }
.bar-meter { width: 100%; height: 8px; border: 0; border-radius: 4px; background: var(--furrow); appearance: none; }
.bar-meter::-webkit-meter-bar { border: 0; border-radius: 4px; background: var(--furrow); }
.bar-meter::-webkit-meter-optimum-value { border-radius: 4px; background: var(--leaf); }
.bar-meter::-moz-meter-bar { border-radius: 4px; background: var(--leaf); }
.metric-date { font-size: 16px; }
.data-source { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--furrow); }
.data-source:last-child { border: 0; }
.source-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--leaf-wash); color: var(--leaf); font-weight: 800; }
.data-source p { margin: 0; }
.data-source small { display: block; color: var(--soil-muted); }
.source-state { color: var(--soil-muted); font-size: 12px; font-weight: 700; }
.source-state.active { color: var(--leaf); }
.table-scroll { max-width: 100%; overflow-x: auto; }
.help-item { border-top: 1px solid var(--furrow); padding: 12px 0; }
.help-item:first-of-type { margin-top: 12px; }
.help-item summary { min-height: 40px; display: flex; align-items: center; cursor: pointer; color: var(--leaf); font-weight: 700; }
.help-item p { margin: 6px 0 2px; color: var(--soil-soft); }
.callout { padding: 14px 16px; border-left: 4px solid var(--sun); background: var(--sun-wash); color: #67460b; }
.callout p { margin: 0; }
.callout p + p { margin-top: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-field { display: grid; gap: 6px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 13px; font-weight: 700; }
.form-field small { color: var(--soil-muted); }
input, select, textarea { width: 100%; min-height: 44px; border: 1px solid var(--furrow-strong); border-radius: var(--radius-sm); padding: 9px 11px; background: #efede4; color: var(--soil); }
textarea { min-height: 86px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #a69e89; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: 3px solid color-mix(in srgb, var(--focus) 18%, transparent); }
.dialog { width: min(620px, calc(100vw - 28px)); max-height: calc(100vh - 28px); border: 0; border-radius: var(--radius-lg); padding: 0; background: var(--paper); color: var(--soil); box-shadow: 0 28px 90px rgba(25, 30, 21, .25); }
.dialog::backdrop { background: rgba(29, 32, 24, .52); backdrop-filter: blur(2px); }
.dialog-small { width: min(440px, calc(100vw - 28px)); }
.dialog-shell { padding: 22px; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.dialog-head h2 { margin: 2px 0 0; font: 700 25px var(--display); letter-spacing: -.025em; }
.icon-button { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; font-size: 26px; line-height: 1; }
.icon-button:hover { background: var(--furrow); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.toast-region { position: fixed; z-index: 200; right: 22px; bottom: 22px; display: grid; gap: 8px; }
.toast { max-width: 360px; padding: 12px 16px; border-radius: var(--radius-md); background: var(--soil); color: white; box-shadow: 0 12px 32px rgba(0, 0, 0, .2); animation: toast-in 180ms cubic-bezier(.23,1,.32,1); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 920px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 50; inset: auto 0 0; width: auto; height: 68px; display: block; padding: 6px 8px; border: 0; border-top: 1px solid var(--furrow); background: var(--paper); }
  .brand, .sidebar-foot { display: none; }
  .main-nav { grid-template-columns: repeat(6, 1fr); gap: 2px; }
  .nav-item { min-height: 54px; display: grid; justify-items: center; align-content: center; gap: 2px; padding: 3px; font-size: 10px; }
  .nav-icon { font-size: 14px; }
  .nav-count { position: absolute; transform: translate(12px, -12px); min-width: 18px; height: 18px; padding: 0 4px; }
  .workspace { padding-bottom: 68px; }
  .overview-grid, .cost-layout, .data-layout, .savings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topbar { min-height: 78px; padding: 14px 16px; }
  .topbar-actions .button-secondary { display: none; }
  .topbar-actions .button { min-height: 42px; padding: 8px 11px; }
  .demo-banner { align-items: start; padding: 10px 16px; }
  #main-content { padding: 24px 16px 76px; }
  .page-head { align-items: start; flex-direction: column; margin-bottom: 22px; }
  .page-head .button { width: 100%; }
  .field-row { grid-template-columns: 1fr auto; gap: 5px 12px; }
  .field-crop { grid-column: 1; }
  .field-status { grid-column: 2; grid-row: 1 / span 2; }
  .parcel-card { grid-template-columns: 1fr; gap: 12px; }
  .parcel-card .button { width: 100%; }
  .list-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .list-table, .list-table tbody, .list-table tr, .list-table td { display: block; width: 100%; }
  .list-table tr { padding: 12px 0; border-bottom: 1px solid var(--furrow); }
  .list-table td { display: flex; justify-content: space-between; gap: 14px; padding: 4px 0; border: 0; text-align: right; }
  .list-table td::before { content: attr(data-label); color: var(--soil-muted); text-align: left; }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.full { grid-column: auto; }
  .alert-card summary { grid-template-columns: 8px 1fr; }
  .level-label { grid-column: 2; justify-self: start; }
  .alert-detail { padding-left: 36px; }
  .bar-row { grid-template-columns: 90px 1fr 62px; }
  .toast-region { right: 12px; bottom: 82px; left: 12px; }
  .toast { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
