@font-face {
  font-family: 'Zilla Slab';
  font-style: normal;
  font-weight: 600;
  src: url('/static/fonts/ZillaSlab-600.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Zilla Slab';
  font-style: normal;
  font-weight: 700;
  src: url('/static/fonts/ZillaSlab-700.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Karla';
  font-style: normal;
  font-weight: 400 700;
  src: url('/static/fonts/Karla-var.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Karla';
  font-style: italic;
  font-weight: 400;
  src: url('/static/fonts/Karla-italic.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  src: url('/static/fonts/PlexMono-400.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  src: url('/static/fonts/PlexMono-500.woff2') format('woff2');
  font-display: swap;
}

:root {
  --ground: #E3E8D3;
  --ground-2: #EDEFE0;
  --panel: #F4F1E1;
  --ink: #262B1C;
  --ink-soft: #57614A;
  --ink-faint: #8A9179;
  --moss: #4B5B2F;
  --moss-deep: #384522;
  --terracotta: #B35B37;
  --terracotta-deep: #8F4327;
  --marigold: #C98A2A;
  --chicory: #43678A;
  --aqua: #2C8C82;
  --line: #C7BC98;
  --line-soft: #DAD3B4;
  --stamp-red: #A63F2C;

  --shadow-ambient: 0 1px 2px rgba(38,43,28,0.04), 0 8px 24px -8px rgba(38,43,28,0.18);
  --hairline-lift: inset 0 1px 0 rgba(255,255,255,0.55);

  --font-display: 'Zilla Slab', Georgia, 'Iowan Old Style', serif;
  --font-body: 'Karla', -apple-system, 'Helvetica Neue', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #1D2216;
    --ground-2: #252B1C;
    --panel: #2A2E1F;
    --ink: #EAE6D2;
    --ink-soft: #ABB294;
    --ink-faint: #757C61;
    --moss: #8FAA5F;
    --moss-deep: #6E8A45;
    --terracotta: #DD8258;
    --terracotta-deep: #C96A3F;
    --marigold: #E7AC4E;
    --chicory: #83AACB;
    --aqua: #52C4B8;
    --line: #454B33;
    --line-soft: #363C27;
    --stamp-red: #DD6A50;
    --shadow-ambient: 0 1px 2px rgba(0,0,0,0.3), 0 12px 32px -10px rgba(0,0,0,0.55);
    --hairline-lift: inset 0 1px 0 rgba(255,255,255,0.06);
  }
}
:root[data-theme="dark"] {
  --ground: #1D2216;
  --ground-2: #252B1C;
  --panel: #2A2E1F;
  --ink: #EAE6D2;
  --ink-soft: #ABB294;
  --ink-faint: #757C61;
  --moss: #8FAA5F;
  --moss-deep: #6E8A45;
  --terracotta: #DD8258;
  --terracotta-deep: #C96A3F;
  --marigold: #E7AC4E;
  --chicory: #83AACB;
  --aqua: #52C4B8;
  --line: #454B33;
  --line-soft: #363C27;
  --stamp-red: #DD6A50;
  --shadow-ambient: 0 1px 2px rgba(0,0,0,0.3), 0 12px 32px -10px rgba(0,0,0,0.55);
  --hairline-lift: inset 0 1px 0 rgba(255,255,255,0.06);
}
:root[data-theme="light"] {
  --ground: #E3E8D3;
  --ground-2: #EDEFE0;
  --panel: #F4F1E1;
  --ink: #262B1C;
  --ink-soft: #57614A;
  --ink-faint: #8A9179;
  --moss: #4B5B2F;
  --moss-deep: #384522;
  --terracotta: #B35B37;
  --terracotta-deep: #8F4327;
  --marigold: #C98A2A;
  --chicory: #43678A;
  --aqua: #2C8C82;
  --line: #C7BC98;
  --line-soft: #DAD3B4;
  --stamp-red: #A63F2C;
  --shadow-ambient: 0 1px 2px rgba(38,43,28,0.04), 0 8px 24px -8px rgba(38,43,28,0.18);
  --hairline-lift: inset 0 1px 0 rgba(255,255,255,0.55);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
/* Tilled-soil texture: the existing dot-grid plus a faint diagonal furrow
   hatch, purely a background-image change — doesn't affect layout/flow. */
body {
  background-image:
    radial-gradient(circle at 1px 1px, rgba(0,0,0,0.05) 1px, transparent 0),
    repeating-linear-gradient(115deg, rgba(0,0,0,0.025) 0px, transparent 1.5px, transparent 34px);
  background-size: 14px 14px, auto;
}
@media (prefers-color-scheme: dark) {
  body { background-image:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,0.03) 1px, transparent 0),
    repeating-linear-gradient(115deg, rgba(255,255,255,0.02) 0px, transparent 1.5px, transparent 34px);
  }
}
:root[data-theme="dark"] body { background-image:
  radial-gradient(circle at 1px 1px, rgba(255,255,255,0.03) 1px, transparent 0),
  repeating-linear-gradient(115deg, rgba(255,255,255,0.02) 0px, transparent 1.5px, transparent 34px);
}
:root[data-theme="light"] body { background-image:
  radial-gradient(circle at 1px 1px, rgba(0,0,0,0.05) 1px, transparent 0),
  repeating-linear-gradient(115deg, rgba(0,0,0,0.025) 0px, transparent 1.5px, transparent 34px);
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-wrap: balance;
  margin: 0;
}
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
a { color: inherit; }
button { font-family: inherit; }

svg.icon { width: 1em; height: 1em; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: -0.15em; }

/* ===== Layout shell ===== */
.app {
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px 28px 60px;
  position: relative;
}

/* ===== Login / signup ===== */
.auth-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 340px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 30px 30px;
  box-shadow: 0 24px 60px -16px rgba(38,43,28,0.28), var(--shadow-ambient), var(--hairline-lift);
}
:root[data-theme="dark"] .auth-card { box-shadow: 0 24px 60px -16px rgba(0,0,0,0.5), var(--shadow-ambient), var(--hairline-lift); }
@media (prefers-color-scheme: dark) { .auth-card { box-shadow: 0 24px 60px -16px rgba(0,0,0,0.5), var(--shadow-ambient), var(--hairline-lift); } }

.auth-logo {
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  object-fit: contain;
}
.auth-wordmark {
  font-size: 25px;
  text-align: center;
  color: var(--moss-deep);
  margin: 0;
}
.auth-tagline {
  text-align: center;
  font-size: 12.5px;
  font-style: italic;
  color: var(--ink-soft);
  margin: 4px 0 26px;
}

.auth-form .form-row { margin-bottom: 16px; }
.auth-form .form-row label {
  text-align: center;
  font-size: 11px;
}
.auth-form input[type="email"],
.auth-form input[type="text"],
.auth-form input[type="password"] {
  display: block;
  width: 100%;
  text-align: center;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 12px 16px;
  background: var(--ground-2);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.auth-form input::placeholder { color: var(--ink-faint); }
.auth-form input:hover { border-color: var(--ink-faint); }
.auth-form input:focus {
  outline: none;
  border-color: var(--moss);
  background: var(--panel);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--moss) 16%, transparent);
}

.auth-hint { display: block; text-align: center; font-size: 11px; color: var(--ink-faint); margin-top: 7px; }
.auth-submit {
  width: 100%;
  justify-content: center;
  margin-top: 6px;
  border-radius: 14px;
  padding: 12px 16px;
  font-size: 14.5px;
  font-weight: 700;
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}
.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,0.16); }
.auth-submit:active { transform: translateY(0); }
.auth-submit:disabled { opacity: 0.65; transform: none; box-shadow: none; }
.auth-toggle { text-align: center; font-size: 13px; color: var(--ink-soft); margin: 18px 0 0; }
.auth-toggle a { color: var(--moss-deep); font-weight: 600; text-decoration: none; }
.auth-toggle a:hover { text-decoration: underline; }

/* ===== Header ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  position: relative;
  z-index: 45;
  overflow: hidden;
  box-shadow: var(--shadow-ambient), var(--hairline-lift);
}
.header .flourish-corner {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 132px;
  height: 92px;
  color: var(--moss);
  opacity: 0.55;
  pointer-events: none;
}
.wordmark { display: flex; align-items: center; gap: 10px; z-index: 1; }
.brand-mark { width: 34px; height: 34px; flex-shrink: 0; object-fit: contain; display: block; }
.wordmark-text { display: flex; flex-direction: column; line-height: 1.15; }
.wordmark .mark { font-size: 26px; color: var(--ink); }
.wordmark .tag { font-size: 12.5px; color: var(--ink-soft); font-style: italic; font-family: var(--font-body); }

.tabs { display: flex; gap: 4px; background: var(--ground-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px; z-index: 1; }
.tab-btn {
  border: none; background: transparent; cursor: pointer;
  padding: 8px 16px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-soft);
  display: flex; align-items: center; gap: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { background: var(--moss); color: #F6F4E6; }
.tab-btn:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--chicory); outline-offset: 2px; }

.header-actions { display: flex; gap: 10px; z-index: 1; }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border-radius: 8px; border: 1px solid var(--line);
  background: var(--ground-2); color: var(--ink);
  padding: 9px 14px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,0.08); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--terracotta); border-color: var(--terracotta-deep); color: #FBF3E9; }
.btn-primary:hover { background: var(--terracotta-deep); }
.btn-ghost { background: transparent; border-color: transparent; padding: 6px 8px; }
.btn-danger { background: transparent; border-color: var(--stamp-red); color: var(--stamp-red); }
.btn-danger:hover { background: var(--stamp-red); color: #FCEDE7; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ===== Main grid ===== */
.layout { display: grid; grid-template-columns: 1fr 320px; gap: 20px; margin-top: 20px; align-items: start; }
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; } }

