:root {
  color-scheme: light;
  --bg: #f4f2e9;
  --surface: rgba(255, 255, 252, .92);
  --surface-solid: #fffefa;
  --text: #1d2a23;
  --muted: #6c776f;
  --line: rgba(31, 69, 48, .11);
  --green: #285e42;
  --green-soft: #dce9d9;
  --lime: #cbe27b;
  --sand: #e8dcc4;
  --danger: #a73e38;
  --shadow: 0 14px 42px rgba(38, 59, 44, .09);
  --radius: 28px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121814;
  --surface: rgba(30, 39, 33, .94);
  --surface-solid: #1c261f;
  --text: #edf2ea;
  --muted: #a5afa8;
  --line: rgba(225, 242, 226, .1);
  --green: #9bd0a8;
  --green-soft: #293d2d;
  --lime: #a7c75c;
  --sand: #473f31;
  --danger: #f18a82;
  --shadow: 0 18px 50px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 85% 2%, color-mix(in srgb, var(--lime) 22%, transparent), transparent 27rem),
    var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, a { touch-action: manipulation; }
img { display: block; max-width: 100%; }

.app-shell { width: min(100%, 760px); min-height: 100dvh; margin: auto; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  height: calc(64px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 20px 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 10px; border: 0; background: none; font-weight: 750; font-size: 17px; padding: 6px 0; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 11px 11px 11px 3px; background: var(--green); color: var(--bg); font-family: Georgia, serif; font-style: italic; }
.icon-button { width: 44px; height: 44px; border: 1px solid var(--line); background: var(--surface); border-radius: 50%; font-size: 20px; box-shadow: 0 5px 20px rgba(0,0,0,.04); }

main { padding: 20px 18px calc(104px + env(safe-area-inset-bottom)); outline: none; }
.page { animation: rise .32s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(7px); } }
.eyebrow { margin: 0 0 5px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 0; font: 500 clamp(34px, 10vw, 50px)/1.05 Georgia, "Times New Roman", serif; letter-spacing: -.035em; }
h2 { margin: 0; font: 500 26px/1.15 Georgia, serif; letter-spacing: -.02em; }
h3 { margin: 0; font-size: 16px; }
p { margin: 0; }
.subtitle { margin-top: 10px; color: var(--muted); max-width: 38rem; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin: 30px 2px 14px; }
.section-heading p { color: var(--muted); font-size: 13px; }
.section-heading button { border: 0; background: none; color: var(--green); font-weight: 750; padding: 8px 0; }

