/* =====================================================================
   SAMA-SAMA — ADMIN v2 (feuille autonome, DA blanc/orange/noir)
   Objectif : lisible et évident. Gros boutons, gros libellés, zéro jargon.
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
a { color: var(--orange-600); text-decoration: none; }
code { background: #f6f1ea; padding: .1rem .35rem; border-radius: 4px; font-size: .85em; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; border-radius: 4px; }
.brand-mark {
  font-family: var(--font-display); font-size: 1.6rem; letter-spacing: .04em; color: var(--ink);
  display: inline-flex; align-items: center; gap: .5rem;
}
/* Pastille du logo (charte graphique), comme sur le site public */
.brand-mark::before {
  content: ""; flex: none;
  width: 1.05em; height: 1.05em;
  background: url("../img/marque/icone.png") center / contain no-repeat;
}
.brand-dot { color: var(--orange); }

/* ---------- Boutons ---------- */
.abtn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-weight: 700; font-size: .95rem;
  padding: .7rem 1.3rem; border-radius: 999px;
  border: 2px solid var(--ink); background: #fff; color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .15s, box-shadow .15s;
}
.abtn:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.abtn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.abtn-primary { background: var(--orange); color: #fff; }
.abtn-ok { background: var(--success); color: #fff; }
.abtn-no { background: #fff; color: var(--error); border-color: var(--error); box-shadow: 3px 3px 0 var(--error); }
.abtn-no:hover { box-shadow: 5px 5px 0 var(--error); }
.abtn-big { width: 100%; padding: 1rem; font-size: 1.05rem; }
.abtn-sm { padding: .45rem .9rem; font-size: .85rem; box-shadow: 2px 2px 0 var(--ink); }

/* ---------- Connexion ---------- */
.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: var(--space-3); }
.login-card {
  width: 100%; max-width: 420px;
  background: #fff; border: 2px solid var(--ink); border-radius: var(--radius-md);
  box-shadow: 6px 6px 0 var(--ink);
  padding: var(--space-5) var(--space-4);
  display: grid; gap: var(--space-2);
}
.login-card h1 { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; font-size: 2rem; }
.login-hint { color: var(--muted); font-size: .9rem; }
.login-card label { display: grid; gap: 6px; font-weight: 700; font-size: .9rem; }
.login-card input {
  font: inherit; padding: .8rem 1rem; min-height: 48px;
  border: 2px solid var(--ink); border-radius: 10px;
}
.login-card input:focus { outline: none; box-shadow: 4px 4px 0 var(--orange); }
.login-error { color: var(--error); font-weight: 600; font-size: .9rem; min-height: 1.2em; }
.login-status { font-size: .85rem; font-weight: 600; color: var(--muted); border-top: 1.5px dashed var(--line); padding-top: .8rem; }
.login-status.ok { color: var(--success); }
.login-status.ko { color: var(--error); background: #fdeaea; border: 1.5px solid var(--error); border-radius: 10px; padding: .7rem .9rem; }
.login-status.ko a { color: var(--error); text-decoration: underline; }

/* ---------- Coquille du tableau de bord ---------- */
.dash { display: grid; grid-template-columns: 230px 1fr; min-height: 100dvh; }
.side {
  background: var(--ink); color: #fff;
  padding: var(--space-3);
  display: flex; flex-direction: column; gap: var(--space-4);
  position: sticky; top: 0; height: 100dvh;
}
.side .brand-mark { color: #fff; }
.side-nav { display: grid; gap: .4rem; }
.side-btn {
  display: flex; align-items: center; gap: .7rem;
  background: none; border: 2px solid transparent; border-radius: 12px;
  color: rgba(255, 255, 255, .75); font-weight: 700; font-size: .95rem;
  padding: .7rem .8rem; text-align: left; width: 100%;
  transition: background .15s, color .15s;
  position: relative;
}
.side-btn svg { width: 22px; height: 22px; flex: none; }
.side-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.side-btn.is-active { background: var(--orange); color: #fff; border-color: var(--ink); }
.side-badge {
  margin-left: auto; font-style: normal; background: #fff; color: var(--orange-600);
  border-radius: 999px; min-width: 1.6em; text-align: center; font-size: .8rem; padding: 0 .35em;
}
.side-foot { margin-top: auto; display: grid; gap: .4rem; }
.side-link { background: none; border: 0; color: rgba(255, 255, 255, .6); font-weight: 600; font-size: .85rem; text-align: left; padding: .3rem 0; }
.side-link:hover { color: var(--orange); }
.side-mode { font-size: .72rem; font-weight: 700; color: rgba(255, 255, 255, .45); padding: .2rem 0; }

.main { padding: var(--space-4); max-width: 1180px; width: 100%; }
.main-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); }
.main-title { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; font-size: 2.2rem; letter-spacing: .02em; }
.who { color: var(--muted); font-size: .85rem; }
.resto-pick { display: flex; align-items: center; gap: .6rem; background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: .35rem .5rem .35rem 1rem; box-shadow: 3px 3px 0 var(--ink); }
.resto-pick label { font-weight: 800; font-size: .85rem; }
.resto-pick select { font: inherit; font-weight: 700; border: 0; background: var(--orange-soft); border-radius: 999px; padding: .45rem .8rem; }

.panel[hidden] { display: none; }
.acard {
  background: #fff; border: 2px solid var(--ink); border-radius: var(--radius-md);
  box-shadow: 4px 4px 0 var(--ink);
  padding: var(--space-4); margin-bottom: var(--space-3);
}
.acard > h2 { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; font-size: 1.5rem; letter-spacing: .03em; margin-bottom: .5rem; }
.help { color: var(--muted); font-size: .9rem; margin-bottom: var(--space-2); }
.aempty { color: var(--muted); font-style: italic; padding: var(--space-2) 0; }

/* ---------- Formulaires ---------- */
.aform { display: grid; gap: var(--space-2); }
.aform label, .agrid label { display: grid; gap: 5px; font-weight: 700; font-size: .88rem; }
.agrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--space-2); }
.aform input, .aform textarea, .aform select, .agrid input, .agrid select {
  font: inherit; padding: .65rem .85rem; min-height: 46px;
  border: 2px solid var(--ink); border-radius: 10px; background: #fff; width: 100%;
}
.aform textarea { min-height: 60px; resize: vertical; }
.aform input:focus, .aform textarea:focus, .aform select:focus,
.agrid input:focus, .agrid select:focus { outline: none; box-shadow: 3px 3px 0 var(--orange); }
/* Vignette d'article dans les listes (boutique) */
.dlist-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; border: 2px solid var(--ink); }
/* Résumé de la remise portée par un code promo */
.promo-deal { background: var(--orange-soft); color: var(--orange-600); font-weight: 800; }

