/* ============================================================
   Catalogo Peirano Vivai — "Botanico elegante"
   ============================================================ */

:root {
  --verde-bosco: #1f3d2b;
  --verde: #2e5d3a;
  --verde-chiaro: #5a7d52;
  --crema: #f7f4ec;
  --crema-2: #efe9da;
  --card: #fffdf8;
  --terracotta: #b5623c;
  --oro: #a98b4f;
  --testo: #2a2a22;
  --testo-soft: #6b6b5e;
  --bordo: rgba(31, 61, 43, 0.14);
  --ombra: 0 1px 2px rgba(31, 61, 43, .05), 0 8px 24px -12px rgba(31, 61, 43, .18);
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --r: 14px;
  --max: 1180px;
  /* semantici (cambiano col tema) */
  --ink: #1f3d2b;
  --surface: #fff;
  --pill-active: #fff;
  --bg-blur: rgba(247, 244, 236, 0.86);
  --body-glow: #ffffff;
}

/* ============ Tema scuro ============ */
html[data-theme="dark"] {
  --verde-chiaro: #7fa874;
  --crema: #14150f;
  --crema-2: #23241b;
  --card: #1c1d16;
  --terracotta: #d4865f;
  --oro: #cBa968;
  --testo: #e8e5d8;
  --testo-soft: #9d9a8a;
  --bordo: rgba(255, 255, 255, 0.12);
  --ombra: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 26px -14px rgba(0, 0, 0, .6);
  --ink: #d9e8cd;
  --surface: #22231b;
  --pill-active: #34362a;
  --bg-blur: rgba(20, 21, 15, 0.86);
  --body-glow: #20231a;
}
html[data-theme="dark"] body {
  background:
    radial-gradient(1200px 600px at 80% -10%, var(--body-glow) 0%, var(--crema) 55%) no-repeat,
    var(--crema);
}
/* in dark le foto un filo meno abbaglianti */
html[data-theme="dark"] .card-media img,
html[data-theme="dark"] .ptile img,
html[data-theme="dark"] .detail-photo img { filter: brightness(.94); }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--testo);
  background:
    radial-gradient(1200px 600px at 80% -10%, #ffffff 0%, var(--crema) 55%) no-repeat,
    var(--crema);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-blur);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--bordo);
}
.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; flex: 1 1 auto; min-width: 220px; }
.brand img { height: 46px; width: auto; display: block; }
.brand .titles { display: flex; flex-direction: column; line-height: 1.1; }
.brand .kicker {
  font-family: var(--sans);
  font-size: .68rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--verde-chiaro);
  font-weight: 600;
}
.brand h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.9rem;
  margin: 0;
  color: var(--ink);
  letter-spacing: .01em;
}
.brand .sub { font-size: .8rem; color: var(--testo-soft); margin-top: 2px; }

/* ---------- Search ---------- */
.search {
  position: relative;
  flex: 1 1 320px;
  max-width: 460px;
}
.search input {
  width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  padding: 12px 42px 12px 44px;
  border: 1px solid var(--bordo);
  border-radius: 999px;
  background: var(--surface);
  color: var(--testo);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search input:focus {
  border-color: var(--verde-chiaro);
  box-shadow: 0 0 0 4px rgba(90, 125, 82, .15);
}
.search .icon-search {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--verde-chiaro); pointer-events: none;
}
.search .clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: var(--crema-2); color: var(--testo-soft);
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  display: none; align-items: center; justify-content: center; font-size: 16px; line-height: 1;
}
.search.has-value .clear { display: flex; }

