/* ==========================================================================
   Plant Care — design system «Оранжерея»
   Tokens → reset → type → layout → components → utilities → motion.
   No framework, no build step. Page-specific additions live in pages.css.
   ========================================================================== */

/* ---------------------------------------------------------------- tokens */

:root {
  color-scheme: light;

  /* palette (SPEC §9.1) */
  --bg: #F6F4EE;
  --surface: #FFFFFF;
  --surface-2: #EFECE3;
  --surface-3: #E7E2D6;
  --ink: #1F2A24;
  --muted: #5E6B63;
  --line: #E3DED2;
  --line-strong: #D3CCBC;
  --leaf: #2F6B4F;
  --leaf-strong: #245840;
  --leaf-soft: #E3EFE7;
  --water: #2E77AE;
  --water-strong: #24659A;
  --water-soft: #E2EEF8;
  --ochre-ink: #7A5300;
  --ochre-soft: #FBEFD0;
  --clay: #B4532F;
  --clay-strong: #9C4425;
  --clay-soft: #F8E4DA;
  --sun: #E9BE5A;

  --on-leaf: #FFFFFF;
  --on-water: #FFFFFF;
  --on-clay: #FFFFFF;

  /* glass + scrim */
  --bg-glass: rgb(246 244 238 / .84);
  --surface-glass: rgb(255 255 255 / .80);
  --photo-glass: rgb(255 255 255 / .88);
  --scrim: rgb(18 26 21 / .44);

  /* inverted toast */
  --toast-bg: #1F2A24;
  --toast-ink: #F3F1EA;
  --toast-muted: #AAB6AE;
  --toast-leaf: #8FD3AE;
  --toast-water: #8CC4F0;
  --toast-ochre: #F0CB6E;
  --toast-clay: #F0A283;

  /* depth: light = soft shadows, dark = hairlines */
  --shadow-sm: 0 1px 2px rgb(31 42 36 / .06);
  --shadow: 0 1px 2px rgb(31 42 36 / .06), 0 8px 24px rgb(31 42 36 / .06);
  --shadow-lg: 0 2px 6px rgb(31 42 36 / .08), 0 22px 48px rgb(31 42 36 / .16);
  --shadow-fab: 0 10px 22px -6px rgb(36 88 64 / .55), 0 3px 6px rgb(36 88 64 / .18);
  --edge: transparent;

  /* shape */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-pill: 999px;

  /* spacing scale 4/8/12/16/20/24/32/40 */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px;

  /* type */
  --font-ui: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Lora", Georgia, "Times New Roman", serif;
  --fs-base: 15px;

  /* motion */
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --t-fast: 120ms;
  --t: 180ms;
  --t-slow: 220ms;

  /* layout */
  --gutter: 16px;
  --content-max: 1120px;
  --topbar-h: 56px;
  --dock-h: 66px;
  --sidebar-w: 264px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --vh: 100dvh;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235E6B63' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");

  /* photo placeholders (deterministic per plant id: .ph-0 … .ph-5) */
  --ph0-a: #E7F0E7; --ph0-b: #CBDFCF; --ph0-ink: #4F8063;
  --ph1-a: #EEF0DD; --ph1-b: #D6DDB5; --ph1-ink: #66773A;
  --ph2-a: #E2EFEC; --ph2-b: #C3DDD7; --ph2-ink: #3B7469;
  --ph3-a: #F4ECDB; --ph3-b: #E5D4B1; --ph3-ink: #876630;
  --ph4-a: #F6E8E0; --ph4-b: #EACDBE; --ph4-ink: #96573B;
  --ph5-a: #E5EDF3; --ph5-b: #C8D9E7; --ph5-ink: #47708F;
}

/* dark palette — system preference unless the page forces light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121814; --surface: #1A221D; --surface-2: #222C26; --surface-3: #2A352E;
    --ink: #E7EDE8; --muted: #9DAAA2; --line: #2C3730; --line-strong: #3A473F;
    --leaf: #74C69D; --leaf-strong: #8AD3AD; --leaf-soft: #1F3328;
    --water: #7DB8E8; --water-strong: #96C7EE; --water-soft: #1C2C3A;
    --ochre-ink: #E9BE5A; --ochre-soft: #33291A;
    --clay: #E8916E; --clay-strong: #EFA588; --clay-soft: #3A241C;
    --on-leaf: #0E1F16; --on-water: #0B1C29; --on-clay: #2A130A;
    --bg-glass: rgb(18 24 20 / .82); --surface-glass: rgb(26 34 29 / .80); --photo-glass: rgb(22 29 25 / .82);
    --scrim: rgb(0 0 0 / .6);
    --toast-bg: #E7EDE8; --toast-ink: #18201B; --toast-muted: #55625A;
    --toast-leaf: #2F6B4F; --toast-water: #2E77AE; --toast-ochre: #7A5300; --toast-clay: #B4532F;
    --shadow-sm: none; --shadow: none; --shadow-lg: 0 24px 60px rgb(0 0 0 / .5);
    --shadow-fab: 0 8px 20px -6px rgb(0 0 0 / .7);
    --edge: var(--line);
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239DAAA2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    --ph0-a: #1E2B23; --ph0-b: #283A2F; --ph0-ink: #86BC9C;
    --ph1-a: #242A1C; --ph1-b: #333B25; --ph1-ink: #AFC07E;
    --ph2-a: #1B2A28; --ph2-b: #243A36; --ph2-ink: #7FC0B3;
    --ph3-a: #2B261C; --ph3-b: #3A3223; --ph3-ink: #D3B37A;
    --ph4-a: #2C211D; --ph4-b: #3D2C25; --ph4-ink: #E0A487;
    --ph5-a: #1C2630; --ph5-b: #253442; --ph5-ink: #8DB6D8;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121814; --surface: #1A221D; --surface-2: #222C26; --surface-3: #2A352E;
  --ink: #E7EDE8; --muted: #9DAAA2; --line: #2C3730; --line-strong: #3A473F;
  --leaf: #74C69D; --leaf-strong: #8AD3AD; --leaf-soft: #1F3328;
  --water: #7DB8E8; --water-strong: #96C7EE; --water-soft: #1C2C3A;
  --ochre-ink: #E9BE5A; --ochre-soft: #33291A;
  --clay: #E8916E; --clay-strong: #EFA588; --clay-soft: #3A241C;
  --on-leaf: #0E1F16; --on-water: #0B1C29; --on-clay: #2A130A;
  --bg-glass: rgb(18 24 20 / .82); --surface-glass: rgb(26 34 29 / .80); --photo-glass: rgb(22 29 25 / .82);
  --scrim: rgb(0 0 0 / .6);
  --toast-bg: #E7EDE8; --toast-ink: #18201B; --toast-muted: #55625A;
  --toast-leaf: #2F6B4F; --toast-water: #2E77AE; --toast-ochre: #7A5300; --toast-clay: #B4532F;
  --shadow-sm: none; --shadow: none; --shadow-lg: 0 24px 60px rgb(0 0 0 / .5);
  --shadow-fab: 0 8px 20px -6px rgb(0 0 0 / .7);
  --edge: var(--line);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239DAAA2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --ph0-a: #1E2B23; --ph0-b: #283A2F; --ph0-ink: #86BC9C;
  --ph1-a: #242A1C; --ph1-b: #333B25; --ph1-ink: #AFC07E;
  --ph2-a: #1B2A28; --ph2-b: #243A36; --ph2-ink: #7FC0B3;
  --ph3-a: #2B261C; --ph3-b: #3A3223; --ph3-ink: #D3B37A;
  --ph4-a: #2C211D; --ph4-b: #3D2C25; --ph4-ink: #E0A487;
  --ph5-a: #1C2630; --ph5-b: #253442; --ph5-ink: #8DB6D8;
}

/* Telegram Mini App: keep the «Оранжерея» palette (app.js paints Telegram's header with --bg and follows
   its colour scheme); map Telegram's safe areas and the stable viewport height. */
