:root {
  --ground: #F6F5F3;
  --surface: #FFFFFF;
  --ink: #1C1A19;
  --muted: #5F5A55;
  --line: #E6E2DC;
  --line-strong: #DCD8D2;
  --wine: #8A1C3B;
  --wine-dark: #6A1229;
  --wine-soft: #FBF3F5;
  --ok-bg: #E3F1E8; --ok-fg: #1E5E3D;
  --warn-bg: #FBEFD5; --warn-fg: #6E4600;
  --info-bg: #E4ECF7; --info-fg: #1F4A80;
  --off-bg: #EEECE9; --off-fg: #5F5A55;
  --err-bg: #FCE8E6; --err-fg: #8C1D18;
  --radius: 12px;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--ink);
  background: var(--ground);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); line-height: 1.45; }
h1, h2, h3 { font-family: "Space Grotesk", Inter, system-ui, sans-serif; letter-spacing: -0.01em; }
a { color: var(--wine); }
a:hover { color: var(--wine-dark); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid #3D6B8F; outline-offset: 2px; }

/* ---------- Boutons & champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #F1EEEA; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--wine); border-color: var(--wine); color: #FFF; }
.btn-primary:hover { background: var(--wine-dark); color: #FFF; }
.btn-danger { color: var(--wine); border-color: #E8C7CF; }
.btn-ok { background: var(--ok-fg); border-color: var(--ok-fg); color: #FFF; }
.btn-ok:hover { background: #164a30; }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.field .hint { font-weight: 400; font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea {
  min-height: 46px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  font: inherit; font-size: 15px; font-weight: 400; background: var(--surface); color: var(--ink); width: 100%;
}
.field textarea { min-height: 80px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; min-height: 32px; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--wine); }

.stepper { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.stepper button { width: 52px; height: 52px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); font: inherit; font-size: 24px; color: var(--ink); cursor: pointer; }
.stepper button.plus { background: var(--wine); border-color: var(--wine); color: #FFF; }
.stepper output { font-family: "Space Grotesk", Inter, sans-serif; font-size: 30px; font-weight: 700; text-align: center; flex: 1; }
.stepper output small { font-size: 15px; font-weight: 500; color: var(--muted); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.confirmed { background: var(--ok-bg); color: var(--ok-fg); }
.badge.waitlist { background: var(--info-bg); color: var(--info-fg); }
.badge.cancelled { background: var(--off-bg); color: var(--off-fg); }
.badge.warn { background: var(--warn-bg); color: var(--warn-fg); }

.notice { padding: 12px 14px; border-radius: 10px; font-size: 14px; line-height: 1.5; }
.notice.warn { background: var(--warn-bg); color: #5C3B00; }
.notice.info { background: var(--info-bg); color: #173A66; }
.notice.err { background: var(--err-bg); color: var(--err-fg); }
.notice.ok { background: var(--ok-bg); color: var(--ok-fg); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }

/* ---------- Page client ---------- */
.public .hero { background: var(--ink); color: var(--ground); padding: 36px 0 30px; }
.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 20px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #D9D3CC; }
.logo { width: 38px; height: 38px; border-radius: 10px; background: var(--wine); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.public .hero h1 { margin: 14px 0 8px; font-size: 30px; line-height: 1.12; }
.public .hero p { margin: 0; color: #D9D3CC; font-size: 15px; }
.public .hero .when { color: #FFF; font-weight: 600; font-size: 17px; margin-bottom: 6px; }
.public main { padding: 24px 20px 40px; display: flex; flex-direction: column; gap: 22px; }
.public form { display: flex; flex-direction: column; gap: 22px; }
.public h2 { font-size: 19px; margin: 0 0 12px; }
.public fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.public legend { font-family: "Space Grotesk", Inter, sans-serif; font-size: 19px; font-weight: 600; padding: 0; margin-bottom: 12px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.avail { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; }
.avail strong { font-size: 15px; }
.legal { text-align: center; font-size: 12px; color: var(--muted); padding: 8px 20px 32px; line-height: 1.6; }
.done { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.done h2 { margin: 0; font-size: 24px; }
.ref { font-family: "Space Grotesk", Inter, sans-serif; font-size: 28px; font-weight: 700; color: var(--wine); }
.linkbox { display: flex; gap: 8px; }
.linkbox input { flex: 1; min-width: 0; min-height: 44px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 10px; font: inherit; font-size: 13px; background: var(--ground); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Espace équipe ---------- */
.admin-top { background: var(--ink); color: var(--ground); }
.admin-top .inner { max-width: 1320px; margin: 0 auto; padding: 14px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.admin-top .brand strong { color: #FFF; font-family: "Space Grotesk", Inter, sans-serif; font-size: 17px; display: block; }
.admin-top .brand span { font-size: 12px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
.tabs button { min-height: 42px; padding: 0 14px; border-radius: 10px; border: 0; background: transparent; color: #D9D3CC; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.tabs button[aria-selected="true"] { background: #34302D; color: #FFF; }
.me { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #D9D3CC; }
.me button { min-height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid #4A4542; background: transparent; color: #D9D3CC; font: inherit; font-size: 12px; cursor: pointer; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--wine); color: #FFF; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex: none; }

.admin-main { max-width: 1320px; margin: 0 auto; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 14px; }
.page-head h1 { margin: 0; font-size: 30px; }
.page-head .sub { font-size: 14px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 860px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.kpi .lbl { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi .val { font-family: "Space Grotesk", Inter, sans-serif; font-size: 30px; font-weight: 700; }
.kpi .val small { font-size: 16px; color: var(--muted); font-weight: 500; }
.kpi .val.wine { color: var(--wine); }
.kpi .foot { font-size: 12px; color: var(--muted); }
.bar { height: 8px; border-radius: 99px; background: #EEEAE5; overflow: hidden; margin-top: 4px; }
.bar > span { display: block; height: 100%; background: var(--wine); border-radius: 99px; }

.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.cols > .main-col { flex: 999 1 640px; min-width: 0; }
.cols > .side-col { flex: 1 1 300px; min-width: 0; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid #EEEAE5; }
.search { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); flex: 1 1 220px; }
.search input { border: 0; outline: none; font: inherit; font-size: 14px; background: transparent; flex: 1; min-width: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--ink); }
.pill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #FFF; }

.table-wrap { overflow-x: auto; }
table.resa { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 820px; }
table.resa th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 10px; }
table.resa th:first-child, table.resa td:first-child { padding-left: 18px; }
table.resa td { padding: 10px 10px; border-top: 1px solid #EEEAE5; vertical-align: middle; }
table.resa tr.is-cancelled td { color: var(--muted); }
table.resa tr.is-cancelled .name { text-decoration: line-through; }
.namebtn { border: 0; background: transparent; padding: 4px 0; font: inherit; text-align: left; cursor: pointer; color: var(--ink); display: flex; flex-direction: column; min-height: 40px; justify-content: center; }
.namebtn .name { font-weight: 600; }
.namebtn small { color: var(--muted); font-size: 12px; }
.namebtn:hover .name { color: var(--wine); text-decoration: underline; }
.ppl { font-weight: 700; font-size: 16px; }
.muted { color: var(--muted); }
.note-ico { color: var(--wine); font-size: 12px; font-weight: 600; }
.empty { padding: 36px 18px; text-align: center; color: var(--muted); }

.log { padding: 18px; display: flex; flex-direction: column; gap: 12px; max-height: 720px; overflow-y: auto; }
.log h2 { margin: 0; font-size: 17px; }
.log-item { display: flex; gap: 10px; font-size: 13px; }
.log-item .avatar { width: 28px; height: 28px; font-size: 12px; background: #5F5A55; }
.log-item .avatar.client { background: #3D6B8F; }
.log-item time { display: block; font-size: 12px; color: var(--muted); }

/* Pointage */
.checkin { max-width: 720px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.checkin-head { padding: 18px 20px; background: var(--ink); color: var(--ground); border-radius: 16px; display: flex; flex-direction: column; gap: 8px; }
.checkin-head .big { font-family: "Space Grotesk", Inter, sans-serif; font-size: 42px; font-weight: 700; }
.checkin-head .big small { font-size: 16px; color: #D9D3CC; font-weight: 500; }
.checkin-head .bar { background: #3A3532; }
.checkin-head .bar > span { background: #E9A3B5; }
.guest { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 16px; }
.guest.in { border-color: #BFDCCB; background: #F6FBF8; }
.guest .who { display: flex; flex-direction: column; min-width: 0; }
.guest .who strong { font-size: 16px; }
.guest .who span { font-size: 13px; color: var(--muted); }
.guest .btn { min-width: 112px; }

/* Réglages */
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; align-items: start; }
.settings .card { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.settings h2 { margin: 0; font-size: 18px; }

/* Connexion */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login .card { width: 100%; max-width: 400px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.login h1 { margin: 0; font-size: 26px; }

/* Fenêtre de saisie */
dialog { border: 0; padding: 0; border-radius: 18px; width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 24px); box-shadow: 0 20px 60px rgba(0,0,0,.25); color: var(--ink); }
dialog::backdrop { background: rgba(28,26,25,.5); }
dialog form { display: flex; flex-direction: column; }
dialog header, dialog footer { padding: 18px 22px; display: flex; align-items: center; gap: 10px; }
dialog header { border-bottom: 1px solid #EEEAE5; justify-content: space-between; }
dialog header h2 { margin: 0; font-size: 22px; }
dialog footer { border-top: 1px solid #EEEAE5; justify-content: flex-end; flex-wrap: wrap; }
dialog footer .spacer { flex: 1; }
dialog .body { padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; max-height: calc(100vh - 200px); }
.meta { font-size: 12px; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #FFF; padding: 12px 18px; border-radius: 12px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 100; max-width: calc(100vw - 32px); }
.toast.err { background: var(--err-fg); }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #D9D3CC; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #5CC08A; }
.live.off::before { background: #D08A00; }
