:root {
  --green-900: #10281c;
  --green-800: #17392a;
  --green-700: #1e4a37;
  --green-600: #276148;
  --green-500: #2f7d5b;
  --green-400: #4a9b76;
  --green-300: #7dbfa0;
  --green-100: #dff0e7;
  --green-50: #f1faf5;
  --lime: #a7d948;
  --lime-dark: #8bbc2f;
  --sand: #f6f3ec;
  --bark: #6b5342;
  --ink: #16241d;
  --muted: #5d7568;
  --line: #e2ece6;
  --white: #ffffff;
  --danger: #c0392b;
  --warn: #d98324;
  --ok: #2f9e5e;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(16, 40, 28, .08);
  --shadow-lg: 0 18px 50px rgba(16, 40, 28, .14);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--green-50);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  padding-bottom: calc(78px + var(--safe-bottom));
  min-height: 100vh;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 1rem; }

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 18px;
}

/* ---------------- En-tête ---------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: var(--safe-top);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 62px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -.02em;
  font-size: 1.12rem;
  color: var(--green-800);
  flex-shrink: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--green-500), var(--lime));
  display: grid;
  place-items: center;
}

.brand-mark svg { width: 20px; height: 20px; }
.brand small { display: block; font-size: .62rem; font-weight: 600; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }

.header-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  align-items: center;
}

.header-nav a {
  padding: 9px 13px;
  border-radius: 10px;
  font-size: .92rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.header-nav a:hover { background: var(--green-50); color: var(--green-700); }
.header-nav a.active { background: var(--green-100); color: var(--green-700); }

.header-actions { display: flex; align-items: center; gap: 8px; margin-left: 10px; }

.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--white);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--green-700);
}
.icon-btn svg { width: 20px; height: 20px; }

.badge-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--lime-dark);
  color: #123;
  font-size: .7rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--green-100);
}

/* ---------------- Boutons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  transition: transform .12s ease, background .18s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; }

.btn-primary { background: var(--green-600); color: #fff; }
.btn-primary:hover { background: var(--green-700); }
.btn-lime { background: var(--lime); color: var(--green-900); }
.btn-lime:hover { background: var(--lime-dark); }
.btn-ghost { background: var(--white); border-color: var(--line); color: var(--green-700); }
.btn-ghost:hover { background: var(--green-50); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 8px 14px; font-size: .85rem; border-radius: 10px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------------- Hero ---------------- */

.hero {
  position: relative;
  color: #fff;
  overflow: hidden;
  border-radius: 0 0 28px 28px;
}

.hero-media {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}

.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(16, 40, 28, .92) 0%, rgba(16, 40, 28, .55) 55%, rgba(47, 125, 91, .6) 100%);
}

.hero-inner {
  position: relative;
  padding: 52px 0 46px;
}

.hero h1 {
  font-size: clamp(1.9rem, 6vw, 3.2rem);
  line-height: 1.08;
  margin: 14px 0 12px;
  letter-spacing: -.03em;
  max-width: 15ch;
}

.hero p { max-width: 52ch; color: rgba(255, 255, 255, .88); font-size: 1.02rem; line-height: 1.6; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .28);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.pill svg { width: 15px; height: 15px; }

.hero-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 30px;
}

.hero-stat {
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.hero-stat strong { display: block; font-size: 1.5rem; letter-spacing: -.02em; }
.hero-stat span { font-size: .8rem; color: rgba(255, 255, 255, .8); }

/* ---------------- Sections ---------------- */

.section { padding: 42px 0; }
.section-tight { padding: 28px 0; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.section-head h2 {
  margin: 6px 0 0;
  font-size: clamp(1.35rem, 4.4vw, 2rem);
  letter-spacing: -.02em;
}

.eyebrow {
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--green-500);
}

.lead { color: var(--muted); line-height: 1.65; }
.muted { color: var(--muted); }
.small { font-size: .84rem; }

/* ---------------- Grilles ---------------- */

.grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 16px; grid-template-columns: 1fr; }

/* ---------------- Cartes ---------------- */

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--green-100);
  overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card-media img { transform: scale(1.05); }

.card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { margin: 0; font-size: 1.06rem; letter-spacing: -.01em; }
.card-body p { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.5; }
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 6px; }

