:root {
  --sand: #FCEBDD;
  --navy: #1D2A7A;
  --blue: #2B3FB8;
  --red: #C8102E;
  --saffron: #FFB627;
  --green: #00704A;
  --green-bg: #E6F5EE;
  --muted: #4A4F6A;
  --pink: #F49CB0;
  --cream: #FFF0C7;
  --grey-bg: #EEF0F6;
  --line: #D9DCE6;
  --title: 'Bricolage Grotesque', system-ui, sans-serif;
  --text: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }
body {
  background: var(--sand);
  color: var(--navy);
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}

h1, h2, h3, p { margin: 0; }
a { color: var(--navy); }
a:hover { color: #000; }
button { cursor: pointer; font: inherit; color: inherit; }
button:disabled { cursor: progress; opacity: .7; }

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.kicker {
  font-size: 13px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--red);
}
.title { font-family: var(--title); font-weight: 800; }
.muted { color: var(--muted); }

.card {
  background: #fff;
  border: 2px solid var(--navy);
  border-radius: 24px;
  box-shadow: 0 4px 0 var(--navy);
}

.badge-green {
  align-self: flex-start;
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--green-bg);
  color: var(--green);
  font-size: 14px;
  font-weight: 600;
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 2px solid var(--navy);
  background: #fff; color: var(--navy);
  font-family: var(--text); font-weight: 600; font-size: 15px;
  text-decoration: none;
}
.btn-main {
  border-width: 3px; background: var(--saffron);
  font-family: var(--title); font-weight: 800; font-size: 20px;
  min-height: 56px; box-shadow: 0 4px 0 var(--navy);
}
.btn-dark { background: var(--navy); color: #fff; }
.btn-saffron { background: var(--saffron); font-weight: 700; }
.btn-link {
  background: none; border: none; padding: 8px 0; min-height: 44px;
  font-weight: 600; font-size: 14px; text-decoration: underline; color: var(--navy);
}
.btn-main:active, .btn-yes:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--navy); }

/* =================================================================
   Page invité
   ================================================================= */
.guest {
  max-width: 480px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 16px 32px;
  display: flex; flex-direction: column; gap: 20px;
}
.guest header { display: flex; flex-direction: column; gap: 10px; padding: 8px 4px 4px; }
.stars { display: flex; gap: 8px; align-items: center; }
.guest h1 { font-family: var(--title); font-weight: 800; font-size: 46px; line-height: 1.02; overflow-wrap: anywhere; }
.guest .intro { font-size: 16px; color: var(--muted); }

