
/*!
 * Veg Planner — Retro Tech Theme (drop-in replacement for style.css)
 * Matches the dark/retro look used in your Biodynamic Calendar & Veg‑O‑Matic apps.
 * Keep existing HTML/JS. Only swap the stylesheet link to this file.
 *
 * Author: ChatGPT for Frederic (Backyard-Farmer)
 * Version: 1.0.0 (2025-08-28)
 */

/* Hide CookieYes floating revisit button on Allotment Planner */
.cky-btn-revisit-wrapper {
    display: none !important;
}

/* -----------------------------------------
   0) TOKENS & BASE
----------------------------------------- */
:root{
  /* Palette */
  --bg: #0b0e12;               /* deep slate */
  --bg-grad-top: #131922;
  --bg-grad-bot: #090c11;

  --surface-1: #0f141b;        /* panels */
  --surface-2: #101720;        /* screen */
  --surface-3: #1b2431;        /* borders */
  --surface-4: #273041;        /* strong borders */
  --paper: #ebe6d7;            /* off‑white for labels if needed */

  /* Brand / accents (neon-ish, same family as other apps) */
  --brand-300: #35518f;
  --brand-400: #4a6ed1;
  --brand-500: #6da3ff;
  --brand-amber: #f7c66b;
  --brand-green: #5fe49b;
  --brand-purple: #a89bff;
  --selection-blue: var(--brand-400);

  /* States */
  --good: color-mix(in srgb, var(--brand-green) 60%, transparent);
  --bad:  color-mix(in srgb, #ff6b6b 60%, transparent);
  --mix:  color-mix(in srgb, var(--brand-amber) 60%, transparent);

  /* Misc */
  --ink: #dbe7ff;
  --ink-dim: #aab8d4;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 12px 30px rgba(0,0,0,.45);
  --grid-square-size: clamp(38px, 9vw, 72px);
  --grid-zoom: 1;
  --grid-square-size-effective: calc(var(--grid-square-size) * var(--grid-zoom));
  --cell-size: var(--grid-square-size-effective);
  --planner-gap: 12px;
  --planner-pad: clamp(12px, 2.5vw, 24px);
}


:root[data-theme="light"]{
  --bg: #f4efe4;
  --bg-grad-top: #fbf7ee;
  --bg-grad-bot: #ece3d2;
  --surface-1: #fffaf0;
  --surface-2: #f8f0df;
  --surface-3: #ded3bd;
  --surface-4: #c9bda4;
  --paper: #fffaf0;
  --brand-300: #51798f;
  --brand-400: #3f6f9f;
  --brand-500: #3f6f9f;
  --brand-amber: #d59b32;
  --brand-green: #2f9d5c;
  --brand-purple: #6d5fa3;
  --selection-blue: var(--brand-500);
  --ink: #263238;
  --ink-dim: #5f6b73;
  --shadow: 0 12px 30px rgba(99, 73, 38, .20);
}

@media (max-width: 767px){
  :root{
    --grid-square-size: calc(var(--grid-square-size) - 6px);
  }
}

@media (min-width: 768px){
  :root{
    --planner-gap: 16px;
  }
}

/* Reset bits */
*,
*::before,
*::after{ box-sizing: border-box; }
html{ background-color: var(--bg); }
body{
  margin: 0;
  color: var(--ink);
  font: 16px/1.5 "Cabin", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(120% 140% at 50% 0%, var(--bg-grad-top) 0%, var(--bg) 52%, var(--bg-grad-bot) 100%);
  user-select: none;
}

[hidden]{
  display: none !important;
}

.brand-banner{
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-height: 88px;
  margin: 0 auto;
  padding: 0;
}

#export-capture-root .brand-banner{
  width: 100%;
  max-width: 1200px;
}

#export-capture-root .export-banner{
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 14px auto 20px;
  padding: 18px 0 12px;
  text-align: center;
}

#export-capture-root .export-banner .brand-banner{
  margin: 0;
}

.brand-banner img{
  max-width: min(380px, 90vw);
  height: auto;
  filter: drop-shadow(0 8px 20px rgba(0,0,0,.35));
  min-height: 64px;
}

.brand-banner__fallback{
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .03em;
  padding: 12px 18px;
  color: var(--ink);
}

/* Prevent inadvertent text highlighting while dragging within the planner */
#workArea,
#grid-container,
.plant,
.grid-square{
  user-select: none;
}

/* Allow text selection within form fields */
input,
textarea{
  user-select: text;
}

/* -----------------------------------------
   1) COMPONENT SHELL HELPERS
----------------------------------------- */
.controls-block:first-child{ margin-top: 0; }

.grid-outer,
.palette-block,
.veg-menu,
#veg-menu{ margin-bottom: 0; }

.planner-sidebar{
  display: grid;
  gap: clamp(8px, 1vw, 10px);
  margin-top: 0;
  padding: clamp(10px, 1.2vw, 14px) clamp(12px, 1.4vw, 16px) clamp(14px, 1.5vw, 18px);
  width: 100%;
  box-sizing: border-box;
  align-content: start;
}

.planner-sidebar > *{
  width: 100%;
}

.manage-external-icon{
  font-size: .72em !important;
  color: color-mix(in srgb, var(--ink-dim) 78%, transparent) !important;
  filter: none !important;
}

.work-mode-switch{
  display: inline-flex;
  align-items: stretch;
  min-width: 0;
  border: 1px solid color-mix(in srgb, var(--surface-4) 74%, transparent);
  border-radius: 10px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface-2) 74%, #000);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 8%, transparent);
}

.work-mode-switch__button{
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.work-mode-switch__button + .work-mode-switch__button{
  border-left: 1px solid color-mix(in srgb, var(--surface-4) 70%, transparent) !important;
}

.work-mode-switch__button.is-selected,
.logbook-toolbar-btn.is-selected{
  color: var(--ink);
  background: color-mix(in srgb, var(--brand-500) 28%, var(--surface-2));
}

.work-mode-status{
  margin: 0;
  font-size: .7rem;
  line-height: 1;
  font-weight: 750;
  letter-spacing: .045em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--ink-dim) 90%, transparent);
  white-space: nowrap;
}

.manage-calendar-link{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  text-decoration: none;
}

.theme-toggle{
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 82px;
  min-height: 32px;
  padding: 5px 8px;
  color: color-mix(in srgb, var(--ink) 88%, var(--ink-dim));
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--surface-3) 36%, #101918),
      color-mix(in srgb, #0f1716 82%, transparent));
  border: 1px solid color-mix(in srgb, var(--surface-4) 74%, transparent);
  border-radius: 999px;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #fff 9%, transparent),
    inset 0 -1px 0 color-mix(in srgb, #000 18%, transparent);
  cursor: pointer;
}

.theme-toggle__icon{
  font-size: .86rem !important;
}

.theme-toggle__icon--sun{
  color: color-mix(in srgb, var(--brand-amber) 86%, #fff) !important;
}

.theme-toggle__icon--moon{
  color: color-mix(in srgb, var(--brand-purple) 74%, var(--ink)) !important;
}

.theme-toggle__track{
  position: relative;
  flex: 0 0 28px;
  width: 28px;
  height: 14px;
  border-radius: 999px;
  background: color-mix(in srgb, #030707 72%, var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--surface-4) 50%, transparent);
  box-shadow: inset 0 1px 2px color-mix(in srgb, #000 42%, transparent);
}

.theme-toggle__thumb{
  position: absolute;
  top: 50%;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--brand-amber) 90%, #fff),
      color-mix(in srgb, var(--brand-amber) 70%, var(--surface-1)));
  box-shadow:
    0 1px 2px color-mix(in srgb, #000 42%, transparent),
    0 0 0 1px color-mix(in srgb, #fff 18%, transparent);
  transform: translateY(-50%);
}

:root[data-theme="light"] .theme-toggle__thumb{
  transform: translate(14px, -50%);
}

:root[data-theme="light"] .theme-toggle{
  color: var(--ink);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--surface-1) 88%, #fff),
      color-mix(in srgb, var(--surface-2) 92%, var(--brand-amber) 8%));
  border-color: color-mix(in srgb, var(--surface-4) 82%, var(--brand-amber));
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #fff 80%, transparent),
    inset 0 -1px 0 color-mix(in srgb, var(--surface-4) 38%, transparent),
    0 2px 8px color-mix(in srgb, #6b4d1d 14%, transparent);
}

:root[data-theme="light"] .theme-toggle__track{
  background: color-mix(in srgb, var(--surface-3) 76%, #fff);
  border-color: color-mix(in srgb, var(--surface-4) 86%, var(--brand-amber));
  box-shadow: inset 0 1px 2px color-mix(in srgb, #6b4d1d 22%, transparent);
}

:root[data-theme="light"] .theme-toggle__icon--moon{
  color: color-mix(in srgb, var(--ink-dim) 72%, var(--brand-purple)) !important;
}

.theme-toggle:hover,
.theme-toggle:focus-visible{
  color: var(--ink);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--surface-3) 72%, transparent),
      color-mix(in srgb, var(--surface-2) 80%, transparent));
  border-color: color-mix(in srgb, var(--brand-300) 78%, var(--surface-4));
  outline: none;
}

.theme-toggle:focus-visible{
  outline: 2px solid color-mix(in srgb, var(--brand-500) 80%, #fff);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-400) 24%, transparent);
}


.planner-busy-bar {
  display: grid;
  grid-template-columns: minmax(80px, 180px) auto;
  align-items: center;
  gap: 8px;
  min-height: 18px;
  padding: 2px 12px;
  background: color-mix(in srgb, var(--surface-1) 94%, #000);
  border-bottom: 1px solid color-mix(in srgb, var(--surface-4) 50%, transparent);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
}

.planner-busy-bar[hidden] {
  display: none !important;
}

.planner-busy-bar__track {
  position: relative;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-3) 70%, #000);
}

.planner-busy-bar__fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--brand-green) 70%, var(--brand-500)),
    transparent
  );
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--brand-green) 65%, transparent));
  animation: plannerBusySlide 1.1s linear infinite;
}

.planner-busy-bar__label {
  min-width: 0;
  overflow: hidden;
  color: color-mix(in srgb, var(--ink) 78%, var(--ink-dim));
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .025em;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes plannerBusySlide {
  from { transform: translateX(-110%); }
  to { transform: translateX(260%); }
}

@media (prefers-reduced-motion: reduce) {
  .planner-busy-bar__fill {
    animation: none;
    width: 100%;
    opacity: .65;
  }
}

.planner-busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: auto;
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--brand-green) 14%, transparent), transparent 34%),
    color-mix(in srgb, #07100f 52%, transparent);
  backdrop-filter: blur(4px) saturate(1.08);
}

.planner-busy-overlay[hidden] {
  display: none !important;
}

.planner-busy-overlay__card {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  max-width: min(88vw, 360px);
  padding: 16px 20px;
  color: color-mix(in srgb, var(--ink) 88%, #fff);
  background: color-mix(in srgb, var(--surface-1) 82%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand-green) 34%, var(--surface-4));
  border-radius: 18px;
  box-shadow:
    0 18px 48px color-mix(in srgb, #000 35%, transparent),
    inset 0 1px 0 color-mix(in srgb, #fff 8%, transparent);
}

.planner-busy-overlay__spinner {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 3px solid color-mix(in srgb, var(--surface-4) 55%, transparent);
  border-top-color: color-mix(in srgb, var(--brand-green) 78%, var(--brand-500));
  box-shadow: 0 0 18px color-mix(in srgb, var(--brand-green) 28%, transparent);
  animation: plannerBusySpin .82s linear infinite;
}

.planner-busy-overlay__label {
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: .015em;
}

#appShell.planner-busy-blocking > :not(.planner-busy-overlay) {
  filter: grayscale(.12) brightness(.78);
  transition: filter .18s ease;
}

:root[data-theme="light"] .planner-busy-overlay {
  background:
    radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--brand-amber) 18%, transparent), transparent 34%),
    color-mix(in srgb, #fff4d8 58%, transparent);
}