:root[data-tg] {
  --safe-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --vh: var(--tg-viewport-stable-height, 100dvh);
}

@media (min-width: 768px) {
  :root { --fs-base: 16px; --gutter: 24px; }
}
@media (min-width: 1024px) {
  :root { --gutter: 40px; --topbar-h: 72px; }
}

/* ---------------------------------------------------------------- reset */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-padding-top: calc(var(--topbar-h) + var(--safe-top) + 12px);
}
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: 1.5;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, video, canvas, picture { display: block; max-width: 100%; }
svg { flex: none; }
img { height: auto; }
input, button, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
table { border-collapse: collapse; }
p, h1, h2, h3, h4 { overflow-wrap: break-word; }
[hidden], [x-cloak] { display: none !important; }
::selection { background: var(--leaf-soft); color: var(--ink); }
summary { cursor: pointer; }
summary::-webkit-details-marker { display: none; }
dialog { color: inherit; }

/* ---------------------------------------------------------------- typography */

h1, h2, h3, .h1, .h2, .h3 {
  font-family: var(--font-head);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1, .h1 { font-size: 28px; line-height: 32px; }
h2, .h2 { font-size: 22px; line-height: 28px; }
h3, .h3 { font-size: 18px; line-height: 24px; }
h4 { font-size: 15px; font-weight: 700; }
p { text-wrap: pretty; }

a:not([class]) { color: var(--leaf); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:not([class]):hover { text-decoration-thickness: 2px; }

.lead { font-size: 1.067em; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.45; }
.tiny { font-size: 12px; line-height: 1.4; }
.strong { font-weight: 700; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.italic-serif, .species { font-family: var(--font-head); font-style: italic; font-weight: 500; }
.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.prose { max-width: 62ch; }
.prose > * + * { margin-top: .75em; }

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

.skip-link {
  position: fixed; left: 12px; top: -60px; z-index: 100;
  background: var(--leaf); color: var(--on-leaf); padding: 10px 16px; border-radius: var(--r-pill);
  font-weight: 700; text-decoration: none; transition: top var(--t) var(--ease);
}
.skip-link:focus { top: calc(var(--safe-top) + 8px); }

.app { min-height: 100dvh; }
.shell { min-height: 100dvh; display: flex; flex-direction: column; min-width: 0; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  padding-top: var(--safe-top);
  background: var(--bg-glass);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  backdrop-filter: saturate(1.4) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.topbar.is-scrolled { border-bottom-color: var(--line); }
.topbar__inner {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 8px;
  width: 100%; max-width: calc(var(--content-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: max(var(--gutter), var(--safe-left)) max(var(--gutter), var(--safe-right));
}
.topbar__back {
  width: 40px; height: 40px; margin-left: -8px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink); text-decoration: none; flex: none;
  transition: background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.topbar__back:hover { background: var(--surface-2); }
.topbar__back:active { transform: scale(.94); }
.tg-back .topbar__back { display: none; }
.tg-main [data-tg-main] { display: none; } /* Telegram MainButton replaces the in-page primary button */
.topbar__brand { display: none; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.no-nav .topbar__brand { display: inline-flex; }
.topbar__title {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--font-head); font-weight: 600; font-size: 22px; line-height: 1.2; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.no-nav .topbar__title { font-size: 18px; }
.topbar__actions { display: flex; align-items: center; gap: 8px; flex: 0 1 auto; min-width: 0; }
.topbar__actions .chip { max-width: 52vw; }
.topbar__actions .chip > span { overflow: hidden; text-overflow: ellipsis; }

.avatar {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--leaf-soft); color: var(--leaf);
  font-weight: 700; font-size: 15px; text-decoration: none; text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgb(47 107 79 / .12);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t) var(--ease);
}
.avatar:active { transform: scale(.94); }
.avatar[aria-current="page"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--leaf); }
.avatar--lg { width: 48px; height: 48px; font-size: 18px; }

/* content */
.main {
  flex: 1 0 auto;
  padding-top: 8px;
  padding-bottom: calc(var(--dock-h) + var(--safe-bottom) + 36px);
}
.no-nav .main { padding-bottom: calc(var(--safe-bottom) + 32px); }
.main:focus { outline: none; }
.container {
  width: 100%; max-width: calc(var(--content-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: max(var(--gutter), var(--safe-left)) max(var(--gutter), var(--safe-right));
}
.container--narrow { max-width: calc(640px + 2 * var(--gutter)); }

.page-head { display: grid; gap: 4px; margin: 8px 0 20px; }
.page-head h1 { font-size: 28px; line-height: 32px; }
.page-head__sub { color: var(--muted); }

/* bottom dock (phones + tablets) */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding-bottom: var(--safe-bottom);
  background: var(--surface-glass);
  -webkit-backdrop-filter: saturate(1.5) blur(20px);
  backdrop-filter: saturate(1.5) blur(20px);
  border-top: 1px solid var(--line);
}
.dock__inner {
  height: var(--dock-h);
  max-width: 560px; margin-inline: auto;
  padding-inline: max(6px, var(--safe-left)) max(6px, var(--safe-right));
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: stretch;
}
.dock__item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 0; padding-top: 2px;
  color: var(--muted); text-decoration: none;
  font-size: 11.5px; font-weight: 600; line-height: 1.15; letter-spacing: .01em;
  transition: color var(--t) var(--ease);
}
.dock__item > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock__icon {
  width: 56px; height: 30px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  transition: background var(--t) var(--ease), transform var(--t-fast) var(--ease);
}
.dock__item:active .dock__icon { transform: scale(.92); }
.dock__item[aria-current="page"] { color: var(--leaf); }
.dock__item[aria-current="page"] .dock__icon { background: var(--leaf-soft); }
.dock__item--fab { justify-content: flex-end; padding-bottom: 9px; gap: 4px; }
.dock__fab {
  width: 58px; height: 58px; margin-top: -30px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--leaf); color: var(--on-leaf);
  box-shadow: 0 0 0 5px var(--bg), var(--shadow-fab);
  transition: transform var(--t-fast) var(--ease), background var(--t) var(--ease);
}
.dock__item--fab:hover .dock__fab { background: var(--leaf-strong); }
.dock__item--fab:active .dock__fab { transform: scale(.94); }
.dock__item--fab[aria-current="page"] .dock__icon { background: none; }

/* sidebar (≥1024px) */
.sidebar { display: none; }

@media (min-width: 1024px) {
  .app--nav { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .dock { display: none; }
  .main { padding-bottom: 56px; padding-top: 4px; }
  .topbar { background: var(--bg-glass); }
  .topbar__title { font-size: 28px; }
  .app--nav .topbar__avatar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px;
    position: sticky; top: 0; height: 100dvh; overflow-y: auto;
    padding: 22px 16px 20px;
    border-right: 1px solid var(--line);
    background: linear-gradient(180deg, var(--bg) 0%, var(--surface-2) 140%);
  }
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 18px; text-decoration: none; color: var(--ink);
}
.brand__mark { width: 36px; height: 36px; flex: none; }
.brand__name { font-family: var(--font-head); font-weight: 600; font-size: 20px; line-height: 1.15; letter-spacing: -0.01em; }
.sidebar__add { margin: 0 2px 14px; }
.sidebar__add .btn { width: 100%; }
.side-nav { display: grid; gap: 2px; }
.side-nav__item {
  display: flex; align-items: center; gap: 12px;
  min-height: 46px; padding: 0 12px; border-radius: 14px;
  color: var(--muted); font-weight: 600; text-decoration: none;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.side-nav__item:hover { background: var(--surface-2); color: var(--ink); }
.side-nav__item[aria-current="page"] { background: var(--leaf-soft); color: var(--leaf); }
.sidebar__foot { margin-top: auto; display: grid; gap: 2px; padding-top: 16px; border-top: 1px solid var(--line); }
.side-user { display: flex; align-items: center; gap: 10px; padding: 10px 12px 2px; color: var(--muted); font-size: 13px; }
.side-user .avatar { width: 32px; height: 32px; font-size: 13px; }
.side-user__name { color: var(--ink); font-weight: 700; font-size: 14px; }

/* ---------------------------------------------------------------- grids & layout helpers */

.stack { display: flex; flex-direction: column; gap: var(--gap, 12px); }
.stack--xs { --gap: 4px; }
.stack--sm { --gap: 8px; }
.stack--lg { --gap: 20px; }
.stack--xl { --gap: 32px; }
.row { display: flex; align-items: center; gap: var(--gap, 8px); min-width: 0; }
.row--top { align-items: flex-start; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, 8px); }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }

.grid { display: grid; gap: var(--gap, 12px); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--plants { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid--rooms { grid-template-columns: minmax(0, 1fr); gap: 14px; }
.grid--stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) {
  .grid--plants { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .grid--rooms { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}
@media (min-width: 900px) {
  .grid--stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
}
@media (min-width: 1280px) {
  .grid--plants { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
  .grid--rooms { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
}
.split { display: grid; gap: 28px; }
@media (min-width: 1024px) {
  .split { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 36px; align-items: start; }
  .split__aside { position: sticky; top: calc(var(--topbar-h) + 16px); }
}

/* ---------------------------------------------------------------- icon */

.icon { flex: none; vertical-align: middle; }  /* size comes from the width/height attributes (ui.icon size) */

/* brand mark (leaf-in-pot) */
.brand__mark .bm-bg { fill: var(--leaf-soft); }
.brand__mark .bm-leaf, .brand__mark .bm-pot { fill: var(--leaf); }
.brand__mark .bm-leaf-2 { fill: var(--leaf); opacity: .62; }
.brand__mark .bm-vein { fill: none; stroke: var(--leaf-soft); stroke-width: 1.2; stroke-linecap: round; }

/* ---------------------------------------------------------------- card / surfaces */

.card {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card--lg { padding: 20px; }
.card--flat { box-shadow: none; background: var(--surface-2); border-color: transparent; }
.card--outline { box-shadow: none; border-color: var(--line); }
.card--link { display: block; text-decoration: none; color: inherit; transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease); }
@media (min-width: 768px) { .card--lg { padding: 24px; } }

.divider { height: 1px; background: var(--line); border: 0; margin: 16px 0; }

/* list of rows inside a card */
.list { background: var(--surface); border: 1px solid var(--edge); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.list__row {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 12px 16px;
  color: inherit; text-decoration: none;
}
.list__row + .list__row { border-top: 1px solid var(--line); }
a.list__row, button.list__row { width: 100%; text-align: left; transition: background var(--t-fast) var(--ease); }
a.list__row:hover, button.list__row:hover { background: var(--surface-2); }
.list__icon {
  width: 36px; height: 36px; border-radius: 12px; flex: none;
  display: grid; place-items: center; background: var(--surface-2); color: var(--muted);
}
.list__chev { color: var(--muted); margin-left: auto; }

/* key/value lines */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.kv dt { color: var(--muted); }
.kv dd { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* callouts */
.callout {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--r-md);
  background: var(--surface-2); color: var(--ink);
}
.callout > .icon { margin-top: 1px; color: var(--muted); }
.callout--leaf { background: var(--leaf-soft); } .callout--leaf > .icon { color: var(--leaf); }
.callout--water { background: var(--water-soft); } .callout--water > .icon { color: var(--water); }
.callout--ochre { background: var(--ochre-soft); } .callout--ochre > .icon { color: var(--ochre-ink); }
.callout--clay { background: var(--clay-soft); } .callout--clay > .icon { color: var(--clay); }

/* ---------------------------------------------------------------- buttons */

.btn {
  --btn-h: 44px;
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--btn-h); padding: 0 20px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font-weight: 700; font-size: 15px; line-height: 1.15; letter-spacing: .005em;
  text-decoration: none; white-space: nowrap; user-select: none;
  cursor: pointer; overflow: hidden; isolation: isolate;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease), box-shadow var(--t) var(--ease);
}
.btn:active { transform: scale(.97); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn.htmx-request { opacity: .75; pointer-events: none; }
.btn .icon { width: 18px; height: 18px; }

.btn--primary { background: var(--leaf); color: var(--on-leaf); box-shadow: 0 1px 2px rgb(31 42 36 / .12); }
.btn--primary:hover { background: var(--leaf-strong); }
.btn--secondary { background: var(--leaf-soft); color: var(--leaf); }
.btn--secondary:hover { border-color: rgb(47 107 79 / .25); }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--outline { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn--outline:hover { border-color: var(--line-strong); }
.btn--danger { background: var(--clay-soft); color: var(--clay); }
.btn--danger:hover { background: var(--clay); color: var(--on-clay); }
.btn--water { background: var(--water); color: var(--on-water); box-shadow: 0 1px 2px rgb(31 42 36 / .12); }
.btn--water:hover { background: var(--water-strong); }

.btn--sm { --btn-h: 36px; padding: 0 14px; font-size: 14px; gap: 6px; }
.btn--sm .icon { width: 16px; height: 16px; }
.btn--lg { --btn-h: 52px; padding: 0 26px; font-size: 16px; }
.btn--lg .icon { width: 20px; height: 20px; }
.btn--block { width: 100%; }
.btn--icon { width: var(--btn-h); padding: 0; }
.btn--icon .icon { width: 20px; height: 20px; }

/* ---------------------------------------------------------------- chips, pills, badges */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px; max-width: 100%; padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--ink);
  font-size: 13px; font-weight: 600; line-height: 1.2;
  white-space: nowrap; text-decoration: none; border: 1px solid transparent;
}
.chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chip .icon { width: 15px; height: 15px; color: var(--muted); }
a.chip, button.chip { cursor: pointer; transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); }
a.chip:hover, button.chip:hover { border-color: var(--line-strong); }
a.chip:active, button.chip:active { transform: scale(.97); }
.chip--sm { min-height: 24px; padding: 0 9px; font-size: 12px; gap: 4px; }
.chip--sm .icon { width: 13px; height: 13px; }
.chip--outline { background: transparent; border-color: var(--line); }
.chip--leaf { background: var(--leaf-soft); color: var(--leaf); } .chip--leaf .icon { color: var(--leaf); }
.chip--water { background: var(--water-soft); color: var(--water); } .chip--water .icon { color: var(--water); }
.chip--ochre { background: var(--ochre-soft); color: var(--ochre-ink); } .chip--ochre .icon { color: var(--ochre-ink); }
.chip--clay { background: var(--clay-soft); color: var(--clay); } .chip--clay .icon { color: var(--clay); }
.chip--glass { background: var(--photo-glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.chip[aria-pressed="true"], .chip.is-active { background: var(--leaf); border-color: var(--leaf); color: var(--on-leaf); }
.chip[aria-pressed="true"] .icon, .chip.is-active .icon { color: currentColor; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 26px; padding: 0 10px 0 8px;
  border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 600; line-height: 1.1; white-space: nowrap;
  background: var(--surface-2); color: var(--muted);
}
.pill .icon { width: 14px; height: 14px; }
.pill--ok { background: var(--leaf-soft); color: var(--leaf); }
.pill--watch { background: var(--ochre-soft); color: var(--ochre-ink); }
.pill--action_needed { background: var(--clay-soft); color: var(--clay); }
.pill--urgent { background: var(--clay); color: var(--on-clay); font-weight: 700; }
.pill--glass { background: var(--photo-glass); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 1px 3px rgb(0 0 0 / .08); }
.pill--glass.pill--urgent { background: var(--clay); color: var(--on-clay); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 28px; padding: 0 11px 0 9px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 700; line-height: 1.15;
}
.badge .icon { width: 16px; height: 16px; }
.badge--toxic { background: var(--clay-soft); color: var(--clay); }
.badge-dot {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--photo-glass); color: var(--clay);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 1px 3px rgb(0 0 0 / .08);
}
.badge-dot .icon { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- plant thumb + placeholders */

.thumb {
  --size: 56px;
  position: relative; flex: none;
  width: var(--size); height: var(--size);
  border-radius: 50%; overflow: hidden;
  background: var(--surface-2);
  display: grid; place-items: center;
}
.thumb--soft { border-radius: calc(var(--size) * .28); }
.thumb--fill { width: 100%; height: 100%; border-radius: 0; }
.thumb > img { width: 100%; height: 100%; object-fit: cover; }
.thumb--photo::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .06); pointer-events: none;
}

.ph {
  color: var(--ph-ink);
  background:
    radial-gradient(120% 90% at 22% 12%, rgb(255 255 255 / .55), transparent 58%),
    linear-gradient(155deg, var(--ph-a) 0%, var(--ph-b) 100%);
}
.ph-0 { --ph-a: var(--ph0-a); --ph-b: var(--ph0-b); --ph-ink: var(--ph0-ink); }
.ph-1 { --ph-a: var(--ph1-a); --ph-b: var(--ph1-b); --ph-ink: var(--ph1-ink); }
.ph-2 { --ph-a: var(--ph2-a); --ph-b: var(--ph2-b); --ph-ink: var(--ph2-ink); }
.ph-3 { --ph-a: var(--ph3-a); --ph-b: var(--ph3-b); --ph-ink: var(--ph3-ink); }
.ph-4 { --ph-a: var(--ph4-a); --ph-b: var(--ph4-b); --ph-ink: var(--ph4-ink); }
.ph-5 { --ph-a: var(--ph5-a); --ph-b: var(--ph5-b); --ph-ink: var(--ph5-ink); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ph { background: radial-gradient(120% 90% at 22% 12%, rgb(255 255 255 / .06), transparent 58%), linear-gradient(155deg, var(--ph-a) 0%, var(--ph-b) 100%); }
}
:root[data-theme="dark"] .ph { background: radial-gradient(120% 90% at 22% 12%, rgb(255 255 255 / .06), transparent 58%), linear-gradient(155deg, var(--ph-a) 0%, var(--ph-b) 100%); }
.ph > .icon { width: 46%; height: 46%; opacity: .85; }
.ph > .illu { width: 64%; height: auto; opacity: .9; }

/* ---------------------------------------------------------------- plant card */

.plant-card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  overflow: hidden; color: inherit; text-decoration: none;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.plant-card:active { transform: scale(.985); }
.plant-card__media { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: var(--surface-2); }
.plant-card__media > .thumb { position: absolute; inset: 0; }
.plant-card__media img { transition: transform .5s var(--ease-out); }
.plant-card__badges {
  position: absolute; top: 8px; left: 8px; right: 8px; z-index: 1;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; pointer-events: none;
}
.plant-card__toxic { position: absolute; right: 8px; bottom: 8px; z-index: 1; }
.plant-card__badges .pill { min-width: 0; }
.plant-card__badges .pill > span { overflow: hidden; text-overflow: ellipsis; }
.plant-card__body { display: grid; gap: 1px; padding: 10px 12px 12px; min-width: 0; }
.plant-card__name {
  font-weight: 700; font-size: 15px; line-height: 1.3; overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.plant-card__species {
  font-family: var(--font-head); font-style: italic; font-weight: 500;
  font-size: 13.5px; line-height: 1.35; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.plant-card__due {
  display: flex; align-items: flex-start; gap: 5px; margin-top: 7px;
  font-size: 13px; font-weight: 600; line-height: 1.25; color: var(--muted);
}
.plant-card__due .icon { width: 15px; height: 15px; color: var(--water); margin-top: 1px; }
.plant-card__due.is-due { color: var(--water); font-weight: 700; }
.plant-card__due.is-overdue { color: var(--clay); font-weight: 700; }
.plant-card__due.is-overdue .icon { color: var(--clay); }
@media (hover: hover) {
  .plant-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
  .plant-card:hover .plant-card__media img { transform: scale(1.03); }
}
@media (min-width: 768px) {
  .plant-card__body { padding: 12px 14px 14px; }
  .plant-card__name { font-size: 16px; }
}

/* ---------------------------------------------------------------- task row */

.task {
  position: relative;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "thumb name actions";
  align-items: center; column-gap: 12px; row-gap: 6px;
  padding: 12px 8px 12px 12px;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm), 0 4px 14px rgb(31 42 36 / .04);
  transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease), box-shadow var(--t) var(--ease);
}
.task--meta { grid-template-areas: "thumb name actions" "thumb meta meta"; }
.task--overdue::before {
  content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--clay);
}
.task__thumb { grid-area: thumb; display: block; text-decoration: none; border-radius: 50%; align-self: center; }
.task__name {
  grid-area: name; min-width: 0;
  font-weight: 700; font-size: 15.5px; line-height: 1.25; color: var(--ink); text-decoration: none;
  overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.task--meta .task__meta { margin-top: -4px; }
a.task__name:hover { text-decoration: underline; text-underline-offset: 3px; }
.task__meta {
  grid-area: meta; align-self: start;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0;
  font-size: 13px; line-height: 1.3; color: var(--muted);
}
.task__meta .chip { max-width: 100%; }
.task__late { display: inline-flex; align-items: center; gap: 4px; color: var(--clay); font-weight: 700; }
.task__late .icon, .task__hint .icon { width: 14px; height: 14px; }
.task__hint { display: inline-flex; align-items: center; gap: 4px; }
.task__actions { grid-area: actions; display: flex; align-items: center; gap: 0; }
@media (max-width: 380px) {
  .task { column-gap: 10px; padding-left: 10px; }
  .task__thumb .thumb { --size: 40px !important; }
  .task__go { padding: 0 12px 0 10px; gap: 6px; }
  .menu > summary { width: 32px; }
}
.task__go { padding: 0 16px 0 13px; }
.task__go .icon { transition: transform var(--t) var(--ease); }

/* watering micro-animation: app.js adds .is-watering before the request */
.task__go::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 0; z-index: -1;
  background: linear-gradient(180deg, rgb(255 255 255 / .28), rgb(255 255 255 / .12));
  border-radius: 40% 40% 0 0 / 14px 14px 0 0;
}
.is-watering .task__go::before { animation: pc-fill .55s var(--ease-out) forwards; }
.is-watering .task__go .icon { animation: pc-drop .5s var(--ease) both; }
.task.htmx-swapping { opacity: 0; transform: translateX(14px) scale(.98); }
.task.htmx-added { opacity: 0; transform: translateY(6px); }

/* overflow menu (<details>) */
.menu { position: relative; }
.menu > summary {
  list-style: none;
  width: 38px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; color: var(--muted);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.menu > summary:hover, .menu[open] > summary { background: var(--surface-2); color: var(--ink); }
.menu__list {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 25;
  min-width: 236px; max-width: calc(100vw - 32px);
  padding: 6px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  transform-origin: top right;
  animation: pc-pop var(--t) var(--ease-out);
}
.menu--up .menu__list { top: auto; bottom: calc(100% + 6px); transform-origin: bottom right; }
.menu__item {
  width: 100%; display: flex; align-items: center; gap: 12px;
  min-height: 48px; padding: 8px 12px; border-radius: 12px;
  text-align: left; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px;
  transition: background var(--t-fast) var(--ease);
}
.menu__item:hover, .menu__item:focus-visible { background: var(--surface-2); }
.menu__item > .icon { color: var(--muted); }
.menu__text { display: grid; gap: 1px; line-height: 1.25; }
.menu__text small { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.menu__item--danger { color: var(--clay); } .menu__item--danger > .icon { color: var(--clay); }

/* ---------------------------------------------------------------- room card */

.room-card {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--edge);
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  overflow: hidden; color: inherit; text-decoration: none;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.room-card:active { transform: scale(.985); }
.room-card__media { position: relative; aspect-ratio: 2 / 1; background: var(--surface-2); }
.room-card__media > .thumb { position: absolute; inset: 0; }
.room-card__media > .thumb > img { object-position: 50% 35%; }   /* portrait plant photos: keep the foliage, not the pot */
.room-card__media .ph { place-items: end end; padding-right: 16%; }
.room-card__media .ph > .illu { width: auto; height: 86%; opacity: .5; }
.room-card__badge {
  position: absolute; left: 14px; bottom: -20px; z-index: 1;
  width: 48px; height: 48px; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--surface); color: var(--leaf);
  box-shadow: 0 0 0 4px var(--surface), var(--shadow-sm);
}
.room-card__badge .icon { width: 24px; height: 24px; }
.room-card__window { position: absolute; top: 10px; right: 10px; }
.room-card__body { display: grid; gap: 6px; padding: 28px 16px 16px; min-width: 0; }
.room-card__name { font-family: var(--font-head); font-weight: 600; font-size: 19px; line-height: 1.25; }
.room-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13.5px; color: var(--muted); }
.room-card__meta .sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; }
.room-card__alert { display: inline-flex; align-items: center; gap: 4px; color: var(--clay); font-weight: 700; }
.room-card__ok { display: inline-flex; align-items: center; gap: 4px; color: var(--leaf); font-weight: 600; }
.room-card__alert .icon, .room-card__ok .icon { width: 15px; height: 15px; }
@media (hover: hover) { .room-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); } }

/* ---------------------------------------------------------------- progress ring */

.ring { display: inline-flex; align-items: center; gap: 14px; min-width: 0; }
.ring__dial { position: relative; width: 76px; height: 76px; flex: none; }
.ring__dial > svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring__track { fill: none; stroke: var(--surface-3); stroke-width: 6; }
.ring__value {
  fill: none; stroke: var(--leaf); stroke-width: 6; stroke-linecap: round;
  transition: stroke-dashoffset .6s var(--ease-out);
}
.ring--done .ring__value { stroke: var(--leaf); }
.ring__center {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1;
}
.ring__num { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.ring__of { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.ring__center .icon { width: 30px; height: 30px; color: var(--leaf); }
.ring__label { display: grid; gap: 2px; min-width: 0; }
.ring__title { font-weight: 700; font-size: 15px; line-height: 1.3; }
.ring__sub { font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- stat tile */

.stat {
  display: grid; gap: 10px; align-content: start; min-width: 0;
  padding: 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--edge); box-shadow: var(--shadow-sm), 0 4px 14px rgb(31 42 36 / .04);
}
.stat__icon {
  width: 36px; height: 36px; border-radius: 12px;
  display: grid; place-items: center; background: var(--surface-2); color: var(--muted);
}
.stat__icon .icon { width: 19px; height: 19px; }
.stat__value { font-size: 24px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat__label { font-size: 13px; line-height: 1.35; color: var(--muted); }
.stat--leaf .stat__icon { background: var(--leaf-soft); color: var(--leaf); }
.stat--water .stat__icon { background: var(--water-soft); color: var(--water); }
.stat--ochre .stat__icon { background: var(--ochre-soft); color: var(--ochre-ink); }
.stat--clay .stat__icon { background: var(--clay-soft); color: var(--clay); }

/* ---------------------------------------------------------------- empty state */

.empty {
  display: grid; justify-items: center; text-align: center; gap: 8px;
  padding: 36px 20px 32px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
}
.empty--bare { background: transparent; border: 0; }
.empty__art {
  position: relative; width: 132px; height: 132px; margin-bottom: 8px;
  display: grid; place-items: center; color: var(--leaf);
}
.empty__art::before {
  content: ""; position: absolute; inset: 10px; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, var(--leaf-soft) 0%, var(--leaf-soft) 55%, transparent 72%);
}
.empty__art > * { position: relative; }
.empty__art .illu { width: 120px; height: 120px; }
.empty__art .icon { width: 40px; height: 40px; }
.empty__title { font-family: var(--font-head); font-weight: 600; font-size: 20px; line-height: 1.3; max-width: 26ch; }
.empty__text { color: var(--muted); max-width: 36ch; }
.empty__action { margin-top: 12px; }

/* ---------------------------------------------------------------- section */

.section { margin-top: 28px; }
.section:first-child { margin-top: 4px; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section__title { font-size: 20px; line-height: 1.3; }
.section__sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.section__action {
  display: inline-flex; align-items: center; gap: 2px; flex: none;
  color: var(--leaf); font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap;
  padding: 6px 2px 6px 8px; margin: -6px -2px -6px 0; border-radius: 10px;
}
.section__action:hover { background: var(--leaf-soft); }
.section__action .icon { width: 16px; height: 16px; }
@media (min-width: 768px) { .section { margin-top: 36px; } .section__title { font-size: 22px; } }

/* ---------------------------------------------------------------- sheet (dialog) */

.sheet {
  position: fixed; inset: auto 0 0 0;
  width: 100%; max-width: 100%;
  max-height: min(90dvh, calc(var(--vh) - 24px));
  margin: 0; padding: 0; border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.sheet:focus-visible { outline: none; }
.sheet[open] { display: flex; flex-direction: column; animation: pc-sheet-up .26s var(--ease-out); }
.sheet.is-closing { animation: pc-sheet-down .2s var(--ease) forwards; }
.sheet::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); animation: pc-fade .2s var(--ease); }
.sheet.is-closing::backdrop { animation: pc-fade-out .2s var(--ease) forwards; }
.sheet__grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 8px auto 0; flex: none; }
.sheet__head { display: flex; align-items: center; gap: 12px; padding: 10px 12px 6px 20px; flex: none; }
.sheet__title { flex: 1; font-size: 20px; line-height: 1.3; }
.sheet__close { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); background: var(--surface-2); }
.sheet__close:hover { color: var(--ink); }
.sheet__body {
  overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 20px calc(24px + var(--safe-bottom));
}
.sheet__foot {
  display: flex; gap: 8px; flex: none;
  padding: 12px 20px calc(12px + var(--safe-bottom));
  border-top: 1px solid var(--line); background: var(--surface);
}
.sheet__foot > .btn { flex: 1; }
.sheet__body > .sheet__foot:last-child {
  position: sticky; bottom: calc(-1 * (24px + var(--safe-bottom)));
  margin: 20px -20px calc(-1 * (24px + var(--safe-bottom)));
}
@media (min-width: 768px) {
  .sheet {
    inset: 0; margin: auto;
    width: min(560px, calc(100% - 48px));
    max-height: min(82dvh, 760px);
    border-radius: var(--r-lg);
  }
  .sheet[open] { animation: pc-pop .22s var(--ease-out); }
  .sheet.is-closing { animation: pc-pop-out .16s var(--ease) forwards; }
  .sheet__grip { display: none; }
  .sheet__head { padding: 16px 16px 8px 24px; }
  .sheet__body { padding: 8px 24px 24px; }
  .sheet__foot { padding: 14px 24px; }
  .sheet__body > .sheet__foot:last-child { bottom: -24px; margin: 24px -24px -24px; }
}
html.has-sheet { overflow: hidden; }

/* ---------------------------------------------------------------- toasts */

.toasts {
  position: fixed; z-index: 70;
  inset: auto 12px calc(var(--dock-h) + var(--safe-bottom) + 14px) 12px;
  width: auto; height: auto; max-height: none;
  margin: 0; padding: 0; border: 0; background: transparent; color: inherit; overflow: visible;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toasts[popover]:not(:popover-open) { display: none; }   /* shown in the top layer (above open sheets) by app.js */
.no-nav .toasts { bottom: calc(var(--safe-bottom) + 16px); }
@media (min-width: 1024px) {
  .toasts { left: auto; right: 28px; bottom: 28px; width: 400px; align-items: stretch; }
}
.toast {
  pointer-events: auto;
  position: relative; overflow: hidden;
  width: 100%; max-width: 460px;
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 8px 6px 8px 14px;
  border-radius: var(--r-md);
  background: var(--toast-bg); color: var(--toast-ink);
  box-shadow: 0 12px 32px rgb(15 22 18 / .28), 0 2px 6px rgb(15 22 18 / .16);
  animation: pc-toast-in .28s var(--ease-out);
}
.toast.is-leaving { animation: pc-toast-out .2s var(--ease) forwards; }
.toast__icon {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  display: grid; place-items: center; color: var(--tone, var(--toast-leaf));
  background: color-mix(in srgb, currentColor 18%, transparent);
}
.toast__icon .icon { width: 17px; height: 17px; }
.toast__text { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 600; line-height: 1.35; padding: 6px 0; }
.toast__undo {
  flex: none; min-height: 40px; padding: 0 12px; border-radius: 10px;
  color: var(--tone, var(--toast-leaf)); font-weight: 700; font-size: 14.5px; letter-spacing: .01em;
}
.toast__undo:hover { background: rgb(255 255 255 / .08); }
.toast__close { flex: none; width: 36px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--toast-muted); }
.toast__close:hover { color: var(--toast-ink); }
.toast__close .icon { width: 18px; height: 18px; }
.toast__bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--tone, var(--toast-leaf)); opacity: .9;
  transform-origin: left center;
  animation: pc-toast-bar var(--toast-ms, 5000ms) linear forwards;
}
.toast:focus-within .toast__bar { animation-play-state: paused; }
@media (hover: hover) { .toast:hover .toast__bar { animation-play-state: paused; } }
.toast--leaf { --tone: var(--toast-leaf); }
.toast--water { --tone: var(--toast-water); }
.toast--ochre { --tone: var(--toast-ochre); }
.toast--clay { --tone: var(--toast-clay); }