.section-heading {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.section-heading h2 { font-size: 19px; }
.section-heading .sub { font-size: 12.5px; color: var(--ink-soft); font-family: var(--font-mono); }

.plot-heading-main { display: flex; align-items: center; gap: 4px; }
.plot-name-input {
  border: none; background: transparent; font-family: var(--font-display); font-weight: 700;
  font-size: 19px; color: var(--ink); padding: 4px 6px; border-radius: 6px; min-width: 80px;
  width: 80px; box-sizing: content-box;
}
.plot-name-input:hover, .plot-name-input:focus { background: var(--ground-2); }
.plot-name-measure {
  position: absolute; top: -9999px; left: -9999px; visibility: hidden; white-space: pre;
  font-family: var(--font-display); font-weight: 700; font-size: 19px;
}

/* ===== Garden map / plot canvas ===== */
.plot-canvas-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.plot-canvas-toolbar .btn { font-size: 12.5px; padding: 7px 12px; }
.plot-canvas-toolbar .btn.active { background: var(--moss); border-color: var(--moss-deep); color: #F6F4E6; }
.plot-canvas-hint { font-size: 11.5px; color: var(--ink-faint); }

.plot-canvas-wrap { position: relative; }

/* The grid is a real measuring tool: --map-grid is one unit (1 ft / 1 m) at
   the current zoom and --map-grid-major every 5, both set by renderPlots().
   Counting squares therefore measures the garden, which the old fixed 27px
   lines could not do. */
.plot-canvas {
  position: relative;
  --map-grid: 22px;
  --map-grid-major: 110px;
  background:
    repeating-linear-gradient(0deg, transparent, transparent calc(var(--map-grid-major) - 1px), var(--line) calc(var(--map-grid-major) - 1px), var(--line) var(--map-grid-major)),
    repeating-linear-gradient(90deg, transparent, transparent calc(var(--map-grid-major) - 1px), var(--line) calc(var(--map-grid-major) - 1px), var(--line) var(--map-grid-major)),
    repeating-linear-gradient(0deg, transparent, transparent calc(var(--map-grid) - 1px), var(--line-soft) calc(var(--map-grid) - 1px), var(--line-soft) var(--map-grid)),
    repeating-linear-gradient(90deg, transparent, transparent calc(var(--map-grid) - 1px), var(--line-soft) calc(var(--map-grid) - 1px), var(--line-soft) var(--map-grid)),
    var(--ground-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  min-height: 420px;
  overflow: auto;
}

.map-zoom-controls { display: flex; align-items: center; gap: 4px; }
.map-zoom-controls .btn { min-width: 30px; justify-content: center; }

/* A conventional map scale bar — a measured line plus the real distance it
   spans, so the drawing can be read without trusting the zoom percentage. */
.map-scale-bar { display: flex; align-items: center; gap: 7px; }
.map-scale-line {
  display: inline-block; height: 7px;
  border: 1px solid var(--ink-faint); border-top: none;
}
.map-scale-label { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-faint); }

/* Sits outside the canvas's own scroll area (overflow:auto above) so it
   stays pinned to the map's corner regardless of how far the tiles scroll. */
.plot-canvas-add-btn {
  position: absolute; top: 12px; right: 12px; z-index: 5;
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--moss); color: #F6F4E6; border: 1px solid var(--moss-deep);
  cursor: pointer; box-shadow: var(--shadow-ambient);
  transition: transform 0.12s cubic-bezier(.34,1.56,.64,1), box-shadow 0.15s ease;
}
.plot-canvas-add-btn svg.icon { font-size: 18px; }
.plot-canvas-add-btn:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.18); transform: translateY(-1px); }
.plot-canvas-add-btn:active { transform: scale(0.94); }

.plot {
  position: absolute;
  background: var(--panel);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  cursor: grab;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
  background-image: radial-gradient(circle at 3px 3px, rgba(0,0,0,0.05) 1px, transparent 0);
  background-size: 9px 9px;
  touch-action: none;
  box-shadow: var(--shadow-ambient), var(--hairline-lift);
  /* Lets the rules below react to the tile's own resized box (not the
     viewport) — content adapts live while dragging the resize handle,
     with no JS involved, since the browser recomputes container queries
     continuously as width/height change. */
  container-type: size;
  container-name: plot;
}
.plot:active { cursor: grabbing; }
/* A round bed is drawn round — the map is a scale drawing, so shape has to
   survive onto it the same way size does. */
.plot.plot-round { border-radius: 50%; }
/* Holds the tile's contents so a rotated bed can counter-rotate its labels
   back upright without untwisting the bed outline itself. */
.plot-inner {
  position: absolute; inset: 0; padding: 10px 12px;
  display: flex; flex-direction: column; justify-content: space-between;
  min-width: 0; overflow: hidden;
}
.plot.plot-round .plot-inner { padding: 14px 16px; }
@media (prefers-color-scheme: dark) {
  .plot { background-image: radial-gradient(circle at 3px 3px, rgba(255,255,255,0.04) 1px, transparent 0); }
}
:root[data-theme="dark"] .plot { background-image: radial-gradient(circle at 3px 3px, rgba(255,255,255,0.04) 1px, transparent 0); }
:root[data-theme="light"] .plot { background-image: radial-gradient(circle at 3px 3px, rgba(0,0,0,0.05) 1px, transparent 0); }

.plot:hover { box-shadow: 0 6px 16px rgba(0,0,0,0.10), var(--shadow-ambient), var(--hairline-lift); border-color: var(--moss); }
.plot.selected { border-color: var(--moss); box-shadow: 0 0 0 2px var(--moss) inset; }

.plot-resize-handle {
  position: absolute; right: -5px; bottom: -5px; width: 14px; height: 14px;
  border-radius: 3px; background: var(--moss); border: 1.5px solid var(--panel);
  cursor: nwse-resize; opacity: 0; transition: opacity 0.12s ease;
}
.plot:hover .plot-resize-handle { opacity: 1; }

.plot-name {
  font-family: var(--font-display); font-weight: 700; color: var(--ink);
  /* overflow-wrap, not word-break: a narrow tile should wrap "Zelišča in
     Solata" between words and clip, never split a word into "Papr / ika". */
  font-size: 15px; line-height: 1.25; overflow-wrap: break-word; word-break: normal;
  max-height: 38px; overflow: hidden; flex-shrink: 0;
  padding-right: 64px; /* clears the pinned water/fertilize buttons */
}

/* Pinned to the card's own top-right corner — position:absolute takes it
   completely out of the flex flow, so it never affects the stack below and
   stays put regardless of how the card is resized. */
.plot-care-pinned { position: absolute; top: 8px; right: 8px; z-index: 2; display: flex; gap: 6px; }
/* Distinct from the plain "log a watering" button beside it: this one opens a
   real valve, so it carries the irrigation accent rather than a care state. */
.plot-irrigation-run-btn { border-color: var(--aqua); color: var(--aqua); }
.plot-irrigation-run-btn:hover { background: var(--aqua); color: var(--panel); }
.plot-care-btn {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--line); background: var(--ground-2);
  color: var(--ink-soft); cursor: pointer;
  transition: transform 0.12s cubic-bezier(.34,1.56,.64,1), border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.plot-care-btn svg.icon { font-size: 15px; }
.plot-care-text { display: none; }
.plot-care-btn:hover { transform: translateY(-1px) scale(1.06); box-shadow: 0 3px 8px rgba(0,0,0,0.18); }
.plot-care-btn:active { transform: scale(0.9); }
.plot-care-btn.ok { border-color: var(--moss); color: var(--moss-deep); }
.plot-care-btn.due { border-color: var(--marigold); color: #8a6300; background: color-mix(in srgb, var(--marigold) 16%, var(--ground-2)); }
.plot-care-btn.overdue { border-color: var(--stamp-red); color: var(--stamp-red); background: color-mix(in srgb, var(--stamp-red) 12%, var(--ground-2)); }
@media (prefers-color-scheme: dark) {
  .plot-care-btn.due { color: var(--marigold); }
}
:root[data-theme="dark"] .plot-care-btn.due { color: var(--marigold); }

/* A satisfying tap-bounce, independent of whatever the click then opens. */
.plot-care-btn.pop { animation: plot-care-pop 0.4s cubic-bezier(.34,1.56,.64,1); }
@keyframes plot-care-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.35); box-shadow: 0 4px 14px rgba(0,0,0,0.22); }
  100% { transform: scale(1); }
}

.plot-care-empty {
  font-size: 11.5px; color: var(--ink-faint); font-style: italic;
  flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center;
}

/* flex: 1 1 auto makes this row claim all the leftover height between the
   name and the footer (instead of sitting as a thin auto-height strip with
   blank space above/below it), and container-type:size on it re-scopes the
   crop icons' cqw/cqh below to that grown area rather than the whole card —
   so icons actually grow into the space instead of leaving it empty. */
.plot-meta-row {
  display: flex; align-items: center; gap: 6px;
  flex: 1 1 auto; min-height: 0;
  container-type: size;
}
/* Spreads across the row's full width regardless of how many icons there
   are — space-evenly (not space-between) so even a single plant lands
   centered rather than pinned to one edge, still reading as "using" the
   whole width instead of just the one it needs. */
.plot-crops { display: flex; flex: 1 1 auto; gap: 6px; flex-wrap: wrap; min-width: 0; justify-content: space-evenly; align-items: center; align-content: center; }
.plot-crop-icon {
  color: var(--moss-deep); flex-shrink: 0; display: inline-flex; cursor: default;
  /* Sized mainly off the crop row's own (grown) box — cqw/cqh here resolve
     against .plot-meta-row's container, not the whole card — with a high-
     coefficient /crop-n term kept only as a safety net for many plants;
     flex-wrap above lets icons wrap into a fuller multi-row grid instead of
     shrinking to cram into one thin line. */
  font-size: clamp(20px, min(16cqw, 45cqh, calc(260cqw / var(--crop-n, 1))), 46px);
  /* --bend/--lift are driven continuously by wireCropWave's mousemove (a
     per-icon lean-away-from-cursor amount, strongest closest to the
     pointer) — bottom-pivoted so each icon bends like a blade of grass
     rooted in place rather than spinning around its own center, and the
     transition is what turns discrete JS updates into a fluid sway that
     settles back upright once the cursor moves off. */
  transform-origin: bottom center;
  transform: rotate(calc(var(--bend, 0) * 1deg)) translateY(calc(var(--lift, 0) * -1px));
  transition: transform 0.22s cubic-bezier(.22, 1, .36, 1);
  position: relative;
}
.plot-crop-icon::after {
  content: attr(data-label);
  position: absolute; bottom: 100%; left: 50%;
  transform: translate(-50%, -4px) scale(0.85);
  padding: 4px 8px; border-radius: 6px;
  background: var(--ink); color: var(--panel);
  font-family: var(--font-body); font-size: 11px; font-weight: 600; white-space: nowrap;
  pointer-events: none; opacity: 0;
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 20;
}
.plot-crop-icon:hover {
  /* .plot-crop-icon's own `transform` above already makes it a stacking
     context, so the ::after's z-index only wins locally — without this the
     label paints underneath .plot-care-pinned (z-index: 2) whenever a crop
     icon sits near the top of the card. */
  z-index: 5;
}
.plot-crop-icon:hover::after {
  opacity: 1;
  transform: translate(-50%, -8px) scale(1);
}

.plot-group-line {
  display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 10.5px; color: var(--ink-faint);
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft);
}
.plot-group-name { display: flex; align-items: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plot-group-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 5px; flex-shrink: 0; }
.plot-dim { font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-faint); flex-shrink: 0; display: inline-flex; align-items: center; gap: 3px; }
.plot-dim svg.icon { font-size: 8px; }

/* Only revealed once the tile is resized tall enough (see @container rule
   below) — hidden by default so a short tile never has to pay for it. */
.plot-recent-activity {
  display: none; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft);
  flex-direction: column; gap: 4px;
}
.plot-recent-activity-title {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-faint); font-weight: 600; margin-bottom: 2px;
}
.plot-activity-row { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; color: var(--ink-soft); }
.plot-activity-date { font-family: var(--font-mono); color: var(--ink-faint); flex-shrink: 0; }