:root[data-theme="light"] .planner-busy-overlay__card {
  color: color-mix(in srgb, var(--ink) 86%, #3d2a0a);
  background: color-mix(in srgb, #fff7df 88%, transparent);
  border-color: color-mix(in srgb, var(--brand-amber) 38%, var(--brand-green));
  box-shadow:
    0 18px 44px color-mix(in srgb, #72551a 20%, transparent),
    inset 0 1px 0 color-mix(in srgb, #fff 70%, transparent);
}

:root[data-theme="light"] .planner-busy-overlay__spinner {
  border-color: color-mix(in srgb, var(--brand-amber) 24%, #efe1bd);
  border-top-color: color-mix(in srgb, var(--brand-green) 62%, var(--brand-amber));
}

@keyframes plannerBusySpin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .planner-busy-overlay__spinner {
    animation: none;
    opacity: .72;
  }

  #appShell.planner-busy-blocking > :not(.planner-busy-overlay) {
    transition: none;
  }
}


.demo-spotlight{
  --demo-spotlight-left: 0px;
  --demo-spotlight-top: 0px;
  --demo-spotlight-width: 0px;
  --demo-spotlight-height: 0px;
  --demo-spotlight-radius: 16px;
  position: fixed;
  left: var(--demo-spotlight-left);
  top: var(--demo-spotlight-top);
  z-index: 44;
  width: var(--demo-spotlight-width);
  height: var(--demo-spotlight-height);
  border: 2px solid color-mix(in srgb, var(--brand-green) 72%, #fff);
  border-radius: var(--demo-spotlight-radius);
  box-shadow:
    0 0 0 max(100vw, 100vh) rgba(4, 7, 12, .34),
    0 0 0 4px color-mix(in srgb, var(--brand-green) 18%, transparent),
    0 0 28px color-mix(in srgb, var(--brand-green) 42%, transparent),
    inset 0 0 18px color-mix(in srgb, var(--brand-green) 13%, transparent);
  opacity: 0;
  pointer-events: none;
  transform: translateZ(0);
  transition:
    left .18s ease,
    top .18s ease,
    width .18s ease,
    height .18s ease,
    opacity .16s ease;
}

.demo-spotlight.is-active{
  opacity: 1;
}

:root[data-theme="light"] .demo-spotlight{
  border-color: color-mix(in srgb, var(--brand-green) 86%, #fff);
  box-shadow:
    0 0 0 max(100vw, 100vh) rgba(38, 50, 56, .24),
    0 0 0 4px color-mix(in srgb, var(--brand-green) 24%, transparent),
    0 0 28px color-mix(in srgb, var(--brand-green) 48%, transparent),
    inset 0 0 18px color-mix(in srgb, var(--brand-green) 14%, transparent);
}

.demo-spotlight[hidden]{
  display: none;
}

.planner-demo-spotlight-active .demo-caption{
  z-index: 45;
}

.planner-demo-spotlight-target{
  position: relative;
  z-index: 46;
}

@media (prefers-reduced-motion: reduce){
  .demo-spotlight{
    transition: none;
  }
}

.demo-caption{
  --demo-caption-left: auto;
  --demo-caption-top: 50%;
  --demo-caption-width: min(340px, calc(100vw - 32px));
  --demo-caption-arrow-x: 50%;
  --demo-caption-arrow-y: 50%;
  position: fixed;
  left: var(--demo-caption-left);
  right: auto;
  top: var(--demo-caption-top);
  bottom: auto;
  z-index: 45;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(8px, 1.6vw, 12px);
  width: min(var(--demo-caption-width), calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: min(420px, calc(100vh - 64px));
  padding: clamp(12px, 1.8vw, 16px);
  color: var(--ink);
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--surface-2) 91%, #000) 0%,
      color-mix(in srgb, var(--surface-1) 94%, #000) 100%);
  border: 1px solid color-mix(in srgb, var(--brand-400) 38%, var(--surface-4));
  border-radius: 18px;
  box-shadow:
    0 18px 44px color-mix(in srgb, #000 42%, transparent),
    0 0 0 1px color-mix(in srgb, var(--brand-green) 14%, transparent),
    inset 0 1px 0 color-mix(in srgb, #fff 10%, transparent);
  overflow: visible;
  transform: none;
  overflow-wrap: anywhere;
}

.demo-caption::after{
  content: "";
  position: absolute;
  z-index: -1;
  width: 16px;
  height: 16px;
  background: color-mix(in srgb, var(--surface-2) 91%, #000);
  border: 1px solid color-mix(in srgb, var(--brand-400) 38%, var(--surface-4));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand-green) 12%, transparent);
  transform: rotate(45deg);
}

.demo-caption[data-demo-placement="right"]::after{
  left: -9px;
  top: clamp(18px, var(--demo-caption-arrow-y), calc(100% - 18px));
  border-top: 0;
  border-right: 0;
}

.demo-caption[data-demo-placement="left"]::after{
  right: -9px;
  top: clamp(18px, var(--demo-caption-arrow-y), calc(100% - 18px));
  border-bottom: 0;
  border-left: 0;
}

.demo-caption[data-demo-placement="below"]::after{
  top: -9px;
  left: clamp(18px, var(--demo-caption-arrow-x), calc(100% - 18px));
  border-right: 0;
  border-bottom: 0;
}

.demo-caption[data-demo-placement="above"]::after{
  bottom: -9px;
  left: clamp(18px, var(--demo-caption-arrow-x), calc(100% - 18px));
  border-top: 0;
  border-left: 0;
}

.demo-caption__header{
  display: flex;
  align-items: flex-start;
  gap: 9px;
  flex-wrap: wrap;
  min-width: 0;
}

.demo-caption__counter{
  flex: 0 0 auto;
  width: fit-content;
  padding: 4px 8px;
  color: color-mix(in srgb, var(--brand-green) 82%, #ffffff);
  text-align: center;
  background: color-mix(in srgb, var(--brand-green) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand-green) 32%, transparent);
  border-radius: 10px;
  font-size: .64rem;
  font-weight: 900;
  letter-spacing: .04em;
  line-height: 1.18;
  text-transform: uppercase;
  white-space: nowrap;
}

.demo-caption__title{
  align-self: center;
  margin: 0;
  color: color-mix(in srgb, var(--ink) 94%, #ffffff);
  font-size: 1.08rem;
  font-weight: 900;
  letter-spacing: -.015em;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.demo-caption__progress{
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: clamp(5px, 1.5vw, 8px);
  min-height: 16px;
  max-width: 100%;
  padding: 2px 1px;
  flex-wrap: wrap;
  background: transparent;
}

.demo-caption__progress-dot{
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-3) 74%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--brand-green) 20%, #ffffff);
  box-shadow: inset 0 1px 0 color-mix(in srgb, #fff 12%, transparent);
  opacity: .56;
}

.demo-caption__progress-dot.is-complete{
  background: color-mix(in srgb, var(--brand-green) 62%, var(--surface-3));
  border-color: color-mix(in srgb, var(--brand-green) 48%, #ffffff);
  opacity: .8;
}

.demo-caption__progress-dot.is-active{
  width: 8px;
  height: 8px;
  background: var(--brand-green);
  border-color: color-mix(in srgb, var(--brand-green) 68%, #ffffff);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--brand-green) 20%, transparent),
    0 0 12px color-mix(in srgb, var(--brand-green) 34%, transparent);
  opacity: 1;
}

.demo-caption[hidden]{
  display: none;
}

.demo-caption__text{
  margin: 0;
  color: color-mix(in srgb, var(--ink) 84%, #ffffff);
  font-size: .89rem;
  font-weight: 600;
  letter-spacing: .005em;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.demo-caption__bullets{
  margin: 2px 0 0;
  padding-left: 1.1rem;
  color: color-mix(in srgb, var(--ink-dim) 86%, #ffffff);
  font-size: .78rem;
  font-weight: 500;
  line-height: 1.42;
  overflow-wrap: anywhere;
}

.demo-caption__bullets[hidden]{
  display: none;
}

.demo-caption__bullets li + li{
  margin-top: 3px;
}

.demo-caption__text.is-changing{
  animation: demo-caption-text-in .28s ease;
}

@keyframes demo-caption-text-in{
  from{
    opacity: .48;
    transform: translateY(4px);
  }
  to{
    opacity: 1;
    transform: translateY(0);
  }
}

.demo-caption__actions{
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  padding-top: 4px;
}

.demo-caption__nav,
.demo-caption__stop{
  flex: 1 1 76px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  min-width: 72px;
  padding: 8px 12px;
  border-radius: 10px;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
}

.demo-caption__nav:focus-visible,
.demo-caption__stop:focus-visible{
  outline: 2px solid color-mix(in srgb, var(--brand-500) 82%, #fff);
  outline-offset: 2px;
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--brand-400) 26%, transparent),
    inset 0 1px 0 color-mix(in srgb, #fff 11%, transparent);
}

.demo-caption__nav:disabled{
  opacity: .48;
  color: color-mix(in srgb, var(--ink-dim) 72%, var(--surface-4));
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--surface-3) 22%, transparent),
      color-mix(in srgb, var(--surface-2) 34%, transparent));
  border-color: color-mix(in srgb, var(--surface-4) 52%, transparent);
  box-shadow: none;
  cursor: not-allowed;
}

.demo-caption__stop{
  margin-left: auto;
  min-width: 66px;
  color: color-mix(in srgb, #ffd0bd 72%, var(--ink-dim));
  background: transparent;
  border-color: color-mix(in srgb, #ff8a65 30%, var(--surface-4));
  box-shadow: none;
}

.demo-caption__stop:hover,
.demo-caption__stop:focus-visible{
  color: color-mix(in srgb, #ffd0bd 88%, #fff);
  background: color-mix(in srgb, #ff6b6b 10%, transparent);
  border-color: color-mix(in srgb, #ff8a65 54%, var(--surface-4));
}

:root[data-theme="light"] .demo-caption button,
:root[data-theme="light"] .demo-caption .secondary{
  background: #fffaf0;
  color: #263238;
  border-color: #c9bda4;
  box-shadow: 0 2px 5px rgba(60, 45, 25, .14);
}

:root[data-theme="light"] #demoNextBtn{
  background: #eef8ef;
  color: #1f2a2d;
  border-color: #2f9d5c;
}

:root[data-theme="light"] .demo-caption button:hover,
:root[data-theme="light"] .demo-caption button:focus-visible,
:root[data-theme="light"] .demo-caption .secondary:hover,
:root[data-theme="light"] .demo-caption .secondary:focus-visible{
  background: #f5ead8;
  color: #1f2a2d;
  border-color: #9f8f73;
}

:root[data-theme="light"] #demoNextBtn:hover,
:root[data-theme="light"] #demoNextBtn:focus-visible{
  background: #ddf1e1;
  color: #172124;
  border-color: #257c49;
}

:root[data-theme="light"] #demoStopBtn{
  background: #fff7df;
  color: #5c3920;
  border-color: #d59b32;
  box-shadow: 0 2px 5px rgba(60, 45, 25, .14);
}

:root[data-theme="light"] #demoStopBtn:hover,
:root[data-theme="light"] #demoStopBtn:focus-visible{
  background: #f8ead0;
  border-color: #b77b1f;
  color: #3f2818;
}

:root[data-theme="light"] .demo-caption button:disabled,
:root[data-theme="light"] .demo-caption .secondary:disabled{
  background: #f8f0df;
  color: #7a827d;
  border-color: #d8cbb5;
  opacity: 1;
  box-shadow: none;
}

.planner-demo-mode #cropTrayPanel,
.planner-demo-mode .grid-buttons{
  pointer-events: none;
  opacity: .58;
}

.demo-carrot-ghost{
  position: fixed;
  left: 0;
  top: 0;
  z-index: 60;
  width: min(72px, calc(var(--grid-square-size-effective) * 1.08));
  height: min(72px, calc(var(--grid-square-size-effective) * 1.08));
  display: grid;
  place-items: center;
  pointer-events: none;
  filter: drop-shadow(0 12px 18px rgba(0,0,0,.4));
  will-change: transform, opacity;
}

.demo-carrot-ghost img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
}

.demo-carrot-ghost.is-dropping{
  opacity: .84;
  transition: opacity .18s ease;
}

.demo-fake-cursor{
  position: fixed;
  left: 0;
  top: 0;
  z-index: 61;
  width: 0;
  height: 0;
  pointer-events: none;
  will-change: transform;
}

.demo-fake-cursor::before{
  content: "";
  display: block;
  width: 18px;
  height: 24px;
  background: color-mix(in srgb, var(--ink) 92%, #fff);
  clip-path: polygon(0 0, 0 92%, 6px 70%, 11px 100%, 16px 98%, 11px 67%, 18px 67%);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.45));
}

.demo-fake-cursor.demo-fake-click::before{
  transform: translate3d(1px, 1px, 0) scale(.92);
}

@keyframes demo-toolbar-target-click{
  0%, 100%{
    transform: translateZ(0) scale(1);
  }

  42%{
    transform: translateZ(0) scale(.94);
  }

  72%{
    transform: translateZ(0) scale(1.04);
  }
}


.grid-square.demo-details-target,
.plant:has(.grid-square.demo-details-target){
  position: relative;
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--brand-400) 46%, transparent),
    0 8px 18px rgba(0,0,0,.18);
  z-index: 2;
}

.crop-detail-pill.demo-fake-hover{
  border-color: rgba(242, 192, 95, .78);
  color: #fff3d7;
  transform: translateY(-1px) scale(1.04);
  box-shadow:
    0 0 0 3px rgba(242, 192, 95, .22),
    0 10px 22px rgba(0, 0, 0, .22),
    inset 0 1px 0 rgba(255, 255, 255, .12);
}

.demo-cover-preview{
  position: fixed;
  z-index: 59;
  pointer-events: none;
  box-shadow:
    0 10px 22px rgba(0,0,0,.24),
    inset 0 0 0 1px rgba(255,255,255,.28);
  will-change: left, top, width, height, opacity;
}

.grid-square.demo-placement-target{
  box-shadow:
    inset 0 0 0 2px color-mix(in srgb, var(--brand-400) 68%, #fff),
    0 0 0 3px color-mix(in srgb, var(--brand-400) 18%, transparent),
    0 0 18px color-mix(in srgb, var(--brand-400) 26%, transparent);
  background: color-mix(in srgb, #0c1118 72%, var(--brand-400));
}

@media (prefers-reduced-motion: reduce){
  .demo-carrot-ghost{
    transition: none;
  }

  .demo-caption__text.is-changing{
    animation: none;
  }

  .demo-fake-cursor,
  .demo-cover-preview{
    transition: none;
  }
}

@keyframes demo-button-attention-pulse{
  0%, 100%{
    background: #0f1716;
    color: var(--ink);
    border-color: color-mix(in srgb, var(--brand-green) 42%, var(--surface-4));
    transform: scale(1);
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--brand-green) 16%, transparent),
      0 0 10px color-mix(in srgb, var(--brand-green) 12%, transparent);
  }
  45%{
    background: var(--brand-green);
    color: #07110b;
    border-color: color-mix(in srgb, var(--brand-green) 80%, #fff);
    transform: scale(1.035);
    box-shadow:
      0 0 0 2px color-mix(in srgb, var(--brand-green) 34%, transparent),
      0 0 18px color-mix(in srgb, var(--brand-green) 45%, transparent);
  }
}

@keyframes demo-button-attention-pulse-light{
  0%, 100%{
    background: #fffaf0;
    color: #263238;
    border-color: rgba(213, 155, 50, .74);
    transform: scale(1);
    box-shadow:
      0 0 0 1px rgba(213, 155, 50, .18),
      0 3px 8px rgba(60, 45, 25, .12);
  }
  45%{
    background: #fff7df;
    color: #263238;
    border-color: #d59b32;
    transform: scale(1.035);
    box-shadow:
      0 0 0 2px rgba(213, 155, 50, .34),
      0 0 0 7px rgba(213, 155, 50, .14),
      0 4px 10px rgba(60, 45, 25, .18);
  }
}

@media (max-width: 1024px){

  .demo-caption{
    left: 50%;
    right: auto;
    top: auto;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: min(520px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    max-height: min(360px, calc(100vh - 96px));
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(-50%);
  }

  .demo-caption::after{
    display: none;
  }
}

@media (max-width: 640px){
  .demo-caption{
    align-items: stretch;
    gap: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: min(340px, calc(100vh - 72px));
    padding: 12px 10px 10px;
  }

  .demo-caption__header{
    gap: 7px;
  }

  .demo-caption__title{
    font-size: 1rem;
  }

  .demo-caption__counter{
    font-size: .6rem;
    padding-inline: 7px;
  }

  .demo-caption__progress{
    justify-content: center;
  }

  .demo-caption__text{
    font-size: .88rem;
    line-height: 1.4;
  }

  .demo-caption__actions{
    gap: 7px;
  }

  .demo-caption__stop{
    margin-left: 0;
  }

  .demo-caption__nav,
  .demo-caption__stop{
    flex: 1 1 calc(33.333% - 7px);
    min-width: 0;
    padding-inline: 8px;
  }
}

@media (max-width: 380px){
  .demo-caption__actions{
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .demo-caption__stop{
    grid-column: 1 / -1;
  }
}

.planner-primary-action.sidebar-top-actions__save{
  width: auto;
  min-height: 30px;
  margin: 0;
  padding: 6px 11px;
  white-space: nowrap;
  background: color-mix(in srgb, var(--brand-500) 22%, var(--surface-2));
  border-color: color-mix(in srgb, var(--brand-400) 54%, var(--surface-4));
  border-radius: 8px;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #fff 10%, transparent),
    0 0 0 1px color-mix(in srgb, var(--brand-400) 12%, transparent);
}

.planner-primary-action.sidebar-top-actions__save:hover,
.planner-primary-action.sidebar-top-actions__save:focus-visible{
  background: color-mix(in srgb, var(--brand-500) 30%, var(--surface-2));
  border-color: var(--brand-300);
}

@media (prefers-reduced-motion: reduce){
  .theme-toggle{
    transition: none;
  }
  .theme-toggle:hover,
  .theme-toggle:focus-visible{
    transform: none;
  }
}
.planner-demo-mode .planner-demo-spotlight-target button:disabled{
  opacity: 1;
  filter: none;
  color: var(--ink);
  -webkit-text-fill-color: currentColor;
  cursor: default;
}

/* Compact shared controls. */
@media (max-width: 1024px){

  .work-mode-switch{
    min-width: 0;
    width: 100%;
  }

  .work-mode-switch__button{
    flex: 1 1 0;
    min-width: 0;
  }
  .planner-primary-action.sidebar-top-actions__save{
    display: inline-flex;
    justify-content: center;
    min-width: 0;
    min-height: 44px;
    padding-inline: 10px;
  }

  .manage-calendar-link,
  .theme-toggle{
    flex: 1 1 100%;
    width: 100%;
  }
}

.sidebar-top-actions{
  display: grid;
  gap: 0;
  justify-items: center;
  padding: 9px 0 0;
}

.sidebar-top-actions__save{
  width: 100%;
  min-height: 42px;
  margin: 0 0 9px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--brand-500) 30%, var(--surface-2));
  border-color: color-mix(in srgb, var(--brand-400) 65%, var(--surface-4));
  color: #fff;
}

.sidebar-top-actions__save:hover{
  border-color: var(--brand-300);
}

.sidebar-top-actions__secondary-row{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}


@media (max-width: 767px){
  .planner-sidebar{
    margin-top: 10px;
    padding: 12px 14px;
  }
}

.crop-tray{
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}

.crop-tray-panel{
  min-height: 0;
  flex: 1 1 auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  border-top: 0;
}

.screen-title{ display: none; }

/* -----------------------------------------
   2) CONTROLS DRAWER (LEFT) — retro dark panel
----------------------------------------- */
#controlsDrawer{
  background: var(--surface-1);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#controlsDrawer{
  width: 100%;
  position: relative;
  transition: width .25s ease, border-color .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.grid-controls{
  border: none;
  padding: 11px 14px;
  display: grid;
  gap: 8px;
}

.controls-toggle-btn{
  min-height: 30px;
  padding: 4px 10px;
  font-size: .78rem;
}

.controls-sections{
  display: grid;
  gap: 10px;
}

.controls-section{
  display: grid;
  gap: 6px;
  text-align: center;
}

.controls-section + .controls-section{
  border-top: 1px solid color-mix(in srgb, var(--surface-4) 55%, transparent);
  padding-top: 10px;
}

.controls-section-title{
  margin: 0;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .045em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--ink-dim) 82%, transparent);
  text-align: center;
}

#gridZoom{
  width: 100%;
}

.grid-buttons{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
}

.grid-buttons > *{ height: 100%; }

.save-actions,
.export-actions,
.plot-size-controls{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
}

.plot-size-controls{
  grid-template-columns: 1fr;
}

.export-status{
  margin-top: 2px;
}

.helper-text{
  margin: 0;
  font-size: .74rem;
  color: var(--ink-dim);
  text-align: center;
}

.grid-buttons #undoBtn{
  grid-column: 1 / -1;
}

.grid-buttons #resetBtn{
  grid-column: 1 / -1;
  margin-top: 6px;
}


#exportBtn,
#printBtn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Inputs */
input[type="text"],
input[type="number"],
select{
  font-size: 1rem;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--surface-3);
  background: var(--surface-2);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
select{
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 3px),
    calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}
input:focus, select:focus{
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-400) 25%, transparent);
  outline: none;
}