/* ---------------------------------------------------------------- segmented (radio pills) */

.seg { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; min-width: 0; }
.seg__opt { position: relative; display: inline-flex; min-width: 0; }
.seg__opt > input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1;
}
.seg__pill {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 42px; padding: 0 16px;
  border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line);
  font-size: 14.5px; font-weight: 600; color: var(--ink); line-height: 1.2;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.seg__pill .icon { width: 17px; height: 17px; color: var(--muted); }
.seg__opt:hover > .seg__pill { border-color: var(--line-strong); }
.seg__opt > input:active + .seg__pill { transform: scale(.97); }
.seg__opt > input:checked + .seg__pill { background: var(--leaf); border-color: var(--leaf); color: var(--on-leaf); }
.seg__opt > input:checked + .seg__pill .icon { color: currentColor; }
.seg__opt > input:focus-visible + .seg__pill { outline: 2.5px solid var(--leaf); outline-offset: 2px; }
.seg__opt > input:disabled + .seg__pill { opacity: .5; }
.seg--fill .seg__opt { flex: 1 1 auto; }   /* long labels («Тёплый пол») get more room instead of wrapping */
.seg--fill .seg__pill { width: 100%; justify-content: center; padding: 0 10px; }

/* ---------------------------------------------------------------- stepper */

