/* Plants — "Potting Shed"
   Terracotta, moss, oat paper. Mobile-first, iOS-native feel. */

:root {
  color-scheme: light dark;

  /* Ground */
  --bg: #f5f1e8;
  --surface: #ffffff;
  --surface-2: #fbf8f1;
  --hairline: rgba(35, 40, 28, 0.1);

  /* Ink */
  --text: #23281c;
  --text-2: #5b6150;
  --text-3: #8a8878;

  /* Brand */
  --accent: #c96f4a;
  --accent-text: #a8502c;
  --accent-ink: #fff7f0;

  /* Status */
  --ok-fill: #4c8a5c;
  --ok-text: #35693f;
  --watch-fill: #d89a2b;
  --watch-text: #8a6100;
  --dry-fill: #d25b33;
  --dry-text: #ac3e1c;
  --watering-fill: #3e92c4;
  --watering-text: #22688f;
  --offline-fill: #9a9689;
  --offline-text: #6e6b5f;

  /* the galvanized watering can */
  --can-body: #97a5ae;
  --can-detail: #5f7280;
  --can-shine: #c9d3d9;

  --ok-tint: #eaf2ec;
  --watch-tint: #f9f0dc;
  --dry-tint: #f9e8e0;
  --watering-tint: #e4f0f8;
  --offline-tint: #efede4;

  --shadow-card: 0 1px 2px rgba(35, 40, 28, 0.06), 0 6px 20px rgba(35, 40, 28, 0.05);
  --shadow-sheet: 0 -8px 40px rgba(35, 40, 28, 0.18);
  --card-edge: none;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  --font-display: ui-rounded, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;

  --ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-out: cubic-bezier(0.2, 0, 0, 1);

  --nav-height: 56px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15170f;
    --surface: #1f221a;
    --surface-2: #262a20;
    --hairline: rgba(242, 239, 227, 0.09);

    --text: #efede1;
    --text-2: #a9a896;
    --text-3: #6f6e5f;

    --accent: #d97f58;
    --accent-text: #e59a78;
    --accent-ink: #2a1710;

    --ok-fill: #5e9e6e;
    --ok-text: #8fc89c;
    --watch-fill: #d89a2b;
    --watch-text: #e4b45a;
    --dry-fill: #d6633c;
    --dry-text: #ee9573;
    --watering-fill: #4e9ccb;
    --watering-text: #85c1e4;
    --offline-fill: #6e6b5f;
    --offline-text: #a5a293;

    --can-body: #8b9ba6;
    --can-detail: #c2d0da;
    --can-shine: #a9bac5;

    --ok-tint: #1e2a20;
    --watch-tint: #2c2514;
    --dry-tint: #2e1e16;
    --watering-tint: #17242d;
    --offline-tint: #22251c;

    --shadow-card: none;
    --shadow-sheet: 0 -8px 40px rgba(0, 0, 0, 0.5);
    --card-edge: inset 0 0 0 1px var(--hairline);
  }
}

/* Status scoping: any element with .s-* exposes --s-fill/--s-text/--s-tint */
.s-ok {
  --s-fill: var(--ok-fill);
  --s-text: var(--ok-text);
  --s-tint: var(--ok-tint);
}
.s-watch {
  --s-fill: var(--watch-fill);
  --s-text: var(--watch-text);
  --s-tint: var(--watch-tint);
}
.s-dry {
  --s-fill: var(--dry-fill);
  --s-text: var(--dry-text);
  --s-tint: var(--dry-tint);
}
.s-water {
  --s-fill: var(--watering-fill);
  --s-text: var(--watering-text);
  --s-tint: var(--watering-tint);
}
.s-off {
  --s-fill: var(--offline-fill);
  --s-text: var(--offline-text);
  --s-tint: var(--offline-tint);
}

strong.s-ok, strong.s-watch, strong.s-dry, strong.s-water, strong.s-off,
span.s-ok, span.s-watch, span.s-dry, span.s-water, span.s-off {
  color: var(--s-text);
  font-weight: 500;
}

/* ---------------------------------------------------------------- base */

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
  min-width: 320px;
}

body {
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.35;
  margin: 0;
  min-height: 100dvh;
  min-width: 320px;
  overscroll-behavior-y: contain;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* paper grain, light mode only */
body::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  content: "";
  inset: 0;
  opacity: 0.025;
  pointer-events: none;
  position: fixed;
  z-index: 90;
}

@media (prefers-color-scheme: dark) {
  body::before {
    content: none;
  }
}

.num {
  font-variant-numeric: tabular-nums;
}