/* Progressive simplification, now load-bearing: tiles are sized by the bed's
   real dimensions, so a small bed genuinely IS a small tile and the content
   has to give way rather than inflate the drawing. Each tier drops the least
   essential thing left, ending at a bare marker for beds too small to label
   at the current zoom — zoom in and the detail comes back. Driven purely by
   the tile's own box via container-type:size, so it re-tiers live while
   zooming or dragging the resize handle, with no JS resize-tracking. */
@container plot (min-height: 260px) {
  .plot-recent-activity { display: flex; }
}
/* Tier 1 — drop the group/dimensions footer. */
@container plot (max-height: 140px) {
  .plot-group-line { display: none; }
}
/* Tier 2 — drop the crop icons and the "no plants yet" filler. */
@container plot (max-height: 96px) {
  .plot-meta-row, .plot-care-empty { display: none; }
}
/* Tier 3 — the care buttons stop fitting beside the name; shrink and
   unpin them so the name keeps the full width. */
@container plot (max-width: 130px) {
  .plot-name { padding-right: 0; font-size: 12.5px; }
  .plot-care-pinned { position: static; justify-content: flex-end; margin-top: auto; }
  .plot-care-btn { width: 22px; height: 22px; }
  .plot-care-btn svg.icon { font-size: 12px; }
}
/* Tier 4 — name only, clipped to a single line. */
@container plot (max-height: 62px) {
  .plot-care-pinned { display: none; }
  .plot-inner { padding: 5px 7px; justify-content: center; }
  .plot-name {
    font-size: 11px; max-height: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
}
/* Tier 5 — too small to letter at all: the tile becomes a plain marker.
   The name still exists for hover/screen readers, just isn't painted. */
@container plot ((max-width: 54px) or (max-height: 34px)) {
  .plot-inner { display: none; }
}

/* Below MAP_TINY_TILE_W/H the tile carries no text at all — renderPlots
   prints the name just outside it instead (.plot-outside-label), the way a
   garden plan labels a narrow bed rather than squeezing letters into it. */
.plot.plot-tiny .plot-inner { display: none; }
.plot-outside-label {
  position: absolute;
  transform: translateX(-50%);
  font-family: var(--font-display); font-weight: 700; font-size: 11.5px;
  color: var(--ink-soft); white-space: nowrap;
  /* Purely a label: clicks belong to the tile it names, not to the text. */
  pointer-events: none;
}

.empty-state { color: var(--ink-faint); font-size: 13.5px; padding: 8px 4px; }

/* ===== Right rail ===== */
.rail-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px; margin-bottom: 18px;
  box-shadow: var(--shadow-ambient), var(--hairline-lift);
}
.rail-card h3 { font-size: 15.5px; display: flex; align-items: center; gap: 7px; }
.rail-card .rail-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }

.weather-now { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.weather-now-icon { font-size: 40px; color: var(--moss-deep); flex-shrink: 0; }
.weather-now-main { min-width: 0; }
.weather-now-temp { font-family: var(--font-display); font-weight: 700; font-size: 26px; color: var(--ink); line-height: 1; }
.weather-now-desc { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; }
.weather-now-meta { display: flex; gap: 12px; font-size: 11.5px; color: var(--ink-soft); font-family: var(--font-mono); margin-bottom: 14px; flex-wrap: wrap; }
.weather-now-meta span { display: flex; align-items: center; gap: 4px; }
.weather-forecast { display: flex; gap: 2px; overflow-x: auto; padding-bottom: 2px; }
.weather-day { flex: 1; min-width: 36px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; border-radius: 7px; }
.weather-day:hover { background: var(--ground-2); }
.weather-day-name { font-size: 10px; text-transform: uppercase; color: var(--ink-faint); font-family: var(--font-mono); }
.weather-day-icon { font-size: 18px; color: var(--moss-deep); margin: 2px 0; }
.weather-day-hi { font-size: 12px; font-weight: 600; color: var(--ink); }
.weather-day-lo { font-size: 11px; color: var(--ink-faint); }
.weather-day-precip { font-size: 9.5px; color: var(--chicory); font-family: var(--font-mono); }

/* Frost warning — only ever shown for frost forecast inside the growing
   season, so it stays rare enough to keep its urgency. */
.weather-frost-alert {
  /* The icon now sets the pace: it's a definite square, and the box grows to
     fit it (see the icon rule below). Centred rather than stretched, since
     nothing is being sized off the box's height any more. */
  display: flex; align-items: center; gap: 11px;
  /* down by two-thirds from 9px 11px */
  padding: 3px 3.67px; margin-bottom: 10px;
  border: 1.5px solid; border-radius: 9px;
}
.weather-frost-alert.hard {
  border-color: var(--stamp-red);
  background: color-mix(in srgb, var(--stamp-red) 12%, transparent);
}
.weather-frost-alert.light {
  border-color: var(--marigold);
  background: color-mix(in srgb, var(--marigold) 14%, transparent);
}
/* Colours are set on the icon's own elements (red triangle, amber snowflake),
   so there's nothing severity-dependent to style here.
   Overrides svg.icon's 1em box: this one is sized by the alert's height
   instead, squaring itself off the stretched height via aspect-ratio. */
/* Selector must out-specify `svg.icon { width:1em; height:1em }` (0,1,1) or
   the sizing below is silently ignored and the icon stays 1em. */
svg.icon.weather-frost-alert-icon {
  flex-shrink: 0; align-self: center;
  /* Width is set independently (a clamped share of the rail) and the height
     follows it via aspect-ratio, so the icon is a definite square that the
     box sizes itself around. Deliberately the reverse of deriving width from
     a stretched height, which is circular — wider icon, narrower text,
     taller text, wider icon — and measurably diverged to 242x367. */
  width: clamp(56px, 30%, 104px);
  height: auto; aspect-ratio: 1;
}
.weather-frost-alert-body {
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
  min-width: 0;
}
.weather-frost-alert-body strong { font-size: 13px; color: var(--ink); }
.weather-frost-alert-body span { font-size: 11.5px; color: var(--ink-soft); line-height: 1.35; }
/* Two classes deep so it out-specifies the `.weather-frost-alert-body span`
   rule above (0,1,1) — a single class would lose and be ignored. */
.weather-frost-alert-body .weather-frost-alert-temp {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink); font-weight: 600;
}

/* The matching days in the forecast strip below the banner. */
.weather-day.frost-hard, .weather-day.frost-light { position: relative; }
.weather-day.frost-hard { background: color-mix(in srgb, var(--stamp-red) 12%, transparent); }
.weather-day.frost-light { background: color-mix(in srgb, var(--marigold) 14%, transparent); }
.weather-day.frost-hard .weather-day-lo { color: var(--stamp-red); font-weight: 700; }
.weather-day.frost-light .weather-day-lo { color: var(--marigold); font-weight: 700; }

/* "Plant next" rail card */
.plant-next-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 6px; border-bottom: 1px solid var(--line-soft);
  border-left: 2.5px solid transparent; border-radius: 4px;
  cursor: pointer; transition: background 0.12s ease;
}
.plant-next-row:last-child { border-bottom: none; }
.plant-next-row:hover { background: var(--ground-2); }
/* A window about to close is the one worth acting on today. */
.plant-next-row.urgent { border-left-color: var(--marigold); }
.plant-next-row.upcoming { cursor: default; opacity: 0.75; }
.plant-next-row.upcoming:hover { background: transparent; }
.plant-next-body { min-width: 0; }
.plant-next-name {
  font-size: 13px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.plant-next-meta { font-size: 11px; color: var(--ink-faint); }
.plant-next-window {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-soft);
  white-space: nowrap; flex-shrink: 0;
}
.plant-next-row.urgent .plant-next-window { color: var(--marigold); font-weight: 600; }
/* Expanded, the full list can run to 20+ rows — cap it and scroll rather
   than letting it stretch the whole rail. */
#railPlantNext.expanded { max-height: 320px; overflow-y: auto; }
.plant-next-more {
  display: block; width: 100%; text-align: left;
  background: none; border: none; cursor: pointer; font-family: inherit;
  font-size: 11px; color: var(--ink-faint); padding: 6px 6px 0;
}
.plant-next-more:hover { color: var(--ink-soft); }
.plant-next-upcoming { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line-soft); }
.plant-next-upcoming-label {
  display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-faint); font-family: var(--font-mono); margin-bottom: 3px;
}

.group-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 4px; border-bottom: 1px solid var(--line-soft);
}
.group-row:last-child { border-bottom: none; }
.group-name-wrap { display: flex; align-items: center; gap: 8px; }
.group-swatch { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.group-name { font-weight: 600; font-size: 13.5px; }
.group-count { font-size: 11.5px; color: var(--ink-faint); font-family: var(--font-mono); }
.icon-btn { background: none; border: none; cursor: pointer; color: var(--ink-faint); padding: 4px; border-radius: 5px; }
.icon-btn:hover { color: var(--moss); background: var(--ground-2); }
.icon-btn.confirm-armed, .icon-btn.confirm-armed:hover { color: #FCEDE7; background: var(--stamp-red); }
.btn-danger.confirm-armed { background: var(--stamp-red); color: #FCEDE7; }

.ticket {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 0; border-bottom: 1px solid var(--line-soft);
}
.ticket:last-child { border-bottom: none; }
.ticket-icon {
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; border: 1px solid var(--line);
}
.ticket-body { flex: 1; min-width: 0; }
.ticket-title { font-size: 13px; font-weight: 600; }
.ticket-item { font-size: 11.5px; font-weight: 500; font-style: italic; color: var(--ink-soft); }
.ticket-meta { font-size: 11.5px; color: var(--ink-soft); font-family: var(--font-mono); }
.stamp {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 6px; border-radius: 4px; border: 1px solid currentColor; flex-shrink: 0;
}
.stamp.today { color: var(--marigold); }
.stamp.tomorrow { color: var(--chicory); }
.stamp.later { color: var(--ink-faint); }
.stamp.overdue { color: var(--stamp-red); }

/* ===== Detail drawer ===== */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(20,18,10,0.35);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease; z-index: 40;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 112px; right: 0; height: calc(100% - 112px); width: 400px; max-width: 92vw;
  background: var(--panel); border-left: 1px solid var(--line); border-top: 1px solid var(--line);
  border-top-left-radius: 10px;
  box-shadow: -8px 0 30px rgba(0,0,0,0.15);
  transform: translateX(100%); transition: transform 0.25s ease; z-index: 41;
  padding: 22px; overflow-y: auto;
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 4px; }
.plant-real-name { font-size: 12px; color: var(--ink-soft); font-style: italic; margin-top: -2px; }
.drawer-actions { display: flex; gap: 6px; }
.drawer-dim { font-family: var(--font-mono); color: var(--ink-soft); font-size: 12.5px; margin-bottom: 18px; }

.sensor-row { display: flex; gap: 12px; margin-bottom: 18px; }
.sensor-tile { flex: 1; background: var(--ground-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.sensor-tile .label { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.05em; display: flex; align-items: center; gap: 5px; }
.sensor-tile .value { font-family: var(--font-mono); font-size: 20px; font-weight: 500; margin-top: 4px; color: var(--ink-faint); }
.sensor-tile .value.unset { font-size: 13px; font-style: italic; font-family: var(--font-body); }

.drawer-section-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); margin: 18px 0 10px; }
.task-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 7px; background: var(--ground-2);
}
.task-row .ticket-icon { background: var(--panel); }

/* ===== Plants ===== */
.plant-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px;
  margin-bottom: 7px; background: var(--ground-2); cursor: pointer; transition: border-color 0.12s ease;
}
.plant-row:hover { border-color: var(--moss); }
.plant-row-icon {
  width: 32px; height: 32px; border-radius: 7px; flex-shrink: 0; background: var(--panel); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; color: var(--moss-deep); font-size: 18px;
}
.plant-row-body { min-width: 0; flex: 1; }
.plant-row-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plant-row-latin { font-style: italic; font-weight: 400; color: var(--ink-soft); font-size: 12px; }
.plant-row-meta { font-size: 11.5px; color: var(--ink-soft); font-family: var(--font-mono); }

