:root {
  --rose: #b5446e;
  --rose-dark: #8c2f52;
  --rose-light: #f5dce6;
  --rose-pale: #fdf0f4;
  --teal: #1a7f6e;
  --teal-light: #e0f4f0;
  --amber: #d97706;
  --amber-light: #fef3c7;
  --ink: #1a1118;
  --ink-soft: #4a3d45;
  --ink-muted: #8c7a84;
  --line: #e8dde2;
  --surface: #fdf6f9;
  --white: #ffffff;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --success: #059669;
  --success-light: #ecfdf5;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --sidebar-w: 220px;
  --header-h: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(26,17,24,0.08), 0 4px 16px rgba(26,17,24,0.04);
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
}

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

html { font-size: 14px; }

body {
  font-family: var(--font-body);
  background: var(--surface);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

#root { display: flex; flex-direction: column; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.logo-mark {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--rose);
  font-weight: 600;
  letter-spacing: -0.3px;
}
.logo-sub {
  font-size: 10px;
  color: var(--ink-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 1px;
}

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }

.nav-section-label {
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 8px 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 400;
  border: none; background: none; width: 100%; text-align: left;
  position: relative;
}
.nav-item:hover { background: var(--rose-pale); color: var(--rose); }
.nav-item.active { background: var(--rose-pale); color: var(--rose); font-weight: 500; }
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  background: var(--rose);
  color: white;
  font-size: 10px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--line);
}
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.user-card:hover { background: var(--rose-pale); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--rose-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; color: var(--rose);
  flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--ink-muted); }

/* ── MAIN LAYOUT ── */
.main-layout {
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.sidebar-hamburger {
  display: none;
  background: none; border: none; cursor: pointer;
  font-size: 20px; line-height: 1; color: var(--ink);
  padding: 4px 6px; border-radius: var(--radius-sm);
}
.sidebar-hamburger:hover { background: var(--rose-pale); }

.sidebar-close {
  display: none;
  background: none; border: none; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--ink-muted);
  position: absolute; top: 14px; right: 14px;
}

.sidebar-overlay {
  display: none;
}

.page-content { flex: 1; padding: 24px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px; font-weight: 500;
  cursor: pointer; border: none;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--rose); color: white; }
.btn-primary:hover { background: var(--rose-dark); }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--rose-pale); color: var(--rose); border-color: var(--rose-light); }
.btn-teal { background: var(--teal); color: white; }
.btn-teal:hover { background: #14695a; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ── CARDS ── */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 500; color: var(--ink); }
.card-body { padding: 16px 20px; }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 11px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.stat-value { font-family: var(--font-display); font-size: 28px; font-weight: 600; color: var(--ink); line-height: 1; }
.stat-sub { font-size: 11px; color: var(--ink-muted); margin-top: 4px; }
.stat-card.rose { border-top: 3px solid var(--rose); }
.stat-card.teal { border-top: 3px solid var(--teal); }
.stat-card.amber { border-top: 3px solid var(--amber); }
.stat-card.success { border-top: 3px solid var(--success); }

/* ── QUEUE ── */
.queue-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.queue-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--white);
  transition: all 0.15s;
  cursor: pointer;
}
.queue-item:hover { border-color: var(--rose-light); background: var(--rose-pale); }
.queue-item.active-consult { border-color: var(--teal); background: var(--teal-light); }
.queue-item.urgent { border-color: var(--danger); background: var(--danger-light); }
.queue-num {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--rose-light); color: var(--rose);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 14px; flex-shrink: 0;
}
.queue-num.active { background: var(--teal); color: white; }
.queue-num.urgent { background: var(--danger); color: white; }
.queue-info { flex: 1; min-width: 0; }
.queue-name { font-size: 13px; font-weight: 500; color: var(--ink); }
.queue-meta { font-size: 11px; color: var(--ink-muted); margin-top: 1px; }
.queue-wait {
  font-size: 11px; font-weight: 500;
  padding: 3px 8px; border-radius: 10px;
  background: var(--amber-light); color: var(--amber);
  flex-shrink: 0;
}
.queue-wait.done { background: var(--success-light); color: var(--success); }