/* Buttons */
button,
input[type="submit"]{
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--surface-4);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .15s, transform .06s;
}
button:hover{ border-color: var(--brand-300); }
button:active{ transform: translateY(1px); }
button.secondary{ background: #0f1716; }
button.secondary:hover{ border-color:#2a6; }
button.subtle{ background: none; border-style: dashed; color: var(--ink-dim); }
button.subtle:hover{ border-color: var(--brand-400); color: var(--ink); }
button.danger{
  background: color-mix(in srgb, #f04f45 18%, var(--surface-2));
  border-color: color-mix(in srgb, #f04f45 70%, var(--surface-4));
  color: #fff;
}
button.danger:hover{ border-color: #f04f45; }
button.danger.is-confirming{
  background: #f04f45;
  border-color: #f04f45;
  color: #fff;
}

.active-state{
  background: #3a7bff;
  border-color: #3a7bff;
  color: white !important;
  box-shadow: 0 0 10px rgba(58, 123, 255, 0.6);
}

.export-status{
  font-size: .9rem;
  color: var(--ink-dim);
  min-height: 1.2em;
}

/* -----------------------------------------
   3) GRID AREA — CRT-esque screen, thin glow on states
----------------------------------------- */
.grid-wrapper{
  --grid-ruler-thickness: 24px;
  display: grid;
  grid-template-columns: var(--grid-ruler-thickness) max-content;
  grid-template-rows: var(--grid-ruler-thickness) max-content;
  align-items: start;
  justify-items: start;
  gap: var(--grid-gap, 2px);
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  position: relative;
}

.grid-corner{
  grid-column: 1;
  grid-row: 1;
  width: var(--grid-ruler-thickness);
  height: var(--grid-ruler-thickness);
  border: 1px solid color-mix(in srgb, var(--surface-3) 65%, transparent);
  background: color-mix(in srgb, var(--surface-2) 65%, transparent);
  opacity: .45;
}

.grid-ruler{
  display: grid;
  gap: var(--grid-gap, 2px);
  width: max-content;
  color: color-mix(in srgb, var(--ink-dim) 82%, white 18%);
  font-size: 0.68rem;
  line-height: 1;
  user-select: none;
}

.grid-ruler--top{
  grid-column: 2;
  grid-row: 1;
  grid-template-columns: repeat(1, var(--grid-square-size-effective));
}

.grid-ruler--left{
  grid-column: 1;
  grid-row: 2;
  grid-template-rows: repeat(1, var(--grid-square-size-effective));
}

.grid-ruler-cell{
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .8;
}

.grid-ruler--top .grid-ruler-cell{
  width: var(--grid-square-size-effective);
  height: var(--grid-ruler-thickness);
}

.grid-ruler--left .grid-ruler-cell{
  width: var(--grid-ruler-thickness);
  height: var(--grid-square-size-effective);
  justify-content: flex-end;
  padding-right: 6px;
}

.grid-ruler--left .grid-ruler-cell::before{
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  width: 6px;
  border-top: 1px solid color-mix(in srgb, var(--ink-dim) 52%, transparent);
  transform: translateY(-50%);
  opacity: .55;
}

.grid-ruler--left .grid-ruler-cell.is-major::before{
  width: 10px;
  border-top-color: color-mix(in srgb, var(--ink) 55%, transparent);
  opacity: .75;
}

/* Keep the container's bezel without introducing extra spacing */
#grid-container{
  grid-column: 2;
  grid-row: 2;
  display: grid;
  position: relative;
  /* JS will set gridTemplateColumns/Rows explicitly */
  gap: var(--grid-gap, 2px);
  border: 1px solid var(--surface-3);
  border-radius: 0;
  background: repeating-linear-gradient(0deg, #0f141b, #0f141b 1px, #121924 2px, #121924 3px);
  /* no extra internal padding that would distort grid lines */
}

.grid-square{
  width: var(--grid-square-size-effective);
  height: var(--grid-square-size-effective);
  border: 1px solid var(--surface-3);
  background: #0c1118;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  outline: none;
}

.placed-veg-icon{
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: clamp(3px, 9%, 8px);
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.35));
}

.grid-square.terrain-tile{
  overflow: hidden;
}

.grid .placed-veg-icon {
  z-index: 2;
}

.bed-label-layer{
  position: absolute;
  inset: 0;
  overflow: visible;
  pointer-events: none;
  z-index: 65;
}

.bed-label-tag{
  position: absolute;
  z-index: 1;
  max-width: calc((var(--grid-square-size-effective) * 3) + (var(--grid-gap, 2px) * 2));
  padding: 2px 7px;
  border: 1px solid rgba(255,255,255,.76);
  border-radius: 999px;
  background: rgba(8,10,14,.9);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.4), 0 0 0 1px rgba(0,0,0,.18);
  text-shadow: 0 1px 1px rgba(0,0,0,.85);
  transform: translate(3px, 3px);
  font-size: clamp(.62rem, calc(var(--grid-square-size-effective) * .2), .8rem);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: .01em;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

:root[data-theme="light"] .bed-label-tag{
  border-color: rgba(255,255,255,.9);
  background: rgba(20,29,43,.9);
  color: #fff;
}

.veg-label-inside{
  position: absolute;
  bottom: 2px; left: 0; right: 0;
  padding: 2px 4px;
  background: rgba(8,10,14,.75);
  font-size: .64rem;
  text-align: center;
  color: var(--ink);
  border-top: 1px solid rgba(255,255,255,.06);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}

/* Tooltips */
.grid-square[data-companion]{ cursor: pointer; }
.grid-square[data-companion]::after{
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: #0a0f15;
  color: var(--ink);
  padding: 6px 8px;
  border-radius: 8px;
  font-size: .76rem;
  border: 1px solid var(--surface-3);
  box-shadow: 0 8px 18px rgba(0,0,0,.45);
  opacity: 0; visibility: hidden;
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
}
.grid-square[data-companion]:hover::after,
.grid-square[data-companion].show-tooltip::after{
  opacity: 1; visibility: visible;
}

:root[data-theme="light"] .grid-corner{
  border-color: color-mix(in srgb, var(--surface-4) 88%, #8b7a5f);
  background: color-mix(in srgb, var(--surface-2) 78%, #fff);
  opacity: .78;
}

:root[data-theme="light"] .grid-ruler{
  color: #56615f;
}

:root[data-theme="light"] .grid-ruler-cell{
  opacity: .92;
}

:root[data-theme="light"] .grid-ruler--left .grid-ruler-cell::before{
  border-top-color: color-mix(in srgb, var(--ink-dim) 72%, transparent);
  opacity: .82;
}

:root[data-theme="light"] .grid-ruler--left .grid-ruler-cell.is-major::before{
  border-top-color: color-mix(in srgb, var(--ink) 68%, transparent);
  opacity: .92;
}

:root[data-theme="light"] #grid-container{
  border-color: color-mix(in srgb, var(--surface-4) 88%, #8b7a5f);
  background:
    repeating-linear-gradient(
      0deg,
      color-mix(in srgb, var(--surface-3) 50%, #fff) 0 1px,
      color-mix(in srgb, var(--surface-2) 82%, #d4c6aa) 1px 3px
    );
}

:root[data-theme="light"] .grid-square{
  border-color: color-mix(in srgb, var(--surface-4) 82%, #8b7a5f);
  background: color-mix(in srgb, var(--surface-1) 78%, var(--surface-2));
}

:root[data-theme="light"] .veg-label-inside{
  color: var(--ink);
  background: color-mix(in srgb, var(--surface-1) 88%, transparent);
  border-top-color: color-mix(in srgb, var(--surface-4) 70%, transparent);
}

:root[data-theme="light"] .grid-square[data-companion]::after{
  color: var(--ink);
  background: color-mix(in srgb, var(--surface-1) 92%, #fff);
  border-color: color-mix(in srgb, var(--surface-4) 88%, #8b7a5f);
  box-shadow: 0 8px 18px color-mix(in srgb, #6b4d1d 18%, transparent);
}

:root[data-theme="light"] .terrain-tile.terrain--soil{
  background:
    radial-gradient(circle at 18% 25%, rgba(73, 43, 24, .42) 0 1.2px, transparent 1.6px),
    radial-gradient(circle at 72% 35%, rgba(143, 91, 48, .32) 0 1.5px, transparent 1.9px),
    radial-gradient(circle at 46% 78%, rgba(83, 52, 28, .34) 0 1.1px, transparent 1.5px),
    #8b5f3d !important;
  border-color: #6e472d !important;
}

:root[data-theme="light"] .terrain-tile.terrain--footpath{
  background:
    radial-gradient(circle at 22% 30%, rgba(120, 74, 42, .30) 0 1.5px, transparent 1.8px),
    radial-gradient(circle at 68% 22%, rgba(172, 127, 82, .34) 0 1.4px, transparent 1.8px),
    radial-gradient(circle at 34% 74%, rgba(100, 66, 41, .28) 0 1.3px, transparent 1.7px),
    radial-gradient(circle at 78% 70%, rgba(151, 105, 63, .24) 0 1.6px, transparent 2px),
    #b58b5f !important;
  border-color: #8f6844 !important;
}

:root[data-theme="light"] .terrain-tile.terrain--woodchip{
  background:
    repeating-linear-gradient(25deg, rgba(115, 69, 31, .34) 0 3px, transparent 3px 10px),
    repeating-linear-gradient(115deg, rgba(187, 123, 55, .28) 0 2px, transparent 2px 12px),
    #b77c3d !important;
  border-color: #8a5727 !important;
}

:root[data-theme="light"] .terrain-tile.terrain--grass{
  background:
    repeating-linear-gradient(82deg, rgba(230, 242, 157, .22) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(12deg, rgba(38, 106, 47, .28) 0 2px, transparent 2px 8px),
    #6f9a4f !important;
  border-color: #4f7b39 !important;
}

:root[data-theme="light"] .terrain-tile.terrain--gravel{
  background:
    radial-gradient(circle at 20% 24%, rgba(255, 250, 229, .54) 0 2px, transparent 2.4px),
    radial-gradient(circle at 70% 30%, rgba(111, 108, 98, .38) 0 1.8px, transparent 2.2px),
    radial-gradient(circle at 42% 74%, rgba(210, 198, 166, .44) 0 2.2px, transparent 2.6px),
    #aaa18e !important;
  border-color: #827968 !important;
}

:root[data-theme="light"] .terrain-tile.terrain--paving{
  background:
    linear-gradient(90deg, rgba(77, 73, 65, .28) 1px, transparent 1px),
    linear-gradient(0deg, rgba(77, 73, 65, .28) 1px, transparent 1px),
    #a8aaa5 !important;
  border-color: #7b807c !important;
}

:root[data-theme="light"] .terrain-tile.terrain--compost{
  background:
    radial-gradient(circle at 25% 32%, rgba(138, 91, 44, .36) 0 1.5px, transparent 1.9px),
    radial-gradient(circle at 65% 66%, rgba(69, 41, 22, .44) 0 1.8px, transparent 2.2px),
    radial-gradient(circle at 80% 24%, rgba(152, 103, 49, .30) 0 1.2px, transparent 1.6px),
    #68462d !important;
  border-color: #4c321f !important;
}

:root[data-theme="light"] .terrain-tile.terrain--straw-mulch{
  background:
    repeating-linear-gradient(30deg, rgba(255, 238, 160, .44) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(115deg, rgba(158, 109, 42, .26) 0 1px, transparent 1px 11px),
    #d2a75b !important;
  border-color: #9c7434 !important;
}

:root[data-theme="light"] :is(
  .crop-card__summary-line,
  .crop-card__summary-value
){
  color: #263238;
}

:root[data-theme="light"] :is(
  .crop-card__summary-label
){
  color: #4e5a58;
}
.companion-card,
.crop-card{
  width: 100%;
  margin: 0;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--surface-4) 58%, var(--surface-3));
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--surface-2) 97%, transparent),
      color-mix(in srgb, #101722 93%, transparent)
    );
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
  display: grid;
}
.companion-card{
  gap: 8px;
}
.companion-card__heading{
  margin: 0;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.companion-card__heading{
  color: color-mix(in srgb, var(--ink-dim) 84%, white);
}
.companion-card__section{
  display: grid;
  gap: 6px;
}
.companion-card__section + .companion-card__section{
  padding-top: 6px;
  border-top: 1px solid color-mix(in srgb, var(--surface-3) 65%, transparent);
}
.companion-card__section-title{
  margin: 0;
  font-size: .74rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.companion-card__section--good .companion-card__section-title{
  color: color-mix(in srgb, #8fdc9f 84%, var(--ink));
}
.companion-card__section--bad .companion-card__section-title{
  color: color-mix(in srgb, #ff9d93 84%, var(--ink));
}
.companion-card__chips{
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.companion-chip{
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .75rem;
  line-height: 1.25;
  letter-spacing: .02em;
  border: 1px solid transparent;
  white-space: normal;
  overflow-wrap: anywhere;
}
.companion-chip--good{
  color: #d5fbe1;
  border-color: rgba(87, 177, 109, .52);
  background: linear-gradient(180deg, rgba(38, 80, 49, .95), rgba(24, 53, 32, .95));
}
.companion-chip--bad{
  color: #ffd4cf;
  border-color: rgba(188, 88, 78, .52);
  background: linear-gradient(180deg, rgba(108, 46, 38, .95), rgba(70, 28, 25, .95));
}
.companion-card__empty{
  margin: 0;
  color: var(--ink-dim);
  font-size: .84rem;
  line-height: 1.35;
  font-style: italic;
}
.crop-card{
  gap: 8px;
  justify-items: stretch;
}

.crop-card--compact{
  gap: 7px;
  padding: 12px;
}

body.planner-phone-mode .crop-card--phone-compact{
  gap: 5px;
  padding: 9px 10px;
  border-radius: 10px;
}

body.planner-phone-mode .crop-card--phone-compact .crop-card__title{
  font-size: .93rem;
  line-height: 1.2;
}

body.planner-phone-mode .crop-card--phone-compact .crop-card__density{
  font-size: .82rem;
  line-height: 1.2;
}

body.planner-phone-mode .crop-card--phone-compact .crop-card__summary{
  gap: 4px;
}

body.planner-phone-mode .crop-card--phone-compact .crop-card__summary-line{
  font-size: .78rem;
  line-height: 1.32;
}

.crop-card--compact .crop-card__title{
  text-align: left;
}

.crop-card__density{
  margin: 0;
  color: color-mix(in srgb, var(--ink) 92%, white);
  font-size: .92rem;
  font-weight: 700;
  line-height: 1.25;
}

.crop-card__summary{
  display: grid;
  gap: 5px;
}

.crop-card__summary-line{
  margin: 0;
  color: var(--ink);
  font-size: .84rem;
  line-height: 1.45;
}

.crop-card__summary-label{
  color: var(--ink-dim);
  font-weight: 700;
}
.crop-card__summary-value{
  color: var(--ink);
}

.companion-label{
  font-weight: 800;
}

.companion-label--good{
  color: color-mix(in srgb, var(--brand-green, #67c26a) 86%, white);
}

.companion-label--avoid{
  color: #ff8a8a;
}
.crop-card__title{
  margin: 0;
  font-size: 1rem;
  max-width: 100%;
  text-align: center;
  overflow-wrap: anywhere;
}
.crop-card__diagram-slot{
  width: min(100%, 160px);
  min-height: 120px;
  max-height: 160px;
  margin: 2px 0 4px;
  padding: 8px;
  align-self: center;
  justify-self: center;
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid #3a2a1a;
  background:
    linear-gradient(180deg, rgba(118, 84, 53, .9), rgba(94, 65, 38, .96)),
    repeating-linear-gradient(
      0deg,
      rgba(50, 33, 20, .35) 0 1px,
      rgba(50, 33, 20, 0) 1px 18px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(50, 33, 20, .35) 0 1px,
      rgba(50, 33, 20, 0) 1px 18px
    );
  box-shadow:
    inset 0 0 0 1px rgba(30, 20, 12, .45),
    0 1px 0 rgba(255, 255, 255, .08);
  overflow: hidden;
}
.crop-card__diagram-slot > *{
  width: 100%;
  max-width: 140px;
  max-height: 140px;
}
.crop-card__diagram-slot svg{
  display: block;
  width: 100%;
  height: auto;
}
.crop-card__diagram-hint{
  margin: -2px 0 2px;
  font-size: .78rem;
  line-height: 1.2;
  color: var(--ink-dim);
  text-align: center;
  max-width: min(100%, 30ch);
}
.crop-card__density-diagram{
  border-radius: 6px;
}

.crop-card__footprint-diagram{
  border-radius: 6px;
}
.crop-card__footprint-cell{
  fill: rgba(35, 23, 14, .55);
  stroke: rgba(130, 94, 60, .65);
  stroke-width: .8;
}
.crop-card__footprint-cell--active{
  fill: #67c26a;
  stroke: #2d7c38;
}
.crop-card__list{
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  width: 100%;
  justify-self: stretch;
  align-items: baseline;
}
.crop-card__list dt{
  color: var(--ink-dim);
}
.crop-card__list dd{
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 420px){
  .crop-card__list{
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .crop-card__list dd{
    margin-bottom: 4px;
  }
}
.crop-card__image{
  width: 100%;
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--surface-3);
  display: block;
}
.crop-detail-actions{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
}
.crop-detail-pill{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid rgba(160, 124, 80, .52);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(54, 37, 24, .96), rgba(34, 23, 15, .96));
  color: color-mix(in srgb, var(--ink) 90%, white);
  font-size: .78rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .03em;
  text-decoration: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .08),
    0 1px 0 rgba(0, 0, 0, .24);
  touch-action: manipulation;
}
.crop-detail-pill:hover,
.crop-detail-pill:focus-visible{
  border-color: rgba(223, 178, 104, .74);
  color: #fff3d7;
  transform: translateY(-1px);
}

/* Crop details are presented as a centred, handheld-game inspired information screen. */
.crop-details-open{ margin-top:.55rem; width:100%; }
.crop-details-dialog[hidden]{ display:none; }
.crop-details-dialog{ position:fixed; inset:0; z-index:10000; display:grid; place-items:center; padding:clamp(16px, 4vh, 44px) clamp(12px, 5vw, 64px); }
.crop-details-dialog__backdrop{ position:absolute; inset:0; background:rgba(3, 8, 12, .76); backdrop-filter:blur(3px); }
.crop-details-dialog__panel{ position:relative; isolation:isolate; display:grid; grid-template-rows:auto minmax(0, 1fr) auto; width:min(92vw, 1120px); height:min(88vh, 900px); overflow:hidden; overscroll-behavior:contain; color:var(--ink); background:var(--surface-1); border:5px solid var(--surface-4); border-radius:24px 24px 42px 24px; box-shadow:0 0 0 3px var(--bg), 0 24px 70px rgba(0,0,0,.6), inset 0 0 0 3px color-mix(in srgb, var(--brand-500) 22%, transparent); }
.crop-details-dialog__topbar{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 14px 10px 18px; border-bottom:2px solid color-mix(in srgb, var(--brand-500) 40%, var(--surface-4)); color:var(--ink-dim); font-size:.72rem; font-weight:700; letter-spacing:.14em; }
.crop-details-dialog__close{ display:grid; flex:0 0 40px; place-items:center; width:40px; height:40px; padding:0; border:3px solid var(--surface-4); border-radius:9px; background:var(--surface-3); color:var(--ink); font:700 1.65rem/1 system-ui; box-shadow:2px 2px 0 var(--bg); cursor:pointer; }
.crop-details-dialog__close:hover{ background:var(--brand-400); color:var(--paper); }
.crop-details-dialog__close:focus-visible{ outline:3px solid var(--brand-amber); outline-offset:3px; }
.crop-details-dialog__body{ min-height:0; overflow-y:auto; padding:clamp(14px, 2.4vw, 26px); scrollbar-color:color-mix(in srgb, var(--brand-500) 72%, var(--surface-4)) color-mix(in srgb, var(--surface-2) 86%, var(--bg)); scrollbar-width:auto; }
.crop-details-dialog__body::-webkit-scrollbar{ width:14px; }
.crop-details-dialog__body::-webkit-scrollbar-track{ background:color-mix(in srgb, var(--surface-2) 86%, var(--bg)); border-left:1px solid color-mix(in srgb, var(--surface-4) 76%, transparent); }
.crop-details-dialog__body::-webkit-scrollbar-thumb{ min-height:44px; border:4px solid color-mix(in srgb, var(--surface-2) 86%, var(--bg)); border-radius:999px; background:color-mix(in srgb, var(--brand-500) 72%, var(--surface-4)); }
.crop-details-dialog__body::-webkit-scrollbar-thumb:hover{ background:var(--brand-500); }
.crop-details-dialog__actions{ padding:12px clamp(14px, 2.4vw, 26px) calc(12px + env(safe-area-inset-bottom)); border-top:2px solid color-mix(in srgb, var(--brand-500) 40%, var(--surface-4)); background:var(--surface-2); }
.crop-details-dialog__actions .crop-detail-actions{ justify-content:flex-end; margin:0; }
.crop-details-dialog__actions .crop-detail-pill{ min-height:38px; padding:9px 14px; }
.field-guide__navigation{ display:grid; grid-template-columns:auto minmax(0, 1fr) auto; gap:10px; align-items:center; margin:16px 0; padding:10px 12px; border:1px solid color-mix(in srgb, var(--brand-500) 38%, var(--surface-4)); border-radius:10px; background:color-mix(in srgb, var(--surface-2) 90%, var(--bg)); box-shadow:inset 0 1px 0 color-mix(in srgb, var(--paper) 8%, transparent); }
.field-guide__chapters{ display:flex; flex-wrap:wrap; gap:6px; justify-content:center; }
.field-guide__navigation button{ min-height:40px; border:1px solid color-mix(in srgb, var(--brand-500) 42%, var(--surface-4)); border-radius:6px; background:var(--surface-3); color:var(--ink); font-weight:500; }
.field-guide__navigation button:not(:disabled):hover{ border-color:var(--brand-amber); color:var(--paper); }
.field-guide__navigation button:disabled{ opacity:.48; cursor:not-allowed; }
.field-guide__chapters [aria-selected="true"]{ border-color:var(--brand-amber); background:color-mix(in srgb, var(--brand-500) 25%, var(--surface-3)); color:var(--paper); font-weight:600; text-decoration:underline; text-decoration-thickness:2px; text-underline-offset:4px; }
.field-guide__navigation button:focus-visible,.field-guide__profile-select:focus-visible,.field-guide__chapter:focus-visible{ outline:3px solid var(--brand-amber); outline-offset:3px; }
.field-guide__chapter{ min-height:240px; overflow-x:hidden; transform-origin:center; }
.field-guide__chapter--turn-a{ animation:field-guide-page-a 200ms ease-out both; }
.field-guide__chapter--turn-b{ animation:field-guide-page-b 200ms ease-out both; }
@keyframes field-guide-page-a{ from{ opacity:.35; transform:translateX(10px); } to{ opacity:1; transform:translateX(0); } }
@keyframes field-guide-page-b{ from{ opacity:.35; transform:translateX(-10px); } to{ opacity:1; transform:translateX(0); } }
.crop-details-requirements p{ white-space:pre-line; }
.field-guide__profile-select{ display:block; width:min(100%, 32rem); min-height:40px; margin-top:6px; }
.visually-hidden{ position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }
.crop-details-content,.crop-details-main{ display:grid; gap:14px; max-width:none; }
.crop-details-header{ display:flex; align-items:center; gap:16px; padding:14px 16px; border:3px solid var(--surface-4); border-radius:12px; background:linear-gradient(135deg, color-mix(in srgb, var(--surface-2) 85%, var(--brand-300)), var(--surface-2)); box-shadow:inset 0 0 0 2px color-mix(in srgb, var(--paper) 10%, transparent), 3px 3px 0 color-mix(in srgb, var(--bg) 55%, transparent); }
.crop-details-icon{ display:block; flex:0 0 clamp(82px, 9vw, 104px); width:clamp(82px, 9vw, 104px); height:clamp(82px, 9vw, 104px); object-fit:contain; image-rendering:auto; filter:drop-shadow(3px 4px 0 rgba(0,0,0,.24)); }
.crop-details-icon--placeholder{ display:grid; place-items:center; border:2px dashed color-mix(in srgb, var(--brand-amber) 65%, var(--surface-4)); border-radius:8px; color:var(--brand-amber); font-size:2rem; filter:none; }
.crop-details-identity{ min-width:0; }
.crop-details-header h2{ margin:0 0 .25rem; color:var(--paper); font-family:"Amatic SC", "Cabin", sans-serif; font-size:clamp(2.35rem, 5vw, 4.2rem); line-height:.9; letter-spacing:.035em; }
.crop-details-scientific{ margin:.25rem 0 .55rem; color:var(--ink-dim); font-size:.94rem; font-style:italic; }
.crop-details-aliases{ max-width:80ch; margin:.55rem 0 0; color:var(--ink-dim); font-size:.75rem; line-height:1.45; white-space:normal; overflow-wrap:anywhere; }
.crop-details-badge{ display:inline-block; padding:.22rem .58rem; border:2px solid color-mix(in srgb, var(--brand-green) 65%, var(--paper)); border-radius:4px; background:var(--brand-green); color:#102019; font-size:.75rem; font-weight:800; letter-spacing:.06em; text-transform:uppercase; }
.crop-details-overview{ display:grid; grid-template-columns:minmax(0, .8fr) minmax(0, 1.2fr); gap:14px; align-items:start; align-content:start; }
.crop-details-section{ align-self:start; height:auto; margin:0; padding:13px 14px; border:3px solid var(--surface-4); border-radius:12px; background:color-mix(in srgb, var(--surface-2) 90%, var(--bg)); box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--paper) 8%, transparent); }
.crop-details-section h3{ margin:0 0 .65rem; padding-bottom:.4rem; border-bottom:2px solid color-mix(in srgb, var(--brand-500) 40%, var(--surface-4)); color:var(--brand-amber); font-size:.8rem; letter-spacing:.11em; text-transform:uppercase; }
.crop-details-quick{ display:grid; gap:16px; align-items:start; align-content:start; padding:clamp(16px, 2.2vw, 24px); border-color:color-mix(in srgb, var(--brand-500) 62%, var(--surface-4)); background:color-mix(in srgb, var(--surface-2) 95%, var(--paper)); box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--paper) 11%, transparent), 0 5px 16px rgba(0,0,0,.16); }
.crop-details-quick > h3{ margin-bottom:0; font-size:.82rem; font-weight:800; letter-spacing:.12em; }
.field-guide-overview__facts{ display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:12px; margin:0; }
.field-guide-overview__fact{ min-width:0; padding:14px; border:1px solid color-mix(in srgb, var(--brand-500) 42%, var(--surface-4)); border-left:3px solid var(--brand-500); border-radius:7px; background:color-mix(in srgb, var(--surface-1) 78%, var(--bg)); }
.field-guide-overview__fact dt,.field-guide-overview__feature h4{ margin:0 0 7px; color:var(--ink-dim); font-size:.72rem; font-weight:800; letter-spacing:.1em; line-height:1.35; text-transform:uppercase; }
.field-guide-overview__fact dd{ margin:0; color:var(--paper); font-family:"Cabin", system-ui, sans-serif; font-size:.94rem; font-weight:700; line-height:1.5; }
.field-guide-overview__fact dd + dd{ margin-top:2px; color:var(--ink); font-size:.86rem; font-weight:600; }
.field-guide-overview__feature{ padding:15px 17px; border:1px solid color-mix(in srgb, var(--brand-500) 45%, var(--surface-4)); border-radius:7px; background:color-mix(in srgb, var(--surface-1) 72%, var(--bg)); }
.field-guide-overview__feature h4{ color:var(--brand-amber); }
.field-guide-overview__feature p{ max-width:72ch; margin:0; color:var(--paper); font-family:"Cabin", system-ui, sans-serif; font-size:.9rem; font-weight:650; line-height:1.5; }
.field-guide-overview__harvest{ border-left:4px solid var(--brand-amber); background:color-mix(in srgb, var(--brand-amber) 8%, var(--surface-1)); }
.field-guide-companions{ display:grid; gap:10px; margin-top:4px; }
.field-guide-companions > h3{ margin:0; color:var(--paper); font-family:"Cabin", system-ui, sans-serif; font-size:1rem; line-height:1.35; }
.field-guide-companions__grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(min(18rem, 100%), 1fr)); gap:10px; }
.field-guide-companions__card{ min-width:0; padding:13px 15px; border:1px solid var(--surface-4); border-left:3px solid var(--brand-500); border-radius:7px; background:color-mix(in srgb, var(--surface-1) 76%, var(--bg)); }
.field-guide-companions__card--avoid{ border-left-color:var(--brand-amber); }
.field-guide-companions__card h4{ margin:0 0 8px; color:var(--ink-dim); font-size:.72rem; font-weight:800; letter-spacing:.1em; line-height:1.35; text-transform:uppercase; }
.field-guide-companions__tags{ display:flex; flex-wrap:wrap; gap:6px; margin:0; padding:0; list-style:none; }
.field-guide-companions__tags li{ max-width:100%; padding:4px 8px; border:1px solid color-mix(in srgb, var(--brand-500) 35%, var(--surface-4)); border-radius:999px; color:var(--ink); background:color-mix(in srgb, var(--brand-500) 7%, var(--surface-2)); font-family:"Cabin", system-ui, sans-serif; font-size:.75rem; line-height:1.35; overflow-wrap:anywhere; }
.field-guide-companions__card--avoid .field-guide-companions__tags li{ border-color:color-mix(in srgb, var(--brand-amber) 35%, var(--surface-4)); background:color-mix(in srgb, var(--brand-amber) 7%, var(--surface-2)); }
.field-guide-companions__disclaimer{ max-width:78ch; margin:0; color:var(--ink-dim); font-family:"Cabin", system-ui, sans-serif; font-size:.75rem; line-height:1.5; }
.crop-details-row{ align-self:start; height:auto; margin:8px 0 0; padding:9px 10px; border-left:2px solid color-mix(in srgb, var(--brand-500) 65%, var(--surface-4)); border-radius:4px; background:color-mix(in srgb, var(--surface-1) 68%, var(--bg)); }
.crop-details-row h4{ margin:0 0 .35rem; color:var(--paper); font-size:.9rem; line-height:1.25; text-transform:capitalize; }
.crop-details-row p,.crop-details-section > p{ margin:5px 0; font-size:.9rem; line-height:1.55; }
.crop-details-row strong,.crop-details-section > p strong{ color:var(--ink-dim); font-size:.94em; letter-spacing:.025em; }
.crop-details-propagation,.crop-details-spacing,.crop-details-harvest{ display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:12px; align-items:start; align-content:start; }
.crop-details-propagation h3,.crop-details-calendar h3,.crop-details-spacing h3,.crop-details-harvest h3{ grid-column:1 / -1; }
.crop-details-calendar{ display:grid; gap:12px; align-items:start; align-content:start; padding:clamp(16px, 2.2vw, 24px); }
.field-guide-calendar__selector{ min-width:0; padding:12px 14px; border:1px solid color-mix(in srgb, var(--brand-500) 38%, var(--surface-4)); border-radius:7px; background:color-mix(in srgb, var(--surface-1) 72%, var(--bg)); color:var(--ink-dim); font-size:.72rem; font-weight:800; letter-spacing:.08em; line-height:1.4; text-transform:uppercase; }
.field-guide-calendar__content{ min-width:0; }
.field-guide-calendar__profile{ min-width:0; padding:18px 20px; border:2px solid color-mix(in srgb, var(--brand-500) 55%, var(--surface-4)); border-left:5px solid var(--brand-500); border-radius:8px; background:color-mix(in srgb, var(--surface-1) 76%, var(--bg)); }
.field-guide-calendar__profile > header{ display:flex; align-items:start; justify-content:space-between; gap:14px; }
.field-guide-calendar__profile h4{ margin:0; color:var(--paper); font-family:"Cabin", system-ui, sans-serif; font-size:.94rem; font-weight:750; line-height:1.45; }
.field-guide-calendar__badge{ flex:0 0 auto; padding:4px 8px; border:1px solid var(--brand-amber); border-radius:4px; color:var(--brand-amber); font-size:.7rem; font-weight:850; letter-spacing:.1em; line-height:1.2; text-transform:uppercase; }
.field-guide-calendar__facts{ display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:10px; margin:15px 0 0; }
.field-guide-calendar__facts > div{ min-width:0; padding:11px 12px; border-left:3px solid color-mix(in srgb, var(--brand-500) 72%, var(--surface-4)); background:color-mix(in srgb, var(--surface-2) 78%, var(--bg)); }
.field-guide-calendar__facts dt,.field-guide-calendar__note h5{ margin:0 0 5px; color:var(--ink-dim); font-size:.72rem; font-weight:800; letter-spacing:.08em; line-height:1.4; text-transform:uppercase; }
.field-guide-calendar__facts dd{ margin:0; color:var(--paper); font-family:"Cabin", system-ui, sans-serif; font-size:.88rem; font-weight:700; line-height:1.5; }
.field-guide-calendar__note{ margin-top:15px; padding:13px 15px; border-top:1px solid color-mix(in srgb, var(--brand-500) 38%, var(--surface-4)); background:color-mix(in srgb, var(--brand-500) 8%, var(--surface-2)); }
.field-guide-calendar__note p{ max-width:82ch; margin:0; color:var(--ink); font-family:"Cabin", system-ui, sans-serif; font-size:.88rem; font-weight:500; line-height:1.5; white-space:pre-line; }
.crop-details-propagation{ display:grid; grid-template-columns:1fr; gap:18px; padding:clamp(16px, 2.2vw, 24px); }
.crop-details-propagation > h3{ margin-bottom:0; }
.field-guide-propagation__featured,.field-guide-propagation__alternatives{ display:grid; gap:9px; min-width:0; }
.field-guide-propagation__featured > h4,.field-guide-propagation__alternatives > h4{ margin:0; color:var(--ink-dim); font-size:.72rem; font-weight:800; letter-spacing:.1em; line-height:1.4; text-transform:uppercase; }
.field-guide-propagation__grid{ display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:12px; align-items:start; }
.field-guide-propagation__route{ min-width:0; padding:15px 16px; border:1px solid color-mix(in srgb, var(--brand-500) 38%, var(--surface-4)); border-radius:8px; background:color-mix(in srgb, var(--surface-1) 72%, var(--bg)); }
.field-guide-propagation__route--primary{ padding:18px 20px; border:2px solid color-mix(in srgb, var(--brand-amber) 64%, var(--surface-4)); border-left-width:5px; background:color-mix(in srgb, var(--brand-500) 10%, var(--surface-1)); box-shadow:inset 0 1px 0 color-mix(in srgb, var(--paper) 8%, transparent); }
.field-guide-propagation__route > header{ display:flex; align-items:start; justify-content:space-between; gap:14px; }
.field-guide-propagation__route h5{ margin:0; color:var(--paper); font-family:"Cabin", system-ui, sans-serif; font-size:.94rem; font-weight:750; line-height:1.45; }
.field-guide-propagation__badge{ flex:0 0 auto; padding:4px 8px; border:1px solid var(--brand-amber); border-radius:4px; color:var(--brand-amber); font-size:.7rem; font-weight:850; letter-spacing:.1em; line-height:1.2; text-transform:uppercase; }
.field-guide-propagation__facts{ display:grid; grid-template-columns:repeat(auto-fit, minmax(9rem, 1fr)); gap:9px; margin:14px 0 0; }
.field-guide-propagation__facts > div{ min-width:0; padding:10px 11px; border-left:3px solid color-mix(in srgb, var(--brand-500) 72%, var(--surface-4)); background:color-mix(in srgb, var(--surface-2) 78%, var(--bg)); }
.field-guide-propagation__facts dt,.field-guide-propagation__instructions h6{ margin:0 0 5px; color:var(--ink-dim); font-size:.72rem; font-weight:800; letter-spacing:.08em; line-height:1.4; text-transform:uppercase; }
.field-guide-propagation__facts dd{ margin:0; color:var(--paper); font-family:"Cabin", system-ui, sans-serif; font-size:.88rem; font-weight:700; line-height:1.5; }
.field-guide-propagation__instructions{ margin-top:14px; padding-top:12px; border-top:1px solid color-mix(in srgb, var(--brand-500) 32%, var(--surface-4)); }
.field-guide-propagation__instructions p{ max-width:72ch; margin:0; color:var(--ink); font-family:"Cabin", system-ui, sans-serif; font-size:.88rem; font-weight:500; line-height:1.5; white-space:pre-line; }
.crop-details-spacing{ display:grid; grid-template-columns:1fr; gap:18px; padding:clamp(16px, 2.2vw, 24px); }
.crop-details-spacing > h3{ margin-bottom:0; }
.field-guide-spacing__featured,.field-guide-spacing__layouts{ display:grid; gap:9px; min-width:0; }
.field-guide-spacing__featured > h4,.field-guide-spacing__layouts > h4{ margin:0; color:var(--ink-dim); font-size:.72rem; font-weight:800; letter-spacing:.1em; line-height:1.4; text-transform:uppercase; }
.field-guide-spacing__grid{ display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:12px; align-items:start; }
.field-guide-spacing__profile{ min-width:0; padding:15px 16px; border:1px solid color-mix(in srgb, var(--brand-500) 38%, var(--surface-4)); border-radius:8px; background:color-mix(in srgb, var(--surface-1) 72%, var(--bg)); }
.field-guide-spacing__profile--featured{ padding:18px 20px; border:2px solid color-mix(in srgb, var(--brand-amber) 64%, var(--surface-4)); border-left-width:5px; background:color-mix(in srgb, var(--brand-500) 10%, var(--surface-1)); box-shadow:inset 0 1px 0 color-mix(in srgb, var(--paper) 8%, transparent); }
.field-guide-spacing__profile > header{ display:flex; align-items:start; justify-content:space-between; gap:14px; }
.field-guide-spacing__profile h5{ margin:0; color:var(--paper); font-family:"Cabin", system-ui, sans-serif; font-size:.94rem; font-weight:750; line-height:1.45; }
.field-guide-spacing__badge{ flex:0 0 auto; padding:4px 8px; border:1px solid var(--brand-amber); border-radius:4px; color:var(--brand-amber); font-size:.7rem; font-weight:850; letter-spacing:.1em; line-height:1.2; text-transform:uppercase; }
.field-guide-spacing__facts{ display:grid; grid-template-columns:repeat(auto-fit, minmax(9rem, 1fr)); gap:9px; margin:14px 0 0; }
.field-guide-spacing__facts > div{ min-width:0; padding:10px 11px; border-left:3px solid color-mix(in srgb, var(--brand-500) 72%, var(--surface-4)); background:color-mix(in srgb, var(--surface-2) 78%, var(--bg)); }
.field-guide-spacing__facts dt,.field-guide-spacing__note h6{ margin:0 0 5px; color:var(--ink-dim); font-size:.72rem; font-weight:800; letter-spacing:.08em; line-height:1.4; text-transform:uppercase; }
.field-guide-spacing__facts dd{ margin:0; color:var(--paper); font-family:"Cabin", system-ui, sans-serif; font-size:.88rem; font-weight:700; line-height:1.5; }
.field-guide-spacing__note{ margin-top:14px; padding-top:12px; border-top:1px solid color-mix(in srgb, var(--brand-500) 32%, var(--surface-4)); }
.field-guide-spacing__note p{ max-width:72ch; margin:0; color:var(--ink); font-family:"Cabin", system-ui, sans-serif; font-size:.88rem; font-weight:500; line-height:1.5; white-space:pre-line; }
.crop-details-harvest{ grid-template-columns:1fr; gap:14px; padding:clamp(16px, 2.2vw, 24px); }
.crop-details-harvest > h3{ margin-bottom:0; }
.field-guide-harvest__stages{ display:grid; gap:14px; min-width:0; }
.field-guide-harvest__stage{ min-width:0; padding:18px 20px; border:2px solid color-mix(in srgb, var(--brand-500) 52%, var(--surface-4)); border-left:5px solid var(--brand-500); border-radius:8px; background:color-mix(in srgb, var(--surface-1) 76%, var(--bg)); }
.field-guide-harvest__stage > h4{ margin:0; color:var(--paper); font-family:"Cabin", system-ui, sans-serif; font-size:.94rem; font-weight:750; line-height:1.45; }
.field-guide-harvest__facts{ display:grid; grid-template-columns:repeat(auto-fit, minmax(12rem, 1fr)); gap:10px; margin:15px 0 0; }
.field-guide-harvest__facts > div{ min-width:0; padding:11px 12px; border-left:3px solid color-mix(in srgb, var(--brand-500) 72%, var(--surface-4)); background:color-mix(in srgb, var(--surface-2) 78%, var(--bg)); }
.field-guide-harvest__facts dt,.field-guide-harvest__instruction h5{ margin:0 0 5px; color:var(--ink-dim); font-size:.72rem; font-weight:800; letter-spacing:.08em; line-height:1.4; text-transform:uppercase; }
.field-guide-harvest__facts dd{ margin:0; color:var(--paper); font-family:"Cabin", system-ui, sans-serif; font-size:.88rem; font-weight:700; line-height:1.5; }
.field-guide-harvest__instruction{ margin-top:14px; padding-top:12px; border-top:1px solid color-mix(in srgb, var(--brand-500) 32%, var(--surface-4)); }
.field-guide-harvest__instruction p{ max-width:78ch; margin:0; color:var(--ink); font-family:"Cabin", system-ui, sans-serif; font-size:.88rem; font-weight:500; line-height:1.5; white-space:pre-line; }
.field-guide-harvest__ready{ padding:13px 15px; border:1px solid color-mix(in srgb, var(--brand-amber) 48%, var(--surface-4)); border-left:4px solid var(--brand-amber); background:color-mix(in srgb, var(--brand-amber) 9%, var(--surface-2)); }
.field-guide-harvest__ready h5{ color:var(--brand-amber); }
.field-guide-harvest__ready p{ color:var(--paper); font-weight:650; }
.field-guide-harvest__storage,.field-guide-harvest__note{ padding:12px 14px; background:color-mix(in srgb, var(--surface-2) 82%, var(--bg)); }
.crop-details-requirements{ display:grid; gap:20px; align-items:start; align-content:start; padding:clamp(16px, 2.2vw, 24px); }
.crop-details-requirements > h3{ margin-bottom:0; }
.field-guide-requirements__section{ display:grid; gap:9px; min-width:0; }
.field-guide-requirements__section > h4{ margin:0; color:var(--ink-dim); font-size:.72rem; font-weight:800; letter-spacing:.1em; line-height:1.4; text-transform:uppercase; }
.field-guide-requirements__facts{ display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:10px; margin:0; }
.field-guide-requirements__facts > div{ min-width:0; padding:12px 13px; border:1px solid color-mix(in srgb, var(--brand-500) 36%, var(--surface-4)); border-left:3px solid var(--brand-500); border-radius:6px; background:color-mix(in srgb, var(--surface-1) 76%, var(--bg)); }
.field-guide-requirements__form .field-guide-requirements__facts > div{ border-left-color:color-mix(in srgb, var(--brand-amber) 72%, var(--brand-500)); background:color-mix(in srgb, var(--surface-2) 82%, var(--bg)); }
.field-guide-requirements__form .field-guide-requirement--support{ grid-column:1 / -1; }
.field-guide-requirements__facts dt{ margin:0 0 6px; color:var(--ink-dim); font-size:.72rem; font-weight:800; letter-spacing:.08em; line-height:1.4; text-transform:uppercase; }
.field-guide-requirements__facts dd{ margin:0; color:var(--paper); font-family:"Cabin", system-ui, sans-serif; font-size:.88rem; font-weight:650; line-height:1.5; white-space:pre-line; }
.field-guide-requirements__notes{ gap:12px; }
.field-guide-requirements__note-list{ display:grid; gap:14px; margin:0; padding:0; list-style:none; }
.field-guide-requirements__note-list > li{ display:grid; grid-template-columns:2.2rem minmax(0, 1fr); gap:12px; max-width:88ch; padding:4px 0 4px 13px; border-left:3px solid color-mix(in srgb, var(--brand-amber) 68%, var(--surface-4)); }
.field-guide-requirements__note-marker{ color:var(--brand-amber); font-size:.72rem; font-weight:800; letter-spacing:.08em; line-height:1.55; }
.field-guide-requirements__note-list p{ margin:0; color:var(--ink); font-family:"Cabin", system-ui, sans-serif; font-size:.88rem; font-weight:500; line-height:1.55; white-space:pre-line; }
.field-guide-requirements__notes-toggle{ justify-self:start; min-height:40px; padding:8px 12px; border:1px solid color-mix(in srgb, var(--brand-amber) 65%, var(--surface-4)); border-radius:6px; background:var(--surface-3); color:var(--paper); font:700 .84rem/1.4 "Cabin", system-ui, sans-serif; }
.field-guide-requirements__notes-toggle:hover{ border-color:var(--brand-amber); color:var(--brand-amber); }
.field-guide-requirements__notes-toggle:focus-visible{ outline:3px solid var(--brand-amber); outline-offset:3px; }
.crop-details-notes{ display:grid; gap:14px; align-items:start; align-content:start; padding:clamp(16px, 2.2vw, 24px); border-color:color-mix(in srgb, var(--brand-500) 55%, var(--surface-4)); background:color-mix(in srgb, var(--surface-2) 94%, var(--bg)); }
.crop-details-notes > h3{ margin-bottom:0; }
.field-guide-notes__list{ display:grid; gap:13px; margin:0; padding:0; list-style:none; }
.field-guide-notes__item{ min-width:0; }
.field-guide-notes__item > article{ display:grid; grid-template-columns:2.2rem minmax(0, 1fr); grid-template-areas:"marker body"; gap:4px 12px; min-width:0; padding:15px 17px; border:1px solid color-mix(in srgb, var(--brand-500) 40%, var(--surface-4)); border-left:4px solid color-mix(in srgb, var(--brand-500) 72%, var(--surface-4)); border-radius:7px; background:color-mix(in srgb, var(--surface-1) 76%, var(--bg)); }
.field-guide-notes__item--labelled > article{ grid-template-columns:minmax(0, 1fr); grid-template-areas:"heading" "body"; }
.field-guide-notes__list:has(> li:only-child) > li > article{ grid-template-columns:minmax(0, 1fr); grid-template-areas:"body"; }
.field-guide-notes__list:has(> li:only-child) > .field-guide-notes__item--labelled > article{ grid-template-areas:"heading" "body"; }
.field-guide-notes__marker{ grid-area:marker; color:var(--ink-dim); font-size:.72rem; font-weight:800; letter-spacing:.09em; line-height:1.55; }
.field-guide-notes__item h4{ grid-area:heading; margin:0 0 2px; color:var(--ink-dim); font-size:.76rem; font-weight:800; letter-spacing:.09em; line-height:1.4; text-transform:uppercase; }
.field-guide-notes__item p{ grid-area:body; max-width:86ch; margin:0; color:var(--ink); font-family:"Cabin", system-ui, sans-serif; font-size:.88rem; font-weight:500; line-height:1.55; white-space:pre-line; }
.field-guide-notes__item--warning > article{ border-color:color-mix(in srgb, var(--brand-amber) 62%, var(--surface-4)); border-left-color:var(--brand-amber); background:color-mix(in srgb, var(--brand-amber) 7%, var(--surface-1)); }
.field-guide-notes__item--warning h4{ color:var(--brand-amber); }
.field-guide-notes__toggle{ justify-self:start; min-height:40px; padding:8px 12px; border:1px solid color-mix(in srgb, var(--brand-500) 62%, var(--surface-4)); border-radius:6px; background:var(--surface-3); color:var(--paper); font:700 .84rem/1.4 "Cabin", system-ui, sans-serif; }
.field-guide-notes__toggle:hover{ border-color:var(--brand-500); color:var(--brand-500); }
.field-guide-notes__toggle:focus-visible{ outline:3px solid var(--brand-amber); outline-offset:3px; }
body.crop-details-dialog-open{ overflow:hidden; }
@media (prefers-reduced-motion:reduce){
  .field-guide__chapter--turn-a,.field-guide__chapter--turn-b{ animation:field-guide-page-reduced 50ms linear both; }
  @keyframes field-guide-page-reduced{ from{ opacity:.85; } to{ opacity:1; } }
}
:root[data-theme="light"] .crop-details-dialog__backdrop{ background:rgba(35, 42, 48, .58); }
:root[data-theme="light"] .crop-details-dialog__panel{ box-shadow:0 0 0 3px var(--bg), 0 24px 70px rgba(55, 42, 25, .32), inset 0 0 0 3px color-mix(in srgb, var(--brand-500) 22%, transparent); }
@media (max-width:949px){ .crop-details-propagation,.crop-details-spacing,.crop-details-harvest{ grid-template-columns:repeat(2, minmax(0, 1fr)); } }
@media (max-width:1199px) and (min-width:1025px){ .field-guide-overview__facts{ grid-template-columns:repeat(2, minmax(0, 1fr)); } .field-guide-propagation__grid{ grid-template-columns:1fr; } .field-guide-spacing__grid{ grid-template-columns:1fr; } .field-guide-calendar__facts{ grid-template-columns:repeat(2, minmax(0, 1fr)); } .field-guide-requirements__facts{ grid-template-columns:repeat(2, minmax(0, 1fr)); } }
@media (max-width:800px){ .crop-details-dialog__panel{ height:min(90vh, 900px); } .crop-details-overview{ grid-template-columns:1fr; } }
@media (max-width:699px){ .crop-details-propagation,.crop-details-spacing,.crop-details-harvest{ grid-template-columns:1fr; } }
@media (max-width:767px){ .crop-details-dialog{ padding:0; } .crop-details-dialog__panel{ width:100%; height:100%; border-width:3px; border-radius:0; } .crop-details-dialog__topbar{ padding-left:max(14px, env(safe-area-inset-left)); padding-right:max(14px, env(safe-area-inset-right)); } .crop-details-dialog__body{ padding:14px max(14px, env(safe-area-inset-right)) 18px max(14px, env(safe-area-inset-left)); } .crop-details-header{ gap:12px; padding:12px; } .crop-details-icon{ flex-basis:64px; width:64px; height:64px; } .crop-details-header h2{ font-size:clamp(2.3rem, 12vw, 3.35rem); } }

body[data-planner-presentation="touch-landscape"] .crop-details-dialog{
  box-sizing:border-box;
  max-height:100dvh;
  grid-template:minmax(0, 1fr) / minmax(0, 1fr);
  padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

body[data-planner-presentation="touch-landscape"] .crop-details-dialog .crop-details-dialog__panel{
  box-sizing:border-box;
  width:100%;
  height:100%;
  grid-template-columns:minmax(0, 1fr);
  border-width:3px;
  border-radius:0;
}
body[data-planner-presentation="touch-landscape"] .crop-details-dialog .crop-details-dialog__topbar{ padding:4px 12px; }
body[data-planner-presentation="touch-landscape"] .crop-details-dialog .crop-details-dialog__close{ flex-basis:44px; width:44px; height:44px; }
body[data-planner-presentation="touch-landscape"] .crop-details-dialog .crop-details-dialog__body{ padding:12px 14px; overscroll-behavior:contain; }
body[data-planner-presentation="touch-landscape"] .crop-details-dialog .crop-details-dialog__actions{ padding:4px 14px; }
body[data-planner-presentation="touch-landscape"] .crop-details-dialog .crop-details-dialog__actions .crop-detail-pill{ min-height:44px; }
body[data-planner-presentation="touch-landscape"] .crop-details-dialog .field-guide__navigation{ gap:4px; padding:2px 6px; }
body[data-planner-presentation="touch-landscape"] .crop-details-dialog .field-guide__navigation button{ min-height:44px; min-width:44px; }
body[data-planner-presentation="touch-landscape"] .crop-details-dialog .field-guide__chapters{
  flex-wrap:nowrap;
  justify-content:flex-start;
  overflow-x:auto;
  overscroll-behavior-x:contain;
  padding:6px;
}
body[data-planner-presentation="touch-landscape"] .crop-details-dialog .field-guide__chapters button{ flex:none; white-space:nowrap; }
body[data-planner-presentation="touch-landscape"] .crop-details-dialog .field-guide__chapter{ min-height:0; }
.crop-detail-pill:focus-visible{
  outline: 2px solid rgba(242, 192, 95, .55);
  outline-offset: 2px;
}
.crop-detail-pill--guide{
  border-color: rgba(113, 173, 103, .44);
  background: linear-gradient(180deg, rgba(38, 62, 36, .94), rgba(27, 41, 25, .96));
}
.crop-detail-pill--buy{
  border-color: rgba(214, 155, 75, .62);
  background: linear-gradient(180deg, rgba(91, 59, 26, .96), rgba(58, 36, 17, .98));
  color: #ffe0a6;
}
.crop-card__state{
  margin: 0;
  font-size: .9rem;
}

/* Chrome / Edge scrollbar styling */
.veg-scroll::-webkit-scrollbar {
    width: 6px;
}

.veg-scroll::-webkit-scrollbar-track {
    background: #1a1c20;
    border-radius: 6px;
}

.veg-scroll::-webkit-scrollbar-thumb {
    background: #3a3f47;
    border-radius: 6px;
}

/* -----------------------------------------
   5) VEG MENU (CATEGORY SELECT + STRIP)
----------------------------------------- */
#veg-menu{
  margin: 0;
  width: 100%;
  max-width: 100%;
  padding: 10px 0 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}

.crop-search-field{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.crop-search-label{
  flex: 0 0 auto;
  color: var(--ink-dim);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1;
  text-transform: uppercase;
}

.crop-search-control{
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}

.crop-search-control__icon{
  position: absolute;
  left: 11px;
  color: color-mix(in srgb, var(--ink-dim) 84%, var(--brand-300));
  font-size: .86rem;
  pointer-events: none;
}

.crop-search-control__input{
  appearance: none;
  width: 100%;
  min-height: 36px;
  padding: 7px 38px 7px 32px;
  border: 1px solid color-mix(in srgb, var(--brand-400) 45%, var(--surface-4));
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(30,39,52,.86), rgba(16,22,30,.86));
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  font: inherit;
  font-size: .92rem;
  font-weight: 700;
  line-height: 1.2;
}

.crop-search-control__input::placeholder{
  color: color-mix(in srgb, var(--ink-dim) 82%, transparent);
}

.crop-search-control__input:hover{
  border-color: var(--brand-300);
}

.crop-search-control__input:focus-visible{
  outline: 2px solid var(--brand-300);
  outline-offset: 2px;
}

.crop-search-control__input::-webkit-search-cancel-button{
  appearance: none;
}

.crop-search-control__clear{
  appearance: none;
  position: absolute;
  right: 3px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: color-mix(in srgb, var(--ink-dim) 82%, transparent);
  cursor: pointer;
}

.crop-search-control__clear[hidden]{
  display: none;
}

.crop-search-control__clear:hover,
.crop-search-control__clear:focus-visible{
  border-color: color-mix(in srgb, var(--brand-400) 38%, transparent);
  background: color-mix(in srgb, var(--surface-4) 55%, transparent);
  color: var(--ink);
}

.crop-search-control__clear:focus-visible{
  outline: 2px solid var(--brand-300);
  outline-offset: 2px;
}

.crop-search-control__input:placeholder-shown + .crop-search-control__clear{
  display: none;
}

:root[data-theme="light"] :is(.crop-search-label, .crop-category-label){
  color: #56615f;
}

:root[data-theme="light"] .crop-search-control__icon{
  color: #56615f;
}

:root[data-theme="light"] .crop-search-control__input{
  background: #fffaf0;
  color: #263238;
  border-color: #c9bda4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75);
}

:root[data-theme="light"] .crop-search-control__input::placeholder{
  color: #6f766f;
}

:root[data-theme="light"] .crop-search-control__clear{
  color: #56615f;
}

:root[data-theme="light"] .crop-search-control__clear:hover,
:root[data-theme="light"] .crop-search-control__clear:focus-visible{
  background: #f4ead8;
  color: #263238;
  border-color: #c9bda4;
}

@media (max-width: 420px){
  .crop-search-field,
  .crop-category-field{
    gap: 6px;
  }

  .crop-search-label,
  .crop-category-label{
    font-size: .74rem;
    letter-spacing: .06em;
  }

  .crop-search-control__input{
    font-size: .88rem;
  }
}

.crop-menu-empty{
  margin: 8px 6px 12px;
  padding: 12px;
  border: 1px dashed color-mix(in srgb, var(--brand-400) 32%, var(--surface-4));
  border-radius: 10px;
  color: var(--ink-dim);
  font-size: .9rem;
  font-weight: 700;
  text-align: center;
}

.crop-category-field{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.crop-category-label{
  flex: 0 0 auto;
  color: var(--ink-dim);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1;
  text-transform: uppercase;
}

.crop-category-select{
  appearance: none;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 36px;
  padding: 7px 34px 7px 10px;
  border: 1px solid color-mix(in srgb, var(--brand-400) 45%, var(--surface-4));
  border-radius: 8px;
  background:
    linear-gradient(45deg, transparent 50%, var(--brand-300) 50%) calc(100% - 17px) 50% / 6px 6px no-repeat,
    linear-gradient(135deg, var(--brand-300) 50%, transparent 50%) calc(100% - 12px) 50% / 6px 6px no-repeat,
    linear-gradient(180deg, rgba(30,39,52,.86), rgba(16,22,30,.86));
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  cursor: pointer;
  font: inherit;
  font-size: .92rem;
  font-weight: 700;
  line-height: 1.2;
}

.crop-category-select:hover{
  border-color: var(--brand-300);
}

.crop-category-select:focus-visible{
  outline: 2px solid var(--brand-300);
  outline-offset: 2px;
}

.crop-category-select option{
  background: #171d26;
  color: var(--ink);
}

:root[data-theme="light"] .crop-category-select{
  background:
    linear-gradient(45deg, transparent 50%, #56615f 50%) calc(100% - 17px) 50% / 6px 6px no-repeat,
    linear-gradient(135deg, #56615f 50%, transparent 50%) calc(100% - 12px) 50% / 6px 6px no-repeat,
    #fffaf0;
  color: #263238;
  border-color: #c9bda4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75);
}

:root[data-theme="light"] .crop-category-select option{
  background: #fffaf0;
  color: #263238;
}

.mobile-toggle{
  display: none;
  width: 100%;
  justify-content: center;
  align-items: center;
  margin-bottom: 6px;
}

body.vegtabs-collapsed #vegTabs{ display: none; }
#vegTabs:empty{ display: none; }

#vegTabs{
  display: flex; justify-content: center; flex-wrap: wrap; gap: 8px;
  margin: 0;
  padding: 0;
}
#vegTabs button{
  appearance: none;
  border: 1px solid var(--surface-4);
  background: var(--surface-2);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, transform .06s, background .15s;
}
#vegTabs button[aria-selected="true"]{
  background: color-mix(in srgb, var(--brand-400) 18%, var(--surface-2));
  border-color: var(--brand-400);
}
#vegTabs button:hover{ border-color: var(--brand-300); }
#vegTabs button:active{ transform: translateY(1px); }

.veg-scroll{
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px 2px 4px;
  min-height: 0;
  flex: 1 1 auto;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  scrollbar-width: thin;          /* Firefox */
  scrollbar-color: color-mix(in srgb, var(--ink-dim) 40%, transparent) transparent;
}

/* Shared icon mechanics also support the planting cursor preview. */
.veg-icon{
  display:flex; align-items:center; justify-content:center; flex:0 0 auto;
}
.veg-icon img{
  width:100%; height:100%; display:block; object-fit:contain;
  image-rendering:auto; pointer-events:none;
}

.place-mode-bar{
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 6px;
  padding: 8px 10px;
  background: var(--surface-1);
  border: 1px solid var(--surface-4);
  border-radius: 10px;
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.3;
}

.place-mode-bar[hidden]{
  display: none;
}

.place-mode-bar__title{
  min-width: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.place-mode-bar__hint{
  color: var(--ink-dim);
  font-size: .8rem;
  font-weight: 500;
}

#crop-cursor-preview{
  position: fixed;
  z-index: 1200;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(0,0,0);
  transition: opacity .12s ease;
}

#crop-cursor-preview.is-visible{
  opacity: .88;
}

#crop-cursor-preview .crop-cursor-preview__icon-host{
  display: block;
}

#crop-cursor-preview .veg-icon{
  border-radius: 6px;
  border-width: 1px;
}

.grid-square.place-pulse{
  animation: placePulse .32s ease;
}

@keyframes placePulse{
  0%{ box-shadow: 0 0 0 0 rgba(109,163,255,.22); }
  60%{ box-shadow: 0 0 0 6px rgba(109,163,255,.18); }
  100%{ box-shadow: 0 0 0 0 rgba(109,163,255,0); }
}

/* -----------------------------------------
   6) PDF EXPORT
----------------------------------------- */
body.pdf-export, body.pdf-export *{ color: #000 !important; }
@media (max-width: 1024px){
  #controlsDrawer{ width: 100%; max-width: 100%; }
  #controlsDrawer[data-state="closed"]{ width: 100%; }
}

@media (min-width: 768px){
  .mobile-toggle{ display: none; }
  body.vegtabs-collapsed #vegTabs{ display: flex; }
}


@media (max-width: 767px){
  .mobile-toggle{ display: inline-flex; }
  body.vegtabs-collapsed #vegTabs{ display: none; }
  #vegTabs{ justify-content: center; }
  #vegTabs button{ padding: 6px 12px; font-size: .95rem; }
  .crop-category-field{
    width: 100%;
    max-width: none;
    justify-content: stretch;
  }
  .crop-category-select{ width: 100%; min-height: 40px; font-size: 1rem; }
  .grid-buttons{
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  }

  .save-actions,
  .export-actions{
    width: 100%;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px){
  #vegTabs button{ font-size: .9rem; }
  .crop-category-field{ align-items: stretch; flex-direction: column; gap: 6px; }
  .crop-category-label{ text-align: left; }
  .crop-category-select{ width: 100%; }
}

/* Screen-reader utility */
.sr-only{
  position: absolute !important;
  height: 1px; width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
  border: 0; padding: 0; margin: -1px;
}

/* Non-interactive overlay layer inside the grid */
.grid-overlay{
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20; /* above cells, below tooltips if any */
}
.overlay-item{
  position: absolute;
  pointer-events: none;
  image-rendering: pixelated; /* retro crispness */
}

/* new: badge layer above canopy images */
.grid-overlay-icons {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 50; /* fruit/badge icons above selection border */
}
.cover-overlay-layer{
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30;
}
.structure-overlay-layer{
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 35;
}

.structure-action-controls{
  position: fixed;
  z-index: 17;
  display: flex;
  gap: 3px;
}
.structure-action-controls[hidden]{ display: none; }
.structure-remove-button{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  margin: 0;
  padding: 0;
  border: 1px solid #59616b;
  border-radius: 4px;
  background: #182029;
  color: #df9996;
  font-size: 21px;
  line-height: 1;
  box-shadow: none;
  cursor: pointer;
}
.structure-remove-button[hidden]{ display: none; }
.structure-remove-button:hover{ background: #30282c; color: #ffc1bc; }
.structure-remove-button:focus-visible{ outline: 2px solid var(--brand-300); outline-offset: 2px; }
.structure-move-button{ color: #c4cbd3; cursor: grab; touch-action: none; font-size: .8rem; }
.structure-move-button:hover{ background: #25333e; color: #e4eaf0; }
.structure-move-button[aria-pressed="true"]{ cursor: grabbing; }
.structure-move-preview{ background: rgba(127, 178, 191, .28); border: 2px dashed #8bbbc5; pointer-events: none; }
.structure-move-preview.is-invalid{ background: rgba(190, 40, 40, .25); border-color: #d76c65; }
@media print{ .structure-action-controls, .structure-move-preview{ display: none !important; } }
@media (pointer: coarse){
  .structure-remove-button{ width: 44px; height: 44px; }
}

/* One perimeter per structure, outside its full-sized growing cells. */
.raised-bed-frame{
  position: absolute;
  box-sizing: border-box;
  pointer-events: none;
  background: transparent;
}
.raised-bed-frame::before{
  content: '';
  position: absolute;
  inset: -3px;
  border: 3px solid #a87545;
  box-shadow: inset 1px 1px 0 #d3a676, inset -1px -1px 0 #734b2d, 0 1px 0 #593b26;
}
.raised-bed-frame.is-selected::before,
.raised-bed-frame:focus-visible::before{
  outline: 2px solid var(--brand-400);
  outline-offset: 2px;
}
/* Metal uses the same overlay box, with a compact SVG perimeter shared by export. */
.raised-bed-frame--metal,
.raised-bed-frame--rounded-metal{
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.raised-bed-frame--metal::before,
.raised-bed-frame--rounded-metal::before{
  inset: 3px;
  border: 0;
  border-radius: inherit;
  box-shadow: none;
}
.raised-bed-frame--metal.is-selected::before,
.raised-bed-frame--rounded-metal.is-selected::before,
.raised-bed-frame--metal:focus-visible::before,
.raised-bed-frame--rounded-metal:focus-visible::before{
  outline-offset: 0;
}
.raised-bed-context{
  display: grid;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--surface-4);
  font-size: .82rem;
}
.raised-bed-context__actions{
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.raised-bed-context__actions button{ min-height: 44px; }
.raised-bed-frame-options{ min-width: 0; margin: 0; padding: 0; border: 0; }
.raised-bed-frame-options legend{ padding: 0; margin-bottom: 4px; color: var(--ink); font-size: .75rem; }
.raised-bed-frame-options__choices{ display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
#raisedBedContext .raised-bed-frame-option{
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  min-width: 0;
  min-height: 64px;
  margin: 0;
  padding: 6px 3px;
  border: 1px solid var(--ink-dim);
  border-radius: 3px;
  color: var(--ink);
  background: var(--surface-1);
  font-size: .66rem;
  line-height: 1.2;
}
#raisedBedContext .raised-bed-frame-option:hover{ background: var(--surface-2); }
#raisedBedContext .raised-bed-frame-option[aria-pressed="true"]{
  border-color: var(--brand-500);
  box-shadow: inset 0 0 0 1px var(--brand-500);
}
.raised-bed-frame-option[aria-pressed="true"]::after{
  content: '✓'; position: absolute; top: 2px; right: 2px;
  padding: 0 2px; color: var(--ink); background: var(--surface-1); font-weight: bold;
}
#raisedBedContext .raised-bed-frame-option:focus-visible{ outline: 2px solid var(--brand-400); outline-offset: 2px; }
.raised-bed-frame-option__preview{
  display: block;
  box-sizing: border-box;
  width: 46px;
  max-width: 85%;
  height: 25px;
  border: 3px solid #a87545;
  background: #4c3523;
  box-shadow: inset 1px 1px 0 #d3a676, inset -1px -1px 0 #734b2d;
}
.raised-bed-frame-option__preview[data-frame="metal"],
.raised-bed-frame-option__preview[data-frame="rounded-metal"]{
  border-color: #9eacb0;
  box-shadow: inset 1px 1px 0 #d3dbdc, 0 1px 0 #68777d;
  border-image: none;
  outline: 1px solid #68777d;
  outline-offset: -1px;
  background: repeating-linear-gradient(90deg, transparent 0 5px, rgba(211,219,220,.14) 5px 6px) top / 100% 2px no-repeat, #4c3523;
}
.raised-bed-frame-option__preview[data-frame="rounded-metal"]{ border-radius: 10px; }
.surface-type-btn__swatch.raised-bed-tool-swatch{
  border: 3px solid #a87545;
  box-shadow: inset 1px 1px 0 #d3a676, 1px 1px 0 #593b26;
}
.raised-bed-tool-active #grid-container{
  cursor: crosshair;
  touch-action: none;
}
.area-erase-preview,
.area-apply-preview{
  position: absolute;
  z-index: 70;
  box-sizing: border-box;
  pointer-events: none;
  background: rgba(210, 45, 45, .18);
  border: 2px solid rgba(220, 55, 55, .9);
  box-shadow: inset 0 0 0 1px rgba(255, 235, 235, .25), 0 0 8px rgba(100, 0, 0, .28);
}
.raised-bed-preview.area-apply-preview{
  border: 0;
  box-shadow: none;
  background: rgba(168, 117, 69, .12);
}
.raised-bed-preview::before{ border-style: dashed; }
.raised-bed-preview.is-invalid::before{ border-color: #e34f4f; }
.raised-bed-preview.is-invalid{ background: rgba(210, 45, 45, .18); }
.raised-bed-preview.raised-bed-frame--metal,
.raised-bed-preview.raised-bed-frame--rounded-metal{
  background-color: rgba(150, 166, 172, .08);
}
.raised-bed-preview.raised-bed-frame--metal.is-invalid,
.raised-bed-preview.raised-bed-frame--rounded-metal.is-invalid{
  background-color: rgba(210, 45, 45, .12);
}

.crop-erase-pending,
.cover-erase-pending{
  outline: 3px solid rgba(220, 45, 45, .95) !important;
  outline-offset: -2px;
  box-shadow: inset 0 0 0 1000px rgba(210, 45, 45, .22) !important;
  filter: sepia(.45) saturate(1.4);
}

.area-erase-pointer-indicator{
  position: fixed;
  z-index: 10000;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  pointer-events: none;
  transform: translate(12px, 12px);
  border: 2px solid rgba(255, 235, 235, .92);
  border-radius: 50%;
  color: #fff;
  background: rgba(190, 30, 36, .96);
  box-shadow: 0 2px 7px rgba(40, 0, 0, .45);
  font: 700 18px/1 system-ui, sans-serif;
}
.timeline-overlay-layer{
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 55;
}
.timeline-activity-marker{
  position: absolute;
  display: block;
  pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--surface-1) 48%, transparent);
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.22);
  animation: timeline-marker-in .12s ease-out;
}

@keyframes timeline-marker-in{
  from { opacity: .72; filter: saturate(.88); }
  to { opacity: 1; filter: saturate(1); }
}
.planner-mode-timeline .plant-wrapper,
.planner-mode-timeline .plant{
  opacity: .86;
}

.cover-area{
  position: absolute;
  pointer-events: none;
  border: 1px solid rgba(214, 232, 255, .45);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.cover-area--draft{
  pointer-events: none;
  border-style: dashed;
  border-color: rgba(255, 255, 255, .9);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5);
}
.cover-area__label{
  position: absolute;
  right: 4px;
  bottom: 4px;
  max-width: calc(100% - 8px);
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(6, 11, 18, .58);
  color: rgba(236, 244, 255, .95);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .03em;
  line-height: 1.25;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cover-area__label[hidden]{ display: none; }
.cover-area__geometry{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  pointer-events: none;
  user-select: none;
}
.cover-netting{
  background:
    repeating-linear-gradient(45deg, rgba(210, 232, 218, .24) 0 2px, rgba(210, 232, 218, .10) 2px 8px),
    repeating-linear-gradient(-45deg, rgba(178, 212, 191, .20) 0 2px, rgba(178, 212, 191, .08) 2px 8px),
    rgba(108, 150, 124, .16);
  border-color: rgba(182, 226, 197, .58);
}
.cover-fleece{
  background: linear-gradient(180deg, rgba(246, 247, 236, .34), rgba(228, 231, 216, .26));
  border-color: rgba(235, 238, 223, .56);
}
.cover-greenhouse,
.cover-polytunnel,
.cover-fruit-cage,
.cover-brassica-cage{
  background: none;
  border-color: transparent;
  box-shadow: none;
}
.cover-area--draft:is(.cover-greenhouse, .cover-polytunnel, .cover-fruit-cage, .cover-brassica-cage){
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
}
.overlay-badge {
  position: absolute;
  pointer-events: none;
  image-rendering: pixelated;
}

/* layering for plant renderer */
.grid { position: relative; }
.plant-wrapper { position: absolute; image-rendering: pixelated; }
.plant-wrapper {
  z-index: 10;
  touch-action: pan-x pan-y;
  background: transparent;
}
.plant-wrapper img,
.plant-wrapper .grid-overlay {
  z-index: 1;
  position: relative;
  image-rendering: pixelated;
  pointer-events: none;
}

.plant-wrapper .canopy {
  z-index: 1;
  position: absolute;
  inset: 0;
  box-sizing: border-box;
  padding: clamp(3px, 7%, 10px);
  object-fit: contain;
  background: transparent;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.35));
}
.plant-wrapper .mini-icon-on-overlay {
  z-index: 2;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(var(--cell-size) * 0.7);
  height: auto;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.35));
  pointer-events: none;
}

/* Individual rotate composes with existing illustration scale/position. Only
   planted artwork participates; wrappers, outlines and overlays stay static. */
.plant-wrapper > .canopy,
.grid-square > .placed-veg-icon {
  /* Match the native rotation at both animation boundaries. */
  rotate: 0deg;
  transform-origin: 50% var(--breeze-base, 89%);
  image-rendering: pixelated;
}
.plant-wrapper > .canopy.crop-breeze,
.grid-square > .placed-veg-icon.crop-breeze {
  animation: var(--breeze-animation, crop-ambient-breeze) var(--breeze-duration, 1400ms) ease-in-out var(--breeze-delay, 0ms) 1 both;
}
@keyframes crop-ambient-breeze {
  0%, 100% { rotate: 0deg; }
  36% { rotate: var(--breeze-angle, 0.8deg); }
  72% { rotate: var(--breeze-return, -0.176deg); }
}
/* Shared lulls retain a little lean between pushes; every segment eases softly
   and the final frame restores the exact resting rotation. */
@keyframes crop-ambient-sustained {
  0%, 100% { rotate: 0deg; }
  18% { rotate: var(--breeze-first); }
  36% { rotate: calc(var(--breeze-angle) * 0.35); }
  58% { rotate: var(--breeze-second); }
  78% { rotate: calc(var(--breeze-angle) * 0.24); }
}
@keyframes crop-ambient-sustained-three {
  0%, 100% { rotate: 0deg; }
  16% { rotate: var(--breeze-first); }
  30% { rotate: calc(var(--breeze-angle) * 0.38); }
  48% { rotate: var(--breeze-second); }
  62% { rotate: calc(var(--breeze-angle) * 0.28); }
  77% { rotate: var(--breeze-third); }
  88% { rotate: calc(var(--breeze-angle) * 0.12); }
}
.exporting .crop-breeze,
.pdf-export .crop-breeze,
#export-capture-root .crop-breeze,
.planner-demo-mode .crop-breeze,
.plant-wrapper.dragging > .crop-breeze {
  animation: none !important;
  rotate: 0deg !important;
}
@media (prefers-reduced-motion: reduce) {
  .crop-breeze { animation: none !important; rotate: 0deg !important; }
}
@media print {
  .crop-breeze { animation: none !important; rotate: 0deg !important; }
}
.plant-wrapper .plant-label { z-index: 3; position: absolute; }

/* Visual feedback for companion status */
.plant.good  { outline: 2px solid #1fae51; }
.plant.bad   { outline: 2px solid #e74c3c; }
.plant.mixed { outline: 2px solid #ff9800; }  /* orange */
.plant.selected{
  outline: 2px solid color-mix(in srgb, var(--brand-400) 70%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-400) 30%, transparent);
}

.plant-wrapper { cursor: grab; }
.plant-wrapper.dragging {
  cursor: grabbing;
  opacity: 0.95;
  touch-action: none;
}
/* Lightweight badge that sits inside the .plant wrapper */
.plant .plant-label {
  position: absolute;
  top: 4px;
  left: 6px;
  padding: 2px 6px;
  font-size: 12px;
  line-height: 1;
  border-radius: 6px;
  background: rgba(16, 22, 28, 0.8);
  color: #cfe9ff;
  border: 1px solid rgba(120,170,255,0.35);
  pointer-events: none;
  z-index: 3;
  text-shadow: 0 1px 0 rgba(0,0,0,.6);
  white-space: nowrap;
}


/* Placed crops keep names in title/aria/data-label instead of permanent badges. */
#grid-container .plant .plant-label,
#grid-container .grid-square .veg-label-inside{
  display: none !important;
}


#grid-container .grid-square[data-veg-label][data-origin="1"]:hover::after,
#grid-container .grid-square[data-veg-label][data-origin="1"]:focus-visible::after{
  content: attr(data-veg-label);
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translate(-50%, -6px);
  z-index: 5;
  max-width: min(16rem, 90vw);
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(10, 15, 21, 0.94);
  color: var(--ink);
  font-size: 0.75rem;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}

#grid-container .plant[data-label]:hover::after,
#grid-container .plant[data-label]:focus-visible::after{
  content: attr(data-label);
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translate(-50%, -6px);
  z-index: 5;
  max-width: min(16rem, 90vw);
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(10, 15, 21, 0.94);
  color: var(--ink);
  font-size: 0.75rem;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}

/* hide interactive chrome during export */
.exporting :is(#controlsDrawer, .palette-block, .drag-handle, .resize-handle, #veg-menu, .menu-bar, .hide-for-export),
.pdf-export :is(#controlsDrawer, .palette-block, .drag-handle, .resize-handle, #veg-menu, .menu-bar, .hide-for-export) {
  display: none !important;
}

.export-composite {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.export-composite .export-insights {
  width: min(320px, 32vw);
  box-sizing: border-box;
  border: 2px solid var(--surface-3);
  border-radius: 10px;
  padding: 12px;
  background: #fff;
}

.export-insights-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(340px, 34vw);
}

.export-insights-summary {
  border: 1px solid var(--surface-4);
  border-radius: 10px;
  padding: 12px;
  background: #f9fbff;
}

.export-insights-summary h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--ink-strong);
}

.export-insight-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.export-insight-card {
  border: 1px solid var(--surface-4);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.export-insight-card p {
  margin: 2px 0;
  line-height: 1.4;
}

.export-insight-card .insight-title {
  font-weight: 700;
  color: var(--ink-strong);
}

.export-insight-card .insight-status {
  color: var(--ink-dim);
}

/* make sure overlay elements are rendered by html2canvas */
.grid-area, #grid-area, .plant-wrapper, .grid-overlay, .grid-overlay-icons, .bed-label-layer, .cover-overlay-layer, .timeline-overlay-layer {
  transform: translateZ(0); /* nudge to a separate layer, stabilizes render */
}

/* Selection border */
.plant.is-selected {
  outline: 2px solid var(--selection-blue);
}
/* ===============================
   Retro Polish Pass — v1
   Layer after style-retro.css + style-retro-layout.css
================================= */

:root{
  --grid-square-size: clamp(40px, 8.5vw, 80px);
  --grid-square-size-effective: calc(var(--grid-square-size) * var(--grid-zoom));
  --grid-gap: 2px;
}
@media (max-width: 1024px){
  :root{
    --grid-square-size: clamp(56px, 12vw, 96px);
  }
}

@media (max-width: 767px){
  :root{
    --grid-square-size: clamp(64px, 16vw, 112px);
  }
}
@media (max-width: 480px){
  :root{
    --grid-square-size: clamp(68px, 18vw, 120px);
  }
}

/* Mobile/tablet crop removal uses double-tap; the legacy selection bar remains hidden. */

/* 2) Veg shelf presence on desktop */
#veg-menu{
  border: 0;
  border-radius: 0;
}
/* 3) Category tab glow/underline */
#vegTabs button{
  position: relative;
  transition: border-color .15s, background .15s, transform .06s, box-shadow .15s;
}
#vegTabs button[aria-selected="true"]{
  background: color-mix(in srgb, var(--brand-400) 18%, var(--surface-2));
  border-color: var(--brand-400);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-400) 30%, transparent);
}
#vegTabs button[aria-selected="true"]::after{
  content: "";
  position: absolute;
  left: 16px; right: 16px; bottom: -6px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--brand-500), transparent);
}

