/* Трекер растений v2. Без внешних шрифтов и CDN. Карточки списка — CSS grid с фиксированными рядами. */
:root {
  --bg: #F3ECDC; --cream: #F7E5C6; --cream-2: #FBF1DE; --ink: #3B3428; --ink-soft: #6B5F4C;
  --border: #E4CFAA; --green: #617A47; --green-dk: #4C6236; --ok-fg: #3F5A2E; --ok-bg: #DCE6CC;
  --warn-bg: #F1DFA6; --warn-fg: #7A5A0C; --danger-bg: #F2C9BC; --danger-fg: #9A2F18; --calm-bg: #E9E1D2;
  --r: 16px; --label-w: 104px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif; }
a { color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.inline { display: inline; margin: 0; }
.wrap { max-width: 1240px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 12px calc(80px + env(safe-area-inset-bottom)); }

/* шапка */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.top h1 { font-size: 22px; margin: 2px 0; }
.top h1 a { text-decoration: none; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: #EAE2D0; padding: 4px; border-radius: 14px; flex: 1 1 300px; max-width: 420px; }
.tabs a { text-align: center; padding: 8px 6px; border-radius: 10px; text-decoration: none; color: var(--ink-soft); font-weight: 600; font-size: 15px; }
.tabs a.on { background: var(--cream-2); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* сводка */
.summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--cream-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 10px 14px; margin-bottom: 12px; font-size: 17px; }
.help { margin-left: auto; }
.help summary { list-style: none; cursor: pointer; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: var(--calm-bg); color: var(--ink-soft); font-weight: 700; }
.help summary::-webkit-details-marker { display: none; }
.help[open] { flex-basis: 100%; }
.help[open] summary { margin-left: auto; }
.help p { font-size: 14px; margin: 6px 0 2px; }

/* тост «Отменить» */
.toast { position: fixed; z-index: 20; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: max-content; max-width: min(92vw, 520px); display: flex; align-items: center; gap: 14px; padding: 10px 16px;
  border-radius: 14px; background: #3B3428; color: #FFF8EA; font-size: 15px; box-shadow: 0 6px 20px rgba(0,0,0,.25);
  transition: opacity .4s; }
.toast.hide { opacity: 0; pointer-events: none; }
.toast-error { background: var(--danger-fg); }
.toast .link-btn { color: #F1DFA6; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--green-dk); text-decoration: underline; font: inherit; font-weight: 600; cursor: pointer; }

/* ===== Список: одинаковые карточки, ряды фиксированной высоты ===== */
.plist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 700px) { .plist { grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 14px; } }
.pc { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 40px 132px 22px 44px; row-gap: 8px;
  height: 278px; padding-bottom: 10px; background: var(--cream); border: 1px solid var(--border); border-radius: var(--r);
  overflow: hidden; box-shadow: 0 2px 8px rgba(150,130,100,.16); scroll-margin-top: 12px; }
.pc.st-overdue { border-color: #D9907A; box-shadow: 0 0 0 1px #D9907A, 0 2px 8px rgba(150,130,100,.16); }
.pc-head { display: flex; align-items: center; gap: 8px; padding: 0 10px; text-decoration: none; min-width: 0; }
.num { flex: 0 0 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: #FFF8EA; font-size: 13px; font-weight: 700; }
.pc-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; font-size: 15px; }
.pc-pic { justify-self: center; width: 132px; height: 132px; border-radius: 12px; overflow: hidden; }
.pc-pic img { display: block; width: 100%; height: 100%; }
.pc-due { display: flex; align-items: center; gap: 6px; margin: 0 10px; min-width: 0; text-decoration: none; font-size: 14px; font-weight: 700; }
.pc-due span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.due-short { display: none; }
@media (max-width: 699px) { .due-long { display: none; } .due-short { display: inline; } }
.dot { flex: 0 0 10px; height: 10px; border-radius: 50%; background: #9DB386; }
.st-today .dot, .st-unknown .dot { background: #D9A928; }
.st-overdue .dot { background: #C8553A; }
.st-ok .pc-due { color: var(--ok-fg); }
.st-today .pc-due, .st-unknown .pc-due { color: var(--warn-fg); }
.st-overdue .pc-due { color: var(--danger-fg); }
.pc-act { margin: 0 10px; }
.pc-act .btn { width: 100%; height: 44px; }

/* кнопки */
.btn { min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--border); background: #FFF8EA; color: var(--ink);
  font: inherit; font-weight: 700; font-size: 15px; cursor: pointer; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; }
.btn-water { background: var(--green); border-color: var(--green-dk); color: #fff; }

/* ===== Страница растения ===== */
.back { display: inline-block; margin-bottom: 10px; padding: 8px 14px; border-radius: 12px; background: var(--cream-2); border: 1px solid var(--border); text-decoration: none; font-weight: 600; }
.detail { max-width: 760px; margin: 0 auto; background: var(--cream); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.d-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; font-weight: 700; font-size: 18px; }
.d-title { min-width: 0; }
.d-title small { display: block; font-weight: 400; font-size: 13px; color: var(--ink-soft); }
.d-hero { display: grid; grid-template-columns: 1fr; gap: 14px; padding: 14px; }
.d-pic { justify-self: center; width: 200px; height: 200px; border-radius: 16px; overflow: hidden; }
.d-pic img { display: block; width: 100%; height: 100%; }
@media (min-width: 640px) { .d-hero { grid-template-columns: 224px 1fr; align-items: start; } .d-pic { width: 224px; height: 224px; } }
/* таблица «подпись — значение»: одна ширина колонки подписей на всей странице */
.kv { display: grid; grid-template-columns: var(--label-w) minmax(0, 1fr); gap: 7px 12px; margin: 0; font-size: 15px; align-items: baseline; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; }
.kv-wide { --label-w: 128px; font-size: 14px; }
.due-overdue { color: var(--danger-fg); font-weight: 700; }
.due-today, .due-unknown { color: var(--warn-fg); font-weight: 700; }
.due-ok { color: var(--ok-fg); font-weight: 700; }
.pill { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.pill-h-ok { background: var(--ok-bg); color: var(--ok-fg); }
.pill-h-warn { background: var(--warn-bg); color: var(--warn-fg); }
.pill-h-danger { background: var(--danger-bg); color: var(--danger-fg); }
.pill-h-calm { background: var(--calm-bg); }
.d-main { display: grid; gap: 14px; min-width: 0; }
.d-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.d-actions .btn-water { grid-column: 1 / -1; }
.d-date { grid-column: 1 / -1; display: grid; grid-template-columns: var(--label-w) minmax(0, 1fr); gap: 12px; align-items: center; color: var(--ink-soft); font-size: 15px; }
.d-date input { font: inherit; height: 40px; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--border); background: #FFF8EA; max-width: 220px; }
@media (min-width: 900px) { .d-actions { grid-template-columns: repeat(3, 1fr); } .d-actions .btn-water { grid-column: auto; } }
.d-undo { margin-top: -8px; }
.d-undo .link-btn { font-size: 14px; color: var(--ink-soft); }
.acc { margin-top: 10px; }
.acc details { border-top: 1px solid var(--border); }
.acc summary { cursor: pointer; padding: 13px 14px; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 6px; }
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after { content: "›"; margin-left: auto; font-size: 20px; line-height: 1; color: var(--ink-soft); transition: transform .15s; }
.acc details[open] > summary::after { transform: rotate(90deg); }
.acc details > :not(summary) { margin-left: 14px; margin-right: 14px; }
.acc details > :last-child { margin-bottom: 14px; }
.acc p { font-size: 14px; margin-top: 0; }
.d-note { display: grid; gap: 8px; }
textarea, .login input { width: 100%; font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: #FFF8EA; }
.tips { padding-left: 20px; font-size: 14px; margin-top: 0; }
.tips li { margin: 4px 0; }
.photo { width: 100%; max-width: 520px; border-radius: 12px; display: block; }

/* история и журнал: одна сетка «дата — событие» */
.hist, .history { list-style: none; padding: 0; margin: 0; }
.hist li, .history li { display: grid; grid-template-columns: var(--label-w) minmax(0, 1fr); gap: 2px 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.hist li:last-child { border-bottom: 0; }
.h-date { grid-row: 1 / span 2; font-weight: 600; }
.h-what, .h-meta, .h-plant { grid-column: 2; }
.h-meta, .h-who { font-size: 13px; color: var(--ink-soft); }
.hist li.undone .h-what, .history li.undone .h-what, .history li.undone .h-plant { text-decoration: line-through; opacity: .6; }
.history li.h-day { display: block; border: 0; padding-top: 14px; font-weight: 700; }
.history.journal li { grid-template-columns: minmax(0, 1fr); }
.history.journal li > * { grid-column: 1; }
.h-plant { font-weight: 600; }

/* общие панели: журнал, настройки, вход */
.box, .panel { background: var(--cream-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin: 0 auto 12px; max-width: 760px; }
.box h3, .panel h3 { margin: 2px 0 8px; font-size: 17px; }
.panel p { margin: 6px 0; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.help-inline summary { cursor: pointer; font-weight: 600; margin-top: 8px; }
.login { max-width: 360px; margin: 40px auto; display: flex; flex-direction: column; gap: 10px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
.error { color: var(--danger-fg); font-weight: 700; }