/* ---------- Zone de dépôt d'une photo ---------- */
.dropzone {
  position: relative; display: grid; place-items: center;
  min-height: 150px; padding: var(--space-2);
  border: 2px dashed var(--ink); border-radius: 12px;
  background: var(--paper); cursor: pointer; overflow: hidden;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.dropzone:hover { background: var(--orange-soft); }
.dropzone.is-over {
  background: var(--orange-soft); border-color: var(--orange);
  border-style: solid; box-shadow: 3px 3px 0 var(--orange);
}
/* pointer-events:none — sinon le survol des enfants déclenche dragleave et
   la zone clignote pendant le glisser. */
.dropzone > * { pointer-events: none; }
.dropzone-hint { display: grid; gap: .15rem; text-align: center; color: var(--muted); }
.dropzone-hint strong { color: var(--ink); font-size: .95rem; }
.dropzone-hint small { font-size: .8rem; font-weight: 600; }
.dropzone-img { max-height: 190px; width: auto; border-radius: 8px; border: 2px solid var(--ink); }
.dropzone-clear {
  pointer-events: auto;
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px; padding: 0; line-height: 1;
  display: grid; place-items: center;
  font-size: 1.2rem; font-weight: 800;
  border: 2px solid var(--ink); border-radius: 50%;
  background: #fff; color: var(--ink);
}
.dropzone-clear:hover { background: var(--error); color: #fff; }

.acheck { display: flex !important; align-items: center; gap: .6rem; font-weight: 700; }
.acheck input { width: 22px !important; height: 22px; min-height: 0 !important; accent-color: var(--orange); }
.aactions { display: flex; gap: .7rem; flex-wrap: wrap; }
.form-msg { font-weight: 600; font-size: .9rem; min-height: 1.2em; }
.form-msg.ok { color: var(--success); }
.form-msg.ko { color: var(--error); }

/* ---------- Interrupteur géant C&C ---------- */
.bigswitch { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; user-select: none; }
.bigswitch input { position: absolute; opacity: 0; width: 0; height: 0; }
.bigswitch-track {
  flex: none; width: 86px; height: 46px; border-radius: 999px;
  background: #ddd4c8; border: 2px solid var(--ink); position: relative;
  transition: background .2s;
}
.bigswitch-track::after {
  content: ""; position: absolute; top: 3px; left: 4px;
  width: 36px; height: 36px; border-radius: 50%;
  background: #fff; border: 2px solid var(--ink);
  transition: left .2s;
}
.bigswitch input:checked + .bigswitch-track { background: var(--success); }
.bigswitch input:checked + .bigswitch-track::after { left: 42px; }
.bigswitch input:focus-visible + .bigswitch-track { outline: 3px solid var(--orange); outline-offset: 2px; }
.bigswitch-label { font-weight: 800; font-size: 1.1rem; }
.bigswitch-label .on { color: var(--success); }
.bigswitch-label .off { color: var(--error); }
/* Plusieurs interrupteurs dans la même carte (Réglages) */
.bigswitch + .bigswitch { margin-top: var(--space-3); }


/* Décalage de retrait d'UNE commande (±5 / ±10 min, carte du kanban) */
.ocard-shift {
  display: grid; gap: .3rem;
  background: var(--paper); border: 1.5px dashed var(--line);
  border-radius: 10px; padding: .5rem .6rem; margin-bottom: .5rem;
}
.ocard-shift-lab { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ocard-shift-row { display: flex; flex-wrap: wrap; gap: .35rem; }
.ocard-shift-row .abtn { padding: .3rem .7rem; font-size: .82rem; box-shadow: 2px 2px 0 var(--ink); min-width: 3rem; }
/* Heure annoncée vs heure demandée : la seconde reste lisible, en retrait. */
.ocard-shift-tag { display: block; font-weight: 700; color: var(--orange-600); font-size: .72rem; }

/* Avertissement « un interrupteur général coupe cette section » */
.anotice {
  background: #fff6e6; border: 2px solid var(--ink); border-radius: var(--radius-sm);
  padding: .7rem .9rem; margin-bottom: var(--space-3); font-size: .92rem; font-weight: 600;
}

/* ---------- Kanban commandes ---------- */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2); align-items: start; }
@media (max-width: 980px) { .kanban { grid-template-columns: 1fr; } }
.kcol { background: #f2ebe1; border: 2px solid var(--ink); border-radius: var(--radius-md); padding: var(--space-2); }
.kcol > h2 { font-size: 1rem; display: flex; align-items: center; gap: .4rem; margin-bottom: var(--space-2); }
.kcol > h2 em { font-style: normal; margin-left: auto; background: var(--ink); color: #fff; border-radius: 999px; padding: 0 .5em; font-size: .8rem; }
.kcol-list { display: grid; gap: .7rem; min-height: 40px; }
.ocard { background: #fff; border: 2px solid var(--ink); border-radius: 12px; padding: .8rem .9rem; box-shadow: 3px 3px 0 var(--ink); }
.ocard-top { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .3rem; }
.ocard-ref { font-family: var(--font-display); font-size: 1.25rem; color: var(--orange-600); letter-spacing: .03em; }
.ocard-pickup { font-weight: 800; background: var(--orange-soft); border: 1.5px solid var(--orange); border-radius: 999px; padding: .05rem .55rem; font-size: .8rem; }
.ocard-time { color: var(--muted); font-size: .78rem; margin-left: auto; }
.ocard-client { font-size: .88rem; margin-bottom: .35rem; }
.ocard-client a { font-weight: 700; }
.ocard-items { list-style: none; padding: .45rem .6rem; margin: 0 0 .5rem; background: var(--paper); border-radius: 8px; display: grid; gap: .2rem; font-size: .85rem; }
.ocard-items small { color: var(--muted); }
.ocard-menu { font-size: .8rem; font-weight: 700; color: var(--orange-600); margin-bottom: .4rem; }
.ocard-total { font-weight: 800; margin-bottom: .6rem; }
.ocard-actions { display: grid; gap: .45rem; }
.ocard-actions .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.ocard-refuse { color: var(--error); font-size: .85rem; font-weight: 700; margin-bottom: .4rem; }
.refused-wrap { margin-top: var(--space-3); background: #fff; border: 2px dashed var(--error); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); }
.refused-wrap summary { cursor: pointer; font-weight: 800; color: var(--error); }
.refused-wrap summary em { font-style: normal; }
.refused-wrap > div { display: grid; gap: .7rem; margin-top: var(--space-2); }

/* ---------- Ma carte ---------- */
.dish-editor { display: grid; grid-template-columns: 1.5fr 1fr; gap: var(--space-3); align-items: start; }
@media (max-width: 900px) { .dish-editor { grid-template-columns: 1fr; } }
.dish-preview-wrap { position: sticky; top: var(--space-2); }
.dprev {
  border: 2px solid var(--ink); border-radius: var(--radius-md); overflow: hidden;
  box-shadow: 4px 4px 0 var(--ink); background: #fff; max-width: 300px;
}
.dprev-photo { aspect-ratio: 4/3; background: var(--orange-soft); display: grid; place-items: center; font-size: 3rem; border-bottom: 2px solid var(--ink); position: relative; }
.dprev-photo img { width: 100%; height: 100%; object-fit: cover; }
.dprev-badge { position: absolute; top: 8px; left: 8px; background: var(--orange); color: #fff; border: 2px solid var(--ink); border-radius: 8px; padding: .15rem .5rem; font-size: .6rem; font-weight: 800; text-transform: uppercase; transform: rotate(-4deg); }
.dprev-body { padding: .8rem .9rem; }
.dprev-body h3 { font-size: 1rem; display: flex; justify-content: space-between; gap: .5rem; }
.dprev-body .price { color: var(--orange-600); font-weight: 800; white-space: nowrap; }
.dprev-body p { color: var(--muted); font-size: .82rem; margin-top: .25rem; }

.dlist { display: grid; gap: .6rem; }
.dlist-row {
  display: flex; align-items: center; gap: .8rem;
  border: 2px solid var(--line); border-radius: 12px; padding: .55rem .8rem; background: #fff;
}
.dlist-row:hover { border-color: var(--ink); }
.dlist-emoji { font-size: 1.6rem; width: 2.2rem; text-align: center; flex: none; }
.dlist-info { flex: 1; min-width: 0; }
.dlist-info strong { display: block; }
.dlist-info small { color: var(--muted); }
.dlist-cat { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; background: var(--paper); border: 1.5px solid var(--line); padding: .15rem .5rem; border-radius: 999px; }
.dlist-actions { display: flex; gap: .45rem; flex: none; }

/* ---------- Promos ---------- */
.promo-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: .7rem .2rem; border-bottom: 1.5px dashed var(--line); flex-wrap: wrap; }
.promo-row.is-off { opacity: .55; }
.promo-state { font-size: .75rem; font-weight: 800; margin-left: .5rem; color: var(--success); }
.promo-row.is-off .promo-state { color: var(--muted); }
.promo-code { background: var(--orange-soft); border: 1.5px solid var(--orange); color: var(--orange-600); border-radius: 6px; padding: 0 .4rem; font-weight: 800; margin-left: .3rem; }

/* ---------- Ruptures ---------- */
.stock-group { margin-bottom: var(--space-2); }
.stock-group h4 { margin-bottom: .5rem; font-size: .95rem; }
.stock-items { display: flex; flex-wrap: wrap; gap: .5rem; }
.stock-item {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 2px solid var(--ink); border-radius: 999px; padding: .4rem .5rem .4rem .8rem;
  font-size: .85rem; font-weight: 700; background: #fff; cursor: pointer; user-select: none;
}
.stock-item input { accent-color: var(--orange); width: 18px; height: 18px; }
/* Trois états : disponible, rupture du jour (levée demain), indisponible. */
.stock-item select {
  font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer;
  border: 0; border-radius: 999px; padding: .25rem 1.4rem .25rem .55rem;
  background: var(--paper); color: inherit; max-width: 11rem;
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right .72rem center, right .52rem center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.stock-item.is-out { background: #f6ecec; border-color: var(--error); color: var(--error); }
.stock-item.is-out > span { text-decoration: line-through; }
/* Rupture du jour : orange, elle se lèvera seule — pas le rouge d'un blocage. */
.stock-item.is-day { background: #fff4e6; border-color: var(--orange); color: var(--orange-600); }
.stock-item.is-day > span { text-decoration: none; }
.stock-item.is-out select { background: rgba(255, 255, 255, .75); }

/* ---------- Statistiques (styles réutilisés par stats.js) ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--space-2); }
.stat-box { background: var(--orange-soft); border: 2px solid var(--ink); border-radius: 12px; padding: var(--space-2); text-align: center; }
.stat-num { display: block; font-family: var(--font-display); font-size: 1.9rem; color: var(--orange-600); line-height: 1; overflow-wrap: anywhere; }
.stat-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.stats-sub { margin: var(--space-3) 0 .5rem; font-size: 1.05rem; }
.stats-note { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); }
.stats-sub2 { margin: var(--space-3) 0 .4rem; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stats-top { display: grid; gap: .3rem; margin: 0; padding-left: 1.2rem; }
.stats-top li { display: flex; justify-content: space-between; gap: 1rem; }
.stats-bars { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.stat-bar { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; align-items: center; gap: .6rem; font-size: .88rem; }
.stat-bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-bar-track { height: 12px; background: #f2ebe1; border: 1.5px solid var(--ink); border-radius: 999px; overflow: hidden; }
.stat-bar-fill { display: block; height: 100%; background: var(--orange); }
.stat-bar-val { color: var(--orange-600); font-variant-numeric: tabular-nums; font-weight: 700; }
.stats-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: var(--space-3) 0 var(--space-1); }
.stats-actions--top { margin: 0 0 var(--space-2); }
.stats-actions .btn, .stats-actions .btn-primary, .stats-actions .btn-ghost, .stats-actions .btn-danger { /* stats.js génère .btn */ }
.stats-actions button {
  display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: .9rem;
  padding: .6rem 1.1rem; border-radius: 999px; border: 2px solid var(--ink);
  background: #fff; color: var(--ink); box-shadow: 3px 3px 0 var(--ink);
}
.stats-actions button:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.stats-actions .btn-primary { background: var(--orange); color: #fff; }
.stats-actions .btn-danger { color: var(--error); border-color: var(--error); box-shadow: 3px 3px 0 var(--error); }
.admin-empty { color: var(--muted); font-style: italic; }

/* ---------- Pages (éditeur Markdown) ---------- */
.page-group + .page-group { margin-top: var(--space-3); }
.page-group h3 {
  font-weight: 800; font-size: .95rem; text-transform: uppercase; letter-spacing: .04em;
  display: flex; align-items: baseline; gap: .6rem; margin-bottom: .5rem;
  padding-bottom: .35rem; border-bottom: 1.5px dashed var(--line);
}
.page-group h3 a { color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: none; letter-spacing: 0; }
.page-group h3 a:hover { color: var(--orange-600); }
#page-count { min-height: 1.2em; font-size: .82rem; }
/* Aperçu du mode « textes » : le vrai bloc de la page, sans sa feuille de
   style — on lisse le minimum pour qu'il reste lisible ici. */
.md-preview svg { width: 24px; height: 24px; }
.md-preview img { max-height: 160px; object-fit: cover; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.page-head h2 { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; font-size: 1.5rem; letter-spacing: .03em; margin-bottom: .3rem; }
.page-head .abtn { text-decoration: none; }
.page-tag { font-weight: 800; }
.page-tag.is-custom { color: var(--orange-600); }

.page-bar {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
  border-top: 1.5px dashed var(--line); border-bottom: 1.5px dashed var(--line);
  padding: var(--space-2) 0; margin-bottom: var(--space-2);
}
.page-bar label { display: grid; gap: 5px; font-weight: 700; font-size: .88rem; }
.page-bar select {
  font: inherit; font-weight: 700; padding: .5rem .8rem;
  border: 2px solid var(--ink); border-radius: 10px; background: #fff;
}
.page-state { flex: 1; min-width: 220px; color: var(--muted); font-size: .85rem; }

.page-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); align-items: start; }
.md-pane { min-width: 0; display: grid; gap: .6rem; }
.md-toolbar { display: flex; gap: .4rem; flex-wrap: wrap; }
#page-md {
  font: 500 .92rem/1.6 ui-monospace, "Cascadia Code", Consolas, monospace;
  width: 100%; min-height: 460px; resize: vertical; padding: var(--space-2);
  border: 2px solid var(--ink); border-radius: 10px; background: #fff; tab-size: 2;
}
#page-md:focus { outline: none; box-shadow: 3px 3px 0 var(--orange); }
.md-help { font-size: .85rem; color: var(--muted); display: grid; gap: .6rem; justify-items: start; }
.md-help code { background: var(--paper); border: 1.5px solid var(--line); border-radius: 5px; padding: 0 .3rem; }

/* ---------- Guide du Markdown ---------- */
.md-guide-card > summary { cursor: pointer; display: grid; gap: .2rem; list-style: none; }
.md-guide-card > summary::-webkit-details-marker { display: none; }
.md-guide-card > summary > span {
  font-family: var(--font-display); font-weight: 400; text-transform: uppercase;
  font-size: 1.5rem; letter-spacing: .03em;
}
.md-guide-card > summary > small { color: var(--muted); font-size: .9rem; font-weight: 600; }
.md-guide-card > summary::after { content: "▾"; position: absolute; right: var(--space-4); color: var(--orange); font-size: 1.4rem; }
.md-guide-card[open] > summary::after { content: "▴"; }
.md-guide-card { position: relative; }
.md-guide-card[open] > summary { border-bottom: 1.5px dashed var(--line); padding-bottom: var(--space-2); margin-bottom: var(--space-3); }

.md-guide-sec + .md-guide-sec { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1.5px dashed var(--line); }
/* Sélecteur d'enfant direct : les titres RENDUS dans les exemples
   (« ### Les produits ») doivent garder l'allure qu'ils auront sur le site,
   pas celle des intertitres du guide. */
.md-guide-sec > h3 { font-weight: 800; font-size: 1.05rem; margin-bottom: .2rem; }

.md-ex { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); align-items: start; margin-top: var(--space-2); }
.md-ex + .md-ex { margin-top: var(--space-3); }
.md-ex-code, .md-ex-out { display: grid; gap: .45rem; min-width: 0; justify-items: start; }
.md-ex-tag { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.md-ex pre {
  font: 500 .88rem/1.6 ui-monospace, "Cascadia Code", Consolas, monospace;
  background: var(--ink); color: #f6f1e9; width: 100%;
  border-radius: 10px; padding: var(--space-2); margin: 0;
  white-space: pre-wrap; overflow-wrap: break-word;
}
.md-ex-note { font-size: .85rem; color: var(--muted); }
.md-ex-note code { background: var(--paper); border: 1.5px solid var(--line); border-radius: 5px; padding: 0 .3rem; font-size: .82rem; }
.md-preview.is-inline { min-height: 0; width: 100%; padding: var(--space-2); background: #fff; border-style: solid; }
.md-preview.is-inline > * + * { margin-top: .6rem; }

@media (max-width: 900px) { .md-ex { grid-template-columns: 1fr; } }

/* Aperçu : approximation volontairement sobre du rendu du site — il sert à
   vérifier la structure du texte, pas à reproduire la charte au pixel près. */
.md-preview {
  border: 2px dashed var(--line); border-radius: 12px; background: var(--paper);
  padding: var(--space-3); min-height: 460px; overflow-wrap: break-word;
}
.md-preview > * + * { margin-top: .9rem; }
.md-preview h1, .md-preview h2, .md-preview h3 {
  font-family: var(--font-display); font-weight: 400; text-transform: uppercase; letter-spacing: .02em;
}
.md-preview h1 { font-size: 1.6rem; }
.md-preview h2 { font-size: 1.25rem; }
.md-preview h3 { font-size: 1.05rem; }
.md-preview p, .md-preview li { color: var(--muted); }
.md-preview ul, .md-preview ol { margin-left: 1.2rem; display: grid; gap: .3rem; }
.md-preview a { color: var(--orange-600); font-weight: 700; }
.md-preview img { max-width: 100%; border: 2px solid var(--ink); border-radius: 10px; }
.md-preview figure { display: grid; gap: .4rem; }
.md-preview figcaption { font-size: .8rem; font-weight: 600; color: var(--muted); text-align: center; }
.md-preview blockquote { border-left: 4px solid var(--orange); padding-left: var(--space-2); font-style: italic; }
.md-preview hr { border: 0; border-top: 2px dashed var(--line); }
.md-preview code { background: #fff; border: 1.5px solid var(--line); border-radius: 5px; padding: 0 .3rem; }

/* Syntaxe étendue : tableaux, blocs de code, définitions, tâches, notes.
   Même allure que sur le site (voir la section correspondante de site.css). */
.md-preview .md-table-wrap { overflow-x: auto; }
.md-preview .md-table { width: 100%; border-collapse: collapse; font-size: .88rem; background: #fff; border: 2px solid var(--ink); }
.md-preview .md-table th, .md-preview .md-table td { padding: .5rem .7rem; border-bottom: 1.5px solid var(--line); text-align: left; }
.md-preview .md-table thead th { background: var(--ink); color: #fff; font-weight: 800; border-bottom: 0; }
.md-preview .md-table tbody tr:nth-child(even) { background: var(--paper); }
.md-preview pre.md-code {
  background: var(--ink); color: #f6f1e9; border-radius: 10px; padding: var(--space-2);
  overflow-x: auto; font: 500 .85rem/1.6 ui-monospace, "Cascadia Code", Consolas, monospace;
}
.md-preview pre.md-code code { background: none; border: 0; padding: 0; color: inherit; font: inherit; }
.md-preview mark { background: var(--orange-soft); padding: 0 .2rem; border-radius: 3px; }
.md-preview del { opacity: .7; }
.md-preview sub, .md-preview sup { font-size: .72em; line-height: 0; }
.md-preview dt { font-weight: 800; margin-top: .5rem; }
.md-preview dd { margin-left: var(--space-2); color: var(--muted); }
.md-preview ul.md-tasks { list-style: none; margin-left: 0; }
.md-preview ul.md-tasks .md-task { display: flex; align-items: flex-start; gap: .5rem; }
.md-preview ul.md-tasks input { width: 1.05em; height: 1.05em; margin-top: .25em; accent-color: var(--orange); flex: none; }
/* Paragraphe ajouté : encadré discrètement dans l'aperçu pour qu'on voie d'un
   coup d'œil ce qui vient d'être ajouté à la page. Sur le site, il se fond
   dans le bloc (voir .md-added dans site.css). */
.md-preview .md-added {
  grid-column: 1 / -1; flex-basis: 100%;
  border-left: 3px solid var(--orange); padding-left: var(--space-2);
}
.md-preview .md-added > * + * { margin-top: .6rem; }
.md-preview .footnote-ref a, .md-preview .footnote-back { color: var(--orange-600); font-weight: 800; text-decoration: none; }
.md-preview .footnotes { font-size: .85rem; color: var(--muted); }
.md-preview .footnotes ol { margin-left: 1.2rem; }
/* Mode FAQ : même accordéon que la page publique */
.md-preview details { background: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: .6rem .9rem; }
.md-preview details + details { margin-top: .5rem; }
.md-preview summary { cursor: pointer; font-weight: 700; }
.md-preview details > p { margin-top: .5rem; }

@media (max-width: 1100px) { .page-editor-grid { grid-template-columns: 1fr; } }

/* ---------- Boîte de dialogue (confirmation / saisie) ----------
   Remplace confirm() et prompt(), que les navigateurs peuvent purement et
   simplement supprimer (case « empêcher cette page d'ouvrir d'autres
   boîtes de dialogue ») : l'action semblait alors ne rien faire. */
.adlg-backdrop {
  position: fixed; inset: 0; z-index: 600;
  background: rgba(12, 9, 6, .6);
  display: grid; place-items: center; padding: var(--space-3);
}
.adlg-backdrop[hidden] { display: none; }
.adlg {
  width: 100%; max-width: 460px;
  background: #fff; border: 2px solid var(--ink); border-radius: var(--radius-md);
  box-shadow: 6px 6px 0 var(--ink);
  padding: var(--space-4);
  display: grid; gap: var(--space-2);
}
.adlg h2 { font-family: var(--font-display); font-weight: 400; text-transform: uppercase; font-size: 1.5rem; letter-spacing: .03em; }
.adlg p { color: var(--muted); font-size: .95rem; white-space: pre-line; }
.adlg input {
  font: inherit; padding: .65rem .85rem; min-height: 46px;
  border: 2px solid var(--ink); border-radius: 10px; background: #fff; width: 100%;
}
.adlg input:focus { outline: none; box-shadow: 3px 3px 0 var(--orange); }
.adlg-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-1); }
.adlg-actions .abtn { flex: 1; min-width: 130px; }

/* ---------- Toast ---------- */
.admin-flash {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; font-weight: 700;
  border: 2px solid var(--orange); border-radius: 999px;
  padding: .7rem 1.4rem; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 500;
}
.admin-flash.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
  .dash { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: column; padding: var(--space-2); }
  .side-nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: .35rem; }
  .side-btn { flex-direction: column; gap: .25rem; font-size: .72rem; padding: .55rem .3rem; text-align: center; align-items: center; }
  .side-badge { position: absolute; top: 4px; right: 8px; margin: 0; }
  .side-foot { flex-direction: row; display: flex; justify-content: space-between; margin-top: var(--space-2); }
  .main { padding: var(--space-2); }
}