.stepper { display: grid; gap: 10px; }
.stepper__bars { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; list-style: none; padding: 0; }
.stepper__step { display: grid; gap: 8px; min-width: 0; }
.stepper__bar { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.stepper__step.is-done .stepper__bar, .stepper__step.is-current .stepper__bar { background: var(--leaf); }
.stepper__step.is-current .stepper__bar { background: linear-gradient(90deg, var(--leaf) 0 60%, var(--leaf-soft) 60%); }
.stepper__label {
  display: none; font-size: 12.5px; font-weight: 600; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stepper__step.is-current .stepper__label { color: var(--ink); }
.stepper__step.is-done .stepper__label { color: var(--leaf); }
.stepper__caption { font-size: 13px; color: var(--muted); }
.stepper__caption strong { color: var(--ink); font-weight: 700; }
@media (min-width: 640px) {
  .stepper__label { display: block; }
  .stepper__caption { display: none; }
}

/* ---------------------------------------------------------------- before / after */

.ba {
  --pos: 50%;
  position: relative; overflow: hidden; isolation: isolate;
  aspect-ratio: 4 / 5; border-radius: var(--r-lg);
  background: var(--surface-2);
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
  cursor: ew-resize;
}
.ba__img, .ba__after > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ba__after { position: absolute; inset: 0; clip-path: inset(0 0 0 var(--pos)); }
.ba__line {
  position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px;
  background: #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / .08), 0 0 12px rgb(0 0 0 / .2); pointer-events: none;
}
.ba__knob {
  position: absolute; top: 50%; left: var(--pos);
  width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%;
  display: grid; place-items: center; grid-auto-flow: column;
  background: #fff; color: #1F2A24;
  box-shadow: 0 4px 14px rgb(0 0 0 / .25); pointer-events: none;
  transition: transform var(--t-fast) var(--ease);
}
.ba__knob .icon { width: 16px; height: 16px; margin: 0 -3px; }
.ba.is-dragging .ba__knob { transform: scale(1.08); }
.ba__tag {
  position: absolute; top: 10px; z-index: 1;
  padding: 4px 10px; border-radius: var(--r-pill);
  background: rgb(20 28 23 / .58); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); pointer-events: none;
}
.ba__tag--before { left: 10px; }
.ba__tag--after { right: 10px; }
.ba__range { position: absolute; inset: auto 0 0 0; width: 100%; opacity: 0; pointer-events: none; }
.ba:has(.ba__range:focus-visible) { outline: 2.5px solid var(--leaf); outline-offset: 3px; }

/* ---------------------------------------------------------------- language switch */

.lang-switch {
  display: inline-flex; padding: 3px; gap: 2px;
  border-radius: var(--r-pill); background: var(--surface-2);
}
.lang-switch form { display: contents; }
.lang-switch button {
  min-width: 48px; min-height: 34px; padding: 0 12px; border-radius: var(--r-pill);
  font-size: 13px; font-weight: 700; letter-spacing: .04em; color: var(--muted);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.lang-switch button:hover { color: var(--ink); }
.lang-switch button[aria-pressed="true"] { background: var(--surface); color: var(--leaf); box-shadow: var(--shadow-sm), 0 0 0 1px var(--edge); }

/* ---------------------------------------------------------------- illustrations */

.illu {
  width: 120px; height: 120px; color: inherit;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.illu * { vector-effect: non-scaling-stroke; }
.illu .fill { fill: currentColor; fill-opacity: .1; }
.illu .fill-2 { fill: currentColor; fill-opacity: .2; }
.illu .solid { fill: currentColor; stroke: none; }
.illu .accent { color: var(--sun); stroke: var(--sun); }
.illu .accent-water { stroke: var(--water); }
.illu .faint { opacity: .45; }

/* ---------------------------------------------------------------- AI analysing skeleton */

.analyzing { display: grid; gap: 14px; }
.analyzing__media {
  position: relative; overflow: hidden; aspect-ratio: 4 / 3; border-radius: var(--r-lg); background: var(--surface-2);
}
.analyzing__media > .thumb { position: absolute; inset: 0; }
.analyzing__media::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgb(116 198 157 / .0) 35%, rgb(116 198 157 / .38) 50%, rgb(116 198 157 / 0) 65%, transparent 100%);
  background-size: 100% 220%;
  animation: pc-scan 2.2s var(--ease) infinite;
  mix-blend-mode: screen;
}
.analyzing__msg { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.analyzing__msg .icon { color: var(--leaf); animation: pc-pulse 1.6s ease-in-out infinite; }
.analyzing__wait { color: var(--muted); font-size: 13px; margin-top: -8px; }
.skel {
  display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 40%, var(--surface-2) 80%);
  background-size: 300% 100%;
  animation: pc-shimmer 1.4s linear infinite;
}
.skel--title { height: 18px; width: 55%; }
.skel--w80 { width: 80%; } .skel--w60 { width: 60%; } .skel--w40 { width: 40%; }

/* ---------------------------------------------------------------- forms */

.field { display: grid; gap: 6px; min-width: 0; }
.field + .field { margin-top: 16px; }
.label { font-weight: 700; font-size: 14px; line-height: 1.3; }
.label small, .label .muted { font-weight: 500; }
.hint { font-size: 13px; color: var(--muted); line-height: 1.4; }
.error-text { font-size: 13px; color: var(--clay); font-weight: 600; }
.input, .select, .textarea {
  width: 100%; min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 16px; line-height: 1.35;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .8; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--leaf); box-shadow: 0 0 0 3px rgb(47 107 79 / .16); }
