/* Addition à table : même identité que la vitrine (thème « lush » vert profond et or).
   Les couleurs par défaut sont surchargées par le bloc theme de la configuration du site. */
:root {
  --bg: #07140d;
  --surface: #102117;
  --surface-2: #0c1a12;
  --text: #f6f1e4;
  --muted: #c5d2c2;
  --gold: #e7c56a;
  --accent: #3ecf6e;
  --on-gold: #102117;
  --line: rgba(231, 197, 106, 0.28);
  --soft-line: rgba(231, 197, 106, 0.14);
  --warn-bg: rgba(255, 166, 77, 0.12);
  --warn-line: rgba(255, 166, 77, 0.5);
  --warn-text: #ffd9a8;
  --good-bg: rgba(62, 207, 110, 0.12);
  --good-line: rgba(62, 207, 110, 0.5);
  --good-text: #b8f5cc;
  --serif: "Cormorant Garamond", Georgia, serif;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: #040b07;
  color: var(--text);
  font-family: Outfit, Signika, Verdana, Helvetica, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.pay {
  width: min(100%, 430px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(62, 207, 110, 0.1), transparent 60%),
    var(--bg);
  box-shadow: 0 0 0 1px var(--soft-line);
}
.pay-loading, .pay-empty {
  margin: 0;
  padding: 48px 28px;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
}

/* En-tête : logo, nom, table */
.pay-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 22px 24px 16px;
  text-align: center;
}
.pay-head:has(.pay-logo) { text-align: left; }
.pay-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  mix-blend-mode: lighten;
}
.pay-head h1 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.pay-head p {
  margin: 0;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
}