.plant-photo {
  width: 100%; height: 150px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line);
  margin-bottom: 14px; display: block;
}

.plant-stage-banner {
  display: flex; align-items: center; gap: 12px; background: var(--ground-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 12px 14px; margin-bottom: 18px;
}
.plant-stage-icon-wrap {
  width: 42px; height: 42px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; color: var(--moss-deep); font-size: 24px; flex-shrink: 0;
}
.plant-stage-label { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.plant-stage-sub { font-size: 12px; color: var(--ink-soft); font-family: var(--font-mono); }

.history-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft);
}
.history-row:last-child { border-bottom: none; }
.history-add-row {
  display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap;
}
.history-add-row select, .history-add-row input[type="date"], .history-add-row input[type="time"] {
  border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; background: var(--ground-2); color: var(--ink);
  font-family: var(--font-body); font-size: 12.5px;
}
.history-add-row input[type="text"] {
  flex: 1; min-width: 100px; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-body); font-size: 12.5px;
}
.history-add-row .btn { padding: 8px 10px; }

/* ===== Bed Yard (graphical planting) ===== */
.yard-search { position: relative; margin-bottom: 12px; }
.yard-search input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-body); font-size: 14px;
}
.yard-search-results {
  display: none; flex-direction: column; gap: 6px;
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px; max-height: 340px; overflow-y: auto;
  box-shadow: 0 14px 34px rgba(0,0,0,0.28);
}
.yard-search-results.open { display: flex; }
.yard-result-chip {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--ground-2);
  cursor: grab; user-select: none; touch-action: none; flex-shrink: 0;
}
.yard-result-chip:active { cursor: grabbing; }
.yard-result-chip:hover { border-color: var(--moss); }
.yard-result-icon {
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0; background: var(--panel);
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  color: var(--moss-deep); font-size: 16px; overflow: hidden;
}
.yard-result-icon img { width: 100%; height: 100%; object-fit: cover; }
.yard-result-body { flex: 1; min-width: 0; }
.yard-result-name { font-size: 13px; font-weight: 600; }
.yard-result-name em { font-style: normal; color: var(--moss-deep); }
.yard-result-latin { font-style: italic; font-size: 11.5px; color: var(--ink-soft); }
.yard-result-spacing { font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); flex-shrink: 0; }
.yard-hint { font-size: 11.5px; color: var(--ink-faint); margin: 2px 0 10px; }

.yard-grid-panel {
  position: sticky; top: -8px; margin: -8px -8px 6px; padding: 10px 10px 8px;
  background: var(--panel); border-bottom: 1px solid var(--line-soft); z-index: 1;
}
.yard-planting-method-toggle { margin-bottom: 8px; }
.yard-planting-method-toggle button { padding: 5px 12px; font-size: 12.5px; }
.yard-grid-toggle { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink); cursor: pointer; user-select: none; }
.yard-grid-toggle input { accent-color: var(--moss); width: 15px; height: 15px; }
.yard-grid-fields { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.yard-grid-fields label { display: flex; flex-direction: column; gap: 3px; font-size: 10.5px; color: var(--ink-soft); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.03em; }
.yard-grid-fields input {
  width: 52px; border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-mono); font-size: 13px;
}
.yard-grid-count { font-size: 11px; color: var(--moss-deep); font-weight: 600; margin-left: auto; align-self: flex-end; }

.nutrient-grid { margin-bottom: 16px; }
.nutrient-grid-group-label {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-faint); margin: 10px 0 6px;
}
.nutrient-grid-group-label:first-child { margin-top: 0; }
.nutrient-grid-row { display: flex; gap: 8px; flex-wrap: wrap; }
.nutrient-field { display: flex; flex-direction: column; gap: 3px; font-size: 10.5px; color: var(--ink-soft); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.03em; }
.nutrient-field input {
  width: 52px; border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-mono); font-size: 13px;
}

.nutrient-received-sub { font-size: 11.5px; color: var(--ink-faint); margin: -4px 0 10px; }
.nutrient-received-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.nutrient-received-item {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: var(--ground-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 11px; min-width: 46px;
}
.nutrient-received-item .nutrient-received-label {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; color: var(--ink-faint); text-transform: uppercase;
}
.nutrient-received-item .nutrient-received-value { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--moss-deep); }
.nutrient-received-row.micro .nutrient-received-item { padding: 4px 8px; min-width: 36px; }
.nutrient-received-row.micro .nutrient-received-value { font-size: 11px; font-weight: 600; color: var(--ink-soft); }
.nutrient-received-row.micro .nutrient-received-label { font-size: 9px; }

.yard-add-new-chip {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px;
  border: 1.5px dashed var(--line); border-radius: 8px; background: transparent;
  cursor: pointer; flex-shrink: 0;
}
.yard-add-new-chip:hover { border-color: var(--terracotta); }
.yard-add-new-chip .yard-result-icon { color: var(--terracotta); }
.yard-add-new-chip .yard-result-latin { font-style: normal; }

.yard-add-form { padding: 4px; }
.yard-add-form .form-row { margin-bottom: 12px; }
.yard-add-form .form-row:last-of-type { margin-bottom: 8px; }

.trefle-lookup-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.trefle-lookup-row .btn { padding: 7px 11px; font-size: 12.5px; flex-shrink: 0; }
.trefle-lookup-hint { font-size: 11px; color: var(--ink-faint); flex: 1; min-width: 140px; }
.trefle-result-row {
  display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 7px;
  cursor: pointer; margin-bottom: 4px;
}
.trefle-result-row:hover { background: var(--ground-2); }
.trefle-result-thumb {
  width: 32px; height: 32px; border-radius: 7px; flex-shrink: 0; object-fit: cover;
  background: var(--panel); border: 1px solid var(--line);
}
.trefle-result-thumb-empty { display: flex; align-items: center; justify-content: center; color: var(--moss-deep); font-size: 16px; }
.trefle-result-body { flex: 1; min-width: 0; }
.trefle-result-name { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.trefle-result-name svg.icon { font-size: 13px; color: var(--moss-deep); }
.trefle-result-latin { font-style: italic; font-size: 11px; color: var(--ink-soft); }
.trefle-selected-row {
  display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 7px;
  background: var(--ground-2); border: 1px solid var(--moss); margin-bottom: 4px;
}
.trefle-selected-row .trefle-result-latin { font-style: normal; }

/* What the Trefle pick actually contributed — shown explicitly, since the
   data is sparse and the user should see it before it's attached. */
.trefle-pulled {
  padding: 8px 10px; margin-bottom: 8px;
  border: 1px solid var(--line-soft); border-radius: 7px;
}
.trefle-pulled-label {
  display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-faint); font-family: var(--font-mono); margin-bottom: 4px;
}
.trefle-pulled-row {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 11.5px; padding: 2px 0;
}
.trefle-pulled-row span:first-child { color: var(--ink-soft); }
.trefle-pulled-row span:last-child { font-family: var(--font-mono); color: var(--ink); }
.trefle-searched-by {
  font-size: 11px; color: var(--ink-faint); margin: 0 0 6px; line-height: 1.35;
}
.trefle-pulled-none, .trefle-pulled-note {
  font-size: 11px; color: var(--ink-faint); margin: 4px 0 0; line-height: 1.35;
}

.yard-canvas-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 6px; }

.yard-zoom-controls { display: flex; align-items: center; gap: 6px; }
.yard-zoom-btn {
  width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--ground-2); color: var(--ink); font-size: 16px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1; padding: 0;
}
.yard-zoom-btn:hover { border-color: var(--moss); color: var(--moss); }
.yard-zoom-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.yard-zoom-btn:disabled:hover { border-color: var(--line); color: var(--ink); }
.yard-zoom-fit { width: auto; padding: 0 12px; font-size: 12px; font-weight: 600; }
.yard-rotation-reset {
  width: auto; padding: 0 10px; gap: 5px; font-size: 12px; font-weight: 600; font-family: var(--font-mono);
}
.yard-labels-toggle.active, .yard-zone-toggle.active, .yard-grid-settings-toggle.active, .yard-nutrient-toggle.active,
.yard-irrigation-toggle.active {
  background: var(--moss); border-color: var(--moss); color: #F6F4E6;
}