/* ── TABLE ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 500;
  color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.data-table td {
  padding: 12px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--rose-pale); }
.data-table td.name { font-weight: 500; color: var(--ink); }

/* ── TAGS / BADGES ── */
.tag {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 10px;
  font-size: 11px; font-weight: 500;
  white-space: nowrap;
}
.tag-rose { background: var(--rose-light); color: var(--rose-dark); }
.tag-teal { background: var(--teal-light); color: var(--teal); }
.tag-amber { background: var(--amber-light); color: var(--amber); }
.tag-success { background: var(--success-light); color: var(--success); }
.tag-danger { background: var(--danger-light); color: var(--danger); }
.tag-gray { background: #f0ece8; color: var(--ink-muted); }

/* ── FORM ── */
.form-group { margin-bottom: 14px; }
.form-label { font-size: 12px; font-weight: 500; color: var(--ink-soft); margin-bottom: 5px; display: block; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.15s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px rgba(181,68,110,0.08);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,17,24,0.45);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%; max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(26,17,24,0.2);
}
.modal-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--ink); }
.modal-body { padding: 20px 22px; }
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ── CHAT / AI ── */
.chat-wrap { display: flex; flex-direction: column; height: 460px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.chat-msg { display: flex; gap: 10px; max-width: 80%; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-bubble {
  padding: 10px 14px; border-radius: 16px;
  font-size: 13px; line-height: 1.5;
}
.chat-msg.bot .chat-bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-msg.user .chat-bubble { background: var(--rose); color: white; border-bottom-right-radius: 4px; }
.chat-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--rose-light); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 500; color: var(--rose); flex-shrink: 0; margin-top: 2px; }
.chat-input-row { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.chat-input-row input { flex: 1; }
.typing-dots { display: flex; gap: 4px; align-items: center; padding: 4px 0; }
.typing-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-muted); animation: bounce 1.2s infinite; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)}30%{transform:translateY(-5px)} }

/* ── DOSSIER ── */
.dossier-header {
  background: linear-gradient(135deg, var(--rose) 0%, var(--rose-dark) 100%);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 22px 24px;
  color: white;
  display: flex; align-items: center; gap: 16px;
}
.dossier-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 20px; font-weight: 600;
}
.dossier-name { font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.dossier-meta { font-size: 12px; opacity: 0.85; margin-top: 2px; }
.dossier-tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--white); }
.dossier-tab { padding: 12px 18px; font-size: 13px; cursor: pointer; color: var(--ink-muted); border-bottom: 2px solid transparent; transition: all 0.15s; font-weight: 400; }
.dossier-tab.active { color: var(--rose); border-bottom-color: var(--rose); font-weight: 500; }
.dossier-tab:hover { color: var(--rose); }
.dossier-body { padding: 20px; }

/* ── AI BADGE ── */
.ai-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: linear-gradient(90deg, #7c3aed, var(--rose));
  color: white; font-size: 10px; font-weight: 500;
  padding: 2px 9px; border-radius: 10px;
  letter-spacing: 0.03em;
}

/* ── CAISSE ── */
.payment-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 16px; }
.payment-btn {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center; cursor: pointer;
  transition: all 0.15s; background: var(--white);
}
.payment-btn:hover, .payment-btn.selected { border-color: var(--rose); background: var(--rose-pale); }
.payment-btn .p-icon { font-size: 22px; margin-bottom: 5px; }
.payment-btn .p-name { font-size: 12px; font-weight: 500; color: var(--ink-soft); }

/* ── MISC ── */
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--ink); }

.alert {
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 12px; margin-bottom: 12px;
  display: flex; align-items: flex-start; gap: 8px;
}
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fcd34d; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #6ee7b7; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

.divider { height: 1px; background: var(--line); margin: 14px 0; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-muted); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 10px; opacity: 0.4; }
.empty-state p { font-size: 13px; }

.progress-bar { height: 5px; background: var(--line); border-radius: 10px; overflow: hidden; margin-top: 6px; }
.progress-fill { height: 100%; border-radius: 10px; background: var(--rose); transition: width 0.3s; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .queue-grid { grid-template-columns: 1fr; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.sidebar-open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .main-layout { margin-left: 0; }
  .sidebar-hamburger { display: inline-flex; align-items: center; justify-content: center; }
  .sidebar-overlay {
    display: block;
    position: fixed; inset: 0;
    background: rgba(26,17,24,0.35);
    z-index: 90;
  }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
}

/* ── ANIMATIONS ── */
.fade-in { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:0.6} }

.online-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); display: inline-block;
  animation: pulse 2s infinite;
}