/* 6) Tooltip timing & legibility */
.grid-square[data-companion]::after{
  transition: opacity .12s ease, visibility .12s ease, transform .12s ease;
  transform: translateX(-50%) translateY(-8px);
}
.grid-square[data-companion]:hover::after,
.grid-square[data-companion].show-tooltip::after{
  transform: translateX(-50%) translateY(-10px);
}

/* === Revert grid to original working style === */

/* === Thin, bright highlight borders on dark theme === */
.grid-square.good-neighbor,
.grid-square.bad-neighbor,
.grid-square.mixed-neighbor{
  position: relative;
  background: #0c1118;
}

/* Bright, thin inset border (doesn’t change layout) */
.grid-square.good-neighbor{
  box-shadow:
    0 0 0 2px #2aff8c inset,     /* neon green */
    inset 0 0 10px rgba(42,255,140,.18);
}

.grid-square.bad-neighbor{
  box-shadow:
    0 0 0 2px #ff5c5c inset,     /* neon red */
    inset 0 0 10px rgba(255,92,92,.18);
}

.grid-square.mixed-neighbor{
  box-shadow:
    0 0 0 2px #ffb349 inset,     /* neon orange */
    inset 0 0 10px rgba(255,179,73,.18);
}

.plant.bad-neighbor{
  outline: 2px solid #ff5c5c;
  box-shadow: 0 0 10px rgba(255,92,92,.18);
}
.plant.good-neighbor{
  outline: 2px solid #2aff8c;
  box-shadow: 0 0 10px rgba(42,255,140,.18);
}
.plant.mixed-neighbor{
  outline: 2px solid #ffb349;
  box-shadow: 0 0 10px rgba(255,179,73,.18);
}