.yard-nutrient-row { display: flex; align-items: center; gap: 8px; margin-top: -2px; margin-bottom: 8px; }
.nutrient-toggle-btn {
  width: 30px; height: 30px; border-radius: 7px; border: 1.5px solid var(--line);
  background: var(--ground-2); font-family: var(--font-mono); font-weight: 700; font-size: 12.5px;
  cursor: pointer; transition: transform 0.1s cubic-bezier(.34,1.56,.64,1), background 0.15s ease, color 0.15s ease;
}
.nutrient-toggle-btn:hover { transform: translateY(-1px); }
.nutrient-toggle-btn.n { color: var(--chicory); border-color: color-mix(in srgb, var(--chicory) 45%, var(--line)); }
.nutrient-toggle-btn.p { color: var(--marigold); border-color: color-mix(in srgb, var(--marigold) 45%, var(--line)); }
.nutrient-toggle-btn.k { color: var(--terracotta); border-color: color-mix(in srgb, var(--terracotta) 45%, var(--line)); }
.nutrient-toggle-btn.n.active { background: var(--chicory); border-color: var(--chicory); color: #F0F5FA; }
.nutrient-toggle-btn.p.active { background: var(--marigold); border-color: var(--marigold); color: #3A2A08; }
.nutrient-toggle-btn.k.active { background: var(--terracotta); border-color: var(--terracotta); color: #FBF3E9; }
.yard-nutrient-hint { font-size: 11px; color: var(--ink-faint); font-style: italic; }

.yard-nutrient-canvas {
  position: absolute; top: 0; left: 0; z-index: 0;
  pointer-events: none; image-rendering: auto;
}
.yard-zoom-label {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft);
  min-width: 44px; text-align: center; user-select: none;
}

.yard-canvas-viewport {
  position: relative; overflow: hidden;
  width: 100%; height: max(85vh, 700px);
  /* transparent, same width as the drag-over state, so nothing shifts when it appears */
  border: 1.5px solid transparent; border-radius: 8px;
  background: var(--ground); /* matches the page background, so the bed reads as floating on the page itself */
  transition: border-color 0.1s ease, box-shadow 0.1s ease;
  /* Without this, a touch drag on the empty margin around the bed (anywhere
     that isn't already covered by .yard-canvas's own touch-action:none) is
     read by the browser as "scroll/zoom the page" instead of reaching our
     pan/pinch pointer handlers below. */
  touch-action: none;
}
.yard-canvas-viewport.drag-over { border-color: var(--moss); box-shadow: 0 0 0 3px color-mix(in srgb, var(--moss) 25%, transparent); }
.yard-canvas-viewport.panning { cursor: grabbing; user-select: none; }

/* Fills the viewport as a fixed reference frame; panning translates this
   layer, independent of the bed's own free position within it. */
.yard-world { position: absolute; inset: 0; }

.yard-canvas {
  position: absolute; left: 50%; top: 50%;
  cursor: grab; touch-action: none;
  /* Grid line spacing is set inline per-bed (background-size), computed from
     the bed's configurable grid_size_in and the current zoom scale — this
     shorthand only supplies the line pattern + fallback tile size. */
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 18px 18px;
  background-color: var(--ground-2);
  /* outline (not border) so the bed's edge doesn't shift the coordinate system
     that plant positions and drag math are computed against */
  outline: 2px solid var(--line);
  outline-offset: -1px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}
.yard-canvas.dragging-bed { cursor: grabbing; }
/* Round beds/planters: width_ft == length_ft always (a diameter's bounding
   square), so a plain 50% radius traces a true circle. Deliberately no
   overflow:hidden — a plant dragged into a "corner" outside the drawn
   circle stays fully visible rather than silently vanishing. */
.yard-canvas.yard-canvas-round { border-radius: 50%; }
.yard-canvas.zone-tool-active { cursor: crosshair; }

.yard-zone {
  position: absolute; border: 1.5px dashed var(--chicory); border-radius: 4px;
  background: color-mix(in srgb, var(--chicory) 10%, transparent);
  cursor: pointer; z-index: 1;
}
.yard-zone:hover { background: color-mix(in srgb, var(--chicory) 20%, transparent); border-color: var(--moss); }
.yard-zone-label {
  position: absolute; top: 4px; left: 4px; transform-origin: top left;
  display: flex; flex-direction: column; gap: 1px; pointer-events: none;
  font-size: 10px; font-family: var(--font-mono); background: var(--panel);
  border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15); white-space: nowrap;
}
.yard-zone-name { font-weight: 700; color: var(--ink); font-family: var(--font-display); font-size: 11px; }
.yard-zone-count { color: var(--ink-faint); }

.yard-zone-draw-preview {
  position: absolute; border: 1.5px dashed var(--moss); border-radius: 4px;
  background: color-mix(in srgb, var(--moss) 15%, transparent);
  pointer-events: none; z-index: 2;
}
.yard-canvas.zones-hidden .yard-zone { display: none; }

/* Automatic irrigation's coverage rectangle — dotted (vs. zones' dashed) and
   a distinct hue so both overlays read as different tools when both are on
   the same bed. */
.yard-irrigation {
  position: absolute; border: 1.5px dotted var(--aqua); border-radius: 4px;
  background: color-mix(in srgb, var(--aqua) 10%, transparent);
  cursor: pointer; z-index: 1;
}
.yard-irrigation:hover { background: color-mix(in srgb, var(--aqua) 20%, transparent); }
.yard-irrigation-disabled { opacity: 0.5; }
.yard-irrigation-label {
  position: absolute; top: 4px; left: 4px; transform-origin: top left;
  display: flex; align-items: center; gap: 4px; pointer-events: none;
  font-size: 10px; font-family: var(--font-mono); background: var(--panel);
  border: 1px solid var(--line); border-radius: 4px; padding: 2px 6px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15); white-space: nowrap; color: var(--aqua);
}
.yard-irrigation-label svg { font-size: 12px; }
/* Sits in the zone's bottom-left, counter-rotated like the label above so it
   stays upright however the bed is turned. Only rendered for a zone wired to
   a real valve — see irrigationCanRunNow(). */
.yard-irrigation-run-btn {
  position: absolute; bottom: 4px; left: 4px; transform-origin: bottom left;
  display: flex; align-items: center; gap: 4px; cursor: pointer;
  font-size: 10px; font-family: var(--font-mono); background: var(--panel);
  border: 1px solid var(--aqua); border-radius: 4px; padding: 3px 7px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15); white-space: nowrap; color: var(--aqua);
}
.yard-irrigation-run-btn:hover { background: var(--aqua); color: var(--panel); }
.yard-irrigation-run-btn svg { font-size: 12px; }
.yard-irrigation-draw-preview {
  position: absolute; border: 1.5px dotted var(--aqua); border-radius: 4px;
  background: color-mix(in srgb, var(--aqua) 15%, transparent);
  pointer-events: none; z-index: 2;
}

.yard-selection-draw-preview {
  position: absolute; border: 1.5px dashed var(--chicory); border-radius: 4px;
  background: color-mix(in srgb, var(--chicory) 12%, transparent);
  pointer-events: none; z-index: 2;
}

.yard-rotate-handle {
  position: absolute; top: -34px; transform: translateX(-50%);
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--panel); border: 1.5px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--moss-deep); font-size: 13px;
  cursor: grab; touch-action: none;
}
.yard-rotate-handle::before {
  content: ""; position: absolute; top: 100%; left: 50%; width: 1px; height: 14px;
  background: var(--line); transform: translateX(-50%);
}
.yard-rotate-handle:hover { border-color: var(--moss); color: var(--moss); }
.yard-rotate-handle.rotating { cursor: grabbing; }

.yard-plant {
  position: absolute; z-index: 3;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--panel); border: 1.5px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--moss-deep); font-size: 17px;
  cursor: grab; touch-action: none;
}
.yard-plant:hover { border-color: var(--moss); box-shadow: 0 2px 6px rgba(0,0,0,0.15); z-index: 10; }
.yard-plant.selected { border-color: var(--chicory); box-shadow: 0 0 0 3px color-mix(in srgb, var(--chicory) 35%, transparent); }
/* Crop glyphs carry far more detail than the stage icons they replace, so
   they get a little more room in the same circle/tile to stay legible. */
svg.icon.icon-crop { width: 1.3em; height: 1.3em; }

/* Hidden for the duration of a group drag (see beginGroupDrag) — the live
   preview cluster stands in for these, so showing both at once would read
   as twice as many plants. */
.yard-plant.yard-plant-ghosted { opacity: 0; pointer-events: none; }
.yard-plant:active { cursor: grabbing; }
.yard-plant.quick-open {
  z-index: 20; border-color: var(--moss);
  animation: plant-quick-grow 0.36s cubic-bezier(.34, 1.56, .64, 1) forwards;
}
@keyframes plant-quick-grow {
  0% { transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(1); box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
  55% { transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(1.45); }
  100% { transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(1.26); box-shadow: 0 8px 20px rgba(0,0,0,0.28); }
}

.yard-plant-label {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  margin-top: 5px; white-space: nowrap; font-size: 10.5px; font-family: var(--font-mono);
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 4px;
  padding: 1px 6px; opacity: 0; pointer-events: none; transition: opacity 0.12s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15); z-index: 2;
}
.yard-plant:hover .yard-plant-label { opacity: 1; }
.yard-canvas.show-all-labels .yard-plant-label { opacity: 1; }

.yard-overlay { position: absolute; top: 0; left: 0; pointer-events: none; }
.yard-overlay text { font-family: var(--font-mono); }

.yard-compost-bin {
  position: absolute; top: 12px; left: 12px; z-index: 10;
  width: 60px; height: 60px; border-radius: 12px;
  background: var(--panel); border: 1.5px solid var(--line);
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); font-size: 30px; cursor: pointer;
}
.yard-compost-bin:hover { border-color: var(--terracotta); color: var(--terracotta); }
.yard-compost-bin.compost-drag-over {
  border-color: var(--terracotta); background: color-mix(in srgb, var(--terracotta) 18%, var(--panel));
  color: var(--terracotta); transform: scale(1.2);
}
.yard-compost-bin.compost-bin-flash { animation: compost-bin-flash-anim 0.5s ease; }
@keyframes compost-bin-flash-anim {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); border-color: var(--terracotta); }
  100% { transform: scale(1); }
}

.compost-entry { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 10px; }
.compost-entry-head { display: flex; align-items: center; gap: 10px; }
.compost-entry-body { flex: 1; min-width: 0; }
.compost-entry-head .btn { flex-shrink: 0; padding: 7px 11px; font-size: 12.5px; }
.compost-entry-history { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }

.drag-ghost {
  position: fixed; top: 0; left: 0; z-index: 100;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--moss);
  display: none; align-items: center; justify-content: center;
  color: var(--moss-deep); font-size: 19px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

/* ===== Bed Page (full-page bed editor) ===== */
.bed-page-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 20px; margin-bottom: 20px;
}
.bed-page-back {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: none;
  color: var(--ink-soft); font-size: 13px; font-weight: 600; cursor: pointer; padding: 6px 4px 6px 0;
  flex-shrink: 0;
}
.bed-page-back:hover { color: var(--moss); }
.bed-page-head .switch-toggle { width: 148px; flex-shrink: 0; }

/* A sliding two-state switch — used for Bed/Planter and Rect/Round in the
   bed page head. The checkbox drives everything via sibling selectors, so
   toggling is one `change` listener in JS with no active-class bookkeeping. */