/* ── Génération de documents (devis / facture) : aperçu à l'écran + mise en page d'impression ── */
.doc-overlay { align-items: flex-start; overflow-y: auto; }
.doc-wrap { width: 100%; max-width: 760px; margin: 0 auto; }
.doc-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; padding: 10px 14px; flex-wrap: wrap; }
.doc-sheet { background: #fff; color: #1a1118; padding: 32px 36px; border: 1px solid var(--line); border-top: none; font-size: 13px; }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid var(--rose); padding-bottom: 14px; margin-bottom: 18px; }
.doc-clinic { font-family: var(--font-display); font-size: 22px; color: var(--rose); }
.doc-title { font-family: var(--font-display); font-size: 22px; letter-spacing: 2px; }
.doc-num { font-family: monospace; font-size: 12px; color: var(--ink-muted); }
.doc-sub { font-size: 12px; color: var(--ink-muted); }
.doc-label { font-size: 10px; text-transform: uppercase; letter-spacing: .6px; color: var(--ink-muted); }
.doc-meta { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.doc-table th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-muted); border-bottom: 1px solid var(--line); padding: 8px 6px; }
.doc-table td { padding: 9px 6px; border-bottom: 1px solid var(--line); }
.doc-table tfoot td { border-bottom: none; padding-top: 14px; }
.doc-foot { border-top: 1px solid var(--line); padding-top: 12px; }
.doc-mention { margin-top: 24px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 9px; line-height: 1.5; color: var(--ink-muted); }
.pay-bloc { margin-top: 10px; padding: 12px 14px; border: 1px dashed var(--teal); border-radius: 10px; font-size: 13px; }
.pay-titre { font-weight: 600; margin-bottom: 6px; }
.pay-liste { margin: 0 0 8px; padding-left: 18px; line-height: 1.6; }
.pay-num { font-family: monospace; font-weight: 600; white-space: nowrap; }
.pay-ref { font-size: 12px; color: var(--ink-muted); }
@media (max-width: 600px) { .doc-sheet { padding: 20px 16px; } .doc-head, .doc-meta { flex-direction: column; } .doc-head > div:last-child, .doc-meta > div:last-child { text-align: left !important; } .doc-overlay { padding: 8px; } }
@media print {
  body.printing-doc > #root { display: none !important; }
  body.printing-doc .doc-overlay { position: static; background: none; padding: 0; display: block; overflow: visible; }
  body.printing-doc .doc-toolbar { display: none; }
  body.printing-doc .doc-wrap { max-width: none; }
  body.printing-doc .doc-sheet { border: none; padding: 0; }
  @page { size: A4; margin: 16mm; }
}

/* ── Écran de connexion ── */
.login-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; background: linear-gradient(160deg, var(--rose-pale) 0%, var(--surface) 60%); }
.login-card { width: 100%; max-width: 400px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(181,68,110,0.12); padding: 28px 28px 24px; }
.login-brand { text-align: center; margin-bottom: 18px; }
.login-logo { font-family: var(--font-display); font-size: 28px; font-weight: 600; color: var(--rose); }
.login-sub { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); margin-top: 2px; }
.login-titre { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin: 0 0 4px; }
.login-intro { font-size: 13px; color: var(--ink-muted); margin: 0 0 16px; }
.login-mdp { position: relative; }
.login-mdp .form-input { padding-right: 46px; }
.login-oeil { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-width: 40px; min-height: 36px; }
.login-btn { width: 100%; justify-content: center; min-height: 44px; font-size: 14px; margin-top: 6px; }
.login-aide { font-size: 12px; color: var(--ink-muted); margin-top: 6px; }
.login-demo { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 12px; font-size: 12px; color: var(--ink-muted); }
.login-demo summary { cursor: pointer; font-weight: 500; color: var(--ink); }
.login-demo p { margin: 8px 0; line-height: 1.45; }
.login-demo table { width: 100%; border-collapse: collapse; }
.login-demo th, .login-demo td { text-align: left; padding: 4px 6px 4px 0; border-bottom: 1px solid var(--line); }
.login-demo code { font-size: 11px; background: var(--surface); padding: 1px 4px; border-radius: 4px; }
.login-pied { max-width: 520px; margin-top: 20px; text-align: center; font-size: 10px; line-height: 1.5; color: var(--ink-muted); }
.btn-ghost.btn-sm.deconnexion { width: 100%; justify-content: center; margin-top: 8px; }