.hero-card {
  position: relative; overflow: hidden; margin-top: 24px; padding: 25px;
  min-height: 185px; border-radius: 34px; color: #f6fbf4;
  background: linear-gradient(135deg, #183d2b, #356f4d);
  box-shadow: 0 20px 48px rgba(23, 61, 42, .2);
}
.hero-card::after { content: ""; position: absolute; width: 180px; height: 180px; right: -55px; top: -60px; border: 34px solid rgba(203,226,123,.18); border-radius: 50% 48% 52% 40%; transform: rotate(-24deg); }
.hero-number { margin-top: 18px; font: 500 53px/1 Georgia, serif; }
.hero-card p { color: rgba(255,255,255,.72); }
.hero-card .primary { margin-top: 18px; background: var(--lime); color: #183522; }

.primary, .secondary, .danger-button {
  min-height: 48px; border: 0; border-radius: 16px; padding: 12px 18px; font-weight: 780;
}
.primary { background: var(--green); color: var(--bg); }
.secondary { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.danger-button { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.full { width: 100%; }
.button-row { display: flex; gap: 10px; }
.button-row > * { flex: 1; }

.task-list, .timeline, .settings-list { display: grid; gap: 10px; }
.task-card, .setting-row {
  display: flex; align-items: center; gap: 13px; min-height: 68px; padding: 13px 15px;
  border: 1px solid var(--line); border-radius: 21px; background: var(--surface); box-shadow: 0 8px 28px rgba(44,62,48,.035);
}
.check {
  flex: 0 0 auto; display: grid; place-items: center; width: 30px; height: 30px;
  border: 1.5px solid color-mix(in srgb, var(--green) 42%, transparent); border-radius: 10px; background: transparent;
}
.task-icon { display: grid; place-items: center; width: 41px; height: 41px; border-radius: 14px; background: var(--green-soft); font-size: 19px; }
.task-copy { min-width: 0; flex: 1; }
.task-copy strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-copy small { color: var(--muted); }
.task-card.done { opacity: .52; }
.task-card.done strong { text-decoration: line-through; }
.completed-check { background: var(--green); color: var(--bg); border-color: var(--green); font-weight: 800; }
.task-delete { flex: 0 0 auto; width: 38px; height: 38px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font-size: 19px; }
.task-delete:active { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

.outdoor-card { overflow: hidden; padding: 20px; border: 1px solid var(--line); border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); }
.outdoor-card.running { color: #f6fbf4; background: linear-gradient(135deg, #193f2b, #326c4a); }
.outdoor-card.running .secondary { border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.1); color: white; }
.outdoor-card.running .primary { background: var(--lime); color: #173522; }
.outdoor-card.finished { border-color: color-mix(in srgb, var(--lime) 55%, var(--line)); background: linear-gradient(145deg, var(--surface-solid), color-mix(in srgb, var(--lime) 20%, var(--surface))); }
.outdoor-heading, .timer-live { display: flex; align-items: center; gap: 14px; }
.outdoor-heading p, .timer-live p { color: var(--muted); font-size: 13px; }
.running .timer-live p { color: rgba(255,255,255,.7); }
.outdoor-icon { display: grid; place-items: center; flex: 0 0 auto; width: 55px; height: 55px; border-radius: 19px; background: var(--green-soft); font-size: 26px; }
.pulse { animation: bellPulse 1.35s ease-in-out infinite; }
@keyframes bellPulse { 50% { transform: rotate(8deg) scale(1.08); } }
.timer-slider { margin: 19px 0; }
.timer-slider > div:first-child, .range-labels { display: flex; align-items: center; justify-content: space-between; }
.timer-slider span, .timer-slider output { font-weight: 750; }
.timer-slider output { padding: 4px 9px; border-radius: 9px; background: var(--green-soft); color: var(--green); }
.running .timer-slider output { background: rgba(255,255,255,.13); color: white; }
.timer-slider input { width: 100%; margin: 14px 0 4px; accent-color: var(--lime); }
.range-labels { color: var(--muted); }
.running .range-labels { color: rgba(255,255,255,.58); }
.timer-start { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 54px; border: 0; border-radius: 18px; background: var(--green); color: var(--bg); font-weight: 800; }
.timer-start span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: rgba(255,255,255,.16); }
.timer-live { margin-bottom: 10px; }
.timer-ring { --remaining:100%; display: grid; place-items: center; flex: 0 0 auto; width: 94px; height: 94px; border-radius: 50%; background: radial-gradient(circle at center, #244f37 59%, transparent 61%), conic-gradient(var(--lime) var(--remaining), rgba(255,255,255,.14) 0); }
.timer-ring span { font: 600 23px/1 Georgia, serif; font-variant-numeric: tabular-nums; }

.plant-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.plant-card { position: relative; overflow: hidden; min-height: 228px; border: 0; border-radius: 25px; padding: 0; text-align: left; background: var(--surface-solid); box-shadow: var(--shadow); }
.plant-photo { width: 100%; aspect-ratio: 1.12; object-fit: cover; background: linear-gradient(145deg, var(--green-soft), var(--sand)); }
.plant-placeholder { display: grid; place-items: center; width: 100%; aspect-ratio: 1.12; background: linear-gradient(145deg, var(--green-soft), var(--sand)); font-size: 48px; }
.plant-card-copy { padding: 13px 14px 15px; }
.plant-card-copy strong { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plant-card-copy small { color: var(--muted); }
.status-badge { position: absolute; top: 11px; right: 11px; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.6); background: rgba(255,255,255,.82); border-radius: 13px; box-shadow: 0 4px 15px rgba(0,0,0,.08); backdrop-filter: blur(8px); }
.fab { position: fixed; right: max(20px, calc((100vw - 740px)/2)); bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 15; width: 56px; height: 56px; border: 0; border-radius: 19px; background: var(--green); color: var(--bg); font-size: 29px; box-shadow: 0 12px 30px rgba(34,82,55,.3); }

.empty { padding: 42px 24px; border: 1px dashed color-mix(in srgb, var(--green) 27%, transparent); border-radius: 27px; text-align: center; background: color-mix(in srgb, var(--surface) 65%, transparent); }
.empty-icon { font-size: 44px; margin-bottom: 12px; }
.empty p { margin: 7px auto 18px; color: var(--muted); max-width: 260px; }

.detail-hero { position: relative; margin: -20px -18px 0; }
.detail-photo, .detail-placeholder { width: 100%; height: min(52vh, 430px); object-fit: cover; background: linear-gradient(145deg, #ceddc4, #e9d9bd); }
.detail-placeholder { display: grid; place-items: center; font-size: 82px; }
.back-button { position: absolute; top: 14px; left: 18px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255,255,255,.88); color: #203127; font-size: 22px; box-shadow: 0 7px 20px rgba(0,0,0,.12); }
.detail-status { position: absolute; right: 18px; bottom: -20px; display: grid; place-items: center; width: 62px; height: 62px; background: var(--surface-solid); border: 6px solid var(--bg); border-radius: 22px; font-size: 27px; }
.detail-title { padding-top: 25px; }
.detail-title .latin { margin-top: 5px; color: var(--muted); font-family: Georgia, serif; font-style: italic; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 17px 0 4px; scrollbar-width: none; }
.chip { flex: none; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px; }
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 20px; }
.quick-action { min-height: 76px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); font-weight: 700; }
.quick-action span { display: block; margin-bottom: 5px; font-size: 22px; }
.measurement-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.measurement { display: grid; grid-template-columns: auto 1fr; gap: 2px 9px; align-items: center; padding: 15px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.measurement > span { grid-row: span 2; font-size: 24px; }
.measurement small { color: var(--muted); }
.measurement strong { font-size: 15px; }
.notes { padding: 17px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); white-space: pre-wrap; }
.timeline-item { display: grid; grid-template-columns: 42px 1fr; gap: 12px; }
.timeline-marker { display: grid; place-items: center; align-self: start; width: 42px; height: 42px; border-radius: 15px; background: var(--green-soft); }
.timeline-body { padding: 2px 0 18px; border-bottom: 1px solid var(--line); }
.timeline-body time { color: var(--muted); font-size: 12px; }
.timeline-body p { margin-top: 4px; color: var(--muted); }
.timeline-photo { width: 100%; max-height: 280px; margin-top: 10px; border-radius: 17px; object-fit: cover; }

.bottom-nav {
  position: fixed; left: 50%; bottom: 0; z-index: 25; transform: translateX(-50%);
  display: grid; grid-template-columns: repeat(4, 1fr); width: min(100%, 760px);
  height: calc(70px + env(safe-area-inset-bottom)); padding: 7px 12px env(safe-area-inset-bottom);
  border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface-solid) 88%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.nav-item { border: 0; border-radius: 15px; background: none; color: var(--muted); }
.nav-item span { display: block; height: 26px; font-size: 21px; }
.nav-item small { font-size: 10px; font-weight: 750; }
.nav-item.active { color: var(--green); background: var(--green-soft); }

dialog { width: min(calc(100% - 20px), 560px); max-height: calc(100dvh - 20px); margin: auto auto 10px; padding: 0; border: 0; border-radius: 30px; color: var(--text); background: var(--surface-solid); box-shadow: 0 20px 80px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(13,25,17,.5); backdrop-filter: blur(4px); }
.modal-inner { padding: 23px 20px calc(24px + env(safe-area-inset-bottom)); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header button { width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--green-soft); font-size: 20px; }
.form-grid { display: grid; gap: 15px; }
.field { display: grid; gap: 7px; }
.field label { color: var(--muted); font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.field input, .field textarea, .field select { width: 100%; min-height: 49px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 15px; outline: none; color: var(--text); background: var(--bg); }
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 13%, transparent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.file-drop { display: grid; place-items: center; min-height: 130px; padding: 18px; border: 1.5px dashed color-mix(in srgb, var(--green) 36%, transparent); border-radius: 20px; background: var(--green-soft); text-align: center; }
.file-drop input { position: absolute; opacity: 0; pointer-events: none; }
.sensor-connect { display: grid; grid-template-columns: auto 1fr; gap: 11px; align-items: center; padding: 15px; border: 1px solid var(--line); border-radius: 21px; background: var(--surface); }
.sensor-connect > button { grid-column: 1 / -1; }
.sensor-connect p { color: var(--muted); font-size: 13px; }
.sensor-orb { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 17px; background: var(--green-soft); font-size: 22px; }
.compat-note { padding: 13px 14px; border-radius: 15px; background: color-mix(in srgb, #d99d43 16%, var(--surface)); color: var(--muted); font-size: 13px; }
.auth-page { display: grid; align-content: center; min-height: calc(100dvh - 40px); max-width: 430px; margin: auto; }
.auth-brand { margin-bottom: 24px; text-align: center; }
.auth-brand .subtitle { margin-left: auto; margin-right: auto; }
.auth-leaf { display: grid; place-items: center; width: 74px; height: 74px; margin: 0 auto 18px; border-radius: 26px 26px 26px 8px; background: var(--green); font-size: 34px; box-shadow: var(--shadow); }
.auth-card { display: grid; gap: 16px; padding: 22px; border: 1px solid var(--line); border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); }
.auth-note { color: var(--muted); font-size: 12px; text-align: center; }
.locked .topbar, .locked .bottom-nav { display: none; }
.locked main { padding-bottom: 20px; }

.setting-row { justify-content: space-between; }
.setting-copy strong { display: block; }
.setting-copy small { color: var(--muted); }
.setting-row button { flex: none; }
.danger-zone { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--line); }
#toast { position: fixed; left: 50%; bottom: calc(85px + env(safe-area-inset-bottom)); z-index: 60; transform: translate(-50%, 18px); max-width: calc(100% - 40px); padding: 11px 16px; border-radius: 14px; background: #173326; color: white; opacity: 0; pointer-events: none; transition: .25s ease; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.offline { padding: 9px 13px; margin-bottom: 15px; border-radius: 14px; background: #8f5c24; color: white; text-align: center; font-size: 13px; }

@media (min-width: 620px) {
  main { padding-left: 28px; padding-right: 28px; }
  .plant-grid { grid-template-columns: repeat(3, 1fr); }
  dialog { margin: auto; }
  .detail-hero { margin-left: 0; margin-right: 0; }
  .detail-photo, .detail-placeholder { border-radius: 30px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
