/* ============================================================
   Bianchi Dessert — espace pâtissier (admin)
   ============================================================ */
body { background: var(--cream); }

/* Connexion */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(120% 90% at 50% 0%, #2a2420 0%, var(--ink) 60%); }
.login-card { background: var(--paper); border-radius: 20px; padding: 32px 28px; width: min(400px, 100%); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login-card .logo { width: 88px; height: 88px; margin: 0 auto 6px; border-radius: 50%; }
.login-card h1 { font-size: 28px; }
.login-card p { margin: 0; color: var(--muted); font-size: 14px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; text-align: left; margin-top: 8px; }
.login-err { color: var(--bad); font-size: 13px; font-weight: 600; min-height: 18px; }
.demo-hint { background: var(--gold-soft); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; color: #5c4a22; }

/* Coque admin */
.topbar { background: var(--ink); color: var(--gold-soft); position: sticky; top: 0; z-index: 30; }
.topbar-inner { max-width: var(--maxw); margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 14px; }
.topbar img { width: 40px; height: 40px; border-radius: 50%; }
.topbar .title { font-family: var(--display); font-size: 22px; letter-spacing: .05em; color: #f6f1e8; }
.topbar .title span { color: var(--gold); }
.topbar .spacer { flex: 1; }
.topbar a, .topbar button.linkish { color: var(--gold-soft); font-size: 13px; font-weight: 600; text-decoration: none; background: none; border: 1px solid rgba(200,164,100,.35); border-radius: 999px; padding: 7px 12px; }
.tabs { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 60px; z-index: 29; }
.tabs-inner { max-width: var(--maxw); margin: 0 auto; display: flex; overflow-x: auto; scrollbar-width: none; padding: 0 8px; }
.tabs-inner::-webkit-scrollbar { display: none; }
.tab { flex: none; padding: 14px 14px; border: 0; background: none; font-weight: 700; font-size: 14px; color: var(--muted); border-bottom: 3px solid transparent; }
.tab.active { color: var(--ink); border-bottom-color: var(--gold); }
.tab .badge { background: var(--gold); color: var(--ink); border-radius: 999px; font-size: 11px; padding: 2px 7px; margin-left: 5px; }
.page { max-width: var(--maxw); margin: 0 auto; padding: 20px 16px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h2 { font-size: 30px; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Statut mode */
.mode-banner { border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.mode-demo { background: var(--warn-bg); color: var(--warn); }
.mode-prod { background: var(--good-bg); color: var(--good); }

/* Stock du jour */
.stock-group { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 14px; overflow: hidden; }
.stock-group-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fbf8f1; }
.stock-group-head h3 { font-size: 22px; flex: 1; }
.stock-group-head small { color: var(--muted); font-weight: 600; }
.stock-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.stock-row:last-child { border-bottom: 0; }
.stock-row.inactif { opacity: .5; }
.stock-name { min-width: 0; }
.stock-name b { display: block; font-family: var(--display); font-size: 18px; line-height: 1.1; }
.stock-name small { color: var(--muted); font-size: 12px; }
.stock-name .pill { margin-left: 6px; vertical-align: middle; }
.stepper { display: inline-flex; align-items: center; background: var(--cream); border-radius: 999px; border: 1px solid var(--line); }
.stepper button { width: 40px; height: 40px; border: 0; background: transparent; font-size: 20px; font-weight: 800; border-radius: 50%; }
.stepper button:hover { background: var(--gold-soft); }
.stepper input { width: 52px; text-align: center; border: 0; background: transparent; font-weight: 800; font-size: 17px; padding: 0; }
.stepper input:focus { outline: none; }
.stepper.off { opacity: .35; pointer-events: none; }
.zero { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); font-size: 12px; font-weight: 800; color: var(--bad); }
.zero:hover { background: var(--bad-bg); }
.stock-row .pill-bad { background: var(--bad-bg); color: var(--bad); }
.saving { font-size: 12px; color: var(--muted); }

/* Tables / listes génériques */
.list { display: flex; flex-direction: column; gap: 10px; }
.item { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 12px 14px; display: flex; align-items: center; gap: 12px; }
.item.inactif { opacity: .55; }
.item-thumb { width: 56px; height: 56px; border-radius: 10px; background: linear-gradient(140deg, #2a2420, var(--ink)); display: grid; place-items: center; font-size: 26px; overflow: hidden; flex: none; }
.item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.item-main { flex: 1; min-width: 0; }
.item-main b { display: block; font-family: var(--display); font-size: 19px; line-height: 1.1; }
.item-main small { color: var(--muted); font-size: 12.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-main .pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.item-price { font-family: var(--display); font-weight: 700; font-size: 20px; color: var(--gold-deep); white-space: nowrap; }
.item-actions { display: flex; gap: 6px; flex: none; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); display: grid; place-items: center; font-size: 15px; }
.icon-btn:hover { border-color: var(--gold); background: var(--gold-soft); }
.icon-btn.danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.group-title { font-family: var(--display); font-size: 22px; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.group-title small { font-family: var(--body); font-size: 12px; color: var(--muted); font-weight: 600; }

/* Commandes */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters .chip { padding: 8px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); font-weight: 700; font-size: 13px; }
.filters .chip.active { background: var(--ink); color: var(--gold); border-color: var(--ink); }
.order { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 14px 16px; display: grid; gap: 10px; }
.order-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-head b { font-family: var(--display); font-size: 22px; }
.order-head .when { color: var(--muted); font-size: 12.5px; }
.order-head .spacer { flex: 1; }
.order-client { font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.order-client a { color: var(--good); font-weight: 700; text-decoration: none; }
.order-lines { font-size: 14px; display: grid; gap: 3px; padding: 8px 12px; background: var(--cream); border-radius: var(--radius-sm); }
.order-lines div { display: flex; justify-content: space-between; gap: 10px; }
.order-lines .tot { font-weight: 800; border-top: 1px solid var(--line); padding-top: 4px; margin-top: 3px; }
.order select { padding: 8px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); font-weight: 700; font-size: 13px; }
.st-en_attente { background: var(--warn-bg); color: var(--warn); }
.st-confirmee { background: #e3edf9; color: #2b5a9a; }
.st-prete { background: var(--good-bg); color: var(--good); }
.st-livree { background: #e9e4dc; color: #6b625a; }
.st-annulee { background: var(--bad-bg); color: var(--bad); }

/* Formulaires / cartes */
.panel { background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; display: grid; gap: 14px; margin-bottom: 16px; }
.panel h3 { font-size: 22px; }
.panel .hint { color: var(--muted); font-size: 13px; margin: -8px 0 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } }
.switch { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); cursor: pointer; }
.switch b { display: block; font-size: 14px; }
.switch small { color: var(--muted); font-size: 12.5px; }
.switch .sw { margin-left: auto; width: 46px; height: 26px; border-radius: 999px; background: #d8d2c7; position: relative; flex: none; transition: background .15s; }
.switch .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch input:checked ~ .sw { background: var(--good); }
.switch input:checked ~ .sw::after { transform: translateX(20px); }
.switch.big { border-color: var(--gold); background: var(--gold-soft); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* Modal admin */
.amodal { position: fixed; inset: 0; z-index: 100; background: rgba(20,17,14,.55); display: grid; place-items: center; padding: 16px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.amodal.open { opacity: 1; pointer-events: auto; }
.amodal-card { background: var(--cream); border-radius: 18px; width: min(560px, 100%); max-height: 92vh; overflow-y: auto; padding: 20px; display: grid; gap: 14px; }
.amodal-card h3 { font-size: 26px; }
.img-pick { display: flex; gap: 12px; align-items: center; }
.img-pick .item-thumb { width: 76px; height: 76px; }
.img-pick .btns { display: flex; flex-direction: column; gap: 6px; }

/* Aperçu bannière */
.banniere-preview { border-radius: var(--radius); padding: 14px 18px; display: flex; gap: 14px; align-items: center; }
.banniere-preview h4 { font-family: var(--display); font-size: 20px; margin: 0; }
.banniere-preview p { margin: 0; font-size: 13px; opacity: .9; }
.banniere-or { background: linear-gradient(120deg, #e9d4a3, var(--gold)); color: var(--ink); }
.banniere-noir { background: var(--ink); color: var(--gold-soft); border: 1px solid rgba(200,164,100,.35); }
.banniere-noir h4 { color: var(--gold); }
.banniere-rouge { background: var(--it-red); color: #fff; }
.banniere-vert { background: var(--it-green); color: #fff; }
.banniere-blanc { background: var(--paper); color: var(--text); border: 1px solid var(--line); }

/* Traductions */
.tr-box { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fbf8f1; padding: 0 14px; }
.tr-box summary { cursor: pointer; padding: 12px 0; font-weight: 700; font-size: 14px; }
.tr-box .hint { margin: 0 0 8px; }
.tr-lang { display: grid; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.tr-lang-title { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--gold-deep); }
.tr-box .field input, .tr-box .field textarea { background: #fff; }

/* Étoile "vitrine du jour" */
.stock-row { grid-template-columns: auto 1fr auto auto; }
.star { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); font-size: 18px; line-height: 1; color: #b9ad9a; }
.star.on { background: var(--gold-soft); border-color: var(--gold); color: var(--gold-deep); }

.order-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.order.hl { outline: 2px solid var(--gold); }

/* Réordonnancement */
.item .drag { cursor: grab; color: #b9ad9a; font-size: 16px; letter-spacing: -2px; padding: 0 4px; user-select: none; }
.item.dragging { opacity: .5; }
.item .updown { display: inline-flex; gap: 2px; }
.item .updown .icon-btn { width: 28px; height: 28px; font-size: 11px; }

/* Mobile : ligne produit sur deux rangées (photo + texte, puis prix + actions), en-tête compact */
@media (max-width: 640px) {
  .item { flex-wrap: wrap; row-gap: 10px; padding: 12px; }
  .item[data-pid] { display: grid; grid-template-columns: auto 56px minmax(0, 1fr); grid-template-areas: "drag thumb main" "price price actions"; column-gap: 12px; align-items: center; }
  .item[data-pid] .drag { grid-area: drag; }
  .item[data-pid] .item-thumb { grid-area: thumb; }
  .item[data-pid] .item-main { grid-area: main; min-width: 0; }
  .item-main b { font-size: 17px; }
  .item[data-pid] .item-price { grid-area: price; }
  .item[data-pid] .item-actions { grid-area: actions; justify-self: end; }
  .item-actions { margin-inline-start: auto; }
  .item .updown .icon-btn { width: 32px; height: 32px; }
  .topbar-inner { gap: 8px; padding: 8px 12px; }
  .topbar img { width: 32px; height: 32px; }
  .topbar .title { font-size: 15px; white-space: nowrap; }
  .topbar a, .topbar button.linkish { white-space: nowrap; padding: 6px 9px; font-size: 12px; }
}

.order-lines .offert { color: var(--good, #2e7d4f); font-weight: 600; }
.pill-ok { background: #e3f2e8; color: #2e7d4f; }

/* Cadrage de la photo produit : aperçu au format des cartes du site, image déplaçable */
.frame-box { position: relative; width: 100%; max-width: 320px; aspect-ratio: 358 / 230; border-radius: 12px; overflow: hidden; background: #E8DFD2; cursor: grab; touch-action: none; user-select: none; }
.frame-box:active { cursor: grabbing; }
.frame-box img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.frame-tools { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; color: var(--muted); max-width: 320px; }
.frame-tools input[type=range] { flex: 1; accent-color: var(--gold); }

/* Fenêtres de l'admin sur mobile : rien ne déborde, les aides de champ passent à la ligne, les boutons se replient */
.amodal-card { overflow-x: hidden; }
.amodal-card > *, .amodal-card .field, .amodal-card .panel { min-width: 0; }
.amodal-card .field label { display: block; line-height: 1.35; overflow-wrap: anywhere; }
.amodal-card .field label small { display: block; margin-top: 2px; }
.amodal-card .field input, .amodal-card .field select, .amodal-card .field textarea { max-width: 100%; box-sizing: border-box; }
.amodal-card .btn { white-space: normal; text-align: center; }
.amodal-card .hint, .amodal-card .switch small, .amodal-card p { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .amodal { padding: 10px; }
  .amodal-card { padding: 16px 14px; max-height: 94vh; }
  .amodal-card h3 { font-size: 22px; }
  .img-pick { flex-wrap: wrap; }
  .tr-box { padding: 0 10px; }
  .form-actions .btn { flex: 1 1 auto; }
}

/* Fiche produit : respiration entre le cadre de la fenêtre, les libellés et les champs ; bloc cadrage aéré */
.amodal-card { padding: 22px 20px; gap: 16px; }
@media (max-width: 640px) { .amodal-card { padding: 20px 18px; } }
.amodal-card .field { display: flex; flex-direction: column; gap: 6px; }
.amodal-card .field label { margin-bottom: 2px; }
#cadrage .frame-box { margin-top: 6px; }
#cadrage .frame-tools { margin-top: 10px; }

/* Fenêtres : le panneau blanc du formulaire garde une marge intérieure, les champs ne touchent plus son bord */
.amodal-card form.panel, .amodal-card .panel { padding: 18px 20px !important; border-radius: 14px; }
.amodal-card h3 { margin: 0 4px; }
@media (max-width: 640px) { .amodal-card form.panel, .amodal-card .panel { padding: 14px 14px !important; } }