.price { font-weight: 800; color: var(--green-700); font-size: 1.08rem; }
.price small { font-weight: 600; color: var(--muted); font-size: .76rem; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-700);
  font-size: .74rem;
  font-weight: 700;
}
.tag-lime { background: rgba(167, 217, 72, .25); color: var(--green-800); }
.tag-warn { background: rgba(217, 131, 36, .16); color: var(--warn); }
.tag-danger { background: rgba(192, 57, 43, .13); color: var(--danger); }
.tag-ok { background: rgba(47, 158, 94, .16); color: var(--ok); }
.tag-muted { background: #eef2ef; color: var(--muted); }

.card-media .tag { position: absolute; top: 12px; left: 12px; }

/* Catégories */

.cat-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 168px;
  display: flex;
  align-items: flex-end;
  color: #fff;
  box-shadow: var(--shadow);
}
.cat-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cat-card::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(11, 30, 21, .86), rgba(11, 30, 21, .1)); }
.cat-card-body { position: relative; padding: 16px; }
.cat-card-body h3 { margin: 0 0 4px; font-size: 1.05rem; }
.cat-card-body span { font-size: .8rem; color: rgba(255, 255, 255, .85); }

/* ---------------- Formulaires ---------------- */

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: .85rem; font-weight: 700; color: var(--green-800); }

.input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, select:focus, textarea:focus {
  border-color: var(--green-400);
  box-shadow: 0 0 0 3px rgba(74, 155, 118, .18);
}
textarea { resize: vertical; min-height: 110px; }

.form-row { display: grid; grid-template-columns: 1fr; gap: 0 14px; }

@media (min-width: 640px) {
  .form-row-2 { grid-template-columns: 1fr 1fr; }
}

.alert {
  padding: 12px 15px;
  border-radius: 12px;
  font-size: .9rem;
  font-weight: 600;
  margin-bottom: 14px;
}
.alert-error { background: rgba(192, 57, 43, .1); color: var(--danger); }
.alert-ok { background: rgba(47, 158, 94, .12); color: var(--ok); }
.alert-info { background: var(--green-100); color: var(--green-700); }

/* ---------------- Auth ---------------- */

.auth-wrap {
  min-height: 72vh;
  display: grid;
  place-items: center;
  padding: 26px 18px 40px;
}
.auth-card {
  width: 100%;
  max-width: 430px;
  background: var(--white);
  border-radius: 22px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  padding: 26px 22px;
}
.auth-card h1 { margin: 4px 0 6px; font-size: 1.6rem; letter-spacing: -.02em; }
.auth-switch { text-align: center; margin-top: 16px; font-size: .9rem; color: var(--muted); }
.auth-switch a { color: var(--green-600); font-weight: 700; }

/* ---------------- Serre ---------------- */

.garden-head {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  margin-bottom: 20px;
}
.garden-stat {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.garden-stat svg { width: 26px; height: 26px; color: var(--green-500); flex-shrink: 0; }
.garden-stat strong { display: block; font-size: 1.25rem; }
.garden-stat span { font-size: .78rem; color: var(--muted); }

.plot-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.plant-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.plant-thumb { position: relative; aspect-ratio: 1 / 1; background: var(--green-100); }
.plant-thumb img { width: 100%; height: 100%; object-fit: cover; }
.plant-thumb .tag { position: absolute; top: 8px; left: 8px; font-size: .68rem; padding: 3px 8px; }

.meter { height: 7px; border-radius: 6px; background: var(--green-100); overflow: hidden; margin-top: 6px; }
.meter > i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--green-400), var(--lime)); }
.meter.health > i { background: linear-gradient(90deg, var(--warn), var(--ok)); }

.plant-card-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.plant-card-body h4 { margin: 0; font-size: .96rem; }
.plant-meta { font-size: .76rem; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.plant-card-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; flex-wrap: wrap; }
.plant-card-actions .btn { flex: 1 1 auto; min-width: 0; }

.seed-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px;
}
.seed-item img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.seed-item h4 { margin: 0; font-size: .9rem; }
.seed-item .qty { margin-left: auto; font-weight: 800; color: var(--green-600); }

/* ---------------- Panier ---------------- */

