/* CropPlan 2.0 for the web */

:root {
  --bg: #f6f1e7;
  --surface: #fffdf9;
  --surface-2: #f3eee2;
  --line: #ebe3d3;
  --line-strong: #dcd2bf;
  --text: #1d2a1e;
  --text-2: #4b5547;
  --muted: #7d8376;

  --green: #40b465;        /* logo background */
  --green-hover: #369e58;
  --green-strong: #1b7f45; /* same hue, dark enough for text on light backgrounds */
  --green-soft: #e3f4e8;
  --green-bright: #86d8a0;
  --orange: #e17a32;
  --orange-soft: #fdead8;
  --red: #c8432f;
  --red-soft: #fbe3dd;
  --blue: #3a7fb0;
  --blue-soft: #e1eef6;
  --yellow: #b8860b;
  --yellow-soft: #faf0cd;
  --pink-soft: #fae4eb;
  --violet-soft: #ece6f7;
  --dark: #4a4f5c;
  --dark-soft: #e7e6ec;

  --t-soak: #4b97cc;
  --t-seed: #40b465;
  --t-light: #e3b52b;
  --t-harvest: #e17a32;

  --radius: 22px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --shadow: 0 1px 2px rgba(52, 60, 34, 0.05), 0 6px 22px -10px rgba(52, 60, 34, 0.16);
  --shadow-lg: 0 18px 44px -18px rgba(52, 60, 34, 0.35);
  --font: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
img { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--green) 45%, transparent); outline-offset: 2px; border-radius: 8px; }
.i { width: 20px; height: 20px; flex: none; }
.muted { color: var(--muted); font-weight: 500; }
.quiet { color: var(--muted); padding: 6px 2px 2px; }
.center { text-align: center; }
.prewrap { white-space: pre-wrap; color: var(--text-2); }
.noscript { padding: 24px; text-align: center; }

/* ---------- Layout ---------- */

.shell { min-height: 100vh; }
.sidebar { display: none; }
.main {
  max-width: 1160px;
  margin: 0 auto;
  padding: 16px 16px calc(112px + var(--safe-b));
  outline: none;
}
.dash-grid, .detail-grid, .form-grid, .cal-layout { display: grid; gap: 16px; align-items: start; }
.dash-col { display: grid; gap: 16px; min-width: 0; }

@media (min-width: 760px) {
  .main { padding: 24px 24px calc(120px + var(--safe-b)); }
  .dash-grid, .detail-grid, .form-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; }
  .cal-layout { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; }
  .form-grid.wide-right { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.25fr); }
  .dash-col { gap: 20px; }
}

@media (min-width: 1000px) {
  .shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); }
  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px 20px;
    background: var(--surface);
    border-right: 1px solid var(--line);
  }
  .main { width: 100%; padding: 32px 40px 56px; }
  .tabbar { display: none !important; }
}

/* Sidebar */
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 6px; }
.brand img { filter: drop-shadow(0 2px 6px rgba(30, 70, 35, .22)); }
.brand strong { display: block; font-size: 19px; letter-spacing: -0.02em; color: var(--green-strong); }
.brand small { display: block; font-size: 12px; color: var(--muted); }
.side-nav { display: grid; gap: 4px; }
.side-nav .nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 14px;
  font-weight: 600; color: var(--text-2);
  transition: background .15s, color .15s;
}
.side-nav .nav-link:hover { background: var(--surface-2); }
.side-nav .nav-link.is-active { background: var(--green-soft); color: var(--green-strong); }
.side-foot { margin-top: auto; display: grid; gap: 10px; }
.side-foot > p { padding: 0 8px; font-size: 12px; color: var(--muted); }
.side-foot .side-level { margin-top: 0; }
.side-sync { display: block; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.side-sync:hover { background: var(--green-soft); }

/* Bottom tab bar */
.tabbar {
  position: fixed; z-index: 30;
  left: 12px; right: 12px; bottom: calc(10px + var(--safe-b));
  max-width: 520px; margin: 0 auto;
  height: 66px;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: rgba(255, 253, 249, 0.9);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
}
.tabbar .nav-link {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0; font-size: 11px; font-weight: 600; color: var(--muted);
}
.tabbar .nav-link .i { width: 22px; height: 22px; }
.tabbar .nav-link.is-active { color: var(--green-strong); }
.tabbar .nav-link.is-active .i { color: var(--green); }
.tab-add {
  justify-self: center;
  width: 54px; height: 54px; border-radius: 19px; border: 0;
  background: var(--green); color: #fff;
  display: grid; place-items: center;
  transform: translateY(-14px);
  box-shadow: 0 10px 22px -8px rgba(64, 180, 101, 0.65);
  transition: transform .15s;
}
.tab-add:active { transform: translateY(-12px) scale(.96); }
.tab-add .i { width: 26px; height: 26px; }

/* ---------- Primitives ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  min-width: 0;
}
:where(a.card) { display: block; }
a.card { transition: transform .15s, box-shadow .15s; }
a.card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(52,60,34,.05), 0 14px 30px -14px rgba(52,60,34,.28); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2, .section-head h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.card-head h2 .i { color: var(--green); }
.card-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.card-head + .card-sub { margin: -6px 0 14px; }
.section { display: grid; gap: 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 2px; }
.card-warn { border-color: #f1c9bf; background: #fffaf8; }
.card-warn h2 .i { color: var(--red); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px;
  border-radius: 14px; border: 1px solid transparent;
  font-weight: 700; font-size: 14.5px; white-space: nowrap;
  transition: background .15s, transform .1s, border-color .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-hover); }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger-text { color: var(--red); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 14px; font-size: 14px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-stack { display: grid; gap: 10px; }
.btn-stack .btn { justify-content: flex-start; }
.link-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: 0; padding: 6px 2px;
  color: var(--green-strong); font-weight: 700; font-size: 14px;
}
.link-btn .i { width: 18px; height: 18px; }
.icon-btn {
  width: 42px; height: 42px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow);
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.chip .i { width: 14px; height: 14px; }
.chip-sm { padding: 2px 8px; font-size: 11.5px; }
.chip-green { background: var(--green-soft); color: var(--green-strong); }
.chip-orange { background: var(--orange-soft); color: #a34d12; }
.chip-red { background: var(--red-soft); color: var(--red); }
.chip-blue { background: var(--blue-soft); color: #245f88; }
.chip-dark { background: var(--dark-soft); color: var(--dark); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.crop-tile {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: 14px; background: var(--tint, var(--green-soft));
}
.crop-tile .crop-svg { width: 72%; height: 72%; }
.crop-tile.sm { width: 34px; height: 34px; border-radius: 11px; }
.crop-tile.lg { width: 54px; height: 54px; border-radius: 17px; }
.crop-svg { display: block; flex: none; }
.crop-svg.inline { display: inline-block; width: 1.25em; height: 1.25em; vertical-align: -0.28em; margin-right: 4px; }
.with-ico { display: inline-flex; align-items: center; gap: 6px; }
.with-ico .i { width: 1.15em; height: 1.15em; }
.quiet.with-ico { display: flex; }
.quiet.with-ico .i { color: var(--yellow); }

.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green-bright), var(--green)); }
.progress.today span { background: linear-gradient(90deg, #f6b26b, var(--orange)); }
.progress.overdue span { background: linear-gradient(90deg, #ef8b78, var(--red)); }
.progress.big { height: 12px; }

.type-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.t-soak { --c: var(--t-soak); }
.t-seed { --c: var(--t-seed); }
.t-light { --c: var(--t-light); }
.t-harvest { --c: var(--t-harvest); }
.type-dot { background: var(--c); }

/* Forms */
.field { display: grid; gap: 6px; margin: 0 0 16px; border: 0; padding: 0; min-width: 0; }
.field:last-child { margin-bottom: 0; }
.field-label { font-weight: 700; font-size: 14px; }
.field-hint { display: block; font-size: 12.5px; color: var(--muted); margin-top: -2px; }
.field-error { font-size: 12.5px; color: var(--red); font-weight: 600; }
.field-error:empty { display: none; }
input[type='text'], input[type='email'], input[type='password'], input[type='tel'], input[type='url'], input[type='date'], input[type='search'], input[type='number'], textarea {
  width: 100%; min-height: 48px; padding: 11px 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
input[type='date'] { display: flex; align-items: center; }
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
input:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 14%, transparent); }
input[aria-invalid], textarea[aria-invalid] { border-color: var(--red); }
::placeholder { color: #a9ab9f; }
input[type='number'] { -moz-appearance: textfield; }
input[type='number']::-webkit-inner-spin-button, input[type='number']::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.stepper {
  display: inline-flex; align-items: center; flex: none;
  border: 1.5px solid var(--line-strong); border-radius: 13px; background: #fff; overflow: hidden;
}
.stepper button { width: 36px; height: 38px; border: 0; background: none; display: grid; place-items: center; color: var(--green); }
.stepper button:hover { background: var(--surface-2); }
.stepper button .i { width: 18px; height: 18px; }
.stepper input[type='number'] { width: 44px; min-height: 38px; padding: 0; border: 0; border-radius: 0; text-align: center; font-weight: 700; background: none; }
.stepper input[type='number']:focus { box-shadow: none; background: var(--green-soft); }
.stepper-lg { width: 100%; justify-content: space-between; }
.stepper-lg button { width: 48px; height: 48px; }
.stepper-lg input[type='number'] { flex: 1; min-height: 48px; font-size: 17px; }
.stepper:focus-within { border-color: var(--green); }
.stepper:has(input[aria-invalid]) { border-color: var(--red); }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 0 16px; }
.switch-row .field-label { display: block; }
.switch { position: relative; flex: none; width: 52px; height: 32px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: background .2s; }
.switch span::after {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 26px; height: 26px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s;
}
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--green) 45%, transparent); outline-offset: 2px; }
.switch input:disabled + span { opacity: .5; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 14px; }
.seg button { min-height: 40px; border: 0; border-radius: 11px; background: none; font-weight: 600; color: var(--text-2); }
.seg button[aria-checked='true'] { background: var(--surface); color: var(--green-strong); box-shadow: var(--shadow); }

.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.form-actions .spacer { flex: 1; }
.num-grid { display: grid; gap: 0 16px; }
@media (min-width: 520px) {
  .num-grid { grid-template-columns: 1fr 1fr; }
  .num-grid .field { display: flex; flex-direction: column; margin-bottom: 16px; }
  .num-grid .stepper { margin-top: auto; }
}

