/* ─── CSS Custom Properties ─────────────────────────────────────────────── */
:root {
  --green-dark:   #1e5631;
  --green:        #27ae60;
  --green-mid:    #2ecc71;
  --green-light:  #eafaf1;
  --green-faint:  #f2fdf6;
  --amber:        #e67e22;
  --amber-light:  #fef9e7;
  --red:          #e74c3c;
  --red-light:    #fdf2f2;
  --blue:         #2980b9;
  --blue-light:   #ebf5fb;
  --purple:       #8e44ad;
  --surface:      #ffffff;
  --surface-alt:  #f8f9fa;
  --border:       #e2e8e4;
  --border-light: #f0f4f1;
  --text:         #1a2e1e;
  --text-mid:     #3d5440;
  --muted:        #6b8c72;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.08);
  --shadow:       0 2px 8px rgba(0,0,0,0.10);
  --shadow-lg:    0 4px 20px rgba(0,0,0,0.13);
  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    16px;
  --nav-h:        60px;
  --header-h:     52px;
  --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --transition:   0.18s ease;
}

/* ─── Reset & Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--surface-alt);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: var(--green); text-decoration: none; }

/* ─── App Shell ─────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* ─── Header ────────────────────────────────────────────────────────────── */
.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--green-dark);
  color: #fff;
  flex-shrink: 0;
  z-index: 10;
}
.app-header__logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.app-header__logo-icon { font-size: 1.4rem; }
.app-header__actions   { display: flex; gap: 8px; align-items: center; }
.header-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background var(--transition);
}
.header-btn:hover { background: rgba(255,255,255,0.25); }
.header-btn--icon { padding: 6px 8px; font-size: 1rem; }

/* ─── Screen Container ──────────────────────────────────────────────────── */
.screens { flex: 1; overflow: hidden; position: relative; }
.screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.screen.active { opacity: 1; pointer-events: auto; }

/* ─── Bottom Nav ────────────────────────────────────────────────────────── */
.bottom-nav {
  height: var(--nav-h);
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 10;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 500;
  padding: 6px 4px 8px;
  transition: color var(--transition);
  position: relative;
}
.nav-btn__icon { font-size: 1.35rem; line-height: 1; }
.nav-btn.active { color: var(--green); }
.nav-btn.active::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 2px;
  background: var(--green);
  border-radius: 0 0 2px 2px;
}
.nav-btn--builder.active { color: var(--amber); }
.nav-btn--builder.active::before { background: var(--amber); }

