:root {
  --vert-fonce: #14532d;
  --vert: #1b7a3d;
  --vert-clair: #2e9e52;
  --orange: #e0692a;
  --rouge: #c0392b;
  --bleu: #2563eb;
  --creme: #faf6ee;
  --texte: #1f2a24;
  --gris: #6b7a71;
  --bordure: #e2e0d6;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--creme);
  color: var(--texte);
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }

/* ── Layout ─────────────────────────────────────────────────────── */
.topbar {
  background: var(--vert-fonce);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { font-size: 1.1rem; margin: 0; font-weight: 700; }
.topbar .sub { font-size: 0.75rem; opacity: 0.8; }
.topbar button {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.tabbar {
  display: flex;
  background: #fff;
  border-bottom: 1px solid var(--bordure);
  position: sticky;
  top: 56px;
  z-index: 9;
  overflow-x: auto;
}
.tabbar a {
  flex: 1;
  text-align: center;
  padding: 12px 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gris);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tabbar a.active {
  color: var(--vert-fonce);
  border-bottom-color: var(--vert);
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 90px;
}

/* ── Boutons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  background: var(--vert);
  min-height: 52px;
  width: 100%;
}
.btn:active { filter: brightness(0.9); }
.btn.orange { background: var(--orange); }
.btn.rouge { background: var(--rouge); }
.btn.bleu { background: var(--bleu); }
.btn.gris { background: #8a9791; }
.btn.outline { background: #fff; color: var(--vert-fonce); border: 2px solid var(--vert); }
.btn.small { padding: 10px 12px; min-height: 40px; font-size: 0.85rem; }

.grid-btn {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.grid-btn.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-btn .btn { font-size: 1.05rem; padding: 18px 8px; }
.grid-btn .btn.selected { outline: 3px solid #ffd166; box-shadow: 0 0 0 2px var(--vert-fonce) inset; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 9px 14px;
  background: #fff;
  border: 2px solid var(--bordure);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--texte);
}
.chip.selected { background: var(--vert-fonce); color: #fff; border-color: var(--vert-fonce); }

/* ── Cartes / sections ──────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border: 1px solid var(--bordure);
}
.card h2 { font-size: 1rem; margin: 0 0 12px; color: var(--vert-fonce); }
.card h3 { font-size: 0.9rem; margin: 0 0 8px; }

.section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gris);
  font-weight: 700;
  margin: 18px 0 8px;
}

.stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat {
  background: #fff;
  border-radius: var(--radius);
  padding: 14px;
  border: 1px solid var(--bordure);
}
.stat .label { font-size: 0.75rem; color: var(--gris); font-weight: 600; }
.stat .value { font-size: 1.35rem; font-weight: 800; color: var(--vert-fonce); margin-top: 4px; }
.stat .value.neg { color: var(--rouge); }

.alert-box {
  background: #fff4e5;
  border: 1px solid #f3c98b;
  color: #7a4a00;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 0.85rem;
  margin-bottom: 12px;
}
.alert-box.danger { background: #fdecea; border-color: #f4b6ae; color: #7a1f13; }

/* ── Panier caisse ──────────────────────────────────────────────── */
.panier-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--bordure);
  font-size: 0.9rem;
}
.panier-item .opts { color: var(--gris); font-size: 0.78rem; }
.qty-ctrl { display: flex; align-items: center; gap: 8px; }
.qty-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--bordure);
  background: #fff; font-size: 1.1rem; font-weight: 700; color: var(--vert-fonce);
  line-height: 1; cursor: pointer; flex-shrink: 0;
}
.qty-btn:active { background: var(--creme); }
.qty-val { min-width: 18px; text-align: center; font-weight: 700; }
.panier-total {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-size: 1.2rem;
  padding: 12px 0;
  color: var(--vert-fonce);
}

/* ── Formulaires ────────────────────────────────────────────────── */
label { display: block; font-size: 0.85rem; font-weight: 600; margin: 10px 0 6px; }
input, select, textarea {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--bordure);
  font-size: 1rem;
  background: #fff;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--bordure); }
th { color: var(--gris); font-weight: 700; font-size: 0.75rem; text-transform: uppercase; }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}
.badge.ok { background: #e3f6e8; color: var(--vert-fonce); }
.badge.warn { background: #fff4e5; color: #7a4a00; }
.badge.danger { background: #fdecea; color: var(--rouge); }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 30px 24px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  text-align: center;
}
.login-card h1 { color: var(--vert-fonce); margin-bottom: 4px; }
.login-card p.tagline { color: var(--gris); font-size: 0.85rem; margin-bottom: 20px; }
.error-msg { color: var(--rouge); font-size: 0.85rem; margin-top: 10px; min-height: 18px; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--vert-fonce);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(0,0,0,0.2);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.toast.show { opacity: 1; }
.toast.error { background: var(--rouge); }