.switch-toggle { display: inline-flex; cursor: pointer; user-select: none; }
.switch-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-toggle-track {
  position: relative; display: flex; width: 100%; height: 34px;
  background: var(--ground-2); border: 1.5px solid var(--line); border-radius: 17px;
  padding: 2px; box-sizing: border-box;
}
.switch-toggle-thumb {
  position: absolute; top: 2px; left: 2px; width: calc(50% - 2px); height: calc(100% - 4px);
  background: var(--moss); border-radius: 15px;
  transition: transform 0.2s cubic-bezier(.34,1.56,.64,1);
}
.switch-toggle input:checked ~ .switch-toggle-track .switch-toggle-thumb { transform: translateX(100%); }
.switch-toggle-label {
  position: relative; z-index: 1; flex: 1 1 50%;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
  transition: color 0.2s ease;
}
.switch-toggle-label svg.icon { font-size: 13px; }
.switch-toggle input:not(:checked) ~ .switch-toggle-track .switch-toggle-label-off,
.switch-toggle input:checked ~ .switch-toggle-track .switch-toggle-label-on { color: #F6F4E6; }
.switch-toggle input:focus-visible ~ .switch-toggle-track { outline: 2px solid var(--moss); outline-offset: 2px; }
.switch-toggle-locked { cursor: not-allowed; }
.switch-toggle input:disabled ~ .switch-toggle-track { opacity: 0.6; }
.switch-toggle input:disabled ~ .switch-toggle-track .switch-toggle-thumb { background: var(--ink-faint); }
.bed-page-name {
  flex: 1; min-width: 160px; border: none; background: transparent;
  font-family: var(--font-display); font-weight: 700; font-size: 22px; color: var(--ink);
  padding: 4px 6px; border-radius: 6px;
}
.bed-page-name:hover, .bed-page-name:focus { background: var(--ground-2); }
.bed-page-dim-field { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.bed-page-dim-field input {
  width: 68px; border: 1px solid var(--line); border-radius: 7px; padding: 7px 8px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-mono); font-size: 13px;
}
.bed-page-dim-field .unit { font-size: 11.5px; color: var(--ink-faint); }
.bed-page-head select {
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px;
  background: var(--ground-2); color: var(--ink); font-size: 13px; flex-shrink: 0; max-width: 160px;
}
.bed-page-create { flex-shrink: 0; }
.bed-page-saved-hint {
  font-size: 11px; color: var(--moss); font-family: var(--font-mono); opacity: 0;
  transition: opacity 0.2s ease; flex-shrink: 0;
}
.bed-page-saved-hint.visible { opacity: 1; }


/* ===== Schedule tab ===== */
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--ground-2); color: var(--ink-soft);
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.chip.active { background: var(--moss); border-color: var(--moss-deep); color: #F6F4E6; }

.day-group { margin-bottom: 22px; }
.day-label { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.day-label .dow { color: var(--ink-faint); font-family: var(--font-mono); font-weight: 400; font-size: 12px; text-transform: uppercase; }
.sched-list { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.sched-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.sched-row:last-child { border-bottom: none; }
.sched-row:hover { background: var(--ground-2); }
.sched-icon { width: 34px; height: 34px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 17px; flex-shrink: 0; }
.sched-title { font-weight: 600; font-size: 13.5px; }
.sched-target { font-size: 12px; color: var(--ink-soft); }
.sched-expand { margin-left: auto; color: var(--ink-faint); }

.pest-search-panel { padding: 14px 16px 16px; background: var(--ground-2); display: none; }
.pest-search-panel.open { display: block; }
.search-box { display: flex; gap: 8px; margin-bottom: 12px; }
.search-box input {
  flex: 1; border: 1px solid var(--line); border-radius: 7px; padding: 8px 12px; background: var(--panel); color: var(--ink); font-family: var(--font-body); font-size: 13px;
}
.product-card { display: flex; gap: 10px; align-items: center; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); margin-bottom: 8px; }
.product-icon { width: 34px; height: 34px; border-radius: 7px; background: var(--ground-2); display: flex; align-items: center; justify-content: center; font-size: 17px; color: var(--terracotta); flex-shrink: 0; }
.product-name { font-size: 13px; font-weight: 600; }
.product-store { font-size: 11.5px; color: var(--ink-soft); }
.product-price { font-family: var(--font-mono); font-weight: 500; font-size: 14px; margin-left: auto; color: var(--moss-deep); }

/* ===== Groups tab ===== */
.groups-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.group-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }

/* ===== Account & Sharing page ===== */
.account-page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; max-width: 760px; }
.account-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.account-card h3 { font-size: 15px; margin: 0; }
.account-card .sub { font-size: 12.5px; color: var(--ink-soft); }
.key-field-row { display: flex; gap: 6px; }
.key-field-row input {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-mono); font-size: 13px;
}
.key-field-row .icon-btn { border: 1px solid var(--line); border-radius: 7px; flex-shrink: 0; }

.govee-device-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line-soft);
}
.govee-device-row:last-child { border-bottom: none; }
.govee-device-name { font-size: 13px; font-weight: 600; min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.govee-device-controls { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.govee-reading { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-soft); }

.tuya-device { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.tuya-device:last-child { border-bottom: none; }
.tuya-device-name { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.tuya-zone-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.tuya-zone-row:last-child { margin-bottom: 0; }
.tuya-zone-label { font-size: 12px; color: var(--ink-soft); width: 46px; flex-shrink: 0; }
.tuya-zone-toggle { width: 66px; height: 26px; flex-shrink: 0; }
.tuya-zone-toggle .switch-toggle-track { height: 26px; }
.tuya-zone-toggle .switch-toggle-label { font-size: 10px; }
.tuya-zone-duration {
  width: 52px; border: 1px solid var(--line); border-radius: 6px; padding: 5px 6px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-mono); font-size: 12px;
}
.govee-pin-btn { flex-shrink: 0; }
.govee-pin-btn.active { color: var(--moss); }
.govee-pin-btn:hover { color: var(--moss); }
.group-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.group-title-edit { display: flex; align-items: center; gap: 8px; min-width: 0; }
.group-title-edit h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-card-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.group-popover { width: 260px; }

/* ---- Bed planning mode ---- */
.plans-card-list { display: flex; flex-direction: column; gap: 6px; }
.plans-card-row {
  display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--ground-2);
}
.plans-card-row.active { border-color: var(--chicory); background: color-mix(in srgb, var(--chicory) 12%, var(--ground-2)); }
.plans-card-name-input {
  flex: 1; min-width: 0; border: 1px solid transparent; background: transparent; color: var(--ink);
  font-size: 13px; padding: 3px 5px; border-radius: 5px; font-family: var(--font-body);
}
.plans-card-name-input:hover { border-color: var(--line); }
.plans-card-name-input:focus { border-color: var(--moss); background: var(--panel); outline: none; }
.plans-card-count { font-size: 10.5px; font-family: var(--font-mono); color: var(--ink-faint); white-space: nowrap; flex-shrink: 0; }
.plans-card-row .btn { padding: 4px 10px; font-size: 12px; flex-shrink: 0; }
.plans-card-row .icon-btn { flex-shrink: 0; }
.plans-card-new-row { display: flex; gap: 6px; align-items: center; margin-top: 10px; }
.plans-card-new-row input {
  flex: 1; min-width: 0; padding: 7px 9px; font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink);
  font-family: var(--font-body);
}
.plans-card-new-row input:focus { border-color: var(--moss); outline: none; }
.plans-card-new-row .btn { flex-shrink: 0; padding: 7px 11px; font-size: 12.5px; }

.yard-plan-banner {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 8px;
  border-radius: 10px; background: color-mix(in srgb, var(--chicory) 14%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--chicory) 35%, var(--line));
  color: var(--ink);
}
.yard-plan-banner-label { font-weight: 600; font-size: 13px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yard-plan-execute-btn { background: var(--moss); color: #fff; border-color: var(--moss); }
.yard-plan-execute-btn:hover { filter: brightness(1.08); }
.yard-plan-execute-btn[disabled] { opacity: 0.5; cursor: default; }

/* Unexecuted plan items read as drafts: dashed outline, no fill. Executed
   items are muted and carry a small checkmark badge, signalling "already
   real, editing here won't do anything more" without hiding them. */
.yard-canvas.plan-mode .yard-plant.plan-item-pending {
  border-style: dashed; border-color: var(--chicory); background: transparent;
}
.yard-canvas.plan-mode .yard-plant.plan-item-executed {
  opacity: 0.55; cursor: default;
}
.plan-item-executed-badge {
  position: absolute; bottom: -4px; right: -4px; width: 15px; height: 15px; border-radius: 50%;
  background: var(--moss); color: #fff; display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--panel);
}
.plan-item-executed-badge svg { width: 10px; height: 10px; }
.group-color-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.group-color-swatch {
  width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer;
  padding: 0; transition: transform 0.12s ease, border-color 0.12s ease;
}
.group-color-swatch:hover { transform: scale(1.1); }
.group-color-swatch.selected { border-color: var(--ink); }
.member-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--ground-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px 4px 6px; font-size: 12px; margin: 3px 4px 0 0; }
.member-chip .plot-group-dot { width: 6px; height: 6px; }

/* ===== The Shed ===== */
.shed-tabs { display: flex; gap: 8px; margin-bottom: 16px; }
.shed-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.shed-toolbar input {
  flex: 1; max-width: 320px; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-body); font-size: 14px;
}
.shed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 14px; }
.shed-card { display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; cursor: pointer; }
.shed-card:hover { border-color: var(--moss); }
.shed-card-icon {
  width: 40px; height: 40px; border-radius: 9px; flex-shrink: 0; background: var(--ground-2);
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center;
  color: var(--moss-deep); font-size: 19px;
}
.shed-card-body { flex: 1; min-width: 0; }
.shed-card-cat { font-size: 11px; color: var(--ink-faint); margin: 2px 0 6px; }
.shed-card-uses { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-soft); }
.shed-used-up-tag { color: var(--terracotta); font-weight: 600; }
.catalog-card-badge.shed-used-up-tag { border-color: var(--terracotta); }
.shed-card-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.shed-card-actions .btn { font-size: 11.5px; padding: 6px 10px; white-space: nowrap; }
.shed-usedup-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); margin: 4px 0 14px; cursor: pointer; }
.shed-usedup-toggle input { accent-color: var(--moss); width: 16px; height: 16px; }

.shed-detail-status {
  background: var(--ground-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 18px;
}
.shed-detail-uses-line { font-family: var(--font-mono); font-size: 13px; color: var(--ink); font-weight: 600; margin-bottom: 3px; }
.shed-uses-estimate { font-size: 12px; color: var(--ink-soft); margin-bottom: 10px; cursor: help; }
.shed-uses-estimate-tag { font-size: 10.5px; font-style: italic; color: var(--ink-faint); }
.shed-detail-status .btn { margin-top: 8px; }
.btn.confirm-armed { background: var(--marigold); border-color: var(--marigold); color: #3A2A08; }
.past-bed-card .shed-card-icon { color: var(--ink-faint); }
.shed-bed-status-tag {
  display: inline-block; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 2px 7px; border-radius: 999px; margin: 0 4px;
}
.shed-bed-status-tag.active { color: var(--moss-deep); background: color-mix(in srgb, var(--moss) 16%, transparent); }
.shed-bed-status-tag.past { color: var(--ink-faint); background: var(--ground-2); }

.view { display: none; }
.view.active { display: block; }

.footer-note { text-align: center; color: var(--ink-faint); font-size: 11.5px; margin-top: 34px; font-style: italic; font-family: var(--font-display); }

/* ===== Bed Designer modal ===== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,18,10,0.4);
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease; z-index: 50;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -46%) scale(0.97);
  width: 460px; max-width: 92vw; max-height: 88vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  padding: 22px 24px 24px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 51;
}
.modal.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.modal-wide { width: 560px; }

/* ===== Plot location picker ===== */
.location-search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.location-search-row input[type="text"] {
  flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-body); font-size: 13.5px;
}
.location-map {
  height: 260px; border-radius: 10px; border: 1px solid var(--line); overflow: hidden;
  background: var(--ground-2); margin-bottom: 10px; position: relative;
}
.location-map .leaflet-container { background: var(--ground-2); font-family: var(--font-body); }
.location-map-fallback {
  height: 100%; display: flex; align-items: center; justify-content: center; text-align: center;
  color: var(--ink-soft); font-size: 13px; padding: 20px;
}
.location-coords-row { display: flex; gap: 12px; margin-bottom: 10px; }
.location-coords-row .form-row { flex: 1; margin-bottom: 0; }
.location-coords-row input[type="number"] {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-mono); font-size: 13px;
}
.location-label-line {
  display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-soft);
  margin-bottom: 14px; min-height: 18px;
}
.location-actions-row { display: flex; gap: 8px; justify-content: space-between; margin-bottom: 4px; }
.location-actions-row .left-actions { display: flex; gap: 8px; }

