/* Caution — Event La Belle Étoile
   Pensé pour un téléphone en plein soleil : fond clair, texte très contrasté, grandes zones de toucher. */

:root {
  --ink: #1a1613;
  --ink-2: #3d362f;
  --muted: #6b6258;
  --bg: #faf7f2;
  --card: #ffffff;
  --line: #e2dacd;
  --brand: #8a5408;        /* brun du logo, assombri pour le contraste du texte blanc */
  --brand-hover: #744506;
  --brand-soft: #f6ecdc;
  --ok: #1f7a3f;
  --ok-soft: #e4f3e9;
  --warn: #b45309;
  --warn-soft: #fdf0dc;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --info: #24507a;
  --info-soft: #e6eff8;
  --radius: 14px;
  --gutter: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  min-height: 100vh;
}
img { max-width: 100%; }
a { color: var(--brand); }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- En-tête ---------- */
.top {
  background: var(--ink);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px var(--gutter);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; }
.brand img { height: 34px; width: auto; display: block; }
.top-right { display: flex; align-items: center; gap: 10px; }
.mode {
  font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 99px; color: #fff; background: #4b5563;
}
.mode-test { background: #b45309; }
.mode-live { background: #b42318; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid #ffffff33; background: transparent; color: #fff;
  display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; }

.wrap { max-width: 720px; margin: 0 auto; padding: 20px var(--gutter) 80px; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
h1.title { font-size: 28px; line-height: 1.15; letter-spacing: -.01em; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: -8px 0 4px; font-weight: 600; text-decoration: none; }

/* ---------- Cartes & boutons ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stack > * + * { margin-top: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 20px; border-radius: 12px; border: 2px solid transparent;
  font-size: 17px; font-weight: 650; text-decoration: none; cursor: pointer; text-align: center;
  transition: background .12s, border-color .12s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--brand-soft); }
.btn-quiet { background: transparent; color: var(--bad); border-color: transparent; min-height: 44px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-sm { min-height: 44px; padding: 8px 14px; font-size: 15px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions > .btn { flex: 1 1 auto; }

/* ---------- Pastilles d'état ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px;
  font-size: 14px; font-weight: 650; background: #ece7df; color: var(--ink-2); white-space: nowrap;
}
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-plain::before { display: none; }

/* ---------- Formulaires ---------- */
.field { display: block; }
.field > span { display: block; font-weight: 650; margin-bottom: 6px; }
.field > small { display: block; color: var(--muted); margin-top: 6px; font-size: 14px; }
input[type=text], input[type=tel], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; min-height: 52px; padding: 12px 14px; border: 2px solid #b9ad9c; border-radius: 12px; background: #fff; font-size: 17px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px #a8681033; }
.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.stepper { display: flex; align-items: stretch; gap: 10px; }
.stepper button { width: 56px; min-height: 56px; border-radius: 12px; border: 2px solid var(--ink); background: #fff; font-size: 28px; line-height: 1; cursor: pointer; font-weight: 500; }
.stepper button:active { background: var(--brand-soft); }
.stepper input { text-align: center; font-size: 24px; font-weight: 700; min-height: 56px; }
.money { position: relative; }
.money input { padding-right: 44px; font-size: 26px; font-weight: 750; letter-spacing: -.01em; }
.money::after { content: "€"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 22px; font-weight: 700; color: var(--muted); pointer-events: none; }

/* ---------- Alertes ---------- */
.alert { padding: 12px 14px; border-radius: 12px; border: 1px solid; font-size: 15px; }
.alert-info { background: var(--info-soft); border-color: #b6cde4; color: #17364f; }
.alert-warn { background: var(--warn-soft); border-color: #eccb96; color: #6b3306; }
.alert-bad { background: var(--bad-soft); border-color: #f0b8b3; color: #7a1610; }
.alert-ok { background: var(--ok-soft); border-color: #a8d5b6; color: #14522a; }
.alert strong { font-weight: 700; }

/* ---------- Liste ---------- */
.tabs { display: flex; gap: 6px; background: #ece7df; padding: 4px; border-radius: 14px; margin-bottom: 14px; }
.tabs a { flex: 1; text-align: center; padding: 11px 8px; min-height: 44px; border-radius: 11px; font-weight: 650; text-decoration: none; color: var(--ink-2); }
.tabs a[aria-current=page] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px #0002; }
.item { display: block; text-decoration: none; color: inherit; }
.item + .item { margin-top: 10px; }
.item:hover { border-color: var(--brand); }
.item-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 6px 10px; }
.item-top .item-name { flex: 1 1 10ch; min-width: 0; overflow-wrap: anywhere; }
.item-top .chip { flex: 0 0 auto; }
.item-name { font-size: 19px; font-weight: 700; overflow-wrap: anywhere; }
.item-meta { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; color: var(--ink-2); }
.item-notes { margin-top: 6px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.amount-strong { font-weight: 750; font-variant-numeric: tabular-nums; }
.empty { text-align: center; padding: 36px 16px; }
.empty p { color: var(--muted); margin: 6px 0 18px; }

/* ---------- Caution : en-tête & progression ---------- */
.summary h1 { font-size: 26px; overflow-wrap: anywhere; }
.summary .page-title { margin-bottom: 0; }
.summary-meta { margin-top: 8px; display: grid; gap: 4px; color: var(--ink-2); font-size: 15px; overflow-wrap: anywhere; }
.progress { margin-top: 14px; }
.progress-row { display: flex; justify-content: space-between; gap: 8px; font-weight: 650; margin-bottom: 6px; flex-wrap: wrap; }
.bar { height: 12px; border-radius: 99px; background: #ece7df; overflow: hidden; display: flex; }
.bar > i { display: block; height: 100%; transition: width .4s; }
.bar > .seg-held { background: var(--ok); }
.bar > .seg-pend { background: #d9b98a; }

/* ---------- Empreintes ---------- */
.hold { border-width: 2px; }
.hold-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.hold-head h3 { font-size: 18px; }
.hold-pending { border-color: var(--ink); }
.hold-held { border-color: var(--ok); background: #fbfefc; }
.hold-captured { border-color: var(--warn); }
.hold-bad { border-color: var(--line); }

.qr-wrap { display: grid; place-items: center; }
.qr { width: min(100%, 340px); background: #fff; padding: 12px; border: 3px solid var(--ink); border-radius: 18px; }
.qr svg { display: block; width: 100%; height: auto; }
.qr.expired { opacity: .25; filter: grayscale(1); }
.hold-amount { text-align: center; font-size: 34px; font-weight: 800; letter-spacing: -.02em; margin-top: 14px; font-variant-numeric: tabular-nums; }
.waiting { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 4px; font-weight: 650; color: var(--ink-2); flex-wrap: wrap; text-align: center; }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--brand); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1.15); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } .bar > i { transition: none; } }
.hold .actions { margin-top: 16px; }

.held-main { display: flex; align-items: center; gap: 14px; }
.tick { flex: none; width: 56px; height: 56px; border-radius: 50%; background: var(--ok); color: #fff; display: grid; place-items: center; }
.tick svg { width: 32px; height: 32px; }
.held-amount { font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.held-detail { margin-top: 12px; display: grid; gap: 6px; color: var(--ink-2); }
.expiry { display: inline-block; padding: 6px 12px; border-radius: 10px; font-weight: 650; background: #ece7df; }
.expiry.warn { background: var(--warn-soft); color: var(--warn); }
.expiry.bad { background: var(--bad-soft); color: var(--bad); }

.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 #1f7a3f88; } 30% { box-shadow: 0 0 0 14px #1f7a3f22; } 100% { box-shadow: 0 0 0 0 #1f7a3f00; } }

/* ---------- Fin de location ---------- */
.close-panel h2 { font-size: 20px; }
.close-panel .lead { color: var(--ink-2); margin-top: 4px; }
.close-panel .actions { margin-top: 14px; }
.take { margin-top: 16px; padding-top: 16px; border-top: 1px dashed #b9ad9c; }
.take-line { display: grid; gap: 6px; }
.sum-line { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--brand-soft); font-weight: 650; }
.sum-line.bad { background: var(--bad-soft); color: var(--bad); }

/* ---------- Historique ---------- */
details.history summary { cursor: pointer; font-weight: 650; min-height: 44px; display: flex; align-items: center; }
.timeline { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.timeline li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; font-size: 14px; }
.timeline time { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 420px) { .timeline li { grid-template-columns: 1fr; gap: 0; } }

/* ---------- Fenêtres de confirmation ---------- */
dialog.modal { border: 0; border-radius: 18px; padding: 0; width: min(92vw, 460px); color: var(--ink); background: #fff; box-shadow: 0 20px 60px #0006; }
dialog.modal::backdrop { background: #1a161399; }
.modal-in { padding: 20px; display: grid; gap: 14px; }
.modal-in h2 { font-size: 21px; }
.modal-in p { color: var(--ink-2); }
.modal-actions { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 420px) { .modal-actions { grid-template-columns: 1fr 1fr; } }
@media (max-width: 559px) {
  dialog.modal { margin: auto auto 0; width: 100%; max-width: none; border-radius: 22px 22px 0 0; }
}

/* ---------- Notifications ---------- */
.toasts { position: fixed; left: 0; right: 0; bottom: 16px; display: grid; gap: 8px; justify-items: center; padding: 0 var(--gutter); z-index: 50; pointer-events: none; }
.toast { pointer-events: auto; max-width: 520px; padding: 14px 18px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 600; box-shadow: 0 8px 24px #0004; }
.toast.ok { background: var(--ok); }
.toast.bad { background: var(--bad); }

.loading { text-align: center; padding: 40px 0; color: var(--muted); }

/* ---------- Connexion & pages client ---------- */
body.public { display: grid; }
.pub { width: min(100%, 520px); margin: 0 auto; padding: 24px var(--gutter) 40px; display: grid; gap: 20px; align-content: start; }
.pub-logo { width: min(320px, 80%); height: auto; margin: 8px auto 0; display: block; }
.pub-card { padding: 22px 20px; }
.pub-foot { text-align: center; color: var(--muted); font-size: 14px; }
.pub-card h1 { font-size: 24px; margin-bottom: 14px; }
.msg { text-align: center; }
.msg h1 { font-size: 24px; margin: 12px 0 8px; }
.msg p { color: var(--ink-2); }
.msg-ico { width: 72px; height: 72px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--info-soft); color: var(--info); }
.msg-ico svg { width: 40px; height: 40px; }
.msg-ok .msg-ico { background: var(--ok-soft); color: var(--ok); }
.msg-warn .msg-ico { background: var(--warn-soft); color: var(--warn); }
.demo-banner { background: var(--warn-soft); border: 2px dashed var(--warn); color: #6b3306; font-weight: 700; padding: 10px 12px; border-radius: 12px; text-align: center; margin-bottom: 16px; }
.demo-h { font-size: 22px; text-align: center; }
.demo-amount { text-align: center; font-size: 44px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0; }
.demo-form { display: grid; gap: 12px; margin-top: 16px; }
.pub-card .muted { text-align: center; }
.pub-card .alert { margin-top: 12px; }
