/* Billetterie — feuille de style commune (public, admin, scanner) */
:root {
  --accent: #00A99A;
  --ink: #1d1d1b;
  --ink-2: #55554f;
  --muted: #8a8a83;
  --line: #e6e4dd;
  --bg: #f7f5ef;
  --card: #ffffff;
  --ok: #1f9d55;
  --warn: #c98a00;
  --bad: #d64545;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 24px rgba(0,0,0,.05);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--accent); }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stack > * + * { margin-top: 12px; }

/* En-tête / pied public */
.site-head { background: var(--card); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; height: 60px; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.brand::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: 1px; }
main.wrap { padding-top: 28px; padding-bottom: 48px; min-height: 60vh; }
.site-foot { border-top: 1px solid var(--line); padding: 20px 0; font-size: .875rem; color: var(--ink-2); }

/* Cartes */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }

/* Liste d'événements */
.events { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.event-card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
.event-card:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,.08); }
.event-card .img { aspect-ratio: 16/9; background: linear-gradient(135deg, var(--accent), #1d1d1b); background-size: cover; background-position: center; }
.event-card .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.event-card .date { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.event-card h2 { font-size: 1.2rem; margin: 0; }
.event-card .meta { color: var(--ink-2); font-size: .9rem; }
.event-card .foot { margin-top: auto; padding-top: 10px; display: flex; justify-content: space-between; align-items: center; font-size: .9rem; }

/* Page événement */
.hero { border-radius: var(--radius); overflow: hidden; aspect-ratio: 21/9; background: linear-gradient(135deg, var(--accent), #1d1d1b); background-size: cover; background-position: center; margin-bottom: 22px; }
.event-layout { display: grid; gap: 24px; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); align-items: start; }
@media (max-width: 820px) { .event-layout { grid-template-columns: 1fr; } }
.facts { list-style: none; padding: 0; margin: 14px 0 18px; display: grid; gap: 6px; }
.facts li { display: flex; gap: 10px; color: var(--ink-2); }
.facts b { color: var(--ink); font-weight: 600; }
.description { white-space: pre-line; color: var(--ink-2); }
.buy { position: sticky; top: 16px; }
.cat { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cat:last-of-type { border-bottom: 0; }
.cat .info { flex: 1; min-width: 0; }
.cat .name { font-weight: 600; }
.cat .desc { font-size: .85rem; color: var(--muted); }
.cat .price { font-weight: 700; white-space: nowrap; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: #eee; color: var(--ink-2); vertical-align: 2px; }
.badge.low { background: #fff3d6; color: #8a5d00; }
.badge.out { background: #fde4e4; color: #a12d2d; }
.badge.ok { background: #dcf3e5; color: #17663a; }
.badge.accent { background: color-mix(in srgb, var(--accent) 16%, white); color: color-mix(in srgb, var(--accent) 70%, black); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qty button { width: 34px; height: 34px; border: 0; background: #f4f3ee; font-size: 1.1rem; cursor: pointer; color: var(--ink); }
.qty button:disabled { opacity: .35; cursor: default; }
.qty input { width: 38px; height: 34px; border: 0; text-align: center; font-weight: 700; font-size: 1rem; background: #fff; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.summary { margin: 14px 0; padding: 12px 0; border-top: 1px dashed var(--line); display: grid; gap: 4px; }
.summary .line { display: flex; justify-content: space-between; }
.summary .total { font-size: 1.2rem; font-weight: 800; }

/* Formulaires */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.field { margin-bottom: 14px; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 3px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=tel], input[type=datetime-local], input[type=date], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #d6d4cc; border-radius: 10px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); border-color: var(--accent); }
input[type=color] { width: 60px; height: 40px; padding: 2px; border: 1px solid #d6d4cc; border-radius: 8px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; border: 1px solid transparent; background: var(--accent); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; padding: 14px; font-size: 1.05rem; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger { background: var(--bad); }
.btn.small { padding: 6px 12px; font-size: .85rem; }
.promo-row { display: flex; gap: 8px; }
.promo-row input { text-transform: uppercase; }
.err { color: var(--bad); font-size: .9rem; }
.flash { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; }
.flash-ok { background: #dcf3e5; color: #17663a; }
.flash-err { background: #fde4e4; color: #a12d2d; }
.flash-warn { background: #fff3d6; color: #7a5200; }

/* Billets en ligne */
.ticket { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; background: var(--card); border: 1px solid var(--line); border-left: 6px solid var(--accent); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; break-inside: avoid; }
.ticket .qr svg, .ticket .qr img { width: 170px; height: 170px; }
.ticket.used { opacity: .55; border-left-color: var(--muted); }
@media (max-width: 520px) { .ticket { grid-template-columns: 1fr; text-align: center; } .ticket .qr { justify-self: center; } }
@media print {
  .site-head, .site-foot, .no-print { display: none !important; }
  body { background: #fff; }
  .ticket { box-shadow: none; }
}

/* Tableaux */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:hover td { background: #fbfaf7; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Admin */
body.admin { background: #f3f2ed; }
.admin-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: #1d1d1b; color: #ddd; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { color: #fff; display: block; padding: 6px 10px 18px; }
.sidebar nav a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 9px; color: #cfcfca; text-decoration: none; font-size: .95rem; }
.sidebar nav a:hover { background: #2c2c29; color: #fff; }
.sidebar nav a.on { background: var(--accent); color: #fff; }
.sidebar .sep { height: 1px; background: #333; margin: 12px 8px; }
.sidebar .who { font-size: .8rem; color: #888; padding: 10px 12px; }
.admin-main { padding: 26px 28px 60px; min-width: 0; }
.admin-main > h1 { font-size: 1.6rem; }
.page-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 1.6rem; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 20px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.kpi .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.kpi .value { font-size: 1.7rem; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: .85rem; color: var(--ink-2); }
.bar { height: 8px; background: #ecebe5; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 600; font-size: .92rem; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.status { font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.st-paid, .st-free, .st-published, .st-valid { background: #dcf3e5; color: #17663a; }
.st-pending, .st-draft { background: #fff3d6; color: #7a5200; }
.st-cancelled, .st-refunded { background: #fde4e4; color: #a12d2d; }
.chart { width: 100%; height: 160px; }
.mobile-bar { display: none; }
@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 30% 0 0; z-index: 20; transform: translateX(-100%); transition: transform .2s; height: 100%; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .mobile-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #1d1d1b; color: #fff; position: sticky; top: 0; z-index: 10; }
  .mobile-bar button { background: none; border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; }
  .admin-main { padding: 18px 16px 50px; }
}
.login-box { max-width: 380px; margin: 12vh auto; }
.inline-form { display: inline; }
details.more summary { cursor: pointer; color: var(--accent); font-weight: 600; }