.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-head h2 { font-size: 20px; }

.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); margin-bottom: 7px; }
.form-row input[type="text"], .form-row input[type="date"], .form-row input[type="time"], .form-row input[type="number"], .form-row select, .form-row textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-body); font-size: 14px;
}
.form-row input[type="date"], .form-row input[type="time"] { font-family: var(--font-mono); font-size: 13px; }
.form-row textarea { resize: vertical; min-height: 44px; }
.dims-row { display: flex; gap: 12px; }
.dims-row .form-row { flex: 1; margin-bottom: 0; }
.dims-row input[type="number"] {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-mono); font-size: 14px;
}
.dims-row .unit { font-size: 12px; color: var(--ink-faint); margin-left: 4px; }

.type-toggle { display: flex; gap: 8px; }
.type-toggle button {
  flex: 1; padding: 10px; border-radius: 8px; border: 1.5px solid var(--line);
  background: var(--ground-2); color: var(--ink-soft); font-weight: 600; font-size: 13.5px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px;
}
.type-toggle button.active { border-color: var(--moss); background: var(--moss); color: #F6F4E6; }


.form-error {
  background: color-mix(in srgb, var(--stamp-red) 12%, transparent);
  border: 1px solid var(--stamp-red); color: var(--stamp-red);
  border-radius: 7px; padding: 9px 12px; font-size: 13px; margin-bottom: 16px; display: none;
}
.form-error.visible { display: block; }

.modal-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.modal-footer .right-actions, .modal-footer .left-actions { display: flex; gap: 8px; }

/* ===== Schedule editor (bed / zone / plant) ===== */
.schedule-target-name { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: var(--ink); margin: 14px 0 4px; }
.schedule-cat-tabs { display: flex; gap: 8px; margin: 14px 0 16px; }
.schedule-cat-tab {
  position: relative; flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px; border-radius: 8px; border: 1.5px solid var(--line); background: var(--ground-2);
  color: var(--ink-soft); font-weight: 600; font-size: 13px; cursor: pointer;
}
.schedule-cat-tab.active { border-color: var(--moss); background: var(--moss); color: #F6F4E6; }
.schedule-cat-dot {
  position: absolute; top: 5px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--chicory);
}
.schedule-cat-tab.active .schedule-cat-dot { background: #F6F4E6; }
.schedule-info-line { font-size: 12.5px; color: var(--ink-soft); margin-bottom: 14px; }
.schedule-recurrence-toggle { margin-bottom: 14px; }
.schedule-weekday-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.schedule-weekday-btn {
  flex: 1; min-width: 40px; padding: 8px 0; border-radius: 7px; border: 1.5px solid var(--line);
  background: var(--ground-2); color: var(--ink-soft); font-weight: 600; font-size: 12px; cursor: pointer;
}
.schedule-weekday-btn.active { border-color: var(--chicory); background: var(--chicory); color: #262111; }
.schedule-warning {
  display: flex; align-items: center; gap: 8px; background: color-mix(in srgb, var(--stamp-red) 12%, transparent);
  border: 1px solid var(--stamp-red); color: var(--stamp-red); border-radius: 8px; padding: 10px 12px;
  font-size: 12.5px; margin-bottom: 14px;
}
.schedule-warning svg.icon { flex-shrink: 0; font-size: 15px; }
.zone-popover-schedule { width: 100%; justify-content: center; margin-top: 8px; }

/* ===== Care action popover (water/fertilize a whole bed) ===== */
.care-popover {
  position: fixed; z-index: 60; width: 240px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,0.25);
  padding: 16px 18px;
  opacity: 0; pointer-events: none;
  transform-origin: var(--pop-origin-x, 50%) var(--pop-origin-y, 0%);
  transform: scale(0.85) translateY(6px);
  transition: opacity 0.15s ease, transform 0.22s cubic-bezier(.34, 1.56, .64, 1);
}
.care-popover.open { opacity: 1; pointer-events: auto; transform: scale(1) translateY(0); }

.care-popover-close {
  position: absolute; top: 8px; right: 8px; background: none; border: none;
  color: var(--ink-faint); cursor: pointer; padding: 4px; border-radius: 5px; font-size: 14px;
}
.care-popover-close:hover { color: var(--ink); background: var(--ground-2); }

.care-popover-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding-right: 16px; }
.care-popover-icon {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  background: var(--ground-2); border: 1px solid var(--line); color: var(--moss-deep);
}
.care-popover-title { font-family: var(--font-display); font-weight: 700; font-size: 14.5px; color: var(--ink); }
.care-popover-sub { font-size: 11.5px; color: var(--ink-soft); font-family: var(--font-mono); margin-top: 2px; }

.care-popover-confirm {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 9px; padding: 11px; font-size: 13.5px; font-weight: 600;
  background: var(--moss); color: #F6F4E6; cursor: pointer;
  transition: transform 0.1s cubic-bezier(.34, 1.56, .64, 1), box-shadow 0.15s ease, opacity 0.15s ease;
}
.care-popover-confirm.fertilize { background: var(--marigold); color: #3A2A08; }
.care-popover-confirm:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.18); transform: translateY(-1px); }
.care-popover-confirm:active { transform: scale(0.96); }
.care-popover-confirm:disabled { cursor: default; }
.care-popover-confirm.loading svg.icon { animation: care-icon-pulse 0.7s ease-in-out infinite; }
.care-popover-confirm.loading { opacity: 0.75; }

@keyframes care-icon-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}

.care-success { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 10px 0 4px; }
.care-success-burst { position: relative; width: 56px; height: 56px; margin-bottom: 10px; }
.care-success-check {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0);
  width: 44px; height: 44px; border-radius: 50%; background: var(--moss); color: #F6F4E6;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  animation: care-check-pop 0.42s cubic-bezier(.34, 1.56, .64, 1) 0.1s forwards;
}
@keyframes care-check-pop {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
  60% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
.care-burst-particle {
  position: absolute; top: 50%; left: 50%; width: 7px; height: 7px; border-radius: 50%;
  background: var(--chicory); transform: translate(-50%, -50%) scale(0.5); opacity: 0;
  animation: care-burst-out 0.6s ease-out forwards;
}
.care-burst-particle.fertilize { background: var(--marigold); border-radius: 2px; }
@keyframes care-burst-out {
  0% { transform: translate(-50%, -50%) scale(0.4); opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1); opacity: 0; }
}
.care-success-text { font-family: var(--font-display); font-weight: 700; font-size: 14.5px; color: var(--ink); }

/* ===== Settings popover ===== */
.settings-popover { width: 260px; }
.settings-account-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--ground-2); color: var(--ink); text-decoration: none;
  font-size: 13px; font-weight: 600; transition: border-color 0.12s ease, background 0.12s ease;
}
.settings-account-link:hover { border-color: var(--moss); background: color-mix(in srgb, var(--moss) 8%, var(--ground-2)); }
.settings-account-link svg.icon { font-size: 14px; color: var(--ink-faint); }
.invite-form-row { display: flex; gap: 6px; margin-bottom: 8px; }
.invite-form-row input[type="email"] {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-body); font-size: 12.5px;
}
.invite-form-row select {
  border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-body); font-size: 12.5px;
}
.invite-row {
  display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-soft);
}
.invite-row:last-child { border-bottom: none; }
.invite-row-main { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: 13px; }
.invite-row-main .sub { font-size: 11px; color: var(--ink-faint); }
.invite-role-select {
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 6px; font-size: 11.5px;
  background: var(--ground-2); color: var(--ink); flex-shrink: 0;
}

/* ===== Garden switcher popover ===== */
/* ===== Plot switcher ===== */
.garden-switcher-popover { width: 286px; padding: 12px; }

/* The owner of a plot that isn't yours, shown as a bare name beside the button
   label rather than inflected into a phrase. */
.plot-switcher-owner {
  margin-left: 6px; padding-left: 6px;
  border-left: 1px solid var(--line);
  color: var(--ink-faint); font-size: 12px;
}

/* Quiet dividing labels — they organise without competing with the plot names. */
.plot-switcher-section {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-faint); font-family: var(--font-mono);
  padding: 0 6px 6px;
}
.plot-switcher-section:not(:first-child) {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft);
}

.plot-switcher-option {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  border: 1px solid transparent; border-radius: 9px;
  background: transparent; color: var(--ink);
  padding: 8px 8px; margin-bottom: 2px;
  font-family: var(--font-body); cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
}
.plot-switcher-option:hover { background: var(--ground-2); }
.plot-switcher-option:active { transform: scale(0.985); }
/* Keyboard focus has to be as obvious as hover, or arrow-key nav feels blind. */
.plot-switcher-option:focus-visible,
.plot-switcher-new:focus-visible {
  outline: none; border-color: var(--moss);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--moss) 22%, transparent);
}
.plot-switcher-option.active {
  background: color-mix(in srgb, var(--moss) 10%, transparent);
  border-color: color-mix(in srgb, var(--moss) 40%, transparent);
}

/* Fixed-width gutter so every name starts on the same vertical line whether or
   not the row is the active one. */