:root[data-theme="light"] .grid-square.good-neighbor,
:root[data-theme="light"] .grid-square.bad-neighbor,
:root[data-theme="light"] .grid-square.mixed-neighbor{
  background: color-mix(in srgb, var(--surface-1) 72%, var(--surface-2));
}

:root[data-theme="light"] .grid-square.good-neighbor{
  box-shadow:
    0 0 0 2px #168a45 inset,
    inset 0 0 10px rgba(47, 157, 92, .24);
}

:root[data-theme="light"] .grid-square.bad-neighbor{
  box-shadow:
    0 0 0 2px #c43f35 inset,
    inset 0 0 10px rgba(196, 63, 53, .20);
}

:root[data-theme="light"] .grid-square.mixed-neighbor{
  box-shadow:
    0 0 0 2px #b87516 inset,
    inset 0 0 10px rgba(213, 155, 50, .24);
}

:root[data-theme="light"] .plant.good-neighbor{
  outline-color: #168a45;
  box-shadow: 0 0 10px rgba(47, 157, 92, .24);
}

:root[data-theme="light"] .plant.bad-neighbor{
  outline-color: #c43f35;
  box-shadow: 0 0 10px rgba(196, 63, 53, .20);
}

:root[data-theme="light"] .plant.mixed-neighbor{
  outline-color: #b87516;
  box-shadow: 0 0 10px rgba(213, 155, 50, .24);
}