.search { position: relative; display: block; margin-bottom: 16px; }
.search .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 44px; background: var(--surface); }

/* Page header */
.page-head { display: flex; align-items: center; gap: 14px; margin: 4px 0 20px; }
.page-head-text { flex: 1; min-width: 0; }
.page-head h1 { font-size: clamp(22px, 4vw, 28px); font-weight: 800; letter-spacing: -0.025em; line-height: 1.15; overflow-wrap: anywhere; }
.page-head p { color: var(--muted); font-size: 14px; margin-top: 3px; }
.page-head-actions { display: flex; gap: 8px; }
@media (max-width: 480px) { .hide-xs { display: none; } .btn-sm:has(.hide-xs) { padding: 0 11px; } }

/* ---------- Dashboard ---------- */

.hero {
  position: relative; overflow: hidden;
  height: 290px; border-radius: 28px;
  background: #dcebe0;
  box-shadow: var(--shadow);
}
.hero-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-top { position: relative; display: flex; align-items: center; gap: 12px; padding: 18px; }
.avatar { width: 52px; height: 52px; flex: none; filter: drop-shadow(0 4px 10px rgba(30, 70, 35, .28)); }
.hero-text { flex: 1; min-width: 0; display: grid; }
.hero-greet { font-size: 13.5px; font-weight: 600; color: #3d6b4c; }
.hero-farm { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; color: var(--green-strong); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; line-height: 1.2; }
.hero-bell { background: rgba(255,255,255,.85); }
.dot-badge {
  position: absolute; top: -3px; right: -3px;
  min-width: 20px; height: 20px; padding: 0 5px;
  display: grid; place-items: center;
  border-radius: 99px; background: var(--orange); color: #fff;
  font-size: 11px; font-weight: 800; border: 2px solid #fff;
}
.hero-cards { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: -58px 12px 20px; }
.summary { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 20px; }
.summary-label { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.summary-value { display: block; font-size: 14.5px; line-height: 1.3; overflow-wrap: anywhere; }
.summary-ico { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 15px; background: var(--orange-soft); color: var(--orange); }
.ring-wrap { position: relative; flex: none; width: 52px; height: 52px; }
.ring-wrap .ring { width: 52px; height: 52px; }
.ring-wrap span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; color: var(--green-strong); }
.ring-track { fill: none; stroke: var(--green-soft); stroke-width: 7; }
.ring-bar { fill: none; stroke: var(--green); stroke-width: 7; stroke-linecap: round; transition: stroke-dasharray .6s ease; }

@media (max-width: 430px) {
  .hero { height: 270px; }
  .hero-top { padding: 14px; }
  .hero-farm { font-size: 20px; }
  .hero-cards { margin: -56px 8px 16px; gap: 10px; }
  .summary { flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; }
  .summary-value { font-size: 14px; }
}
@media (min-width: 760px) {
  .hero { height: 300px; }
  .hero-top { padding: 24px 26px; }
  .hero-farm { font-size: 26px; }
  .hero-cards { max-width: 640px; margin: -64px 24px 24px; }
}

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat { display: grid; gap: 2px; padding: 16px; }
.stat-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.stat-ico { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; }
.stat-ico.green { background: var(--green-soft); color: var(--green); }
.stat-ico.orange { background: var(--orange-soft); color: var(--orange); }
.stat-ico.blue { background: var(--blue-soft); color: var(--blue); }
.stat-ico.yellow { background: var(--yellow-soft); color: var(--yellow); }
.stat-chev { width: 28px; height: 28px; padding: 6px; border-radius: 50%; background: var(--surface-2); color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.stat-label { font-weight: 700; font-size: 14px; }
.stat-hint { font-size: 12px; color: var(--muted); }

/* Tasks */
.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.task { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 14px; }
.task:hover { background: var(--surface-2); }
.check {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  border: 2px solid var(--line-strong); background: #fff;
  display: grid; place-items: center; color: transparent;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
}
.check .i { width: 17px; height: 17px; stroke-width: 2.6; }
.check:hover { border-color: var(--green); color: color-mix(in srgb, var(--green) 40%, transparent); }
.check:active { transform: scale(.9); }
.task.is-done .check { background: var(--green); border-color: var(--green); color: #fff; }
.task-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.task-ico {
  width: 38px; height: 38px; flex: none; display: grid; place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--c);
}
.task-ico .crop-svg { width: 26px; height: 26px; }
.task-text { min-width: 0; display: grid; }
.task-title { font-weight: 700; font-size: 14.5px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere; }
.task-meta { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.task-meta .type-dot { width: 7px; height: 7px; }
.task.is-done .task-title { text-decoration: line-through; text-decoration-color: var(--line-strong); color: var(--muted); }
.task.is-done .task-ico { filter: grayscale(.6); opacity: .7; }
.more-link { display: block; margin-top: 8px; font-size: 13.5px; font-weight: 700; color: var(--red); }

.day-group + .day-group { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.day-label { font-size: 13px; color: var(--muted); margin: 0 4px 6px; }
.day-label strong { color: var(--text); font-weight: 700; }
.day-group.is-today .day-label strong { color: var(--green-strong); }
.day-group.is-past { opacity: .8; }

/* Plans */
.plan-list { display: grid; gap: 12px; }
.plan-card { display: grid; gap: 12px; padding: 16px; }
.plan-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.crop-stack { display: flex; flex: none; }
.crop-stack .crop-tile { border: 2px solid var(--surface); }
.crop-stack .crop-tile + .crop-tile { margin-left: -12px; }
.plan-card-title { display: grid; gap: 1px; margin-top: -2px; }
.plan-card-title strong { font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.plan-card-title span { font-size: 12.5px; color: var(--muted); }
.plan-card-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.toggle-harvested { justify-self: start; }

.plan-hero { display: grid; gap: 14px; }
.plan-hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.countdown { display: flex; align-items: baseline; gap: 10px; color: var(--text-2); font-weight: 600; }
.countdown-n .i { width: 40px; height: 40px; stroke-width: 2.4; }
.countdown-n { font-size: 46px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; color: var(--green-strong); }
.countdown.is-late .countdown-n { color: var(--red); }
.progress-labels { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: -6px; }
.progress-labels strong { color: var(--text); }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini-stats div { display: grid; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.mini-stats strong { font-size: 17px; font-weight: 800; }
.mini-stats span { font-size: 12px; color: var(--muted); }

.crop-list { display: grid; gap: 12px; }
.crop { display: grid; gap: 12px; padding: 16px; }
.crop-head { display: flex; align-items: center; gap: 12px; }
.crop-head > div { flex: 1; min-width: 0; display: grid; }
.crop-name { font-weight: 700; font-size: 15.5px; }
.crop-name:hover { color: var(--green-strong); }
.crop-sub { font-size: 12.5px; color: var(--muted); }
.crop-sub strong { color: var(--text-2); }
.qty { font-size: 18px; font-weight: 800; color: var(--green-strong); background: var(--green-soft); padding: 4px 12px; border-radius: 12px; }
.crop-notes { font-size: 13.5px; color: var(--text-2); background: var(--surface-2); padding: 10px 12px; border-radius: 12px; white-space: pre-wrap; }
.actions-card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 14px; }
.actions-card .btn { min-width: 0; padding: 6px 10px; white-space: normal; line-height: 1.2; text-align: center; }

/* Plan form: product picker */
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.pick {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: 16px;
  border: 1.5px solid var(--line); background: var(--surface);
  transition: border-color .15s, background .15s;
}
.pick.is-on { border-color: color-mix(in srgb, var(--green) 55%, transparent); background: #f4fbf6; }
.pick-text { flex: 1; min-width: 0; display: grid; }
.pick-name { font-weight: 700; font-size: 14.5px; line-height: 1.25; overflow-wrap: anywhere; }
.pick-meta { font-size: 12.5px; color: var(--muted); }
.pick-meta.is-warn { color: var(--red); font-weight: 600; }
.pick-meta.is-ok { color: var(--green-strong); font-weight: 600; }
.pick-summary { margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--text-2); }

/* Products */
.product-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.product { display: grid; gap: 14px; padding: 16px; }
.product-head { display: flex; align-items: center; gap: 14px; }
.product-head > div { flex: 1; min-width: 0; display: grid; }
.product-name { font-size: 16.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-used { font-size: 12.5px; color: var(--muted); }
.product-chev { color: var(--muted); }

.cycle-bar { display: flex; gap: 3px; height: 8px; border-radius: 99px; overflow: hidden; }
.cycle-bar span { min-width: 4px; }
.cycle-bar.big { height: 16px; border-radius: 8px; }
.seg-soak { background: var(--t-soak); }
.seg-dark { background: #4d5364; }
.seg-light { background: linear-gradient(90deg, #a6e0b8, var(--t-seed)); }
.cycle { display: grid; gap: 12px; }
.cycle-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--muted); }
.cycle-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cycle-legend i { width: 10px; height: 10px; border-radius: 3px; }
.cycle-legend strong { color: var(--text); }
.cycle-total { margin-left: auto; color: var(--orange) !important; }
.cycle-total .i { width: 16px; height: 16px; }

.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.icon-opt { position: relative; }
.icon-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.icon-opt span {
  display: grid; place-items: center; height: 44px; border-radius: 12px;
  border: 1.5px solid transparent; background: var(--surface-2);
  transition: border-color .15s, background .15s, transform .1s;
}
.icon-opt .crop-svg { width: 28px; height: 28px; }
.icon-opt input:checked + span { border-color: var(--green); background: var(--green-soft); transform: scale(1.05); }
.icon-opt input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--green) 45%, transparent); }

/* Calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-head h2 { font-size: 17px; font-weight: 800; }
.cal-head .icon-btn { box-shadow: none; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-wd { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 4px 0 6px; text-transform: capitalize; }
.cal-day {
  aspect-ratio: 1 / 1.05; min-height: 42px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 1.5px solid transparent; border-radius: 13px; background: none; padding: 0;
  font-weight: 600; font-size: 14px;
}
.cal-day:hover { background: var(--surface-2); }
.cal-day.is-out { color: #b8b9b0; }
.cal-day.is-today .cal-num { color: var(--green-strong); font-weight: 800; }
.cal-day.is-today { border-color: var(--green-soft); }
.cal-day.is-selected { background: var(--green); color: #fff; border-color: var(--green); }
.cal-day.is-selected .cal-num { color: #fff; }
.cal-day.is-selected .type-dot { box-shadow: 0 0 0 1.5px #fff; }
.cal-day.is-complete:not(.is-selected) .type-dot { opacity: .35; }
.cal-dots { display: flex; gap: 3px; height: 6px; }
.cal-dots .type-dot { width: 6px; height: 6px; }
.cal-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal .link-btn { display: flex; margin: 6px auto 0; }
.day-title { font-weight: 500 !important; }

/* Settings */
.about { display: flex; align-items: center; gap: 14px; }
.about img { filter: drop-shadow(0 2px 6px rgba(30, 70, 35, .22)); }
.about div { display: grid; }
.about span { font-size: 13px; color: var(--muted); }

/* Empty states */
.empty { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 18px 8px; }
.empty-ico { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 24px; background: var(--green-soft); color: var(--green); margin-bottom: 4px; }
.empty-ico .i { width: 34px; height: 34px; stroke-width: 1.7; }
.empty h3 { font-size: 17px; }
.empty p { color: var(--muted); max-width: 36ch; }
.empty .btn { margin-top: 8px; }

/* ---------- Overlays ---------- */

.toast {
  position: fixed; z-index: 60; left: 50%; bottom: calc(92px + var(--safe-b));
  display: flex; align-items: center; gap: 10px;
  max-width: calc(100vw - 32px); padding: 12px 18px;
  border-radius: 16px; background: #1f2b20; color: #fff;
  font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translate(-50%, 16px); pointer-events: none;
  transition: opacity .2s, transform .25s cubic-bezier(.2,.9,.3,1.2);
}
.toast .i { color: var(--green-bright); }
.toast[data-kind='error'] .i { color: #ff9c8a; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 1000px) { .toast { bottom: 32px; left: calc(50% + 132px); } }

.dialog {
  border: 0; padding: 0; background: none; color: var(--text);
  width: min(400px, calc(100vw - 32px)); max-width: none;
}
.dialog::backdrop { background: rgba(28, 36, 24, 0.45); backdrop-filter: blur(3px); }
.dialog[open] { animation: pop .2s cubic-bezier(.2,.9,.3,1.2); }
.dialog-body { background: var(--surface); border-radius: 26px; padding: 24px; box-shadow: var(--shadow-lg); text-align: center; }
.dialog-body h2 { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.dialog-body p { color: var(--text-2); }
.dialog-icon { width: 56px; height: 56px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 18px; background: var(--green-soft); color: var(--green); }
.dialog-icon.is-danger { background: var(--red-soft); color: var(--red); }
.dialog-icon .i { width: 26px; height: 26px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }

.sheet { width: min(520px, 100vw); margin: auto auto 0; }
.sheet[open] { animation: slide-up .25s cubic-bezier(.2,.9,.3,1); }
.sheet .dialog-body { border-radius: 28px 28px 0 0; padding: 10px 16px calc(16px + var(--safe-b)); text-align: left; }
.sheet-grip { width: 40px; height: 5px; border-radius: 9px; background: var(--line-strong); margin: 0 auto 12px; }
.sheet-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.sheet-item { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 18px; background: var(--surface-2); }
.sheet-item:hover { background: var(--green-soft); }
.sheet-item strong { display: block; }
.sheet-item small { display: block; color: var(--muted); font-size: 13px; }
.sheet-item > span:nth-child(2) { flex: 1; }
.sheet-ico { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 15px; background: var(--green); color: #fff; }
.sheet-chev { color: var(--muted); }

/* ---------- Motion ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@keyframes slide-up { from { transform: translateY(100%); } to { transform: none; } }
.main.animate .rise { animation: rise .45s cubic-bezier(.2,.8,.3,1) both; animation-delay: calc(min(var(--i, 0), 10) * 45ms); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ======================================================================
   Farm mode
   ====================================================================== */

/* Every looping animation is offset by --clock (seconds since page load),
   so re-renders continue the loop instead of restarting it. */
.farm-map { --clock: 0s; }

.home-bar { display: flex; justify-content: flex-end; margin: 0 0 14px; }
.mode-switch {
  display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow);
}
.mode-switch button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 14px; border: 0; border-radius: 12px; background: none;
  font-weight: 700; font-size: 13.5px; color: var(--text-2); white-space: nowrap;
  transition: background .2s, color .2s;
}
.mode-switch button .i { width: 18px; height: 18px; }
.mode-switch button:hover { background: var(--surface-2); }
.mode-switch button[aria-checked='true'] { background: var(--green); color: #fff; }
@media (max-width: 560px) {
  .home-bar .mode-switch, .farm-head .mode-switch { width: 100%; }
}

.farm-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 4px 0 14px; }
.farm-title h1 { font-size: clamp(24px, 4.4vw, 30px); font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; }
.farm-title p { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.farm-title p .i { width: 15px; height: 15px; }

.zone-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin: 0 -2px; scrollbar-width: none; }
.zone-chips::-webkit-scrollbar { display: none; }
.zone-chips button {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface);
  font-weight: 700; font-size: 13.5px; white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis;
  transition: background .2s, color .2s, border-color .2s;
}
.zone-chips button[aria-selected='true'] { background: #1f2a20; border-color: #1f2a20; color: #fff; }

.farm-layout { display: grid; gap: 18px; align-items: start; }
.farm-left { min-width: 0; }
.farm-panel { display: grid; gap: 16px; align-content: start; min-width: 0; }
@media (min-width: 1320px) {
  .farm-layout { grid-template-columns: minmax(0, 1.5fr) minmax(340px, 1fr); }
  .farm-panel { position: sticky; top: 24px; max-height: calc(100vh - 48px); overflow-y: auto; padding: 2px; margin: -2px; scrollbar-width: thin; }
}

/* Map */
.farm-map {
  position: relative; overflow: hidden; container-type: inline-size;
  border-radius: 28px; border: 4px solid #fff;
  background: #e3c99d;
  box-shadow: 0 1px 2px rgba(52,60,34,.06), 0 18px 40px -22px rgba(52,60,34,.45);
}
.farm-world {
  position: relative; transform-origin: 0 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: row dense; gap: 12px; padding: 12px;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.18) 0 2px, transparent 3px) 0 0 / 26px 26px,
    radial-gradient(circle at 70% 80%, rgba(150,110,60,.14) 0 2px, transparent 3px) 0 0 / 34px 34px,
    #e3c99d;
  transition: transform .75s cubic-bezier(.22, .8, .22, 1);
  will-change: transform;
}
@container (min-width: 540px) { .farm-world { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 14px; } }
@container (min-width: 820px) { .farm-world { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.farm-road {
  grid-column: 1 / -1; position: relative; height: 36px; border-radius: 12px; overflow: hidden;
  background: linear-gradient(#cfae7c, #d8b988);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.25), inset 0 -2px 0 rgba(120,80,40,.15);
}
.farm-road::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px dashed rgba(255,255,255,.55); }
.road-sign {
  position: absolute; z-index: 2; left: 10px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; background: #fffdf6; font-size: 11.5px; font-weight: 800; color: var(--green-strong);
  box-shadow: 0 2px 0 rgba(120,80,40,.25); max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tractor {
  position: absolute; z-index: 1; top: 50%; width: 28px; height: 28px;
  animation: drive 22s linear infinite; animation-delay: calc(0s - var(--clock));
}
@keyframes drive {
  0% { left: -8%; transform: translateY(-58%) scaleX(1); }
  48% { left: 100%; transform: translateY(-58%) scaleX(1); }
  50% { left: 100%; transform: translateY(-58%) scaleX(-1); }
  98% { left: -8%; transform: translateY(-58%) scaleX(-1); }
  100% { left: -8%; transform: translateY(-58%) scaleX(1); }
}

/* Zones (one per plan) */
.zone {
  position: relative; min-width: 0;
  padding: 44px 10px 12px; border-radius: 18px;
  background:
    radial-gradient(circle at 30% 40%, rgba(255,255,255,.14) 0 3px, transparent 4px) 0 0 / 22px 22px,
    radial-gradient(circle at 70% 70%, rgba(60,110,30,.12) 0 3px, transparent 4px) 0 0 / 30px 30px,
    #a9d27f;
  box-shadow: inset 0 -3px 0 rgba(70,110,40,.18);
  cursor: pointer;
  transition: opacity .45s, filter .45s, box-shadow .45s;
}
.zone::before {
  content: ''; position: absolute; inset: 5px; border-radius: 14px; pointer-events: none;
  border: 2px dashed rgba(122, 86, 48, .45);
}
.zone.n-2, .zone.n-3plus { grid-column: span 2; }
@container (min-width: 700px) { .zone.n-2 { grid-column: span 1; } }
.farm-world.has-sel .zone:not(.is-sel) { opacity: .55; filter: saturate(.65); }
.zone.is-sel { box-shadow: 0 0 0 4px #fff, 0 0 0 10px rgba(64, 180, 101, .55), 0 14px 30px -12px rgba(30, 50, 20, .5); }
.zone.is-ready::after {
  content: ''; position: absolute; inset: -3px; border-radius: 20px; pointer-events: none;
  box-shadow: 0 0 0 3px rgba(242, 184, 75, .8);
  animation: pulse-ring 2s ease-in-out infinite; animation-delay: calc(0s - var(--clock));
}
@keyframes pulse-ring { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.zone-label {
  position: absolute; z-index: 2; top: 8px; left: 50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 5px; max-width: calc(100% - 14px);
  padding: 3px 10px; border-radius: 999px; background: #fffdf6;
  font-size: 11.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 2px 0 rgba(70,110,40,.25);
}
.zone-label em { font-style: normal; color: var(--muted); font-weight: 700; }
.zone-label em::before { content: '·'; margin-right: 5px; }
.zone-label em.is-late { color: var(--red); }
.zone-empty { font-size: 12px; color: #3d5a2a; text-align: center; padding: 18px 4px; }

.plots { display: grid; grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 12px 8px; }
@container (min-width: 540px) { .plots { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); } }
@container (min-width: 820px) { .plots { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); } }

/* Plots (one per crop in a plan) */
.plot {
  position: relative; display: flex; flex-direction: column; gap: 14px; min-width: 0;
  padding: 0; border: 0; background: none; text-align: center; cursor: pointer;
}
.plot-square {
  position: relative; display: block; aspect-ratio: 1; border-radius: 16px;
  filter: drop-shadow(0 3px 0 rgba(90, 60, 30, .35));
  transition: transform .2s cubic-bezier(.3,.9,.4,1.4);
}
.plot:hover .plot-square { transform: translateY(-3px); }
.plot:active .plot-square { transform: scale(.95); }
.plot-svg { display: block; width: 100%; height: 100%; }
.plot.is-sel .plot-square { outline: 3px solid #fff; outline-offset: 2px; border-radius: 17px; box-shadow: 0 0 0 7px rgba(64, 180, 101, .6); }
.ph-waiting .plot-square::after {
  content: ''; position: absolute; inset: 6px; border-radius: 12px; border: 2px dashed rgba(255,255,255,.45);
}
.plot-qty {
  position: absolute; top: 5px; right: 5px; padding: 1px 6px; border-radius: 99px;
  background: rgba(30, 24, 16, .55); color: #fff; font-size: 10px; font-weight: 800;
}
.plot-time {
  position: absolute; z-index: 1; left: 50%; bottom: -9px; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 99px;
  background: #fffdf6; color: var(--text); font-size: 10.5px; font-weight: 800; white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.plot-time .i { width: 11px; height: 11px; stroke-width: 2.4; color: var(--green); }
.plot-time.is-ready .i, .plot-time.is-late .i { color: #fff; }
.plot-time.is-ready { background: var(--orange); color: #fff; }
.plot-time.is-late { background: var(--red); color: #fff; }
.plot-name {
  font-size: 11px; font-weight: 800; color: #2a3b20; line-height: 1.2;
  overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow-wrap: anywhere;
}
.bubble {
  position: absolute; z-index: 2; top: -13px; left: 50%;
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%;
  background: #fff; color: var(--c);
  box-shadow: 0 3px 8px rgba(0,0,0,.22);
  animation: bob 1.6s ease-in-out infinite; animation-delay: calc(0s - var(--clock));
}
.bubble::after { content: ''; position: absolute; bottom: -4px; left: 50%; margin-left: -4px; border: 4px solid transparent; border-top-color: #fff; border-bottom: 0; }
.bubble.is-late { box-shadow: 0 0 0 2.5px var(--red), 0 3px 8px rgba(0,0,0,.22); }
@keyframes bob { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -5px); } }
.bee {
  position: absolute; z-index: 2; top: 38%; left: 42%; width: 16px; height: 16px; pointer-events: none;
  animation: orbit 5s linear infinite; animation-delay: calc(0s - var(--clock));
}
@keyframes orbit {
  from { transform: rotate(0deg) translateX(30px) rotate(0deg) scaleX(-1); }
  to { transform: rotate(360deg) translateX(30px) rotate(-360deg) scaleX(-1); }
}

/* SVG life */
.sway { transform-box: fill-box; transform-origin: 50% 100%; animation: sway 3.4s ease-in-out infinite; animation-delay: calc(var(--d, 0s) - var(--clock)); }
.ph-overdue .sway { animation-duration: 5s; }
@keyframes sway { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
.zz { font: 800 11px var(--font); fill: #f6e7a6; transform-box: fill-box; animation: zz 2.6s ease-in infinite; animation-delay: calc(var(--d, 0s) - var(--clock)); }
@keyframes zz { 0% { opacity: 0; transform: translate(0, 5px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(7px, -12px); } }
.drip { animation: drip 1.5s ease-in infinite; animation-delay: calc(var(--d, 0s) - var(--clock)); }
@keyframes drip { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(20px); opacity: 0; } }
.spark { transform-box: fill-box; transform-origin: center; animation: twinkle 1.8s ease-in-out infinite; animation-delay: calc(var(--d, 0s) - var(--clock)); }
@keyframes twinkle { 0%, 100% { transform: scale(.3); opacity: .2; } 50% { transform: scale(1.1); opacity: 1; } }
.smoke { transform-box: fill-box; transform-origin: center; opacity: 0; animation: smoke 3s ease-out infinite; animation-delay: calc(var(--d, 0s) - var(--clock)); }
@keyframes smoke { 0% { transform: translate(0, 0) scale(.5); opacity: .9; } 100% { transform: translate(12px, -24px) scale(1.7); opacity: 0; } }
.ripple { transform-box: fill-box; transform-origin: center; animation: ripple 2.8s ease-out infinite; animation-delay: calc(var(--d, 0s) - var(--clock)); }
@keyframes ripple { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(2.3); opacity: 0; } }

/* Farmhouse zone */
.home-art { position: relative; }
.house-svg { display: block; width: 100%; height: auto; }
.critter { position: absolute; width: 17px; height: 17px; pointer-events: none; }
.critter svg, .bee svg, .fly svg, .tractor svg { display: block; width: 100%; height: 100%; }
.hen { left: 6%; top: 46%; animation: peck 1.8s ease-in-out infinite; animation-delay: calc(0s - var(--clock)); }
.hen-2 { left: 34%; top: 82%; animation-duration: 2.3s; animation-delay: calc(-.9s - var(--clock)); }
@keyframes peck { 0%, 60%, 100% { transform: rotate(0) translateY(0); } 70% { transform: rotate(-22deg) translateY(2px); } 80% { transform: rotate(0); } 88% { transform: rotate(-22deg) translateY(2px); } }
.duck { left: 72%; top: 62%; animation: swim 10s ease-in-out infinite; animation-delay: calc(0s - var(--clock)); }
@keyframes swim {
  0% { transform: translate(0, 0) scaleX(1); }
  45% { transform: translate(18px, 6px) scaleX(1); }
  50% { transform: translate(18px, 6px) scaleX(-1); }
  95% { transform: translate(0, 0) scaleX(-1); }
  100% { transform: translate(0, 0) scaleX(1); }
}

.zone-free {
  display: grid; place-items: center; align-content: center; gap: 6px; min-height: 120px; padding: 16px;
  border-radius: 18px; border: 2.5px dashed rgba(255,255,255,.85);
  background: rgba(169, 210, 127, .45); color: var(--green-strong); font-size: 13px; text-align: center;
}
.zone-free::before { display: none; }
.zone-free:hover { background: rgba(169, 210, 127, .7); }
.free-plus { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: var(--green); box-shadow: 0 3px 0 rgba(70,110,40,.25); }

/* Ambient effects */
.farm-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 3; }
.cloud {
  position: absolute; width: 300px; height: 150px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(25, 45, 25, .17), transparent);
  filter: blur(4px); animation: cloud 40s linear infinite;
}
.cloud.c1 { top: 4%; animation-delay: calc(-6s - var(--clock)); }
.cloud.c2 { top: 52%; width: 380px; height: 170px; animation-duration: 55s; animation-delay: calc(-30s - var(--clock)); }
@keyframes cloud { from { left: -40%; } to { left: 110%; } }
.fly { position: absolute; width: 18px; height: 18px; animation: fly 24s ease-in-out infinite, flap .25s ease-in-out infinite alternate; animation-delay: calc(0s - var(--clock)), 0s; }
.fly.f2 { width: 15px; height: 15px; animation-duration: 31s, .22s; animation-delay: calc(-14s - var(--clock)), 0s; }
@keyframes fly {
  0% { left: 8%; top: 22%; } 20% { left: 38%; top: 10%; } 40% { left: 72%; top: 28%; }
  60% { left: 58%; top: 62%; } 80% { left: 24%; top: 74%; } 100% { left: 8%; top: 22%; }
}
@keyframes flap { from { transform: scaleX(1); } to { transform: scaleX(.55); } }
.night, .tint, .firefly { display: none; }
.night { position: absolute; inset: 0; background: radial-gradient(120% 90% at 50% 30%, rgba(60, 80, 170, .2), rgba(22, 32, 92, .42)); mix-blend-mode: multiply; }
.tint { position: absolute; inset: 0; mix-blend-mode: multiply; }
[data-sky='night'] .night, [data-sky='night'] .firefly, [data-sky='dawn'] .tint, [data-sky='dusk'] .tint { display: block; }
[data-sky='dawn'] .tint { background: linear-gradient(120deg, rgba(255, 180, 140, .32), rgba(255, 226, 170, .14)); }
[data-sky='dusk'] .tint { background: linear-gradient(120deg, rgba(150, 105, 190, .3), rgba(255, 150, 95, .28)); }
.lamp { opacity: var(--lights-o); transition: opacity 2s; }
.firefly {
  position: absolute; left: var(--x); top: var(--y); width: 5px; height: 5px; border-radius: 50%;
  background: #fff7a8; box-shadow: 0 0 10px 4px rgba(255, 238, 120, .75);
  animation: firefly 3.6s ease-in-out infinite; animation-delay: calc(var(--d) - var(--clock));
}
@keyframes firefly { 0%, 100% { opacity: 0; transform: translate(0, 0); } 50% { opacity: 1; transform: translate(10px, -14px); } }

.map-btn {
  position: absolute; z-index: 4; top: 12px; right: 12px;
  width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: #fff; color: var(--text); box-shadow: 0 4px 14px rgba(0,0,0,.2);
}

.farm-hint {
  display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 14px 16px;
  border-radius: 20px; background: var(--green-soft); color: var(--green-strong);
}
.hint-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 14px; background: #fff; color: var(--green); flex: none; }
.hint-ico .i { width: 22px; height: 22px; }
.road-sign .i, .zone-label .i { width: 13px; height: 13px; color: var(--green); }
.zone-label .crop-svg.inline, .plot-name .crop-svg.inline { margin-right: 2px; }
.zone-chips .i { width: 17px; height: 17px; }
.zone-chips .crop-svg.inline { margin-right: 0; }
.farm-hint strong { display: block; font-size: 14.5px; }
.farm-hint small { display: block; font-size: 12.5px; color: #4a7a5a; font-weight: 600; }

/* Panel */
.farm-card h2 { font-size: 18px; font-weight: 800; letter-spacing: -0.015em; }
.fc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.fc-title { flex: 1; min-width: 0; }
.fc-title h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; line-height: 1.2; }
.fc-title h2 .qty { font-size: 14px; padding: 2px 9px; }
.fc-title a { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 700; color: var(--green-strong); }
.fc-title a .i { width: 15px; height: 15px; }
.fc-head .icon-btn { box-shadow: none; width: 38px; height: 38px; }
.fc-sub { font-size: 14px; font-weight: 800; margin: 18px 0 4px; }

.phase-chip .i { width: 15px; height: 15px; }
.phase-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; background: var(--surface-2); }
.phase-chip.ph-soak { background: var(--blue-soft); color: #245f88; }
.phase-chip.ph-dark { background: var(--dark-soft); color: var(--dark); }
.phase-chip.ph-light { background: var(--green-soft); color: var(--green-strong); }
.phase-chip.ph-ready { background: var(--orange-soft); color: #a34d12; }
.phase-chip.ph-overdue { background: var(--red-soft); color: var(--red); }

.timers { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 14px 0; }
.timer { padding: 10px 12px; border-radius: 14px; background: var(--surface-2); min-width: 0; }
.timer small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.timer strong { display: block; font-size: 24px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.2; }
.timer strong.is-late { color: var(--red); }
.growth-row { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }

.cycle-game { margin-top: 30px; }
.cycle-track { position: relative; display: flex; gap: 3px; height: 14px; }
.cycle-track > span:not(.cycle-marker) { border-radius: 6px; }
.cycle-marker { position: absolute; top: -6px; bottom: -6px; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--text); transition: left .6s; }
.cycle-marker i {
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  padding: 2px 7px; border-radius: 99px; background: var(--text); color: #fff;
  font-style: normal; font-size: 10.5px; font-weight: 800; white-space: nowrap;
}
.cycle-steps { display: flex; justify-content: space-between; gap: 6px; margin-top: 12px; }
.cycle-steps span { display: grid; justify-items: center; font-size: 11.5px; font-weight: 700; color: var(--text-2); text-align: center; }
.t-ico { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; margin-bottom: 2px; background: color-mix(in srgb, var(--c) 16%, #fff); color: var(--c); }
.t-ico .i { width: 16px; height: 16px; stroke-width: 2.1; }
.cycle-steps small { color: var(--muted); font-weight: 600; }

.action-btn { margin: 18px 0 10px; min-height: 54px; font-size: 15.5px; }
.action-btn.t-harvest { background: var(--orange); }
.action-btn.t-harvest:hover { background: #c9692a; }
.action-btn .i { width: 20px; height: 20px; }
.xp-chip {
  flex: none; display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  background: #fff1c7; color: #8f6200; font-size: 11px; font-weight: 800; white-space: nowrap;
}
.xp-chip.on-dark { background: rgba(255,255,255,.22); color: #fff; }
.task.is-done .xp-chip { opacity: .4; }

.crop-rows { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.crop-row {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 16px;
  background: var(--surface-2); text-align: left; transition: background .15s;
}
.crop-row:hover { background: var(--green-soft); }
.crop-row-text { flex: 1; min-width: 0; display: grid; }
.crop-row-text strong { font-size: 14px; }
.crop-row-text small { font-size: 12px; color: var(--muted); font-weight: 600; }
.crop-row-text small .i { width: 13px; height: 13px; }
.bubble .i { width: 16px; height: 16px; stroke-width: 2.2; }
.bubble-sm { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: var(--c); box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.bubble-sm .i { width: 15px; height: 15px; stroke-width: 2.2; }
.mini-ring, .lvl-ring {
  flex: none; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(closest-side, var(--surface-2) 74%, transparent 75% 100%), conic-gradient(var(--green) calc(var(--p) * 1%), #d8efdf 0);
}
.mini-ring { width: 40px; height: 40px; font-size: 10.5px; font-weight: 800; }

/* Player */
.player-top { display: flex; align-items: center; gap: 14px; }
.player-top small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.player-top h2 { font-size: 20px; }
.player-top .muted { font-size: 12.5px; }
.lvl-ring {
  width: 66px; height: 66px;
  background: radial-gradient(closest-side, var(--surface) 76%, transparent 77% 100%), conic-gradient(#f2b84b calc(var(--p) * 1%), #f3ead2 0);
}
.lvl-ring b { font-size: 26px; font-weight: 800; color: var(--green-strong); }
.lvl-ring.sm { width: 42px; height: 42px; background: radial-gradient(closest-side, var(--surface-2) 74%, transparent 75% 100%), conic-gradient(#f2b84b calc(var(--p) * 1%), #e9dfc4 0); }
.lvl-ring.sm b { font-size: 16px; }
.streak { margin-left: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-weight: 800; font-size: 14px; white-space: nowrap; }
.streak .i { width: 16px; height: 16px; }
.streak.is-on { background: #ffe9d6; color: #c2410c; }
.xp-bar { height: 10px; margin: 16px 0; border-radius: 99px; background: #f3ead2; overflow: hidden; }
.xp-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #f7d070, #f2a93b); transition: width .6s; }
.player-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.player-stats div { display: grid; justify-items: center; padding: 10px 4px; border-radius: 14px; background: var(--surface-2); text-align: center; }
.player-stats .i { width: 19px; height: 19px; color: var(--green); margin-bottom: 2px; }
.player-stats strong { font-size: 18px; font-weight: 800; line-height: 1.2; }
.player-stats small { font-size: 11px; color: var(--muted); font-weight: 600; }

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 8px; }
.badge {
  display: grid; justify-items: center; gap: 2px; padding: 12px 6px; border-radius: 16px; text-align: center;
  background: var(--surface-2); border: 1px solid transparent; filter: grayscale(1); opacity: .55;
}
.badge.is-got { filter: none; opacity: 1; background: linear-gradient(#fffaea, #fdedc9); border-color: #f1d796; }
.badge-ico { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: #fff; color: #b7791f; box-shadow: 0 0 0 3px #f6dfa5; margin-bottom: 4px; }
.badge-ico .i { width: 22px; height: 22px; }
.badge strong { font-size: 12.5px; line-height: 1.25; }
.badge small { font-size: 11px; color: var(--muted); line-height: 1.3; }

.farm-empty { text-align: center; display: grid; justify-items: center; gap: 8px; }
.farm-empty p { color: var(--muted); max-width: 34ch; }
.farm-empty .btn-row { justify-content: center; margin-top: 6px; }

.side-level { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; background: var(--surface-2); }
.side-level strong { display: block; font-size: 13.5px; }
.side-level small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }

/* Rewards */
.float-text {
  position: fixed; z-index: 90; pointer-events: none;
  font-weight: 800; font-size: 16px; color: #e48a12; white-space: nowrap;
  text-shadow: 0 1px 0 #fff, 0 0 10px #fff, 0 0 4px #fff;
  animation: float-up 1.15s ease-out forwards;
}
@keyframes float-up {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(.7); }
  15% { opacity: 1; transform: translate(-50%, -90%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -280%) scale(1); }
}
.confetti {
  position: fixed; z-index: 90; width: 9px; height: 9px; border-radius: 2px; pointer-events: none;
  background: var(--c);
  animation: burst 1.25s cubic-bezier(.15, .7, .3, 1) forwards;
}
.confetti.is-leaf { width: 12px; height: 7px; border-radius: 0 80% 0 80%; background: #6cb043; }
@keyframes burst {
  0% { transform: translate(-50%, -50%) scale(.5); opacity: 1; }
  75% { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy) + 70px)) rotate(var(--r)); opacity: 0; }
}

/* ======================================================================
   Day & night (driven by <html data-sky>, see sky.js)
   ====================================================================== */

:root {
  --sky-top: #cfe8ef; --sky-bottom: #f4f1e0; --sun-core: #ffd166; --sun-glow: #ffe8a3;
  --sun-o: 1; --moon-o: 0; --stars-o: 0; --shade-o: 0; --lights-o: 0; --clouds-o: 1;
  --sun-x: 610px; --sun-y: 84px; --moon-x: 600px; --moon-y: 70px;
}
:root[data-sky='dawn'] {
  --sky-top: #a3b8e2; --sky-bottom: #ffd3a6; --sun-core: #ffb35c; --sun-glow: #ffc98f;
  --stars-o: .15; --shade-o: .16; --lights-o: .35; --clouds-o: .9;
}
:root[data-sky='dusk'] {
  --sky-top: #6c66a6; --sky-bottom: #ffb07c; --sun-core: #ff9147; --sun-glow: #ffad73;
  --stars-o: .35; --shade-o: .26; --lights-o: .75; --clouds-o: .7;
}
:root[data-sky='night'] {
  --sky-top: #0f1736; --sky-bottom: #2f3d6c;
  --sun-o: 0; --moon-o: 1; --stars-o: 1; --shade-o: .55; --lights-o: 1; --clouds-o: .16;
}

.sky-top { stop-color: var(--sky-top); transition: stop-color 2s; }
.sky-bottom { stop-color: var(--sky-bottom); transition: stop-color 2s; }
.sun-glow { stop-color: var(--sun-glow); }
.sun-core { fill: var(--sun-core); transition: fill 2s; }
.sky-sun { transform: translate(var(--sun-x), var(--sun-y)); opacity: var(--sun-o); transition: transform 1.5s ease, opacity 2s; }
.sky-moon { transform: translate(var(--moon-x), var(--moon-y)); opacity: var(--moon-o); transition: transform 1.5s ease, opacity 2s; }
.sky-stars { opacity: var(--stars-o); transition: opacity 2s; }
.sky-clouds { opacity: var(--clouds-o); transition: opacity 2s; }
.sky-shade { opacity: var(--shade-o); transition: opacity 2s; }
.sky-lights { opacity: var(--lights-o); transition: opacity 2s; }
.twinkle { transform-box: fill-box; transform-origin: center; animation: twinkle 2.8s ease-in-out infinite; animation-delay: var(--d, 0s); }
.h-firefly { animation: firefly 3.6s ease-in-out infinite; animation-delay: var(--d, 0s); }
.h-zz { display: none; font: 800 12px var(--font); fill: #fff; transform-box: fill-box; animation: zz 2.6s ease-in infinite; animation-delay: var(--d, 0s); }
.eyes-shut { display: none; }
[data-sky='night'] .eyes-shut, [data-sky='night'] .h-zz { display: inline; }
[data-sky='night'] .eyes-open { display: none; }

.sky-ico .i { display: none; width: 14px; height: 14px; }
:root:not([data-sky]) .sky-day, [data-sky='dawn'] .sky-dawn, [data-sky='day'] .sky-day, [data-sky='dusk'] .sky-dusk, [data-sky='night'] .sky-night { display: block; }
.sky-chip {
  display: inline-flex; align-items: center; gap: 6px;
  justify-self: start; margin-top: 6px; padding: 3px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .72); color: var(--text-2);
  font-size: 12px; font-weight: 700; white-space: nowrap;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.farm-title .sky-chip { display: inline-flex; margin-top: 8px; background: var(--surface); border: 1px solid var(--line); }
.hero-greet, .hero-farm { transition: color 2s; }
[data-sky='dusk'] .hero-greet, [data-sky='night'] .hero-greet { color: #d7e0f7; }
[data-sky='dusk'] .hero-farm, [data-sky='night'] .hero-farm { color: #fff; }
[data-sky='night'] .hero .sky-chip { background: rgba(15, 23, 54, .55); color: #e6ecff; }
[data-sky='dusk'] .hero .sky-chip { background: rgba(60, 50, 110, .45); color: #fff; }

/* ======================================================================
   Crop library
   ====================================================================== */

.dialog.library { width: min(580px, calc(100vw - 24px)); }
.lib-body { display: flex; flex-direction: column; max-height: min(86vh, 760px); padding: 20px; text-align: left; }
.lib-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.lib-head > div { flex: 1; }
.lib-head h2 { margin-bottom: 4px; }
.lib-head p { font-size: 13.5px; color: var(--muted); }
.lib-head .icon-btn { box-shadow: none; width: 38px; height: 38px; }
.lib-search { margin-bottom: 12px; }
.lib-list { list-style: none; margin: 0 -6px; padding: 0 6px; display: grid; gap: 6px; overflow-y: auto; flex: 1; min-height: 120px; }
.lib-item {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 10px;
  border: 1.5px solid var(--line); border-radius: 16px; background: var(--surface); text-align: left;
  transition: border-color .15s, background .15s;
}
.lib-item:hover:not(:disabled) { border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.lib-item[aria-pressed='true'] { border-color: var(--green); background: #f2faf4; }
.lib-item:disabled { cursor: default; opacity: .75; }
.lib-text { flex: 1; min-width: 0; display: grid; }
.lib-text strong { font-size: 14.5px; }
.lib-text small { font-size: 12px; color: var(--muted); font-weight: 600; }
.lib-check {
  width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%;
  border: 2px solid var(--line-strong); color: transparent; transition: background .15s, border-color .15s;
}
.lib-check .i { width: 16px; height: 16px; stroke-width: 2.6; }
.lib-item[aria-pressed='true'] .lib-check { background: var(--green); border-color: var(--green); color: #fff; }
.lib-chev { color: var(--muted); }
.lib-foot { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 14px; }

.lib-banner {
  width: 100%; display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding: 14px 16px;
  text-align: left; cursor: pointer; background: linear-gradient(135deg, #fffdf6, #e8f6ec); border-color: #cdebd6;
}
.lib-banner:hover { border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.lib-banner > span:nth-child(2) { flex: 1; min-width: 0; }
.lib-banner strong { display: block; font-size: 15px; }
.lib-banner small { display: block; font-size: 12.5px; color: var(--muted); }
.lib-banner .i { color: var(--green); }
.lib-banner-ico { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: #fff; color: var(--green); box-shadow: var(--shadow); }
.lib-banner-ico .i { width: 22px; height: 22px; }
.center-row { justify-content: center; }

/* ======================================================================
   First steps checklist
   ====================================================================== */

.start-card { margin-bottom: 16px; background: linear-gradient(135deg, #fffdf6, #ebf7ef); }
.farm-panel .start-card { margin-bottom: 0; }
.start-card .progress { margin-bottom: 12px; }
.start-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 4px; }
.start-item {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 6px; border: 0; border-radius: 12px;
  background: none; text-align: left; font-weight: 600; font-size: 14.5px; color: var(--text);
}
.start-item:hover { background: rgba(255,255,255,.7); }
.start-item > .i { color: var(--muted); width: 18px; height: 18px; }
.start-label { flex: 1; }
.start-check {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%;
  border: 2px solid var(--line-strong); background: #fff; color: #fff;
}
.start-check .i { width: 15px; height: 15px; stroke-width: 2.8; }
.is-done .start-check { background: var(--green); border-color: var(--green); }
.is-done .start-label { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }

/* ======================================================================
   Tutorial
   ====================================================================== */

.tour { position: fixed; inset: 0; z-index: 55; pointer-events: none; }
.tour-shade {
  position: absolute; inset: 0; pointer-events: auto;
  background: rgba(18, 24, 14, .58);
  transition: clip-path .35s cubic-bezier(.3,.8,.3,1);
}
.tour-ring {
  position: absolute; display: none; pointer-events: auto;
  box-shadow: 0 0 0 3px #fff, 0 0 0 8px rgba(64, 180, 101, .55);
  transition: left .35s cubic-bezier(.3,.8,.3,1), top .35s cubic-bezier(.3,.8,.3,1), width .35s, height .35s;
  animation: tour-pulse 1.8s ease-in-out infinite;
}
.tour.is-interactive .tour-ring { pointer-events: none; }
@keyframes tour-pulse { 0%, 100% { box-shadow: 0 0 0 3px #fff, 0 0 0 8px rgba(64, 180, 101, .55); } 50% { box-shadow: 0 0 0 3px #fff, 0 0 0 14px rgba(64, 180, 101, .25); } }
.tour-card {
  position: absolute; pointer-events: auto; outline: none;
  width: min(390px, calc(100vw - 24px)); padding: 18px 20px 18px;
  background: var(--surface); border-radius: 24px; box-shadow: 0 24px 60px -16px rgba(0, 0, 0, .45);
  transition: left .35s cubic-bezier(.3,.8,.3,1), top .35s cubic-bezier(.3,.8,.3,1);
}
.tour-card.pop { animation: pop .3s cubic-bezier(.2,.9,.3,1.2); }
.tour-progress { height: 5px; margin: -2px 0 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.tour-progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green-bright), var(--green)); transition: width .4s; }
.tour-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.tour-count { font-size: 12px; font-weight: 700; color: var(--muted); }
.tour-skip { border: 0; background: none; padding: 4px 0; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.tour-skip:hover { color: var(--text); }
.tour-card h2 { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.tour-card > p { color: var(--text-2); font-size: 14.5px; }
.tour-logo { width: 64px; height: 64px; margin: 14px auto 4px; filter: drop-shadow(0 6px 14px rgba(30, 70, 35, .28)); }
.tour-fields { display: grid; gap: 10px; margin-top: 12px; }
.tour-fields .field { margin: 0; }
.tour-cycle { display: flex; align-items: center; margin: 16px 0 10px; }
.tour-cycle span { display: grid; justify-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--text-2); }
.tour-cycle b { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 13px; background: color-mix(in srgb, var(--c) 16%, #fff); color: var(--c); }
.tour-cycle b .i { width: 20px; height: 20px; stroke-width: 2; }
.t-dark { --c: #4d5364; }
.tour-cycle i { flex: 1; height: 2px; margin: 0 2px 16px; background: repeating-linear-gradient(90deg, var(--line-strong) 0 5px, transparent 5px 9px); }
.tour-example { padding: 10px 12px; border-radius: 14px; background: var(--surface-2); font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.tour-wait { display: flex; align-items: center; gap: 8px; }
.tour-wait .i { width: 18px; height: 18px; flex: none; }
.tour-wait { margin-top: 10px; padding: 8px 12px; border-radius: 12px; background: var(--yellow-soft); color: #7a5b00; font-size: 13px; font-weight: 700; }
.tour-help {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 12px; padding: 10px 12px;
  border: 1.5px dashed color-mix(in srgb, var(--green) 45%, transparent); border-radius: 14px;
  background: var(--green-soft); color: var(--green-strong); font-weight: 700; font-size: 14px;
}
.tour-help:hover { background: #cfeed9; }
.tour-help .i { width: 18px; height: 18px; }
.tour-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.tour-actions .spacer { flex: 1; }
.tour-actions .btn { min-height: 42px; padding: 0 14px; font-size: 14px; }
.tour-actions .btn .i { width: 18px; height: 18px; }
/* While the tutorial is open its card sits at the bottom, so toasts move up. */
body:has(.tour) .toast { top: calc(14px + env(safe-area-inset-top, 0px)); bottom: auto; }

/* ======================================================================
   Tray sizes & seed amounts
   ====================================================================== */

.tray-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.tray-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface);
}
.tray-row.is-on { border-color: color-mix(in srgb, var(--green) 45%, transparent); background: #f4fbf6; }
.tray-main { flex: 1; min-width: 0; display: grid; grid-template-columns: 18px 42px minmax(0, 1fr); align-items: center; gap: 10px; cursor: pointer; }
.tray-main .tray-shape { justify-self: center; }
.tray-main input { width: 18px; height: 18px; accent-color: var(--green); flex: none; }
.tray-main input:disabled { opacity: .6; }
.tray-shape { flex: none; border-radius: 3px; min-width: 6px; min-height: 6px; background: #3f4b3c; box-shadow: inset 0 0 0 2px #2d362b, 0 1px 0 rgba(0,0,0,.1); margin: 0 4px; }
.tray-row.is-on .tray-shape { background: linear-gradient(135deg, #86d8a0, var(--green)); box-shadow: inset 0 0 0 2px #2f8f52; }
.tray-name { display: grid; line-height: 1.25; }
.tray-name strong { font-size: 14.5px; }
.tray-name small { font-size: 12px; color: var(--muted); }
.tray-default { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tray-default input { accent-color: var(--green); width: 16px; height: 16px; margin: 0; }
.tray-default input:checked + span { color: var(--green-strong); }
.tray-del { width: 34px; height: 34px; box-shadow: none; color: var(--red); }
.tray-del:disabled { color: var(--line-strong); cursor: not-allowed; }
.tray-del .i { width: 17px; height: 17px; }
.tray-add { display: grid; gap: 8px; }
.tray-add-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.tray-add-row input { min-height: 42px; padding: 8px 10px; }
.tray-add-row > span { color: var(--muted); font-weight: 700; }
@media (max-width: 480px) {
  .tray-add-row { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .tray-add-row input[name='name'] { grid-column: 1 / -1; }
  .tray-add-row .btn { grid-column: 1 / -1; }
}

.tray-select {
  justify-self: start; margin-top: 4px; padding: 3px 26px 3px 10px; min-height: 28px;
  border: 1.5px solid var(--line-strong); border-radius: 999px; background-color: #fff;
  font-size: 12px; font-weight: 700; color: var(--text-2); cursor: pointer;
  -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d8376' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 12px;
}
.tray-select:focus { outline: none; border-color: var(--green); }

.input-suffix { position: relative; }
.input-suffix input { padding-right: 40px; }
.input-suffix span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 700; pointer-events: none; }
.seed-field { margin-top: 4px; }
.qty small { display: block; font-size: 10.5px; font-weight: 700; color: var(--green-strong); opacity: .8; text-align: center; margin-top: -2px; }

.tray-row { flex-wrap: wrap; }
.tray-adj { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.tray-adj input {
  width: 62px; min-height: 32px; padding: 4px 6px; border-radius: 10px; text-align: center;
  font-size: 13px; font-weight: 700; -moz-appearance: textfield;
}
@media (max-width: 480px) {
  .tray-main { flex-basis: 100%; }
  .tray-adj { margin-left: 28px; }
  .tray-default { margin-left: auto; }
}

.brand-ver { display: inline-block; margin-left: 2px; padding: 1px 6px; border-radius: 6px; background: var(--green); color: #fff; font-size: 11px; font-weight: 800; vertical-align: 3px; letter-spacing: 0; }

/* ======================================================================
   Account & sync
   ====================================================================== */

.sync-status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--muted); line-height: 1.3; }
.sync-status .i { width: 16px; height: 16px; flex: none; }
.sync-status.is-ok { color: var(--green-strong); }
.sync-status.is-ok .i { color: var(--green); }
.sync-status.is-syncing .i { animation: spin 1s linear infinite; }
.sync-status.is-pending, .sync-status.is-offline { color: #8a6a12; }
.sync-status.is-error, .sync-status.is-expired { color: var(--red); }
@keyframes spin { to { transform: rotate(360deg); } }

.account-card .btn-row { margin-top: 4px; }
.account-card .account-session-row { margin-bottom: 12px; }
.account-card .billing-controls { display: grid; gap: 10px; margin: 18px 0; }
.account-card .billing-controls .field-hint,
.account-card .billing-controls .btn-row { margin: 0; }
.account-card > .btn-stack {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line);
}
.account-card > .btn-stack [data-delete-account] { margin-left: auto; }
@media (max-width: 480px) {
  .account-card .billing-controls .btn,
  .account-card > .btn-stack > .btn { width: 100%; justify-content: center; }
  .account-card > .btn-stack [data-delete-account] { margin-left: 0; }
}
.account-user { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.account-user > div { display: grid; min-width: 0; }
.account-user strong { font-size: 15.5px; overflow-wrap: anywhere; }
.account-user small { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.account-avatar {
  width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: var(--green); color: #fff; font-weight: 800; font-size: 18px;
}
.sync-line { margin: 0 0 14px; padding: 9px 12px; border-radius: 12px; background: var(--surface-2); }

.dialog.auth { width: min(420px, calc(100vw - 24px)); }
.auth-body { text-align: left; }
.auth-logo { margin: 0 auto 10px; filter: drop-shadow(0 4px 10px rgba(30, 70, 35, .25)); }
.auth-body h2 { text-align: center; }
.auth-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.auth-tabs { margin-bottom: 16px; }
.auth-body .field { margin-bottom: 12px; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 48px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--muted);
}
.pw-toggle:hover { background: var(--surface-2); color: var(--text); }
.auth-error { display: flex; align-items: flex-start; gap: 8px; margin: 4px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--red-soft); color: var(--red); font-size: 13.5px; font-weight: 600; }
.auth-error .i { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.auth-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 14px; font-size: 12px; color: var(--muted); text-align: center; }
.auth-note .i { width: 14px; height: 14px; flex: none; }
.pw-field { text-align: left; margin-top: 14px; }
.dialog-actions .btn { min-width: 0; white-space: normal; line-height: 1.2; padding: 8px 12px; text-align: center; }

/* Authentication: one column with explicit spacing, including recovery screens. */
.dialog.auth { width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); border-radius: 24px; overflow-y: auto; }
.auth .auth-body { display: flex; flex-direction: column; gap: 18px; padding: 28px; text-align: left; }
.auth .auth-logo { margin: 0 auto; filter: none; }
.auth .auth-body h2 { margin: 0; font-size: 24px; line-height: 1.25; }
.auth .auth-sub { margin: -8px 0 2px; color: var(--text-2); line-height: 1.6; }
.auth .auth-tabs, .auth .field, .auth .legal-check { margin: 0; }
.auth .field { gap: 8px; }
.auth .field-hint { margin: 0; color: var(--text-2); line-height: 1.5; }
.auth input:not([type='checkbox']) { min-width: 0; width: 100%; min-height: 48px; font-size: 16px; }
.auth-help { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.auth-help-link { border: 0; padding: 8px 0; background: transparent; color: var(--green-strong); font-size: 13px; font-weight: 600; line-height: 1.5; text-align: left; text-decoration: underline; text-underline-offset: 3px; }
.auth .dialog-actions { margin: 4px 0 0; }
.auth .dialog-actions .btn { min-height: 48px; }
.auth .btn-primary { background: var(--green-strong); color: #fff; }
.auth .btn-primary:hover { background: #146536; }
.auth .auth-note { align-items: flex-start; margin: 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--text-2); line-height: 1.6; }
.auth .auth-note .i { margin-top: 3px; }
.auth .auth-error { margin: 0; }
.auth .legal-check { text-align: left; }
@media (max-width: 480px) {
  .auth .auth-body { padding: 24px 20px; }
  .auth .auth-tabs button { font-size: 13px; padding: 8px; }
}

/* ---------- Customer catalogue (editor) ---------- */

.cat-promo { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; background: linear-gradient(120deg, var(--green-soft), var(--surface) 70%); border-color: #cfe9d7; }
.cat-promo-ico { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 15px; background: var(--green); color: #fff; box-shadow: 0 6px 16px -8px rgba(27, 127, 69, .7); }
.cat-promo-ico .i { width: 24px; height: 24px; }
.cat-promo-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.cat-promo-text strong { font-size: 15.5px; }
.cat-promo-text small { color: var(--text-2); font-size: 13px; }

.share-card { border-color: #cfe9d7; }
.share-card .card-head .chip .i { color: inherit; }
.link-box { display: flex; gap: 8px; margin-bottom: 8px; }
.link-box input { flex: 1; min-width: 0; min-height: 44px; font-size: 14px; color: var(--green-strong); font-weight: 600; background: var(--green-soft); border-color: #cfe9d7; }
.share-hint { margin: 0 0 12px; }
.share-card > .btn-block + .share-hint { margin-top: 8px; }
.note-box { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 12px; border-radius: 14px; background: var(--blue-soft); color: #245f88; font-size: 13.5px; font-weight: 600; }
.note-box .i { flex: none; margin-top: 1px; }
.share-alt { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line-strong); display: grid; gap: 10px; }

.cat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cat-row { padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: #fff; display: grid; gap: 10px; transition: opacity .15s, background .15s; }
.cat-row.is-off { background: var(--surface-2); }
.cat-row.is-off .cat-row-name, .cat-row.is-off .crop-tile, .cat-row.is-off .cat-row-fields { opacity: .5; }
.cat-row-head { display: flex; align-items: center; gap: 12px; }
.cat-row-name { flex: 1; min-width: 0; display: grid; }
.cat-row-name strong { font-size: 15px; overflow-wrap: anywhere; }
.cat-row-name small { font-size: 12.5px; color: var(--muted); }
.cat-row-name small.has-dates { color: var(--green-strong); font-weight: 600; }
.cat-row-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.cat-row-fields input { min-height: 42px; padding: 8px 12px; font-size: 14px; }
@media (max-width: 480px) { .cat-row-fields { grid-template-columns: 1fr; } }

.cat-plans { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.cat-plan { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; cursor: pointer; }
.cat-plan input { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--green); }
.cat-plan.is-off { background: var(--surface-2); }
.cat-plan.is-off .cat-plan-date, .cat-plan.is-off .cat-plan-text { opacity: .55; }
.cat-plan-date { width: 56px; flex: none; display: grid; text-align: center; padding: 4px 0; border-radius: 10px; background: var(--orange-soft); color: #a34d12; line-height: 1.15; }
.cat-plan-date b { font-size: 14px; }
.cat-plan-date small { font-size: 11px; font-weight: 600; text-transform: capitalize; }
.cat-plan-text { flex: 1; min-width: 0; display: grid; }
.cat-plan-text strong { font-size: 14.5px; overflow-wrap: anywhere; }
.cat-plan-text small { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }

.dialog.preview { width: min(980px, calc(100vw - 24px)); height: min(860px, calc(100vh - 32px)); }
.preview-body { height: 100%; display: flex; flex-direction: column; background: var(--surface); border-radius: 24px; overflow: hidden; box-shadow: var(--shadow-lg); }
.preview-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--line); }
.preview-bar strong { flex: 1; min-width: 0; font-size: 15px; }
.preview-bar .icon-btn { box-shadow: none; }
.preview-body iframe { flex: 1; width: 100%; border: 0; background: var(--bg); }
.copy-area { font-size: 13px; }
.dialog-actions.one { grid-template-columns: 1fr; }

/* ---------- CropPlan Pro ---------- */

.pro-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 11px 4px 8px; border-radius: 99px;
  background: linear-gradient(120deg, #f6c453, #e9a23b); color: #4a3105;
  font-size: 12.5px; font-weight: 800; letter-spacing: .01em; white-space: nowrap;
  box-shadow: 0 4px 12px -6px rgba(185, 120, 20, .6);
}
.pro-badge .i { width: 14px; height: 14px; }
.pro-badge.sm { padding: 2px 9px 2px 6px; font-size: 11.5px; }
.pro-card {
  position: relative; overflow: hidden; display: grid; gap: 14px;
  border-color: #cfe9d7;
  background: radial-gradient(120% 90% at 100% 0%, var(--green-soft), transparent 60%), var(--surface);
}
.pro-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pro-price { font-size: 13px; font-weight: 700; color: var(--green-strong); }
.pro-card h2 { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.pro-text { color: var(--text-2); font-size: 14px; margin-top: -6px; }
.pro-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pro-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 16px; background: #fff; border: 1px solid var(--line); }
.pro-list li > span:last-child { display: grid; gap: 2px; min-width: 0; }
.pro-list strong { font-size: 14.5px; }
.pro-list small { font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.pro-ico { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 12px; background: var(--green-soft); color: var(--green-strong); }
.pro-card.is-active .pro-ico { background: var(--green); color: #fff; }
.pro-login { justify-self: center; margin-top: -6px; }
.pro-note { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; color: var(--muted); text-align: center; }
.pro-note .i { width: 14px; height: 14px; flex: none; }
.pro-legal { margin: 0; font-size: 12px; color: var(--muted); text-align: center; }
.pro-legal a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.pro-page { max-width: 560px; }
.account-hint { margin: -6px 0 14px; }

.slug-form { display: grid; gap: 10px; }
.slug-form .field { margin: 0; }
.slug-field {
  display: flex; align-items: center; min-width: 0;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; overflow: hidden;
}
.slug-field:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 14%, transparent); }
.slug-prefix { flex: none; max-width: 55%; padding: 0 2px 0 14px; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left; }
.slug-field input[type='text'] { flex: 1; min-width: 0; border: 0; border-radius: 0; padding-left: 2px; font-weight: 700; color: var(--green-strong); box-shadow: none; }
.slug-field input[type='text']:focus { box-shadow: none; }
.share-alt .link-btn { justify-self: start; }

/* Account and sign-out are visible before profile editing on every screen. */
.settings-account { margin-bottom: 20px; }
.account-session { font-weight: 700; font-size: 14px; margin: 0 0 10px; }
.account-session-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.account-session-row .account-user { min-width: 0; margin: 0; }
.account-session-row .account-user > div { min-width: 0; overflow-wrap: anywhere; }
.account-signout { flex-shrink: 0; border: 1px solid var(--green-strong); }

.settings-website { margin-bottom: 16px; }

/* Registration is the app entry point, independent of the requested route. */
.auth-required .sidebar,.auth-required .tabbar{display:none!important}
.auth-required .shell{display:block;margin:0}.auth-required .main{margin:0;padding:32px 20px;min-height:100dvh;width:100%;max-width:none}
.auth-gate{max-width:460px;margin:clamp(20px,8vh,85px) auto;text-align:center}
.auth-gate-brand{display:inline-flex;align-items:center;gap:12px;font-size:25px;text-decoration:none;color:inherit;margin-bottom:32px}
.auth-gate h1{font-size:clamp(28px,6vw,38px);line-height:1.2;letter-spacing:-1px;margin:0 0 18px}
.auth-gate>p{line-height:1.7;color:var(--muted);margin:0 0 24px}
.auth-gate-actions{display:grid;gap:10px;margin-bottom:22px}.auth-gate .auth-gate-note{font-size:13px}
.legal-check{display:flex;align-items:flex-start;gap:10px;font-size:12px;line-height:1.6;margin:16px 0}.legal-check input[type=checkbox]{width:18px;height:18px;flex:0 0 18px;margin-top:3px}.legal-check a,.app-legal a{text-decoration:underline;text-underline-offset:3px}.app-legal{display:flex;justify-content:center;flex-wrap:wrap;gap:18px;padding:22px 18px 100px;font-size:12px}.auth-required .app-legal{padding-bottom:30px}

/* ---------- Motion touches (js/fx.js), as on the website's app scenes ---------- */

/* A ring where something is pressed. */
.tap-ring {
  position: fixed; z-index: 95; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border: 2.5px solid var(--green); border-radius: 50%; pointer-events: none; opacity: 0;
  animation: tap-ring .55s ease-out;
}
@keyframes tap-ring { from { opacity: .7; transform: scale(.3); } to { opacity: 0; transform: scale(1.3); } }

/* Ticked-off tasks pop; numbers bump when they change. */
.check { position: relative; }
.task.just-done .check { animation: check-pop .45s cubic-bezier(.2,.8,.3,1.5); }
.task.just-done .check::after {
  content: ''; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--green);
  animation: check-ring .6s ease-out forwards;
}
.task.just-done .task-title, .task.just-done .task-ico { animation: task-done .5s ease-out; }
@keyframes check-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.18); } 100% { transform: none; } }
@keyframes check-ring { from { opacity: .8; transform: scale(1); } to { opacity: 0; transform: scale(1.9); } }
@keyframes task-done { from { color: var(--text); opacity: 1; filter: none; } }
.lib-item[aria-pressed='true'] .lib-check { animation: check-pop .4s cubic-bezier(.2,.8,.3,1.5); }
.bump { animation: bump .28s ease-out; }
@keyframes bump { 50% { transform: scale(1.3); } }

/* Plan form: the schedule grows back from the harvest date as trays are added. */
.plan-tl .card-head h2 .i { color: var(--green); }
.crop-tile.xs { width: 24px; height: 24px; border-radius: 8px; }
.tl-empty { margin: 0; padding: 22px 12px; border: 1.5px dashed var(--line-strong); border-radius: 14px; color: var(--muted); font-size: 13px; text-align: center; }
.tl { --lab: 132px; }
.tl-axis, .tl-row { display: grid; grid-template-columns: var(--lab) minmax(0, 1fr); align-items: center; }
.tl-days { display: grid; padding-bottom: 4px; color: var(--muted); font-size: 10.5px; font-weight: 700; text-align: center; }
.tl-days .is-h { border-radius: 6px; background: var(--orange-soft); color: #a34d12; }
.tl-row { height: 0; opacity: 0; overflow: hidden; transition: height .3s, opacity .25s; }
.tl-row.is-on { height: 36px; opacity: 1; }
.tl-lab { display: flex; align-items: center; gap: 7px; min-width: 0; padding-right: 8px; font-size: 13px; white-space: nowrap; }
.tl-lab b { overflow: hidden; text-overflow: ellipsis; }
.tl-lab em { color: var(--muted); font-style: normal; font-weight: 700; }
.tl-track { position: relative; height: 12px; border-radius: 6px; background: var(--surface-2); }
.tl-seg {
  position: absolute; top: 0; bottom: 0; border-radius: 6px; transform: scaleX(0); transform-origin: 100% 50%;
  transition: transform .55s cubic-bezier(.3,.7,.2,1), left .4s ease, width .4s ease;
}
.tl-seg.seg-light { transition-delay: .1s, 0s, 0s; }
.tl-seg.seg-dark { transition-delay: .5s, 0s, 0s; }
.tl-seg.seg-soak { transition-delay: .8s, 0s, 0s; }
.tl-row.is-on .tl-seg { transform: none; }
.tl-hv {
  position: absolute; top: 50%; display: grid; place-items: center; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border: 2px solid var(--surface); border-radius: 50%; background: var(--t-harvest); color: #fff;
  transform: scale(0); transition: transform .3s cubic-bezier(.2,.8,.3,1.5), left .4s ease;
}
.tl-hv .i { width: 12px; height: 12px; stroke-width: 2.4; }
.tl-row.is-on .tl-hv { transform: none; }
.tl-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.tl-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tl-legend i { width: 14px; height: 7px; border-radius: 4px; }
.tl-key-harvest { background: var(--t-harvest); }
@media (min-width: 760px) {
  #plan-form > .dash-col:first-child { align-self: stretch; }
  .plan-tl { position: sticky; top: 16px; }
}
/* On phones the schedule follows the list of crops, where the trays are added. */
@media (max-width: 759px) {
  #plan-form > .dash-col { display: contents; }
  #plan-form .plan-tl { order: 3; }
  #plan-form .form-actions { order: 4; }
}

/* Farm mode: plots react to the task just done. */
.plot-fx { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; pointer-events: none; }
.plot-fx svg { display: block; width: 100%; height: 100%; overflow: visible; }
.grow { transform-box: fill-box; transform-origin: 50% 100%; }
.plot.fx-light .plot-svg { animation: fx-lit 1.3s ease-out; }
.plot.fx-light .grow { animation: fx-grow 1.2s cubic-bezier(.3,.7,.2,1.2) backwards; animation-delay: calc(.25s + var(--i, 0) * 35ms); }
.plot.fx-seed .grow, .plot.fx-soak .grow { animation: fx-grow .8s cubic-bezier(.3,.7,.2,1.3) backwards; animation-delay: calc(.5s + var(--i, 0) * 40ms); }
.plot.fx-harvest .grow { animation: fx-pluck .5s ease-in forwards; animation-delay: calc(var(--i, 0) * 30ms); }
@keyframes fx-lit { from { filter: brightness(.55) saturate(.35); } }
@keyframes fx-grow { from { transform: scale(.45); } }
@keyframes fx-pluck { to { opacity: 0; transform: translateY(-14px) scale(0); } }
.fx-cover { animation: fx-cover .7s ease-in forwards; }
@keyframes fx-cover { to { opacity: 0; transform: translateY(-26px); } }
/* Sown trays go into the dark once the seeds have landed. */
.plot.fx-seed .cover { animation: fx-cover-in .5s .9s backwards; }
@keyframes fx-cover-in { from { opacity: 0; transform: translateY(-26px); } }
.fx-sun { transform-box: fill-box; transform-origin: center; animation: fx-sun 1.5s ease-out forwards; }
@keyframes fx-sun {
  0% { opacity: 0; transform: scale(.2); }
  30% { opacity: 1; transform: scale(1.1); }
  70% { opacity: 1; transform: scale(1) rotate(30deg); }
  100% { opacity: 0; transform: scale(1.2) rotate(45deg); }
}
.fx-fall { opacity: 0; animation: fx-fall .6s cubic-bezier(.5,0,.8,.6) forwards, fx-fade .4s 1.1s forwards; animation-delay: var(--d), calc(var(--d) + 1s); }
@keyframes fx-fall { from { opacity: 0; transform: translateY(-48px); } 30% { opacity: 1; } to { opacity: 1; transform: none; } }
@keyframes fx-fade { to { opacity: 0; } }
.fx-splash { transform-box: fill-box; transform-origin: center; opacity: 0; animation: fx-splash .6s ease-out forwards; animation-delay: var(--d); }
@keyframes fx-splash { from { opacity: .9; transform: scale(.2); } to { opacity: 0; transform: scale(1.6); } }
.fx-basket {
  display: grid; place-items: center; width: 40%; aspect-ratio: 1; border-radius: 50%;
  background: #fff; color: var(--orange); box-shadow: 0 4px 12px rgba(0,0,0,.25);
  animation: check-pop .45s cubic-bezier(.2,.8,.3,1.5);
}
.fx-basket .i { width: 55%; height: 55%; }
.phase-chip.is-new { animation: check-pop .45s cubic-bezier(.2,.8,.3,1.5); }

/* ---------- Android / iOS apps (html.is-native, see platform.js) ---------- */
/* The app is drawn behind the status bar: keep the content clear of it. */
.is-native .main { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
@media (min-width: 760px) { .is-native .main { padding-top: calc(24px + env(safe-area-inset-top, 0px)); } }

/* iPhone and iPad zoom in on form fields with text under 16px, so fields are at least 16px there (-webkit-touch-callout only exists on iOS). */
@supports (-webkit-touch-callout: none) { input:not([type='checkbox']):not([type='radio']), select, textarea { font-size: max(16px, 1em); } }