button {
  -webkit-tap-highlight-color: transparent;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 0;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

button:disabled {
  cursor: default;
}

button:not(:disabled):active {
  transform: scale(0.97);
}

input,
select {
  font: inherit;
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2.5px solid color-mix(in srgb, var(--accent) 65%, transparent);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- shell */

.screen {
  margin: 0 auto;
  max-width: 640px;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(24px + env(safe-area-inset-bottom));
}

body.has-nav .screen {
  padding-bottom: calc(24px + var(--nav-height) + env(safe-area-inset-bottom));
}

.screen-header {
  padding: 4px 0 14px;
}

.header-row {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 36px;
}

.screen-header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 28px;
  margin: 0;
}

.screen-header.pushed {
  align-items: center;
  display: flex;
  gap: 6px;
}

.screen-header.pushed h1 {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  line-height: 22px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.back-btn {
  align-items: center;
  display: inline-flex;
  height: 44px;
  justify-content: center;
  margin-left: -12px;
  width: 44px;
}

.chev-back {
  transform: rotate(180deg);
}

.header-action {
  min-height: 44px;
}

.greeting {
  color: var(--text-2);
  font-size: 15px;
  line-height: 20px;
  margin: 6px 0 0;
}

.brand-lockup {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.brand-art {
  aspect-ratio: 1;
  flex: none;
  width: 36px;
}

.welcome-art .brand-art {
  height: auto;
  width: 100%;
}

/* freshness pill */
.fresh-pill {
  align-items: center;
  background: var(--s-tint);
  border-radius: 999px;
  color: var(--s-text);
  display: inline-flex;
  font-size: 12px;
  font-weight: 500;
  gap: 6px;
  min-height: 30px;
  padding: 4px 12px;
  position: relative;
}

.fresh-pill::after {
  content: "";
  inset: -7px 0;
  position: absolute;
}

.fresh-pill .dot {
  background: var(--s-fill);
  border-radius: 999px;
  height: 6px;
  width: 6px;
}

.fresh-pill.is-syncing .dot {
  animation: pulse-dot 1s ease-in-out infinite;
}

@keyframes pulse-dot {
  50% {
    opacity: 0.3;
    transform: scale(0.7);
  }
}

/* ---------------------------------------------------------------- icons */

svg.icon {
  display: inline-block;
  flex: none;
  height: 24px;
  stroke-width: 1.75;
  vertical-align: -6px;
  width: 24px;
}

.chev-inline {
  height: 14px;
  stroke-width: 2.2;
  vertical-align: -2px;
  width: 14px;
}

.chev-expand {
  color: var(--text-3);
  height: 18px;
  transform: rotate(90deg);
  transition: transform 200ms var(--ease-out);
  width: 18px;
}

details[open] .chev-expand {
  transform: rotate(-90deg);
}

.chev-row {
  color: var(--text-3);
  height: 18px;
  width: 18px;
}

/* ---------------------------------------------------------------- zone cards */

.zone-list {
  display: grid;
  gap: 12px;
}

.zone-card {
  background: var(--surface);
  border-radius: 20px 20px 20px 6px; /* leaf-tip */
  box-shadow: var(--shadow-card), var(--card-edge);
  cursor: pointer;
  display: flex;
  gap: 14px;
  min-height: 108px;
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.zone-card.bg-dry {
  background: var(--dry-tint);
}

.zone-card.bg-water {
  background:
    radial-gradient(circle at 82% 18%, color-mix(in srgb, var(--watering-fill) 20%, transparent) 0 34%, transparent 35%),
    linear-gradient(135deg, var(--watering-tint), color-mix(in srgb, var(--watering-fill) 13%, var(--surface)) 74%);
  box-shadow: 0 14px 36px color-mix(in srgb, var(--watering-fill) 18%, transparent), var(--shadow-card), var(--card-edge);
}

.zone-card.is-unconfigured {
  align-items: center;
  background: transparent;
  box-shadow: none;
  outline: 1.5px dashed var(--hairline);
  outline-offset: -1.5px;
}

.ghost-icon {
  color: var(--text-3);
}

.ghost-icon .icon {
  height: 32px;
  width: 32px;
}

.zone-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.zone-head {
  align-items: flex-start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.zone-head h3,
.zone-card.is-unconfigured h3 {
  font-size: 17px;
  font-weight: 600;
  line-height: 22px;
  margin: 0;
  overflow-wrap: anywhere;
}

.chip {
  background: var(--s-tint);
  border-radius: 999px;
  color: var(--s-text);
  flex: none;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  padding: 3px 10px;
  white-space: nowrap;
}

@media (prefers-color-scheme: dark) {
  .chip {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--s-fill) 30%, transparent);
  }
}

.reading {
  align-items: baseline;
  column-gap: 10px;
  display: flex;
  flex-wrap: wrap;
}

.reading-num {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 44px;
}

.reading-num .pct {
  color: var(--text-2);
  font-size: 17px;
  font-weight: 500;
  margin-left: 1px;
}

.reading-num.is-null {
  color: var(--text-3);
}

.reading-meta {
  color: var(--text-2);
  font-size: 12px;
  line-height: 16px;
}

.reading.is-stale .reading-num {
  opacity: 0.55;
}

.reading-stale {
  color: var(--watch-text);
  flex-basis: 100%;
  font-size: 12px;
  line-height: 16px;
}

.zone-card.is-stale .gauge,
.zone-hero.is-stale .gauge {
  filter: saturate(0.2);
}

.zone-foot {
  align-items: flex-end;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 6px;
}

.zone-caption {
  color: var(--text-2);
  font-size: 12px;
  line-height: 16px;
}

.zone-card.is-unconfigured .zone-caption {
  color: var(--accent-text);
  font-weight: 500;
}

/* water button */
.btn-water {
  align-items: center;
  background: var(--watering-fill);
  border-radius: 12px;
  color: #fff;
  display: inline-flex;
  flex: none;
  font-size: 15px;
  font-weight: 600;
  gap: 6px;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  transition: background-color 300ms linear, opacity 300ms linear;
}

.btn-water .icon {
  height: 18px;
  stroke-width: 2;
  width: 18px;
}

.btn-water.is-locked {
  opacity: 0.4;
}

.btn-water.is-queued {
  background: color-mix(in srgb, var(--watering-fill) 72%, var(--bg));
}

.btn-water.is-counting {
  background: var(--watering-fill);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--watering-fill) 40%, transparent);
  animation: water-button-pulse 1.35s ease-in-out infinite;
}

@keyframes water-button-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--watering-fill) 32%, transparent);
    transform: translateY(0);
  }
  50% {
    box-shadow: 0 0 0 7px color-mix(in srgb, var(--watering-fill) 0%, transparent);
    transform: translateY(-1px);
  }
}

