/* Planter — warm paper, deep green, terracotta. Mobile first. */
:root {
  --paper: #f3efe4;
  --paper-2: #e9e3d3;
  --card: #fbf9f3;
  --ink: #1d2a22;
  --ink-2: #5c6a60;
  --line: #d9d2bf;
  --green: #1f3a2b;
  --leaf: #3f7a52;
  --water: #2f6f9e;
  --water-soft: #dce9f1;
  --clay: #c46a44;
  --clay-soft: #f4dfd3;
  --warn: #b7791f;
  --warn-soft: #f5e8c8;
  --display: 'Fraunces', Georgia, serif;
  --body: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  --radius: 18px;
  --on: #fff;
  --tabs-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131a16; --paper-2: #1c2620; --card: #19221d; --ink: #e9e6db; --ink-2: #9aa79d; --line: #2c3a31;
    --green: #0e1611; --leaf: #7dbd8f; --water: #7bb6de; --water-soft: #1c303d; --clay: #e08e68; --clay-soft: #3a251c;
    --warn: #e0b057; --warn-soft: #3a3019; --on: #0f1712;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.45; }
body { min-height: 100dvh; overscroll-behavior-y: none; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; margin: 0; line-height: 1.15; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1.05rem; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.app { max-width: 620px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top) + 14px) 18px 10px; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand-mark { width: 16px; height: 16px; border-radius: 0 60% 0 60%; background: var(--leaf); transform: rotate(-8deg); }
.brand-name { font-family: var(--display); font-size: 1.35rem; font-weight: 500; }
.topbar-date { color: var(--ink-2); font-size: .88rem; }
.view { flex: 1; padding: 6px 16px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 28px); display: flex; flex-direction: column; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center; background: color-mix(in oklab, var(--paper) 92%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tab { flex: 1; max-width: 155px; height: var(--tabs-h); border: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-2); font-size: .72rem; font-weight: 500; position: relative; }
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { color: var(--leaf); }
.tab .dot { position: absolute; top: 9px; left: calc(50% + 7px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--water); color: var(--on); font-size: .68rem; line-height: 17px; font-weight: 600; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section { display: flex; align-items: baseline; justify-content: space-between; margin: 8px 2px -4px; }
.section h2 { font-size: 1.3rem; }
.section .count { color: var(--ink-2); font-size: .85rem; }
.muted { color: var(--ink-2); }
.tiny { color: var(--ink-2); font-size: .8rem; margin-top: 8px; }
.empty { text-align: center; padding: 34px 18px; }
.empty h3 { font-size: 1.35rem; margin-bottom: 6px; }
.empty .big { font-size: 2.4rem; display: block; margin-bottom: 8px; }

.btn { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 10px 18px; font-weight: 600; font-size: .95rem; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--leaf); border-color: var(--leaf); color: var(--on); }
.btn.water { background: var(--water); border-color: var(--water); color: var(--on); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--clay); border-color: color-mix(in oklab, var(--clay) 45%, var(--line)); }
.btn.small { min-height: 34px; padding: 5px 13px; font-size: .84rem; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; }
.link { border: 0; background: none; padding: 0; color: var(--leaf); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > .grow { flex: 1; }

/* plant rows on Today */
.due { display: flex; flex-direction: column; gap: 10px; }
.plant-row { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; }
.plant-row .info { min-width: 0; }
.plant-row .name { font-family: var(--display); font-size: 1.12rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plant-row .sub { color: var(--ink-2); font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plant-row .actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.plant-row .actions .btn { flex: 1; padding: 8px 10px; }
.plant-row .actions .btn.icon { flex: 0 0 52px; }
.plant-row.soon { grid-template-columns: 48px 1fr auto; padding: 8px 12px 8px 8px; }
.thumb { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; background: var(--paper-2); display: grid; place-items: center; font-size: 1.6rem; flex: none; border: 0; padding: 0; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.soon .thumb { width: 48px; height: 48px; border-radius: 12px; font-size: 1.2rem; }

.pill { display: inline-block; font-size: .74rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); white-space: nowrap; }
.pill.water { background: var(--water-soft); color: var(--water); }
.pill.late { background: var(--clay-soft); color: var(--clay); }
.pill.ok { background: color-mix(in oklab, var(--leaf) 16%, transparent); color: var(--leaf); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.ai { background: var(--paper-2); color: var(--ink-2); }
.pill.ai::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--leaf); margin-right: 6px; animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.7); } }