.input[aria-invalid="true"] { border-color: var(--clay); }
.textarea { min-height: 96px; resize: vertical; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: var(--chevron);
  background-position: right 14px center; background-size: 18px 18px; background-repeat: no-repeat;
}

.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; cursor: pointer; }
.switch__text { display: grid; gap: 2px; min-width: 0; }
.switch input {
  appearance: none; -webkit-appearance: none; flex: none;
  position: relative; width: 50px; height: 30px; border-radius: 15px; margin: 0;
  background: var(--surface-3); cursor: pointer;
  transition: background var(--t) var(--ease);
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25);
  transition: transform var(--t) var(--ease-out);
}
.switch input:checked { background: var(--leaf); }
.switch input:checked::after { transform: translateX(20px); }
.switch input:focus-visible { outline: 2.5px solid var(--leaf); outline-offset: 2px; }

.check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; min-height: 44px; padding: 10px 0; }
.check input {
  appearance: none; -webkit-appearance: none; flex: none;
  position: relative; width: 24px; height: 24px; margin: 0; border-radius: 50%;
  border: 2px solid var(--line-strong); background: var(--surface); cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.check input::after {
  content: ""; position: absolute; left: 7px; top: 3px; width: 6px; height: 11px;
  border: solid var(--on-leaf); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) scale(0);
  transition: transform var(--t) var(--ease-out);
}
.check input:checked { background: var(--leaf); border-color: var(--leaf); }
.check input:checked::after { transform: rotate(45deg) scale(1); }
.check input:checked + .check__text { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.check input:focus-visible { outline: 2.5px solid var(--leaf); outline-offset: 2px; }
.check__text { line-height: 1.4; padding-top: 1px; }

/* ---------------------------------------------------------------- focus */

:focus { outline: none; }
:focus-visible { outline: 2.5px solid var(--leaf); outline-offset: 2px; }
.btn:focus-visible, .chip:focus-visible, .dock__item:focus-visible, .side-nav__item:focus-visible { outline-offset: 3px; }
.dock__item--fab:focus-visible { outline: none; }
.dock__item--fab:focus-visible .dock__fab { outline: 2.5px solid var(--leaf); outline-offset: 3px; }
.plant-card:focus-visible, .room-card:focus-visible { outline-offset: 3px; }

/* ---------------------------------------------------------------- htmx helpers */

.htmx-indicator { opacity: 0; transition: opacity var(--t) var(--ease); }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: pc-spin .7s linear infinite;
}