/* ---------- Filters bar ---------- */
.filters {
  position: sticky;
  top: 75px;
  z-index: 20;
  background: var(--bg-blur);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--bordo);
}
.filters-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* ---- Toolbar / switcher viste + tema ---- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.viewbar, .themebar {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--crema-2); border-radius: 999px;
}
.themebar button {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; cursor: pointer;
  width: 34px; height: 30px; border-radius: 999px; color: var(--verde);
  transition: background .14s, color .14s, box-shadow .14s;
}
.themebar button svg { width: 17px; height: 17px; }
.themebar button:hover { color: var(--ink); }
.viewbar button {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: transparent; cursor: pointer;
  padding: 6px 13px; border-radius: 999px;
  font-family: var(--sans); font-size: .82rem; font-weight: 600; color: var(--verde);
  transition: background .14s, color .14s, box-shadow .14s;
}
.viewbar button svg { width: 17px; height: 17px; }
.viewbar button:hover { color: var(--ink); }
.viewbar button.active, .themebar button.active {
  background: var(--pill-active); color: var(--ink);
  box-shadow: 0 1px 3px rgba(31,61,43,.22);
}

.alpha {
  display: flex; flex-wrap: wrap; gap: 3px;
}
.alpha button {
  font-family: var(--sans);
  border: 0; background: transparent; cursor: pointer;
  width: 28px; height: 28px; border-radius: 8px;
  font-size: .82rem; font-weight: 600; color: var(--verde);
  transition: background .12s, color .12s;
}
.alpha button:hover { background: var(--crema-2); }
.alpha button.active { background: var(--verde-bosco); color: #fff; }
.alpha button:disabled { color: var(--bordo); cursor: default; }

.shapes { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--bordo); background: var(--surface);
  padding: 5px 12px 5px 9px; border-radius: 999px;
  font-size: .8rem; font-weight: 600; color: var(--testo);
  cursor: pointer; transition: all .12s; white-space: nowrap;
}
.chip svg { width: 15px; height: 15px; }
.chip:hover { border-color: var(--verde-chiaro); }
.chip.active { background: var(--verde-bosco); color: #fff; border-color: var(--ink); }
.chip.active svg { color: #fff !important; }
.chip .count { opacity: .6; font-weight: 500; }
.reset {
  border: 0; background: transparent; color: var(--terracotta);
  font-weight: 600; font-size: .8rem; cursor: pointer; padding: 5px 8px;
  text-decoration: underline; text-underline-offset: 3px;
}
.reset[hidden] { display: none; }

/* ---------- Main ---------- */
main { max-width: var(--max); margin: 0 auto; padding: 26px 20px 80px; }

.result-meta { color: var(--testo-soft); font-size: .85rem; margin: 0 0 18px; }
.result-meta b { color: var(--ink); }

.genus {
  margin: 0 0 30px;
  scroll-margin-top: 150px;
}
.genus-head {
  display: flex; align-items: baseline; gap: 12px;
  padding-bottom: 8px; margin-bottom: 14px;
  border-bottom: 2px solid var(--verde-bosco);
}
.genus-head h2 {
  font-family: var(--serif); font-weight: 600;
  font-size: 2rem; line-height: 1; margin: 0; color: var(--ink);
}
.genus-head .count { font-size: .8rem; color: var(--testo-soft); font-weight: 500; }

.species-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}

.card {
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--bordo);
  border-radius: var(--r);
  box-shadow: var(--ombra);
  overflow: hidden;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--verde-chiaro);
  box-shadow: 0 2px 4px rgba(31,61,43,.06), 0 18px 36px -16px rgba(31,61,43,.32);
}
.card-media {
  position: relative;
  height: 175px;
  display: flex; align-items: center; justify-content: center;
  background:
    linear-gradient(135deg, rgba(255,255,255,.4), rgba(255,255,255,0)),
    var(--cat-bg, #e9eee3);
  border-bottom: 1px solid var(--bordo);
  overflow: hidden;
}
.card-media svg { width: 56px; height: 56px; color: var(--cat-fg, var(--verde)); opacity: .85; }
.card-media img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .35s ease;
}
.card:hover .card-media img { transform: scale(1.05); }
.card-media::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 -40px 40px -30px rgba(31, 61, 43, .25);
}
.card-body { padding: 13px 15px 15px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-name { font-family: var(--serif); font-size: 1.42rem; line-height: 1.05; color: var(--ink); }
.card-name .sp { font-style: italic; }
.card-volgare { font-size: .76rem; color: var(--testo-soft); margin-top: -4px; }

.variants { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.variant {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center; gap: 8px;
  font-size: .82rem; padding: 4px 0;
  border-top: 1px dashed var(--bordo);
}
.variant:first-child { border-top: 0; }
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .7rem; font-weight: 700; letter-spacing: .01em;
  padding: 2px 8px 2px 6px; border-radius: 999px;
  background: var(--cat-bg, #e9eee3); color: var(--cat-fg, var(--verde));
}
.badge svg { width: 12px; height: 12px; }
.variant .dims { color: var(--testo-soft); font-size: .76rem; }
.variant .dims b { color: var(--testo); font-weight: 600; }
.variant .price { font-weight: 700; color: var(--ink); white-space: nowrap; }
.variant .price small { font-weight: 600; color: var(--testo-soft); }
.variant .price.na { color: var(--testo-soft); font-weight: 600; font-size: .76rem; }
.variant-more { font-size: .76rem; color: var(--terracotta); font-weight: 600; padding-top: 4px; }

/* ============ Vista GALLERIA ============ */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
}
.ptile {
  position: relative; display: block; padding: 0; border: 0; cursor: pointer;
  aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden;
  background: var(--cat-bg, #e9eee3);
  box-shadow: var(--ombra);
}
.ptile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.ptile-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.ptile-icon svg { width: 46px; height: 46px; color: var(--cat-fg, var(--verde)); opacity: .85; }
.ptile:hover img { transform: scale(1.08); }
.ptile-name {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 26px 12px 11px; text-align: left; color: #fff;
  font-family: var(--serif); font-size: 1.18rem; line-height: 1.1;
  background: linear-gradient(to top, rgba(20,35,22,.92) 10%, rgba(20,35,22,.55) 55%, rgba(20,35,22,0));
  opacity: 0; transition: opacity .2s ease; pointer-events: none;
}
.ptile-name i { font-style: normal; font-weight: 600; }
.ptile-name small { display: block; font-family: var(--sans); font-size: .68rem; font-weight: 600; opacity: .85; margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }
.ptile:hover .ptile-name, .ptile:focus-visible .ptile-name { opacity: 1; }
@media (hover: none) {
  .ptile-name { opacity: 1; padding-top: 34px; }  /* mobile: nome sempre visibile */
}

/* ============ Vista ELENCO ============ */
.table-wrap { border: 1px solid var(--bordo); border-radius: 12px; background: var(--card); }
table.elenco { width: 100%; border-collapse: collapse; font-size: .84rem; table-layout: auto; }
table.elenco thead th {
  position: sticky; top: var(--elenco-top, 120px); z-index: 5;
  background: var(--verde-bosco); color: #fff;
  text-align: left; font-weight: 600; font-size: .74rem;
  letter-spacing: .03em; text-transform: uppercase;
  padding: 9px 10px; white-space: nowrap;
}
table.elenco thead th:first-child { border-radius: 11px 0 0 0; }
table.elenco thead th:last-child { border-radius: 0 11px 0 0; }
table.elenco th.sortable { cursor: pointer; user-select: none; }
table.elenco th.sortable:hover { background: var(--verde); }
table.elenco th.sorted { color: #ffe8a8; }
table.elenco th.num { text-align: right; }
table.elenco th.th-img { width: 52px; }
table.elenco td { padding: 6px 10px; border-top: 1px solid var(--bordo); vertical-align: middle; }
table.elenco tbody tr { cursor: pointer; transition: background .1s; }
table.elenco tbody tr:hover { background: #f3efe2; }
table.elenco td.num { text-align: right; white-space: nowrap; }
table.elenco td.mono { font-variant-numeric: tabular-nums; color: var(--testo-soft); }
table.elenco td.c-gen { font-weight: 600; color: var(--ink); }
table.elenco td.c-sp { font-family: var(--serif); font-size: 1rem; font-style: italic; }
table.elenco td.c-vol { color: var(--testo-soft); }
table.elenco td.price { font-weight: 700; color: var(--ink); }
table.elenco td.price .na { font-weight: 600; color: var(--testo-soft); font-size: .78rem; }
.td-img { width: 52px; }
.td-img img { width: 44px; height: 44px; object-fit: cover; border-radius: 7px; display: block; }
.th-icon { width: 44px; height: 44px; border-radius: 7px; display: flex; align-items: center; justify-content: center; }
.th-icon svg { width: 22px; height: 22px; }
.badge.sm { font-size: .66rem; padding: 2px 7px 2px 5px; }
.badge.sm svg { width: 11px; height: 11px; }

/* Responsive: invece dello scroll orizzontale, nascondo colonne secondarie.
   Ordine colonne: 1 img · 2 Cod · 3 Genere · 4 Specie · 5 Volgare · 6 Forma · 7 Vaso · 8 Altezza · 9 Prezzo */
@media (max-width: 880px) {
  table.elenco th:nth-child(2), table.elenco td:nth-child(2),   /* Cod */
  table.elenco th:nth-child(8), table.elenco td:nth-child(8) {  /* Altezza */
    display: none;
  }
}
@media (max-width: 640px) {
  table.elenco th:nth-child(5), table.elenco td:nth-child(5),   /* Volgare */
  table.elenco th:nth-child(7), table.elenco td:nth-child(7) {  /* Vaso */
    display: none;
  }
}

.empty {
  text-align: center; color: var(--testo-soft);
  padding: 70px 20px; font-size: 1.05rem;
}
.empty .big { font-family: var(--serif); font-size: 1.6rem; color: var(--ink); display: block; margin-bottom: 6px; }

/* ---------- Pagina dedicata (detail) ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: var(--crema);
  display: none; overflow-y: auto;
}
.modal-backdrop.open { display: block; animation: detailIn .22s ease; }
@keyframes detailIn { from { opacity: .3; } to { opacity: 1; } }
.modal { min-height: 100%; }

.detail-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
  background: var(--bg-blur);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--bordo);
}
.detail-back {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--bordo); background: var(--surface); cursor: pointer;
  padding: 8px 16px 8px 12px; border-radius: 999px;
  font-family: var(--sans); font-size: .88rem; font-weight: 600; color: var(--ink);
  transition: border-color .14s, background .14s;
}
.detail-back:hover { border-color: var(--verde-chiaro); background: var(--surface); }
.detail-back svg { width: 17px; height: 17px; }
.detail-crumb { color: var(--testo-soft); font-size: .85rem; }
.detail-crumb span { opacity: .6; margin: 0 4px; }

.detail-hero {
  max-width: var(--max); margin: 0 auto;
  padding: 28px 20px 10px;
  display: grid; grid-template-columns: 1fr; gap: 26px;
}
.detail-photo {
  position: relative; border-radius: 18px; overflow: hidden;
  background: var(--cat-bg, #e9eee3);
  aspect-ratio: 4 / 3; box-shadow: var(--ombra);
  display: flex; align-items: center; justify-content: center;
}
.detail-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-icon svg { width: 96px; height: 96px; color: var(--cat-fg, var(--verde)); opacity: .9; }
.detail-side { display: flex; flex-direction: column; }
.detail-kicker {
  font-size: .72rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  margin-bottom: 8px;
}
.detail-title {
  font-family: var(--serif); font-weight: 600; font-size: clamp(2.2rem, 6vw, 3.2rem);
  line-height: 1; margin: 0; color: var(--ink);
}
.detail-title .sp { font-style: italic; }
.detail-volgare { color: var(--testo-soft); margin: 8px 0 0; font-size: 1.02rem; }
.detail-price {
  font-family: var(--serif); font-size: 2.1rem; color: var(--ink);
  margin: 18px 0 18px;
}
.detail-price small { font-family: var(--sans); font-size: .8rem; color: var(--testo-soft); font-weight: 600; vertical-align: middle; margin-right: 2px; }
.detail-price.na { font-size: 1.3rem; color: var(--testo-soft); }
.detail-side .btn-info { width: auto; align-self: flex-start; }
.detail-availability { color: var(--testo-soft); font-size: .82rem; margin: 14px 0 0; }

.detail-specs, .detail-block { max-width: var(--max); margin: 0 auto; padding: 6px 20px; }
.detail-specs { padding-bottom: 80px; }
.detail-specs h2, .detail-block h2 {
  font-family: var(--serif); font-size: 1.7rem; color: var(--ink);
  margin: 22px 0 14px; padding-bottom: 8px; border-bottom: 2px solid var(--verde-bosco);
}
.detail-desc { font-size: 1.06rem; line-height: 1.65; color: var(--testo); margin: 0; max-width: 70ch; }

/* galleria */
.detail-gallery { display: flex; flex-direction: column; gap: 10px; }
.dg-main {
  border-radius: 18px; overflow: hidden; background: var(--crema-2);
  aspect-ratio: 4 / 3; box-shadow: var(--ombra);
}
.dg-main img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dg-thumbs {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px;
  overflow-x: auto; scrollbar-width: thin; padding-bottom: 2px;
}
.dg-thumb {
  border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer;
  padding: 0; background: var(--crema-2); aspect-ratio: 1 / 1; min-width: 56px;
  transition: border-color .12s, transform .12s;
}
.dg-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dg-thumb:hover { transform: translateY(-2px); }
.dg-thumb.active { border-color: var(--verde-chiaro); }

/* scheda pianta — griglia compatta a icone */
.care-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px;
}
.care-item {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 7px;
  background: var(--card); border: 1px solid var(--bordo); border-radius: 14px; padding: 15px 10px 13px;
}
.care-ic {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--crema-2); color: var(--verde);
}
.care-ic svg { width: 23px; height: 23px; }
.care-txt { display: flex; flex-direction: column; min-width: 0; }
.care-label { font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; color: var(--testo-soft); font-weight: 700; }
.care-val { font-size: .9rem; color: var(--ink); font-weight: 600; line-height: 1.25; margin-top: 3px; }
.care-fact {
  margin-top: 14px; padding: 13px 16px; border-radius: 12px;
  background: var(--crema-2); border-left: 3px solid var(--oro);
  font-size: .92rem; color: var(--testo); line-height: 1.5;
}
.care-fact b { color: var(--ink); }
.modal-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.modal-table th {
  text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--testo-soft); font-weight: 700; padding: 8px 8px; border-bottom: 2px solid var(--bordo);
}
.modal-table td { padding: 9px 8px; border-bottom: 1px solid var(--bordo); font-size: .88rem; }
.modal-table tr:last-child td { border-bottom: 0; }
.modal-table .price { font-weight: 700; color: var(--ink); }
.modal-note { font-size: .76rem; color: var(--testo-soft); margin: 6px 0 18px; }
.btn-info {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--verde-bosco); color: #fff; text-decoration: none;
  font-weight: 600; font-size: .95rem;
  padding: 13px 22px; border-radius: 999px; width: 100%; justify-content: center;
  transition: background .15s;
}
.btn-info:hover { background: var(--verde); }
.btn-info svg { width: 18px; height: 18px; }
.btn-info[data-add] { cursor: pointer; border: 0; font-family: var(--sans); }

