/* Plants – herbarium-modern design system */
:root {
  --bg: #f4f2eb;
  --surface: #ffffff;
  --surface-2: #eceee5;
  --surface-3: #e3e7dc;
  --ink: #1b2a21;
  --ink-2: #3a4a3f;
  --muted: #6a7466;
  --line: #e1dfd5;
  --brand: #2f6b47;
  --brand-ink: #ffffff;
  --brand-2: #4c9a68;
  --brand-soft: #dcebdc;
  --accent: #e3a33a;
  --accent-soft: #fbefd8;
  --water: #2f7fc1;
  --water-soft: #dcebf7;
  --danger: #c2512f;
  --danger-soft: #f8e2d9;
  --warn: #b97b0c;
  --warn-soft: #fbefd2;
  --ok: #2f8a52;
  --ok-soft: #dcf0e1;
  --frost: #3d7fb8;
  --frost-soft: #e2eef9;
  --shadow: 0 1px 2px rgba(27, 42, 33, .06), 0 6px 24px rgba(27, 42, 33, .07);
  --shadow-lg: 0 10px 40px rgba(27, 42, 33, .18);
  --radius: 18px;
  --radius-sm: 12px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1511; --surface: #16201a; --surface-2: #1c2821; --surface-3: #233229; --ink: #e5ece5; --ink-2: #c3cec4;
    --muted: #93a195; --line: #29372e; --brand: #6cc08b; --brand-ink: #0c1a11; --brand-2: #8fd3a7; --brand-soft: #1d3626;
    --accent: #f0b85a; --accent-soft: #3a2f1a; --water: #69aee6; --water-soft: #16293a; --danger: #ec8a66;
    --danger-soft: #3b211a; --warn: #f1c25a; --warn-soft: #3a3019; --ok: #6cc08b; --ok-soft: #1a3324; --frost: #8cc0ee;
    --frost-soft: #182a3b; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 26px rgba(0, 0, 0, .35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1511; --surface: #16201a; --surface-2: #1c2821; --surface-3: #233229; --ink: #e5ece5; --ink-2: #c3cec4;
  --muted: #93a195; --line: #29372e; --brand: #6cc08b; --brand-ink: #0c1a11; --brand-2: #8fd3a7; --brand-soft: #1d3626;
  --accent: #f0b85a; --accent-soft: #3a2f1a; --water: #69aee6; --water-soft: #16293a; --danger: #ec8a66;
  --danger-soft: #3b211a; --warn: #f1c25a; --warn-soft: #3a3019; --ok: #6cc08b; --ok-soft: #1a3324; --frost: #8cc0ee;
  --frost-soft: #182a3b; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 26px rgba(0, 0, 0, .35); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 750; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .6em; }
.latin { font-family: var(--serif); font-style: italic; letter-spacing: .005em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: .6rem; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.grow { flex: 1; min-width: 0; }
.hide { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ic { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- layout ---------- */
#app { min-height: 100vh; min-height: 100dvh; }
.view { max-width: 760px; margin: 0 auto; padding: calc(16px + var(--safe-t)) 16px calc(var(--tabbar-h) + 32px + var(--safe-b)); }
.view.flush { padding: 0 0 calc(var(--tabbar-h) + 32px + var(--safe-b)); max-width: 760px; }
.view.full { padding: 0; max-width: none; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 10px 0 18px; }
.pagehead .eyebrow { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; }
.section { margin: 26px 0 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.section h2 { font-size: 1.05rem; }
.section .count { color: var(--muted); font-weight: 600; font-size: .9rem; }

/* ---------- tab bar ---------- */
#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b); background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--line); display: flex; justify-content: center;
}
#tabbar .inner { width: 100%; max-width: 560px; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; }
#tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); font-size: .7rem; font-weight: 600; padding: 8px 0; position: relative; }
#tabbar a .ic { width: 24px; height: 24px; }
#tabbar a.active { color: var(--brand); }
#tabbar a .dot { position: absolute; top: 4px; left: calc(50% + 8px); min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .68rem; line-height: 17px; text-align: center; }
#tabbar a.scan { color: var(--brand-ink); }
#tabbar a.scan span.btn-scan { width: 58px; height: 58px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; margin-top: -26px; box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 45%, transparent); border: 4px solid var(--bg); }
#tabbar a.scan span.btn-scan .ic { width: 26px; height: 26px; }
#tabbar a.scan span.lbl { color: var(--muted); }
#tabbar a.scan.active span.lbl { color: var(--brand); }
@media (min-width: 980px) {
  #tabbar { top: 0; bottom: 0; right: auto; width: 92px; height: auto; border-top: 0; border-right: 1px solid var(--line); padding: 24px 0; }
  #tabbar .inner { grid-template-columns: 1fr; grid-auto-rows: 84px; align-content: start; }
  #tabbar a.scan span.btn-scan { margin-top: 0; }
  .view, .view.flush { padding-left: 120px; max-width: 880px; }
  body.no-tabbar .view { padding-left: 16px; }
}
body.no-tabbar #tabbar { display: none; }

/* ---------- cards & surfaces ---------- */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card + .card { margin-top: 12px; }
.card h3 { margin-bottom: 6px; }
.list { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list > :not(:first-child) { border-top: 1px solid var(--line) !important; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 64px; color: inherit; }
a.item:active, button.item:active { background: var(--surface-2); }
.item .thumb { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; background: var(--surface-2); flex: none; display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.item .thumb.round { border-radius: 50%; }
.item .title { font-weight: 650; line-height: 1.25; }
.item .sub { color: var(--muted); font-size: .85rem; line-height: 1.3; }
.item .chev { color: var(--muted); }
button.item { width: 100%; background: none; border: 0; text-align: left; cursor: pointer; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 46px; padding: 0 18px; border-radius: 999px; border: 0; cursor: pointer; font-weight: 650; background: var(--surface-2); color: var(--ink); transition: transform .08s ease, background .2s; text-decoration: none; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.water { background: var(--water); color: #fff; }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.ghost { background: transparent; color: var(--brand); padding: 0 10px; }
.btn.outline { background: transparent; border: 1.5px solid var(--line); }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: .9rem; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.iconbtn { width: 42px; height: 42px; border-radius: 50%; display: inline-grid; place-items: center; border: 0; background: var(--surface-2); color: var(--ink); cursor: pointer; flex: none; }
.iconbtn.glass { background: rgba(0, 0, 0, .38); color: #fff; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.iconbtn.check { width: 46px; height: 46px; border: 2px solid var(--line); background: transparent; color: transparent; transition: all .2s; }
.iconbtn.check.water { border-color: color-mix(in srgb, var(--water) 45%, transparent); color: var(--water); }
.iconbtn.check .ic { width: 22px; height: 22px; }
.iconbtn.check.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.fab { position: fixed; right: max(18px, calc(50% - 360px)); bottom: calc(var(--tabbar-h) + 18px + var(--safe-b)); z-index: 30; width: 58px; height: 58px; border-radius: 20px; border: 0; background: var(--ink); color: var(--bg); display: grid; place-items: center; box-shadow: var(--shadow-lg); cursor: pointer; }
.fab .ic { width: 26px; height: 26px; }

/* ---------- chips, badges, pills ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 6px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); font-weight: 600; font-size: .9rem; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip .n { color: var(--muted); font-weight: 600; }
.chip.on .n { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); line-height: 1.6; white-space: nowrap; }
.badge .ic { width: 14px; height: 14px; }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.water { background: var(--water-soft); color: var(--water); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.frost { background: var(--frost-soft); color: var(--frost); }
.pill-status { position: absolute; top: 10px; left: 10px; }

/* ---------- forms ---------- */
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: .85rem; font-weight: 650; color: var(--ink-2); margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface); outline: none; transition: border-color .15s; }
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { border-color: var(--brand); }
.search { position: relative; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 44px; border-radius: 999px; background: var(--surface); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; min-height: 60px; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); transition: background .2s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(20px); }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 999px; font-weight: 650; font-size: .9rem; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .1); }
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.months span { text-align: center; font-size: .7rem; font-weight: 700; padding: 6px 0; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.months span.on { background: var(--brand); color: var(--brand-ink); }
.months.pick span { cursor: pointer; }
.error { color: var(--danger); font-size: .9rem; margin: 6px 0; }

/* ---------- banners ---------- */
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); margin: 12px 0; font-size: .95rem; }
.banner .ic { width: 22px; height: 22px; margin-top: 1px; }
.banner.frost { background: var(--frost-soft); color: var(--ink); }
.banner.frost .ic { color: var(--frost); }
.banner.warn { background: var(--warn-soft); }
.banner.warn .ic { color: var(--warn); }
.banner.danger { background: var(--danger-soft); }
.banner.danger .ic { color: var(--danger); }
.banner.info { background: var(--surface-2); }
.banner.ok { background: var(--ok-soft); }
.banner.ok .ic { color: var(--ok); }
.banner b { font-weight: 700; }

/* ---------- today ---------- */
.hello h1 { font-size: 1.9rem; }
.weather-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); font-weight: 650; font-size: .9rem; }
.summary-card { display: flex; align-items: center; gap: 16px; padding: 18px; border-radius: var(--radius); background: linear-gradient(135deg, #2f6b47 0%, #17402a 100%); color: #fff; margin: 14px 0 6px; overflow: hidden; position: relative; }
.summary-card .big { font-size: 2.6rem; font-weight: 800; line-height: 1; }
.summary-card .leafart { position: absolute; right: -18px; bottom: -22px; width: 140px; height: 140px; opacity: .18; }
.task .kindicon { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.task .kindicon .ic { width: 18px; height: 18px; }
.k-water { background: var(--water-soft); color: var(--water); }
.k-fertilize { background: var(--accent-soft); color: var(--warn); }
.k-mist { background: var(--water-soft); color: var(--water); }
.k-repot { background: var(--brand-soft); color: var(--brand); }
.k-prune { background: var(--surface-2); color: var(--ink-2); }
.k-rotate, .k-clean, .k-custom { background: var(--surface-2); color: var(--ink-2); }
.task .thumbwrap { position: relative; }
.task .thumbwrap .kindicon { position: absolute; right: -6px; bottom: -6px; width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--surface); }
.task .thumbwrap .kindicon .ic { width: 14px; height: 14px; }
.task.is-done { opacity: .55; }
.task.is-done .title { text-decoration: line-through; }
.late { color: var(--danger); font-weight: 650; }
.raintip { color: var(--water); font-weight: 600; }

/* ---------- garden grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.pcard { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); aspect-ratio: 4 / 5; box-shadow: var(--shadow); color: #fff; display: block; }
.pcard img { width: 100%; height: 100%; object-fit: cover; }
.pcard .noimg { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); }
.pcard .noimg .ic { width: 48px; height: 48px; opacity: .5; }
.pcard .meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 40px 12px 12px; background: linear-gradient(transparent, rgba(0, 0, 0, .72)); }
.pcard .meta .n { font-weight: 750; line-height: 1.2; }
.pcard .meta .s { font-size: .8rem; opacity: .85; }
.pcard .qw { position: absolute; right: 10px; top: 10px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--water); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); cursor: pointer; }
.pcard .stat { position: absolute; left: 10px; top: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 750; background: rgba(255, 255, 255, .92); color: var(--water); }
.pcard .stat.late { color: var(--danger); }
.pcard .stat.ok { color: var(--ok); }
.pcard .stat.rest { color: var(--muted); }

/* ---------- hero (plant / species / scan) ---------- */
.hero { position: relative; background: var(--surface-2); }
.hero .img { width: 100%; aspect-ratio: 4 / 3.4; object-fit: cover; max-height: 62vh; }
.hero .topbar { position: absolute; top: calc(12px + var(--safe-t)); left: 12px; right: 12px; display: flex; justify-content: space-between; z-index: 2; }
.sheetcard { position: relative; margin-top: -28px; border-radius: 24px 24px 0 0; background: var(--bg); padding: 22px 16px 8px; z-index: 1; }
.titleblock h1 { font-size: 1.85rem; }
.titleblock .latin { font-size: 1.1rem; color: var(--ink-2); }
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; background: #000; }
.gallery::-webkit-scrollbar { display: none; }
.gallery figure { margin: 0; flex: 0 0 100%; scroll-snap-align: center; position: relative; }
.gallery img { width: 100%; aspect-ratio: 4 / 3.4; max-height: 62vh; object-fit: cover; }
.gallery figcaption { position: absolute; right: 8px; bottom: 34px; font-size: .68rem; color: rgba(255, 255, 255, .85); background: rgba(0, 0, 0, .45); padding: 2px 8px; border-radius: 6px; max-width: 80%; }
.dots { position: absolute; left: 0; right: 0; bottom: 36px; display: flex; gap: 6px; justify-content: center; z-index: 2; pointer-events: none; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .5); }
.dots i.on { background: #fff; }
.hcount { position: absolute; left: 12px; bottom: 40px; z-index: 2; font-size: .75rem; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .5); padding: 2px 9px; border-radius: 999px; pointer-events: none; }
.photobar { margin: -6px 0 14px; }
.photobar .chips { margin-bottom: 8px; }
.thumbstrip { position: relative; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 16px; margin: 0 -16px; }
.thumbstrip::-webkit-scrollbar { display: none; }
.thumbstrip button { flex: 0 0 64px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: 12px; overflow: hidden; background: var(--surface-2); cursor: pointer; }
.thumbstrip button.on { border-color: var(--brand); }
.thumbstrip img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- facts ---------- */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.facts > *, .tiles > *, .grid > * { min-width: 0; }
.kindicon { display: grid; place-items: center; flex: none; border-radius: 10px; }
.kindicon .ic { width: 20px; height: 20px; }
.fact { background: var(--surface); border-radius: var(--radius-sm); padding: 12px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start; }
.fact .fi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.fact .fi .ic { width: 18px; height: 18px; }
.fact .fl { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; overflow-wrap: anywhere; }
.fact .fv { font-weight: 700; line-height: 1.25; }
.fact .fd { font-size: .8rem; color: var(--muted); line-height: 1.3; margin-top: 2px; }
.f-sun { background: var(--accent-soft); color: var(--warn); }
.f-water { background: var(--water-soft); color: var(--water); }
.f-temp { background: var(--danger-soft); color: var(--danger); }
.f-hum { background: var(--frost-soft); color: var(--frost); }
.f-green { background: var(--brand-soft); color: var(--brand); }
.f-gray { background: var(--surface-2); color: var(--ink-2); }
.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: .95rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }
details.more { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0 16px; margin-top: 12px; }
details.more summary { list-style: none; cursor: pointer; padding: 14px 0; font-weight: 650; display: flex; justify-content: space-between; align-items: center; }
details.more summary::-webkit-details-marker { display: none; }
details.more[open] summary .ic { transform: rotate(180deg); }
details.more .body { padding-bottom: 14px; }
.prose { font-size: .97rem; color: var(--ink-2); }
.prose p { margin-bottom: .7em; }

/* ---------- scan result ---------- */
.conf { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.meter { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.meter.mid i { background: var(--accent); }
.meter.low i { background: var(--danger); }
.compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.compare figure { margin: 0; position: relative; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); aspect-ratio: 1; }
.compare img { width: 100%; height: 100%; object-fit: cover; }
.compare figcaption { position: absolute; left: 8px; bottom: 8px; font-size: .72rem; font-weight: 700; background: rgba(0, 0, 0, .55); color: #fff; padding: 2px 8px; border-radius: 6px; }
.refstrip { display: flex; gap: 8px; overflow-x: auto; margin-top: 8px; scrollbar-width: none; }
.refstrip img { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; flex: none; }
.health { border-left: 4px solid var(--ok); }
.health.attention { border-left-color: var(--accent); }
.health.sick { border-left-color: var(--danger); }
.issue { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; margin-top: 10px; }
.issue summary { cursor: pointer; list-style: none; display: flex; gap: 10px; align-items: center; }
.issue summary::-webkit-details-marker { display: none; }
.issue img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; }
.issue .ib { margin-top: 10px; font-size: .93rem; }
.issue .ib h4 { margin: 10px 0 2px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.subjects { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 14px; padding: 2px 16px 4px; scrollbar-width: none; }
.subjects::-webkit-scrollbar { display: none; }
.pickhead { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.subj { flex: 0 0 132px; display: flex; flex-direction: column; gap: 4px; padding: 6px; border-radius: 16px; border: 2px solid var(--line);
  background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.subj.on { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.subj img, .subj .noimg { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 11px; background: var(--surface-2); display: grid; place-items: center; }
.subj .t { font-weight: 800; font-size: .85rem; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.subj .g { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; color: var(--muted); font-weight: 700; }
.subj .g .ic { width: 12px; height: 12px; }
.stickybar { position: sticky; bottom: calc(var(--tabbar-h) + 10px + var(--safe-b)); display: flex; gap: 10px; padding: 10px 0; z-index: 5; }
.stickybar .btn { box-shadow: var(--shadow-lg); }

/* processing */
.scanning { position: relative; overflow: hidden; border-radius: var(--radius); background: #000; }
.scanning img { width: 100%; aspect-ratio: 1; object-fit: cover; opacity: .85; }
.scanning::after { content: ""; position: absolute; left: 0; right: 0; height: 36%; top: -36%; background: linear-gradient(transparent, color-mix(in srgb, var(--brand-2) 55%, transparent), transparent); animation: sweep 1.8s ease-in-out infinite; }
@keyframes sweep { to { top: 100%; } }
.steps { list-style: none; padding: 0; margin: 18px 0; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 8px 0; color: var(--muted); font-weight: 600; }
.steps li .b { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); flex: none; }
.steps li.done { color: var(--ink); }
.steps li.done .b { background: var(--ok); border-color: var(--ok); color: #fff; }
.steps li.now { color: var(--ink); }
.steps li.now .b { border-color: var(--brand); border-top-color: transparent; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- camera ---------- */
.cam { position: fixed; inset: 0; background: #000; z-index: 60; display: flex; flex-direction: column; color: #fff; }
.cam video, .cam .fallback { flex: 1; width: 100%; object-fit: cover; min-height: 0; }
.cam .fallback { display: grid; place-items: center; padding: 24px; text-align: center; background: radial-gradient(circle at 50% 30%, #1f3a29, #050806); }
.cam .top { position: absolute; top: 0; left: 0; right: 0; padding: calc(12px + var(--safe-t)) 14px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: linear-gradient(rgba(0, 0, 0, .55), transparent); z-index: 2; }
.cam .seg { background: rgba(255, 255, 255, .16); }
.cam .seg button { color: rgba(255, 255, 255, .85); }
.cam .seg button.on { background: #fff; color: #111; }
.cam .frame { position: absolute; inset: 18% 10% 30%; border-radius: 28px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .18); border: 2px solid rgba(255, 255, 255, .55); }
.cam .hint { position: absolute; left: 0; right: 0; bottom: calc(176px + var(--safe-b)); text-align: center; font-size: .9rem; font-weight: 600; text-shadow: 0 1px 6px rgba(0, 0, 0, .7); padding: 0 24px; }
.cam .bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 18px calc(22px + var(--safe-b)); background: linear-gradient(transparent, rgba(0, 0, 0, .7)); }
.cam .tray { display: flex; gap: 8px; min-height: 64px; margin-bottom: 14px; overflow-x: auto; }
.cam .tray .t { position: relative; flex: none; }
.cam .tray img { width: 60px; height: 60px; border-radius: 12px; object-fit: cover; border: 2px solid #fff; }
.cam .tray button { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #fff; color: #000; display: grid; place-items: center; padding: 0; }
.cam .tray button .ic { width: 14px; height: 14px; }
.cam .controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.cam .shutter { width: 78px; height: 78px; border-radius: 50%; border: 5px solid #fff; background: rgba(255, 255, 255, .25); cursor: pointer; transition: transform .1s; }
.cam .shutter:active { transform: scale(.92); background: #fff; }
.cam .go { justify-self: end; }
.cam .go .btn { background: var(--brand-2); color: #06140b; }
.cam .flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 3; }
.cam .flash.on { opacity: .8; transition: none; }

/* ---------- sheet / modal / toast ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(10, 18, 13, .45); z-index: 80; opacity: 0; transition: opacity .2s; }
.backdrop.on { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 81; max-height: 92vh; overflow-y: auto; background: var(--bg); border-radius: 24px 24px 0 0; padding: 10px 18px calc(22px + var(--safe-b)); transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); max-width: 640px; margin: 0 auto; box-shadow: var(--shadow-lg); }
.sheet.on { transform: translateY(0); }
.sheet .grab { width: 42px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 0 auto 14px; }
.sheet h2 { margin-bottom: 14px; }
@media (min-width: 700px) { .sheet { bottom: 50%; border-radius: 24px; transform: translateY(60%); opacity: 0; transition: transform .25s, opacity .2s; } .sheet.on { transform: translateY(50%); opacity: 1; } }
#toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 18px + var(--safe-b)); transform: translate(-50%, 20px); z-index: 90; background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; display: flex; gap: 14px; align-items: center; opacity: 0; transition: all .25s; pointer-events: none; max-width: calc(100vw - 32px); box-shadow: var(--shadow-lg); font-weight: 600; font-size: .93rem; }
#toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast button { background: none; border: 0; color: var(--brand-2); font-weight: 800; cursor: pointer; padding: 4px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent), radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--accent) 18%, transparent), transparent), var(--bg); }
.auth .box { width: 100%; max-width: 420px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.35rem; letter-spacing: -.02em; }
.logo .mark { width: 42px; height: 42px; border-radius: 14px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; }
.logo .mark .ic { width: 24px; height: 24px; }
.auth h1 { font-size: 2rem; margin: 28px 0 6px; }
.auth .lead { color: var(--muted); margin-bottom: 22px; }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty .art { width: 120px; height: 120px; margin: 0 auto 14px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; }
.empty .art .ic { width: 52px; height: 52px; }
.empty h3 { color: var(--ink); font-size: 1.15rem; margin-bottom: 6px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(3, 1fr); } }
.tile { position: relative; border-radius: var(--radius); padding: 14px; min-height: 96px; background: var(--surface); box-shadow: var(--shadow); color: var(--ink); display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.tile .ic { width: 26px; height: 26px; color: var(--brand); }
.tile b { font-weight: 700; line-height: 1.2; }
.tile small { color: var(--muted); font-weight: 600; }
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 10px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl { position: relative; padding: 6px 0 14px; }
.tl .dot { position: absolute; left: -26px; top: 6px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line); }
.tl .dot .ic { width: 12px; height: 12px; }
.tl img { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; margin-top: 6px; }
.tl .when { font-size: .8rem; color: var(--muted); }
.warnbox { border-radius: var(--radius); padding: 14px 16px; background: var(--danger-soft); display: flex; gap: 12px; align-items: flex-start; margin: 12px 0; }
.warnbox .ic { color: var(--danger); width: 24px; height: 24px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.tbl th, table.tbl td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.tbl th { color: var(--muted); font-weight: 650; font-size: .8rem; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--brand); animation: spin .8s linear infinite; display: inline-block; }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; flex: none; }
.center-load { display: grid; place-items: center; padding: 60px 0; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.3rem; letter-spacing: .15em; font-weight: 700; }
.attribution { font-size: .72rem; color: var(--muted); }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* light scale */
.lightbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; margin-top: 12px; }
.lightbar .lb { display: flex; flex-direction: column; gap: 5px; align-items: center; }
.lightbar .lb i { display: block; width: 100%; height: 12px; border-radius: 6px; background: var(--surface-3); position: relative; }
.lightbar .lb:nth-child(1) i { opacity: .55; } .lightbar .lb:nth-child(2) i { opacity: .7; } .lightbar .lb:nth-child(3) i { opacity: .85; }
.lightbar .lb.need i { background: color-mix(in srgb, var(--brand) 55%, var(--surface-3)); opacity: 1; }
.lightbar .lb.here i::after { content: ""; position: absolute; left: 50%; top: -3px; width: 18px; height: 18px; margin-left: -9px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 1px 4px rgba(0,0,0,.25); box-sizing: border-box; }
.lightbar .lb span { margin-top: 3px; }
.lightbar .lb span { font-size: .66rem; font-weight: 700; color: var(--muted); text-align: center; line-height: 1.15; }
.lightbar .lb.here span { color: var(--ink); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; color: var(--ink-2); }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: 4px; }
.legend .sw.need { background: color-mix(in srgb, var(--brand) 55%, var(--surface-3)); }
.legend .sw.here { background: var(--accent); border-radius: 50%; }
.light-card { border-left: 4px solid var(--line); }
.light-card.ok { border-left-color: var(--ok); }
.light-card.warn { border-left-color: var(--accent); }
.light-card.danger { border-left-color: var(--danger); }
.hint { color: var(--ink-2); font-size: .82rem; line-height: 1.3; margin-top: 2px; }
.chips-mini { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* camera mode switcher */
.cam .modes { display: flex; gap: 4px; background: rgba(255, 255, 255, .14); border-radius: 18px; padding: 4px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.cam .modes button { border: 0; background: transparent; color: rgba(255, 255, 255, .85); display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 12px; border-radius: 14px; font-weight: 700; font-size: .72rem; cursor: pointer; min-width: 70px; }
.cam .modes button .ic { width: 20px; height: 20px; }
.cam .modes button.on { background: #fff; color: #111; }
.cam .modes button[data-mode="diagnose"].on { color: #b5452e; }
.cam .modeinfo { position: absolute; top: calc(78px + var(--safe-t)); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 2; padding: 0 20px; text-align: center; font-weight: 600; font-size: .9rem; text-shadow: 0 1px 6px rgba(0, 0, 0, .7); }
.cam .plantchip { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: .85rem;
  background: rgba(255, 255, 255, .92); color: #1b2a21; cursor: pointer; text-shadow: none; }
.cam .plantchip .ic { width: 16px; height: 16px; }
.cam .focus { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; text-shadow: none; }
.cam .focus:empty { display: none; }
.cam .focus button { display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: 999px; padding: 6px 11px; font-weight: 700;
  font-size: .78rem; background: rgba(0, 0, 0, .38); color: #fff; cursor: pointer; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.cam .focus button .ic { width: 14px; height: 14px; }
.cam .focus button.on { background: #fff; color: #111; }
.cam .frame { inset: 26% 10% 30%; }
@media (max-width: 380px) { .cam .modes button { min-width: 60px; padding: 6px 8px; } }
.quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 12px 0 4px; }
.quick a { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; color: var(--ink); display: flex; flex-direction: column; gap: 6px; min-height: 92px; }
.quick a .qi { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; }
.quick a .qi .ic { width: 19px; height: 19px; }
.quick a b { font-size: .9rem; line-height: 1.2; }
.quick a small { color: var(--muted); font-size: .75rem; line-height: 1.25; }
.diag-cta { display: flex; gap: 14px; align-items: center; border-radius: var(--radius); padding: 14px; background: var(--danger-soft); color: var(--ink); margin-top: 16px; }
.diag-cta .qi { width: 46px; height: 46px; border-radius: 14px; background: var(--danger); color: #fff; display: grid; place-items: center; flex: none; }

.cam .tray .t { padding-bottom: 18px; }
.cam .tray .part { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); font-size: .62rem; font-weight: 800; white-space: nowrap;
  background: rgba(0, 0, 0, .65); color: #fff; padding: 1px 6px; border-radius: 6px; cursor: pointer; }
.cam .tray .part.set { background: #fff; color: #111; }
.cam .tray { min-height: 84px; }
.cam .hint { bottom: calc(196px + var(--safe-b)); }
.pgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.pgrid button { position: relative; padding: 0; border: 0; border-radius: 12px; overflow: hidden; aspect-ratio: 1; background: var(--surface-2); cursor: pointer; }
.pgrid img { width: 100%; height: 100%; object-fit: cover; }
.pgrid .tag { position: absolute; left: 6px; bottom: 6px; font-size: .66rem; font-weight: 800; background: rgba(0, 0, 0, .6); color: #fff; padding: 1px 6px; border-radius: 6px; }
.pgrid .star { position: absolute; right: 6px; top: 6px; background: var(--accent); color: #fff; border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; }
.pgrid .star .ic { width: 13px; height: 13px; }
.pgrid .add { display: grid; place-items: center; color: var(--brand); background: var(--brand-soft); font-weight: 700; font-size: .8rem; }
.pgrid .slot { background: var(--surface); border: 1.5px dashed var(--line); color: var(--muted); align-content: center; gap: 4px; }
.pgrid .slot span { color: var(--ink-2); }
.pgrid .slot i { position: absolute; right: 6px; top: 6px; color: var(--brand); display: grid; }
.pgrid .slot i .ic { width: 14px; height: 14px; }
.viewer img { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 14px; background: #000; }

/* distribution map */
.rangecard { padding: 12px; }
.worldmap svg { display: block; width: 100%; height: auto; }
.worldmap .land path { fill: var(--surface-3); stroke: var(--bg); stroke-width: .5; stroke-linejoin: round; }
.worldmap .dots circle { fill: var(--brand); fill-opacity: .55; stroke: var(--brand); stroke-width: .8; }
.worldmap .dots circle.cult { fill: none; stroke: var(--muted); stroke-width: 1.2; }
.maplegend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: .72rem; color: var(--muted); }
.maplegend .dot { width: 9px; height: 9px; border-radius: 50%; background: color-mix(in srgb, var(--brand) 55%, transparent); border: 1px solid var(--brand); }
.maplegend .dot.cult { background: none; border: 1.5px solid var(--muted); margin-left: 8px; }
/* "of" divider above the jasperknows login button */
.or { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; color: var(--muted); font-size: .8rem; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
