/* ============================================================================
   G4rden - "Pixel Farm" theme (Stardew / Harvest Moon flavor)
   Default theme. The botanical theme from the sensor dashboard is kept as
   .theme-botanical for users who toggle it on.
   ============================================================================ */

:root, .theme-farm {
  /* Wood & parchment palette */
  --grass:    #7cb04a;
  --grass-2:  #6a9a3e;
  --grass-3:  #5a8635;
  --soil:     #6b4a32;
  --soil-2:   #543925;
  --wood:     #8a5a36;
  --wood-2:   #6e4527;
  --wood-3:   #5a3820;
  --wood-lt:  #b07a4a;
  --parch:    #f6e9c8;
  --parch-2:  #efdcb0;
  --parch-3:  #e6cf9a;
  --ink:      #4a3422;
  --ink-2:    #6b4e34;
  --ink-3:    #8a6a47;
  --gold:     #f2c14e;
  --gold-2:   #e0a32f;
  --sky:      #bfe0ef;
  --sky-2:    #9ecbe0;

  --leaf:     #4a7c3a;
  --leaf-2:   #6fae45;

  /* status */
  --ok:       #5a8635;
  --warn:     #e0a32f;
  --crit:     #c4382f;
  --info:     #4f93cf;
  --frost:    #6fa8d0;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;

  --pixel: "Pixelify Sans", "VT323", monospace;
  --display: "Pixelify Sans", system-ui, sans-serif;
  --body: "Nunito", ui-sans-serif, system-ui, sans-serif;
  --read: "VT323", "Pixelify Sans", monospace;

  --frame-shadow: 0 4px 0 rgba(0,0,0,0.18);
}

/* botanical fallback theme overrides */
.theme-botanical {
  --grass:    #5d7c39;
  --grass-2:  #4d6a2c;
  --soil:     #6b4a32;
  --wood:     #93a774;
  --wood-2:   #6c7762;
  --wood-3:   #57614c;
  --parch:    #faf5e6;
  --parch-2:  #f3ecd5;
  --parch-3:  #e7dcc0;
  --ink:      #1c2515;
  --ink-2:    #364130;
  --ink-3:    #6c7762;
  --gold:     #d99a2b;
  --gold-2:   #c2851d;
  --display: "Instrument Serif", Georgia, serif;
  --body: "Nunito", system-ui, sans-serif;
  --pixel: "Nunito", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--body);
  color: var(--ink);
  background: var(--grass-3);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: var(--body); color: inherit; }
img { image-rendering: pixelated; }
.crisp { image-rendering: pixelated; }

/* ---------- App background: grassy field ---------- */
.farm-bg {
  background-color: var(--grass);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.06) 0 2px, transparent 2px),
    radial-gradient(circle at 70% 60%, rgba(0,0,0,.05) 0 2px, transparent 2px),
    radial-gradient(circle at 45% 85%, rgba(255,255,255,.05) 0 2px, transparent 2px),
    linear-gradient(180deg, var(--grass) 0%, var(--grass-2) 100%);
  background-size: 26px 26px, 32px 32px, 40px 40px, 100% 100%;
  background-attachment: fixed;
}
.theme-botanical .farm-bg {
  background-image:
    radial-gradient(circle at 1px 1px, rgba(44,69,25,.05) 1px, transparent 0),
    linear-gradient(180deg, #efe7d2 0%, #e7dcc0 100%);
  background-size: 22px 22px, 100% 100%;
}

/* ---------- Typography ---------- */
.pixel { font-family: var(--pixel); }
.display { font-family: var(--display); }
.read { font-family: var(--read); }
h1, h2, h3 { font-family: var(--display); margin: 0; font-weight: 600; line-height: 1.05; }
.theme-botanical h1, .theme-botanical h2, .theme-botanical h3 { font-weight: 400; }
.title-xl { font-size: clamp(26px, 4vw, 40px); }
.title-lg { font-size: clamp(20px, 3vw, 28px); }
.title-md { font-size: 20px; }
.eyebrow {
  font-family: var(--pixel);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-3);
}
.muted { color: var(--ink-3); }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Wood-framed panels (the core motif) ---------- */
.panel {
  background: var(--parch);
  border: 3px solid var(--wood-2);
  border-radius: var(--r-lg);
  box-shadow:
    inset 0 0 0 2px var(--parch),
    inset 0 0 0 3px var(--wood-lt),
    var(--frame-shadow);
  position: relative;
}
.panel-pad { padding: 18px 20px; }
.theme-botanical .panel {
  border-width: 1px;
  border-color: var(--parch-3);
  box-shadow: 0 1px 2px rgba(44,69,25,.06), 0 6px 18px -10px rgba(44,69,25,.18);
}