.detail-cta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 2px 0; }
.detail-side .btn-info, .btn-outline { width: auto; }
.btn-outline {
  display: inline-flex; align-items: center; gap: 9px;
  border: 1px solid var(--bordo); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: .95rem; padding: 12px 20px; border-radius: 999px;
  text-decoration: none; cursor: pointer; transition: border-color .15s;
}
.btn-outline:hover { border-color: var(--verde-chiaro); }
.btn-outline svg { width: 18px; height: 18px; }

/* ---------- Loader / footer ---------- */
.loader { text-align: center; padding: 80px 20px; color: var(--testo-soft); }
.sentinel { height: 1px; }
.site-footer {
  border-top: 1px solid var(--bordo); margin-top: 40px;
  padding: 26px 20px; text-align: center; color: var(--testo-soft); font-size: .8rem;
}
.site-footer a { color: var(--verde); }

@media (min-width: 760px) {
  .detail-hero {
    grid-template-columns: 1.05fr 1fr;
    align-items: center;
    padding-top: 36px;
  }
  .detail-photo { aspect-ratio: 1 / 1; }
  .detail-side { padding-left: 8px; }
}
@media (max-width: 540px) {
  .brand h1 { font-size: 1.6rem; }
  .brand img { height: 38px; }
  .filters { top: 64px; }
  .genus-head h2 { font-size: 1.7rem; }
}

