/* Plateforme boulangerie — feuille unique, mobile d'abord, sans dépendance */
:root {
  --brand: #8B4513;
  --brand-2: #F5DEB3;
  --ink: #1f1a17;
  --muted: #6b625c;
  --line: #e7e1dc;
  --bg: #faf8f6;
  --card: #ffffff;
  --ok: #1e7b45;
  --ok-bg: #e5f4ea;
  --warn: #8a5a00;
  --warn-bg: #fff3d6;
  --err: #b42318;
  --err-bg: #fde8e6;
  --info-bg: #e8f0fb;
  --radius: 12px;
  --tap: 46px;
  font-size: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif; line-height: 1.45;
}
img { max-width: 100%; display: block; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8rem; }
small, .muted { color: var(--muted); }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 720px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  h1 { font-size: 1.8rem; }
}
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.right { text-align: right; } .center { text-align: center; }
.nowrap { white-space: nowrap; }

/* Cartes */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.card h2 { font-size: 1.1rem; }
.card.flat { border: 0; }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: var(--tap); padding: .6rem 1.1rem; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--err); border-color: #f2c2bd; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.block { width: 100%; }
.btn.lg { min-height: 54px; font-size: 1.05rem; }
.btn.sm { min-height: 36px; padding: .3rem .7rem; font-size: .9rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; text-decoration: underline; }

/* Formulaires */
label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field { margin-bottom: 1rem; }
.field .hint { font-weight: 400; font-size: .88rem; color: var(--muted); margin-top: .25rem; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; min-height: var(--tap); padding: .55rem .75rem; border: 1px solid #cfc7c0; border-radius: 10px;
  font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); outline-offset: 1px; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; min-height: 32px; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--brand); }
.otp-input { font-size: 1.6rem; letter-spacing: .5rem; text-align: center; }

/* Choix sous forme de pastilles (mode, dates, créneaux, paiement) */
.choices { display: flex; gap: .5rem; flex-wrap: wrap; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; }
.choice > span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: var(--tap); min-width: 72px;
  padding: .45rem .8rem; border: 1px solid #cfc7c0; border-radius: 10px; background: #fff; font-weight: 600; text-align: center; cursor: pointer;
}
.choice > span small { font-weight: 400; font-size: .78rem; }
.choice input:checked + span { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, #fff); box-shadow: inset 0 0 0 1px var(--brand); }
.choice input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--brand) 35%, transparent); }
.choices.big .choice { flex: 1 1 140px; }
.choices.big .choice > span { min-height: 64px; }
.scroll-x { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .3rem; scrollbar-width: thin; }
.scroll-x .choice > span { min-width: 88px; }