/* ---------------------------------------------------------------- utilities (kept small) */

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 40px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.tone-leaf { color: var(--leaf); } .tone-water { color: var(--water); } .tone-ochre { color: var(--ochre-ink); } .tone-clay { color: var(--clay); }
.only-phone { } .only-desktop { display: none; }
@media (min-width: 1024px) { .only-phone { display: none !important; } .only-desktop { display: initial; } }

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

@keyframes pc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pc-fade-out { to { opacity: 0; } }
@keyframes pc-pop { from { opacity: 0; transform: scale(.96) translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes pc-pop-out { to { opacity: 0; transform: scale(.97); } }
@keyframes pc-sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes pc-sheet-down { to { transform: translateY(100%); } }
@keyframes pc-toast-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pc-toast-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes pc-toast-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes pc-shimmer { from { background-position: 100% 0; } to { background-position: -50% 0; } }
@keyframes pc-scan { from { background-position: 0 120%; } to { background-position: 0 -120%; } }
@keyframes pc-pulse { 50% { transform: scale(.85); opacity: .6; } }
@keyframes pc-spin { to { transform: rotate(360deg); } }
@keyframes pc-fill { from { height: 0; } to { height: 100%; } }
@keyframes pc-drop {
  0% { transform: translateY(0); }
  35% { transform: translateY(-5px) scale(1.12); }
  70% { transform: translateY(2px) scale(.94); }
  100% { transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .skel, .analyzing__media::after, .analyzing__msg .icon, .spinner { animation: none !important; }
  .spinner { border-right-color: currentColor; opacity: .6; }
}

/* ---------------------------------------------------------------- print */

@media print {
  .dock, .sidebar, .topbar, .toasts { display: none !important; }
  body { background: #fff; }
}