.event { padding: 22px 20px; display: flex; flex-direction: column; gap: 16px; }
.event-head { display: flex; align-items: center; gap: 12px; }
.event-icon {
  width: 48px; height: 48px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.event-icon.mairie { background: var(--blue); }
.event-icon.diner { background: var(--pink); }
.event-head .kicker { font-size: 12px; letter-spacing: .1em; }
.event h2 { font-family: var(--title); font-weight: 800; font-size: 24px; line-height: 1.15; }
.event .where { font-size: 16px; }
.event .where small { font-size: 14px; color: var(--muted); }

.choices { display: flex; flex-direction: column; align-items: center; gap: 12px; padding-top: 4px; }
.btn-yes {
  width: 100%; min-height: 84px;
  border-radius: 999px; border: 3px solid var(--navy);
  background: var(--saffron); color: var(--navy);
  font-family: var(--title); font-weight: 800; font-size: 28px; line-height: 1.1;
  padding: 8px 16px;
  box-shadow: 0 6px 0 var(--navy);
}
.btn-no {
  min-height: 48px; padding: 0 26px;
  border-radius: 999px; border: 2px solid var(--navy);
  background: #fff; color: var(--navy);
  font-weight: 600; font-size: 16px;
  transition: transform .3s ease;
}
.btn-no[data-tries="1"] { transform: translate(92px, -6px) rotate(9deg); }
.btn-no[data-tries="2"] { transform: translate(-92px, 8px) rotate(-8deg); }
.hint { font-size: 14px; font-weight: 600; color: var(--red); text-align: center; min-height: 0; }

.result {
  border-radius: 18px; padding: 16px;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
}
.result.yes { background: var(--cream); gap: 10px; }
.result.no { background: var(--grey-bg); }
.result h3 { font-family: var(--title); font-weight: 800; font-size: 22px; }
.result h3:focus { outline: none; }
.result p { font-size: 15px; }

.save-error { font-size: 14px; font-weight: 600; color: var(--red); }

.guest footer { margin-top: auto; padding: 4px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }

.message { padding: 28px 22px; display: flex; flex-direction: column; gap: 10px; }
.message h2 { font-family: var(--title); font-weight: 800; font-size: 26px; }

@media (prefers-reduced-motion: reduce) {
  .btn-no { transition: none; }
}

/* =================================================================
   Espace mariés
   ================================================================= */
.login-wrap {
  min-height: 100vh; padding: 48px 16px;
  display: flex; align-items: center; justify-content: center;
}
.login {
  width: 100%; max-width: 420px;
  border-radius: 28px; box-shadow: 0 6px 0 var(--navy);
  padding: 36px 28px;
  display: flex; flex-direction: column; gap: 20px;
}
.login h1 { font-family: var(--title); font-weight: 800; font-size: 36px; line-height: 1.05; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field-label { font-size: 14px; font-weight: 600; }
.field input {
  min-height: 48px; padding: 0 14px;
  border: 2px solid var(--navy); border-radius: 14px;
  font-family: var(--text); font-size: 16px; color: var(--navy); background: #fff;
  width: 100%;
}
.error { font-size: 14px; font-weight: 600; color: var(--red); }

.admin { max-width: 1240px; margin: 0 auto; padding: 32px 16px 48px; display: flex; flex-direction: column; gap: 24px; }
.admin-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.admin-head h1 { font-family: var(--title); font-weight: 800; font-size: 40px; line-height: 1.05; }

.toast {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px;
  border-radius: 16px; padding: 12px 16px; font-size: 15px; font-weight: 600;
}
.toast.ok { background: var(--green-bg); border: 2px solid var(--green); color: var(--green); }
.toast.err { background: #FFE6E9; border: 2px solid var(--red); color: var(--red); }
.toast button { min-height: 44px; padding: 0 12px; border: none; background: transparent; font-weight: 600; font-size: 14px; text-decoration: underline; color: inherit; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat { border-radius: 20px; padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.stat.main { background: var(--saffron); }
.stat .label { font-size: 14px; font-weight: 600; }
.stat .num { font-family: var(--title); font-weight: 800; font-size: 48px; line-height: 1; }
.stat .sub { font-size: 13px; color: var(--muted); }
.stat.main .sub { color: var(--navy); }
.num.red { color: var(--red); }
.num.blue { color: var(--blue); }

.pills { display: flex; flex-wrap: wrap; gap: 12px; }
.pills p { padding: 10px 16px; background: #fff; border-radius: 999px; font-size: 14px; }

.box { background: #fff; border: 2px solid var(--navy); border-radius: 24px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.box h2 { font-family: var(--title); font-weight: 800; font-size: 24px; line-height: 1.15; }

.tpl { padding: 20px 24px; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.tpl h2 { font-size: 22px; }
.tpl-text { display: flex; flex-direction: column; gap: 6px; flex: 1 1 320px; }
.tpl-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tpl-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.pill {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
}
.pill.oui { background: var(--green-bg); color: var(--green); }
.pill.non { background: var(--grey-bg); color: var(--navy); }
.pill.attente { background: #fff; color: var(--muted); border: 1px dashed var(--muted); }
.pill.none { background: transparent; color: var(--muted); padding-left: 0; }
.pill.mariee { background: var(--sand); color: var(--red); }
.pill.marie { background: #E4E7FA; color: var(--blue); }
.pill.todo { background: var(--cream); color: #7A4B00; font-weight: 700; }
.pill.done { background: var(--green-bg); color: var(--green); font-weight: 700; }

.columns { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.add { flex: 1 1 320px; }
.list { flex: 999 1 600px; min-width: 0; }

.toggle { display: flex; gap: 8px; }
.toggle button {
  flex: 1; min-height: 48px; border-radius: 14px; border: 2px solid var(--navy);
  background: #fff; color: var(--navy); font-weight: 600; font-size: 15px;
}
.toggle button[aria-pressed="true"] { background: var(--navy); color: #fff; }

.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; }
.check input { width: 22px; height: 22px; accent-color: var(--navy); flex-shrink: 0; }

.notice {
  background: var(--cream); border: 2px solid var(--navy); border-radius: 16px;
  padding: 16px; display: flex; flex-direction: column; gap: 12px; font-size: 15px;
}
.notice .row { display: flex; flex-wrap: wrap; gap: 8px; }

.list-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.all-sent { font-size: 14px; font-weight: 600; color: var(--green); }

.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 780px; border-collapse: collapse; font-size: 15px; }
th {
  text-align: left; padding: 0 6px 10px; border-bottom: 2px solid var(--navy);
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
}
td { padding: 12px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td .name { font-weight: 600; display: block; }
td .email { font-size: 13px; color: var(--muted); display: block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cell-row.nowrap { flex-wrap: nowrap; }
.cell-row .btn { flex-shrink: 0; }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: 13px; }
.link-text { font-size: 13px; color: var(--muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }
.empty { padding: 20px 6px; color: var(--muted); }

dialog {
  width: min(760px, calc(100vw - 32px)); height: min(90vh, 1100px);
  padding: 0; border: 2px solid var(--navy); border-radius: 20px;
  box-shadow: 0 6px 0 var(--navy);
}
dialog::backdrop { background: rgba(29, 42, 122, .45); }
.dialog-inner { display: flex; flex-direction: column; height: 100%; }
.dialog-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 2px solid var(--navy); background: var(--sand); }
.dialog-bar h2 { font-family: var(--title); font-weight: 800; font-size: 20px; }
dialog iframe { flex: 1; width: 100%; border: 0; background: #EEF0F6; }

@media (max-width: 480px) {
  .admin-head h1 { font-size: 32px; }
  .box { padding: 20px 16px; }
}