/* ============ La mia lista delle piante (FAB + drawer) ============ */
.fab-list {
  position: fixed; right: 20px; bottom: 20px; z-index: 40;
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--verde-bosco); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px -6px rgba(31,61,43,.5);
  transition: transform .15s, background .15s;
}
.fab-list:hover { transform: translateY(-3px); background: var(--verde); }
.fab-list svg { width: 27px; height: 27px; }
.fab-list.pulse { animation: fabPulse .4s ease; }
@keyframes fabPulse { 0%{transform:scale(1)} 40%{transform:scale(1.18)} 100%{transform:scale(1)} }
.fab-count {
  position: absolute; top: -3px; right: -3px; min-width: 22px; height: 22px; padding: 0 5px;
  border-radius: 999px; background: var(--terracotta); color: #fff;
  font: 700 .72rem/22px var(--sans); text-align: center; box-shadow: 0 0 0 2px var(--crema);
}

.drawer-overlay { position: fixed; inset: 0; z-index: 44; background: rgba(31,45,30,.5); backdrop-filter: blur(2px); }
.drawer {
  position: fixed; top: 0; right: 0; z-index: 45; height: 100%;
  width: min(420px, 100%); display: flex; flex-direction: column;
  background: var(--crema); box-shadow: -10px 0 40px rgba(0,0,0,.25);
  animation: drawerIn .22s ease;
}
@keyframes drawerIn { from { transform: translateX(30px); opacity: .5; } to { transform: none; opacity: 1; } }
.drawer-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--bordo); display: flex; gap: 10px; }
.drawer-titles { flex: 1; min-width: 0; }
.drawer-kicker {
  display: block; font-family: var(--serif); font-size: 1.35rem; color: var(--ink); line-height: 1; margin-bottom: 9px;
}
.drawer-listrow { display: flex; gap: 6px; align-items: center; }
#listSelect {
  flex: 1; min-width: 0; font-family: var(--sans); font-size: .9rem; font-weight: 600; color: var(--ink);
  padding: 7px 10px; border: 1px solid var(--bordo); border-radius: 9px; background: var(--surface);
}
.lbtn {
  flex: none; width: 32px; height: 32px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--bordo); background: var(--surface); color: var(--verde);
  display: flex; align-items: center; justify-content: center;
}
.lbtn:hover { border-color: var(--verde-chiaro); }
.lbtn svg { width: 16px; height: 16px; }
.drawer-close { flex: none; width: 34px; height: 34px; border: 0; background: transparent; font-size: 24px; color: var(--testo-soft); cursor: pointer; line-height: 1; }