.btn-water-wide {
  border-radius: 14px;
  margin: 14px 0 4px;
  min-height: 50px;
  width: 100%;
}

/* ---------------------------------------------------------------- plant art */

.plant-slot {
  display: flex;
  margin: -10px 0 -6px 2px;
  min-height: 92px;
}

.plant-art {
  display: block;
  flex: none;
  height: auto;
  overflow: visible;
}

/* Three spring variables (--sway-a/b/c, from the scroll engine) cycle across
   cards so a flick ripples through the shelf instead of tilting in lockstep. */
.plant-art .sway {
  transform: rotate(var(--sway-a, 0deg));
  transform-box: view-box;
  transform-origin: 50% 72%;
  will-change: transform;
}

.zone-card:nth-child(3n + 2) .plant-art .sway {
  transform: rotate(var(--sway-b, 0deg));
}

.zone-card:nth-child(3n) .plant-art .sway {
  transform: rotate(var(--sway-c, 0deg));
}

.brand-art .sway {
  transform: rotate(var(--sway-c, 0deg));
}

.plant-art .breeze {
  animation: breeze 6.5s ease-in-out infinite;
  transform-box: view-box;
  transform-origin: 50% 72%;
}

/* an uneven rhythm reads as air, not a metronome */
@keyframes breeze {
  0% {
    transform: rotate(-2deg);
  }
  26% {
    transform: rotate(1.3deg);
  }
  49% {
    transform: rotate(2.4deg);
  }
  64% {
    transform: rotate(0.6deg);
  }
  82% {
    transform: rotate(-1.2deg);
  }
  100% {
    transform: rotate(-2deg);
  }
}

.zone-card.bg-water .plant-art .breeze,
.hero-plant.is-watering .plant-art .breeze {
  animation: happy-wiggle 1.5s ease-in-out infinite;
}

@keyframes happy-wiggle {
  0%,
  100% {
    transform: rotate(-2.6deg);
  }
  25% {
    transform: rotate(2.8deg) scale(1.02);
  }
  50% {
    transform: rotate(-2.2deg);
  }
  75% {
    transform: rotate(2.4deg) scale(1.02);
  }
}

.zone-card.is-stale .plant-art {
  filter: saturate(0.25);
  opacity: 0.8;
}

.hero-plant {
  align-self: flex-end;
  margin-bottom: 2px;
}

.sheet-plant {
  flex: none;
  margin-right: 2px;
}

/* appearance picker */
.plant-picker {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
}

.plant-choice {
  align-items: flex-end;
  background: var(--surface-2);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  min-height: 64px;
  padding: 8px 4px 5px;
}

.plant-choice.is-active {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-2));
  box-shadow: inset 0 0 0 2px var(--accent);
}

.plant-choice .brand-art {
  width: 42px;
}

.icon-pref-preview {
  display: inline-flex;
  margin-left: auto;
}

.icon-pref-preview .brand-art {
  width: 26px;
}

.swatch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
}

.swatch {
  background: var(--swatch);
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  height: 34px;
  width: 34px;
}

.swatch.is-active {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4.5px var(--accent);
}

.chips-row-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.size-chip.is-active {
  background: var(--accent);
  color: var(--accent-ink);
}

/* ---------------------------------------------------------------- gauge */

.gauge {
  flex: none;
  height: 76px;
  width: 44px;
}

.gauge-hero {
  height: 140px;
  width: 81px;
}

.gauge-track {
  fill: var(--surface-2);
}