.cart-line {
  display: grid;
  grid-template-columns: 68px 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
}
.cart-line img { width: 68px; height: 68px; border-radius: 12px; object-fit: cover; }
.cart-line h4 { margin: 0 0 3px; font-size: .95rem; }
.qty-control { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qty-control button { width: 32px; height: 32px; border: none; background: var(--green-50); color: var(--green-700); font-weight: 800; cursor: pointer; }
.qty-control span { min-width: 34px; text-align: center; font-weight: 700; font-size: .9rem; }

.summary {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: .92rem; color: var(--muted); }
.summary-row.total { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; font-size: 1.1rem; font-weight: 800; color: var(--green-800); }

/* ---------------- Tableaux ---------------- */

.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td { padding: 12px 14px; text-align: left; font-size: .88rem; border-bottom: 1px solid var(--line); }
th { background: var(--green-50); font-weight: 700; color: var(--green-800); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--green-50); }

/* ---------------- Navigation basse ---------------- */

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding-bottom: var(--safe-bottom);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 2px 9px;
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  position: relative;
}
.bottom-nav a svg { width: 22px; height: 22px; }
.bottom-nav a.active { color: var(--green-600); }
.bottom-nav a.active::before {
  content: "";
  position: absolute;
  top: 0;
  width: 26px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--lime-dark);
}

/* ---------------- Pied de page ---------------- */

.site-footer {
  background: var(--green-900);
  color: rgba(255, 255, 255, .75);
  padding: 34px 0 calc(30px + var(--safe-bottom));
  margin-top: 20px;
}
.footer-grid { display: grid; grid-template-columns: 1fr; gap: 22px; }
.site-footer h4 { color: #fff; margin: 0 0 10px; font-size: .95rem; }
.site-footer a { display: block; padding: 4px 0; font-size: .88rem; }
.site-footer a:hover { color: var(--lime); }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .12); margin-top: 22px; padding-top: 16px; font-size: .8rem; text-align: center; }

/* ---------------- Toasts ---------------- */

.toast-host {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(92px + var(--safe-bottom));
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 380px);
}
.toast {
  background: var(--green-800);
  color: #fff;
  padding: 13px 16px;
  border-radius: 12px;
  font-size: .9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s ease;
}
.toast.err { background: var(--danger); }
.toast.ok { background: var(--green-600); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ---------------- Modale ---------------- */

.modal-host {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(11, 30, 21, .55);
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal {
  background: var(--white);
  border-radius: 20px;
  padding: 22px;
  width: min(100%, 520px);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal h2 { margin: 0 0 6px; font-size: 1.25rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* ---------------- Divers ---------------- */

.split { display: grid; grid-template-columns: 1fr; gap: 22px; }

.empty {
  text-align: center;
  padding: 40px 20px;
  background: var(--white);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--green-100);
  border-top-color: var(--green-500);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 30px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.prose { line-height: 1.75; color: #2b3d34; }
.prose p { margin: 0 0 14px; }

.info-list { display: grid; gap: 10px; grid-template-columns: 1fr; }
.info-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 14px; background: var(--green-50); border-radius: 12px; font-size: .88rem; }
.info-row strong { color: var(--green-800); }

.pwa-banner {
  background: linear-gradient(135deg, var(--green-700), var(--green-500));
  color: #fff;
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}
.pwa-banner h3 { margin: 0 0 4px; font-size: 1.05rem; }
.pwa-banner p { margin: 0; font-size: .86rem; color: rgba(255, 255, 255, .85); }
.store-logos { display: flex; gap: 14px; align-items: center; opacity: .9; }
.store-logos svg { width: 26px; height: 26px; }

/* ---------------- Responsive ---------------- */

@media (min-width: 560px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .plot-grid { grid-template-columns: repeat(2, 1fr); }
  .garden-head { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 860px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1.15fr .85fr; }
  .hero-stats { grid-template-columns: repeat(4, 1fr); }
  .hero-inner { padding: 76px 0 66px; }
  .plot-grid { grid-template-columns: repeat(3, 1fr); }
  .garden-head { grid-template-columns: repeat(4, 1fr); }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
  .section { padding: 58px 0; }
}

@media (min-width: 1024px) {
  .plot-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 767px) {
  .header-nav { display: none; }
  .hero h1 { max-width: none; }
}
