/* ------------------------------------------------------------------
   Charte Econology (econology.fr) : Raleway, vert #50af31, gris #474746
   Les variables ci-dessous sont le seul endroit à toucher pour
   une retouche cosmétique globale.
------------------------------------------------------------------ */
:root {
  --green: #50af31;
  --green-dark: #3f8f26;
  --green-soft: #e9f6e3;
  --orange: #f07500;
  --red: #df280a;
  --ink: #474746;
  --ink-2: #636363;
  --muted: #a0a0a0;
  --line: #e6e6e6;
  --bg: #f4f4f4;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(0, 0, 0, .06), 0 12px 30px rgba(0, 0, 0, .05);
  --font: "Raleway", "Helvetica Neue", Verdana, Arial, sans-serif;
  --max: 1120px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
}
a { color: var(--green-dark); }
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; }

/* ---------- En-tête ---------- */
.topbar {
  background: var(--card);
  border-bottom: 3px solid var(--green);
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 14px 20px;
}
.topbar .brand img { width: 250px; height: auto; }
.brand-tagline { display: flex; flex-direction: column; border-left: 1px solid var(--line); padding-left: 22px; flex: 1; }
.brand-sp { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); font-size: .95rem; font-weight: 800; line-height: 1.1; text-transform: uppercase; letter-spacing: .04em; }
.brand-sp img { width: 84px; height: 84px; }
.brand-sp small { display: block; font-size: .7rem; font-weight: 600; color: var(--ink-2); text-transform: none; letter-spacing: 0; margin-top: 3px; }
.brand-title { font-weight: 700; font-size: 1.15rem; letter-spacing: .01em; }
.brand-sub { color: var(--ink-2); font-size: .85rem; }

/* ---------- Fil d'Ariane ---------- */
.crumbs {
  max-width: var(--max);
  margin: 0 auto;
  padding: 16px 20px 0;
  font-size: .9rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--green-dark); text-decoration: underline; }
.crumbs .sep { color: var(--green); font-weight: 700; }
.crumbs .current { color: var(--green-dark); font-weight: 700; }