/* ─── Section Headers ───────────────────────────────────────────────────── */
.section-header {
  padding: 16px 16px 8px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.section-title  { font-size: 1.1rem; font-weight: 700; }
.section-sub    { font-size: 0.78rem; color: var(--muted); }
.section-action { font-size: 0.8rem; color: var(--green); font-weight: 600; background: none; border: none; }

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.card--pad    { padding: 14px 16px; }
.card--shadow { box-shadow: var(--shadow-sm); }

/* ─── HOME SCREEN ───────────────────────────────────────────────────────── */
#screen-home { background: var(--green-faint); }

.home-weather {
  background: linear-gradient(135deg, var(--green-dark) 0%, #2d6a4f 100%);
  color: #fff;
  padding: 16px;
  margin: 12px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.weather-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.weather-location { font-size: 0.78rem; opacity: 0.8; margin-bottom: 2px; }
.weather-temp     { font-size: 2.6rem; font-weight: 700; line-height: 1; }
.weather-desc     { font-size: 0.85rem; opacity: 0.85; margin-top: 2px; }
.weather-icon     { font-size: 3rem; }
.weather-row {
  display: flex;
  gap: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.2);
}
.weather-stat { font-size: 0.75rem; opacity: 0.85; }
.weather-stat strong { display: block; font-size: 0.95rem; font-weight: 700; }

.watering-banner {
  margin: 0 12px 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 600;
}
.watering-banner--skip  { background: var(--blue-light);  color: var(--blue); }
.watering-banner--water { background: var(--green-light); color: var(--green-dark); }
.watering-banner--alert { background: var(--amber-light); color: var(--amber); }
.watering-banner__icon   { font-size: 1.3rem; flex-shrink: 0; }
.watering-banner__text   { flex: 1; }
.watering-banner__reason { font-size: 0.75rem; font-weight: 400; margin-top: 2px; opacity: 0.8; }

.home-alerts { margin: 0 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.alert-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
}
.alert-chip--warning { background: var(--amber-light); color: #7d5a00; }
.alert-chip--danger  { background: var(--red-light);   color: #8b1a1a; }
.alert-chip--info    { background: var(--blue-light);  color: #1a4a6e; }

.home-tasks { margin: 0 12px 12px; }
.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  font-size: 0.85rem;
}
.task-emoji { font-size: 1.1rem; flex-shrink: 0; }
.task-plant { font-weight: 600; }
.task-note  { color: var(--muted); font-size: 0.78rem; }
.task-dot   { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-left: auto; }
.task-item--colored { border-width: 2px; margin-bottom: 8px; }

/* Legend strip: small transparent bars with darker borders, same treatment as annual overview bars */
.schedule-legend-strip { padding: 12px 16px 8px; }
.schedule-legend-strip__body { display: flex; flex-wrap: wrap; gap: 14px 18px; }
.legend-bar {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: 6px;
  border: 2px solid; font-size: 0.75rem; font-weight: 700;
}

.forecast-row {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 0 12px 12px;
  scrollbar-width: none;
}
.forecast-row::-webkit-scrollbar { display: none; }
.forecast-day {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  min-width: 60px;
}
.forecast-day__name { font-weight: 600; color: var(--muted); }
.forecast-day__icon { font-size: 1.4rem; }
.forecast-day__hi   { font-weight: 700; color: #c0392b; }
.forecast-day__lo   { color: var(--blue); }
.forecast-day__rain { color: var(--blue); font-size: 0.7rem; }
.forecast-day.today { border-color: var(--green); background: var(--green-light); }

/* ─── GARDEN SCREEN ─────────────────────────────────────────────────────── */
#screen-garden { display: flex; flex-direction: column; background: var(--surface-alt); }

.garden-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.garden-toolbar::-webkit-scrollbar { display: none; }
.tool-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-mid);
  white-space: nowrap;
  transition: all var(--transition);
}
.tool-btn:hover  { border-color: var(--green); color: var(--green); }
.tool-btn.active { background: var(--green-light); border-color: var(--green); color: var(--green-dark); }
.tool-sep        { width: 1px; height: 24px; background: var(--border); flex-shrink: 0; }

.garden-canvas-wrap {
  flex: 1;
  overflow: auto;
  padding: 12px;
  background: var(--surface-alt);
  position: relative;
}
#garden-canvas {
  display: block;
  cursor: crosshair;
  border-radius: var(--radius-sm);
  touch-action: none;
}

.garden-statusbar {
  padding: 6px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  gap: 16px;
  flex-shrink: 0;
}
.statusbar-item strong { color: var(--text); }

/* Plant picker */
.plant-picker {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 12px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
  z-index: 20;
  max-height: 60%;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.plant-picker.open { transform: translateY(0); }
.picker-handle-row {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 12px;
  cursor: ns-resize;
  touch-action: none;
}
.picker-handle {
  width: 36px; height: 4px;
  background: var(--border);
  border-radius: 2px;
}
.picker-shrink-btn {
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
}
.picker-shrink-btn:hover { background: var(--green-light); border-color: var(--green); }
.plant-picker.shrunk {
  max-height: 88px !important;
  overflow: hidden;
}

/* Under-grid plant list */
.multiselect-bar {
  position: absolute;
  top: 12px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  z-index: 20;
}
.multiselect-bar__delete {
  padding: 5px 10px;
  border: none;
  border-radius: var(--radius-sm);
  background: #c0392b;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}
.multiselect-bar__cancel {
  padding: 4px 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.garden-plant-list {
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.garden-plant-list__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}
.garden-plant-list__badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--green-light);
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 700;
}
.garden-plant-list__caret {
  transition: transform 0.2s ease;
  color: var(--muted);
}
.garden-plant-list.collapsed .garden-plant-list__caret { transform: rotate(-90deg); }
.garden-plant-list.collapsed .garden-plant-list__body { display: none; }
.garden-plant-list__body {
  max-height: 160px;
  overflow-y: auto;
  padding: 0 10px 10px;
}
.plant-list-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.plant-list-row:last-child { border-bottom: none; }
.plant-list-row__emoji { font-size: 1.05rem; }
.plant-list-row__name { flex: 1; color: var(--text); }
.plant-list-row__count { color: var(--muted); font-weight: 600; font-size: 0.8rem; }
.plant-list-row__locate {
  border: none;
  background: transparent;
  font-size: 0.95rem;
  cursor: pointer;
  padding: 2px 4px;
}
.plant-list-empty {
  padding: 12px 4px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

/* Planted-date field in plant info panel */
.plant-info-date-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  font-size: 0.85rem;
  color: var(--muted);
}
.plant-info-date-row label { flex-shrink: 0; }
.plant-info-date-row input[type="date"] {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 0.85rem;
}

.app-header__nav { display: none; }
.bottom-nav { display: flex; }

.picker-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 10px;
  background: var(--surface-alt);
}
.picker-qty-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px 10px;
  font-size: 0.82rem;
}
.picker-qty-label { color: var(--muted); flex: 1; }
.qty-btn {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
}
.qty-btn:hover { background: var(--green-light); border-color: var(--green); }
#qty-value { font-weight: 700; font-size: 1rem; min-width: 20px; text-align: center; }

.picker-categories {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 10px;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.picker-categories::-webkit-scrollbar { display: none; }
.cat-pill {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.cat-pill.active { background: var(--green-light); border-color: var(--green); color: var(--green-dark); }

.plant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.plant-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-alt);
  cursor: grab;
  font-size: 0.7rem;
  text-align: center;
  color: var(--text-mid);
  transition: all var(--transition);
  user-select: none;
}
.plant-chip:active     { cursor: grabbing; transform: scale(0.96); }
.plant-chip__emoji     { font-size: 1.6rem; }
.plant-chip__name      { font-weight: 600; line-height: 1.2; }
.plant-chip__space     { color: var(--muted); font-size: 0.65rem; }

/* Selected plant info */
.plant-info-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px 16px;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
  z-index: 15;
  display: none;
}
.plant-info-panel.visible    { display: block; }
.plant-info-panel__header    { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.plant-info-panel__name      { display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 700; }
.plant-info-panel__zone      { font-size: 0.75rem; font-weight: 600; padding: 3px 8px; border-radius: 20px; }
.zone-green       { background: #eafaf1; color: #1e5631; }
.zone-orange      { background: #fef9e7; color: #7d5a00; }
.zone-deep_orange { background: #fdf2e9; color: #a04000; }
.zone-red         { background: var(--red-light); color: #8b1a1a; }
.plant-info-stats { display: flex; gap: 16px; font-size: 0.78rem; color: var(--muted); margin-bottom: 12px; }
.plant-info-stats span strong { color: var(--text); display: block; font-size: 0.85rem; }
.plant-info-actions { display: flex; gap: 8px; }
.info-btn         { flex: 1; padding: 8px; border-radius: var(--radius-sm); font-size: 0.82rem; font-weight: 600; border: 1px solid var(--border); background: var(--surface-alt); color: var(--text-mid); }
.info-btn--danger { border-color: var(--red); color: var(--red); background: var(--red-light); }
.variety-select   { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.82rem; background: var(--surface-alt); margin-bottom: 8px; }

/* ─── PLANTS SCREEN ─────────────────────────────────────────────────────── */
#screen-plants { background: var(--surface-alt); }
.plants-sidebar { display: none; } /* desktop-only, see 1024px breakpoint */
.plants-search-bar {
  display: flex; gap: 8px; padding: 10px 12px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.plants-search-bar input {
  flex: 1; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.88rem; background: var(--surface-alt);
}
.plants-filter-btn {
  padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-alt); font-size: 0.85rem;
}
.plant-list { padding: 8px 12px; display: grid; grid-template-columns: 1fr; gap: 0; }
.plant-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); margin-bottom: 8px;
  overflow: hidden; cursor: pointer; transition: box-shadow var(--transition);
}
.plant-card:hover            { box-shadow: var(--shadow); }
.plant-card__header          { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.plant-card__emoji           { font-size: 2rem; flex-shrink: 0; }
.plant-card__info            { flex: 1; min-width: 0; }
.plant-card__name            { font-weight: 700; font-size: 0.95rem; }
.plant-card__cat             { font-size: 0.72rem; color: var(--muted); text-transform: capitalize; }
.plant-card__badges          { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.badge                       { font-size: 0.65rem; font-weight: 600; padding: 2px 6px; border-radius: 10px; }
.badge--sun-full             { background: #fef9e7; color: #7d5a00; }
.badge--sun-partial          { background: #eaf4fb; color: #1a4a6e; }
.badge--water-high           { background: #ebf5fb; color: #1a4a6e; }
.badge--water-med            { background: #e8f8f5; color: #0e6655; }
.badge--water-low            { background: #f9f9f9; color: #555; }
.badge--frost                { background: #ebf5fb; color: #1a4a6e; }
.badge--agri-excellent       { background: #eafaf1; color: #1e5631; }
.badge--agri-good            { background: #e9f7ef; color: #1e5631; }
.plant-card__body            { padding: 0 14px 12px; font-size: 0.8rem; color: var(--muted); display: none; border-top: 1px solid var(--border-light); }
.plant-card.expanded .plant-card__body { display: block; }
.plant-detail-grid           { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding: 10px 0; }
.detail-item                 { font-size: 0.78rem; }
.detail-item strong          { display: block; color: var(--text); font-size: 0.82rem; }
.companions-row, .antagonists-row { margin-top: 8px; font-size: 0.78rem; }
.companion-tag               { display: inline-block; margin: 2px; padding: 2px 7px; border-radius: 10px; font-size: 0.7rem; font-weight: 600; }
.companion-tag--good         { background: var(--green-light); color: var(--green-dark); }
.companion-tag--bad          { background: var(--red-light); color: var(--red); }
.varieties-list              { margin-top: 8px; }
.variety-item                { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border-light); font-size: 0.78rem; }
.variety-item:last-child     { border-bottom: none; }
.variety-item__name          { font-weight: 600; }
.variety-item__days          { color: var(--muted); }
.variety-btn                 { padding: 3px 10px; border: 1px solid var(--green); border-radius: 20px; background: none; color: var(--green); font-size: 0.72rem; font-weight: 600; }

/* ─── SCHEDULE SCREEN ───────────────────────────────────────────────────── */
#screen-schedule { background: var(--surface); }
.schedule-frost-banner {
  margin: 10px 12px 0; padding: 8px 12px;
  background: var(--amber-light); border-radius: var(--radius-sm);
  font-size: 0.8rem; color: #7d5a00; display: flex; gap: 8px; align-items: center;
}

.schedule-workspace { display: block; }
.schedule-day-detail { display: none; } /* mobile: modal is used instead */

/* ─── ANNUAL OVERVIEW (Gantt-style) ─────────────────────────────────────── */
.annual-overview        { margin: 16px 12px 24px; }
.annual-overview__title { font-size: 0.95rem; font-weight: 700; margin-bottom: 10px; }
.annual-overview__body  { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; overflow-x: auto; }
.gantt-empty             { color: var(--muted); font-size: 0.85rem; padding: 12px 4px; }

.gantt-header           { min-width: 1040px; }
.gantt-header__ruler    { position: relative; height: 38px; }
.gantt-header__months   {
  position: relative; height: 20px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.72rem; font-weight: 700; color: var(--text);
}
.gantt-header__months span { position: absolute; top: 0; text-align: left; padding-left: 5px; border-left: 2px solid var(--text-mid, #555); height: 100%; }
.gantt-header__days     { position: relative; height: 18px; }
.gantt-tick {
  position: absolute; top: 0; font-size: 0.62rem; color: var(--muted);
  padding-left: 2px; height: 100%;
  white-space: nowrap;
}

.gantt-rows-wrap { position: relative; min-width: 1040px; }
.gantt-gridlines { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.gantt-gridline  { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border-light); }
.gantt-gridline--month { background: var(--border, #ccc); width: 1px; }

.gantt-rows      { position: relative; z-index: 1; }
.gantt-row       { padding: 6px 0; border-bottom: 1px solid var(--border-light); }
.gantt-row__track{ position: relative; height: 38px; border-radius: 6px; }
.gantt-seg        {
  position: absolute; top: 0; height: 38px; min-width: 3px;
  box-sizing: border-box; border-style: solid; border-width: 2px 0;
}
.gantt-seg--indoor  { background: rgba(142, 68, 173, 0.14); border-color: #8e44ad; }
.gantt-seg--grow    { background: rgba(39, 174, 96, 0.14);  border-color: #27ae60; }
.gantt-seg--harvest { background: rgba(230, 126, 34, 0.14); border-color: #e67e22; }
.gantt-seg--solo  { border-radius: 6px; border-left-width: 2px; border-right-width: 2px; }
.gantt-seg--start { border-radius: 6px 0 0 6px; border-left-width: 2px; }
.gantt-seg--end   { border-radius: 0 6px 6px 0; border-right-width: 2px; }
.gantt-seg--mid   { border-radius: 0; }
.gantt-bar-label {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  font-size: 0.76rem; font-weight: 700; color: #fff;
  background: rgba(0,0,0,0.32); border-radius: 4px; padding: 3px 8px;
  white-space: nowrap; pointer-events: none; z-index: 2;
  max-width: calc(100% - 8px); overflow: hidden; text-overflow: ellipsis;
}
.gantt-legend      { display: flex; gap: 16px; margin-top: 10px; font-size: 0.72rem; color: var(--muted); }
.gantt-legend-item { display: flex; align-items: center; gap: 5px; }
.gantt-legend-item i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; border-style: solid; border-width: 2px; box-sizing: border-box; }

/* ─── SETTINGS SCREEN ───────────────────────────────────────────────────── */
#screen-settings { background: var(--surface-alt); padding-bottom: 24px; }
.settings-section        { margin: 12px; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.settings-section__title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); padding: 10px 14px 6px; }
.settings-row            { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px; border-top: 1px solid var(--border-light); font-size: 0.88rem; }
.settings-row:first-of-type { border-top: none; }
.settings-row__label     { color: var(--text); }
.settings-row__sub       { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.settings-input          { padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; max-width: 140px; text-align: right; background: var(--surface-alt); }
.settings-toggle         { position: relative; width: 44px; height: 24px; cursor: pointer; }
.settings-toggle input   { opacity: 0; width: 0; height: 0; }
.toggle-track            { position: absolute; inset: 0; background: var(--border); border-radius: 12px; transition: background var(--transition); }
.toggle-thumb            { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; box-shadow: var(--shadow-sm); transition: transform var(--transition); }
.settings-toggle input:checked ~ .toggle-track { background: var(--green); }
.settings-toggle input:checked ~ .toggle-thumb { transform: translateX(20px); }
.settings-btn            { width: 100%; padding: 12px; border: none; background: none; font-size: 0.88rem; color: var(--green); font-weight: 600; text-align: left; padding-left: 14px; }
.settings-btn--danger    { color: var(--red); }
.size-inputs             { display: flex; align-items: center; gap: 8px; }
.size-inputs input       { width: 60px; text-align: center; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 0.85rem; }
.size-inputs span        { color: var(--muted); font-size: 0.8rem; }

/* ─── Builder Screen ────────────────────────────────────────────────────── */
#screen-builder { background: var(--surface); }
#screen-builder .builder-wrap { height: 100%; display: flex; flex-direction: column; }

.builder-tabs {
  display: flex; gap: 6px; overflow-x: auto; padding: 10px 12px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.builder-tabs::-webkit-scrollbar { display: none; }
.builder-tab {
  flex-shrink: 0; padding: 8px 14px; border: 1px solid var(--border);
  border-radius: 20px; background: var(--surface-alt); color: var(--muted);
  font-size: 0.82rem; font-weight: 600; white-space: nowrap;
  transition: all var(--transition);
}
.builder-tab:hover  { border-color: var(--green); color: var(--green-dark); }
.builder-tab.active { background: var(--green); border-color: var(--green); color: #fff; }

.builder-content { flex: 1; overflow-y: auto; padding: 14px 16px 24px; }
.builder-empty   { color: var(--muted); font-size: 0.85rem; padding: 24px 4px; text-align: center; }
.builder-section-title { font-size: 0.98rem; font-weight: 700; margin-bottom: 10px; }

.builder-btn {
  padding: 10px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 0.85rem; font-weight: 600;
  transition: all var(--transition);
}
.builder-btn:hover           { border-color: var(--green); }
.builder-btn--primary        { background: var(--green); border-color: var(--green); color: #fff; }
.builder-btn--primary:hover  { background: var(--green-dark); }

.rec-list  { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.rec-card  {
  display: flex; gap: 12px; padding: 12px 14px; background: var(--surface-alt);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.rec-icon    { font-size: 1.5rem; flex-shrink: 0; }
.rec-card strong { display: block; font-size: 0.88rem; margin-bottom: 2px; }
.rec-card p  { font-size: 0.8rem; color: var(--muted); }
.rec-badge   {
  display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 10px;
  background: var(--green-light); color: var(--green-dark); font-size: 0.68rem;
  font-weight: 700; text-transform: capitalize;
}
.rec-inline  {
  padding: 8px 12px; margin-bottom: 12px; background: var(--amber-light);
  color: #7d5a00; border-radius: var(--radius-sm); font-size: 0.8rem;
}

.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.option-card {
  display: flex; flex-direction: column; gap: 4px; padding: 12px;
  border: 2px solid var(--border); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; text-align: center;
  transition: all var(--transition);
}
.option-card input { display: none; }
.option-card:hover   { border-color: var(--green-mid); }
.option-card.selected { border-color: var(--green); background: var(--green-light); }
.opt-icon    { font-size: 1.4rem; }
.opt-detail  { font-size: 0.72rem; color: var(--muted); }

.bed-list, .zone-list, .trellis-list, .path-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.bed-item, .zone-item, .trellis-item, .path-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.82rem;
}
.btn-remove {
  background: none; border: none; color: var(--red); font-size: 0.9rem;
  font-weight: 700; padding: 2px 6px;
}

.bed-form, .zone-form, .trellis-form, .path-form {
  padding: 12px; background: var(--surface-alt); border: 1px dashed var(--border);
  border-radius: var(--radius); margin-bottom: 8px;
}
.bed-form h4, .zone-form h4, .trellis-form h4, .path-form h4 {
  font-size: 0.82rem; font-weight: 700; margin-bottom: 8px; color: var(--text-mid);
}
.form-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.form-row label { display: flex; flex-direction: column; gap: 4px; font-size: 0.75rem; color: var(--muted); flex: 1; min-width: 110px; }
.form-row input, .form-row select {
  padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.85rem; background: var(--surface); color: var(--text);
}

.toggle-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 0.85rem; }

.shopping-note { font-size: 0.8rem; color: var(--muted); margin-bottom: 12px; }
.shopping-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; margin-bottom: 16px; }
.shopping-table th {
  text-align: left; padding: 8px; border-bottom: 2px solid var(--border);
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
}
.shopping-table td { padding: 8px; border-bottom: 1px solid var(--border-light); }
.shopping-table .qty { font-weight: 700; }
.shopping-table .for-col { color: var(--muted); font-size: 0.76rem; }

.build-order { padding: 12px; background: var(--green-light); border-radius: var(--radius); margin-bottom: 14px; }
.build-order h4 { font-size: 0.82rem; font-weight: 700; margin-bottom: 8px; color: var(--green-dark); }
.build-order ol { padding-left: 18px; font-size: 0.82rem; }
.build-order li { margin-bottom: 4px; }

.build-steps { padding: 12px; background: var(--surface-alt); border-radius: var(--radius); margin-top: 10px; }
.build-steps h4 { font-size: 0.82rem; font-weight: 700; margin-bottom: 8px; }
.build-steps ol { padding-left: 18px; font-size: 0.8rem; }
.build-steps li { margin-bottom: 4px; }

/* ─── Toast ─────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: calc(var(--nav-h) + 12px); left: 50%;
  transform: translateX(-50%); z-index: 100;
  display: flex; flex-direction: column; gap: 6px;
  pointer-events: none; width: calc(100% - 32px); max-width: 400px;
}
.toast {
  padding: 10px 14px; border-radius: var(--radius); font-size: 0.85rem;
  font-weight: 500; box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s ease, toast-out 0.3s ease 2.5s forwards;
  pointer-events: auto;
}
.toast--success { background: var(--green-dark); color: #fff; }
.toast--error   { background: var(--red);        color: #fff; }
.toast--info    { background: var(--blue);        color: #fff; }
.toast--warning { background: var(--amber);       color: #fff; }
@keyframes toast-in  { from { opacity:0; transform:translateY(12px); } to { opacity:1; transform:none; } }
@keyframes toast-out { from { opacity:1; } to { opacity:0; } }

/* ─── Loading / Empty ───────────────────────────────────────────────────── */
.spinner { width:32px; height:32px; border:3px solid var(--border); border-top-color:var(--green); border-radius:50%; animation:spin 0.7s linear infinite; margin:32px auto; }
@keyframes spin { to { transform:rotate(360deg); } }
.loading-state { display:flex; flex-direction:column; align-items:center; padding:40px 20px; color:var(--muted); font-size:0.85rem; gap:12px; }
.empty-state   { text-align:center; padding:40px 24px; color:var(--muted); }
.empty-state__icon  { font-size:3rem; margin-bottom:12px; }
.empty-state__title { font-size:1rem; font-weight:700; color:var(--text); margin-bottom:6px; }
.empty-state__sub   { font-size:0.85rem; margin-bottom:16px; }
.empty-state__btn   { padding:10px 24px; background:var(--green); color:#fff; border:none; border-radius:var(--radius); font-size:0.9rem; font-weight:600; }

/* ─── Modal ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,0.5); z-index:50;
  display:flex; align-items:flex-end; justify-content:center;
  opacity:0; pointer-events:none; transition:opacity 0.25s;
}
.modal-overlay.open { opacity:1; pointer-events:auto; }
.modal {
  background:var(--surface); border-radius:var(--radius-lg) var(--radius-lg) 0 0;
  padding:20px 16px 32px; width:100%; max-width:480px; max-height:85vh;
  overflow-y:auto; transform:translateY(40px);
  transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
.modal-overlay.open .modal { transform:none; }
.modal__handle { width:36px; height:4px; background:var(--border); border-radius:2px; margin:0 auto 16px; }
.modal__title  { font-size:1.05rem; font-weight:700; margin-bottom:12px; }

/* ─── Utility ───────────────────────────────────────────────────────────── */
.hidden  { display:none !important; }
.flex    { display:flex; }
.gap-8   { gap:8px; }
.gap-12  { gap:12px; }
.p-12    { padding:12px; }
.p-16    { padding:16px; }
.mt-8    { margin-top:8px; }
.mt-12   { margin-top:12px; }
.text-sm { font-size:0.82rem; }
.text-xs { font-size:0.72rem; }
.muted   { color:var(--muted); }
.bold    { font-weight:700; }
.center  { text-align:center; }
.w-full  { width:100%; }

::-webkit-scrollbar       { width:4px; height:4px; }
::-webkit-scrollbar-track { background:transparent; }
::-webkit-scrollbar-thumb { background:var(--border); border-radius:2px; }

@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav { padding-bottom:env(safe-area-inset-bottom); height:calc(var(--nav-h) + env(safe-area-inset-bottom)); }
}

/* ─── Compass & Companion ───────────────────────────────────────────────── */
.companion-panel {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  max-height: 55%;
  overflow-y: auto;
  z-index: 18;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
  padding-bottom: 12px;
}
.companion-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
}
.companion-close {
  background: var(--surface-alt);
  border: none;
  border-radius: 50%;
  width: 26px; height: 26px;
  font-size: 0.85rem;
  color: var(--muted);
}
.companion-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.82rem;
}
.companion-item:last-child { border-bottom: none; }
.companion-item__name { font-weight: 700; margin-bottom: 4px; }
.companion-tag-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.comp-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}
.comp-tag--good    { background: var(--green-light); color: var(--green-dark); }
.comp-tag--bad     { background: var(--red-light);   color: var(--red); }
.comp-tag--missing { background: var(--surface-alt); color: var(--muted); border: 1px dashed var(--border); }

/* Zone legend */
.zone-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 0.68rem;
  flex-shrink: 0;
}
.zone-legend-item { display: flex; align-items: center; gap: 3px; }
.zone-dot { width: 10px; height: 10px; border-radius: 2px; border: 1px solid rgba(0,0,0,0.15); }

/* North picker */
.north-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.north-btn {
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
  font-size: 0.88rem;
  font-weight: 500;
  text-align: center;
  transition: all var(--transition);
}
.north-btn:hover  { border-color: var(--green); background: var(--green-light); }
.north-btn.active { border-color: var(--blue,#2980b9); background: #ebf5fb; color: var(--blue,#2980b9); font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════════════
   TABLET (640px–1023px) — wider single-column layout. Still touch-first
   navigation (bottom tabs), but the phone-width cap is relaxed and grids
   get more breathing room. Desktop workspace kicks in separately at 1024px.
   ═══════════════════════════════════════════════════════════════════════ */
@media (min-width: 640px) and (max-width: 1023px) {
  #app {
    max-width: 720px;
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
  }
  .plant-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
  .plant-list { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 12px 16px; }
  .modal { max-width: 560px; }
}

/* ═══════════════════════════════════════════════════════════════════════
   DESKTOP WORKSPACE (Template B direction) — kicks in at 1024px+.
   Below this width, everything above still applies unchanged (mobile-first).
   ═══════════════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {

  /* Top bar becomes the primary nav; bottom tab bar goes away */
  .app-header { padding: 0 20px; gap: 24px; }
  .app-header__nav { display: flex; gap: 4px; flex: 1; }
  .app-header__nav-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.75);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    flex: none;
    height: auto;
  }
  .app-header__nav-btn:hover  { background: rgba(255,255,255,0.1); color: #fff; }
  .app-header__nav-btn.active { background: rgba(255,255,255,0.18); color: #fff; }
  .bottom-nav { display: none; }
  .screens { padding-bottom: 0; }

  /* Workspace grid: library | center | dock */
  .garden-workspace {
    display: grid;
    grid-template-columns: 260px 1fr 300px;
    height: calc(100vh - var(--header-h)); /* toolbar now floats over the canvas, no longer its own row */
    overflow: hidden;
  }
  .garden-center { display: flex; flex-direction: column; overflow: hidden; position: relative; }

  .desktop-library-slot, .desktop-dock-slot {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    overflow-y: auto;
    padding: 14px;
  }
  .desktop-library-slot { border-right: 1px solid var(--border); }
  .desktop-dock-slot    { border-left: 1px solid var(--border); }

  /* Plant picker docks statically into the library slot */
  .desktop-library-slot #plant-picker {
    position: static;
    transform: none;
    max-height: none;
    width: 100%;
    box-shadow: none;
    border-top: none;
    border-radius: 0;
    padding: 0;
  }

  .desktop-library-slot #picker-categories {
    flex-wrap: wrap;
    overflow-x: visible;
  }

  /* Plant info + companion panel dock statically into the right slot */
  .desktop-dock-slot #plant-info-panel {
    position: static;
    display: block;
    box-shadow: none;
    border-top: none;
    border-radius: 12px;
    background: var(--surface-alt);
    margin-bottom: 14px;
  }
  .desktop-dock-slot #plant-info-panel:empty { display: none; }
  .desktop-dock-slot #companion-panel {
    position: static;
    box-shadow: none;
    border-top: none;
    border-radius: 12px;
    margin-bottom: 14px;
  }
  .desktop-dock-slot .companion-close { display: none; }

  /* Plants-in-garden list, relocated from under the canvas to the dock,
     stacked above Companion Planting */
  .desktop-dock-slot #garden-plant-list {
    border-top: none;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 14px;
  }
  .desktop-dock-slot #garden-plant-list .garden-plant-list__body { max-height: 220px; }

  .dock-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin: 4px 0 8px;
  }
  .dock-schedule-preview .mini-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 0;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--border);
  }
  .dock-schedule-preview .mini-row .c {
    margin-left: auto;
    color: var(--muted);
    font-size: 0.75rem;
  }
  .dock-schedule-preview .empty {
    color: var(--muted);
    font-size: 0.8rem;
    padding: 6px 0;
  }

  .garden-canvas-wrap { flex: 1; }

  /* Toolbar sits as a real (non-overlapping) row at the top of garden-center,
     above whichever canvas (Grid or Property) is currently visible — reparented
     there by applyDesktopLayout() as the FIRST child, not floated over content,
     so it can never cover canvas interactions, the property search bar, or
     the multiselect bar underneath it. */
  .garden-center > .garden-toolbar {
    flex-shrink: 0;
    margin: 10px auto 0;
    width: auto;
    max-width: calc(100% - 28px);
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(255,255,255,0.94);
    backdrop-filter: blur(6px);
    box-shadow: var(--shadow-lg);
    padding: 6px 10px;
  }
  .garden-center > .garden-toolbar .tool-btn { border-radius: 999px; }

  /* Schedule: calendar left, day detail right */
  .schedule-workspace {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
    padding: 16px;
  }
  #schedule-container { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
  .schedule-day-detail {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    min-height: 300px;
    position: sticky;
    top: 16px;
  }
  .schedule-day-detail__header { font-size: 1.05rem; font-weight: 700; margin-bottom: 12px; }
  .schedule-day-detail__empty  { color: var(--muted); font-size: 0.85rem; }
  .annual-overview { margin: 0 16px 24px; }

  #app {
    max-width: none;
    box-shadow: none;
  }

  /* ── HOME: weather/banner/alerts | today's tasks, forecast full-width below ── */
  .home-workspace {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 18px;
    align-items: start;
    padding: 16px 16px 0;
  }
  .home-main   { display: flex; flex-direction: column; }
  .home-main .home-weather,
  .home-main .watering-banner,
  .home-main .home-alerts { margin: 0 0 14px; }
  .home-main .home-alerts:last-child { margin-bottom: 0; }

  .home-side {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 4px 14px 14px;
    height: 100%;
  }
  .home-side .section-header { padding: 12px 0 8px; }
  .home-side .home-tasks     { margin: 0; }
  .home-side .home-tasks .task-item:last-child { margin-bottom: 0; }

  .home-forecast { padding: 8px 16px 20px; }
  .home-forecast .section-header { padding: 8px 0 10px; }
  .home-forecast .forecast-row {
    overflow-x: visible;
    flex-wrap: wrap;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  }

  /* ── PLANTS: category/stat sidebar | search + list ── */
  .plants-workspace {
    display: grid;
    grid-template-columns: 220px 1fr;
    height: calc(100vh - var(--header-h));
    overflow: hidden;
  }
  .plants-sidebar {
    display: block;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 16px 14px;
    overflow-y: auto;
  }
  .plants-sidebar__title {
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.05em; color: var(--muted); margin-bottom: 8px;
  }
  .plants-sidebar__title--stats { margin-top: 20px; }
  .plants-category-list { display: flex; flex-direction: column; gap: 6px; }
  .plants-category-chip {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px; border-radius: var(--radius-sm);
    border: 2px solid var(--border); background: var(--surface);
    font-size: 0.8rem; font-weight: 600; color: var(--text);
    text-align: left; cursor: pointer; transition: all var(--transition);
  }
  .plants-category-chip:hover  { border-color: var(--green-mid); }
  .plants-category-chip.active { color: var(--cat-color, var(--green)); border-color: var(--cat-color, var(--green)); background: var(--cat-fill, var(--green-light)); }
  .plants-category-chip__count { margin-left: auto; font-size: 0.72rem; color: var(--muted); font-weight: 700; }
  .plants-stats { display: flex; flex-direction: column; gap: 6px; font-size: 0.78rem; color: var(--muted); }
  .plants-stats strong { color: var(--text); }

  .plants-main   { overflow-y: auto; height: 100%; }
  .plants-search-bar { top: 0; }
  .plant-list {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
    padding: 12px 16px;
  }

  /* ── SETTINGS: sections flow into balanced columns ── */
  .settings-grid {
    column-count: 2;
    column-gap: 16px;
    padding: 0 12px;
  }
  .settings-grid .settings-section {
    margin: 0 0 16px;
    break-inside: avoid;
  }

  /* ── BUILDER: vertical tab rail instead of horizontal tab strip ── */
  #screen-builder .builder-wrap { flex-direction: row; height: calc(100vh - var(--header-h)); }
  .builder-tabs {
    flex-direction: column; flex-shrink: 0; width: 220px;
    overflow-x: visible; overflow-y: auto;
    border-bottom: none; border-right: 1px solid var(--border);
    padding: 14px 10px;
  }
  .builder-tab { width: 100%; text-align: left; border-radius: var(--radius-sm); }
  .builder-content { padding: 20px 24px; }
  .option-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .shopping-table { max-width: 760px; }
}

/* ---- Property Canvas (Phase 2) ---- */
.property-canvas-wrap { position: relative; }
.property-canvas-wrap.hidden,
.garden-canvas-wrap.hidden { display: none; }

.property-toolbar {
  position: absolute; top: 8px; left: 8px; right: 8px; z-index: 5;
  display: flex; gap: 6px; flex-wrap: wrap;
}
.property-toolbar .picker-search { flex: 1 1 200px; }

#property-canvas { width: 100%; height: 100%; cursor: grab; touch-action: none; }
#property-canvas:active { cursor: grabbing; }
#property-canvas.calibrating,
#property-canvas.calibrating:active { cursor: crosshair; }

#property-address-results {
  position: absolute; top: 48px; left: 8px; right: 8px; z-index: 5;
  display: flex; flex-direction: column; gap: 4px;
  background: rgba(255,255,255,0.95); border-radius: 8px; padding: 6px;
  max-height: 200px; overflow-y: auto;
}
#property-address-results .tool-btn { text-align: left; }

.property-calibrate-banner {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.75); color: #fff; padding: 8px 14px;
  border-radius: 20px; font-size: 13px; z-index: 5;
}