.plot-switcher-mark {
  width: 16px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  color: var(--moss-deep);
}
.plot-switcher-mark svg.icon { font-size: 14px; }
.plot-switcher-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.plot-switcher-name {
  font-size: 13.5px; font-weight: 600; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.plot-switcher-meta {
  font-size: 11px; color: var(--ink-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.plot-switcher-option.active .plot-switcher-name { color: var(--moss-deep); }

/* "New plot" reads as an action, not another plot: dashed, accent-coloured,
   and separated from the list above it. */
.plot-switcher-new {
  display: flex; align-items: center; gap: 7px; width: 100%;
  margin-top: 8px; padding: 9px 10px;
  border: 1px dashed var(--line); border-radius: 9px;
  background: transparent; color: var(--moss-deep);
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.plot-switcher-new:hover {
  border-color: var(--moss); border-style: solid;
  background: color-mix(in srgb, var(--moss) 10%, transparent);
}
.plot-switcher-new svg.icon { font-size: 14px; }

/* Rows fade up in sequence as the popover springs open. Capped so a long list
   never leaves the last row lagging behind the container. */
.garden-switcher-popover.open .plot-switcher-option,
.garden-switcher-popover.open .plot-switcher-new {
  animation: plot-row-in 0.22s ease both;
  animation-delay: calc(min(var(--row-i, 0), 6) * 22ms);
}
@keyframes plot-row-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .garden-switcher-popover.open .plot-switcher-option,
  .garden-switcher-popover.open .plot-switcher-new { animation: none; }
}

/* ===== Zone popover (create + manage) ===== */
.zone-popover { width: 260px; }
.zone-popover-name-input {
  width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; margin-bottom: 2px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 14px;
}
.zone-popover .form-row input[type="text"] { margin: 0; }
.zone-popover-desc {
  width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-body); font-size: 12.5px;
  resize: vertical; min-height: 44px;
}
.zone-popover-actions { display: flex; gap: 8px; margin: 12px 0 10px; }
.zone-popover-actions .care-popover-confirm { padding: 9px; font-size: 12.5px; }
.zone-popover-delete { width: 100%; justify-content: center; }

/* ===== Inspect popover ===== */
.inspect-popover { width: 290px; }
.inspect-summary {
  background: var(--ground-2); border: 1px solid var(--line); border-radius: 9px;
  padding: 10px 12px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px;
}
.inspect-summary-row { display: flex; justify-content: space-between; gap: 10px; font-size: 11.5px; }
.inspect-summary-label { color: var(--ink-soft); }
.inspect-summary-value { color: var(--ink); font-family: var(--font-mono); text-align: right; }
.inspect-summary-finding {
  font-family: var(--font-body); font-style: italic; color: var(--ink-soft);
  font-size: 11.5px; margin-top: 2px; text-align: right;
}
.inspect-note {
  width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-body); font-size: 12.5px;
  resize: vertical; min-height: 50px;
}
.health-slider-row { margin-bottom: 12px; }
.health-slider-label {
  display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px;
}
.health-slider-value { font-family: var(--font-display); font-weight: 700; font-size: 13px; }
.health-slider {
  width: 100%; appearance: none; -webkit-appearance: none; height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--stamp-red), var(--marigold), var(--moss));
  outline: none; cursor: pointer;
}
.health-slider::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--ink); cursor: pointer;
}
.health-slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--panel); border: 2px solid var(--ink); cursor: pointer;
}
.health-slider-scale { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--ink-faint); margin-top: 3px; }

/* ===== Grid settings popover (per-bed snap grid) ===== */
.grid-settings-size-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.grid-settings-size-row label { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.grid-settings-size-input { display: flex; align-items: center; gap: 6px; }
.grid-settings-size-input input {
  width: 60px; border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-mono); font-size: 13px; text-align: right;
}
.grid-settings-size-input span { font-size: 11.5px; color: var(--ink-faint); font-family: var(--font-mono); }
.grid-settings-snap-toggle {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink); cursor: pointer; user-select: none;
}
.grid-settings-snap-toggle input { accent-color: var(--moss); width: 15px; height: 15px; }
.zone-popover-delete span { display: flex; align-items: center; gap: 6px; }

/* ===== Selection action bar (rubber-band select in the yard) ===== */
.yard-selection-bar {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; padding: 8px 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.28); z-index: 55;
}
.yard-selection-count {
  font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft);
  padding: 0 8px 0 4px; white-space: nowrap;
}
.yard-selection-btn {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--ground-2);
  color: var(--ink); font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: transform 0.1s cubic-bezier(.34,1.56,.64,1), border-color 0.15s ease;
}
.yard-selection-btn:hover { border-color: var(--moss); transform: translateY(-1px); }
.yard-selection-btn:active { transform: scale(0.95); }
.yard-selection-btn.danger { border-color: var(--stamp-red); color: var(--stamp-red); }
.yard-selection-btn.danger:hover { background: var(--stamp-red); color: #FCEDE7; }
.yard-selection-btn.danger.confirm-armed { background: var(--stamp-red); color: #FCEDE7; }
.yard-selection-clear {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; border: none; background: none;
  color: var(--ink-faint); cursor: pointer; flex-shrink: 0;
}
.yard-selection-clear:hover { color: var(--ink); background: var(--ground-2); }

.selection-action-popover .form-row label {
  display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-soft); margin-bottom: 6px; font-weight: 600;
}
.selection-action-popover input[type="date"] {
  width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-mono); font-size: 13px;
}
.care-popover-confirm.inspect { background: var(--ink-soft); color: #F6F4E6; }
.care-popover-confirm.pest { background: var(--stamp-red); color: #FCEDE7; }
.care-popover-confirm.harvest { background: var(--terracotta); color: #FBF3E9; }

/* ===== Right-click context menu ===== */
.yard-context-menu {
  position: fixed; z-index: 60; min-width: 170px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 14px 34px rgba(0,0,0,0.28); padding: 6px;
  opacity: 0; pointer-events: none; transform: scale(0.95); transform-origin: top left;
  transition: opacity 0.1s ease, transform 0.1s ease;
}
.yard-context-menu.open { opacity: 1; pointer-events: auto; transform: scale(1); }
.yard-context-menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px;
  border: none; background: none; border-radius: 7px; color: var(--ink);
  font-size: 13px; font-family: var(--font-body); cursor: pointer; text-align: left;
}
.yard-context-menu-item:hover { background: var(--ground-2); }
.yard-context-menu-item svg.icon { font-size: 15px; color: var(--moss-deep); flex-shrink: 0; }

/* ===== Plant quick-action wheel (single-click on a planted icon) ===== */
.plant-quick-actions { position: fixed; top: 0; left: 0; z-index: 56; pointer-events: none; }
.plant-quick-btn {
  position: absolute; top: 0; left: 0; pointer-events: auto;
  width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--line);
  background: var(--panel); color: var(--moss-deep); font-size: 14px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,0.28); opacity: 0;
  animation: plant-quick-pop 0.42s cubic-bezier(.3, 1.4, .5, 1) forwards;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.plant-quick-btn:hover { border-color: var(--moss); background: var(--ground-2); }
.plant-quick-btn.water { color: var(--chicory); }
.plant-quick-btn.fertilize { color: var(--marigold); }
.plant-quick-btn.inspect { color: var(--ink-soft); }
.plant-quick-btn.pest { color: var(--stamp-red); }
.plant-quick-btn.harvest { color: var(--terracotta); }
.plant-quick-btn::after {
  content: attr(data-label);
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) translate(var(--lx, 0px), var(--ly, -30px)) scale(0.85);
  padding: 4px 8px; border-radius: 6px;
  background: var(--ink); color: var(--panel);
  font-family: var(--font-body); font-size: 11px; font-weight: 600; white-space: nowrap;
  pointer-events: none; opacity: 0;
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 10;
}
.plant-quick-btn:hover::after, .plant-quick-btn:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, -50%) translate(var(--lx, 0px), var(--ly, -30px)) scale(1);
}
@keyframes plant-quick-pop {
  0%   { transform: translate(-50%, -50%) rotate(-260deg) scale(0.15); opacity: 0; }
  55%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--qx)), calc(-50% + var(--qy))) rotate(0deg) scale(1); opacity: 1; }
}

/* ===== Grid + paste ghost preview ===== */
.yard-grid-preview { position: absolute; top: 0; left: 0; pointer-events: none; z-index: 4; }
.yard-grid-preview-icon {
  position: absolute; width: 26px; height: 26px; border-radius: 50%;
  background: color-mix(in srgb, var(--moss) 30%, transparent);
  border: 1.5px dashed var(--moss); transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center; color: var(--moss-deep); font-size: 14px;
}

/* ===== Plant Catalog tab ===== */
.catalog-filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.catalog-search-row input {
  width: 100%; max-width: 360px; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-body); font-size: 14px;
}
.catalog-chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
#catalogBedSelect {
  align-self: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  background: var(--ground-2); color: var(--ink); font-family: var(--font-body); font-size: 13px;
}

.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.catalog-card {
  display: flex; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; align-items: flex-start; cursor: pointer;
}
.catalog-card:hover { border-color: var(--moss); }
.catalog-card-photo {
  width: 56px; height: 56px; border-radius: 9px; flex-shrink: 0; overflow: hidden;
  background: var(--ground-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; color: var(--moss-deep); font-size: 26px;
}
.catalog-card-photo img { width: 100%; height: 100%; object-fit: cover; }
.catalog-card-body { flex: 1; min-width: 0; }
.catalog-card-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--ink); }
.catalog-card-latin { font-style: italic; font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; min-height: 15px; }
.catalog-card-meta { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.catalog-delete-note { font-size: 11.5px; color: var(--ink-faint); align-self: center; }

.catalog-card-badge {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 3px 8px; border-radius: 999px; background: var(--ground-2); border: 1px solid var(--line); color: var(--ink-soft);
}
.catalog-card-stats { display: flex; gap: 10px; font-family: var(--font-mono); font-size: 11px; color: var(--ink-faint); margin-bottom: 4px; flex-wrap: wrap; }
.catalog-card-taxon { font-size: 11px; color: var(--ink-faint); margin-bottom: 8px; }
.catalog-card-usage { display: flex; gap: 6px; flex-wrap: wrap; }
.catalog-usage-never { font-size: 11px; color: var(--ink-faint); font-style: italic; }
.catalog-usage-bed {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600;
  color: var(--moss-deep); background: color-mix(in srgb, var(--moss) 12%, transparent);
  border: 1px solid var(--moss); border-radius: 999px; padding: 3px 9px; text-decoration: none;
}
.catalog-usage-bed span { font-family: var(--font-mono); color: var(--ink-faint); font-weight: 400; }
.catalog-usage-bed:hover { background: var(--moss); color: #F6F4E6; }
.catalog-usage-bed:hover span { color: #F6F4E6; }

.catalog-detail-photo {
  width: 100%; height: 200px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line);
  margin-bottom: 12px; display: block; background: var(--ground-2);
}
.catalog-detail-photo-empty { display: flex; align-items: center; justify-content: center; color: var(--moss-deep); font-size: 40px; }
.catalog-detail-latin { font-style: italic; font-size: 14px; color: var(--ink-soft); margin-bottom: 8px; }
.catalog-detail-grid { display: flex; gap: 24px; margin-bottom: 14px; }
.catalog-detail-grid label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-faint); margin-bottom: 3px; }
.catalog-detail-grid div div { font-family: var(--font-mono); font-size: 14px; color: var(--ink); }
/* Trefle-sourced tolerances are sparse, so this row wraps rather than
   assuming a fixed set of columns like the grid above it. */
.catalog-detail-growth { flex-wrap: wrap; row-gap: 10px; margin-bottom: 4px; }
.catalog-detail-source {
  font-size: 10.5px; color: var(--ink-faint); font-family: var(--font-mono);
  margin: 0 0 14px;
}
.catalog-detail-needs { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.catalog-detail-needs label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-faint); margin-bottom: 2px; }
.catalog-detail-needs p { font-size: 13.5px; color: var(--ink); margin: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .care-popover-confirm.loading svg.icon, .care-success-check, .care-burst-particle { animation: none !important; }
  .care-success-check { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  .care-burst-particle { display: none; }
  .yard-plant.quick-open { animation: none !important; transform: translate(-50%, -50%) rotate(var(--rot, 0deg)) scale(1.15); }
  .plant-quick-btn {
    animation: none !important; opacity: 1;
    transform: translate(calc(-50% + var(--qx)), calc(-50% + var(--qy))) scale(1);
  }
}
