/* Vision RDV V2 */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --ink: #0d1530;
  --ink-2: #4a5372;
  --muted: #8a92ad;
  --line: #e7eaf3;
  --line-2: #f0f2f8;
  --accent: #3b5bfd;
  --accent-2: #6f4cff;
  --accent-soft: #eef1ff;
  --danger: #e5484d;
  --ok: #12a37a;
  --warn: #d98a0b;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(13, 21, 48, .04), 0 8px 24px -12px rgba(13, 21, 48, .12);
  --shadow-lg: 0 24px 60px -20px rgba(13, 21, 48, .35);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --side: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; font-size: 15px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
[hidden] { display: none !important; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--line-2); padding: 2px 6px; border-radius: 6px; }
code.wrap { word-break: break-all; display: block; margin-top: 6px; }
.link { color: var(--accent); font-weight: 600; }
.link:hover { text-decoration: underline; }
.link-btn { border: 0; background: none; color: var(--muted); font-size: 13px; text-decoration: underline; }
.req { color: var(--danger); font-weight: 700; }
.ic { flex: none; }

/* ---------- Marque ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 17px; letter-spacing: -.01em; }
.brand b { font-weight: 700; }
.brand.big { font-size: 20px; margin-bottom: 26px; }
.logo { width: 32px; height: 32px; border-radius: 10px; display: inline-grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 800; font-size: 16px; box-shadow: 0 6px 16px -6px rgba(59, 91, 253, .7); flex: none; }
.logo.xl { width: 56px; height: 56px; border-radius: 16px; font-size: 26px; }

/* ---------- Boutons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 11px; border: 1px solid transparent; font-weight: 600; font-size: 14px; transition: background .15s, box-shadow .15s, transform .05s, border-color .15s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: #fff; box-shadow: 0 6px 16px -8px rgba(13, 21, 48, .6); }
.btn.primary:hover { background: #1b2550; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: #cfd5e6; background: #fafbff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--danger); }
.btn.danger-ghost:hover { background: #fff1f1; }
.btn.block { width: 100%; height: 46px; font-size: 15px; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row form { margin: 0; }
.btn-row.center { justify-content: center; }
.icon-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; display: inline-grid; place-items: center; color: var(--ink-2); cursor: pointer; position: relative; flex: none; }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }

/* ---------- Champs ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
input:not([type=radio]):not([type=checkbox]):not([type=color]), select, textarea { width: 100%; height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; min-width: 0; }
textarea { height: auto; padding: 10px 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(59, 91, 253, .12); }
input:disabled, select:disabled, textarea:disabled { background: #f7f8fb; color: var(--ink-2); }
input[type=color] { width: 44px; height: 38px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.code-input { font-size: 22px !important; letter-spacing: .2em; text-align: center; height: 52px !important; font-variant-numeric: tabular-nums; }
.w-num { width: 70px !important; flex: none; }

.alert { padding: 11px 14px; border-radius: 11px; font-size: 14px; margin-bottom: 14px; }
.alert.error { background: #fff1f1; color: #b4232a; border: 1px solid #ffd9d9; }
.alert.success { background: #ebfaf4; color: #0b7a5b; border: 1px solid #c8f0de; }
.alert.info { background: var(--accent-soft); color: #2a40b8; border: 1px solid #dbe1ff; }

/* ---------- Connexion / pages simples ---------- */
.login-page { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; background: var(--surface); }
.login-art { position: relative; overflow: hidden; background: #0b1130; display: flex; align-items: flex-end; padding: 56px; }
.orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .85; }
.o1 { width: 520px; height: 520px; background: #3b5bfd; top: -140px; left: -120px; animation: drift 14s ease-in-out infinite alternate; }
.o2 { width: 420px; height: 420px; background: #7a4cff; bottom: -120px; right: -80px; animation: drift 18s ease-in-out infinite alternate-reverse; }
.o3 { width: 260px; height: 260px; background: #0e9f9a; top: 40%; left: 45%; opacity: .55; animation: drift 11s ease-in-out infinite alternate; }
@keyframes drift { to { transform: translate(40px, 30px) scale(1.08); } }
.login-art::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 48px 48px; mask-image: linear-gradient(to bottom, transparent, #000 40%, #000 70%, transparent); -webkit-mask-image: linear-gradient(to bottom, transparent, #000 40%, #000 70%, transparent); }
.art-copy { position: relative; z-index: 1; color: #fff; max-width: 460px; }
.art-copy h2 { font-size: 40px; line-height: 1.1; letter-spacing: -.03em; margin: 26px 0 12px; font-weight: 700; }
.art-copy p { color: rgba(255,255,255,.72); margin: 0; font-size: 16px; }
.login-panel { display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 6px; }
.login-card > .muted { margin: 0 0 24px; }
.login-card .btn { margin-top: 6px; }
.login-card .foot { text-align: center; font-size: 12px; margin-top: 28px; }
.plain-page { background: var(--bg); }
.install { max-width: 620px; margin: 0 auto; padding: 48px 20px; }
.install h1 { letter-spacing: -.02em; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.checks li { font-size: 14px; }
.checks .ok { color: var(--ok); }
.checks .ko { color: var(--danger); font-weight: 600; }
.steps { padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 20px; letter-spacing: .08em; background: var(--line-2); padding: 14px; border-radius: 12px; text-align: center; word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.codes code { font-size: 16px; text-align: center; padding: 10px; }

/* ---------- Coque applicative ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 14px; z-index: 40; overflow-y: auto; }
.sidebar > .brand { padding: 4px 8px 18px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-sec { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 16px 10px 6px; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; font-weight: 550; font-size: 14px; color: var(--ink-2); }
.sidebar nav a:hover { background: var(--line-2); color: var(--ink); }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent); }
.sidebar nav a span { flex: 1; }
.count { font-style: normal; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; padding: 0 6px; }
.side-user { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 14px 4px 0; margin-top: 12px; }
.side-user form { margin: 0; }
.su-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.su-text b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.su-text small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; background: linear-gradient(135deg, #e6eaff, #f0e8ff); color: var(--accent); font-weight: 700; font-size: 13px; flex: none; }
.main { flex: 1; margin-left: var(--side); min-width: 0; }
.mobile-bar { display: none; }
.scrim { display: none; }
.content { padding: 26px 30px 40px; max-width: 1500px; margin: 0 auto; }

/* ---------- En-têtes et cartes ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 27px; letter-spacing: -.025em; }
.page-head p { margin: 4px 0 0; }
.ph-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ph-actions form { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 18px; min-width: 0; }
.card h3 { margin: 0 0 14px; font-size: 16px; letter-spacing: -.01em; }
.card.slim { padding: 12px 14px; }
.card.empty, .empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid2.wide-left { grid-template-columns: 1.5fr 1fr; }
.grid2.tight, .grid3, .grid4 { gap: 12px; }
.grid2.tight { grid-template-columns: 1fr 1fr; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); }
.grid4 { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.2fr; }
.span2 { grid-column: 1 / -1; }
.chip { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 6px; background: var(--line-2); color: var(--ink-2); vertical-align: 1px; }
.chip.ok { background: #e6f7f0; color: #0b7a5b; }
.chip.off { background: #fdeceb; color: #b4232a; }
.pill { display: inline-block; min-width: 26px; text-align: center; padding: 2px 8px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 99px; background: color-mix(in srgb, var(--sc) 12%, white); color: color-mix(in srgb, var(--sc) 80%, black); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--sc); }
.role { font-size: 12px; font-weight: 650; padding: 3px 9px; border-radius: 7px; }
.role-admin { background: #0d1530; color: #fff; }
.role-secretariat { background: #f0eaff; color: #5b34d6; }
.role-doctor { background: #e2f6f5; color: #087a76; }
.role-insurer { background: #fdf3e0; color: #9a6206; }
.dim { opacity: .55; }
.hl { background: #f6f8ff; }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; margin: 0 -6px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 650; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: #fafbff; }
.table form.inline, form.inline { display: inline; margin: 0; }
.small-table td { font-size: 13px; padding: 8px 10px; }
.details { max-width: 320px; word-break: break-word; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 14px; }
.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.plain-list li:last-child { border-bottom: 0; }
.plain-list form { margin: 0; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; margin: 0 0 16px; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; }

/* ---------- Filtres ---------- */
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filters.wrap > * { flex: 0 1 auto; }
.filters select, .filters input[type=date] { width: auto; min-width: 150px; }
.search { position: relative; flex: 1 1 240px; display: flex; align-items: center; }
.search .ic { position: absolute; left: 12px; color: var(--muted); }
.search input { padding-left: 36px !important; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form.grow { flex: 1; }
.select-wrap { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 4px 0 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink-2); }
.select-wrap select { border: 0 !important; height: 38px !important; padding: 0 8px 0 0 !important; box-shadow: none !important; max-width: 240px; font-weight: 600; color: var(--ink); background: transparent; width: auto; }
.checks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 16px; padding: 4px 0; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 18px; }
.status-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.status-form input[name=label] { width: 200px; }

/* ---------- Statistiques ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr) 1.4fr; gap: 16px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; }
.kpi span { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi b { font-size: 34px; letter-spacing: -.03em; line-height: 1.1; }
.kpi small { color: var(--muted); font-size: 12px; }
.kpi a { font-size: 13px; font-weight: 600; color: #fff; opacity: .85; }
.kpi.accent { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 0; color: #fff; }
.kpi.accent span { color: rgba(255,255,255,.8); }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 70px; margin-top: 6px; }
.bars div { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.bars i { display: block; width: 100%; max-width: 26px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.bars em { font-style: normal; font-size: 10.5px; color: var(--muted); }
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.mini-stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; box-shadow: var(--shadow); transition: border-color .15s; }
.mini-stat:not(:has(.ms-icon)) { grid-template-columns: 1fr; }
.mini-stat .ms-icon { grid-row: 1 / 3; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.mini-stat b { font-size: 22px; letter-spacing: -.02em; }
.mini-stat span:last-child { font-size: 13px; color: var(--muted); }
a.mini-stat:hover, .mini-stat.active { border-color: var(--accent); }
.big-num { font-size: 40px; font-weight: 700; margin: 0; letter-spacing: -.03em; }
.big-num.warn { color: var(--danger); }
.timeline, .activity { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.timeline li:last-child, .activity li:last-child { border-bottom: 0; }
.timeline li.muted { display: block; }
.tl-time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.tl-main { display: flex; flex-direction: column; min-width: 0; }
.tl-main small { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-main:hover b { color: var(--accent); }
.activity li { padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.activity small { display: block; color: var(--muted); font-size: 12px; }

/* ---------- Cartes d'entités ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.entity-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; display: block; }
.entity-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.ec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ec-head b { flex: 1; font-size: 15.5px; }
.ec-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.entity-card p { margin: 0 0 8px; display: flex; gap: 4px; align-items: center; }
.ec-stats { display: flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.ec-stats b { color: var(--ink); }
.temp-pw { border-color: #c8f0de; background: #f6fdf9; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; align-items: center; }
.kv span { color: var(--muted); font-size: 13px; }
.kv code.big { font-size: 18px; padding: 6px 12px; justify-self: start; }
.confirm-box { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; background: #fff8eb; border: 1px solid #f6dfae; border-radius: 14px; padding: 16px 18px; margin-bottom: 18px; flex-wrap: wrap; }
.confirm-box ul { margin: 6px 0 0; padding-left: 18px; }
.confirm-box form { display: flex; gap: 8px; margin: 0; }
.seg-radio { display: inline-flex; background: #e9ecf5; border-radius: 11px; padding: 3px; margin-bottom: 14px; }
.seg-radio label { cursor: pointer; }
.seg-radio input { position: absolute; opacity: 0; pointer-events: none; }
.seg-radio span { display: block; padding: 7px 14px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.seg-radio input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(13,21,48,.12); }
.days { display: flex; gap: 6px; flex-wrap: wrap; }
.days label { cursor: pointer; }
.days input { position: absolute; opacity: 0; pointer-events: none; }
.days span { display: grid; place-items: center; width: 46px; height: 38px; border-radius: 10px; border: 1px solid var(--line); font-weight: 600; font-size: 13px; color: var(--ink-2); background: #fff; }
.days input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.days input:focus-visible + span { outline: 3px solid rgba(59,91,253,.3); }

/* ---------- Agenda ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.tb-left, .tb-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nav-arrows { display: flex; }
.range-label { margin: 0 0 0 6px; font-size: 21px; letter-spacing: -.02em; font-weight: 700; }
.seg { display: inline-flex; background: #e9ecf5; border-radius: 11px; padding: 3px; }
.seg button { border: 0; background: transparent; height: 34px; padding: 0 14px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.seg button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(13,21,48,.12); }
.legend { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin-bottom: 12px; }
.legend > span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 16px; height: 12px; border-radius: 4px; display: inline-block; }
.lg-avail { background: #e3f7ee; border: 1px solid #b7e8d2; }
.lg-block { background: repeating-linear-gradient(135deg, #eceef4 0 4px, #f8f9fc 4px 8px); border: 1px solid #dde1ea; }
.legend .link { margin-left: auto; }
.cal-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; }
.loading { position: absolute; top: 0; left: 0; right: 0; height: 3px; overflow: hidden; z-index: 6; }
.loading::after { content: ""; position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, var(--accent), transparent); animation: load 1s ease-in-out infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.tg-head { display: grid; grid-template-columns: 60px repeat(var(--n), 1fr); border-bottom: 1px solid var(--line); background: #fff; }
.tg-corner { border-right: 1px solid var(--line-2); }
.tg-day { border: 0; background: transparent; padding: 10px 6px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; border-left: 1px solid var(--line-2); }
.tg-day span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.tg-day b { font-size: 19px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; }
.tg-day:hover b { background: var(--line-2); }
.tg-day.is-today span { color: var(--accent); }
.tg-day.is-today b { background: var(--accent); color: #fff; box-shadow: 0 6px 14px -6px rgba(59,91,253,.8); }
.tg-scroll { max-height: calc(100vh - 250px); min-height: 420px; overflow-y: auto; }
.tg-body { display: grid; grid-template-columns: 60px 1fr; }
.tg-times > div { position: relative; border-right: 1px solid var(--line-2); }
.tg-times span { position: absolute; top: -8px; right: 9px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tg-times > div:first-child span { display: none; }
.tg-cols { display: grid; grid-template-columns: repeat(var(--n), 1fr); }
.tg-col { position: relative; border-left: 1px solid var(--line-2); cursor: copy; background-color: #fcfcfe;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(var(--line-2) 1px, transparent 1px);
  background-size: 100% var(--hour), 100% calc(var(--hour) / 2); }
.tg-col.is-today { background-color: #f9faff; }
.avail { position: absolute; left: 0; right: 0; background: rgba(18, 163, 122, .085); border-left: 3px solid rgba(18, 163, 122, .45); pointer-events: none; z-index: 0; }
.avail span { position: absolute; top: 3px; right: 6px; font-size: 10.5px; font-weight: 600; color: #0b7a5b; opacity: .8; }
.blocked { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(135deg, rgba(138,146,173,.16) 0 6px, rgba(138,146,173,.05) 6px 12px); pointer-events: none; z-index: 1; border-top: 1px dashed #c4c9d8; border-bottom: 1px dashed #c4c9d8; overflow: hidden; }
.blocked span { position: absolute; top: 4px; left: 8px; font-size: 11px; font-weight: 600; color: var(--ink-2); background: rgba(255,255,255,.8); padding: 1px 6px; border-radius: 5px; }
.now { position: absolute; left: -1px; right: 0; height: 2px; background: var(--danger); z-index: 5; pointer-events: none; }
.now::before { content: ""; position: absolute; left: -5px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.ev { position: absolute; z-index: 2; text-align: left; overflow: hidden; border: 0; border-left: 3px solid var(--c); border-radius: 8px; background: color-mix(in srgb, var(--c) 13%, white); color: var(--ink); padding: 4px 8px; display: flex; flex-direction: column; gap: 1px; transition: transform .12s, box-shadow .12s; box-shadow: 0 1px 2px rgba(13,21,48,.06); }
.ev:hover { box-shadow: 0 8px 20px -10px rgba(13,21,48,.45); transform: translateY(-1px); z-index: 4; }
.ev b { font-size: 12.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev span { font-size: 11.5px; color: color-mix(in srgb, var(--c) 75%, black); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev em { font-style: normal; font-size: 10.5px; color: var(--ink-2); }
.ev.short { flex-direction: row; align-items: center; gap: 6px; padding: 2px 8px; }
.ev.short span { order: -1; flex: none; }
.ev.cancelled, .mev.cancelled { opacity: .55; }
.ev.cancelled b, .mev.cancelled { text-decoration: line-through; }
.mg-head { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid var(--line); }
.mg-head div { padding: 12px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.mg-body { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: minmax(112px, 1fr); }
.mg-cell { border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; cursor: copy; position: relative; }
.mg-cell:nth-child(7n) { border-right: 0; }
.mg-cell:hover { background: #f8f9ff; }
.mg-cell.out { background: #fbfbfd; }
.mg-cell.out .mg-num { color: #c0c5d6; }
.mg-cell.has-avail::after { content: ""; position: absolute; top: 12px; right: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.mg-num { align-self: flex-start; border: 0; background: transparent; width: 28px; height: 28px; border-radius: 50%; font-weight: 600; font-size: 13px; }
.mg-num:hover { background: var(--line-2); }
.mg-cell.is-today .mg-num { background: var(--accent); color: #fff; }
.mev { border: 0; background: color-mix(in srgb, var(--c) 12%, white); border-radius: 6px; padding: 3px 7px; font-size: 12px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.mev i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex: none; }
.more { border: 0; background: transparent; color: var(--ink-2); font-size: 12px; font-weight: 600; text-align: left; padding: 2px 7px; }
.more:hover { color: var(--accent); }

/* ---------- Modales ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(13, 21, 48, .38); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; opacity: 0; transition: opacity .16s; }
.modal-backdrop.open { opacity: 1; }
.modal { width: 100%; max-width: 520px; background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg); padding: 20px 22px 18px; transform: translateY(10px) scale(.98); transition: transform .18s; max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal.lg { max-width: 720px; }
.modal-backdrop.open .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font-size: 18px; letter-spacing: -.01em; }
.modal-body { overflow-y: auto; margin: 0 -22px; padding: 2px 22px; }
.modal-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.spacer { flex: 1; }
.appt-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.dyn-fields { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; }
.dyn-fields:empty { display: none; }
.field-check { margin-bottom: 14px; align-self: end; height: 42px; }
.old-values { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); background: var(--line-2); padding: 8px 12px; border-radius: 10px; margin-bottom: 14px; }
.history summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.history ul { list-style: none; padding: 0; margin: 0 0 12px; font-size: 13px; display: grid; gap: 8px; }
.history small { color: var(--muted); }
.summary { background: var(--line-2); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; display: grid; gap: 4px; font-size: 14px; }
.success-modal { text-align: center; align-items: center; }
.success-modal .summary { text-align: left; width: 100%; }
.success-icon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: #e6f7f0; color: var(--ok); margin: 6px auto 10px; }
.success-modal h3 { margin: 0 0 14px; font-size: 20px; }

/* ---------- Réservation ---------- */
.booking { display: grid; grid-template-columns: 290px 1fr; gap: 18px; align-items: start; }
.booking-filters { position: sticky; top: 20px; }
.chips-select { display: flex; flex-wrap: wrap; gap: 6px; }
.chips-select button { border: 1px solid var(--line); background: #fff; border-radius: 10px; height: 36px; padding: 0 12px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.chips-select button.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.booking-slots { position: relative; }
.bs-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.bs-head h3 { margin: 0; }
.slot-grid { display: grid; grid-template-columns: repeat(var(--days, 7), minmax(0, 1fr)); gap: 10px; min-height: 240px; }
.slot-day { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sd-head { display: flex; flex-direction: column; align-items: center; padding: 8px 0; border-radius: 12px; background: var(--line-2); }
.sd-head span { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.sd-head b { font-size: 20px; line-height: 1.2; }
.sd-head small { font-size: 11px; color: var(--muted); }
.slot-day.is-today .sd-head { background: var(--accent-soft); }
.slot-day.is-today .sd-head span { color: var(--accent); }
.sd-list { display: flex; flex-direction: column; gap: 6px; max-height: 460px; overflow-y: auto; padding: 2px; }
.slot { border: 1px solid #cfe9dd; background: #effaf5; color: #0b6b4f; border-radius: 9px; height: 34px; font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; transition: .12s; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.slot:hover { background: var(--ok); color: #fff; border-color: var(--ok); }
.slot.mine { background: var(--accent-soft); border-color: #d3dbff; color: var(--accent); flex-direction: column; height: auto; padding: 5px 6px; line-height: 1.2; }
.slot.mine small { font-weight: 500; font-size: 11px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot.demo { display: inline-flex; height: 24px; padding: 0 8px; margin: 0 4px 0 12px; vertical-align: middle; font-size: 12px; }
.slot.pulse { animation: pulse 1.2s ease-in-out 3; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(18,163,122,.25); } }
.no-slot { text-align: center; color: #b4b9cb; font-size: 12.5px; margin: 10px 0; }
.legend-line { margin: 14px 0 0; }
.appt-list { display: flex; flex-direction: column; }
.appt-row { display: grid; grid-template-columns: 200px 1fr auto; gap: 16px; align-items: center; border: 0; background: transparent; text-align: left; padding: 12px 8px; border-bottom: 1px solid var(--line-2); border-radius: 10px; }
.appt-row:hover { background: #fafbff; }
.appt-row span { display: flex; flex-direction: column; min-width: 0; }
.appt-row small { color: var(--muted); font-size: 12.5px; }
.appt-row .status { display: inline-flex; flex-direction: row; }

/* ---------- Notifications ---------- */
.notif-list { padding: 8px; }
.notif { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; }
.notif:hover { background: #fafbff; }
.notif.unread { background: #f6f8ff; }
.n-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--line-2); color: var(--ink-2); flex: none; }
.t-appointment_created { background: #e6f7f0; color: var(--ok); }
.t-appointment_cancelled { background: #fdeceb; color: var(--danger); }
.t-appointment_moved, .t-appointment_modified { background: var(--accent-soft); color: var(--accent); }
.n-body { flex: 1; display: flex; flex-direction: column; font-size: 14px; }
.n-body small { color: var(--muted); font-size: 12px; }
.notif .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; z-index: 90; transform: translate(-50%, 16px); opacity: 0; transition: .2s; background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.bad { background: var(--danger); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi.chart { grid-column: 1 / -1; }
  .grid2.wide-left { grid-template-columns: 1fr; }
  .booking { grid-template-columns: 1fr; }
  .booking-filters { position: static; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); column-gap: 14px; }
  .booking-filters .btn.block { align-self: end; margin-bottom: 14px; }
}
@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  #navToggle:checked ~ .sidebar { transform: none; }
  #navToggle:checked ~ .scrim { display: block; position: fixed; inset: 0; background: rgba(13,21,48,.3); z-index: 35; }
  .main { margin-left: 0; }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 30; height: 58px; padding: 0 10px; background: rgba(255,255,255,.88); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
  .mobile-bar .bell i { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
  .content { padding: 16px 14px 32px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .grid4 { grid-template-columns: 1fr 1fr; }
  .dyn-fields { grid-template-columns: 1fr; }
  .range-label { font-size: 17px; width: 100%; margin: 4px 0 0; order: 3; }
  .tb-left, .tb-right { width: 100%; }
  .tb-right .btn.primary { margin-left: auto; }
  .select-wrap { flex: 1; }
  .select-wrap select { max-width: none; flex: 1; }
  .seg button[data-view="week"] { display: none; }
  .mg-body { grid-auto-rows: minmax(64px, 1fr); }
  .mev { font-size: 0; padding: 4px; }
  .mev i { width: 8px; height: 8px; }
  .legend .link { margin-left: 0; }
  .appt-row { grid-template-columns: 1fr; gap: 6px; }
  .page-head h1 { font-size: 23px; }
  .filters select, .filters input[type=date] { flex: 1 1 140px; }
  .confirm-box form { width: 100%; }
}

/* ---------- V2.1 : système ---------- */
.env-banner { background: repeating-linear-gradient(135deg, #fff4d6 0 14px, #fff0c7 14px 28px); border: 1px solid #f3d58a; color: #8a5a00; font-weight: 700; font-size: 13px; text-align: center; padding: 7px 12px; border-radius: 10px; margin-bottom: 16px; letter-spacing: .02em; }
.install.wide { max-width: 860px; }
.config-box { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.5; background: #0d1530 !important; color: #e8ecff !important; border-radius: 12px !important; padding: 14px !important; height: auto !important; white-space: pre; }
.diag { list-style: none; padding: 0; margin: 0; }
.diag li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.diag li:last-child { border-bottom: 0; }
.diag li small { color: var(--muted); text-align: right; word-break: break-word; max-width: 55%; }
.diag li.ok span { color: var(--ok); }
.diag li.ko span { color: var(--danger); font-weight: 600; }
.diag li.warn span { color: var(--warn); }
.chip.warn { background: #fdf3e0; color: #9a6206; }
.danger-zone { border-color: #f6caca; }
.danger-zone h3 { color: #b4232a; }
.btn.danger:disabled { opacity: .45; }
.checks .warn { color: var(--warn); }
