:root {
  color-scheme: light;
  --bg: #f4f8f3;
  --surface: #ffffff;
  --ink: #15382d;
  --muted: #61756e;
  --line: #cddbd4;
  --green: #1f7a50;
  --lime: #dff44a;
  --sky: #bfe6f5;
  --coral: #ff765f;
  --yellow: #ffd85c;
  --pad: 16px;
  --header: 68px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; overflow-x: clip; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Arial, sans-serif; overflow-x: clip; }
body.nav-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input { color: inherit; font: inherit; }
img { display: block; max-width: 100%; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
a, button, input, label { touch-action: manipulation; -webkit-tap-highlight-color: rgba(31, 122, 80, .18); }
#overview, #beds, #tasks, #insights { scroll-margin-top: 84px; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; }
::selection { background: var(--lime); color: var(--ink); }
.skip-link { position: fixed; z-index: 120; top: 8px; left: 8px; padding: 10px 14px; background: var(--ink); color: white; transform: translateY(-150%); transition: transform .2s; }
.skip-link:focus { transform: translateY(0); }

.app-header { position: fixed; z-index: 60; top: 0; left: 0; right: 0; min-height: calc(var(--header) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(var(--pad), env(safe-area-inset-right)) 0 max(var(--pad), env(safe-area-inset-left)); display: flex; align-items: center; justify-content: space-between; gap: 12px; background: rgba(255, 255, 255, .94); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
.logo { min-height: 44px; display: flex; align-items: center; gap: 8px; font: 900 16px "Arial Black", Arial, sans-serif; }
.logo span { width: 32px; height: 32px; display: grid; place-items: center; background: var(--lime); border-radius: 50%; font: 700 10px Arial, sans-serif; }
.nav-toggle, .help-button, .avatar, .icon-button { width: 48px; height: 48px; flex: 0 0 auto; border: 1px solid var(--line); background: white; }
.nav-toggle, .help-button, .icon-button { cursor: pointer; }
.nav-toggle { position: relative; }
.nav-toggle span { position: absolute; left: 14px; width: 18px; height: 2px; background: var(--ink); transition: top .25s, transform .25s; }
.nav-toggle span:first-child { top: 19px; }
.nav-toggle span:last-child { top: 26px; }
.nav-toggle[aria-expanded="true"] span:first-child { top: 23px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { top: 23px; transform: rotate(-45deg); }
.header-actions { display: flex; gap: 8px; }
.help-button { display: none; place-items: center; border-radius: 50%; }
.avatar { display: grid; place-items: center; border-radius: 50%; background: var(--sky); border-color: var(--ink); font-size: 11px; font-weight: 700; }
.side-nav { position: fixed; z-index: 45; top: calc(var(--header) + env(safe-area-inset-top)); bottom: 0; left: 0; width: min(84vw, 300px); padding: 24px var(--pad) calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 28px; background: var(--ink); color: white; transform: translateX(-105%); visibility: hidden; transition: transform .3s, visibility .3s; overscroll-behavior: contain; }
.side-nav.open { transform: translateX(0); visibility: visible; }
.workspace { padding-bottom: 20px; display: flex; flex-direction: column; gap: 5px; border-bottom: 1px solid rgba(255, 255, 255, .18); }
.workspace span, .season span { color: #a9c0b8; font-size: 9px; }
.workspace b { font-size: 14px; }
.workspace i { color: #a9c0b8; font-size: 10px; font-style: normal; }
.side-nav nav { display: grid; gap: 5px; }
.side-nav nav a { min-height: 48px; padding: 0 12px; display: flex; align-items: center; gap: 13px; color: #bcd0c8; font-size: 13px; }
.side-nav nav a span { width: 20px; font-size: 18px; text-align: center; }
.side-nav nav a.active { background: var(--lime); color: var(--ink); }
.season { margin-top: auto; display: grid; gap: 9px; }
.season > div { height: 6px; overflow: hidden; background: rgba(255, 255, 255, .18); }
.season > div i { display: block; width: 57%; height: 100%; background: var(--lime); }
.season b { font-size: 10px; font-weight: 400; }
.side-nav > small { color: #89a097; font-size: 9px; text-transform: uppercase; }
.nav-scrim { position: fixed; z-index: 44; inset: calc(var(--header) + env(safe-area-inset-top)) 0 0; border: 0; background: rgba(9, 30, 23, .44); opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s; }
.nav-scrim.visible { opacity: 1; visibility: visible; }

main { padding: calc(var(--header) + env(safe-area-inset-top) + 26px) var(--pad) calc(96px + env(safe-area-inset-bottom)); }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.page-head p { margin: 0 0 8px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.page-head h1 { margin: 0; font: 700 2.35rem/.98 Georgia, serif; }
.page-head h1 em { color: var(--green); font-weight: 400; }
.primary-button, .secondary-button { min-height: 48px; padding: 0 16px; border: 1px solid var(--ink); border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 700; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; background: var(--ink); color: white; }
.primary-button span { font-size: 20px; font-weight: 400; }
.secondary-button { background: white; }
.page-head > .primary-button { width: 48px; padding: 0; }
.page-head > .primary-button { font-size: 0; }
.page-head > .primary-button span { font-size: 24px; }

.garden-brief { min-height: 410px; margin-top: 26px; position: relative; overflow: hidden; border-radius: 6px; background: var(--ink); color: white; }
.garden-brief::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(21, 56, 45, .08), rgba(21, 56, 45, .9)); }
.garden-brief > img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; object-position: center; }
.garden-brief > div { position: absolute; z-index: 2; left: 18px; right: 18px; }
.garden-brief > div:nth-of-type(1) { bottom: 92px; }
.garden-brief > div > span { font-size: 9px; text-transform: uppercase; }
.garden-brief h2 { max-width: 520px; margin: 10px 0; font: 700 2.2rem/.95 Georgia, serif; }
.garden-brief p { max-width: 440px; margin: 0; color: #d9e9e2; font-size: 13px; }
.garden-brief .weather { bottom: 16px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.weather > b { font: 700 30px Georgia, serif; font-variant-numeric: tabular-nums; }
.weather > span { min-width: 0; color: #d9e9e2; font-size: 10px; }
.unit-switcher, .view-switcher { display: inline-grid; grid-template-columns: 1fr 1fr; border: 1px solid currentColor; }
.unit-switcher button, .view-switcher button { min-width: 44px; min-height: 44px; padding: 0 8px; border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 10px; }
.unit-switcher button.active { background: white; color: var(--ink); }

.metrics { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.metric { min-width: 0; min-height: 138px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.metric > span, .panel-head span, .bed-detail span { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.metric strong { display: block; margin: 12px 0 4px; font: 700 2.4rem/1 Georgia, serif; font-variant-numeric: tabular-nums; }
.metric strong span { color: var(--muted); font-size: 16px; }
.metric p { margin: 0; color: var(--muted); font-size: 10px; }
.metric p b { color: var(--green); }
.metric.accent { background: var(--lime); border-color: var(--ink); }

.dashboard-grid { margin-top: 14px; display: grid; gap: 14px; }
.panel { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h2 { margin: 5px 0 0; font: 700 24px Georgia, serif; }
.view-switcher { color: var(--muted); }
.view-switcher button.active { background: var(--ink); color: white; }
.bed-grid { margin-top: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bed { min-height: 112px; padding: 12px; display: flex; flex-direction: column; align-items: flex-start; border: 1px solid var(--line); border-radius: 4px; background: #eff6f1; cursor: pointer; text-align: left; transition: transform .2s, border-color .2s, background-color .2s; }
.bed span { color: var(--muted); font-size: 9px; }
.bed b { margin: auto 0 8px; font-size: 13px; }
.bed i { padding: 4px 7px; border-radius: 3px; background: #d7ebdd; color: #23603f; font-size: 8px; font-style: normal; text-transform: uppercase; }
.bed.watch { background: #fff8da; }
.bed.watch i { background: var(--yellow); color: #5b4700; }
.bed.harvest { background: #fff0eb; }
.bed.harvest i { background: var(--coral); color: #47170f; }
.bed.active { border: 2px solid var(--green); box-shadow: inset 0 0 0 1px white; }
.bed-detail { margin-top: 14px; padding-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; border-top: 1px solid var(--line); }
.bed-detail div:first-child { grid-column: 1 / -1; }
.bed-detail b { display: block; margin-top: 5px; font-size: 12px; }

.task-progress { margin: 22px 0 12px; }
.task-progress > span { display: block; margin-bottom: 8px; color: var(--muted); font-size: 10px; }
.task-progress > div { height: 7px; overflow: hidden; background: #e6ede9; }
.task-progress i { display: block; width: 40%; height: 100%; background: var(--green); transform-origin: left; transition: transform .35s; }
.task-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.task-list li { border-bottom: 1px solid var(--line); }
.task-list label { min-height: 66px; padding: 9px 0; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.task-list input { width: 20px; height: 20px; flex: 0 0 auto; accent-color: var(--green); }
.task-list label > span { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.task-list b { font-size: 12px; overflow-wrap: anywhere; }
.task-list small { color: var(--muted); font-size: 9px; }
.task-list input:checked + span b { color: var(--muted); text-decoration: line-through; }

.panel-head a { min-height: 44px; display: flex; align-items: center; gap: 10px; color: var(--green); font-size: 11px; }
.forecast-grid { margin-top: 22px; display: grid; grid-template-columns: repeat(5, minmax(58px, 1fr)); overflow-x: auto; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.forecast-grid div { min-width: 58px; padding: 14px 8px; display: flex; flex-direction: column; gap: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.forecast-grid time { color: var(--muted); font-size: 9px; }
.forecast-grid b { font: 700 22px Georgia, serif; font-variant-numeric: tabular-nums; }
.forecast-grid i { color: var(--muted); font-size: 9px; font-style: normal; }
.forecast > p { margin: 16px 0 0; padding: 14px; background: var(--sky); font-size: 11px; line-height: 1.5; }
.forecast > p b { display: block; }

.field-note { min-height: 340px; margin: 0; position: relative; overflow: hidden; border-radius: 6px; }
.field-note::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 36%, rgba(14, 43, 34, .88)); }
.field-note img { width: 100%; height: 100%; position: absolute; object-fit: cover; object-position: center 70%; }
.field-note figcaption { position: absolute; z-index: 2; left: 18px; right: 18px; bottom: 18px; color: white; }
.field-note span { font-size: 9px; }
.field-note p { max-width: 460px; margin: 10px 0 0; font: 700 24px/1.1 Georgia, serif; }

.bottom-nav { position: fixed; z-index: 35; left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); height: 66px; padding: 4px; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 6px; background: rgba(255, 255, 255, .96); box-shadow: 0 12px 30px rgba(21, 56, 45, .18); backdrop-filter: blur(14px); }
.bottom-nav a { min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 8px; }
.bottom-nav a span { font-size: 16px; }
.bottom-nav a.active { background: var(--lime); color: var(--ink); border-radius: 4px; }

.task-dialog { width: min(calc(100% - 24px), 520px); max-height: calc(100svh - 24px); padding: 0; border: 1px solid var(--ink); border-radius: 6px; color: var(--ink); background: white; overscroll-behavior: contain; }
.task-dialog::backdrop { background: rgba(9, 30, 23, .62); }
.task-dialog form { padding: 20px; }
.task-dialog header { margin-bottom: 22px; display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.task-dialog header span { color: var(--muted); font-size: 9px; }
.task-dialog h2 { margin: 5px 0 0; font: 700 28px Georgia, serif; }
.dialog-close { width: 48px; height: 48px; border: 1px solid var(--line); border-radius: 50%; background: white; cursor: pointer; font-size: 24px; }
.task-dialog label { display: block; margin: 18px 0 8px; font-size: 11px; font-weight: 700; }
.task-dialog input { width: 100%; min-height: 50px; padding: 0 12px; border: 1px solid var(--line); border-radius: 4px; background: white; font-size: 16px; }
.dialog-error { min-height: 22px; margin: 8px 0 0; color: #b22c1e; font-size: 12px; }
.dialog-actions { margin-top: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity .55s, transform .55s; }
.reveal.visible { opacity: 1; transform: translateY(0); }

@media (hover: hover) {
  .logo:hover, .panel-head a:hover, .bottom-nav a:hover { color: var(--green); }
  .help-button:hover { background: var(--lime); border-color: var(--ink); }
  .primary-button:hover { background: var(--green); }
  .side-nav nav a:hover { background: rgba(255, 255, 255, .08); color: white; }
  .side-nav nav a.active:hover { background: var(--lime); color: var(--ink); }
  .bed:hover { transform: translateY(-2px); border-color: var(--green); }
  .view-switcher button:hover, .unit-switcher button:hover { background: var(--lime); color: var(--ink); }
}

@media (min-width: 700px) {
  :root { --pad: 26px; }
  .help-button { display: grid; }
  .page-head h1 { font-size: 3.2rem; }
  .page-head > .primary-button { width: auto; padding: 0 16px; font-size: 12px; }
  .garden-brief { min-height: 430px; }
  .garden-brief > div { left: 28px; right: 28px; }
  .garden-brief h2 { font-size: 3.2rem; }
  .metrics { grid-template-columns: repeat(4, 1fr); }
  .bed-grid { grid-template-columns: repeat(4, 1fr); }
  .bed-detail { grid-template-columns: 2fr 1fr 1fr; }
  .bed-detail div:first-child { grid-column: auto; }
  .forecast-grid { overflow: visible; }
  .field-note { min-height: 440px; }
  .field-note p { font-size: 32px; }
}

@media (min-width: 1050px) {
  :root { --pad: 32px; --header: 76px; }
  .app-header { left: 248px; background: white; backdrop-filter: none; }
  .nav-toggle { display: none; }
  .logo { position: fixed; z-index: 60; left: 22px; top: calc(18px + env(safe-area-inset-top)); color: white; }
  .logo span { color: var(--ink); }
  .side-nav { z-index: 55; top: 0; width: 248px; padding: calc(98px + env(safe-area-inset-top)) 18px 24px; transform: none; visibility: visible; }
  .nav-scrim { display: none; }
  main { margin-left: 248px; padding-top: calc(var(--header) + env(safe-area-inset-top) + 36px); padding-bottom: 50px; }
  .bottom-nav { display: none; }
  .page-head h1 { font-size: 3.8rem; }
  .garden-brief { min-height: 460px; }
  .garden-brief h2 { font-size: 3.7rem; }
  .metric { min-height: 150px; }
  .dashboard-grid { grid-template-columns: 1.35fr .85fr; align-items: start; }
  .garden-map { grid-row: span 2; }
  .forecast { grid-column: 1; }
  .field-note { grid-column: 2; min-height: 420px; }
}

@media (min-width: 1380px) {
  .dashboard-grid { grid-template-columns: 1.1fr .9fr .8fr; }
  .garden-map { grid-column: span 2; grid-row: auto; }
  .tasks { grid-column: 3; grid-row: span 2; }
  .forecast { grid-column: 1 / 3; }
  .field-note { grid-column: 1 / 3; min-height: 420px; }
}

@media (max-width: 370px) {
  .page-head h1 { font-size: 2.05rem; }
  .garden-brief h2 { font-size: 1.95rem; }
  .weather > span { font-size: 9px; }
  .metric { padding: 13px; }
  .panel { padding: 14px; }
  .bed { min-height: 104px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}