/* Texte réservé aux lecteurs d'écran */
.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; }

/* Accessibilité : focus visible au clavier, mouvement réduit, cibles tactiles confortables */
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.dossier-tab:focus-visible, .payment-btn:focus-visible, [data-clic]:focus-visible { outline-offset: -2px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; } }
@media (pointer: coarse) {
  .btn, .btn-sm, .nav-item, .form-input, .form-select, .dossier-tab, .payment-btn, .sidebar-close, .sidebar-hamburger { min-height: 44px; }
  .btn-sm { padding-top: 10px; padding-bottom: 10px; }
  .btn.btn-sm.deconnexion { min-height: 44px; }
  input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; }
}

/* ── Mobile (≤ 768 px) : rien ne doit déborder de l'écran ; les tableaux défilent horizontalement ── */
@media (max-width: 768px) {
  .page-content { padding: 16px 12px; }
  .stats-grid > *, .grid-2 > *, .grid-3 > *, .queue-grid > * { min-width: 0; }
  .stats-grid[style*="grid-template-columns"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .grid-2[style*="grid-template-columns"], .grid-3[style*="grid-template-columns"], .queue-grid[style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  .data-table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table th, .data-table td { white-space: nowrap; }
  .card-header { flex-wrap: wrap; gap: 8px; }
  .dossier-tabs { overflow-x: auto; flex-wrap: nowrap; }
  .dossier-tab { white-space: nowrap; flex: 0 0 auto; }
  .topbar { gap: 6px; }
  .topbar-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions { gap: 6px; flex-shrink: 0; }
  .stat-value { overflow-wrap: anywhere; }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .modal { max-width: 100vw; }
  .page-content [style*="display: flex"] { flex-wrap: wrap; }   /* barres d'outils (filtre + boutons) : retour à la ligne plutôt que débordement */
  .page-content [style*="display: flex"] > .form-input { min-width: 0; }
}
@media (max-width: 480px) { .lbl-long { display: none; } }
@media (max-width: 600px) {
  .modal [style*="minmax(0, 2fr) minmax(0, 2fr)"] { grid-template-columns: minmax(0, 1fr) auto !important; }   /* lignes d'ordonnance : médicament / posologie / durée empilés */
  .modal [style*="minmax(0, 2fr) minmax(0, 2fr)"] > input:nth-child(1) { grid-column: 1 / -1; }
}

/* Page de connexion v0.11 — deux volets, inspirée de la maquette validée */
.login-page { background: radial-gradient(circle at 8% 90%, #f3d3dc 0, transparent 38%), radial-gradient(circle at 96% 6%, #f6dde2 0, transparent 30%), #fbf6f1; }
.login-split { width: 100%; max-width: 1060px; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); border-radius: 22px; overflow: hidden; background: #fff; box-shadow: 0 24px 70px rgba(110,30,60,0.16); }
.login-hero { position: relative; padding: 44px 40px 0; min-height: 600px; background: linear-gradient(160deg, #fbe9ec 0%, #f7dde3 100%); overflow: hidden; }
.login-marque { display: flex; align-items: center; gap: 12px; color: #7a2250; }
.login-marque-fleur { display: inline-flex; }
.login-marque-nom { display: block; font-family: var(--font-display); font-size: 30px; font-weight: 500; color: #5c1238; line-height: 1.1; }
.login-marque-sub { display: block; font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: #8a6a76; margin-top: 3px; }
.login-hero-titre { font-family: var(--font-display); font-size: clamp(30px, 3.4vw, 42px); font-weight: 500; line-height: 1.1; color: #5c1238; margin: 40px 0 14px; position: relative; z-index: 2; }
.login-hero-texte { font-size: 15px; line-height: 1.55; color: #5e4a54; max-width: 300px; margin: 0 0 26px; position: relative; z-index: 2; }
.login-hero-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; position: relative; z-index: 2; max-width: 210px; }
.login-hero-liste li { display: flex; align-items: center; gap: 14px; font-size: 13.5px; line-height: 1.35; color: #3d2a33; }
.login-puce { width: 48px; height: 48px; border-radius: 50%; background: rgba(224,150,172,0.28); color: #7a2250; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.login-photo { position: absolute; right: 0; bottom: 0; width: min(54%, 340px); height: auto; z-index: 1; -webkit-mask-image: linear-gradient(to right, transparent 0, #000 26%), linear-gradient(to bottom, transparent 0, #000 16%); -webkit-mask-composite: source-in; mask-image: linear-gradient(to right, transparent 0, #000 26%), linear-gradient(to bottom, transparent 0, #000 16%); mask-composite: intersect; }
.login-split .login-card { max-width: none; box-shadow: none; border: 0; border-radius: 0; padding: 40px 44px 30px; display: flex; flex-direction: column; justify-content: center; }
.login-eyebrow { font-size: 11.5px; letter-spacing: 0.2em; text-transform: uppercase; color: #6b6a55; padding-bottom: 8px; margin-bottom: 22px; position: relative; }
.login-eyebrow::after { content: ""; position: absolute; left: 0; bottom: 0; width: 48px; height: 1px; background: #c98aa0; }
.login-onglets { display: grid; grid-template-columns: 1fr 1fr; gap: 0; background: #fbeff1; padding: 0; border-radius: 10px; margin-bottom: 24px; overflow: hidden; }
.login-onglets button { min-height: 48px; border: 0; background: transparent; border-radius: 10px; font: inherit; font-size: 14px; font-weight: 500; color: #5c1238; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.login-onglets button.actif { background: #8a2a55; color: #fff; box-shadow: 0 4px 12px rgba(138,42,85,0.3); }
.login-titre { font-family: var(--font-display); font-size: 36px; font-weight: 500; color: #4a0f2e; margin: 0 0 4px; }
.login-intro { font-size: 15px; color: #6a5a62; margin: 0 0 20px; }
.login-champ { position: relative; }
.login-champ .form-input { padding-left: 44px; min-height: 50px; border-radius: 10px; background: #fff; }
.login-champ-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #5c4a54; display: inline-flex; pointer-events: none; }
.login-mdp .form-input { padding-right: 48px; }
.login-oubli { text-align: right; font-size: 12.5px; color: #6a5a62; margin-top: 8px; }
.login-oubli span { color: #8a2a55; text-decoration: underline; }
.login-btn { background: #8a2a55; border-color: #8a2a55; border-radius: 10px; min-height: 52px; font-size: 16px; margin-top: 8px; box-shadow: 0 6px 16px rgba(138,42,85,0.28); }
.login-btn:hover:not(:disabled) { background: #74204a; border-color: #74204a; }
.login-demo { margin-top: 22px; border: 1px solid #ecdfe2; border-radius: 12px; padding: 0; background: #fffafa; }
.login-demo summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; min-height: 56px; }
.login-demo summary::-webkit-details-marker { display: none; }
.login-demo-ico { color: #4a3a42; display: inline-flex; }
.login-demo-txt { display: flex; flex-direction: column; flex: 1; font-size: 13px; color: #2d2128; }
.login-demo-txt small { font-size: 11.5px; color: #6a5a62; font-weight: 400; }
.login-demo-pastille { font-size: 12px; background: #e6eddc; color: #3f5230; padding: 6px 12px; border-radius: 8px; white-space: nowrap; }
.login-demo p, .login-demo .login-comptes { margin-left: 16px; margin-right: 16px; }
.login-demo .login-comptes { margin-bottom: 16px; }
.login-demo p { margin-top: 0; }
.login-comptes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.login-compte { text-align: left; padding: 8px 10px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 2px; }
.login-compte:hover { border-color: #8a2a55; background: #fbeff1; }
.login-compte-role { font-size: 12px; font-weight: 600; color: var(--ink); }
.login-patdemo { margin-top: 16px; padding: 10px 12px; border-radius: 10px; background: #fbeff1; font-size: 12px; line-height: 1.5; }
.login-patdemo code { background: #fff; padding: 1px 5px; border-radius: 4px; }
@media (max-width: 860px) { .login-split { grid-template-columns: minmax(0, 1fr); } .login-hero { display: none; } .login-split .login-card { padding: 28px 22px 24px; } .login-titre { font-size: 30px; } }

/* Suivi de grossesse (v0.11) */
.gr-barre { position: relative; display: grid; grid-template-columns: 14fr 14fr 12fr; height: 12px; border-radius: 6px; overflow: hidden; margin-top: 6px; }
.gr-barre-t1 { background: #f5dce6; } .gr-barre-t2 { background: #ecb7cb; } .gr-barre-t3 { background: #dc8aa9; }
.gr-curseur { position: absolute; top: -3px; width: 4px; height: 18px; background: #8a2a55; border-radius: 2px; transform: translateX(-2px); }
.gr-barre-lib { display: grid; grid-template-columns: 14fr 14fr 12fr; font-size: 10px; color: var(--ink-muted); margin-top: 3px; }
.gr-grille { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.gr-contact { border: 1px solid var(--line); border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.gr-contact.gr-fait { background: #eef7f2; border-color: #bfdccb; } .gr-contact.gr-maintenant { background: #fff7e6; border-color: #f0d28a; } .gr-contact.gr-manque { background: #fdeef2; border-color: #eaa9bd; }
.gr-examens { display: grid; gap: 6px; }
.gr-examen { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.gr-cpn { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
@media (max-width: 600px) { .gr-grille { grid-template-columns: repeat(2, minmax(0, 1fr)); } .gr-examen { flex-wrap: wrap; } }

/* Suggestions (v0.11) */
.aide-sugg { border: 1px dashed var(--rose); background: var(--rose-pale); border-radius: 10px; padding: 10px 12px; margin: 10px 0; }

/* Rappels (v0.11) */
.rappel-ligne { display: flex; gap: 16px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; align-items: flex-start; }
.rappel-ligne:last-child { border-bottom: 0; }
.rappel-msg { margin-top: 8px; padding: 8px 10px; background: var(--surface); border-radius: 8px; font-size: 12px; line-height: 1.5; color: var(--ink-muted); }
.rappel-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* Connexion — pleine page (v0.11.1) : plus de cadre flottant, l'illustration s'ancre dans le panneau et se fond dans son fond */
.login-page { padding: 0; justify-content: flex-start; align-items: stretch; background: #fff; }
.login-split { max-width: none; flex: 1 1 auto; border-radius: 0; box-shadow: none; min-height: 0; }
.login-hero { padding: clamp(32px, 5vw, 64px) clamp(28px, 4.5vw, 72px) 0; min-height: 0; background: radial-gradient(ellipse 70% 60% at 78% 82%, #fff3f4 0%, rgba(255,243,244,0) 70%), linear-gradient(160deg, #fbe9ec 0%, #f6d9e0 100%); }
.login-hero::before { content: ""; position: absolute; right: -8%; bottom: -6%; width: 78%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,0.75) 0%, rgba(255,255,255,0) 68%); z-index: 0; pointer-events: none; }
.login-photo { width: min(64%, 480px); right: 0; bottom: 0; -webkit-mask-image: linear-gradient(to right, transparent 0, #000 30%), linear-gradient(to bottom, transparent 0, #000 22%); mask-image: linear-gradient(to right, transparent 0, #000 30%), linear-gradient(to bottom, transparent 0, #000 22%); filter: saturate(1.03); }
.login-split .login-card { padding: clamp(32px, 5vw, 64px) clamp(28px, 5vw, 80px) 24px; max-width: 640px; width: 100%; margin: 0 auto; }
.login-pied { max-width: none; margin: 0; padding: 12px 24px; background: #fbf3f5; border-top: 1px solid #f0dde2; min-height: 72px; box-sizing: border-box; }
@media (max-width: 860px) { .login-split { min-height: 0; } .login-split .login-card { max-width: none; } }

/* Accessibilité (v0.11.2) : lien d'évitement, zone principale, cibles tactiles sur écrans tactiles */
.lien-evitement { position: absolute; left: 8px; top: -60px; z-index: 1000; background: #8a2a55; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 14px; text-decoration: none; }
.lien-evitement:focus { top: 8px; }
main.page-content:focus { outline: none; }
@media (pointer: coarse) { .btn, .btn-sm, .nav-item, .form-input, .form-select, .dossier-tab, .payment-btn, .sidebar-close, .sidebar-hamburger, .topbar-actions button { min-height: 44px; } }

/* Bandeau de démonstration (v0.12) */
.bandeau-demo { background: #fff4d6; color: #6b4e00; border-bottom: 1px solid #f0dc9a; font-size: 12px; line-height: 1.4; padding: 6px 12px; text-align: center; }

.bandeau-erreur{display:flex;align-items:center;justify-content:space-between;gap:12px;background:var(--danger-light);color:var(--danger);border:1px solid #fecaca;border-radius:10px;padding:10px 14px;margin:0 0 12px;font-size:14px}

/* Hospitalisation : boutons des lits adaptés au tactile */
.lit-actions .btn, .vac-haut .btn { min-height: 44px; min-width: 44px; }

/* ── VACCINS ET RAPPELS (page du cabinet) ── */
.vs-page { max-width: 1100px; margin: 0 auto; width: 100%; }
.vs-haut { display: flex; justify-content: space-between; align-items: center; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 18px; }
.vs-intro { margin: 0; flex: 1 1 320px; color: var(--ink-soft); font-size: 14px; line-height: 1.5; }
.vs-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.vs-stat { background: var(--white); border: 1px solid var(--line); border-top: 3px solid var(--rose); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); }
.vs-stat-amber { border-top-color: var(--amber); } .vs-stat-teal { border-top-color: var(--teal); }
.vs-stat-success { border-top-color: var(--success); } .vs-stat-danger { border-top-color: var(--danger); }
.vs-stat-n { font-family: var(--font-display); font-size: 28px; font-weight: 600; line-height: 1; color: var(--ink); }
.vs-stat-l { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); margin-top: 6px; }
.vs-filtres { display: flex; gap: 8px; margin: 0 0 16px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.vs-filtre { flex: 0 0 auto; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); color: var(--ink-soft); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.vs-filtre:hover { border-color: var(--rose-light); background: var(--rose-pale); }
.vs-filtre.actif { background: var(--rose); border-color: var(--rose); color: #fff; font-weight: 500; }
.vs-liste { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.vs-carte { background: var(--white); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.vs-carte.vs-ok { border-left-color: var(--success); } .vs-carte.vs-confirmer { border-left-color: var(--amber); } .vs-carte.vs-passe { border-left-color: var(--danger); }
.vs-carte-haut { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.vs-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--rose-light); color: var(--rose-dark); display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 18px; flex: 0 0 auto; }
.vs-id { flex: 1 1 160px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.vs-id strong { font-size: 16px; color: var(--ink); } .vs-id span { font-size: 12px; color: var(--ink-muted); }
.vs-rdv { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; }
.vs-rdv-date { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--ink); } .vs-rdv-date small { font-family: var(--font-body); font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.vs-rdv-det { font-size: 13px; color: var(--ink-soft); margin-top: 2px; overflow-wrap: anywhere; }
.vs-note { font-size: 13px; line-height: 1.5; color: var(--ink-soft); background: var(--surface); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px; }
.vs-note-danger { background: var(--danger-light); color: var(--danger); }
.vs-carte .vs-note { margin-bottom: 0; }
.vs-detail { font-size: 13px; color: var(--ink-muted); margin: 0; }
.vs-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.vs-actions .btn { flex: 0 1 auto; }
.vs-danger { color: var(--danger); } .vs-danger:hover { background: var(--danger-light); border-color: var(--danger); color: var(--danger); }
.vs-hist { font-size: 13px; color: var(--ink-soft); } .vs-hist summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; font-weight: 500; } .vs-hist ul { margin: 4px 0 0; padding-left: 20px; }
.vs-vide { background: var(--white); border: 1px dashed var(--line); border-radius: var(--radius); padding: 32px 16px; text-align: center; color: var(--ink-muted); }
.vs-panneau { padding: 18px 20px; margin-top: 20px; }
.vs-titre { margin: 0 0 12px; font-family: var(--font-display); font-size: 18px; color: var(--ink); }
.vs-panneau ul { margin: 8px 0 0; padding-left: 20px; line-height: 1.7; font-size: 14px; }
.vs-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.vs-table td { padding: 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
@media (max-width: 900px) { .vs-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .vs-liste { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .vs-actions .btn { flex: 1 1 calc(50% - 8px); justify-content: center; white-space: normal; text-align: center; min-width: 0; }
  .vs-actions .btn-primary { flex-basis: 100%; }
  .vs-rdv-date { font-size: 20px; } .vs-panneau { padding: 16px; }
  .vs-table, .vs-table thead, .vs-table tbody, .vs-table tr, .vs-table td { display: block; }
  .vs-table thead { position: absolute; left: -9999px; }
  .vs-table tr { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; padding: 6px 10px; }
  .vs-table td { border: 0; padding: 3px 0; }
}

/* Téléphone : le titre de la page passe avant les raccourcis (WhatsApp reste accessible par le menu). */
@media (max-width: 640px) {
  .topbar-actions button[aria-label="WhatsApp"] { display: none; }
  .topbar-title { font-size: 17px; }
}