.plant.is-selected{
  outline: 2px solid var(--brand-400);
  box-shadow: 0 0 10px color-mix(in srgb, var(--brand-400) 18%, transparent);
}
.plant.mixed{ outline: 2px solid #ff9800; }  /* orange */

/* Keep hover/tooltip behavior unchanged */
.grid-square[data-companion]::after{
  will-change: transform, opacity;
}
/* Grid bezel remains defined in layout overrides; no viewport overrides here */

/* Scroll ownership + planner shell sizing live in layout.css */

/* === Left control panel hierarchy + quieter UI === */
.left-column #controlsDrawer{
  background: color-mix(in srgb, var(--surface-1) 72%, #0a0f15);
  border-top: 1px solid color-mix(in srgb, var(--surface-4) 22%, transparent);
}

.left-column #controlsDrawer .grid-controls{
  padding: 9px 11px 11px;
  gap: 8px;
}

.left-column #controlsContent{
  display: grid;
  gap: 10px;
}

.left-column #controlsContent > *{
  padding-bottom: 9px;
  margin-bottom: 9px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.left-column #controlsContent > *:last-child{
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.left-column #controlsDrawer button,
.left-column #controlsDrawer input[type="submit"]{
  min-height: 32px;
  border-radius: 9px;
  font-size: 0.84rem;
  font-weight: 600;
  color: color-mix(in srgb, var(--ink-dim) 90%, transparent);
  background: color-mix(in srgb, var(--surface-2) 74%, transparent);
  border-color: color-mix(in srgb, var(--surface-4) 48%, transparent);
  box-shadow: none;
}

.left-column #controlsDrawer input[type="text"],
.left-column #controlsDrawer input[type="number"],
.left-column #controlsDrawer select{
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 9px;
  border-color: color-mix(in srgb, var(--surface-3) 70%, transparent);
}

.left-column #controlsDrawer .grid-buttons{
  gap: 8px;
}

.left-column #controlsDrawer .save-actions,
.left-column #controlsDrawer .export-actions{
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  position: relative;
  z-index: 1;
}

.left-column #controlsDrawer .save-actions > *{
  grid-column: 1 / -1;
}

.left-column #controlsDrawer .export-status{
  font-size: 0.82rem;
}

/* Responsive polish for tablet/mobile planner controls */
.save-actions--danger button{
  border-color: color-mix(in srgb, #f04f45 38%, var(--surface-4));
  color: color-mix(in srgb, #ffd7d3 82%, var(--ink));
}

.save-actions--danger button:hover{
  border-color: color-mix(in srgb, #f04f45 72%, var(--surface-4));
  color: #fff;
}

@media (max-width: 1024px){
  #placeModeBar{
    display: none !important;
  }

  html,
  body{
    max-width: 100%;
    overflow-x: hidden;
  }

  #appShell,
  #leftPanel,
  #workArea{
    max-width: 100%;
  }

  .crop-tray{
    box-shadow: none;
  }
}


@media (max-width: 767px){
  .place-mode-bar{
    padding: 9px 10px;
  }

  #place-veg-name{
    min-width: 0;
    overflow-wrap: anywhere;
  }

  #veg-menu{
    padding-top: 0;
    overflow: visible;
  }

  #veg-menu,
  .veg-scroll{
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .crop-tray{
    width: 100%;
    max-width: 100%;
  }

  .crop-tray{
    padding-bottom: 2px;
    border-bottom: 1px solid color-mix(in srgb, var(--surface-4) 26%, transparent);
  }

  .veg-scroll{
    flex: 0 0 auto;
    padding: 10px 0 2px;
    overflow-y: visible;
    scrollbar-gutter: auto;
  }

}


.planner-layer-tabs{
  --tab-shell-border: color-mix(in srgb, var(--surface-4) 72%, transparent);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 0;
  width: 100%;
  border: 1px solid var(--tab-shell-border);
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface-1) 92%, transparent);
}

.planner-layer-tab[hidden]{
  display: none !important;
}

.planner-layer-tab{
  appearance: none;
  border: 0;
  border-right: 1px solid color-mix(in srgb, var(--surface-4) 58%, transparent);
  border-bottom: 1px solid var(--tab-shell-border);
  border-radius: 0;
  background: color-mix(in srgb, var(--surface-2) 82%, #04070b);
  color: color-mix(in srgb, var(--ink-dim) 90%, var(--ink));
  font: inherit;
  font-size: .83rem;
  font-weight: 600;
  line-height: 1.2;
  min-height: 42px;
  padding: 10px 8px;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.planner-layer-tab:last-child{
  border-right: 0;
}

.planner-layer-tab:hover{
  color: color-mix(in srgb, var(--ink) 88%, white);
  background: color-mix(in srgb, var(--surface-2) 90%, var(--surface-1));
}

.planner-layer-tab:focus-visible{
  outline: 2px solid color-mix(in srgb, var(--brand-500) 70%, white);
  outline-offset: -2px;
}

.planner-layer-tab.is-selected{
  color: color-mix(in srgb, var(--ink) 95%, white);
  border-bottom-color: transparent;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--surface-1) 64%, #1b2431) 0%,
    color-mix(in srgb, var(--surface-2) 96%, #070b10) 100%
  );
  box-shadow: inset 0 2px 0 color-mix(in srgb, var(--brand-500) 30%, transparent);
}

#plannerModeCropsBtn.is-selected{
  box-shadow: inset 0 2px 0 color-mix(in srgb, var(--brand-green) 52%, transparent);
}

#plannerModeSurfacesBtn.is-selected{
  box-shadow: inset 0 2px 0 color-mix(in srgb, #a87955 52%, transparent);
}

.planner-layer-panel{
  display: grid;
  gap: clamp(8px, 1vw, 10px);
  margin-top: 0;
  padding: clamp(8px, .9vw, 10px);
  border: 1px solid color-mix(in srgb, var(--surface-4) 72%, transparent);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--surface-1) 90%, #05080d) 0%,
    color-mix(in srgb, var(--surface-2) 96%, #04070b) 100%
  );
}


@media (max-width: 767px){
  .planner-layer-tabs{
    width: 100%;
  }

  .planner-layer-tab{
    min-width: 0;
    min-height: 44px;
    padding-inline: 6px;
  }
}


:root[data-theme="light"] .planner-layer-tabs{
  --tab-shell-border: #c9bda4;
  background: #f8f0df;
}

:root[data-theme="light"] .planner-layer-tab{
  background: #fffaf0;
  color: #4e5a58;
  border-right-color: #d5c9b0;
  border-bottom-color: #c9bda4;
}

:root[data-theme="light"] .planner-layer-tab:hover,
:root[data-theme="light"] .planner-layer-tab:focus-visible{
  background: #fff3dd;
  color: #263238;
}

:root[data-theme="light"] .planner-layer-tab.is-selected{
  background: linear-gradient(180deg, #fffaf0 0%, #f8f0df 100%);
  color: #263238;
}

:root[data-theme="light"] .planner-layer-panel{
  border-color: #c9bda4;
  background: linear-gradient(180deg, #fffaf0 0%, #f8f0df 100%);
}

.surface-tools{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:10px;
  border:1px solid color-mix(in srgb, var(--surface-4) 64%, transparent);
  border-radius:10px;
  background: color-mix(in srgb, var(--surface-2) 92%, transparent);
}

.surface-tools__title{ margin:0; font-size:.95rem; }
.surface-tools__help{ margin:0; font-size:.82rem; color:var(--ink-dim); }
.surface-tools__buttons{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:6px;
}
.surface-tools__buttons{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.surface-tools__group{
  display:flex;
  flex-direction:column;
  gap:5px;
}
.surface-tools__group-title{
  margin:0;
  font-size:.7rem;
  font-weight:700;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:var(--ink-dim);
}
.surface-tools__group-buttons{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:6px;
}
.surface-type-btn,
.cover-type-btn{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 64px;
  padding: 6px 5px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--surface-4) 70%, transparent);
  border-radius: 11px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--surface-1) 82%, #0a1018) 0%,
    color-mix(in srgb, var(--surface-2) 90%, #05090f) 100%
  );
  color: color-mix(in srgb, var(--ink) 88%, var(--ink-dim));
  text-align: left;
  transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.surface-type-btn__label,
.cover-type-btn__label{
  display: block;
  width: 100%;
  max-width: 100%;
  text-align: center;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  font-size: .68rem;
  font-weight: 650;
  letter-spacing: .02em;
}

.surface-type-btn__swatch,
.cover-type-btn__swatch{
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--surface-4) 76%, transparent);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--surface-3) 70%, #0b1119) 0%,
    color-mix(in srgb, var(--surface-2) 96%, #04080d) 100%
  );
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--ink) 9%, transparent);
  order: 1;
}