/* Messages */
.alert { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.alert.success { background: var(--ok-bg); color: var(--ok); }
.alert.error { background: var(--err-bg); color: var(--err); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.info { background: var(--info-bg); color: #1d4f91; }
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 99px; font-size: .78rem; font-weight: 600; background: #eee; color: #444; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.info { background: var(--info-bg); color: #1d4f91; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .55rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #fbf7f3; }
td.num, th.num { text-align: right; white-space: nowrap; }

/* ---------------- Boutique ---------------- */
.shop-header { background: var(--brand); color: #fff; }
.shop-header .wrap { display: flex; align-items: center; gap: .75rem; min-height: 60px; }
.shop-header a { color: #fff; text-decoration: none; }
.shop-logo { width: 40px; height: 40px; border-radius: 10px; background: #fff; object-fit: cover; }
.shop-name { font-weight: 700; font-size: 1.05rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-link { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: var(--tap); min-height: var(--tap); }
.cart-count { position: absolute; top: 2px; right: 0; background: #fff; color: var(--brand); border-radius: 99px; font-size: .72rem; font-weight: 700; padding: 0 .35rem; }
.lang-switch { color: #fff; opacity: .9; font-size: .85rem; }
.hero { background: linear-gradient(180deg, var(--brand-2), var(--bg)); padding: 1.2rem 0 .5rem; }
.hero .info { font-size: .92rem; color: #3d3530; }
.banner { padding: .7rem 1rem; border-radius: 10px; font-weight: 600; margin: .8rem 0; }
.banner.closed { background: var(--err-bg); color: var(--err); }
.banner.full { background: var(--warn-bg); color: var(--warn); }
.cat-nav { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.cat-nav .scroll-x { padding: .5rem 0; }
.cat-nav a { flex: none; padding: .45rem .9rem; border-radius: 99px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .9rem; min-height: 38px; display: inline-flex; align-items: center; }
.products { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (min-width: 720px) { .products { grid-template-columns: repeat(4, 1fr); } }
.product { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.product .ph { aspect-ratio: 4 / 3; background: var(--brand-2); display: flex; align-items: center; justify-content: center; font-size: 2rem; }
.product .ph img { width: 100%; height: 100%; object-fit: cover; }
.product .body { padding: .6rem .7rem .7rem; display: flex; flex-direction: column; gap: .25rem; flex: 1; }
.product .name { font-weight: 600; font-size: .95rem; }
.product .price { font-weight: 700; color: var(--brand); }
.product .meta { font-size: .78rem; color: var(--muted); }
.product.soldout .ph { filter: grayscale(.8); opacity: .7; }
.product .add { margin-top: auto; }
.qty { display: inline-flex; align-items: center; border: 1px solid #cfc7c0; border-radius: 10px; overflow: hidden; }
.qty button { width: var(--tap); height: var(--tap); border: 0; background: #fff; font-size: 1.3rem; cursor: pointer; color: var(--brand); }
.qty input { width: 52px; text-align: center; border: 0; min-height: var(--tap); font: inherit; font-weight: 700; -moz-appearance: textfield; }
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.sticky-bar { position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: .7rem 0; z-index: 6; box-shadow: 0 -4px 14px rgba(0,0,0,.05); }
.cart-line { display: grid; grid-template-columns: 56px 1fr auto; gap: .7rem; padding: .8rem 0; border-bottom: 1px solid var(--line); align-items: start; }
.cart-line img, .cart-line .noimg { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; background: var(--brand-2); }
.totals div { display: flex; justify-content: space-between; padding: .25rem 0; }
.totals .grand { font-size: 1.15rem; font-weight: 800; border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .5rem; }
.steps { display: flex; gap: .3rem; margin: 1rem 0; }
.steps span { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.steps span.on { background: var(--brand); }
.section-title { display: flex; align-items: center; gap: .5rem; }
.section-title .n { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem; flex: none; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: .4rem 0 .4rem 1.4rem; position: relative; border-left: 2px solid var(--line); margin-left: .4rem; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: .75rem; width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.timeline li.done::before { background: var(--ok); }
.timeline li.current::before { background: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 25%, transparent); }
.spinner { width: 54px; height: 54px; border: 5px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite; margin: 1rem auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.big-number { font-size: 2rem; font-weight: 800; letter-spacing: .02em; }
.map-box { height: 220px; border-radius: 10px; border: 1px solid var(--line); background: #eef; }
footer.shop-footer { padding: 2rem 0 5rem; font-size: .85rem; color: var(--muted); }

/* ---------------- Back-office ---------------- */
.admin-top { background: #2b2420; color: #fff; }
.admin-top .wrap { display: flex; align-items: center; gap: .75rem; min-height: 56px; }
.admin-top a, .admin-top button { color: #fff; }
.admin-top .who { font-size: .85rem; opacity: .85; }
.assist-bar { background: #b42318; color: #fff; padding: .4rem 0; font-weight: 600; font-size: .9rem; }
.admin-nav { background: #fff; border-bottom: 1px solid var(--line); }
.admin-nav .scroll-x { padding: .35rem 0; }
.admin-nav a { flex: none; padding: .55rem .85rem; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: .92rem; min-height: 42px; display: inline-flex; align-items: center; }
.admin-nav a.on { background: color-mix(in srgb, var(--brand) 12%, #fff); color: var(--brand); }
main.admin { padding-top: 1rem; padding-bottom: 3rem; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.kpi .v { font-size: 1.8rem; font-weight: 800; }
.kpi .l { color: var(--muted); font-size: .88rem; }
.order-card { display: flex; justify-content: space-between; gap: .5rem; padding: .7rem .2rem; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.order-card:hover { background: #fbf7f3; }
.order-card .num { font-weight: 800; font-size: 1.05rem; }
.status-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.status-actions form { flex: 1 1 160px; }
.status-actions .btn { width: 100%; }
details.box { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; background: #fff; }
details.box summary { cursor: pointer; font-weight: 600; min-height: 32px; }
.option-group { border: 1px dashed #cfc7c0; border-radius: 10px; padding: .8rem; margin-bottom: .8rem; }
.photo-thumbs { display: flex; gap: .5rem; flex-wrap: wrap; }
.photo-thumbs figure { margin: 0; width: 110px; }
.photo-thumbs img { border-radius: 8px; }
.toast { position: fixed; right: 16px; bottom: 16px; left: 16px; max-width: 420px; margin-left: auto; background: #2b2420; color: #fff; padding: 1rem; border-radius: 12px; z-index: 50; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.toast a { color: #ffd9a8; }

/* ---------------- Impression ---------------- */
.print-page { max-width: 800px; margin: 0 auto; padding: 16px; background: #fff; }
.print-page h1 { font-size: 1.4rem; }
.print-page table { font-size: .95rem; }
.cake-sheet { border: 1px solid #999; border-radius: 6px; padding: .7rem; margin-bottom: .8rem; page-break-inside: avoid; display: grid; grid-template-columns: 1fr 120px; gap: .7rem; }
.cake-sheet img { width: 120px; border-radius: 6px; }
.ticket { max-width: 380px; margin: 0 auto; font-family: ui-monospace, Menlo, monospace; font-size: 14px; }
.ticket .big { font-size: 28px; font-weight: 800; text-align: center; }
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .print-page { padding: 0; }
}
.btn.primary.pending { opacity: .75; }