.task { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; padding-top: 2px; }
.task:last-child { padding-bottom: 2px; }
.task .check { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--leaf); background: none; display: grid; place-items: center; color: var(--on); font-size: .9rem; }
.task .check.done { background: var(--leaf); }
.task .what { flex: 1; min-width: 0; }
.task .who { color: var(--ink-2); font-size: .8rem; }

/* plant grid */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 520px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.tile { border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); padding: 0; overflow: hidden; text-align: left; display: flex; flex-direction: column; }
.tile .pic { aspect-ratio: 1; background: var(--paper-2); display: grid; place-items: center; font-size: 2.4rem; position: relative; }
.tile .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .pic .pill { position: absolute; left: 8px; bottom: 8px; background: color-mix(in oklab, var(--card) 88%, transparent); backdrop-filter: blur(6px); }
.tile .pic .pill.late { color: var(--clay); }
.tile .pic .pill.water { color: var(--water); }
.tile .pic .flag { position: absolute; right: 8px; top: 8px; }
.tile .cap { padding: 9px 12px 11px; min-width: 0; }
.tile .cap .name { font-family: var(--display); font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .cap .sub { color: var(--ink-2); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fab { position: fixed; right: max(16px, calc(50% - 294px)); bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 14px); z-index: 4; box-shadow: 0 6px 18px rgb(0 0 0 / .18); }

/* plant page */
.hero { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--paper-2); aspect-ratio: 4 / 3; display: grid; place-items: center; font-size: 4rem; }
.hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.back { align-self: flex-start; margin-bottom: -4px; }
.title h1 { font-size: 1.9rem; }
.title .latin { color: var(--ink-2); font-style: italic; }
.message { border-left: 3px solid var(--leaf); padding: 2px 0 2px 12px; }
.care { display: grid; gap: 12px; }
.care dt { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.care dd { margin: 1px 0 0; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.facts div { background: var(--paper-2); border-radius: 12px; padding: 9px 4px; }
.facts b { display: block; font-family: var(--display); font-size: 1.35rem; font-weight: 500; }
.facts span { font-size: .74rem; color: var(--ink-2); }
.strip { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.strip button { flex: none; width: 84px; height: 84px; border-radius: 12px; border: 0; padding: 0; overflow: hidden; background: var(--paper-2); }
.strip img { width: 100%; height: 100%; object-fit: cover; }
.log { list-style: none; margin: 0; padding: 0; }
.log li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.log li:first-child { border-top: 0; }
.log .when { color: var(--ink-2); font-size: .8rem; }

/* forms */
label.field { display: block; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
label.field > input, label.field > select, label.field > textarea { display: block; width: 100%; margin-top: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 11px 13px; font-size: 1rem; font-weight: 400; color: var(--ink); }
textarea { resize: vertical; min-height: 76px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.preview { width: 100%; max-height: 300px; object-fit: cover; border-radius: 14px; display: block; }

.spot { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
.spot:first-child { border-top: 0; }
.spot .name { font-family: var(--display); font-size: 1.08rem; }

.toggle { display: flex; gap: 12px; align-items: flex-start; }
.toggle input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--leaf); flex: none; }
.toggle span { font-weight: 600; }
.toggle small { display: block; font-weight: 400; color: var(--ink-2); font-size: .82rem; }

/* sheet + toast */
.sheet-backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / .4); z-index: 10; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; background: var(--paper); border-radius: 22px 22px 0 0; max-width: 620px; margin: 0 auto; max-height: 92dvh; overflow-y: auto; padding: 8px 18px calc(env(safe-area-inset-bottom) + 20px); animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-handle { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 14px; }
.sheet-body { display: flex; flex-direction: column; gap: 14px; }
.sheet-body h2 { font-size: 1.4rem; }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 18px); transform: translateX(-50%); z-index: 20; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-size: .9rem; display: flex; gap: 14px; align-items: center; max-width: calc(100vw - 32px); box-shadow: 0 6px 20px rgb(0 0 0 / .25); }
.toast button { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; padding: 0; }

/* login */
.login { margin: auto 0; padding: 20px 6px 60px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-size: 2.3rem; }
.login input.code { font-family: var(--display); font-size: 2rem; letter-spacing: .35em; text-align: center; }

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