/* wooden header bar */
.wood-bar {
  background: linear-gradient(180deg, var(--wood-lt) 0%, var(--wood) 40%, var(--wood-2) 100%);
  border: 3px solid var(--wood-3);
  border-radius: var(--r-lg);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.18), var(--frame-shadow);
  color: #fff5e0;
}
.theme-botanical .wood-bar {
  background: var(--wood);
  border-color: var(--wood-3);
  color: #fff;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--pixel);
  font-size: 14px; font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--r-md);
  background: var(--parch-2);
  border: 2px solid var(--wood-2);
  box-shadow: 0 3px 0 var(--wood-2);
  color: var(--ink);
  transition: transform .06s, box-shadow .06s;
}
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--wood-2); }
.btn:hover { background: var(--parch-3); }
.btn-primary {
  background: linear-gradient(180deg, var(--grass) 0%, var(--grass-2) 100%);
  border-color: var(--grass-3);
  box-shadow: 0 3px 0 var(--grass-3);
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.06); background: linear-gradient(180deg, var(--grass) 0%, var(--grass-2) 100%); }
.btn-gold {
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-2) 100%);
  border-color: #b9831f; box-shadow: 0 3px 0 #b9831f; color: #4a3422;
}
.btn-sm { padding: 6px 11px; font-size: 12.5px; box-shadow: 0 2px 0 var(--wood-2); }
.btn-sm:active { box-shadow: 0 0 0; transform: translateY(2px); }
.btn-ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn-ghost:hover { background: rgba(0,0,0,.05); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }

/* ---------- Chips / tags ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--pixel);
  font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  background: var(--parch-3);
  border: 2px solid var(--wood-2);
  color: var(--ink-2);
}
.chip-sm { font-size: 11px; padding: 2px 8px; border-width: 1.5px; }
.chip.ok   { background: #dcedc4; border-color: var(--ok); color: #3f6020; }
.chip.warn { background: #fbe7c4; border-color: var(--warn); color: #8a5e12; }
.chip.crit { background: #f6d3cf; border-color: var(--crit); color: #8a2820; }
.chip.info { background: #d3e6f6; border-color: var(--info); color: #1f5680; }
.chip.frost{ background: #d8ecf8; border-color: var(--frost); color: #2a6285; }

/* ---------- Layout ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.shell { width: 100%; max-width: 1280px; margin: 0 auto; padding: 16px 20px 96px; }
@media (max-width: 640px) { .shell { padding: 12px 12px 96px; } }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 14px;
  position: sticky; top: 10px; z-index: 30;
  margin-bottom: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-badge {
  width: 42px; height: 42px; border-radius: 8px;
  background: var(--grass-2);
  border: 2px solid var(--wood-3);
  display: grid; place-items: center;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.2);
  overflow: hidden;
}
.brand-icon {
  width: 100%; height: 100%; object-fit: contain;
  image-rendering: pixelated; image-rendering: crisp-edges;
  display: block;
}
.brand-icon-lg {
  width: 48px; height: 48px; object-fit: contain;
  image-rendering: pixelated; image-rendering: crisp-edges;
  display: block; margin: 0 auto;
}
.brand-name { font-family: var(--display); font-size: 24px; color: #fff5e0; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.spacer { flex: 1; }

/* nav tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  font-family: var(--pixel);
  font-size: 13.5px; font-weight: 600;
  padding: 8px 14px; border-radius: 8px;
  color: #fff5e0; opacity: .8;
  display: inline-flex; align-items: center; gap: 7px;
  border: 2px solid transparent;
}
.tab:hover { opacity: 1; background: rgba(255,255,255,.12); }
.tab.on {
  opacity: 1;
  background: var(--parch);
  color: var(--ink);
  border-color: var(--wood-3);
  box-shadow: 0 3px 0 var(--wood-3);
}

/* ---------- Weather widget ---------- */
.weather-strip {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
}
.weather-now { display: flex; align-items: center; gap: 10px; }
.weather-temp { font-family: var(--read); font-size: 30px; line-height: 1; color: var(--ink); }
.weather-meta { font-size: 12px; color: var(--ink-2); }
.forecast-row { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; }
.forecast-day {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 8px; border-radius: 6px; min-width: 46px;
  background: rgba(255,255,255,.4);
}
.forecast-day.frost { background: #d8ecf8; box-shadow: inset 0 0 0 1.5px var(--frost); }
.forecast-day .fd { font-family: var(--pixel); font-size: 10px; font-weight: 600; color: var(--ink-3); }
.forecast-day .ft { font-family: var(--read); font-size: 14px; color: var(--ink); }
.forecast-day .ft .lo { color: var(--info); }

/* frost banner */
.frost-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; margin-bottom: 16px;
  background: linear-gradient(180deg, #e3f1fa, #cfe7f5);
  border: 3px solid var(--frost);
  border-radius: var(--r-lg);
  box-shadow: var(--frame-shadow);
}
.frost-banner.warm { background: linear-gradient(180deg, #fbeed0, #f6e0b0); border-color: var(--gold-2); }

.account-storage {
  margin-top: 14px; padding: 10px 12px; border-radius: 8px;
  background: var(--parch-2); border: 1.5px solid var(--parch-3);
}
.account-storage.warn {
  background: linear-gradient(180deg, #fbeed0, #f6e0b0);
  border-color: var(--gold-2);
}
.bed-limit-hint {
  font-size: 12px; font-family: var(--pixel); color: var(--ink-3);
  padding: 3px 9px; border-radius: 6px; white-space: nowrap;
  background: var(--parch-2); border: 1.5px solid var(--parch-3);
}
.bed-limit-hint.warn {
  color: var(--crit);
  border-color: var(--gold-2);
  background: linear-gradient(180deg, #fbeed0, #f6e0b0);
}
.limit-toast {
  margin: 0; padding: 10px 16px; font-size: 13px; line-height: 1.45;
  background: linear-gradient(180deg, #fde8e4, #fad4cc);
  border-bottom: 2px solid #c4382f; color: #5a2018;
}
.habit-toast {
  position: fixed; z-index: 180; left: 50%; bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex; align-items: flex-start; gap: 10px;
  max-width: min(420px, calc(100vw - 24px));
  padding: 12px 14px; border-radius: 12px;
  background: linear-gradient(180deg, #e8f5ef, #d4ebdc);
  border: 2px solid #2d6a4f; box-shadow: var(--frame-shadow);
  color: #1b4332; font-size: 13px; line-height: 1.45;
  animation: habit-toast-in .25s ease-out;
}
.habit-toast.habit-milestone {
  background: linear-gradient(180deg, #fbf0d4, #f3e2b0);
  border-color: #c9a227; color: #5c4a1a;
}
.habit-toast-emoji { font-size: 22px; line-height: 1; flex-shrink: 0; }
.habit-toast-title { font-weight: 700; margin-bottom: 2px; }
.habit-toast-body { opacity: .92; }
.habit-toast-close {
  appearance: none; border: none; background: transparent; cursor: pointer;
  font-size: 14px; opacity: .65; padding: 0 0 0 4px; flex-shrink: 0;
}
.habit-toast-close:hover { opacity: 1; }
@keyframes habit-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.care-rhythm { background: linear-gradient(180deg, rgba(255,255,255,.55), rgba(255,255,255,.35)); }
.care-rhythm-at-risk { border-color: var(--warn) !important; background: linear-gradient(180deg, #fdf6e8, #fbeed0); }
.care-rhythm-rank { font-size: 28px; line-height: 1; }
.care-rhythm-stats .chip { font-size: 11px; }
.garden-score-pill {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--leaf); color: #fff;
}
.garden-score-track {
  height: 6px; border-radius: 999px; background: var(--parch-3); overflow: hidden;
}
.garden-score-fill {
  height: 100%; border-radius: 999px; background: var(--leaf); transition: width .3s ease;
}
.return-nudge-warn { border-color: var(--warn) !important; }
.concept-help {
  margin: 0 0 14px; padding: 10px 14px; font-size: 13px; line-height: 1.45;
  background: linear-gradient(180deg, rgba(255,255,255,.7), rgba(255,255,255,.45));
  border: 2px solid var(--wood-2); border-radius: 10px;
}
.concept-help summary {
  cursor: pointer; font-weight: 600; color: var(--ink-2); list-style: none;
}
.concept-help summary::-webkit-details-marker { display: none; }
.concept-help summary::before { content: "▸ "; font-size: 11px; }
.concept-help[open] summary::before { content: "▾ "; }
.concept-help-body { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.community-sharing-more { font-size: 12.5px; }
.community-sharing-more summary { font-size: 12.5px; color: var(--leaf); font-weight: 600; }
.community-sharing-more .concept-row { align-items: flex-start; }
.concept-row { display: flex; gap: 10px; align-items: flex-start; }
.concept-icon { font-size: 20px; line-height: 1.2; flex-shrink: 0; }

/* ---------- Zone badge ---------- */
.zone-hero { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.zone-badge {
  width: 120px; height: 120px;
  border-radius: 16px;
  background: radial-gradient(circle at 40% 30%, var(--grass) 0%, var(--grass-3) 100%);
  border: 4px solid var(--wood-3);
  box-shadow: inset 0 3px 0 rgba(255,255,255,.2), var(--frame-shadow);
  display: grid; place-items: center; color: #fff;
  position: relative;
}
.zone-badge .zlabel { font-family: var(--display); font-size: 46px; line-height: 1; text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.zone-badge .zsub { font-family: var(--pixel); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; opacity: .9; }

.stat-row { display: flex; gap: 22px; flex-wrap: wrap; }
.stat .v { font-family: var(--read); font-size: 26px; line-height: 1; color: var(--ink); }
.stat .v.frost { color: var(--frost); }
.stat .v.warm { color: var(--gold-2); }
.stat .l { font-size: 11px; color: var(--ink-3); margin-top: 3px; font-family: var(--pixel); letter-spacing: .04em; }

/* ---------- "Plant now" cards ---------- */
.section-title { display: flex; align-items: center; gap: 12px; margin: 26px 4px 14px; }
.section-title h2 { color: #fff5e0; text-shadow: 0 2px 0 rgba(0,0,0,.22); }
.section-title .eyebrow { color: rgba(255,255,255,.8); }
.section-title .meta { margin-left: auto; color: rgba(255,255,255,.85); font-size: 13px; font-family: var(--pixel); }

.now-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.now-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; }
.now-card .nc-head { display: flex; align-items: center; gap: 10px; }
.now-card .nc-sprite {
  width: 52px; height: 52px; flex: none;
  background: var(--parch-3); border-radius: 8px;
  border: 2px solid var(--wood-2);
  display: grid; place-items: center;
}
.now-card .nc-name { font-family: var(--display); font-size: 19px; line-height: 1; }
.now-card .nc-sci { font-size: 11px; color: var(--ink-3); }
.now-card .nc-action {
  font-family: var(--pixel); font-size: 12px; font-weight: 600;
  padding: 5px 9px; border-radius: 6px; align-self: flex-start;
}
.act-indoors { background: #e7dcf3; color: #6a4a8a; }
.act-direct  { background: #dcedc4; color: #4a6a25; }
.act-transplant { background: #cfe6f5; color: #2a6285; }
.act-fall    { background: #fbe4cc; color: #9a5a22; }
.now-card .nc-win { font-family: var(--read); font-size: 15px; color: var(--ink-2); }
.now-card .nc-tip { font-size: 12px; color: var(--ink-3); line-height: 1.35; }

/* ---------- Season calendar ---------- */
.cal-wrap { padding: 16px; overflow-x: auto; }
.cal {
  display: grid;
  grid-template-columns: 130px repeat(12, 1fr);
  gap: 2px; min-width: 760px;
}
.cal-h { font-family: var(--pixel); font-size: 11px; font-weight: 600; color: var(--ink-3); text-align: center; padding: 4px 0; }
.cal-row-label { font-family: var(--pixel); font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 7px; padding-right: 8px; }
.cal-cell { height: 26px; border-radius: 3px; background: rgba(0,0,0,.04); position: relative; }
.cal-cell.month-now { box-shadow: inset 0 0 0 2px var(--gold); }
.cal-bar { position: absolute; top: 4px; bottom: 4px; border-radius: 3px; }
.cal-bar.indoors { background: #c3a8e0; }
.cal-bar.transplant { background: #8fc1e3; }
.cal-bar.direct { background: #9ed06b; }
.cal-bar.harvest { background: var(--gold); }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; font-family: var(--pixel); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }

/* ---------- Plant library grid ---------- */
.lib-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cat-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--parch); border: 2px solid var(--wood-2);
  border-radius: 8px; padding: 7px 12px; box-shadow: 0 2px 0 var(--wood-2);
}
.search-box input { border: none; background: none; outline: none; font-size: 14px; width: 160px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.lib-card { padding: 12px; display: flex; flex-direction: column; gap: 8px; align-items: center; text-align: center; cursor: pointer; transition: transform .08s; }
.lib-card:hover { transform: translateY(-3px); }
.lib-sprite {
  width: 72px; height: 72px;
  background: var(--parch-3); border-radius: 10px;
  border: 2px solid var(--wood-2);
  display: grid; place-items: center;
}
.lib-card .lc-name { font-family: var(--display); font-size: 18px; line-height: 1; }
.lib-card .lc-tag { font-size: 10.5px; font-family: var(--pixel); color: var(--ink-3); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(40,28,18,.5);
  display: grid; place-items: center; padding: 20px;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  width: 100%; max-width: 720px; max-height: calc(100vh - 40px);
  overflow: hidden; display: flex; flex-direction: column;
  animation: pop .2s cubic-bezier(.2,.7,.3,1.1);
}
@keyframes pop { from { transform: scale(.96) translateY(8px); opacity: 0 } to { transform: scale(1); opacity: 1 } }
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
}
.modal-head .mh-title { font-family: var(--display); font-size: 24px; color: #fff5e0; }
.modal-body { overflow-y: auto; padding: 18px 20px; background: var(--parch); }
.close-x {
  margin-left: auto; width: 32px; height: 32px; border-radius: 7px;
  background: rgba(0,0,0,.18); display: grid; place-items: center; color: #fff5e0;
  font-family: var(--pixel); font-size: 16px;
}
.close-x:hover { background: rgba(0,0,0,.3); }

/* detail layout */
.detail-top { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start; }
.detail-sprite {
  width: 110px; height: 110px;
  background: var(--parch-3); border-radius: 12px;
  border: 3px solid var(--wood-2); display: grid; place-items: center;
}
.kv-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 14px; }
.kv {
  background: var(--parch-2); border: 2px solid var(--parch-3);
  border-radius: 8px; padding: 8px 11px;
}
.kv .k { font-family: var(--pixel); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.kv .v { font-family: var(--read); font-size: 17px; color: var(--ink); }

/* soil mix bar */
.mix-bar { display: flex; height: 16px; border-radius: 5px; overflow: hidden; border: 2px solid var(--wood-2); margin-top: 6px; }
.mix-bar i { height: 100%; }
.mix-sand { background: #e6cf9a; }
.mix-silt { background: #c9a878; }
.mix-clay { background: #b5805a; }
.mix-organic { background: #6b4a32; }
.mix-key { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; font-size: 11px; font-family: var(--pixel); }
.mix-key span { display: inline-flex; align-items: center; gap: 5px; }
.mix-key i { width: 11px; height: 11px; border-radius: 3px; }

/* ph scale */
.ph-scale { position: relative; height: 18px; border-radius: 5px; margin-top: 8px;
  background: linear-gradient(90deg, #e8604a 0%, #f2c14e 35%, #7cb04a 50%, #4f93cf 75%, #8a5aa8 100%); border: 2px solid var(--wood-2); }
.ph-band { position: absolute; top: -3px; bottom: -3px; border: 3px solid var(--ink); border-radius: 6px; box-shadow: 0 0 0 1px #fff; }
.ph-key { display: flex; justify-content: space-between; font-size: 10px; font-family: var(--pixel); color: var(--ink-3); margin-top: 3px; }

/* companion chips */
.comp-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.comp-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; border-radius: 999px; font-family: var(--pixel); font-size: 12px; font-weight: 600; border: 2px solid; }
.comp-chip .cc-sprite { width: 24px; height: 24px; border-radius: 50%; background: var(--parch-3); display: grid; place-items: center; }
.comp-good { background: #dcedc4; border-color: var(--ok); color: #3f6020; }
.comp-bad { background: #f6d3cf; border-color: var(--crit); color: #8a2820; }

/* ---------- My Garden ---------- */
.admin-wrap { max-width: 900px; margin: 0 auto; padding: 20px 16px 48px; }
.admin-login { max-width: 400px; margin: 12vh auto 0; padding: 24px; }
.admin-top { border-radius: var(--r-lg); margin-bottom: 18px; padding: 12px 16px; display: flex; align-items: center; gap: 10px; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.admin-stat { padding: 16px; text-align: center; }
.admin-stat-val { font-family: var(--display); font-size: 32px; line-height: 1.1; }
.admin-table { display: flex; flex-direction: column; gap: 10px; }
.admin-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px; flex-wrap: wrap; }

.garden-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.gp-card { padding: 0; overflow: hidden; }
.gp-photo {
  height: 120px; position: relative; background: var(--parch-3);
  display: grid; place-items: center; border-bottom: 3px solid var(--wood-2);
}
.gp-photo image-slot { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
.gp-stage-tag { position: absolute; top: 8px; left: 8px; z-index: 2; }
.gp-body { padding: 12px 14px; }
.gp-name { font-family: var(--display); font-size: 20px; }
.gp-progress { height: 10px; border-radius: 5px; background: rgba(0,0,0,.08); margin-top: 8px; overflow: hidden; border: 1.5px solid var(--wood-2); }
.gp-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--grass), var(--gold)); }
.stage-steps { display: flex; gap: 4px; margin-top: 10px; }
.stage-step { flex: 1; height: 6px; border-radius: 3px; background: rgba(0,0,0,.1); }
.stage-step.done { background: var(--grass-2); }
.unplaced-strip { background: var(--parch-2); border: 2px dashed var(--gold-2); }
.gp-unplaced { outline: 2px dashed var(--warn); outline-offset: -2px; }
.gp-unplaced-tag { position: absolute; top: 8px; right: 8px; z-index: 2; }
.plant-notepad { width: 100%; margin-top: 10; padding-top: 10; border-top: 1.5px solid var(--parch-3); }
.notepad-label { display: block; font-family: var(--display); font-size: 14px; color: var(--ink-2); margin-bottom: 6px; }
.notepad-input {
  width: 100%; box-sizing: border-box; border-radius: 8px; border: 2px solid var(--wood-2);
  padding: 8px 10px; font-size: 13px; line-height: 1.45; font-family: inherit;
  background: #fffef8; resize: vertical; min-height: 4.5em;
}
.notepad-input:focus { outline: none; border-color: var(--gold-2); box-shadow: 0 0 0 2px rgba(242, 193, 78, .25); }
.notepad-meta { font-size: 11px; color: var(--ink-3); margin-top: 4px; text-align: right; font-family: var(--pixel); }
.notepad-meta.warn { color: var(--crit); }
.bed-canvas.bed-placing { cursor: crosshair; }

/* ---------- Tasks ---------- */
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; }
.task-check {
  width: 24px; height: 24px; flex: none; border-radius: 6px;
  border: 2px solid var(--wood-2); background: var(--parch-2);
  display: grid; place-items: center;
}
.task-row.done .task-check { background: var(--grass-2); border-color: var(--grass-3); color: #fff; }
.task-row.done .task-label { text-decoration: line-through; color: var(--ink-3); }
.task-label { font-weight: 600; }
.task-when { margin-left: auto; font-family: var(--pixel); font-size: 12px; color: var(--ink-3); }
.task-row.overdue .task-when { color: var(--crit); }
.task-row.task-water .task-check { border-color: #6eb5d8; background: #e8f4fa; font-size: 13px; }
.task-row.task-water.overdue .task-check { border-color: var(--crit); background: #fde8e8; }

.water-group-list { max-height: min(52vh, 420px); overflow-y: auto; }
.water-group-head, .water-plant-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: none; background: transparent; cursor: pointer; font: inherit; color: inherit;
}
.water-group-head { padding: 10px 12px; border-bottom: 1px solid var(--parch-3); }
.water-plant-rows { padding: 4px 0 6px; }
.water-plant-row { padding: 7px 12px 7px 20px; font-size: 13px; }
.water-plant-row:hover, .water-group-head:hover { background: var(--parch-2); }
.water-plant-row.on { background: #e8f4fa; }
.water-pick {
  width: 22px; height: 22px; flex: none; border-radius: 5px;
  border: 2px solid var(--wood-2); background: var(--parch-2);
  display: grid; place-items: center; font-size: 12px;
}
.water-pick.sm { width: 18px; height: 18px; font-size: 10px; }
.water-pick.on, .water-pick.part { background: #cfe9f5; border-color: #6eb5d8; color: var(--ink); }
.task-row.task-rain-hold { opacity: 0.92; }
.task-row.task-rain-hold .task-when { color: #2a6a8a; }
.task-missed-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: none; background: var(--parch-2); border-radius: 8px;
  padding: 10px 12px; cursor: pointer; font: inherit; color: inherit;
}
.task-missed-section .task-label { font-weight: 600; }
.task-sched-learned { color: var(--ink-2); }

/* ---------- Bed planner ---------- */
.planner-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.bed-collision-banner {
  position: absolute; top: 8px; left: 8px; right: 8px; z-index: 5;
  margin: 0; padding: 10px 14px; pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.22);
}
.bed-canvas.bed-custom-shape {
  background:
    linear-gradient(90deg, rgba(0,0,0,.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(0,0,0,.04) 1px, transparent 1px),
    #5a4a3a;
  background-size: 40px 40px, 40px 40px, 100% 100%;
}
.bed-shape-fill { fill: rgba(124, 176, 74, 0.55); }
.bed-shape-edge { stroke: rgba(90, 56, 32, 0.85); stroke-width: 2.5; }
.zone-svg-layer { z-index: 3; overflow: visible; }
.zone-vertex { fill: #fff; stroke: var(--wood-3); stroke-width: 2; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.zone-vertex.sel { fill: var(--gold); stroke: #fff; stroke-width: 2.5; }
.bed-shape-panel {
  margin-top: 12px; padding: 10px 12px; background: var(--parch-2);
  border-radius: 8px; border: 1.5px solid var(--parch-3);
}
.bed-shape-panel.compact { margin-top: 0; margin-bottom: 12px; }
.bed-shape-hint { font-size: 12px; margin: 6px 0 0; line-height: 1.45; }
.shape-edge-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.shape-edge-chip { font-size: 11px; font-family: var(--pixel); }
.shape-edge-label {
  font-family: var(--pixel);
  fill: #fff;
  stroke: rgba(0, 0, 0, 0.72);
  stroke-width: 3px;
  paint-order: stroke fill;
  pointer-events: none;
  user-select: none;
}
.length-unit-toggle { display: inline-flex; gap: 4px; }
.length-unit-toggle.compact .btn { min-width: 2.2rem; padding-left: 8px; padding-right: 8px; }
.bed-vertex { fill: #fff; stroke: var(--wood-3); stroke-width: 2; cursor: crosshair; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.bed-vertex.sel { fill: var(--gold); stroke: #fff; }
.bed-canvas.shape-editing .bed-plant { pointer-events: none; opacity: 0.45; }
.bed-canvas.shape-editing { cursor: crosshair; }
.bed-canvas {
  position: relative; width: 100%;
  background:
    linear-gradient(90deg, rgba(0,0,0,.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(0,0,0,.06) 1px, transparent 1px),
    repeating-linear-gradient(180deg, #7a5436 0 6px, #6e4a2f 6px 12px);
  background-size: 40px 40px, 40px 40px, 100% 100%;
  border: 3px solid var(--wood-3); border-radius: var(--r-lg);
  box-shadow: inset 0 0 30px rgba(0,0,0,.25);
  min-height: 420px; overflow: hidden; touch-action: none;
}
.bed-plant {
  position: absolute; width: 48px; height: 48px;
  transform: translate(-50%, -50%);
  display: grid; place-items: center; cursor: grab;
  filter: drop-shadow(0 3px 2px rgba(0,0,0,.35));
}
.bed-plant:active { cursor: grabbing; }
.bed-plant.sel { outline: 3px dashed var(--gold); outline-offset: 2px; border-radius: 8px; }
.bed-plant .bp-label {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  font-family: var(--pixel); font-size: 10px; font-weight: 600; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.8); white-space: nowrap;
}
.palette-tray { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px; }
.tray-item {
  width: 56px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 4px; border-radius: 8px; cursor: grab; border: 2px solid transparent;
}
.tray-item:hover { background: rgba(0,0,0,.05); border-color: var(--wood-2); }
.tray-item.on { background: var(--parch-3); border-color: var(--gold-2); }
.tray-item .ti-name { font-family: var(--pixel); font-size: 9.5px; color: var(--ink-3); }
.bed-hint { font-family: var(--pixel); font-size: 12px; color: rgba(255,255,255,.85); text-align: center; padding: 20px; }
.companion-flag {
  position: absolute; font-size: 14px; pointer-events: none;
  animation: bob 1.2s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-3px) } }

/* ---------- Setup / onboarding ---------- */
.setup-wrap { max-width: 520px; margin: 6vh auto; }
.loc-suggest { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.loc-opt { text-align: left; padding: 10px 14px; border-radius: 8px; background: var(--parch-2); border: 2px solid transparent; font-weight: 600; }
.loc-opt:hover { border-color: var(--gold-2); background: var(--parch-3); }
.loc-opt small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; }

/* ---------- account banner ---------- */
.acct-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px; margin-bottom: 16px;
  background: linear-gradient(180deg, var(--parch), var(--parch-2));
}
.acct-banner .ab-text { flex: 1; min-width: 200px; font-size: 13.5px; }
.acct-banner .ab-text b { font-family: var(--pixel); }

/* sensor upsell */
.sensor-cta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 16px 18px; }
.diy-step { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1.5px dashed var(--parch-3); }
.diy-step:last-child { border-bottom: none; }
.diy-num {
  width: 30px; height: 30px; flex: none; border-radius: 7px;
  background: var(--grass-2); color: #fff; display: grid; place-items: center;
  font-family: var(--pixel); font-weight: 700;
}

/* bottom nav (mobile) */
.botnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: none; align-items: stretch;
  background: linear-gradient(180deg, var(--wood), var(--wood-2));
  border-top: 3px solid var(--wood-3);
}
.botnav button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0; color: rgba(255,245,224,.7); font-family: var(--pixel); font-size: 10px; font-weight: 600;
}
.botnav button.on { color: #fff5e0; background: rgba(255,255,255,.1); }
@media (max-width: 760px) {
  .topbar .tabs { display: none; }
  .botnav { display: flex; }
}

/* utility */
.row { display: flex; align-items: center; gap: 10px; }

/* ---------- footer ---------- */
.pp-footer {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 8px; margin: 36px auto 0; padding: 16px 12px;
  font-size: 12.5px; color: var(--ink-3);
  border-top: 2px dashed var(--panel-line);
  max-width: 900px;
}
.pp-footer button, .pp-footer a {
  background: none; border: none; cursor: pointer;
  color: var(--ink-2); font-family: var(--body); font-size: 12.5px;
  text-decoration: none; padding: 0;
}
.pp-footer button:hover, .pp-footer a:hover { color: var(--leaf); text-decoration: underline; }
.pp-footer .sep { color: var(--ink-soft); opacity: .6; }

.lang-switcher {
  display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px;
}
.lang-switcher-btn {
  font-family: var(--pixel); font-size: 9px; letter-spacing: 0.06em;
  color: var(--ink-3); background: var(--parch-2);
  border: 2px solid var(--parch-3); border-radius: 4px;
  padding: 3px 6px; cursor: pointer; line-height: 1.2;
}
.lang-switcher-btn:hover { color: var(--ink); border-color: var(--wood-2); }
.lang-switcher-btn.is-active {
  color: var(--wood-3); border-color: var(--gold-2); background: var(--gold);
}
.pp-footer .lang-slot { display: inline-flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.gap-sm { gap: 6px; } .gap-lg { gap: 18px; }
.mt { margin-top: 14px; } .mt-lg { margin-top: 24px; }
.grow { flex: 1; }
.center { display: grid; place-items: center; }
.hide { display: none !important; }
