:root {
  --green-900: #063b26;
  --green-700: #0b5d3b;
  --green-500: #12804f;
  --green-100: #e3f2ea;
  --gold-600: #b8860b;
  --gold-500: #d4a017;
  --gold-200: #f6e7b4;
  --cream: #fbf8f1;
  --ink: #1d2420;
  --muted: #5e6b64;
  --line: #e2ddd0;
  --red-600: #b42318;
  --red-100: #fde8e6;
  --orange-600: #b54708;
  --orange-100: #fef0c7;
  --white: #fff;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 20, 0.06), 0 6px 20px rgba(16, 24, 20, 0.06);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.5;
}
img { max-width: 100%; }
a { color: var(--green-700); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
h2 { font-size: 1.35rem; color: var(--green-900); }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }

.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* ---------- En-tête & navigation ---------- */
.topbar { background: var(--green-900); color: var(--white); }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--white); text-decoration: none; font-weight: 700; }
.brand-badge {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--gold-500); color: var(--green-900); font-weight: 800; font-size: 0.95rem;
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { color: #cfe6da; text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 0.925rem; }
.nav a:hover, .nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.1); color: var(--white); }

.hero {
  background: radial-gradient(circle at 85% 20%, rgba(212, 160, 23, 0.35), transparent 45%),
    linear-gradient(135deg, var(--green-900), var(--green-700));
  color: var(--white);
  padding: 40px 0 56px;
}
.hero .eyebrow { color: var(--gold-200); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.8rem; font-weight: 700; }
.hero h1 { font-size: clamp(1.7rem, 5vw, 2.6rem); margin: 6px 0 8px; }
.hero .subtitle { font-size: 1.1rem; color: #d7ebe0; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.pill {
  display: inline-flex; flex-direction: column; background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 12px; padding: 10px 14px; min-width: 140px;
}
.pill strong { font-size: 1.2rem; color: var(--gold-200); }
.pill span { font-size: 0.8rem; color: #cfe6da; }

.progress { margin-top: 22px; max-width: 520px; }
.progress-bar { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.18); overflow: hidden; }
.progress-bar > div { height: 100%; background: var(--gold-500); border-radius: 999px; width: 0; transition: width 0.6s ease; }
.progress-label { font-size: 0.85rem; color: #d7ebe0; margin-top: 6px; }

main { padding: 24px 0 48px; }
.lift { margin-top: -32px; }

/* ---------- Cartes & mise en page ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.grid-2 { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 3fr 2fr; align-items: start; } }
.sticky { position: sticky; top: 16px; }

.prize-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.prize-list li { display: flex; gap: 12px; align-items: flex-start; }
.prize-rank {
  flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold-200); color: var(--green-900); font-weight: 800; font-size: 0.9rem;
}
.prize-list li:first-child .prize-rank { background: var(--gold-500); }

/* ---------- Formulaires ---------- */
label { display: block; font-weight: 600; font-size: 0.925rem; margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.825rem; }
input[type="text"], input[type="tel"], input[type="email"], input[type="number"], input[type="password"],
input[type="datetime-local"], select, textarea {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #cfc8b8; border-radius: 10px; background: var(--white); color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid rgba(18, 128, 79, 0.3); outline-offset: 1px; border-color: var(--green-500); }
.checkbox { display: flex; gap: 8px; align-items: center; font-weight: 600; }
.checkbox input { width: 18px; height: 18px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 16px; cursor: pointer; text-decoration: none;
  background: var(--green-700); color: var(--white); transition: background 0.15s ease, transform 0.05s ease;
}
.btn:hover { background: var(--green-500); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-gold { background: var(--gold-500); color: var(--green-900); }
.btn-gold:hover { background: #e2b33a; }
.btn-ghost { background: transparent; color: var(--green-700); border-color: #cfc8b8; }
.btn-ghost:hover { background: var(--green-100); }
.btn-danger { background: var(--white); color: var(--red-600); border-color: #f1b8b2; }
.btn-danger:hover { background: var(--red-100); }
.btn-sm { padding: 6px 10px; font-size: 0.85rem; border-radius: 8px; }
.btn-lg { padding: 14px 20px; font-size: 1.05rem; width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Quantité */
.qty { display: flex; align-items: center; gap: 8px; }
.qty button { width: 44px; height: 44px; font-size: 1.4rem; padding: 0; }
.qty input { width: 90px; text-align: center; font-size: 1.2rem; font-weight: 700; }

/* ---------- Sélecteur de numéros ---------- */
.picker-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.picker-tools > * { flex: 1 1 160px; }
.number-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.num {
  font: inherit; font-size: 0.78rem; font-variant-numeric: tabular-nums; padding: 8px 0; border-radius: 6px;
  border: 1px solid var(--line); background: var(--white); cursor: pointer; color: var(--ink);
}
.num:hover:not(:disabled) { border-color: var(--green-500); background: var(--green-100); }
.num.selected { background: var(--green-700); color: var(--white); border-color: var(--green-700); font-weight: 700; }
.num:disabled { background: #eeebe3; color: #b2ab9b; text-decoration: line-through; cursor: not-allowed; }
@media (max-width: 480px) { .num { font-size: 0.68rem; padding: 7px 0; } .number-grid { gap: 3px; } }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.8rem; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; border: 1px solid var(--line); }
.legend .l-sel { background: var(--green-700); }
.legend .l-taken { background: #eeebe3; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 32px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 4px 6px 4px 10px; border-radius: 999px;
  background: var(--green-100); color: var(--green-900); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 0.9rem;
}
.chip button { border: 0; background: transparent; cursor: pointer; color: var(--green-700); font-size: 1rem; line-height: 1; padding: 2px 4px; border-radius: 50%; }
.chip button:hover { background: rgba(0, 0, 0, 0.08); }

details.picker > summary { cursor: pointer; font-weight: 700; color: var(--green-700); padding: 10px 0; list-style: none; }
details.picker > summary::-webkit-details-marker { display: none; }
details.picker > summary::before { content: "▸ "; }
details.picker[open] > summary::before { content: "▾ "; }

/* Récapitulatif */
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.summary-total > :last-child { white-space: nowrap; }
.summary-total { font-size: 1.3rem; font-weight: 800; color: var(--green-900); border-bottom: 0; padding-top: 12px; }

/* ---------- Alertes & badges ---------- */
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid; }
.alert-error { background: var(--red-100); border-color: #f5c2bd; color: #7a1a12; }
.alert-success { background: var(--green-100); border-color: #b5dcc6; color: var(--green-900); }
.alert-warn { background: var(--orange-100); border-color: #fbd789; color: #7a3306; }
.alert-info { background: #eef4ff; border-color: #c7d7fe; color: #1e3a8a; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.badge-pending { background: var(--orange-100); color: var(--orange-600); }
.badge-paid { background: var(--green-100); color: var(--green-700); }
.badge-cancelled { background: var(--red-100); color: var(--red-600); }
.badge-expired { background: #eceae4; color: var(--muted); }
.badge-review { background: #eef4ff; color: #1e40af; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--green-900); color: var(--white);
  padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow); z-index: 100; max-width: calc(100% - 32px);
}

/* ---------- Tickets ---------- */
.tickets { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .tickets { grid-template-columns: 1fr 1fr; } }
.ticket {
  position: relative; display: grid; grid-template-columns: 1fr 112px; background: var(--white);
  border: 2px solid var(--green-700); border-radius: 16px; overflow: hidden; break-inside: avoid; page-break-inside: avoid;
}
.ticket-main { padding: 14px 16px; background: linear-gradient(135deg, #fffdf6, #fbf3dc); }
.ticket-title { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--green-700); }
.ticket-number { font-size: 2.4rem; font-weight: 900; color: var(--green-900); font-variant-numeric: tabular-nums; letter-spacing: 0.04em; line-height: 1.1; margin: 4px 0; }
.ticket-number small { font-size: 0.9rem; font-weight: 700; color: var(--gold-600); margin-right: 6px; letter-spacing: 0; }
.ticket-info { font-size: 0.8rem; color: var(--muted); }
.ticket-info b { color: var(--ink); }
.ticket-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; font-size: 0.9rem; color: var(--ink); }
.ticket-stub { border-left: 2px dashed var(--green-700); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px; background: var(--white); }
.ticket-stub img { width: 92px; height: 92px; }
.ticket-stub span { font-size: 0.65rem; color: var(--muted); text-align: center; margin-top: 4px; }
.ticket-watermark {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  color: rgba(180, 35, 24, 0.22); font-weight: 900; font-size: 1.4rem; transform: rotate(-12deg); text-align: center;
}

/* ---------- Tableaux (admin) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); white-space: nowrap; }
td.nums { max-width: 220px; font-variant-numeric: tabular-nums; }

.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 20px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.stat b { display: block; font-size: 1.5rem; color: var(--green-900); font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.8rem; color: var(--muted); }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs button { font: inherit; font-weight: 600; border: 0; background: transparent; padding: 10px 14px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--green-900); border-bottom-color: var(--gold-500); }

.prize-row { display: grid; grid-template-columns: 36px 1fr 1.5fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
@media (max-width: 640px) { .prize-row { grid-template-columns: 36px 1fr auto; } .prize-row .desc { grid-column: 2 / 4; } }

.winner { display: flex; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.winner:last-child { border-bottom: 0; }
.winner-number { font-size: 1.6rem; font-weight: 900; color: var(--green-900); font-variant-numeric: tabular-nums; min-width: 90px; }
.winner-body { flex: 1 1 200px; }

.verify-result { text-align: center; padding: 24px 12px; }
.verify-result .big { font-size: 3rem; line-height: 1; }

footer.site { padding: 24px 0 40px; color: var(--muted); font-size: 0.85rem; text-align: center; }

/* ---------- Impression : uniquement les tickets ---------- */
@media print {
  body { background: var(--white); }
  .no-print, .topbar, footer.site, .hero { display: none !important; }
  main { padding: 0; }
  .card { border: 0; box-shadow: none; padding: 0; }
  .tickets { grid-template-columns: 1fr 1fr; gap: 10px; }
  .ticket { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