@media (prefers-color-scheme: dark) {
  .gauge-track {
    fill: color-mix(in srgb, var(--surface-2) 60%, var(--bg));
  }
}

.zone-card.bg-dry .gauge-track,
.zone-card.bg-water .gauge-track {
  fill: color-mix(in srgb, var(--surface) 65%, transparent);
}

.gauge-fill {
  fill: var(--s-fill);
}

.gauge-fill.is-watering {
  animation: wave-slide 4.8s linear infinite;
}

@keyframes wave-slide {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-32px);
  }
}

.gauge-tick {
  fill: var(--s-fill);
  opacity: 0.7;
}

.gauge-noread {
  color: var(--s-fill);
}

/* ---------------------------------------------------------------- zone detail */

.zone-hero {
  align-items: center;
  display: flex;
  gap: 20px;
  justify-content: center;
  padding: 10px 4px 6px;
}

.hero-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hero-info .chip {
  align-self: flex-start;
}

.threshold-preview {
  align-items: center;
  display: flex;
  gap: 14px;
  padding: 10px 16px 0;
}

.threshold-preview .group-foot {
  margin: 0;
  padding: 0;
}

/* ---------------------------------------------------------------- groups & rows */

.group-block {
  margin-top: 22px;
}

.group-heading {
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 16px;
  margin: 0 0 8px;
  padding: 0 16px;
  text-transform: uppercase;
}

.day-heading {
  margin: 22px 0 10px;
  padding: 0;
}

.group {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-card), var(--card-edge);
  overflow: hidden;
}

.group-foot {
  color: var(--text-2);
  font-size: 13px;
  line-height: 18px;
  margin: 8px 0 0;
  padding: 0 16px;
}

.row {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 48px;
  padding: 6px 16px;
  position: relative;
}

.row + .row::before,
.row + .row-details::before,
.row-details + .row::before,
details.row-details .row::before {
  border-top: 1px solid var(--hairline);
  content: "";
  left: 16px;
  position: absolute;
  right: 0;
  top: 0;
}

.row-label {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  font-size: 15px;
  gap: 8px;
  line-height: 20px;
}

.row-value {
  color: var(--text-2);
  font-size: 15px;
  line-height: 20px;
  overflow-wrap: anywhere;
  text-align: right;
}

.row.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.row-input input,
.row-input select,
.row-details .row-input input {
  background: transparent;
  border: 0;
  color: var(--text-2);
  flex: 1;
  font-size: 16px;
  min-width: 0;
  padding: 8px 0;
  text-align: right;
}

.row select {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--text-2);
  direction: rtl;
  font-size: 16px;
  padding: 8px 0;
}

.row-action {
  color: var(--accent-text);
  font-size: 15px;
  font-weight: 500;
  justify-content: flex-start;
  text-align: left;
  width: 100%;
}

.row-action .row-label {
  color: inherit;
}

.row-action:disabled {
  color: var(--text-3);
}

.row-action .chev-row {
  margin-left: auto;
}

.row-destructive {
  color: var(--dry-text);
}

.row-buttons {
  gap: 10px;
  padding-bottom: 12px;
  padding-top: 12px;
}

.row-tall {
  align-items: flex-start;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 14px;
  padding-top: 12px;
}

.row-details {
  display: block;
}

.row-details summary {
  cursor: pointer;
  list-style: none;
}

.row-details summary::-webkit-details-marker {
  display: none;
}

.status-dot {
  background: var(--s-fill);
  border-radius: 999px;
  display: inline-block;
  flex: none;
  height: 8px;
  width: 8px;
}

.status-dot.s-ok { background: var(--ok-fill); }
.status-dot.s-watch { background: var(--watch-fill); }
.status-dot.s-dry { background: var(--dry-fill); }
.status-dot.s-off { background: var(--offline-fill); }

.live-dot {
  animation: pulse-dot 2s ease-in-out infinite;
  background: var(--ok-fill);
  border-radius: 999px;
  display: inline-block;
  height: 6px;
  margin-left: 6px;
  width: 6px;
}

.update-dot {
  background: var(--accent);
  border-radius: 999px;
  display: inline-block;
  flex: none;
  height: 6px;
  margin-right: 8px;
  width: 6px;
}

/* steppers */
.stepper {
  align-items: center;
  display: inline-flex;
  gap: 2px;
}

.step-btn {
  align-items: center;
  background: var(--surface-2);
  border-radius: 10px;
  color: var(--text);
  display: inline-flex;
  font-size: 20px;
  font-weight: 500;
  height: 36px;
  justify-content: center;
  line-height: 1;
  width: 40px;
}

.step-btn:disabled {
  color: var(--text-3);
}

.step-value {
  display: inline-block;
  font-size: 15px;
  font-weight: 500;
  min-width: 56px;
  text-align: center;
}

