/* Frais & Tonique — feuille de style unique, mobile first (page publique + admin) */

:root {
  --paper: #F5EFE3;
  --card: #FFFDF8;
  --kraft: #D9C6A5;
  --kraft-soft: #EEE4D1;
  --ink: #1C1A17;
  --muted: #6B6458;
  --line: #E3D8C6;
  --gingembre: #E9B10F;
  --bissap: #B3123F;
  --ok: #3E9B57;
  --danger: #A3322A;
  --radius: 16px;
  --shadow: 0 1px 2px rgb(28 26 23 / .06), 0 10px 28px -14px rgb(28 26 23 / .22);
  --script: "Caveat", "Segoe Print", cursive;
  --serif: "Fraunces", Georgia, serif;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 16px/1.55 var(--sans); }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.script { font-family: var(--script); font-weight: 600; line-height: 1; }

/* ── Hero : le tableau de Raïssa, les bouteilles posées devant ── */
.hero { text-align: center; }
.hero__scene { position: relative; padding: 28px 20px 0; }
.hero__canvas {
  width: min(74%, 380px); aspect-ratio: 4 / 5; margin: 0 auto; overflow: hidden; background: #fff;
  border-radius: 4px; box-shadow: 0 2px 4px rgb(28 26 23 / .1), 0 24px 40px -18px rgb(28 26 23 / .45);
}
.hero__canvas img { width: 100%; height: 100%; object-fit: cover; }
.hero__table {
  position: relative; display: flex; justify-content: center; align-items: flex-end; gap: 16px;
  margin: -150px -20px 0; padding: 0 20px 18px;
  background: linear-gradient(to bottom, transparent calc(100% - 34px), #4A443B calc(100% - 34px), #39342D);
}
.hero__table .bottle { width: auto; filter: drop-shadow(0 12px 10px rgb(0 0 0 / .35)); }
.hero__table .bottle:nth-child(even) { transform: translateY(-4px) scale(.94); }
.hero__text { padding: 24px 20px 32px; max-width: 640px; margin: 0 auto; }
.facts a { text-decoration-color: var(--kraft); text-underline-offset: 3px; }
.hero .facts { text-align: left; max-width: 420px; margin-left: auto; margin-right: auto; }
.eyebrow { font-size: .75rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
h1 { font: 600 clamp(2.4rem, 11vw, 3.8rem)/1 var(--serif); letter-spacing: -.02em; margin: 8px 0 12px; }
.lead { font-size: 1.05rem; color: var(--muted); }
.facts { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 8px; font-size: .95rem; }
.facts li { padding-left: 20px; position: relative; }
.facts li::before { content: ""; position: absolute; left: 4px; top: .65em; width: 5px; height: 5px; border-radius: 50%; background: var(--kraft); }
.facts .facts__status::before { display: none; }
.dot { position: absolute; left: 0; top: .45em; width: 11px; height: 11px; border-radius: 50%; background: var(--danger); }
.dot.is-open { background: var(--ok); box-shadow: 0 0 0 4px rgb(62 155 87 / .18); }

/* Bandeau dessin à l'encre (clin d'œil aux étiquettes) */
.band { height: 56px; background: var(--ink) url(bandeau.webp) center / cover; }

/* ── Contenu ── */
.wrap { max-width: 640px; margin: 0 auto; padding: 4px 16px 40px; }
.step { display: flex; align-items: center; gap: 10px; font: 600 1.3rem/1.2 var(--serif); margin: 36px 0 14px; }
.step span { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--paper); font: 700 .85rem var(--sans); }
.step--flush { margin-top: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stock { margin: -4px 0 14px; padding: 8px 14px; border-radius: 14px; background: var(--kraft-soft); display: inline-block; font-size: .9rem; }

/* Fiche produit : tableau en tête, étiquette kraft dessous */
.products { display: grid; gap: 20px; }
.product { background: var(--kraft-soft); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.product__art { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--kraft); }
.product__art img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 58%; transition: transform .6s ease; }
.art-placeholder { height: 100%; display: grid; place-items: center; background: radial-gradient(circle at 50% 60%, var(--kraft-soft), var(--kraft)); }
.art-placeholder .bottle { width: auto; }
.product:hover .product__art img { transform: scale(1.03); }
.product__name {
  position: absolute; left: 12px; top: 12px; padding: 4px 16px 8px; border-radius: 12px;
  background: var(--kraft-soft); color: var(--accent); font: 600 2.4rem/1 var(--script);
  box-shadow: 0 6px 18px -8px rgb(0 0 0 / .45);
}
.product__name::after { content: ""; display: block; width: 26px; height: 3px; margin-top: 2px; border-radius: 2px; background: var(--accent); }
.product__body { padding: 14px 18px 6px; }
.product__desc { font-weight: 500; }
.product__ing { color: var(--muted); font-size: .88rem; margin: 2px 0 6px; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px dashed rgb(28 26 23 / .16); }
.row__info { flex: 1; min-width: 0; }
.row__label { display: block; font-weight: 700; }
.bottle { flex: none; width: 34px; display: flex; justify-content: center; filter: drop-shadow(0 3px 4px rgb(28 26 23 / .18)); }
.row.is-out { opacity: .5; }
.soldout { font-style: normal; font-weight: 500; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--danger); margin-left: 6px; }
.row__price { font-size: .95rem; }
.row__price small { color: var(--muted); font-size: .8rem; }
.row.is-on .row__label { color: var(--accent); filter: brightness(.8); }

