:root {
  --green: #2f9e57;
  --green-drk: #258144;
  --green-soft: #e7f5ec;
  --bg: #f4f6f5;
  --card: #ffffff;
  --ink: #22302a;
  --muted: #7a8580;
  --line: #e6ebe8;
  --radius: 18px;
  --shadow: 0 8px 24px rgba(20, 60, 40, .07);
  --r-lg: 24px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }

.shell { max-width: 1180px; margin: 0 auto; padding: 0 20px 40px; }

/* ---------- Barre supérieure ---------- */
.topbar { background: linear-gradient(120deg, #37b060, #2f9e57); color: #fff; margin: 0 -20px 0; padding: 0 20px; border-radius: 0 0 var(--r-lg) var(--r-lg); }
.tb-inner { max-width: 1140px; margin: 0 auto; display: flex; align-items: center; gap: 18px; padding: 16px 0; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { font-size: 26px; width: 46px; height: 46px; display: grid; place-items: center; background: rgba(255,255,255,.18); border-radius: 13px; }
.brand-txt h1 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.brand-txt p { margin: 1px 0 0; font-size: 13px; opacity: .9; }
.tb-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; background: rgba(255,255,255,.14); padding: 9px 16px; border-radius: 12px; }
.tb-title .tb-cart { font-size: 18px; }
.menu-btn { margin-left: auto; background: rgba(255,255,255,.14); border: none; color: #fff; font-size: 20px; font-weight: 800; letter-spacing: 1px; width: 44px; height: 44px; border-radius: 12px; cursor: pointer; }
.menu-btn:hover { background: rgba(255,255,255,.25); }
.dropdown {
  position: absolute; top: 58px; right: 20px; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 18px 40px rgba(0,0,0,.18); padding: 8px; width: 230px; z-index: 40;
}
.dropdown[hidden] { display: none; }
.dropdown button { display: flex; align-items: center; gap: 11px; width: 100%; background: none; border: none; color: var(--ink); font-size: 14px; font-weight: 600; padding: 11px 13px; border-radius: 11px; cursor: pointer; text-align: left; }
.dropdown button:hover { background: var(--green-soft); color: var(--green-drk); }
.dropdown button span { font-size: 17px; }
.tb-inner { position: relative; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 300px 1fr; gap: 26px; align-items: start; margin-top: 22px; }

/* ---------- Sidebar ---------- */
.sidebar { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow); position: sticky; top: 16px; }
.sidebar h2 { margin: 0 0 18px; font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.ring-wrap { position: relative; width: 180px; height: 180px; margin: 4px auto 14px; }
.ring { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #e8efec; stroke-width: 13; }
.ring-fg { fill: none; stroke: var(--green); stroke-width: 13; stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pct { font-size: 34px; font-weight: 800; color: var(--ink); line-height: 1; }
.done-label { font-size: 13px; color: var(--muted); margin-top: 4px; }
.articles-count { text-align: center; margin: 0 0 18px; color: var(--muted); font-size: 14px; font-weight: 600; }

.encourage { display: flex; gap: 12px; align-items: center; background: var(--green-soft); border-radius: 14px; padding: 13px 14px; }
.enc-ico { width: 34px; height: 34px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; font-size: 17px; flex-shrink: 0; }
.encourage strong { font-size: 14px; display: block; }
.encourage p { margin: 2px 0 0; font-size: 13px; color: #3b6d4d; }

.tip { display: flex; gap: 10px; align-items: flex-start; background: #fff8eb; border: 1px solid #f5e6c6; border-radius: 14px; padding: 12px 14px; margin-top: 12px; }
.tip-ico { font-size: 17px; flex-shrink: 0; }
.tip p { margin: 0; font-size: 13px; color: #8a6d2e; }

.side-menu { margin-top: 18px; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); padding-top: 16px; }
.side-menu button { display: flex; align-items: center; gap: 11px; width: 100%; background: none; border: none; color: var(--ink); font-size: 14.5px; font-weight: 600; padding: 11px 12px; border-radius: 11px; cursor: pointer; text-align: left; }
.side-menu button:hover { background: #f2f6f3; }
.side-menu button span { font-size: 18px; }
.editing #editBtn { background: var(--green-soft); color: var(--green-drk); }
.side-menu button.active { background: var(--green-soft); color: var(--green-drk); }

/* Mode édition : boutons supprimer visibles */
body.editmode .pill-x { opacity: .5; }
body.editmode .pill-x:hover { opacity: 1; }
body.editmode .add-inline { display: none; }
body.editmode .pill .pill-check { pointer-events: none; opacity: .5; }

/* ---------- Zone principale ---------- */
.content-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 4px 0 20px; }
.head-txt { display: flex; align-items: center; gap: 13px; }
.head-ico { font-size: 26px; width: 50px; height: 50px; display: grid; place-items: center; background: var(--green-soft); border-radius: 14px; }
.head-txt h2 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.head-txt p { margin: 1px 0 0; color: var(--muted); font-size: 14px; }
.expand-btn { display: flex; align-items: center; gap: 7px; background: var(--card); border: 1px solid var(--line); color: var(--ink); font-weight: 700; font-size: 14px; padding: 10px 15px; border-radius: 12px; cursor: pointer; box-shadow: 0 2px 8px rgba(20,60,40,.05); }
.expand-btn:hover { border-color: var(--green); color: var(--green-drk); }
.chev { transition: transform .2s ease; }

/* ---------- Stepper vertical ---------- */
.stepper { list-style: none; margin: 0; padding: 0; position: relative; display: flex; flex-direction: column; gap: 16px; }
.stepper::before {
  content: ""; position: absolute; left: 19px; top: 26px; bottom: 26px; width: 3px;
  background: repeating-linear-gradient(#cdd8d1 0 8px, transparent 8px 16px);
}
.step { position: relative; padding-left: 52px; }
.step .badge {
  position: absolute; left: 0; top: 18px; width: 41px; height: 41px; border-radius: 50%;
  background: var(--c); color: #fff; font-weight: 800; font-size: 16px;
  display: grid; place-items: center; box-shadow: 0 3px 8px rgba(20,60,40,.2);
  z-index: 1; transition: transform .15s ease;
}
.step:hover .badge { transform: scale(1.06); }

/* ---------- Carte rayon ---------- */
.rayon-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.rayon-head { width: 100%; display: flex; align-items: center; gap: 13px; padding: 15px 18px; border: none; background: none; cursor: pointer; text-align: left; }
.rayon-head:hover { background: #fafcfb; }
.rayon-ico { font-size: 26px; width: 46px; height: 46px; display: grid; place-items: center; background: var(--soft); border-radius: 13px; flex-shrink: 0; }
.rayon-title { font-weight: 800; font-size: 16.5px; letter-spacing: -.01em; }
.rayon-meta { color: var(--muted); font-size: 13.5px; margin-left: 2px; }
.rayon-prog { margin-left: auto; font-weight: 800; font-size: 15px; color: var(--muted); background: #eef1ef; padding: 5px 12px; border-radius: 10px; white-space: nowrap; }
.rayon-prog.full { color: var(--green-drk); background: var(--green-soft); }
.rayon-head .chev { color: var(--muted); font-size: 16px; transition: transform .2s ease; }

.rayon-card.open .chev { transform: rotate(180deg); }
.rayon-card.open .rayon-head { border-bottom: 1px solid var(--line); }
.rayon-body { max-height: 0; padding: 0 18px; overflow: hidden; transition: max-height .3s ease, padding .3s ease; }
.rayon-card.open .rayon-body { max-height: 1200px; padding: 6px 18px 16px; }

.pills { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 9px; }
.pill {
  display: inline-flex; align-items: center; gap: 9px; background: #f6f8f7;
  border: 1px solid var(--line); border-radius: 999px; padding: 8px 13px 8px 8px;
  font-weight: 600; font-size: 14px; transition: all .15s ease;
}
.pill-check {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid #cdd6d0; background: transparent;
  cursor: pointer; display: grid; place-items: center; color: transparent; font-size: 12px; flex-shrink: 0;
  transition: all .15s ease;
}
.pill:hover .pill-check { border-color: var(--c); }
.pill.done { background: var(--soft); border-color: var(--soft); }
.pill.done .pill-check { background: var(--c); border-color: var(--c); color: #fff; }
.pill.done .pill-name { text-decoration: line-through; color: var(--muted); }
.pill-x { background: none; border: none; color: #c2c9c5; font-size: 13px; cursor: pointer; width: 18px; height: 18px; border-radius: 50%; opacity: 0; transition: opacity .15s ease; }
.pill:hover .pill-x { opacity: 1; }
.pill-x:hover { color: #e04040; background: #fee9e9; }

.add-inline input {
  width: 100%; font-family: inherit; font-size: 14px; padding: 10px 14px; border: 1.5px dashed #cdd6d0;
  border-radius: 12px; outline: none; background: #fbfdfc; color: var(--ink);
}
.add-inline input:focus { border-color: var(--c); border-style: solid; }

/* ---------- Bannière footer ---------- */
.footer-banner { display: flex; align-items: center; gap: 14px; background: var(--green-soft); border: 1px solid #cfe9d9; border-radius: var(--r-lg); padding: 16px 22px; margin-top: 26px; }
.fb-ico { font-size: 26px; }
.footer-banner p { margin: 0; flex: 1; font-weight: 700; color: var(--green-drk); font-size: 15px; }
.fb-shop { font-size: 26px; }

/* ---------- Modale ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20, 40, 30, .45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.overlay[hidden] { display: none; }
.modal { background: var(--card); border-radius: 20px; box-shadow: 0 20px 50px rgba(0,0,0,.25); width: 100%; max-width: 420px; padding: 22px; max-height: 80vh; overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 800; }
.m-close { background: #f0f3f1; border: none; width: 30px; height: 30px; border-radius: 9px; color: var(--muted); font-size: 14px; cursor: pointer; }
.m-close:hover { color: var(--ink); }
.h-list { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.h-list li { font-size: 13.5px; padding: 9px 12px; background: #f6f8f7; border-radius: 10px; color: var(--ink); }
.h-list .h-ts { color: var(--muted); font-size: 12px; margin-right: 8px; }
.h-list .h-empty { color: var(--muted); text-align: center; }
.set-row { margin-bottom: 10px; }
.modal-btn { width: 100%; font-family: inherit; font-size: 14.5px; font-weight: 700; text-align: left; padding: 13px 15px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.modal-btn:hover { border-color: var(--green); color: var(--green-drk); }
.modal-btn.ghost { text-align: center; color: var(--muted); }

.addform { display: flex; flex-direction: column; gap: 10px; }
.addform select, .addform input { font-family: inherit; font-size: 14.5px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; outline: none; background: var(--card); color: var(--ink); }
.addform select:focus, .addform input:focus { border-color: var(--green); }
.addform button { align-self: flex-end; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .tb-title { display: none; }
}
@media (max-width: 520px) {
  .shell { padding: 0 12px 30px; }
  .topbar { margin: 0 -12px; padding: 0 12px; }
  .rayon-meta { display: none; }
  .rayon-head { flex-wrap: wrap; gap: 10px; }
  .rayon-prog { margin-left: auto; }
  .content-head { flex-wrap: wrap; }
}