.drawer-body { flex: 1; overflow-y: auto; padding: 12px 16px; }
.drawer-empty { text-align: center; color: var(--testo-soft); padding: 50px 16px; }
.drawer-empty svg { width: 48px; height: 48px; color: var(--bordo); margin-bottom: 10px; }

.li-item { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--bordo); }
.li-thumb { flex: none; width: 56px; height: 56px; border-radius: 9px; object-fit: cover; background: var(--crema-2); }
.li-main { flex: 1; min-width: 0; }
.li-name { font-family: var(--serif); font-size: 1.12rem; color: var(--ink); line-height: 1.05; }
.li-name .sp { font-style: italic; }
.li-meta { font-size: .74rem; color: var(--testo-soft); margin-top: 1px; }
.li-row2 { display: flex; align-items: center; justify-content: space-between; margin-top: 7px; gap: 8px; }
.qty { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--bordo); border-radius: 999px; background: var(--surface); }
.qty button { width: 26px; height: 26px; border: 0; background: transparent; cursor: pointer; font-size: 16px; color: var(--verde-bosco); line-height: 1; }
.qty span { min-width: 24px; text-align: center; font-weight: 700; font-size: .85rem; }
.li-price { font-weight: 700; color: var(--ink); font-size: .92rem; white-space: nowrap; }
.li-price small { color: var(--testo-soft); font-weight: 600; }
.li-remove { border: 0; background: transparent; color: var(--terracotta); cursor: pointer; font-size: .76rem; text-decoration: underline; text-underline-offset: 2px; }