.stepper { flex: none; display: inline-flex; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 999px; }
.stepper button { width: 44px; height: 44px; border: 0; background: none; font-size: 1.35rem; cursor: pointer; border-radius: 50%; touch-action: manipulation; }
.stepper button:active { background: var(--kraft-soft); }
.stepper input { width: 32px; text-align: center; border: 0; background: none; font-weight: 700; appearance: textfield; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.returns { margin-top: 20px; }
.returns .step { margin: 0 0 4px; font-size: 1.05rem; }
.returns .step span { background: var(--kraft); color: var(--ink); }

/* Champs */
.fields { display: grid; gap: 14px; }
.fields label { display: grid; gap: 6px; font-weight: 500; font-size: .95rem; }
.fields input:not([type=checkbox]):not([type=color]):not([type=file]), .fields textarea, .fields select, .admin-head select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 1rem;
}
.fields input:focus, .fields textarea:focus, .fields select:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgb(28 26 23 / .1); }
.fields .check, .check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); }
.hp { position: absolute; left: -9999px; }
.alert { background: #FBEDEB; border: 1px solid #EBC3BE; color: var(--danger); border-radius: 10px; padding: 12px 16px; margin-top: 20px; display: grid; gap: 4px; }

/* Barre de commande collante */
.checkout {
  position: sticky; bottom: 0; z-index: 5; margin: 24px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: rgb(245 239 227 / .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
.checkout__sum { display: grid; min-width: 0; }
.checkout__sum .muted { font-size: .8rem; line-height: 1.3; }
.checkout__sum strong { font: 600 1.6rem/1.1 var(--serif); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 26px;
  border: 0; border-radius: 999px; background: var(--ink); color: var(--paper);
  font-weight: 700; font-size: 1rem; text-decoration: none; cursor: pointer; white-space: nowrap; transition: transform .15s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .3; cursor: not-allowed; }
.btn--ghost { background: none; color: var(--ink); border: 1px solid var(--ink); }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: .9rem; }

/* Bon à savoir */
.tips ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tips li { padding: 12px 16px; background: var(--kraft-soft); border-radius: 12px; font-weight: 500; }
.tips .step span { background: var(--gingembre); color: var(--ink); }

/* Confirmation / fermé */
.thanks, .closed { margin-top: 28px; display: grid; gap: 12px; text-align: center; justify-items: center; }
.thanks .script, .closed .script { font-size: 3rem; color: var(--bissap); }
.recap { list-style: none; padding: 0; margin: 0; font-weight: 500; }
.total-line strong { font: 600 1.6rem var(--serif); display: block; }

.foot { text-align: center; color: var(--muted); padding: 28px 16px calc(36px + env(safe-area-inset-bottom)); display: grid; gap: 4px; }
.foot__brand { font: 600 1.3rem var(--serif); color: var(--ink); }
.foot .pill { justify-self: center; margin: 6px 0; }
.foot__share { justify-self: center; font-size: .9rem; }

/* Ajout à l'écran d'accueil */
.install { margin-top: 16px; display: grid; gap: 10px; text-align: center; justify-items: center; background: var(--kraft-soft); }
.install .script { font-size: 2.2rem; color: var(--bissap); }
.install__how { font-size: .95rem; }
.install__how svg { vertical-align: -3px; }

/* Pastille d'appel */
.pill {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 22px; padding: 10px 18px 10px 12px;
  border-radius: 999px; background: var(--ink); color: var(--paper); text-decoration: none; font-weight: 500;
  box-shadow: var(--shadow);
}
.pill svg { flex: none; padding: 6px; width: 30px; height: 30px; border-radius: 50%; background: var(--gingembre); color: var(--ink); }
.thanks .pill, .closed .pill { margin-top: 0; }

/* ── Écrans plus larges ── */
@media (min-width: 680px) {
  .checkout { margin: 24px 0 0; border: 1px solid var(--line); border-radius: var(--radius); }
  .products { grid-template-columns: 1fr 1fr; }
  .wrap { max-width: 760px; }
}

/* ════════════ Admin ════════════ */
.admin-sticky { position: sticky; top: 0; z-index: 10; background: rgb(245 239 227 / .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.admin-top { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 0; }
.admin-top__brand { font: 600 1.6rem/1 var(--script); color: var(--bissap); }
.cart { position: relative; display: grid; place-items: center; width: 44px; height: 44px; color: var(--ink); border-radius: 50%; }
.cart__badge {
  position: absolute; top: 0; right: -2px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: var(--bissap); color: #fff; font: 700 .78rem/22px var(--sans); text-align: center; box-shadow: 0 0 0 2px var(--paper);
  animation: pop .4s ease;
}
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
.tag-new { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--bissap); color: #fff; font-size: .7rem; font-weight: 700; vertical-align: middle; }
.order.is-new { background: linear-gradient(90deg, rgb(179 18 63 / .06), transparent 70%); margin: 0 -18px; padding-left: 18px; padding-right: 18px; }
.spacer { height: 20px; }
.tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 8px 12px;
}
.tabs a { text-align: center; padding: 9px 6px; border-radius: 999px; text-decoration: none; font-weight: 500; font-size: .95rem; white-space: nowrap; }
.tabs a[aria-current] { background: var(--ink); color: var(--paper); }
.admin .wrap { max-width: 760px; }
.admin-head { margin: 22px 0 14px; display: grid; gap: 10px; }
.admin-head h1 { font-size: 2rem; margin: 0; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-actions form { flex: 1 1 100%; }
.flash { margin: 16px 0 0; padding: 12px 16px; border-radius: 12px; background: #E6F2E8; color: #24543A; font-weight: 500; }
.login { max-width: 380px; margin: 14vh auto 0; }
.brand-script { font-size: 2.6rem; color: var(--bissap); }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.kpi span { display: block; font-size: .78rem; color: var(--muted); }
.kpi strong { font: 600 1.5rem var(--serif); }
.kpi__sub { display: block; font-size: .75rem; color: var(--muted); margin-top: 2px; }
.field-title { font-weight: 500; font-size: .95rem; }

.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 500; }
.table .num { text-align: right; white-space: nowrap; }
.prod-name { font: 600 1.6rem/1 var(--script); color: var(--accent); }
.prod-qty { font: 600 1.5rem var(--serif); }

.order { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.order:first-child { padding-top: 0; }
.order:last-child { border-bottom: 0; padding-bottom: 0; }
.order__main { display: grid; gap: 2px; min-width: 0; }
.order__main p { margin-top: 6px; }
.order__side { display: grid; justify-items: end; align-content: start; gap: 8px; }
.order__total { font: 600 1.3rem var(--serif); }
.order.is-done .order__main, .order.is-done .order__total { opacity: .4; }
.link-btn { background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--muted); text-decoration: underline; font-size: .85rem; justify-self: start; }

.stack { display: grid; gap: 16px; }
fieldset.card { margin: 0; min-width: 0; }
legend { float: left; width: 100%; font: 600 1.15rem var(--serif); margin-bottom: 14px; padding: 0; }
legend + * { clear: both; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.input-suffix { position: relative; display: block; }
.input-suffix span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.fields input[type=color] { width: 100%; height: 48px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.savebar { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--paper) 30%); }
.savebar .btn { width: 100%; }

.product-edit legend { color: var(--accent); filter: brightness(.85); }
.product-edit__art { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.product-edit__art .thumb { flex: none; width: 96px; height: 96px; border-radius: 12px; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .bottle { height: 80px; width: auto; }
.add-product { margin-top: 24px; }
.btn--block { display: flex; width: 100%; margin-bottom: 16px; }
.btn--wa { background: #1F8F4E; color: #fff; }
.announce { margin-bottom: 16px; display: grid; gap: 10px; }
.announce .step { font-size: 1.1rem; }
.announce .step span, .help .step span { background: var(--kraft-soft); color: var(--ink); font-size: .95rem; }
.announce__actions { display: grid; gap: 8px; }
.help { margin-bottom: 16px; }
.help__steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 16px; }
.help__steps li { counter-increment: s; display: grid; grid-template-columns: 32px 1fr; column-gap: 12px; }
.help__steps li::before { content: counter(s); grid-row: span 2; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--gingembre); font-weight: 700; }
.help__steps strong, .help__list strong { display: block; }
.help__list { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.admin .row { gap: 10px; }
.admin span.bottle { display: grid; place-items: center; font-size: 1.4rem; }

@media (min-width: 680px) {
  .tabs { grid-template-columns: repeat(6, 1fr); }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .admin-actions form { flex: 0 1 auto; }
  .savebar .btn { width: auto; }
}

/* QR code : affichette & étiquettes */
.qr-actions { display: grid; gap: 6px; margin-bottom: 20px; }
.qr-actions .btn { width: 100%; }
.qr-actions p { margin-bottom: 10px; }
.poster {
  width: 100%; max-width: 420px; margin: 0 auto 30px; padding: 28px 24px; text-align: center; background: #fff;
  border-radius: var(--radius); box-shadow: var(--shadow); display: grid; gap: 10px; justify-items: center;
}
.poster__brand { font: 600 2.6rem/1 var(--script); color: var(--bissap); }
.poster__lead { font: 600 1.2rem/1.3 var(--serif); }
.poster__qr { width: 72%; padding: 12px; border: 3px solid var(--ink); border-radius: 18px; }
.poster__qr svg, .sticker svg { display: block; width: 100%; height: auto; }
.poster__scan { font-weight: 500; }
.poster__url { font-weight: 700; letter-spacing: .02em; word-break: break-all; }
.poster__info { color: var(--muted); font-size: .9rem; }
.stickers { display: none; }

@media print {
  @page { size: A4; margin: 10mm; }
  .no-print, .checkout, .foot, .tabs, .band, .admin-sticky { display: none !important; }
  body[data-print] .wrap { max-width: none; padding: 0; }
  body[data-print="planche"] .poster { display: none; }
  body[data-print="planche"] .stickers { display: grid; grid-template-columns: repeat(5, 36mm); grid-auto-rows: 38mm; justify-content: center; }
  .sticker { display: grid; justify-items: center; align-content: center; gap: 1mm; border: .2mm dashed #bbb; font: 600 8pt var(--sans); }
  .sticker > div { width: 26mm; }
  .poster { width: 148mm; max-width: none; min-height: 200mm; margin: 0 auto; box-shadow: none; border: .3mm solid #ddd; align-content: center; gap: 6mm; }
  .poster__brand { font-size: 34pt; }
  .poster__lead { font-size: 16pt; }
  .poster__qr { width: 95mm; }
  body { background: #fff; }
  .card, .kpi { box-shadow: none; }
}

/* Annonce, Courses, Finances */
.announce__text { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: .95rem; line-height: 1.45; resize: vertical; }
code { font-size: .85em; padding: 1px 6px; border-radius: 6px; background: var(--kraft-soft); }
.flash--warn { background: #FBF1DA; color: #7A5A00; margin: 12px 0 0; }
.recipe-legend { color: var(--accent); filter: brightness(.85); }
.shopping { list-style: none; margin: 0 0 12px; padding: 0; display: grid; }
.shopping li { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.shopping li:last-child { border-bottom: 0; }
.shopping input:checked + span { text-decoration: line-through; opacity: .45; }

.segmented { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--kraft-soft); margin-bottom: 14px; }
.segmented a, .segmented label { flex: 1; text-align: center; padding: 9px 10px; border-radius: 999px; text-decoration: none; font-weight: 500; cursor: pointer; }
.segmented a[aria-current], .segmented label:has(input:checked) { background: var(--card); box-shadow: var(--shadow); }
.segmented--form { margin: 0; }
.segmented--form label { position: relative; }
.segmented--form input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.period-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.period-nav strong { font: 600 1.25rem var(--serif); text-align: center; }
.kpi--result strong { color: #24543A; }
.kpi--result.is-neg strong { color: var(--danger); }

.entry { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; }
.entry > div:first-child { display: grid; gap: 2px; min-width: 0; }
.entry__side { display: grid; justify-items: end; align-content: start; }
.entry__amount { font: 600 1.1rem var(--serif); white-space: nowrap; }
.entry__amount.is-in { color: #24543A; }
.entry__amount.is-out { color: var(--danger); }
.admin .admin-actions { margin-top: 16px; }

details.announce summary { cursor: pointer; list-style: none; }
details.announce summary::-webkit-details-marker { display: none; }
details.announce summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .2s; }
details.announce[open] summary::after { transform: rotate(180deg); }
details.announce:not([open]) { gap: 0; padding-bottom: 18px; }
details.announce summary.step { margin: 0; }