/* switch */
.switch {
  background: color-mix(in srgb, var(--text-3) 42%, var(--surface-2));
  border-radius: 999px;
  flex: none;
  height: 31px;
  padding: 2px;
  position: relative;
  transition: background-color 200ms linear;
  width: 51px;
}

.switch .knob {
  background: #fff;
  border-radius: 999px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  display: block;
  height: 27px;
  transition: transform 200ms var(--ease-out);
  width: 27px;
}

.switch.is-on {
  background: var(--ok-fill);
}

.switch.is-on .knob {
  transform: translateX(20px);
}

.switch:disabled {
  opacity: 0.4;
}

.switch:not(:disabled):active {
  transform: none;
}

/* duration chips */
.chips-row {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
}

.dur-chip {
  background: var(--surface-2);
  border-radius: 12px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  min-height: 44px;
  transition: background-color 200ms linear, color 200ms linear;
}

.dur-chip.is-active {
  background: var(--watering-fill);
  color: #fff;
}

.dur-chip:disabled {
  color: var(--text-3);
}

/* secondary buttons (calibration capture) */
.btn-secondary {
  align-items: center;
  background: var(--surface-2);
  border-radius: 12px;
  color: var(--accent-text);
  display: inline-flex;
  flex: 1;
  flex-direction: column;
  font-size: 15px;
  font-weight: 600;
  gap: 2px;
  justify-content: center;
  min-height: 54px;
  padding: 8px 10px;
}

.btn-secondary small {
  color: var(--text-3);
  font-size: 12px;
  font-weight: 400;
}

.btn-secondary:disabled {
  color: var(--text-3);
}

.btn-primary {
  align-items: center;
  background: var(--accent);
  border-radius: 14px;
  color: var(--accent-ink);
  display: inline-flex;
  font-size: 15px;
  font-weight: 600;
  justify-content: center;
  min-height: 50px;
  padding: 0 20px;
}

.btn-primary:disabled {
  opacity: 0.55;
}

.link-btn {
  color: var(--accent-text);
  font-size: inherit;
  font-weight: 500;
  min-height: 32px;
}

/* household + invites + demo */
.welcome-invite {
  background: var(--ok-tint);
  border-radius: 12px;
  color: var(--ok-text);
  font-size: 14px;
  font-weight: 500;
  line-height: 19px;
  margin: 0 0 20px;
  max-width: 320px;
  padding: 10px 14px;
}

.welcome-demo {
  color: var(--accent-text);
  margin-top: 18px;
  min-height: 44px;
}

.demo-pill {
  --s-fill: var(--accent);
  --s-text: var(--accent-text);
  --s-tint: color-mix(in srgb, var(--accent) 14%, var(--surface));
  gap: 5px;
}

.invite-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.invite-expiry {
  color: var(--text-2);
  font-size: 12px;
  font-weight: 400;
}

.invite-actions {
  align-items: center;
  display: inline-flex;
  flex: none;
  gap: 14px;
}

/* household */
.member-email {
  min-width: 0;
  overflow-wrap: anywhere;
}

.member-you {
  background: var(--ok-tint);
  border-radius: 999px;
  color: var(--ok-text);
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
  padding: 2px 8px;
}

.member-remove {
  color: var(--dry-text);
  flex: none;
}

.row-add-member {
  gap: 10px;
}

.row-add-member input {
  background: transparent;
  border: 0;
  color: var(--text);
  flex: 1;
  font-size: 16px;
  min-width: 0;
  padding: 8px 0;
}

.row-add-member input::placeholder {
  color: var(--text-3);
}

.row-add-member .link-btn {
  flex: none;
}

/* ---------------------------------------------------------------- activity */

.event-row {
  align-items: center;
  display: flex;
  gap: 12px;
  padding: 7px 0;
}

.group .event-row {
  min-height: 48px;
  padding: 6px 16px;
  position: relative;
}

.group .event-row + .event-row::before {
  border-top: 1px solid var(--hairline);
  content: "";
  left: 16px;
  position: absolute;
  right: 0;
  top: 0;
}

