/* ==========================================================================
   Prise de rendez-vous – feuille de style unique (aucune police ni ressource externe : RGPD)
   ========================================================================== */

:root {
  --violet: #6d4aff;
  --violet-dark: #4b2fd6;
  --violet-deep: #2a1b66;
  --violet-soft: #efeaff;
  --violet-line: #d9d2fb;
  --pink: #ff5fa2;
  --teal: #12b3a6;
  --teal-dark: #0b7f76;
  --teal-soft: #dff6f3;
  --amber: #f59e0b;
  --amber-soft: #fff4de;
  --red: #e5484d;
  --red-dark: #c62a2f;
  --red-soft: #ffe9ea;
  --green: #1a9d5b;
  --green-soft: #e3f7ec;

  --ink: #1f1b3a;
  --muted: #6b6785;
  --line: #e6e2f4;
  --bg: #f6f5fb;
  --card: #ffffff;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px -12px rgba(52, 33, 140, 0.25), 0 2px 6px rgba(52, 33, 140, 0.06);
  --shadow-sm: 0 2px 8px rgba(52, 33, 140, 0.1);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.admin { background: #f1eefb; }
main { flex: 1; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.02rem; }
p { margin: 0 0 1em; }
a { color: var(--violet-dark); }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.88em; background: var(--violet-soft); color: var(--violet-deep); padding: 2px 6px; border-radius: 6px; word-break: break-all; }

[hidden] { display: none !important; }

.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hp { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.center { text-align: center; }

:focus-visible { outline: 3px solid rgba(109, 74, 255, 0.55); outline-offset: 2px; }

.skip-link { position: absolute; left: 12px; top: -60px; z-index: 300; background: var(--violet); color: #fff; padding: 10px 14px; border-radius: 10px; text-decoration: none; }
.skip-link:focus { top: 12px; }

.container { width: min(1120px, 100% - 32px); margin-inline: auto; }
.container.narrow { width: min(640px, 100% - 32px); }
.center-page { display: grid; align-items: center; padding-block: 48px; }

/* ---------- Icônes ---------- */
.icon {
  width: 1.15em; height: 1.15em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.2em;
}
.avatar { width: 100%; height: 100%; display: block; stroke: none; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; min-height: 42px;
  font: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2; text-decoration: none; text-align: center;
  color: var(--ink); background: #fff;
  border: 1.5px solid transparent; border-radius: var(--radius-sm);
  cursor: pointer; transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled, .btn.is-disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; transform: none; }

.btn-primary { color: #fff; background: linear-gradient(135deg, var(--violet) 0%, #8a63ff 55%, #a45bff 100%); box-shadow: 0 8px 18px -8px rgba(109, 74, 255, 0.7); }
.btn-primary:hover { box-shadow: 0 12px 22px -8px rgba(109, 74, 255, 0.75); }
.btn-soft { color: var(--violet-dark); background: var(--violet-soft); }
.btn-soft:hover { background: #e4dcff; }
.btn-teal { color: #fff; background: linear-gradient(135deg, var(--teal) 0%, #1bc9b4 100%); box-shadow: 0 8px 18px -10px rgba(18, 179, 166, 0.8); }
.btn-ghost { color: var(--ink); background: transparent; border-color: var(--line); }
.btn-ghost:hover { background: #faf9fe; border-color: var(--violet-line); }
.btn-danger { color: #fff; background: var(--red); box-shadow: 0 8px 18px -10px rgba(229, 72, 77, 0.8); }
.btn-danger:hover { background: var(--red-dark); }
.btn-danger-ghost { color: var(--red-dark); background: transparent; border-color: #f6c4c6; }
.btn-danger-ghost:hover { background: var(--red-soft); }
.btn-ghost-light { color: #fff; background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.35); }
.btn-ghost-light:hover { background: rgba(255, 255, 255, 0.26); }
.btn-icon { padding: 0; width: 42px; color: var(--violet-dark); background: #fff; border-color: var(--line); }
.btn-icon:hover { background: var(--violet-soft); }
.btn-lg { min-height: 50px; padding: 12px 22px; font-size: 1.02rem; }
.btn-block { width: 100%; }

.link-btn { font: inherit; font-weight: 600; color: var(--violet-dark); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
.inline-form { display: inline; margin: 0; }

/* ---------- Barre supérieure ---------- */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; padding-block: 10px; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: #fff; background: linear-gradient(135deg, var(--violet), var(--pink)); box-shadow: var(--shadow-sm); font-size: 1.15rem; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text small { color: var(--muted); font-size: 0.78rem; }
.bar-link { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; padding: 8px 12px; border-radius: 999px; }
.bar-link:hover { background: var(--violet-soft); color: var(--violet-dark); }

/* Espace administrateur : barre sombre + avatar féminin, pour bien le distinguer du site public */
.admin-bar { background: linear-gradient(120deg, var(--violet-deep) 0%, #4a2fbd 60%, #6a3fd8 100%); border-bottom: 0; color: #fff; }
.admin-bar .brand-text small { color: rgba(255, 255, 255, 0.72); }
.admin-bar .bar-link { color: rgba(255, 255, 255, 0.85); }
.admin-bar .bar-link:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.avatar-wrap { display: inline-block; flex: none; width: 46px; height: 46px; border-radius: 50%; overflow: hidden; background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85), 0 6px 14px -4px rgba(0, 0, 0, 0.45); }
.avatar-xl { width: 96px; height: 96px; box-shadow: 0 0 0 5px #fff, 0 12px 24px -8px rgba(109, 74, 255, 0.55); margin-bottom: 14px; }

.admin-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.btn-bar { min-height: 40px; padding: 8px 14px; font-size: 0.9rem; color: #fff; background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.22); }
.btn-bar:hover { background: rgba(255, 255, 255, 0.24); }
.btn-bar-google { background: #fff; color: var(--violet-deep); border-color: #fff; }
.btn-bar-google:hover { background: #f3efff; }
.btn-bar-ok { background: rgba(26, 157, 91, 0.3); border-color: rgba(120, 235, 175, 0.6); }

/* ---------- Pied de page ---------- */
.footer { padding: 28px 0 36px; text-align: center; color: var(--muted); font-size: 0.88rem; }
.footer .container { display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: center; }
.footer a { color: var(--muted); }
.footer .dot { opacity: 0.5; }

/* ---------- Cartes, alertes, messages ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid; margin: 0 0 16px; font-size: 0.94rem; }
.alert .icon { margin-top: 0.2em; }
.alert-error { color: #8c1d22; background: var(--red-soft); border-color: #f6c4c6; }
.alert-warn { color: #7a4b00; background: var(--amber-soft); border-color: #f6dca3; }
.alert a { color: inherit; font-weight: 700; }
.pre-line { white-space: pre-line; overflow-wrap: anywhere; }

.toasts { position: fixed; top: 80px; right: 16px; z-index: 250; display: grid; gap: 10px; width: min(420px, calc(100% - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--violet);
  border-radius: 14px; box-shadow: var(--shadow); animation: toast-in 0.25s ease both;
}
.toast > .icon { margin-top: 0.2em; color: var(--violet); }
.toast > span { flex: 1; font-size: 0.95rem; }
.toast-success { border-left-color: var(--green); }
.toast-success > .icon { color: var(--green); }
.toast-error { border-left-color: var(--red); }
.toast-error > .icon { color: var(--red); }
.toast.is-leaving { opacity: 0; transform: translateX(14px); transition: opacity 0.18s ease, transform 0.18s ease; }
.toast-close { flex: none; display: grid; place-items: center; width: 28px; height: 28px; margin: -4px -6px 0 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.toast-close:hover { background: var(--violet-soft); color: var(--ink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- Page publique : en-tête ---------- */
.hero {
  color: #fff; padding: 52px 0 96px; text-align: center;
  background: radial-gradient(900px 380px at 85% -10%, rgba(255, 95, 162, 0.55), transparent 60%),
              radial-gradient(700px 380px at 0% 0%, rgba(18, 179, 166, 0.35), transparent 60%),
              linear-gradient(135deg, #4b2fd6 0%, #6d4aff 55%, #8a63ff 100%);
}
.hero h1 { color: #fff; margin-bottom: 0.35em; }
.hero .lead { max-width: 560px; margin: 0 auto 1.6em; font-size: 1.08rem; color: rgba(255, 255, 255, 0.9); }
.hero-compact { padding: 22px 0 70px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; margin-bottom: 14px; font-size: 0.85rem; font-weight: 700; letter-spacing: 0.03em; background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 999px; }
.eyebrow-dark { margin: 0 0 6px; font-size: 0.82rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.steps { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; list-style: none; margin: 0; padding: 0; font-size: 0.92rem; font-weight: 600; color: rgba(255, 255, 255, 0.72); }
.steps li { display: inline-flex; align-items: center; gap: 8px; }
.steps li > span { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.45); font-size: 0.85rem; }
.steps .is-current { color: #fff; }
.steps .is-current > span { background: #fff; border-color: #fff; color: var(--violet-dark); }
.steps .is-done { color: #fff; }
.steps .is-done > span { background: var(--teal); border-color: var(--teal); color: #fff; }

/* ---------- Page publique : créneaux ---------- */
.planner { margin-top: -62px; position: relative; padding-bottom: 8px; }
.planner-card { padding: 22px; }
.planner-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.planner-head h2 { display: flex; align-items: center; gap: 10px; margin: 0; }
.planner-head h2 .icon { color: var(--violet); }
.week-nav { display: inline-flex; align-items: center; gap: 10px; }
.week-title { min-width: 170px; text-align: center; font-weight: 700; font-size: 0.95rem; }

.days { display: grid; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); gap: 12px; }
.day { background: #fcfbff; border: 1px solid var(--line); border-radius: 16px; padding: 12px 10px 14px; }
.day.is-today { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(109, 74, 255, 0.12); }
.day.is-empty { background: transparent; border-style: dashed; }
.day-head { display: flex; flex-direction: column; align-items: center; line-height: 1.15; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px dashed var(--line); }
.day-head .dow { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--violet); }
.day-head .dom { font-size: 1.7rem; font-weight: 800; }
.day-head .mon { font-size: 0.8rem; color: var(--muted); }
.slots { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.slot {
  display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 8px;
  font-weight: 700; font-size: 0.95rem; text-decoration: none; color: var(--violet-dark);
  background: var(--violet-soft); border: 1.5px solid var(--violet-line); border-radius: 12px;
  transition: transform 0.12s ease, background-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}
.slot:hover, .slot:focus-visible { color: #fff; background: var(--violet); border-color: var(--violet); transform: translateY(-1px); box-shadow: 0 8px 16px -8px rgba(109, 74, 255, 0.8); }
.no-slot { text-align: center; color: #b3afc9; padding: 8px 0; }

.empty { text-align: center; padding: 28px 12px 18px; }
.state-icon { display: inline-grid; place-items: center; width: 72px; height: 72px; margin-bottom: 14px; font-size: 1.9rem; color: var(--violet); background: var(--violet-soft); border-radius: 50%; }
.state-ok { color: var(--green); background: var(--green-soft); }
.state-warn { color: #b26a00; background: var(--amber-soft); }

.reassure { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 26px; margin: 22px 0 8px; padding: 0; color: var(--muted); font-size: 0.9rem; }
.reassure li { display: inline-flex; align-items: center; gap: 8px; }
.reassure .icon { color: var(--teal-dark); }

/* ---------- Formulaire de réservation ---------- */
.book-layout { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 24px; align-items: start; margin-top: -48px; position: relative; padding-bottom: 24px; }
.summary-card { position: sticky; top: 88px; color: #fff; border: 0; background: linear-gradient(150deg, var(--violet-deep) 0%, #4b2fd6 55%, #7a4dff 100%); }
.summary-label { margin: 0 0 8px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.7); }
.summary-date { margin: 0 0 6px; font-size: 1.2rem; font-weight: 700; display: flex; gap: 10px; align-items: flex-start; }
.summary-time { margin: 0 0 20px; font-size: 1.05rem; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pill { display: inline-block; padding: 2px 10px; font-size: 0.8rem; font-weight: 700; border-radius: 999px; background: rgba(255, 255, 255, 0.2); }
.form-card h1 { margin-bottom: 4px; }
.form-card form { margin-top: 18px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.field { margin-bottom: 16px; }
.field > label, .field > .label { display: block; margin-bottom: 6px; font-weight: 700; font-size: 0.92rem; }
.hint { margin: 6px 0 0; font-size: 0.84rem; color: var(--muted); }
.field-error { margin: 6px 0 0; font-size: 0.86rem; font-weight: 600; color: var(--red-dark); }

input[type="text"], input[type="email"], input[type="password"], input[type="date"], input[type="time"], input[type="number"], select, textarea {
  width: 100%; padding: 11px 13px; font: inherit; color: var(--ink); background: #fff;
  border: 1.5px solid #d6d1ec; border-radius: var(--radius-sm);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px rgba(109, 74, 255, 0.16); }
input[readonly] { background: #faf9fe; }
input:disabled, select:disabled { opacity: 0.55; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--violet); }

.input-wrap { position: relative; }
.input-wrap > .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-wrap > input { padding-left: 42px; }
.field.has-error input { border-color: var(--red); background: #fffafa; }

.check, .field > label.check { display: flex; gap: 10px; align-items: flex-start; margin: 0; font-size: 0.92rem; font-weight: 400; cursor: pointer; }
.check input { flex: none; width: 20px; height: 20px; margin-top: 2px; }
.consent { padding: 14px; background: #faf9fe; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.consent.has-error { border-color: var(--red); background: #fffafa; }

/* ---------- Pages d'état (confirmation, annulation, erreur) ---------- */
.state-card { text-align: center; margin-top: 36px; margin-bottom: 36px; padding: 32px 26px; }
.details { margin: 22px 0; padding: 0; text-align: left; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.details > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.details > div:last-child { border-bottom: 0; }
.details dt { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.9rem; }
.details dd { margin: 0; font-weight: 700; word-break: break-word; }
.details a { color: var(--violet-dark); }

.cancel-box { margin-top: 22px; text-align: left; border: 1px solid #f3c9cb; border-radius: var(--radius-sm); background: #fffafa; padding: 4px 16px; }
.cancel-box summary { display: flex; align-items: center; gap: 8px; padding: 12px 0; cursor: pointer; font-weight: 700; color: var(--red-dark); list-style: none; }
.cancel-box summary::-webkit-details-marker { display: none; }
.cancel-box[open] summary { border-bottom: 1px solid #f3c9cb; margin-bottom: 12px; }
.cancel-box form { padding-bottom: 16px; }

.prose-page { padding-block: 32px; }
.prose h1 { display: flex; align-items: center; gap: 10px; }
.prose h1 .icon { color: var(--violet); }
.prose h2 { margin-top: 1.6em; font-size: 1.1rem; color: var(--violet-dark); }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 0.4em; }

/* ---------- Connexion administrateur ---------- */
.login-card { text-align: center; padding: 34px 28px; }
.login-card form { text-align: left; margin-top: 20px; }
.login-card .alert { text-align: left; }

/* ==========================================================================
   Agenda d'administration
   ========================================================================== */
.cal-page { width: min(1360px, 100% - 32px); padding-block: 22px 40px; }

.cal-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-bottom: 14px; }
.nav-group { display: inline-flex; align-items: center; gap: 8px; }
.cal-title { flex: 1; min-width: 200px; margin: 0; font-size: clamp(1.15rem, 1rem + 0.8vw, 1.6rem); }
.segmented { display: inline-flex; padding: 4px; gap: 2px; background: #e4def9; border-radius: 14px; }
.segmented a { padding: 8px 16px; border-radius: 10px; font-weight: 700; font-size: 0.92rem; text-decoration: none; color: var(--violet-dark); }
.segmented a:hover { background: rgba(255, 255, 255, 0.55); }
.segmented a.is-active { background: #fff; box-shadow: var(--shadow-sm); color: var(--violet-deep); }

.cal-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 8px; }
.tool-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; font-size: 0.78rem; font-weight: 800; color: #fff; background: var(--violet); border-radius: 999px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.86rem; color: var(--muted); }
.lg { display: inline-flex; align-items: center; gap: 7px; }
.lg::before { content: ""; width: 14px; height: 14px; border-radius: 5px; background: var(--c, var(--violet)); }
.lg-free { --c: var(--teal); }
.lg-booked { --c: var(--violet); }
.lg-closed { --c: #b9b4cf; }
.lg-absence { --c: var(--amber); }
.cal-help { margin: 0 0 10px; font-size: 0.86rem; color: var(--muted); }
.card.cal-card { padding: 0; overflow: hidden; }

/* ----- Grille horaire (jour / semaine) ----- */
.tg-scroll { overflow-x: auto; }
.tg { --hour-h: 64px; --axis-w: 62px; min-width: 780px; }
.tg.tg-day { min-width: 320px; }
.tg-head, .tg-body { display: grid; grid-template-columns: var(--axis-w) repeat(var(--day-cols, 7), minmax(0, 1fr)); }
.tg-head { background: #faf9fe; border-bottom: 1px solid var(--line); }
.tg-corner { background: #faf9fe; }
.tg-colhead { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px 6px; border-left: 1px solid var(--line); text-align: center; }
.tg-colhead a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; border-radius: 10px; padding: 2px 8px; }
.tg-colhead a:hover { background: var(--violet-soft); }
.tg-colhead .dow { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.tg-colhead .dom { display: inline-grid; place-items: center; min-width: 30px; height: 30px; font-size: 1.1rem; font-weight: 800; border-radius: 50%; }
.tg-colhead.is-today .dom { color: #fff; background: var(--violet); }
.tg-colhead.is-today .dow { color: var(--violet); }
.tg-colhead.is-weekend { background: #f4f1fb; }
.tg-closure-tag, .mc-closure {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 3px 9px;
  font: inherit; font-size: 0.76rem; font-weight: 700; color: #7a4b00; background: var(--amber-soft);
  border: 1px solid #f6dca3; border-radius: 999px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tg-closure-tag:hover, .mc-closure:hover { background: #ffe9bd; }

.tg-body { position: relative; height: calc(var(--hour-h) * var(--grid-hours, 12)); user-select: none; -webkit-user-select: none; }
.tg-axis { background: #faf9fe; }
.tg-hour { height: var(--hour-h); position: relative; }
.tg-hour span { position: absolute; top: 0; right: 8px; transform: translateY(-50%); font-size: 0.74rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.tg-hour:first-child span { transform: translateY(4px); }

.tg-col {
  position: relative; border-left: 1px solid var(--line); cursor: crosshair; touch-action: pan-y;
  background-image:
    linear-gradient(to bottom, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(230, 226, 244, 0.55) 1px, transparent 1px);
  background-size: 100% var(--hour-h), 100% calc(var(--hour-h) / 2);
}
.tg-col.is-weekend { background-color: #faf8ff; }
.tg-col.is-closed {
  background-color: #fffaf0;
  background-image:
    linear-gradient(to bottom, var(--line) 1px, transparent 1px),
    repeating-linear-gradient(135deg, rgba(245, 158, 11, 0.14) 0 9px, transparent 9px 18px);
  background-size: 100% var(--hour-h), auto;
}

.tg-ev {
  position: absolute; left: 3px; right: 3px; z-index: 1;
  display: flex; flex-direction: column; justify-content: flex-start; gap: 1px; overflow: hidden;
  padding: 4px 8px; font: inherit; font-size: 0.8rem; line-height: 1.25; text-align: left; cursor: pointer;
  border: 0; border-left: 4px solid; border-radius: 9px; box-shadow: 0 1px 3px rgba(31, 27, 58, 0.12);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.tg-ev:hover { z-index: 3; transform: translateY(-1px); box-shadow: 0 6px 14px -6px rgba(31, 27, 58, 0.45); }
.tg-ev > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev-time { font-weight: 800; font-size: 0.74rem; font-variant-numeric: tabular-nums; opacity: 0.85; }
.ev-title { font-weight: 700; }
.ev-sub { font-size: 0.74rem; opacity: 0.85; }
.tg-ev.is-short { flex-direction: row; align-items: center; gap: 8px; padding-block: 0; }
.tg-ev.is-short .ev-sub { display: none; }
.tg-ev.is-short > span { flex: none; max-width: 100%; }
.tg-ev.is-short .ev-title { flex: 0 1 auto; min-width: 0; }
.ev-free { color: var(--teal-dark); background: var(--teal-soft); border-left-color: var(--teal); }
.ev-booked { color: #fff; background: linear-gradient(135deg, var(--violet) 0%, #8a63ff 100%); border-left-color: var(--violet-deep); }
.ev-closed { color: #6b6785; background: repeating-linear-gradient(135deg, #efedf6 0 7px, #e6e3f1 7px 14px); border-left-color: #b9b4cf; }
.tg-ev.is-past { opacity: 0.55; }

.tg-now { position: absolute; left: 0; right: 0; height: 2px; z-index: 2; background: var(--pink); pointer-events: none; }
.tg-now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--pink); }
.tg-selection {
  position: absolute; left: 2px; right: 2px; z-index: 4; pointer-events: none;
  padding: 4px 8px; font-size: 0.78rem; font-weight: 800; color: var(--violet-dark);
  background: rgba(109, 74, 255, 0.16); border: 2px dashed var(--violet); border-radius: 9px;
}

/* ----- Vue mois ----- */
.mc { user-select: none; -webkit-user-select: none; }
.mc-head, .mc-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.mc-head > div { padding: 10px 6px; text-align: center; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); background: #faf9fe; border-bottom: 1px solid var(--line); }
.mc-cell { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 5px; min-height: 108px; padding: 7px; background: #fff; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: cell; min-width: 0; }
.mc-week .mc-cell:last-child { border-right: 0; }
.mc-cell.is-weekend { background: #faf8ff; }
.mc-cell.is-out { background: #f6f4fb; }
.mc-cell.is-out .mc-num { opacity: 0.45; }
.mc-cell.is-past:not(.is-today) .mc-num { color: var(--muted); }
.mc-cell.is-closed { background: #fffaf0 repeating-linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0 9px, transparent 9px 18px); }
.mc-cell.is-selected { z-index: 1; background: #ece6ff; outline: 2px solid var(--violet); outline-offset: -2px; }
.mc-num { display: inline-grid; place-items: center; min-width: 30px; height: 30px; font-weight: 800; text-decoration: none; color: inherit; border-radius: 50%; }
.mc-num:hover { background: var(--violet-soft); }
.mc-cell.is-today .mc-num { color: #fff; background: var(--violet); }
.mc-pill { max-width: 100%; padding: 3px 10px; font-size: 0.78rem; font-weight: 700; text-decoration: none; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-booked { color: #fff; background: var(--violet); }
.pill-free { color: var(--teal-dark); background: var(--teal-soft); }

/* ==========================================================================
   Fenêtres de dialogue
   ========================================================================== */
dialog.dlg {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; padding: 0;
  color: var(--ink); background: #fff; border: 0; border-radius: 22px;
  box-shadow: 0 30px 70px -20px rgba(31, 17, 100, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
}
dialog.dlg.dlg-wide { width: min(640px, calc(100vw - 32px)); }
dialog.dlg[open] { animation: dlg-in 0.18s ease both; }
dialog.dlg::backdrop { background: rgba(31, 27, 58, 0.55); backdrop-filter: blur(3px); }
/* Sans JavaScript, la fenêtre envoyée par le serveur reste visible et centrée */
dialog.dlg[open]:not(:modal) { position: fixed; inset: 0; margin: auto; height: fit-content; z-index: 400; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

.dlg-head { display: flex; align-items: center; gap: 12px; padding: 20px 22px 6px; }
.dlg-head h2 { flex: 1; margin: 0; font-size: 1.18rem; }
.dlg-icon { display: inline-grid; place-items: center; flex: none; width: 42px; height: 42px; font-size: 1.15rem; color: var(--violet); background: var(--violet-soft); border-radius: 50%; }
.dlg-icon.is-warn, .dlg-icon.is-sun { color: #b26a00; background: var(--amber-soft); }
.dlg-icon.is-error { color: var(--red-dark); background: var(--red-soft); }
.dlg-icon.is-ok { color: var(--green); background: var(--green-soft); }
.dlg-icon.is-booked { color: #fff; background: linear-gradient(135deg, var(--violet), #8a63ff); }
.dlg-x { display: grid; place-items: center; flex: none; width: 36px; height: 36px; color: var(--muted); background: transparent; border: 0; border-radius: 50%; cursor: pointer; }
.dlg-x:hover { color: var(--ink); background: var(--violet-soft); }
.dlg-body { padding: 10px 22px 18px; }
.dlg-scroll { max-height: min(68vh, 640px); overflow: auto; }
.dlg-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; background: #faf9fe; border-top: 1px solid var(--line); }
.dlg-foot form { margin: 0; }
.dlg-foot-wrap { justify-content: flex-start; }
.dlg-foot-wrap > .btn-ghost { margin-left: auto; }

.line { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; font-weight: 600; }
.line .icon { color: var(--violet); }
.actions-stack { display: grid; gap: 10px; margin-top: 16px; }
.inline-row { display: flex; gap: 10px; align-items: stretch; }
.inline-row select { flex: 1; }
.stack-form { margin: 14px 0 0; }

.affected { list-style: none; display: grid; gap: 8px; max-height: 220px; overflow: auto; margin: 14px 0 0; padding: 12px; background: #faf9fe; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.affected li { line-height: 1.35; }

.sync { display: flex; align-items: flex-start; gap: 8px; margin: 14px 0 0; padding: 10px 12px; font-size: 0.9rem; font-weight: 600; border-radius: var(--radius-sm); }
.sync .icon { margin-top: 0.15em; }
.sync-ok { color: #11693c; background: var(--green-soft); }
.sync-error { color: #8c1d22; background: var(--red-soft); }
.sync-off { color: var(--muted); background: #f4f1fb; }

.dlg-body .details { margin: 4px 0 0; }
.dlg-body .details > div { grid-template-columns: 110px minmax(0, 1fr); }

/* Choix d'action (ouvrir / fermer / absence) */
.seg-radio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 18px; padding: 0; border: 0; min-width: 0; }
.seg-radio label { position: relative; display: block; cursor: pointer; }
.seg-radio input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg-radio span { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 76px; padding: 10px 6px; text-align: center; font-size: 0.86rem; font-weight: 700; line-height: 1.2; color: var(--muted); background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius-sm); transition: border-color 0.12s ease, background-color 0.12s ease, color 0.12s ease; }
.seg-radio span .icon { font-size: 1.35rem; }
.seg-radio label:hover span { border-color: var(--violet-line); }
.seg-radio input:checked + span { color: var(--violet-dark); background: var(--violet-soft); border-color: var(--violet); }
.seg-radio input:focus-visible + span { outline: 3px solid rgba(109, 74, 255, 0.55); outline-offset: 2px; }

/* Jours de la semaine */
.weekdays { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; padding: 0; border: 0; min-width: 0; }
.weekdays legend { margin-bottom: 6px; padding: 0; font-weight: 700; font-size: 0.92rem; float: left; width: 100%; }
.weekdays label { position: relative; cursor: pointer; }
.weekdays input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.weekdays span { display: inline-grid; place-items: center; min-width: 48px; padding: 8px 10px; font-size: 0.86rem; font-weight: 700; color: var(--muted); background: #fff; border: 1.5px solid var(--line); border-radius: 999px; }
.weekdays input:checked + span { color: #fff; background: var(--violet); border-color: var(--violet); }
.weekdays input:focus-visible + span { outline: 3px solid rgba(109, 74, 255, 0.55); outline-offset: 2px; }

.closure-list { list-style: none; display: grid; gap: 8px; margin: 0 0 6px; padding: 0; }
.closure-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--amber-soft); border: 1px solid #f6dca3; border-radius: var(--radius-sm); }
.closure-list form { margin: 0; }

.copy-row { display: flex; gap: 8px; margin: 16px 0 6px; }
.copy-row input { flex: 1; min-width: 0; font-size: 0.88rem; }
.dlg-body.center > .btn { margin-top: 12px; }
.qr { display: block; margin: 4px auto 0; width: 220px; height: 220px; max-width: 100%; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm); }

/* ==========================================================================
   Adaptation aux petits écrans
   ========================================================================== */
@media (max-width: 960px) {
  .book-layout { grid-template-columns: 1fr; margin-top: -40px; }
  .summary-card { position: static; }
  .days { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (max-width: 720px) {
  .hero { padding: 36px 0 84px; }
  .planner-card { padding: 16px; }
  .week-title { min-width: 0; font-size: 0.88rem; }
  .days { grid-template-columns: 1fr; }
  .day { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 12px; align-items: start; }
  .day-head { padding: 4px 12px 4px 0; margin: 0; border-bottom: 0; border-right: 1px dashed var(--line); }
  .day-head .dom { font-size: 1.5rem; }
  .slots { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }
  .no-slot { text-align: left; }
  .grid-2 { grid-template-columns: 1fr; }
  .details > div { grid-template-columns: 1fr; gap: 2px; }
  .dlg-body .details > div { grid-template-columns: 1fr; gap: 2px; }
  .card { padding: 20px 16px; }

  .bar { flex-wrap: wrap; }
  .admin-actions { width: 100%; justify-content: flex-start; padding-bottom: 6px; }
  .brand-text small { display: none; }
  .bar-link span { display: none; }

  .cal-toolbar { gap: 10px; }
  .cal-title { order: -1; flex-basis: 100%; }
  .segmented { width: 100%; }
  .segmented a { flex: 1; text-align: center; padding-inline: 8px; }
  .tool-buttons { width: 100%; }
  .tool-buttons .btn { flex: 1 1 100%; }

  .mc-cell { min-height: 78px; padding: 4px; gap: 3px; }
  .mc-head > div { padding-inline: 2px; font-size: 0.68rem; letter-spacing: 0; }
  .mc-pill { padding: 2px 6px; font-size: 0.68rem; }
  .mc-num { min-width: 26px; height: 26px; font-size: 0.85rem; }
  .mc-closure { font-size: 0.66rem; padding: 2px 6px; }

  .seg-radio { grid-template-columns: 1fr; }
  .seg-radio span { flex-direction: row; justify-content: flex-start; min-height: 0; padding: 12px 14px; }
  .toasts { top: 72px; }
  .dlg-foot { justify-content: stretch; }
  .dlg-foot > .btn, .dlg-foot > form { flex: 1; }
  .dlg-foot form .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  .topbar, .footer, .toasts, .cal-tools, .cal-toolbar .nav-group, .segmented, .cal-help { display: none !important; }
  body, body.admin { background: #fff; }
  .card { box-shadow: none; }
}