/* ---------- Page ---------- */
.page { max-width: var(--max); margin: 0 auto; padding: 14px 20px 48px; }
h1 { font-size: 1.6rem; font-weight: 700; margin: 10px 0 20px; }
h1 small { display: block; font-size: .95rem; font-weight: 500; color: var(--ink-2); margin-top: 4px; }
h2 { font-size: 1.2rem; font-weight: 700; margin: 26px 0 12px; }
.note { color: var(--ink-2); font-size: .92rem; }
.warn { background: #fff5e8; border-left: 4px solid var(--orange); padding: 10px 14px; border-radius: 6px; color: var(--ink); font-size: .92rem; }
.err { background: #fdecea; border-left: 4px solid var(--red); padding: 10px 14px; border-radius: 6px; font-size: .92rem; }

/* ---------- Accueil : 4 vignettes ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 10px; }
.tile {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: 0 6px 18px rgba(0,0,0,.09), 0 18px 40px rgba(0,0,0,.07); }
.tile .tile-visual {
  height: 150px;
  background: linear-gradient(135deg, var(--green-soft), #fff);
  display: grid;
  place-items: center;
  color: var(--green);
}
.tile .tile-visual svg { width: 76px; height: 76px; }
.tile .tile-visual img { width: 100%; height: 100%; object-fit: cover; }
.tile .tile-visual { position: relative; overflow: hidden; }
.tile .tile-body { padding: 16px 18px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tile .tile-title { font-weight: 700; font-size: 1.02rem; line-height: 1.25; }
.tile .tile-title small { display: block; font-weight: 500; color: var(--ink-2); font-size: .85rem; margin-top: 3px; }
.tile .arrow { color: var(--green); font-weight: 800; font-size: 1.4rem; }

/* ---------- Cartes de configuration ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 20px;
  position: relative;
}
.card.invalid { outline: 2px solid var(--red); }
.card.span-2 { grid-column: 1 / -1; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title { font-weight: 800; text-transform: uppercase; letter-spacing: .03em; line-height: 1.15; font-size: 1rem; }
.card-title b { color: var(--green); display: block; }
.card-title span { color: var(--ink-2); font-weight: 600; }
.card-icon { color: var(--muted); flex: none; }
.card-icon svg { width: 44px; height: 44px; }
.card-icon img { width: 64px; height: 64px; object-fit: contain; opacity: .9; }
.card-help { font-size: .85rem; color: var(--ink-2); margin: -6px 0 10px; }

/* Choix : boutons larges, texte jamais tronqué */
.choices { display: flex; flex-wrap: wrap; gap: 10px; }
.choice {
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 600;
  font-size: .92rem;
  line-height: 1.2;
  cursor: pointer;
  white-space: normal;
  text-align: center;
  min-width: 56px;
  transition: border-color .12s, background .12s, color .12s;
}
.choice:hover { border-color: var(--green); }
.choice.active { background: var(--green); border-color: var(--green); color: #fff; }
.choice[disabled] { opacity: .45; cursor: not-allowed; }
.choice small { display: block; font-weight: 500; font-size: .78rem; opacity: .85; }

/* Compteurs */
.counters { display: grid; gap: 10px; }
.counter { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.counter label { font-weight: 600; font-size: .92rem; }
.stepper { display: inline-flex; align-items: center; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; }
.stepper button { width: 36px; height: 34px; border: 0; background: #fff; color: var(--green-dark); font-weight: 800; font-size: 1.1rem; cursor: pointer; }
.stepper button:hover { background: var(--green-soft); }
.stepper output { min-width: 40px; text-align: center; font-weight: 700; }

/* Champs numériques */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: .9rem; }
.field input, .field select {
  font: inherit; padding: 9px 12px; border: 2px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--green); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }

/* ---------- Barre d'actions ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-top: 26px; }
.btn {
  border: 2px solid var(--green);
  background: var(--green);
  color: #fff;
  border-radius: 999px;
  padding: 12px 26px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--green-dark); }
.btn.secondary:hover { background: var(--green-soft); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn.orange { background: var(--orange); border-color: var(--orange); }
.btn.orange:hover { filter: brightness(.95); }

/* ---------- Liste des machines ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 16px; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.product {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 10px; cursor: pointer;
  border: 2px solid transparent; text-align: left; color: inherit; position: relative; font: inherit;
}
.product:hover { border-color: var(--green); }
.product.featured { border-color: var(--orange); }
.product.disabled { opacity: .55; cursor: not-allowed; }
.product .pimg { height: 140px; display: grid; place-items: center; background: #fafafa; border-radius: 10px; overflow: hidden; }
.product .pimg img { max-height: 130px; width: auto; }
.product .pname { font-weight: 800; font-size: 1rem; }
.product .pcat { color: var(--green-dark); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.product .pdesc { color: var(--ink-2); font-size: .85rem; }
.product .pmeta { display: flex; gap: 8px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-2); }
.product .pmeta span { background: var(--bg); border-radius: 6px; padding: 3px 8px; }
.badge { position: absolute; top: 12px; right: 12px; background: var(--orange); color: #fff; font-size: .72rem; font-weight: 700; border-radius: 6px; padding: 3px 8px; text-transform: uppercase; }

/* ---------- Options / accessoires ---------- */
.optgroup { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.optgroup h3 { margin: 0 0 12px; font-size: 1rem; text-transform: uppercase; letter-spacing: .03em; }
.optgroup h3 b { color: var(--green); }
.optgroup .optional { color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; font-size: .85rem; margin-left: 8px; }
.opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.opt { border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; text-align: left; cursor: pointer; color: inherit; display: flex; gap: 10px; align-items: center; }
.opt:hover { border-color: var(--green); }
.opt.active { border-color: var(--green); background: var(--green-soft); }
.opt .oname { font-weight: 600; font-size: .9rem; }
.opt .oref { color: var(--muted); font-size: .78rem; }
.opt .oqty { margin-left: auto; font-weight: 700; color: var(--green-dark); white-space: nowrap; }

/* ---------- Récapitulatif ---------- */
table.recap { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.recap th, table.recap td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: .92rem; vertical-align: top; }
table.recap th { background: var(--green-soft); color: var(--ink); font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
table.recap td.num, table.recap th.num { text-align: right; white-space: nowrap; }
table.recap tr.group td { background: #fafafa; font-weight: 700; color: var(--green-dark); }
table.recap .ref { color: var(--muted); font-size: .8rem; }
table.recap .na { color: var(--orange); font-size: .8rem; font-weight: 600; }
.qty-edit { width: 64px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; text-align: right; font: inherit; }

/* ---------- Divers ---------- */
.loading { color: var(--muted); padding: 40px 0; text-align: center; }
.hidden { display: none !important; }
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 8px 14px; }
  .brand-sp span { display: none; }
  .brand-tagline { border-left: 0; padding-left: 0; }
  .topbar .brand img { width: 190px; }
  .brand-sp img { width: 56px; height: 56px; }
  h1 { font-size: 1.35rem; }
}
@media print {
  .topbar, .crumbs, .foot, .actions, .filters { display: none !important; }
  body { background: #fff; }
}

/* ---------- Collectif / tertiaire ---------- */
.optgroup.invalid { outline: 2px solid var(--red); }
.typos { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.typo { border: 2px solid var(--line); border-radius: 12px; padding: 8px 12px 12px; margin: 0; }
.typo legend { font-weight: 800; color: var(--green-dark); padding: 0 6px; }
.typo .counter { margin: 6px 0; }
.typo .counter label { font-size: .85rem; }
.typo-pt { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 6px; }
.locaux { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.local { border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; }
.local-name { font-weight: 600; font-size: .9rem; }

.foot { max-width: var(--max); margin: 0 auto; padding: 18px 20px 28px; color: var(--ink-2); font-size: .85rem; border-top: 1px solid var(--line); display: flex; gap: 14px; align-items: center; }
.foot img { flex: none; width: 60px; height: 60px; }
.foot p { margin: 0; }

/* ---------- Visuels d'origine ---------- */
.notes { margin-top: 22px; display: grid; gap: 8px; }
.notes p { margin: 0; padding: 10px 14px; background: var(--card); border-left: 4px solid var(--green); border-radius: 6px; font-size: .9rem; color: var(--ink-2); }
.notes a { font-weight: 700; }
.synoptique { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; margin-top: 18px; }
.synoptique h3 { margin: 0 0 10px; font-size: 1rem; text-transform: uppercase; letter-spacing: .03em; }
.synoptique h3 b { color: var(--green); }
.synoptique img { width: 100%; height: auto; border-radius: 8px; }
.opt-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin: 6px 0 14px; }
.opt-image { display: flex; gap: 12px; align-items: center; background: var(--bg); border-radius: 10px; padding: 10px; }
.opt-image img { width: 72px; height: 90px; object-fit: contain; flex: none; }
.opt-image b { display: block; font-size: .9rem; }
.opt-image span { font-size: .82rem; color: var(--ink-2); }

/* ---------- Photos produits (options, récap) ---------- */
.vmc-chosen { display: flex; align-items: center; gap: 18px; }
.vmc-chosen img { width: 110px; height: 110px; object-fit: contain; background: #fff; border-radius: 10px; padding: 6px; box-shadow: var(--shadow); flex: none; }
.vmc-chosen h1 { margin: 0; }
.opt .othumb { width: 64px; height: 64px; flex: none; display: flex; align-items: center; justify-content: center; background: #fff; border-radius: 8px; overflow: hidden; }
.opt .othumb:empty { display: none; }
.opt .othumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.recap td.pcell { display: flex; align-items: center; gap: 10px; }
.recap td.pcell img { width: 48px; height: 48px; object-fit: contain; background: #fff; border-radius: 6px; flex: none; }
.opt > span:not(.othumb):not(.oqty) { flex: 1; }
