/* Гербарий — токены */
:root {
  --ink: #22271F;          /* тёмная хвоя, почти чёрный */
  --pine: #1E3A2A;         /* глубокий зелёный */
  --paper: #FBFAF6;        /* фон */
  --card: #FFFFFF;
  --line: #E2E0D6;
  --peony: #A83254;        /* пионовый малиновый — акцент */
  --muted: #7C8177;
  --display: "Spectral", Georgia, serif;
  --ui: "Inter", -apple-system, system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  font-family: var(--ui);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* ---------- каркас ---------- */
.screen { min-height: 100dvh; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: var(--pine); color: #F4F1E6;
}
.brand {
  font-family: var(--display); font-weight: 600; font-size: 26px;
  letter-spacing: 0.01em;
}
.topbar h2 {
  font-family: var(--display); font-style: italic; font-weight: 600;
  font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.count { margin-left: auto; font-size: 13px; opacity: .75; }
.back {
  border: 0; background: none; color: inherit;
  font-size: 30px; line-height: 1; padding: 0 6px 4px 0; cursor: pointer;
}

/* ---------- вход ---------- */
#login-screen { display: flex; align-items: center; justify-content: center; }
.login-card { width: min(340px, 88vw); text-align: center; }
.login-card .brand { color: var(--pine); font-size: 40px; }
.login-sub { color: var(--muted); margin: 6px 0 24px; }
.login-card input {
  width: 100%; padding: 13px 14px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px;
}

/* ---------- панель поиска ---------- */
.toolbar { padding: 12px 16px 4px; }
#search {
  width: 100%; padding: 11px 14px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
}
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 2px 6px; }
.chip {
  flex: 0 0 auto; padding: 6px 13px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--ink); cursor: pointer;
}
.chip.active { background: var(--pine); border-color: var(--pine); color: #F4F1E6; }

/* ---------- сетка карточек ---------- */
.grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 12px; padding: 8px 16px;
}
@media (min-width: 700px) { .grid { grid-template-columns: repeat(4, 1fr); } }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; cursor: pointer; position: relative;
}
.card::before {            /* «бирка» — фирменная полоска слева */
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; background: var(--peony); z-index: 1;
}
.card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.card .noimg {
  width: 100%; aspect-ratio: 1; display: flex; align-items: center;
  justify-content: center; font-size: 34px; background: #EFEDE4; color: var(--muted);
}
.card-meta { padding: 9px 10px 11px 12px; }
.card-cultivar {
  font-family: var(--display); font-style: italic; font-weight: 600;
  font-size: 16px; line-height: 1.25;
}
.card-species {
  font-size: 12px; color: var(--muted); margin-top: 2px; letter-spacing: .02em;
}
.empty { padding: 48px 32px; text-align: center; color: var(--muted); line-height: 1.5; }

/* ---------- FAB ---------- */
.fab {
  position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom));
  width: 60px; height: 60px; border-radius: 50%;
  border: 0; background: var(--peony); color: #fff;
  font-size: 32px; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 18px rgba(168, 50, 84, .4);
}
.fab:active { transform: scale(.94); }

/* ---------- мастер добавления ---------- */
.form-wrap { padding: 16px; max-width: 560px; margin: 0 auto; }
.photo-step { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.photo-slot {
  position: relative; aspect-ratio: 3/4; border: 1.5px dashed var(--line);
  border-radius: 12px; background: var(--card); overflow: hidden;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.photo-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot-label {
  position: relative; z-index: 1; font-size: 14px; color: var(--muted);
  background: rgba(251, 250, 246, .85); padding: 6px 10px; border-radius: 8px;
}
.status { margin: 12px 2px 0; font-size: 14px; color: var(--pine); }
.status.err { color: var(--peony); }

form label { display: block; margin-top: 14px; font-size: 13px; font-weight: 500; color: var(--muted); }
form input, form textarea {
  width: 100%; margin-top: 5px; padding: 11px 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  font-family: var(--ui);
}
input[name="cultivar"] { font-family: var(--display); font-style: italic; font-size: 18px; }
.row2 { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }

.btn {
  padding: 13px 20px; font-size: 16px; font-weight: 600; font-family: var(--ui);
  border: 0; border-radius: 10px; cursor: pointer;
}
.btn.primary { background: var(--pine); color: #F4F1E6; }
.btn.danger { background: none; color: var(--peony); border: 1px solid var(--peony); }
.btn.ghost { background: none; color: var(--pine); border: 1px solid var(--pine); }
.btn.wide { width: 100%; margin-top: 22px; }
.btn:disabled { opacity: .5; }
.error { color: var(--peony); font-size: 14px; }

/* ---------- карточка растения ---------- */
.detail { padding: 16px; max-width: 640px; margin: 0 auto; }
.detail-head { margin-bottom: 14px; }
.detail-cultivar {
  font-family: var(--display); font-style: italic; font-weight: 600; font-size: 28px;
  line-height: 1.15;
}
.detail-species { color: var(--muted); font-size: 15px; margin-top: 3px; }
.gallery { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 10px; }
.gallery figure { flex: 0 0 auto; width: 160px; position: relative; }
.gallery img { width: 160px; height: 160px; object-fit: cover; border-radius: 10px; display: block; }
.gallery figcaption { font-size: 11px; color: var(--muted); margin-top: 4px; }
.gallery .del-photo {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px;
  border: 0; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff;
  font-size: 14px; cursor: pointer;
}
.kv { border-top: 1px solid var(--line); }
.kv div { display: flex; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
.kv dt { flex: 0 0 128px; color: var(--muted); }
.kv dd { flex: 1; }
.detail-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.add-photo-label { display: inline-block; }

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

/* v2 */
.spec-badge{display:inline-block;font-size:11px;font-weight:600;color:var(--peony);
  border:1px solid var(--peony);border-radius:6px;padding:1px 6px;margin-left:5px;font-style:normal}
.btn.accent{background:var(--peony);color:#fff}
.label-wrap{padding:20px 16px;max-width:560px;margin:0 auto;text-align:center}
.label-canvas-box{background:#fff;border:1px solid var(--line);border-radius:8px;padding:12px;display:inline-block}
img.label{max-width:100%;height:auto}
.hint{font-size:13px;color:var(--muted);margin-top:12px;line-height:1.5}
.slot-label small{font-weight:400;font-size:11px}