.drawer-foot { border-top: 1px solid var(--bordo); padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); background: var(--card); }
.foot-total { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.foot-total b { font-family: var(--serif); font-size: 1.7rem; color: var(--ink); }
.foot-total span { font-size: .8rem; color: var(--testo-soft); }
.foot-note { font-size: .72rem; color: var(--testo-soft); margin: 0 0 12px; }
.foot-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.foot-actions .btn-info { width: 100%; grid-column: 1 / -1; padding: 12px; }
.foot-mini {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--bordo); background: var(--surface); color: var(--verde-bosco);
  font-weight: 600; font-size: .82rem; padding: 9px; border-radius: 10px; cursor: pointer;
}
.foot-mini:hover { border-color: var(--verde-chiaro); }
.foot-mini svg { width: 15px; height: 15px; }
.foot-mini.danger { color: var(--terracotta); }

/* aggiunta rapida sulle card */
.card-add {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.92); color: var(--verde-bosco);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(31,61,43,.25); opacity: 0; transform: scale(.8);
  transition: opacity .14s, transform .14s, background .14s;
}
.card:hover .card-add, .card-add:focus { opacity: 1; transform: scale(1); }
.card-add svg { width: 18px; height: 18px; }
.card-add.done { background: var(--verde-bosco); color: #fff; opacity: 1; transform: scale(1); }
@media (hover: none) { .card-add { opacity: 1; transform: scale(1); } }

/* pulsante aggiungi nella tabella misure + scheda */
.add-btn {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  border: 1px solid var(--verde-bosco); background: transparent; color: var(--verde-bosco);
  font-weight: 600; font-size: .78rem; padding: 5px 11px; border-radius: 999px; cursor: pointer;
  transition: background .12s, color .12s;
}
.add-btn:hover { background: var(--verde-bosco); color: #fff; }
.add-btn svg { width: 14px; height: 14px; }
.modal-table td.col-add { text-align: right; width: 1%; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(10px);
  z-index: 60; background: var(--verde-bosco); color: #fff; font-weight: 600; font-size: .88rem;
  padding: 11px 18px; border-radius: 999px; box-shadow: 0 8px 24px -6px rgba(0,0,0,.4);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* stampa */
.print-sheet { display: none; }
@media print {
  body > * { display: none !important; }
  .print-sheet { display: block !important; padding: 0; color: #000; }
  .print-sheet h1 { font-family: var(--serif); }
  .print-sheet table { width: 100%; border-collapse: collapse; margin-top: 12px; }
  .print-sheet th, .print-sheet td { border-bottom: 1px solid #ccc; padding: 7px 6px; text-align: left; font-size: 12px; }
  .print-sheet .pt-total { font-size: 18px; font-weight: 700; margin-top: 14px; text-align: right; }
}