.cover-type--greenhouse .cover-type-btn__swatch{
  background-color: rgba(142, 176, 206, .22);
  background-image:
    linear-gradient(180deg, rgba(208, 232, 255, .34), rgba(83, 118, 149, .14)),
    repeating-linear-gradient(90deg, rgba(224, 242, 255, .26) 0 2px, transparent 2px 11px),
    repeating-linear-gradient(0deg, rgba(220, 239, 255, .2) 0 2px, transparent 2px 11px);
  border-color: color-mix(in srgb, #b7d5ef 68%, var(--surface-4));
}

.cover-type--polytunnel .cover-type-btn__swatch{
  background-color: rgba(217, 231, 244, .24);
  background-image:
    linear-gradient(180deg, rgba(248, 252, 255, .34), rgba(157, 183, 210, .16)),
    repeating-linear-gradient(135deg, rgba(234, 245, 255, .22) 0 4px, rgba(158, 184, 210, .14) 4px 8px);
  border-color: color-mix(in srgb, #c6dcf3 66%, var(--surface-4));
}

.cover-type--netting .cover-type-btn__swatch{
  background-color: rgba(166, 192, 220, .14);
  background-image:
    repeating-linear-gradient(45deg, rgba(224, 236, 248, .26) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(-45deg, rgba(224, 236, 248, .26) 0 1px, transparent 1px 7px);
  border-color: color-mix(in srgb, #b7cee8 64%, var(--surface-4));
}

.cover-type--fleece .cover-type-btn__swatch{
  background-color: rgba(246, 241, 226, .24);
  background-image:
    radial-gradient(circle at 22% 24%, rgba(255, 255, 255, .34), transparent 55%),
    radial-gradient(circle at 72% 58%, rgba(255, 250, 236, .26), transparent 60%),
    radial-gradient(circle at 44% 72%, rgba(248, 240, 218, .2), transparent 58%);
  border-color: color-mix(in srgb, #ece0c3 66%, var(--surface-4));
}

.cover-type--fruit-cage .cover-type-btn__swatch{
  border-width: 2px;
  border-color: color-mix(in srgb, #9db2c8 72%, var(--surface-4));
  background-color: rgba(150, 175, 203, .16);
  background-image:
    linear-gradient(180deg, rgba(231, 241, 252, .18), rgba(83, 107, 131, .16)),
    repeating-linear-gradient(90deg, rgba(221, 234, 248, .26) 0 1px, transparent 1px 8px),
    repeating-linear-gradient(0deg, rgba(221, 234, 248, .24) 0 1px, transparent 1px 8px);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--surface-4) 76%, transparent),
    inset 0 1px 0 color-mix(in srgb, #fff 20%, transparent);
}

.cover-type--brassica-cage .cover-type-btn__swatch{
  border: 1px solid #cbd4c9;
  background-color: rgba(232, 238, 226, .12);
  background-image:
    linear-gradient(180deg, rgba(100, 115, 105, .12), rgba(244, 245, 236, .16), rgba(100, 115, 105, .12)),
    repeating-linear-gradient(90deg, rgba(166, 181, 166, .5) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(0deg, rgba(166, 181, 166, .5) 0 1px, transparent 1px 4px);
}

.surface-type-btn.is-active,
.cover-type-btn.is-active{
  border-color: color-mix(in srgb, var(--brand-500) 86%, #c6dcff);
  color: color-mix(in srgb, var(--ink) 96%, #fff);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--surface-1) 76%, var(--brand-400) 10%) 0%,
    color-mix(in srgb, var(--surface-2) 88%, var(--brand-400) 8%) 100%
  );
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--brand-500) 62%, transparent),
    0 0 0 1px color-mix(in srgb, var(--brand-500) 30%, transparent),
    0 8px 18px color-mix(in srgb, #071326 42%, transparent);
}

.surface-type-btn.is-active .surface-type-btn__swatch,
.cover-type-btn.is-active .cover-type-btn__swatch{
  border-color: color-mix(in srgb, var(--brand-500) 62%, #d7e7ff);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--brand-500) 42%, transparent),
    inset 0 1px 0 color-mix(in srgb, #fff 24%, transparent),
    inset 0 -1px 0 color-mix(in srgb, var(--surface-2) 70%, transparent);
}

.surface-type-btn:focus-visible,
.cover-type-btn:focus-visible{
  outline: 2px solid color-mix(in srgb, var(--brand-500) 82%, #d7e6ff);
  outline-offset: 2px;
  border-color: color-mix(in srgb, var(--brand-500) 72%, var(--surface-4));
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--brand-500) 34%, transparent),
    0 0 0 2px color-mix(in srgb, var(--brand-500) 24%, transparent);
}


:root[data-theme="light"] .surface-tools{
  border-color: #c9bda4;
  background: #fffaf0;
  color: #263238;
  box-shadow: 0 1px 3px rgba(60, 45, 25, .08);
}

:root[data-theme="light"] .surface-tools__title{
  color: #263238;
}

:root[data-theme="light"] :is(.surface-tools__help, .helper-text, .export-status){
  color: #4e5a58;
}

:root[data-theme="light"] :is(.surface-type-btn, .cover-type-btn){
  background: #fffaf0;
  color: #263238;
  border-color: #c9bda4;
  box-shadow: 0 1px 3px rgba(60, 45, 25, .10);
}

:root[data-theme="light"] :is(.surface-type-btn, .cover-type-btn):hover{
  background: #fff3dd;
  color: #263238;
  border-color: #b8a982;
}

:root[data-theme="light"] :is(.surface-type-btn, .cover-type-btn).is-active{
  background: #eef8ef;
  color: #1f2a2d;
  border-color: #2f9d5c;
  box-shadow: 0 0 0 1px rgba(47, 157, 92, .20);
}

:root[data-theme="light"] :is(.surface-type-btn__swatch, .cover-type-btn__swatch){
  border-color: #c9bda4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .65), 0 1px 2px rgba(60, 45, 25, .12);
}

:root[data-theme="light"] :is(.surface-type-btn, .cover-type-btn).is-active :is(.surface-type-btn__swatch, .cover-type-btn__swatch){
  border-color: rgba(47, 157, 92, .68);
  box-shadow: inset 0 0 0 1px rgba(47, 157, 92, .18), inset 0 1px 0 rgba(255, 255, 255, .72);
}

.planner-mode-covers #grid-container{
  outline: 2px solid color-mix(in srgb, var(--brand-500) 55%, transparent);
  outline-offset: 3px;
}

.planner-mode-covers .grid-square{
  border-color: color-mix(in srgb, var(--brand-500) 42%, var(--surface-3));
}

.planner-mode-covers .plant-wrapper,
.planner-mode-covers .plant{
  opacity: .72;
  filter: saturate(.82);
  pointer-events: none;
}

/* Layout owns drawing gestures, including on sprites with inline hit targets. */
.planner-mode-surfaces :is(.plant-wrapper, .plant, .plant-wrapper *, .plant *){
  pointer-events: none !important;
}

.planner-mode-crops .cover-area{
  opacity: .55;
}

.planner-mode-covers .cover-overlay-layer{
  pointer-events: auto;
}

.planner-mode-covers .cover-area{
  opacity: .92;
  pointer-events: auto;
  cursor: context-menu;
}

/* Crop panel layout */
#cropLayerPanel{
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  flex: 1 1 auto;
}

#cropLayerPanel .crop-tray{
  flex: 1 1 auto;
  min-height: 180px;
  overflow: hidden;
}

#cropLayerPanel .crop-tray-panel,
#cropLayerPanel #veg-menu,
#cropLayerPanel #veg-scroll{
  min-height: 0;
}

#cropLayerPanel #veg-scroll{
  overflow-y: auto;
}

/* Compact crop list, scoped to keep placed crop art and Layout tools unchanged. */
#cropLayerPanel .veg-selection-container{
  display:grid; grid-template-columns:minmax(0, 1fr); gap:0;
  align-content:start; width:100%; min-height:0;
}
#cropLayerPanel .veg-item{
  position:relative; box-sizing:border-box; display:flex; flex-direction:row;
  align-items:center; justify-content:flex-start; gap:8px;
  width:100%; min-width:0; min-height:35px; margin:0;
  flex: 1;
  padding:4px 7px;
  border:0; border-bottom:1px solid color-mix(in srgb, var(--ink) 14%, transparent);
  border-radius:2px; background:transparent; color:var(--ink);
  box-shadow:none; font:inherit; text-align:left; cursor:pointer; transform:none;
}
#cropLayerPanel .veg-item:hover{ background:color-mix(in srgb, var(--ink) 7%, transparent); }
#cropLayerPanel .veg-item:focus-visible{ outline:2px solid var(--brand-300); outline-offset:-2px; }
#cropLayerPanel .veg-item .veg-icon{
  width:24px; height:24px; border:0; border-radius:0; background:transparent;
  box-shadow:none; transform:none; animation:none;
}
#cropLayerPanel .veg-icon img{ width:100%; height:100%; object-fit:contain; }
#cropLayerPanel .veg-item .veg-label{
  position:static; display:block; transform:none; padding:0; border:0; border-radius:0;
  background:transparent; color:inherit; font-size:.78rem; font-weight:500;
  line-height:1.2; text-align:left; white-space:nowrap; text-transform:none; text-shadow:none;
}
#cropLayerPanel .veg-item.is-active{
  background:color-mix(in srgb, #67c27a 20%, var(--surface-2)); box-shadow:inset 3px 0 #67c27a;
}
/* Keep the selection tick beside the illustration, leaving room for full names. */
#cropLayerPanel .veg-item.is-active::after{
  content:'\2713'; position:absolute; left:24px; bottom:2px;
  width:10px; height:10px; border-radius:2px; background:var(--surface-1);
  font-size:.6rem; line-height:10px; text-align:center;
}
@media (max-width:767px){ #cropLayerPanel .veg-item{ min-height:44px; } }

/* Sibling planting and information buttons avoid nested interactive controls. */
#cropLayerPanel #veg-scroll{ overflow-anchor:none; }
#cropLayerPanel .crop-list-entry{ min-width:0; container-type:inline-size; }
@container (max-width:260px){
  #cropLayerPanel .veg-item{ gap:6px; padding-inline:5px; }
  #cropLayerPanel .veg-item .veg-icon{ width:22px; height:22px; }
  #cropLayerPanel .veg-item .veg-label{ font-size:.75rem; }
  #cropLayerPanel .veg-item.is-active::after{ left:20px; }
}
#cropLayerPanel .crop-list-row{ display:flex; align-items:stretch; min-width:0; }
#cropLayerPanel .crop-profile-chevron{
  margin-inline-start:auto; font-size:1rem; line-height:1;
  width:1em; height:1em; flex:0 0 1em; text-align:center;
}
#cropLayerPanel .crop-profile-toggle[aria-expanded="true"] .crop-profile-chevron{ transform:rotate(90deg); }
#cropLayerPanel .crop-profile-choices{ margin-inline-start:8px; }
#cropLayerPanel .crop-profile-choices[hidden]{ display:none; }
#cropLayerPanel .crop-profile-entry .veg-label{ min-width:0; white-space:normal; overflow-wrap:anywhere; }
#cropLayerPanel .crop-profile-entry .crop-inline-info{ min-width:0; overflow-wrap:anywhere; }
#cropLayerPanel .crop-info-toggle{
  flex:0 0 35px; min-width:35px; min-height:35px; margin:0; padding:0;
  border:0; border-bottom:1px solid color-mix(in srgb, var(--ink) 14%, transparent);
  border-radius:2px; background:transparent; color:var(--ink-dim);
  box-shadow:none; font-size:1rem; cursor:pointer; transform:none;
}
#cropLayerPanel .crop-info-toggle:hover,
#cropLayerPanel .crop-info-toggle[aria-expanded="true"]{
  color:var(--ink); background:color-mix(in srgb, var(--ink) 10%, transparent);
}
#cropLayerPanel .crop-info-toggle:focus-visible{
  outline:2px solid var(--brand-300); outline-offset:-2px;
}
#cropLayerPanel .crop-inline-info{
  padding:8px; border-bottom:1px solid color-mix(in srgb, var(--ink) 20%, transparent);
  background:color-mix(in srgb, var(--ink) 4%, transparent); overflow-anchor:none;
}
#cropLayerPanel .crop-inline-info[hidden]{ display:none; }
#cropLayerPanel .crop-inline-info .crop-card{
  padding:0; margin:0; border:0; border-radius:0; background:transparent; box-shadow:none;
  text-align:left; align-items:stretch; gap:5px;
}
#cropLayerPanel .crop-inline-info .crop-card__title{ margin:0 0 4px; font-size:.85rem; }
#cropLayerPanel .crop-inline-info .crop-card__density{ margin:0 0 6px; font-size:.78rem; }
#cropLayerPanel .crop-inline-info .crop-card__summary{ gap:4px; }
#cropLayerPanel .crop-inline-info .crop-card__summary-line{
  font-size:.75rem;
}
#cropLayerPanel .crop-inline-info .crop-card__summary-value{ overflow-wrap:anywhere; }
#cropLayerPanel .crop-inline-info .crop-details-open{
  margin:4px 0 0; padding:6px 8px; border-radius:3px;
  border:1px solid color-mix(in srgb, var(--ink) 25%, transparent);
  background:color-mix(in srgb, var(--ink) 7%, transparent); color:var(--ink);
  box-shadow:none; font-size:.75rem;
}
#cropLayerPanel .crop-inline-info .crop-details-open:hover{
  background:color-mix(in srgb, var(--ink) 14%, transparent);
}
body[data-planner-presentation="touch-landscape"] #cropLayerPanel .crop-inline-info .crop-details-open{ min-height:44px; }
@media (max-width:767px){
  #cropLayerPanel .crop-info-toggle{ flex-basis:44px; min-width:44px; min-height:44px; }
}

#surfaceLayerPanel{
  align-content: start;
}

.timeline-activity-marker--harvest-window{
  background: color-mix(in srgb, var(--brand-amber) 82%, var(--surface-2));
  border-color: color-mix(in srgb, var(--brand-amber) 62%, transparent);
}

.timeline-activity-marker--plant-out-window{
  background: color-mix(in srgb, var(--brand-green) 72%, #16331f);
  border-color: color-mix(in srgb, var(--brand-green) 52%, transparent);
}

.timeline-activity-marker--sow-window{
  background: color-mix(in srgb, var(--brand-purple) 76%, var(--surface-2));
  border-color: color-mix(in srgb, var(--brand-purple) 58%, transparent);
}

@media (max-width: 980px){
  .surface-type-btn,
  .cover-type-btn{
    min-height: 62px;
    padding: 6px 4px;
  }

  .surface-type-btn__swatch,
  .cover-type-btn__swatch{
    width: 30px;
    height: 30px;
    flex-basis: 30px;
  }
}


@media (max-width: 767px){
  .surface-tools{
    padding: 10px;
    gap: 8px;
  }

  .surface-tools__buttons{
    gap: 7px;
  }

  .surface-tools__group{
    gap: 4px;
  }

  .cover-type-btn{
    min-height: 60px;
    padding: 5px 4px;
  }

  .surface-type-btn__label,
  .cover-type-btn__label{
    font-size: .64rem;
  }

  .surface-type-btn__swatch,
  .cover-type-btn__swatch{
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }
}


/* Phone mode: crop-first quick planner */

.planner-phone-mode #plannerModeCropsBtn,
.planner-phone-mode #plannerModeSurfacesBtn{
  width: 100%;
}








.planner-phone-mode .planner-layer-panel{
  border-top: 1px solid color-mix(in srgb, var(--surface-4) 72%, transparent);
  border-radius: 10px;
}

.planner-phone-mode #veg-menu{
  width: 100%;
  padding-top: 2px;
}

.planner-phone-mode #cropLayerPanel #veg-scroll{
  max-height: min(40dvh, 360px);
  overflow-y: auto;
}