/* Montant restant */
.pay-hero {
  position: relative;
  overflow: hidden;
  margin: 4px 16px 0;
  padding: 24px 22px 22px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(150deg, #173021 0%, #0d1c13 70%);
}
.pay-hero-label {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}
.pay-hero-amount {
  position: relative;
  z-index: 1;
  margin: 6px 0 0;
  color: var(--gold);
  font-size: clamp(44px, 14vw, 58px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.pay-progress {
  position: relative;
  z-index: 1;
  height: 8px;
  margin-top: 18px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.pay-progress span {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: var(--accent);
  transition: width 400ms var(--ease);
}
.pay-hero-total, .pay-hero-pending {
  position: relative;
  z-index: 1;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.pay-hero-total { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pay-hero-total span:only-child { margin-left: auto; }
.pay-hero-pending { margin-top: 6px; color: var(--warn-text); font-weight: 600; }
/* Halo décoratif (reprend l'emplacement des anciennes formes) */
.pay-art {
  display: none;
  position: absolute;
  right: -40px;
  top: -40px;
  width: 200px;
  height: 200px;
  pointer-events: none;
}
.blob { position: absolute; border-radius: 50%; filter: blur(2px); }
.blob-a { inset: 30px; background: radial-gradient(circle, rgba(231, 197, 106, 0.22), transparent 65%); }
.blob-b { width: 90px; height: 90px; right: 50px; top: 90px; background: radial-gradient(circle, rgba(62, 207, 110, 0.18), transparent 70%); }
.blob-c { display: none; }

.pay-body { padding: 8px 16px 36px; }
.pay-ask {
  margin: 26px 8px 14px;
  text-align: center;
  font-family: var(--serif);
  font-size: 25px;
  font-weight: 700;
  line-height: 1.1;
  text-wrap: balance;
}

/* Choix du mode de règlement */
.pay-choices { display: grid; gap: 12px; }
.pay-choice {
  position: relative;
  overflow: hidden;
  width: 100%;
  min-height: 120px;
  padding: 22px 22px 44px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
  text-align: center;
  transition: border-color 160ms var(--ease), transform 160ms var(--ease), background 160ms var(--ease);
}
@media (hover: hover) {
  .pay-choice:not(:disabled):hover { border-color: var(--gold); background: #142a1d; }
}
.pay-choice:active { transform: scale(0.985); }
.pay-choice-title {
  display: block;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.pay-choice-sub {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
}
.doodle {
  position: absolute;
  left: 50%;
  bottom: 10px;
  width: 50px;
  height: 26px;
  transform: translateX(-50%);
  pointer-events: none;
}
.doodle-flower { color: var(--gold); }
.doodle-core { fill: var(--surface); }
.doodle-swoosh { color: var(--accent); }
.doodle-cross { color: #f0a35e; }

.pay-secure {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.pay-secure svg { width: 14px; height: 14px; color: var(--gold); }

.pay-note, .pay-hint {
  margin: 16px 8px 0;
  color: var(--muted);
  line-height: 1.45;
  text-align: center;
}
.pay-banner {
  margin: 4px 16px 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
}
.pay-banner.good { background: var(--good-bg); border-color: var(--good-line); color: var(--good-text); }
.pay-banner.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-text); }

/* Détail de l'addition (replié) */
.pay-detail {
  margin-top: 22px;
  border: 1px solid var(--soft-line);
  border-radius: 18px;
  background: var(--surface-2);
}
.pay-detail summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 18px;
  list-style: none;
  font-weight: 600;
  cursor: pointer;
}
.pay-detail summary::-webkit-details-marker { display: none; }
.pay-detail summary span { color: var(--muted); font-size: 13px; font-weight: 500; margin-left: auto; }
.pay-detail summary::after { content: "+"; color: var(--gold); font-size: 22px; transition: transform 200ms var(--ease); }
.pay-detail[open] summary::after { transform: rotate(45deg); }
.pay-detail ul { list-style: none; margin: 0; padding: 0 18px 10px; }
.pay-detail li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--soft-line);
}
.pay-detail li.taken { color: var(--muted); }
.pay-detail em { font-style: normal; font-size: 12px; color: var(--accent); }
.pay-detail strong { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Règlements déjà effectués */
.pay-ledger { margin-top: 30px; }
.pay-ledger h2 {
  margin: 0 6px 6px;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
}
.pay-ledger ul { list-style: none; margin: 0; padding: 0 6px; }
.pay-ledger li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--soft-line);
}
.pay-ledger strong { font-size: 16px; color: var(--gold); }
.pay-ledger .who { margin: 0; font-weight: 600; }
.pay-ledger .how { margin: 2px 0 0; color: var(--muted); font-size: 13px; font-weight: 500; }
.pay-ledger .sum { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Écrans « Mes articles » et « On split » */
.pay-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 0 0 8px 16px;
  padding: 0 16px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font-weight: 600;
}
.pay-back span { color: var(--gold); font-size: 18px; line-height: 1; }
@media (hover: hover) { .pay-back:hover { border-color: var(--gold); } }
.pay-strip {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 4px 16px 0;
  padding: 14px 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(150deg, #173021 0%, #0d1c13 70%);
  color: var(--muted);
  font-weight: 600;
}
.pay-strip strong {
  color: var(--gold);
  font-size: 28px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.pay-step {
  margin: 22px 8px 6px;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.05;
}
.pay-step + .pay-hint { margin-top: 0; text-align: left; }
.pay-lines { display: grid; gap: 10px; margin-top: 18px; }
.pay-line {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  min-height: 60px;
  padding: 14px 16px;
  border: 1px solid var(--soft-line);
  border-radius: 18px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 160ms var(--ease), background 160ms var(--ease);
}
.pay-line:has(input:checked) { border-color: var(--gold); background: #172b1e; }
.pay-line.taken { opacity: 0.6; cursor: default; }
.pay-line input {
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--gold);
}
.pay-line .name { font-weight: 600; }
.pay-line strong { font-variant-numeric: tabular-nums; }
.pay-line .comment, .pay-line .state {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.pay-line .state { color: var(--accent); }
.pay-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 18px 0;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}
.pay-switch button {
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}
.pay-switch button[aria-pressed="true"] { background: var(--gold); color: var(--on-gold); }
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin: 10px 0 18px;
}
.stepper button {
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--gold);
  font-size: 28px;
  line-height: 1;
}
.stepper button:disabled { opacity: 0.35; cursor: not-allowed; }
.stepper strong {
  min-width: 56px;
  font-size: 46px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.pay-part {
  margin: 8px 0 0;
  text-align: center;
}
.pay-part span { display: block; color: var(--muted); font-weight: 600; }
.pay-part strong {
  display: block;
  margin-top: 4px;
  color: var(--gold);
  font-size: 46px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.pay-amount {
  width: 100%;
  height: 76px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--gold);
  font-size: 38px;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.02em;
}
.pay-amount::placeholder { color: rgba(231, 197, 106, 0.35); }
.pay-amount:focus { outline: 3px solid var(--gold); outline-offset: 2px; }
.pay-dock {
  position: sticky;
  bottom: 0;
  margin: 0;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 72%, rgba(7, 20, 13, 0));
}
.pay-body .pay-dock { margin: 8px -16px 0; }
.pay-dock .pay-secure { margin-top: 10px; }
.pay-go {
  width: 100%;
  height: 56px;
  border: 0;
  border-radius: 999px;
  background: var(--gold);
  color: var(--on-gold);
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  transition: background 160ms var(--ease);
}
@media (hover: hover) { .pay-go:not(:disabled):hover { background: #f0d385; } }
.pay-go:disabled { background: #22342a; color: #9fb09c; box-shadow: none; cursor: not-allowed; }
.pay-thanks {
  margin: 18px 0 0;
  padding: 24px;
  border: 1px solid var(--good-line);
  border-radius: 24px;
  background: var(--good-bg);
  text-align: center;
}
.pay-thanks strong { display: block; font-family: var(--serif); font-size: 30px; }
.pay-thanks span { display: block; margin-top: 6px; color: var(--muted); }
@media (max-width: 480px) {
  body { background: var(--bg); }
  .pay { box-shadow: none; }
}

/* Accessibilité et petits écrans. */
body { overflow-x: clip; }
.pay { overflow-wrap: anywhere; }
button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.pay-choice:disabled, .pay-own button:disabled { opacity: 0.6; cursor: progress; }
.pay-own {
  margin: 0 16px 12px;
  padding: 14px;
  border: 1px solid var(--warn-line);
  border-radius: 18px;
  background: var(--warn-bg);
  color: var(--text);
}
.pay-own p { margin: 0 0 10px; font-weight: 600; color: var(--warn-text); text-align: center; }
.pay-own-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.pay-own-actions button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font-weight: 600;
}
.pay-own-actions button:first-child { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.pay-back, .stepper button, .pay-switch button { min-height: 44px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}