.icon-disc {
  align-items: center;
  background: var(--s-tint);
  border-radius: 999px;
  color: var(--s-text);
  display: inline-flex;
  flex: none;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.icon-disc .icon {
  height: 16px;
  stroke-width: 2;
  width: 16px;
}

.event-title {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  line-height: 20px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.event-row time {
  color: var(--text-2);
  flex: none;
  font-size: 12px;
}

.empty-state {
  align-items: center;
  color: var(--text-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 80px 20px;
  text-align: center;
}

.empty-icon {
  color: var(--text-3);
  height: 36px;
  width: 36px;
}

.empty-state p {
  margin: 0;
}

/* ---------------------------------------------------------------- inspector */

.json-well {
  background: var(--surface-2);
  border-radius: 12px;
  box-shadow: var(--card-edge);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
}

.json-well pre {
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 17px;
  margin: 0;
}

.j-key {
  color: var(--watering-text);
}

/* ---------------------------------------------------------------- tab bar */

.tab-bar {
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-top: 1px solid var(--hairline);
  bottom: 0;
  left: 0;
  padding-bottom: env(safe-area-inset-bottom);
  position: fixed;
  right: 0;
  z-index: 40;
}

@supports not ((backdrop-filter: blur(20px)) or (-webkit-backdrop-filter: blur(20px))) {
  .tab-bar {
    background: var(--bg);
  }
}

.tab-bar-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0 auto;
  max-width: 640px;
}

.tab-item {
  align-items: center;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: var(--nav-height);
  padding-top: 7px;
}

.tab-item.is-active {
  color: var(--accent-text);
}

.tab-item.is-active .icon {
  stroke-width: 2.1;
}

.tab-icon {
  position: relative;
}

.badge-dot {
  border-radius: 999px;
  height: 6px;
  position: absolute;
  right: -3px;
  top: -1px;
  width: 6px;
}

.badge-dot.s-dry {
  background: var(--dry-fill);
}

.badge-dot.s-accent {
  background: var(--accent);
}

.tab-label {
  font-size: 10px;
  font-weight: 500;
  line-height: 12px;
}

/* ---------------------------------------------------------------- toasts, banners, save bar */

#banner-root {
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 12px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  left: 16px;
  margin: 0 auto;
  max-width: 608px;
  position: fixed;
  right: 16px;
  z-index: 45;
}

body:not(.has-nav) #banner-root {
  bottom: calc(env(safe-area-inset-bottom) + 16px);
}

.toast {
  animation: rise-in 260ms var(--ease-out);
  border-radius: 14px;
  box-shadow: var(--shadow-card), var(--card-edge);
  font-size: 14px;
  line-height: 19px;
  padding: 12px 16px;
}

.toast-error {
  background: var(--dry-tint);
  color: var(--dry-text);
  cursor: pointer;
}

.toast-notice {
  background: var(--surface);
  color: var(--text);
}

.update-pill {
  align-self: center;
  animation: rise-in 260ms var(--ease-out);
  background: var(--surface);
  border-radius: 999px;
  box-shadow: var(--shadow-card), var(--card-edge);
  color: var(--accent-text);
  font-size: 13px;
  font-weight: 600;
  min-height: 40px;
  padding: 0 18px;
}

.save-bar {
  align-items: center;
  animation: rise-in 260ms var(--ease-out);
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-sheet), var(--card-edge);
  display: flex;
  gap: 8px;
  padding: 10px;
}

.save-bar .btn-primary {
  flex: 1;
}