@media (max-width: 1024px){
  body.planner-mode-crops #placeModeBar{
    display: none;
  }

  .grid-square.has-mobile-auto-soil{
    overflow: hidden;
    background:
      radial-gradient(circle at 18% 25%, rgba(55, 31, 18, .56) 0 1.2px, transparent 1.8px),
      radial-gradient(circle at 72% 35%, rgba(130, 76, 38, .38) 0 1.5px, transparent 2px),
      radial-gradient(circle at 46% 78%, rgba(75, 43, 24, .42) 0 1.1px, transparent 1.7px),
      linear-gradient(135deg, #6f4429, #4d2f1f);
    border-color: color-mix(in srgb, #8a5c38 72%, var(--surface-3));
  }

  .grid-square.has-mobile-auto-soil::before{
    content: "";
    position: absolute;
    inset: 2px;
    border-radius: 4px;
    background:
      repeating-linear-gradient(28deg, rgba(255,255,255,.045) 0 1px, transparent 1px 7px),
      repeating-linear-gradient(118deg, rgba(0,0,0,.12) 0 1px, transparent 1px 9px);
    opacity: .72;
    pointer-events: none;
    z-index: 0;
  }

  .grid-square.has-mobile-auto-soil > *{
    position: relative;
    z-index: 1;
  }

  .grid-square.has-mobile-auto-soil .placed-veg-icon{
    z-index: 2;
  }

  :root[data-theme="light"] .grid-square.has-mobile-auto-soil{
    background:
      radial-gradient(circle at 18% 25%, rgba(73, 43, 24, .42) 0 1.2px, transparent 1.6px),
      radial-gradient(circle at 72% 35%, rgba(143, 91, 48, .32) 0 1.5px, transparent 1.9px),
      radial-gradient(circle at 46% 78%, rgba(83, 52, 28, .34) 0 1.1px, transparent 1.5px),
      #8b5f3d;
    border-color: #6e472d;
  }
}

/* Lightweight diary/logbook panel */
.logbook-panel[hidden]{
  display: none !important;
}

.logbook-panel{
  --logbook-panel-top: 12px;
  position: fixed;
  top: var(--logbook-panel-top);
  right: 12px;
  z-index: 18;
  width: min(380px, calc(100vw - 24px));
  /* Keep the floating diary within the viewport. */
  max-height: min(calc(100dvh - var(--logbook-panel-top) - 12px), 680px);
  transform: translateX(calc(100% + 32px));
  opacity: 0;
  pointer-events: none;
  transition: transform .22s ease, opacity .18s ease;
}

.logbook-panel.is-minimized{
  width: auto;
}

.logbook-panel.is-open{
  transform: translateX(0);
  opacity: 1;
  pointer-events: none;
}

/* Only visible diary content owns input; empty wrapper space reaches the grid. */
.logbook-panel.is-open:not(.is-minimized) .logbook-panel__page{
  pointer-events: auto;
}

.logbook-panel__page{
  position: relative;
  max-height: inherit;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scroll-padding-top: 100px;
  isolation: isolate;
  padding: 0 16px 16px;
  box-sizing: border-box;
  color: #3b2b1d;
  scrollbar-width: thin;
  scrollbar-color: rgba(92, 62, 30, .30) transparent;
  background:
    repeating-linear-gradient(0deg, transparent 0 30px, rgba(128, 84, 38, .06) 31px 32px),
    linear-gradient(135deg, #f8edcf, #f2e3bb);
  border: 1px solid rgba(100, 66, 30, .30);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}

.logbook-panel.is-minimized .logbook-panel__page{
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateX(16px) scale(.96);
}

.logbook-panel__restore{
  pointer-events: auto;
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  color: #4c321b;
  background: linear-gradient(135deg, #fbf1d4 0%, #ead4a3 100%);
  border: 1px solid rgba(100, 66, 30, .42);
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .20);
  cursor: pointer;
}

.logbook-panel__restore[hidden]{
  display: none !important;
}

.logbook-panel__restore:hover,
.logbook-panel__restore:focus-visible{
  background: linear-gradient(135deg, #fff8de 0%, #f0d99f 100%);
  outline: 2px solid rgba(76, 50, 27, .36);
  outline-offset: 3px;
}

.logbook-panel__bar{
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  margin: 0 -16px 10px;
  padding: 8px 16px 4px;
  border-bottom: 1px solid rgba(87, 58, 28, .22);
  background: #f8edcf;
}

:root[data-theme="light"] .logbook-panel__bar{ background: #fff5da; }
.logbook-panel__branding{
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  font-size: .78rem;
}
.logbook-panel__branding a{ color: inherit; white-space: nowrap; text-decoration: underline; }
.logbook-panel__branding a:hover{ text-decoration-thickness: 2px; }
.logbook-panel__branding a:focus-visible{ outline: 2px solid #795334; outline-offset: 2px; }
.logbook-panel__logo{ display: block; flex: 0 1 100px; min-width: 0; }
.logbook-panel__logo img{ display: block; width: 100%; max-width: 100px; height: auto; }
.logbook-panel__bar > .logbook-panel__tabs{ grid-column: 1 / -1; grid-row: 2; }
.logbook-panel__bar > .logbook-panel__close{ grid-column: 2; grid-row: 1; }
.logbook-panel__tabs{ display: flex; flex-wrap: nowrap; gap: 4px; }
.logbook-panel__tabs button,
.logbook-panel__guide button{
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  box-shadow: none;
  cursor: pointer;
}
.logbook-panel__tabs button{ border-bottom-width: 2px; white-space: nowrap; }
.logbook-panel__tabs button[aria-selected="true"]{ border-bottom-color: #795334; }
.logbook-panel__tabs button:hover,
.logbook-panel__guide button:hover{ background: rgba(92, 62, 30, .1); }
.logbook-panel__tabs button:focus-visible,
.logbook-panel [role="tabpanel"]:focus-visible,
.logbook-panel__guide :is(a, button):focus-visible{ outline: 2px solid #795334; outline-offset: -2px; }
.logbook-panel__guide{ font-size: .875rem; line-height: 1.45; }
.logbook-panel__guide :is(h1, h2){ margin: 0 0 6px; color: inherit; font: inherit; font-weight: 700; }
.logbook-panel__guide h1{ font-size: 1.2rem; }
.logbook-panel__guide :is(p, ol){ margin: 0 0 10px; }
.logbook-panel__guide ol{ padding-inline-start: 1.4em; }
.logbook-panel__guide li + li{ margin-top: 4px; }
.logbook-panel__guide a{ color: inherit; text-decoration: underline; }
.logbook-panel__calendar-link{ display: inline-flex; align-items: center; gap: 6px; min-height: 24px; }
@media (max-width: 1024px){
  .logbook-panel__calendar-link{ min-height: 44px; }
}
.logbook-panel__guide button{ border-color: rgba(87, 58, 28, .4); }
.logbook-panel__controls{ margin: 0; }
.logbook-panel__controls div + div{ margin-top: 6px; }
.logbook-panel__controls dt{ display: inline; font-weight: 700; }
.logbook-panel__controls dd{ display: inline; margin: 0; }
.logbook-panel__controls dd::before{ content: " — "; }

.logbook-panel__header{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(87, 58, 28, .22);
  transition: margin-bottom .18s ease, padding-bottom .18s ease;
}

.logbook-panel--has-entries .logbook-panel__header{
  margin-bottom: 10px;
  padding-bottom: 8px;
}

.logbook-panel__date{
  margin: 0 0 4px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(65, 45, 28, .76);
}

.logbook-panel__title{
  margin: 0;
  font-family: "Amatic SC", cursive;
  font-size: clamp(1.55rem, 4.5vw, 2.25rem);
  line-height: .9;
  max-height: 3rem;
  color: #4c321b;
  transition: opacity .18s ease, max-height .18s ease, margin .18s ease, transform .18s ease;
}

.logbook-panel--has-entries .logbook-panel__title{
  max-height: 0;
  margin: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
}

.logbook-panel__close{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  color: #4c321b;
  background: rgba(255, 248, 222, .72);
  border: 1px solid rgba(101, 66, 28, .34);
  border-radius: 999px;
  cursor: pointer;
}

.logbook-panel__close:hover,
.logbook-panel__close:focus-visible{
  background: rgba(255, 255, 244, .95);
  outline: 2px solid rgba(76, 50, 27, .36);
  outline-offset: 2px;
}

/* Temporary bed-removal feedback; separate from the crop ledger. */
.logbook-panel__bed-notice{
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  margin: 12px 0;
  padding: 10px 12px;
  color: #3a2a1d;
  background: rgba(255, 250, 232, .78);
  border: 1px solid rgba(92, 62, 30, .24);
  border-left: 3px solid #887454;
  border-radius: 8px;
  font-size: .88rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  opacity: 1;
  transition: opacity .75s ease;
}
.logbook-panel__bed-notice p{
  margin: 3px 0 0;
  font-size: .82rem;
}
.logbook-panel__bed-notice.is-fading{ opacity: 0; }
.logbook-panel__bed-notice-dismiss{
  display: grid;
  place-items: center;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-size: 1.4rem;
  cursor: pointer;
}
.logbook-panel__bed-notice-dismiss:hover{ background: rgba(92, 62, 30, .1); }
.logbook-panel__bed-notice-dismiss:focus-visible{
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
:root[data-theme="dark"] .logbook-panel__bed-notice{
  color: #302114;
  background: rgba(255, 246, 214, .88);
}
@media (max-width: 767px){
  .logbook-panel__bed-notice{ padding: 8px 10px; }
  .logbook-panel__bed-notice-dismiss{ min-width: 44px; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce){
  .logbook-panel__bed-notice{ transition: none; }
}
@media print{
  #logbookBedNotice{ display: none; }
}

.logbook-panel__empty{
  margin: 0;
  padding: 8px 0;
  color: rgba(56, 39, 24, .82);
  font-size: 1rem;
  line-height: 1.5;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.logbook-panel__entries{
  display: grid;
  gap: 10px;
}

.logbook-panel__page::-webkit-scrollbar{
  width: 8px;
}

.logbook-panel__page::-webkit-scrollbar-track{
  background: transparent;
}

.logbook-panel__page::-webkit-scrollbar-thumb{
  background: rgba(92, 62, 30, .24);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

.logbook-panel__day{
  display: grid;
  gap: 10px;
}

.logbook-panel__day-title{
  margin: 0;
  color: #4c321b;
  font-size: 1.02rem;
  letter-spacing: .01em;
}

.logbook-panel__entry{
  padding: 8px;
  background: rgba(255, 250, 232, .20);
  border: 1px solid rgba(92, 62, 30, .16);
  border-radius: 4px;
}

.logbook-panel__entry p{
  margin: 6px 0 0;
  line-height: 1.45;
}

.logbook-panel__summary-ledger{
  display: grid;
  gap: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 2px 0;
}

.logbook-panel__summary-card{
  position: relative;
  max-width: 100%;
  min-width: 0;
  padding: 9px 6px;
  color: #3b2b1d;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(92, 62, 30, .20);
  border-radius: 0;
  box-shadow: none;
}

.logbook-panel__summary-bed-title,
.logbook-panel__summary-primary,
.logbook-panel__summary-timing{
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}

.logbook-panel__summary-bed-title,
input.logbook-panel__bed-name-input{
  margin-bottom: 6px;
  color: rgba(54, 34, 17, .9);
  font-family: var(--font-display, inherit);
  font-size: .98rem;
  font-weight: 900;
  letter-spacing: .01em;
}

.logbook-panel__summary-crops{
  display: grid;
  gap: 5px;
  min-width: 0;
}

.logbook-panel__summary-crop{
  position: relative;
  isolation: isolate;
  min-width: 0;
  padding-top: 5px;
  border-top: 1px solid rgba(92, 62, 30, .14);
}

.logbook-panel__summary-crop.is-grid-selected::before{
  inset: -2px -5px;
}

.logbook-panel__summary-crop:is(.is-grid-selected, .is-logbook-selected)::before{
  content: "";
  position: absolute;
  z-index: -1;
  inset: -2px -5px;
  pointer-events: none;
  background: rgba(151, 202, 229, .24);
  border-radius: 6px;
  box-shadow: 0 0 0 2px rgba(101, 166, 202, .78);
}

.logbook-panel__summary-crop:first-child{
  padding-top: 0;
  border-top: 0;
}

.logbook-panel__summary-primary{
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 0;
  font-size: .92rem;
  font-weight: 800;
  line-height: 1.35;
}

.logbook-panel__summary-primary:hover{
  color: color-mix(in srgb, currentColor 82%, var(--selection-blue, #4b91bd));
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--selection-blue, #4b91bd) 55%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.logbook-panel__summary-primary:focus-visible{
  outline: 2px solid var(--selection-blue, #4b91bd);
  outline-offset: 2px;
  border-radius: 3px;
}

.plant.is-logbook-selected,
.plant-wrapper.is-logbook-selected{
  outline: 2px solid rgba(106, 177, 216, .94);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(179, 221, 242, .34), 0 0 9px rgba(72, 151, 194, .38);
}

.grid-square.is-logbook-selected{
  outline: 2px solid rgba(106, 177, 216, .94);
  outline-offset: -2px;
  box-shadow: inset 0 0 0 2px rgba(205, 235, 249, .34), 0 0 7px rgba(72, 151, 194, .34);
}

.logbook-panel__summary-item{
  min-width: 0;
  overflow-wrap: anywhere;
}

.logbook-panel__summary-item:not(:last-child)::after{
  content: "·";
  margin: 0 .42em;
  color: rgba(76, 50, 27, .58);
  font-weight: 700;
}

.logbook-panel__summary-timing{
  margin-top: 2px;
  color: rgba(56, 39, 24, .78);
  font-size: .82rem;
  font-style: italic;
  line-height: 1.3;
}

.logbook-panel__summary-planted-date,
.logbook-panel__summary-planting-number,
.logbook-panel__summary-harvest-line{
  display: block;
}

.logbook-panel__summary-planting-number{
  margin-top: 1px;
  color: rgba(56, 39, 24, .72);
  font-size: .78rem;
  font-style: normal;
  font-weight: 650;
  letter-spacing: .01em;
}

.logbook-panel__planting-edit{
  width: 1.55rem;
  height: 1.55rem;
  margin-left: .35rem;
  padding: 0;
  color: inherit;
  font: inherit;
  font-size: .95rem;
  line-height: 1;
  background: rgba(255, 255, 244, .68);
  border: 1px solid rgba(92, 62, 30, .3);
  border-radius: 50%;
  cursor: pointer;
}

.logbook-panel__planting-edit:hover,
.logbook-panel__planting-edit:focus-visible{
  background: #fffdf0;
  outline: 2px solid rgba(65, 125, 45, .38);
  outline-offset: 1px;
}

.logbook-panel__planting-menu{
  position: relative;
  z-index: 4;
  display: grid;
  gap: 3px;
  width: min(100%, 18rem);
  margin: 5px 0 3px;
  padding: 5px;
  background: #fffdf0;
  border: 1px solid rgba(92, 62, 30, .3);
  border-radius: 8px;
  box-shadow: 0 5px 14px rgba(47, 32, 18, .16);
}

.logbook-panel__planting-menu-option{
  padding: 6px 8px;
  color: #3b2b1d;
  font: inherit;
  font-size: .78rem;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
}

.logbook-panel__planting-menu-option:hover,
.logbook-panel__planting-menu-option:focus-visible{
  background: rgba(151, 202, 229, .28);
  outline: 2px solid rgba(65, 125, 45, .34);
}

.logbook-panel__summary-harvest-line{
  margin-top: 1px;
}

.logbook-panel__planted-date-control{
  display: inline-flex;
  align-items: center;
  gap: .35em;
  max-width: 100%;
  font-style: normal;
  font-weight: 800;
}

.logbook-panel__planted-date-input{
  max-width: 9.5rem;
  min-height: 1.8rem;
  padding: 2px 6px;
  color: #3b2b1d;
  font: inherit;
  font-size: .82rem;
  font-weight: 800;
  background: rgba(255, 255, 244, .72);
  border: 1px solid rgba(92, 62, 30, .32);
  border-radius: 8px;
  cursor: pointer;
}

.logbook-panel__planted-date-input:focus-visible{
  outline: 3px solid rgba(65, 125, 45, .34);
  outline-offset: 2px;
}

:root[data-theme="dark"] .logbook-panel__summary-card{
  background: transparent;
}

:root[data-theme="dark"] .logbook-panel__entry{
  background: rgba(255, 246, 214, .20);
}

:root[data-theme="dark"] .logbook-panel__summary-crop:is(.is-grid-selected, .is-logbook-selected)::before{
  background: rgba(139, 195, 225, .30);
  box-shadow: 0 0 0 2px rgba(112, 177, 211, .88);
}

:root[data-theme="dark"] .plant.is-logbook-selected,
:root[data-theme="dark"] .plant-wrapper.is-logbook-selected{
  outline-color: rgba(137, 204, 237, .96);
  box-shadow: 0 0 0 4px rgba(87, 158, 197, .28), 0 0 10px rgba(94, 184, 231, .42);
}

:root[data-theme="dark"] .grid-square.is-logbook-selected{
  outline-color: rgba(137, 204, 237, .96);
  box-shadow: inset 0 0 0 2px rgba(169, 219, 244, .28), 0 0 8px rgba(94, 184, 231, .36);
}

:root[data-theme="dark"] .logbook-panel__summary-planting-number{
  color: rgba(48, 33, 20, .82);
}

:root[data-theme="dark"] .logbook-panel__planting-edit,
:root[data-theme="dark"] .logbook-panel__planting-menu{
  color: #302114;
  background: rgba(255, 246, 214, .96);
}

@media (max-width: 767px){
  .logbook-panel__summary-card{
    padding: 9px 10px 8px 14px;
  }

  .logbook-panel__summary-primary{
    font-size: .86rem;
  }

  .logbook-panel__summary-timing{
    font-size: .78rem;
  }
}

:root[data-theme="light"] .logbook-panel__page{
  color: #3a2a1d;
  background:
    repeating-linear-gradient(0deg, transparent 0 30px, rgba(128, 84, 38, .06) 31px 32px),
    linear-gradient(135deg, #fff5da, #f7e8c4);
  box-shadow: 0 6px 18px rgba(99, 73, 38, .16);
}

:root[data-theme="dark"] .logbook-panel__page{
  box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
}

@media (prefers-reduced-motion: reduce){
  .logbook-panel{
    transition: none;
  }
}

.logbook-panel__bed-header {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-bottom: 6px;
}
.logbook-panel__bed-header .logbook-panel__summary-bed-title {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
}
.logbook-panel__bed-rename {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 2rem;
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: inherit;
  font: inherit;
  line-height: 1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}
.logbook-panel__bed-rename:hover {
  background: rgba(255, 255, 244, .68);
  border-color: rgba(92, 62, 30, .3);
}
.logbook-panel__bed-rename:focus-visible,
input.logbook-panel__bed-name-input:focus-visible {
  outline: 2px solid rgba(65, 125, 45, .38);
  outline-offset: 1px;
}
input.logbook-panel__bed-name-input {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 2rem;
  box-sizing: border-box;
  margin: 0;
  padding: 3px 7px;
  line-height: 1.3;
  background: rgba(255, 255, 244, .72);
  border: 1px solid rgba(92, 62, 30, .32);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 244, .46);
}
input.logbook-panel__bed-name-input:focus {
  background: #fffdf0;
  border-color: rgba(92, 62, 30, .42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 244, .46);
}
.logbook-panel__bed-empty { margin: 4px 0; font-size: .85rem; opacity: .75; }

.area-apply-preview{
  background: rgba(30, 150, 170, .18);
  border: 2px solid rgba(20, 140, 160, .9);
  box-shadow: inset 0 0 0 1px rgba(225, 255, 255, .25);
}

.crop-footprint-preview {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 71;
}
.crop-footprint-preview__valid {
  fill: rgba(50, 160, 85, .16);
  stroke: #3aaf66;
  stroke-width: 1;
}
.crop-footprint-preview__invalid {
  fill: rgba(210, 65, 65, .16);
  stroke: #df6262;
  stroke-width: 1;
  stroke-dasharray: 4 3;
}
.planner-manage-open .crop-footprint-preview,
.exporting .crop-footprint-preview,
.pdf-export .crop-footprint-preview,
body:has(#mobileLogbookDialog:modal, #backupRestoreDialog:modal, #legacyMigrationDialog:modal,
  #planTransferDialog:not([hidden]), #planReceiveDialog:not([hidden]), #fieldGuideMount > .crop-details-dialog:not([hidden])) .crop-footprint-preview {
  display: none;
}

.grid-rectangle-measurement{
  position: absolute;
  top: 5px;
  right: 5px;
  max-width: calc(100% - 10px);
  padding: 2px 5px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .9);
  color: #153b3e;
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  box-sizing: border-box;
  pointer-events: none;
}
.area-erase-preview .grid-rectangle-measurement{ color: #7b1717; }

/* Shared roof surface: colour, material and ridge direction are independent. */
.shed-roof, .surface-type-btn__swatch.shed-tool-swatch {
  --roof-light: #50565b;
  --roof-mid: #41464a;
  --roof-dark: #353a3e;
  --roof-edge: #22272b;
  --roof-angle: 90deg;
  --roof-pattern-angle: 180deg;
  box-sizing: border-box;
  background: linear-gradient(var(--roof-angle), var(--roof-mid), var(--roof-light) 49%, var(--roof-dark) 50%, var(--roof-mid));
  border: 2px solid var(--roof-edge);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.28);
}
.shed-roof { position: absolute; pointer-events: none; }
.shed-roof[data-colour="green"] { --roof-light: #657763; --roof-mid: #52634f; --roof-dark: #3b4c3a; --roof-edge: #2d3b2c; }
.shed-roof[data-colour="brown"] { --roof-light: #92745b; --roof-mid: #7c604b; --roof-dark: #5c4637; --roof-edge: #433328; }
.shed-roof[data-colour="red"] { --roof-light: #a26b62; --roof-mid: #8c574f; --roof-dark: #6b403a; --roof-edge: #4b302c; }
.shed-preview.area-apply-preview { background: rgba(65, 70, 74, .55); border: 2px dashed #292f34; }
.shed-preview.area-apply-preview.is-invalid { background: rgba(190, 40, 40, .25); border-color: #b42318; }

.shed-roof--wide { --roof-angle: 180deg; --roof-pattern-angle: 90deg; }
.shed-roof::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(var(--roof-pattern-angle), transparent 0 3px, rgba(255,255,255,.035) 3px 4px);
}
.shed-roof[data-material="metal"]::before {
  background: repeating-linear-gradient(var(--roof-pattern-angle), rgba(255,255,255,.17) 0 1px, transparent 1px 5px, rgba(0,0,0,.22) 5px 7px);
}
.shed-roof[data-material="tiles"]::before {
  background:
    repeating-linear-gradient(var(--roof-angle), transparent 0 7px, rgba(0,0,0,.28) 7px 8px, rgba(255,255,255,.18) 8px 9px),
    repeating-linear-gradient(var(--roof-pattern-angle), transparent 0 14px, rgba(0,0,0,.2) 14px 15px);
}

.shed-roof::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: calc(50% - 1px);
  width: 2px; background: var(--roof-edge); box-shadow: 1px 0 rgba(255,255,255,.35);
}
.shed-roof--wide::after {
  top: calc(50% - 1px); bottom: auto; left: 0; right: 0;
  width: auto; height: 2px; box-shadow: 0 1px rgba(255,255,255,.35);
}
.shed-roof.is-selected, .shed-roof:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 3px; }
.shed-context { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.shed-options { min-width: 0; margin: 0; padding: 0; border: 0; }
.shed-options legend { padding: 0; margin-bottom: 4px; font-size: .75rem; color: var(--ink); }
.shed-options__choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.shed-options--colour .shed-options__choices { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.shed-context .shed-option { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; min-height: 44px; margin: 0; padding: 4px; border: 1px solid var(--ink-dim); border-radius: 3px; color: var(--ink); background: var(--surface-1); font-size: .65rem; line-height: 1.2; }
.shed-context .shed-option:hover { background: var(--surface-2); }
.shed-context .shed-option[aria-pressed="true"] { border-color: var(--brand-500); box-shadow: inset 0 0 0 1px var(--brand-500); }
.shed-option[aria-pressed="true"]::after { content: '✓'; position: absolute; top: 3px; right: 3px; padding: 0 2px; color: var(--ink); background: var(--surface-1); font-weight: bold; }
.shed-context .shed-option:focus-visible { outline: 2px solid var(--brand-400); outline-offset: 2px; }
.shed-option__preview { display: block; position: relative; height: 27px; border: 1px solid #292f34; border-radius: 1px; }
.shed-option__preview[data-preview="felt"] { background: repeating-linear-gradient(12deg, #41464a 0 3px, #454a4e 3px 4px); }
.shed-option__preview[data-preview="metal"] { background: repeating-linear-gradient(90deg, #92999d 0 2px, #697277 2px 3px, #81898e 3px 6px); }
.shed-option__preview[data-preview="tiles"] { background: repeating-linear-gradient(0deg, transparent 0 7px, #65463d 7px 8px), repeating-linear-gradient(90deg, #996a59 0 12px, #795044 12px 13px); }
.shed-option__preview[data-preview="charcoal"] { background: #41464a; }
.shed-option__preview[data-preview="green"] { background: #52634f; }
.shed-option__preview[data-preview="brown"] { background: #7c604b; }
.shed-option__preview[data-preview="red"] { background: #8c574f; }
.shed-options--orientation .shed-option__preview { background: linear-gradient(135deg, #81898e, #41464a); }
.shed-option__preview[data-preview="horizontal"]::after { content: ''; position: absolute; top: calc(50% - 1px); left: 2px; right: 2px; height: 2px; background: #e5e8e9; }
.shed-option__preview[data-preview="vertical"]::after { content: ''; position: absolute; left: calc(50% - 1px); top: 2px; bottom: 2px; width: 2px; background: #e5e8e9; }
.shed-context .raised-bed-context__actions { margin-top: 8px; }

/* The crop chooser owns the available desktop sidebar height. */
@media (min-width:1025px){
  #cropLayerPanel #veg-scroll{ flex:1 1 0; }
}
#cropLayerPanel .crop-selection-info{
  flex:0 0 auto; padding:6px 8px; border-radius:3px; font-size:.78rem;
  color:var(--ink); background:color-mix(in srgb, var(--ink) 7%, transparent);
  white-space:normal; text-align:left;
}
#cropLayerPanel .crop-selection-info[hidden]{ display:none; }

/* Retain an identifiable, selectable footprint when atlas artwork is unavailable. */
.plant-wrapper.crop-art-placeholder {
  border: 1px dashed currentColor;
  background: rgba(100, 140, 90, .18);
}
.plant-wrapper.crop-art-placeholder::after {
  content: attr(data-label);
  position: absolute;
  inset: 4px;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}

.veg-icon.crop-art-placeholder { position: relative; }
.veg-icon.crop-art-placeholder::after {
  content: "✦";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