.save-bar .link-btn {
  min-height: 50px;
  padding: 0 14px;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------------------------------------------------------------- sheet */

.scrim {
  animation: scrim-in 340ms var(--ease-out);
  background: rgba(20, 22, 15, 0.4);
  inset: 0;
  position: fixed;
  z-index: 50;
}

@keyframes scrim-in {
  from {
    opacity: 0;
  }
}

.sheet {
  animation: sheet-in 340ms var(--ease-spring);
  background: var(--surface);
  border-radius: 28px 28px 0 0;
  bottom: 0;
  box-shadow: var(--shadow-sheet);
  left: 0;
  margin: 0 auto;
  max-width: 640px;
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
  position: fixed;
  right: 0;
  touch-action: none;
  z-index: 55;
}

@keyframes sheet-in {
  from {
    transform: translateY(100%);
  }
}

.scrim.is-closing {
  animation: scrim-out 240ms var(--ease-out) forwards;
}

.sheet.is-closing {
  animation: sheet-out 240ms var(--ease-out) forwards;
}

@keyframes scrim-out {
  to {
    opacity: 0;
  }
}

@keyframes sheet-out {
  to {
    transform: translateY(105%);
  }
}

.grabber {
  background: var(--hairline);
  border-radius: 999px;
  display: block;
  height: 5px;
  margin: 4px auto 14px;
  width: 36px;
}

.sheet-title {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.sheet-title h3 {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  min-width: 0;
}

.sheet-title-meta {
  color: var(--text-2);
  font-size: 13px;
}

.sheet-caption {
  color: var(--text-2);
  font-size: 13px;
  line-height: 18px;
  margin: 10px 2px 16px;
}

.sheet-interlock {
  align-items: center;
  background: var(--watch-tint);
  border-radius: 14px;
  color: var(--watch-text);
  display: flex;
  font-size: 14px;
  gap: 10px;
  line-height: 19px;
  min-height: 50px;
  padding: 12px 16px;
}

.sheet-interlock .icon {
  flex: none;
}

.btn-water-confirm {
  background: var(--watering-fill);
  color: #fff;
  width: 100%;
}

.sheet-stepper {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: center;
}

.step-big {
  border-radius: 12px;
  font-size: 24px;
  height: 44px;
  width: 56px;
}

.step-value-big {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 650;
  min-width: 84px;
  text-align: center;
}

.sheet-progress {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 0 4px;
}

.sheet-progress .btn-primary {
  width: 100%;
}

.sheet-progress-label {
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  margin: 0;
  text-align: center;
}

/* the pour scene: a watering can tips over the zone's own plant */
.pour-scene {
  height: 118px;
  position: relative;
  width: 168px;
}

/* the can itself is shared between the sheet scene and the card/hero overlay;
   each context sets its own size and resting spot */
.watering-can {
  display: block;
  position: absolute;
  transform-origin: 58% 66%;
}

.pour-scene .watering-can {
  left: 36px;
  top: 2px;
  transition: transform 500ms var(--ease-spring);
  width: 64px;
}

.can-svg {
  display: block;
  height: auto;
  overflow: visible;
  width: 100%;
}

/* while the command is in flight the can hovers upright; when the pump
   confirms it tips over and settles into a gentle bob */
.pour-scene:not(.is-pouring) .watering-can {
  animation: can-hover 2.4s ease-in-out infinite;
}

@keyframes can-hover {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

.pour-scene.is-pouring .watering-can {
  animation: can-tip 600ms var(--ease-spring) both, can-bob 2.4s ease-in-out 600ms infinite;
}

@keyframes can-tip {
  0% {
    transform: rotate(-3deg) translateY(-2px);
  }
  100% {
    transform: rotate(16deg) translateY(0);
  }
}

@keyframes can-bob {
  0%,
  100% {
    transform: rotate(16deg) translateY(0);
  }
  50% {
    transform: rotate(20deg) translateY(-2px);
  }
}

.pour-plant {
  bottom: 0;
  position: absolute;
  right: 6px;
}

.pour-drops {
  height: 62px;
  left: 82px;
  pointer-events: none;
  position: absolute;
  top: 26px;
  width: 48px;
}

/* one drop recipe for both scenes; --drop-dx/--drop-dy set the travel */
.pour-drops i,
.rain i {
  background: var(--watering-fill);
  border-radius: 42% 42% 58% 58%;
  box-shadow: 0 0 8px color-mix(in srgb, var(--watering-fill) 50%, transparent);
  display: block;
  opacity: 0;
  position: absolute;
}

.pour-drops i {
  --drop-dx: 10px;
  --drop-dy: 46px;
  height: 11px;
  left: 18px;
  top: 0;
  width: 7px;
}

/* the stream holds back until the can has mostly tipped */
.pour-scene.is-pouring .pour-drops {
  animation: fade-in 300ms ease 450ms both;
}

.pour-scene.is-pouring .pour-drops i {
  animation: drop-fall 0.85s linear infinite;
}

.pour-scene.is-pouring .pour-drops i:nth-child(2) {
  animation-delay: -0.28s;
  left: 6px;
  top: 2px;
}

.pour-scene.is-pouring .pour-drops i:nth-child(3) {
  animation-delay: -0.57s;
  left: 30px;
  top: 4px;
}

.pour-scene.is-pouring .pour-drops i:nth-child(4) {
  animation-delay: -0.14s;
  left: 40px;
  top: 8px;
}

.pour-scene.is-pouring .pour-drops i:nth-child(5) {
  animation-delay: -0.72s;
  left: 14px;
  top: 6px;
}

/* drops leave the rose with a little sideways momentum, then mostly fall */
@keyframes drop-fall {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(0.78);
  }
  13% {
    opacity: 1;
  }
  55% {
    transform: translate(calc(var(--drop-dx) * 0.7), calc(var(--drop-dy) * 0.52)) scale(1);
  }
  87% {
    opacity: 0.92;
  }
  100% {
    opacity: 0;
    transform: translate(var(--drop-dx), var(--drop-dy)) scale(1.06);
  }
}

.pour-puddle {
  background: var(--watering-fill);
  border-radius: 999px;
  bottom: -2px;
  height: 7px;
  opacity: 0;
  position: absolute;
  right: 22px;
  transition: opacity 600ms linear, width 600ms var(--ease-out);
  width: 36px;
}

.pour-scene.is-pouring .pour-puddle {
  animation: puddle-grow 2.6s ease-in-out infinite;
  opacity: 0.35;
}

/* the finished scene: the plant keeps its puddle and a check pops in where
   the can was, so the sheet's height doesn't jump when the pour ends */
.pour-scene.is-done .pour-puddle {
  opacity: 0.3;
}

.done-check {
  align-items: center;
  background: var(--ok-tint);
  border-radius: 999px;
  color: var(--ok-text);
  display: flex;
  height: 46px;
  justify-content: center;
  left: 40px;
  position: absolute;
  top: 16px;
  width: 46px;
  animation: check-pop 420ms var(--ease-spring) both;
}

.done-check svg {
  height: 24px;
  width: 24px;
}

@keyframes check-pop {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes puddle-grow {
  0%,
  100% {
    transform: scaleX(0.85);
  }
  50% {
    transform: scaleX(1.15);
  }
}

/* the can-and-drops overlay over the card/hero plant while its pump runs */
.plant-slot,
.hero-plant {
  position: relative;
}

.water-anim {
  bottom: 0;
  left: -8px;
  pointer-events: none;
  position: absolute;
  right: -8px;
  top: -18px;
  z-index: 1;
  animation: fade-in 320ms ease both;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* the overlay can is sized as a share of the slot so it scales with the
   operator's small/medium/large plant setting */
.water-anim .watering-can {
  left: -13%;
  top: 0;
  transform: rotate(18deg);
  width: 52%;
  animation: can-bob 2.2s ease-in-out infinite;
}

.hero-plant .watering-can {
  top: -18px;
}

.rain {
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.rain i {
  --drop-dx: 6px;
  --drop-dy: 82px;
  height: 10px;
  width: 6px;
  animation: drop-fall 0.78s linear infinite;
}

.water-anim.size-small .rain i {
  --drop-dy: 58px;
}

/* drops fan out from the rose at the upper left: the further from the can,
   the lower the stream starts */
.rain i:nth-child(1) {
  animation-delay: -0.05s;
  left: 12%;
  top: 0;
}

.rain i:nth-child(2) {
  animation-delay: -0.28s;
  left: 28%;
  top: 4px;
}

.rain i:nth-child(3) {
  animation-delay: -0.5s;
  left: 44%;
  top: 8px;
}

.rain i:nth-child(4) {
  animation-delay: -0.16s;
  left: 58%;
  top: 12px;
}

.rain i:nth-child(5) {
  animation-delay: -0.42s;
  left: 72%;
  top: 16px;
}

.rain i:nth-child(6) {
  animation-delay: -0.66s;
  left: 84%;
  top: 20px;
}

.rain i:nth-child(7) {
  animation-delay: -0.36s;
  left: 96%;
  top: 24px;
}

@media (prefers-reduced-motion: reduce) {
  .btn-water.is-counting {
    animation: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--watering-fill) 22%, transparent);
  }

  .pour-scene .watering-can,
  .pour-scene.is-pouring .pour-drops,
  .pour-scene.is-pouring .pour-drops i,
  .pour-scene.is-pouring .pour-puddle,
  .water-anim .watering-can,
  .rain i,
  .sheet-state.state-enter,
  .done-check {
    animation: none;
  }

  .pour-scene.is-pouring .watering-can {
    transform: rotate(16deg);
  }

  .pour-scene.is-pouring .pour-drops i,
  .rain i {
    opacity: 0.85;
    transform: translate(calc(var(--drop-dx) * 0.5), calc(var(--drop-dy) * 0.6));
  }
}

body.sheet-open {
  overflow: hidden;
}

/* phase changes cross-fade the sheet body instead of re-sliding the sheet */
.sheet-state.state-enter {
  animation: state-in 260ms var(--ease-out) both;
}

@keyframes state-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------------------------------------------------------------- welcome */

.welcome {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100dvh - env(safe-area-inset-top) - 80px);
  padding: 24px 8px;
  text-align: center;
}

.welcome-art {
  margin-bottom: 18px;
  width: min(240px, 60vw);
}

.welcome-art svg {
  display: block;
  height: auto;
  width: 100%;
}

.welcome-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 34px;
  margin: 0 0 6px;
}

.welcome-sub {
  color: var(--text-2);
  font-size: 15px;
  margin: 0 0 32px;
}

.welcome-error {
  background: var(--dry-tint);
  border-radius: 12px;
  color: var(--dry-text);
  font-size: 13px;
  line-height: 18px;
  margin: 0 0 20px;
  max-width: 320px;
  padding: 10px 14px;
}

.btn-apple {
  align-items: center;
  background: #000;
  border-radius: 14px;
  color: #fff;
  display: inline-flex;
  font-size: 15px;
  font-weight: 600;
  gap: 8px;
  justify-content: center;
  min-height: 50px;
  padding: 0 24px;
  width: min(320px, 100%);
}

.btn-apple .icon {
  height: 20px;
  vertical-align: -4px;
  width: 20px;
}

@media (prefers-color-scheme: dark) {
  .btn-apple {
    background: #fff;
    color: #000;
  }
}

.welcome-foot {
  color: var(--text-3);
  font-size: 12px;
  margin: 28px 0 0;
}

/* ---------------------------------------------------------------- skeleton */

.skeleton-card {
  animation: shimmer 1.4s ease-in-out infinite;
  background: linear-gradient(100deg, var(--surface), var(--surface-2), var(--surface));
  background-size: 220% 100%;
  border-radius: 20px 20px 20px 6px;
  min-height: 108px;
}

@keyframes shimmer {
  0% {
    background-position: 110% 0;
  }
  100% {
    background-position: -110% 0;
  }
}

/* ---------------------------------------------------------------- view transitions */

.view-enter > * {
  animation: view-in 220ms var(--ease-out);
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
}

/* ---------------------------------------------------------------- reduced motion */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 80ms !important;
  }
}
