/* ============================================================
   ORDONNANCE.MA — Charte graphique médicale v2.0
   Police : Poppins (titres/UI) + Inter (corps)
   Design : Professionnel médical, sobre, mobile-first
============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Poppins:wght@500;600;700&display=swap');

/* ---------- VARIABLES ---------- */
:root {
  --primary:       #1d4ed8;
  --primary-dk:    #1e40af;
  --primary-lt:    #dbeafe;
  --secondary:     #0891b2;
  --accent:        #10b981;
  --accent-lt:     #d1fae5;
  --danger:        #ef4444;
  --warning:       #f59e0b;

  --bg:            #f8fafc;
  --bg-alt:        #f1f5f9;
  --surface:       #ffffff;
  --border:        #e2e8f0;
  --border-dk:     #cbd5e1;

  --text:          #0f172a;
  --text-md:       #334155;
  --text-muted:    #64748b;
  --text-light:    #94a3b8;

  --radius-sm:     6px;
  --radius:        12px;
  --radius-lg:     18px;
  --radius-xl:     24px;

  --shadow-sm:     0 1px 3px rgba(0,0,0,.08);
  --shadow:        0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:     0 8px 32px rgba(0,0,0,.12);
  --shadow-primary:0 4px 20px rgba(29,78,216,.25);

  --font-ui:       'Poppins', system-ui, sans-serif;
  --font-body:     'Inter', system-ui, sans-serif;

  --header-h:      64px;
  --max-w:         1200px;
  --max-w-md:      860px;
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
ul, ol { list-style: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* ---------- UTILITAIRES ---------- */
.container    { max-width: var(--max-w); margin: 0 auto; padding: 0 20px; }
.container-md { max-width: var(--max-w-md); margin: 0 auto; padding: 0 20px; }
.sr-only      { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; }
.hidden       { display: none !important; }
.text-center  { text-align: center; }
.text-muted   { color: var(--text-muted); }
.flex         { display: flex; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.gap-1        { gap: 8px; }
.gap-2        { gap: 16px; }
.gap-3        { gap: 24px; }
.mt-1         { margin-top: 8px; }
.mt-2         { margin-top: 16px; }
.mt-3         { margin-top: 24px; }
.mt-4         { margin-top: 32px; }
.mb-1         { margin-bottom: 8px; }
.mb-2         { margin-bottom: 16px; }
.mb-3         { margin-bottom: 24px; }

/* ---------- BOUTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .9rem;
  border: 2px solid transparent;
  transition: all .18s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn--primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn--primary:hover {
  background: var(--primary-dk);
  border-color: var(--primary-dk);
  box-shadow: var(--shadow-primary);
  transform: translateY(-1px);
}
.btn--ghost {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn--ghost:hover {
  background: var(--primary-lt);
}
.btn--white {
  background: #fff;
  color: var(--primary);
  border-color: #fff;
}
.btn--white:hover {
  background: var(--primary-lt);
}
.btn--sm  { padding: 7px 14px; font-size: .82rem; border-radius: var(--radius-sm); }
.btn--lg  { padding: 14px 28px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn--danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn--danger:hover { background: #dc2626; }
.btn--full { width: 100%; justify-content: center; }

/* ---------- HEADER ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.site-header__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}
.site-header__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.site-header__logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.site-header__logo-icon svg { color: #fff; }
.site-header__brand {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--primary-dk);
}
.site-header__brand span { color: var(--secondary); }

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.site-nav__link {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: .88rem;
  color: var(--text-md);
  transition: all .15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.site-nav__link:hover,
.site-nav__link.active {
  background: var(--primary-lt);
  color: var(--primary);
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.site-header__user {
  font-size: .85rem;
  color: var(--text-muted);
  font-weight: 500;
  padding: 0 4px;
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 6px;
  border-radius: var(--radius-sm);
  margin-left: auto;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: .2s;
}

/* Mobile nav drawer */
.mobile-nav {
  display: none;
  position: fixed;
  inset: var(--header-h) 0 0 0;
  background: #f8fafc;
  z-index: 99;
  padding: 16px;
  flex-direction: column;
  gap: 7px;
  border-top: 1px solid var(--border);
  overflow-y: auto;
}
.mobile-nav.open { display: flex; }
.mobile-nav__link {
  display: flex;
  align-items: center;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: 10px;
  background: var(--surface);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .95rem;
  color: var(--text-md);
  transition: background .15s, color .15s, border-color .15s;
}
.mobile-nav__link:hover {
  background: var(--primary-lt);
  border-color: var(--primary);
  color: var(--primary-dk);
}
.mobile-nav__link.active {
  background: var(--primary-lt);
  border-color: var(--primary);
  border-left-color: var(--primary);
  color: var(--primary-dk);
}
.mobile-nav__divider { height: 1px; background: var(--border); margin: 10px 2px; }

/* Boutons d'authentification du menu mobile */
.mobile-nav__btn {
  display: block;
  text-align: center;
  padding: 13px 16px;
  border-radius: 10px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: .95rem;
  transition: background .15s, color .15s, border-color .15s;
}
.mobile-nav__btn--primary { background: var(--primary); color: #fff; }
.mobile-nav__btn--primary:hover { background: var(--primary-dk); }
.mobile-nav__btn--ghost { border: 1.5px solid var(--primary); color: var(--primary); background: var(--surface); }
.mobile-nav__btn--ghost:hover { background: var(--primary-lt); }
.mobile-nav__link--logout { color: var(--danger); }
.mobile-nav__link--logout:hover { background: #fef2f2; border-color: var(--danger); color: var(--danger); }

/* ---------- FOOTER ---------- */
.site-footer {
  background: #0f172a;
  color: #94a3b8;
  margin-top: auto;
}
.site-footer__main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 48px 20px 32px;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1.8fr 1fr;
  gap: 40px;
}
.site-footer__brand { }
.site-footer__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.site-footer__logo-icon {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.site-footer__logo-icon svg { color: #fff; }
.site-footer__logo-text {
  font-family: var(--font-ui);
  font-weight: 700;
  color: #f1f5f9;
  font-size: 1.05rem;
}
.site-footer__desc {
  font-size: .85rem;
  line-height: 1.7;
  max-width: 280px;
}
.site-footer__col h4 {
  font-family: var(--font-ui);
  font-size: .85rem;
  font-weight: 600;
  color: #e2e8f0;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 14px;
}
.site-footer__col a {
  display: block;
  font-size: .85rem;
  padding: 3px 0;
  transition: color .15s;
}
.site-footer__col a:hover { color: #f1f5f9; }
/* Liste « Spécialités » : toutes les spécialités sur 2 sous-colonnes */
.site-footer__specs { columns: 2; column-gap: 28px; }
.site-footer__specs a { break-inside: avoid; }
.site-footer__specs-all { margin-top: 12px; font-weight: 600; color: #cbd5e1; }
.site-footer__specs-all:hover { color: #f1f5f9; }
@media (max-width: 480px) { .site-footer__specs { columns: 1; } }
.site-footer__bottom {
  border-top: 1px solid #1e293b;
  padding: 16px 20px;
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .8rem;
  flex-wrap: wrap;
  gap: 8px;
}
.site-footer__bottom a { color: #64748b; }
.site-footer__bottom a:hover { color: #94a3b8; }

/* ---------- BREADCRUMB ---------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: var(--text-muted);
  padding: 12px 0;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb__sep { color: var(--text-light); }

/* ---------- CARDS ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .2s, border-color .2s;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-dk);
}
.card--primary { border-left: 4px solid var(--primary); }
.card--accent   { border-left: 4px solid var(--accent); }
.card--flat     { box-shadow: none; }

/* ---------- BADGES ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: .75rem;
  font-weight: 600;
  font-family: var(--font-ui);
}
.badge--primary { background: var(--primary-lt); color: var(--primary-dk); }
.badge--green   { background: var(--accent-lt);  color: #065f46; }
.badge--gray    { background: var(--bg-alt);      color: var(--text-muted); }
.badge--blue    { background: #e0f2fe;            color: #0369a1; }

/* ---------- FORMS ---------- */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-family: var(--font-ui);
  font-weight: 500;
  font-size: .87rem;
  color: var(--text-md);
  margin-bottom: 6px;
}
.form-label .required { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29,78,216,.12);
}
.form-control::placeholder { color: var(--text-light); }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
.form-hint  { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: .82rem; color: var(--danger); margin-top: 4px; }

.form-check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.form-check input { width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; }
.form-check span { font-size: .9rem; color: var(--text-md); }

/* ---------- ALERTS ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: .9rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-left: 4px solid;
}
.alert--success { background: var(--accent-lt);  border-color: var(--accent);  color: #064e3b; }
.alert--error   { background: #fee2e2;           border-color: var(--danger);  color: #7f1d1d; }
.alert--info    { background: var(--primary-lt); border-color: var(--primary); color: #1e3a8a; }
.alert--warning { background: #fef3c7;           border-color: var(--warning); color: #78350f; }

/* ---------- SECTION TITLES ---------- */
.section-title {
  font-family: var(--font-ui);
  font-size: clamp(1.4rem, 2.5vw, 1.9rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.section-subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.6;
}
.section-eyebrow {
  font-family: var(--font-ui);
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--primary);
  margin-bottom: 8px;
}

/* ---------- HOMEPAGE HERO ---------- */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 40%, #0891b2 100%);
  color: #fff;
  padding: 80px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero__inner { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; }
.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  padding: 5px 14px;
  border-radius: 100px;
  font-size: .82rem;
  font-weight: 600;
  font-family: var(--font-ui);
  margin-bottom: 20px;
  letter-spacing: .04em;
}
.hero h1 {
  font-family: var(--font-ui);
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 18px;
  color: #fff;
}
.hero h1 span { color: #7dd3fc; }
.hero__sub {
  font-size: clamp(.95rem, 2vw, 1.1rem);
  color: rgba(255,255,255,.85);
  line-height: 1.7;
  max-width: 580px;
  margin: 0 auto 32px;
}
.hero__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.hero__search {
  max-width: 520px;
  margin: 32px auto 0;
  display: flex;
  gap: 0;
}
.hero__search-input {
  flex: 1;
  padding: 14px 18px;
  border: none;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  font-size: 1rem;
  outline: none;
  color: var(--text);
}
.hero__search-btn {
  padding: 14px 22px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .95rem;
  transition: background .15s;
}
.hero__search-btn:hover { background: #059669; }

/* ---------- STATS BAND ---------- */
.stats-band {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 28px 20px;
}
.stats-band__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-item__value {
  font-family: var(--font-ui);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-item__label {
  font-size: .82rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ---------- SECTIONS HOMEPAGE ---------- */
.section { padding: 64px 20px; }
.section--alt { background: var(--bg-alt); }
.section--dark { background: #0f172a; color: #f1f5f9; }

.specialites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 32px;
}
.specialite-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  text-align: center;
  transition: all .15s;
  text-decoration: none;
  color: var(--text);
}
.specialite-card:hover {
  border-color: var(--primary);
  background: var(--primary-lt);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.specialite-card__icon {
  width: 48px; height: 48px;
  background: var(--primary-lt);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px;
  font-size: 1.5rem;
}
.specialite-card:hover .specialite-card__icon { background: var(--primary); }
.specialite-card:hover .specialite-card__icon svg { color: #fff !important; }
.specialite-card__name {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .88rem;
  color: var(--text-md);
}
.specialite-card:hover .specialite-card__name { color: var(--primary-dk); }
.specialite-card__count {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Steps */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-top: 40px;
}
.step {
  text-align: center;
  padding: 32px 24px;
  background: var(--surface);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  position: relative;
}
.step__num {
  width: 48px; height: 48px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1.2rem;
  margin: 0 auto 16px;
}
.step__title {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 8px;
}
.step__desc { font-size: .9rem; color: var(--text-muted); }

/* Audience cards */
.audience-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 32px;
}
.audience-card {
  padding: 32px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.audience-card--primary { background: linear-gradient(135deg, #1d4ed8, #0891b2); color: #fff; border: none; }
.audience-card--green   { background: linear-gradient(135deg, #059669, #10b981); color: #fff; border: none; }
.audience-card__icon { font-size: 2.5rem; margin-bottom: 16px; }
.audience-card__title { font-family: var(--font-ui); font-size: 1.2rem; font-weight: 700; margin-bottom: 10px; }
.audience-card__desc  { font-size: .9rem; line-height: 1.7; opacity: .9; }

/* Ordonnances grid */
.ordonnances-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 28px;
}
.ordonnance-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: all .15s;
  text-decoration: none;
  display: block;
}
.ordonnance-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.ordonnance-card__spec {
  font-size: .75rem;
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 6px;
}
.ordonnance-card__name {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
  line-height: 1.35;
}

/* ---------- PAGE ORDONNANCES (liste) ---------- */
.page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 24px 0;
}
.page-header__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}
.page-header h1 {
  font-family: var(--font-ui);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.page-header p { color: var(--text-muted); font-size: .95rem; }

.search-bar-wrap {
  position: sticky;
  top: var(--header-h);
  z-index: 50;
  background: rgba(248,250,252,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
}
.search-bar {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s;
}
.search-bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(29,78,216,.1);
}
.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: .95rem;
  color: var(--text);
}
.search-bar input::placeholder { color: var(--text-light); }
.search-bar svg { color: var(--text-muted); flex-shrink: 0; }
.search-bar__clear {
  background: var(--bg-alt);
  color: var(--text-muted);
  border: none;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-family: var(--font-ui);
  font-weight: 500;
  transition: background .15s;
}
.search-bar__clear:hover { background: var(--border); }
.search-meta {
  max-width: var(--max-w);
  margin: 8px auto 0;
  font-size: .82rem;
  color: var(--text-muted);
}

.patho-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 24px 20px;
  max-width: var(--max-w);
  margin: 0 auto;
}
.patho-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all .15s;
  overflow: hidden;
}
.patho-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: #bfdbfe;
}
.patho-item a {
  display: block;
  padding: 14px 16px;
  color: var(--text);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .9rem;
  line-height: 1.35;
}
.patho-item__spec {
  font-size: .72rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* ---------- PAGE ORDONNANCE (fiche) ---------- */
.ordo-page { max-width: var(--max-w-md); margin: 0 auto; padding: 24px 20px 48px; }

.ordo-title-section { margin-bottom: 28px; }
.ordo-title-section h1 {
  font-family: var(--font-ui);
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.ordo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.ordo-card__title {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.ordo-card__title::before {
  content: '';
  width: 12px; height: 12px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}

.med-list { counter-reset: med; }
.med-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  counter-increment: med;
  position: relative;
  padding-left: 32px;
}
.med-item::before {
  content: counter(med);
  position: absolute;
  left: 0;
  top: 18px;
  width: 22px; height: 22px;
  background: var(--primary-lt);
  color: var(--primary);
  border-radius: 50%;
  font-size: .75rem;
  font-weight: 700;
  font-family: var(--font-ui);
  display: flex; align-items: center; justify-content: center;
}
.med-item:last-child { border-bottom: none; }

/* ─── Nom médicament / molécule (liens discrets) ─── */
.med-item__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 6px;
}
.med-name {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: .98rem;
  color: var(--primary-dk);
}
.med-name a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  transition: text-decoration-color .15s;
}
.med-name a:hover { text-decoration-color: var(--primary); }
.med-forme {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: .98rem;
  color: var(--primary-dk);
  white-space: nowrap;
}
.med-mol {
  font-size: .85rem;
  color: var(--accent);
  font-style: italic;
}
.med-mol a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  transition: text-decoration-color .15s;
}
.med-mol a:hover { text-decoration-color: var(--accent); }
.med-poso {
  font-size: .9rem;
  color: var(--text-md);
  line-height: 1.6;
  padding: 6px 0;
}
.med-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.med-meta__ppv {
  background: #fef9c3;
  color: #78350f;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
}
.med-meta__forme,
.med-meta__classe {
  background: var(--bg-alt);
  color: var(--text-muted);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .78rem;
}

/* ─── Accordéons ─────────────────────────────────────────── */
.accordion-group { margin-top: 8px; }
.accordion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
  transition: box-shadow .2s;
}
.accordion:hover { box-shadow: var(--shadow-md); }
.accordion details {}
.accordion summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 20px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background .15s;
  position: relative;
}
.accordion summary:hover { background: var(--bg-alt); }
.accordion summary::-webkit-details-marker { display: none; }
.accordion__icon {
  flex-shrink: 0;
  width: 30px; height: 30px;
  background: var(--primary-lt);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  transition: background .18s, color .18s;
}
.accordion__icon svg {
  display: block;
  stroke: currentColor;
}
.accordion__label {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
  flex: 1;
}
.accordion summary::after {
  content: '';
  width: 20px; height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%231d4ed8' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  flex-shrink: 0;
  transition: transform .25s cubic-bezier(.4,0,.2,1);
  margin-left: auto;
}
details[open] > summary::after { transform: rotate(180deg); }
details[open] > summary {
  background: linear-gradient(90deg, var(--primary-lt) 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
}
details[open] > summary .accordion__icon {
  background: var(--primary);
  color: #fff;
}

.accordion__body {
  padding: 22px 24px;
  font-size: .92rem;
  line-height: 1.75;
  color: var(--text-md);
}
.accordion__body img { max-width: 100%; border-radius: var(--radius); margin-top: 16px; }

/* ─── Contenu formaté (modales + accordéons) ──────────────── */
.med-p {
  margin: 0 0 .8em;
  line-height: 1.75;
  color: var(--text-md);
}
.med-p:last-child { margin-bottom: 0; }

.med-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--primary);
  margin: 22px 0 10px;
  padding: 6px 12px;
  background: var(--primary-lt);
  border-radius: 6px;
}
.med-section-title:first-child { margin-top: 4px; }

.med-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

.med-ol, .med-ul {
  margin: 6px 0 14px 0;
  padding-left: 20px;
  line-height: 1.8;
}
.med-ol li, .med-ul li {
  margin-bottom: 5px;
  color: var(--text-md);
}
.med-ul { list-style: none; padding-left: 0; }
.med-ul li { padding-left: 18px; position: relative; }
.med-ul li::before {
  content: '›';
  position: absolute; left: 0;
  color: var(--primary);
  font-weight: 700;
}
.med-ol { list-style: decimal; }

/* Table responsive médicaments similaires */
.med-table-wrap {
  margin: 14px 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.med-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
}
.med-table thead tr {
  background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
}
.med-table th {
  color: #fff;
  padding: 10px 16px;
  text-align: left;
  font-weight: 600;
  font-family: var(--font-ui);
  font-size: .8rem;
  letter-spacing: .04em;
  white-space: nowrap;
}
.med-table td {
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-md);
  vertical-align: middle;
}
.med-table tbody tr:last-child td { border-bottom: none; }
.med-table tbody tr:nth-child(even) { background: var(--bg-alt); }
.med-table tbody tr:hover { background: var(--primary-lt); }
.med-table td:last-child { font-weight: 700; color: var(--accent); }

/* Table → cards sur mobile */
@media (max-width: 520px) {
  .med-table thead { display: none; }
  .med-table, .med-table tbody { display: block; }
  .med-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
  }
  .med-table tr:nth-child(even) { background: var(--bg-alt); }
  .med-table tr:hover { background: var(--primary-lt); }
  .med-table td {
    display: block;
    padding: 0;
    border: none;
    font-size: .83rem;
  }
  .med-table td::before {
    content: attr(data-label);
    display: block;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
    margin-bottom: 1px;
  }
  .med-table td:last-child { grid-column: 1 / -1; }
}

/* ─── Tableau médicaments similaires (div layout) ─────────── */
.med-similar {
  margin: 14px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: .86rem;
}
.med-similar__head {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #fff;
}
.med-similar__row {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.med-similar__row:last-child { border-bottom: none; }
.med-similar__row:nth-child(even) { background: var(--bg-alt); }
.med-similar__row:hover { background: var(--primary-lt); }
.med-similar__drug { font-weight: 600; color: var(--text); }
.med-similar__pres { color: var(--text-muted); font-size: .82rem; }
.med-similar__ppv  { font-weight: 700; color: var(--accent); white-space: nowrap; text-align: right; }

/* Mobile : flex card par ligne */
@media (max-width: 520px) {
  .med-similar__head { display: none; }          /* en-tête masqué */
  .med-similar__row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 1px 8px;
    padding: 10px 14px;
  }
  .med-similar__drug {
    flex: 1 1 auto;
    min-width: 0;
  }
  .med-similar__ppv {
    flex: 0 0 auto;
  }
  .med-similar__pres {
    flex: 1 1 100%;          /* 2e ligne, pleine largeur */
    font-size: .80rem;
  }
}

.med-ci {
  margin-top: 18px;
  padding: 12px 16px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid #ef4444;
  border-radius: 8px;
  font-size: .87rem;
}
.med-ci__title {
  font-weight: 700;
  color: #dc2626;
  margin-bottom: 5px;
  font-size: .88rem;
}
.med-ci p { margin: 0; color: #7f1d1d; line-height: 1.6; }
.med-empty { color: var(--text-muted); font-style: italic; text-align: center; padding: 20px 0; }

/* ─── Dialog médicament ──────────────────────────────────── */
dialog.med-dialog {
  border: none;
  padding: 0;
  border-radius: 20px;
  box-shadow: 0 30px 70px rgba(0,0,0,.28);
  max-width: min(94vw, 660px);
  width: min(94vw, 660px);
  max-height: 90vh;
  overflow: hidden;
  animation: dialogIn .22s cubic-bezier(.34,1.56,.64,1);
}
@keyframes dialogIn {
  from { opacity: 0; transform: translateY(20px) scale(.95); }
  to   { opacity: 1; transform: none; }
}
dialog.med-dialog::backdrop {
  background: rgba(15,23,42,.65);
  backdrop-filter: blur(6px);
}
.med-dialog__inner {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

/* En-tête modale */
.med-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 16px;
  background: var(--surface);
  flex-shrink: 0;
  position: relative;
}
.med-dialog__header::after {
  content: '';
  position: absolute;
  bottom: 0; left: 20px; right: 20px;
  height: 1px;
  background: var(--border);
}
.med-dialog__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary-lt);
  color: var(--primary);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 7px;
  width: fit-content;
}
.med-dialog__badge--mol {
  background: #f0fdf4;
  color: #065f46;
}
.med-dialog__title {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1.08rem;
  color: var(--text);
  margin: 0;
  line-height: 1.3;
}
.med-dialog__sub {
  font-size: .82rem;
  color: var(--text-muted);
  margin-top: 3px;
  font-style: italic;
}
.med-dialog__close {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 1.1rem;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
  transition: all .15s;
  line-height: 1;
}
.med-dialog__close:hover { background: #fee2e2; color: #dc2626; border-color: #fecaca; }

/* Chips prix / forme / classe */
.med-dialog__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  flex-shrink: 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}
.chip--green { background: #dcfce7; color: #166534; }
.chip--blue  { background: var(--primary-lt); color: var(--primary-dk); }
.chip--gray  { background: var(--surface); color: var(--text-muted); border: 1px solid var(--border); }

/* Corps de la modale */
.med-dialog__body {
  padding: 20px;
  overflow-y: auto;
  font-size: .9rem;
  line-height: 1.75;
  color: var(--text-md);
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

/* Mobile : modale plein écran par le bas */
@media (max-width: 520px) {
  dialog.med-dialog {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    margin: 0;
    max-width: 100%;
    width: 100%;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    animation: dialogSlideUp .28s cubic-bezier(.34,1.36,.64,1);
  }
  @keyframes dialogSlideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }
  .med-dialog__body { padding: 16px; }
  .med-dialog__header { padding: 16px 16px 14px; }
  .med-dialog__chips { padding: 10px 16px; }
}

/* ─── Divers ordonnance ──────────────────────────────────── */
.ordo-source {
  margin-top: 20px;
  font-size: .82rem;
  color: var(--text-muted);
  padding: 10px 16px;
  background: var(--bg-alt);
  border-radius: var(--radius);
  border-left: 3px solid var(--border);
}
.ordo-source-list {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.7;
}
.accordion__body .med-ul a,
.accordion__body .med-p a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.accordion__body .med-ul a:hover,
.accordion__body .med-p a:hover {
  opacity: .8;
}
.ordo-nav {
  margin-top: 32px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- AUTH PAGES ---------- */
.auth-page {
  min-height: calc(100vh - var(--header-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg);
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 440px;
}
.auth-card__logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-card__logo a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--primary-dk);
}
.auth-card__logo-icon {
  width: 40px; height: 40px;
  background: var(--primary);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.auth-card__logo-icon svg { color: #fff; }
.auth-card__title {
  font-family: var(--font-ui);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.auth-card__sub { font-size: .9rem; color: var(--text-muted); margin-bottom: 28px; }
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-light);
  font-size: .82rem;
}
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.auth-footer { text-align: center; margin-top: 20px; font-size: .88rem; color: var(--text-muted); }
.auth-footer a { color: var(--primary); font-weight: 600; }

/* ---------- BLOG ---------- */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  margin-top: 32px;
}
.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all .18s;
  display: flex;
  flex-direction: column;
}
.blog-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.blog-card__img {
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--primary-lt), #e0f2fe);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
  overflow: hidden;
}
.blog-card__img img { width: 100%; height: 100%; object-fit: cover; }
.blog-card__body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.blog-card__cat {
  font-family: var(--font-ui);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--primary);
  margin-bottom: 8px;
}
.blog-card__title {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 10px;
  flex: 1;
}
.blog-card__title a { color: inherit; }
.blog-card__title a:hover { color: var(--primary); }
.blog-card__excerpt { font-size: .88rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 16px; }
.blog-card__meta { display: flex; align-items: center; gap: 12px; font-size: .8rem; color: var(--text-light); }

/* Article blog */
.article-content {
  max-width: 720px;
  margin: 0 auto;
  font-size: .97rem;
  line-height: 1.8;
  color: var(--text-md);
}
.article-content h2 { font-family: var(--font-ui); font-size: 1.35rem; font-weight: 700; color: var(--text); margin: 32px 0 14px; }
.article-content h3 { font-family: var(--font-ui); font-size: 1.1rem; font-weight: 600; color: var(--text); margin: 24px 0 10px; }
.article-content p  { margin-bottom: 16px; }
.article-content ul, .article-content ol { padding-left: 24px; margin-bottom: 16px; list-style: revert; }
.article-content li { margin-bottom: 6px; }
.article-content strong { color: var(--text); font-weight: 600; }
.article-content a  { color: var(--primary); text-decoration: underline; }
.article-content blockquote {
  border-left: 4px solid var(--primary);
  padding: 14px 20px;
  background: var(--primary-lt);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 24px 0;
  font-style: italic;
  color: var(--text);
}

/* ---------- ADMIN PANEL ---------- */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 240px;
  background: #0f172a;
  color: #94a3b8;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.admin-sidebar__logo {
  padding: 20px 16px;
  border-bottom: 1px solid #1e293b;
  font-family: var(--font-ui);
  font-weight: 700;
  color: #f1f5f9;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-sidebar__logo span { color: var(--secondary); }
.admin-nav { padding: 12px 8px; flex: 1; }
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  color: #94a3b8;
  transition: all .15s;
  margin-bottom: 2px;
}
.admin-nav a:hover, .admin-nav a.active {
  background: #1e293b;
  color: #f1f5f9;
}
.admin-main { flex: 1; display: flex; flex-direction: column; background: var(--bg); }
.admin-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.admin-topbar h1 { font-family: var(--font-ui); font-size: 1.15rem; font-weight: 700; color: var(--text); }
.admin-content { padding: 24px; flex: 1; }

.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: var(--bg-alt);
  padding: 12px 16px;
  text-align: left;
  font-family: var(--font-ui);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 16px;
  font-size: .9rem;
  border-bottom: 1px solid var(--bg-alt);
  color: var(--text);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); }

/* ---------- DISCLAIMER ---------- */
.disclaimer {
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: .83rem;
  color: #78350f;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}

/* ---------- PAGINATION ---------- */
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 32px; flex-wrap: wrap; }
.pagination a, .pagination span {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-family: var(--font-ui);
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-md);
  transition: all .15s;
}
.pagination a:hover   { background: var(--primary-lt); border-color: var(--primary); color: var(--primary); }
.pagination .current  { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- TAGS ---------- */
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tag {
  display: inline-flex;
  padding: 4px 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: .78rem;
  font-weight: 500;
  color: var(--text-md);
  text-decoration: none;
  transition: all .15s;
}
.tag:hover { background: var(--primary-lt); border-color: var(--primary); color: var(--primary); }

/* ---------- PAGE 404 ---------- */
.page-404 { text-align: center; padding: 80px 20px; }
.page-404__code { font-size: 6rem; font-weight: 700; color: var(--primary-lt); font-family: var(--font-ui); line-height: 1; }
.page-404__title { font-family: var(--font-ui); font-size: 1.5rem; font-weight: 700; margin: 16px 0 8px; }
.page-404__sub   { color: var(--text-muted); margin-bottom: 28px; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1024px) {
  .site-footer__main { grid-template-columns: 1fr 1fr; }
  .steps { grid-template-columns: 1fr; }
  .audience-grid { grid-template-columns: 1fr; }
  .admin-sidebar { width: 200px; }
}

@media (max-width: 768px) {
  :root { --header-h: 56px; }
  /* Sur mobile, header = logo + toggle thème + hamburger uniquement.
     Tous les boutons (Connexion/Inscription/Déconnexion) et le nom d'utilisateur
     passent dans le menu mobile : sinon ils débordent et coupent le hamburger. */
  .site-nav, .site-header__actions .btn { display: none; }
  .site-header__user { display: none; }
  /* Toggle + hamburger groupés à droite */
  .site-header__actions { margin-left: auto; gap: 6px; }
  .hamburger { display: flex; margin-left: 4px; }
  .site-header__inner { gap: 12px; }

  .hero { padding: 56px 20px; }
  .hero__search { flex-direction: column; }
  .hero__search-input, .hero__search-btn {
    border-radius: var(--radius-lg);
  }

  .stats-band__inner { gap: 24px; }
  .specialites-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .ordonnances-grid { grid-template-columns: 1fr 1fr; }
  .blog-grid { grid-template-columns: 1fr; }
  .site-footer__main { grid-template-columns: 1fr 1fr; gap: 24px; }

  .auth-card { padding: 28px 20px; }
  .ordo-card { padding: 20px; }

  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; }
}

@media (max-width: 520px) {
  .patho-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .ordonnances-grid { grid-template-columns: 1fr; }
  .site-footer__main { grid-template-columns: 1fr; }
  .site-footer__bottom { flex-direction: column; text-align: center; }
  .hero__actions { flex-direction: column; }
  .hero__actions .btn { width: 100%; justify-content: center; }
}

@media (max-width: 360px) {
  .patho-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 24px 16px; }
}

/* ── Équivalents médicaments (modal ordonnance.php) ──────────────────────── */
.med-equiv { margin-bottom: 18px; }
.med-equiv__title {
  font-weight: 700; font-size: .88rem; color: var(--primary);
  margin-bottom: 10px; display: flex; align-items: center; gap: 6px;
}
.med-similar__row--gen { background: #f0fdf4; }
.gen-badge {
  display: inline-block; font-size: .62rem; font-weight: 700;
  background: var(--accent-lt); color: #065f46; border-radius: 4px;
  padding: 1px 5px; margin-left: 5px; vertical-align: middle;
  text-transform: uppercase;
}

/* ============================================================
   MODE SOMBRE (opt-in via bouton) — activé par [data-theme="dark"] sur <html>
   • Clair par défaut ; choix mémorisé côté navigateur (localStorage 'ord-theme').
   • Cœur du système : on redéfinit les tokens de couleur → tout ce qui s'appuie
     sur var(--bg/--surface/--text/--border…) bascule automatiquement.
   • Les pages avec couleurs codées en dur dans leur <style> inline sont
     surchargées par des sélecteurs html[data-theme="dark"] .x : leur spécificité
     (0,2,1) est supérieure à une classe nue (0,1,0), donc elles l'emportent
     sans !important malgré l'ordre source.
============================================================ */
html                    { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

html[data-theme="dark"]{
  /* Palette « clinique nuit » : neutres froids légèrement teintés (teinte ~258),
     un seul accent bleu calme (pas néon) + cyan secondaire. Contrastes vérifiés
     WCAG AA (texte ≥4.5:1). Voir aussi le hero assombri plus bas. */
  --primary:    #6ea2f2;  /* accent : liens, icônes, onglet actif (6.3:1 / surface) */
  --primary-dk: #2f64cc;  /* bleu profond : fond des boutons (texte blanc 5.5:1) */
  --primary-lt: #1c2c47;  /* fond de puce / onglet actif */
  --secondary:  #38c3da;  /* cyan accent (marque .ma, points) */
  --accent:     #34d39a;
  --accent-lt:  #123b30;
  --danger:     #f08a8a;
  --warning:    #e9b667;

  --bg:         #0e1422;  /* fond de page */
  --bg-alt:     #131a27;  /* surfaces secondaires / champs */
  --surface:    #18202f;  /* cartes */
  --border:     #2b3547;
  --border-dk:  #3a4659;

  --text:       #e8ecf3;  /* 13.8:1 */
  --text-md:    #aeb7c6;  /*  8.1:1 */
  --text-muted: #8b94a7;  /*  5.4:1 */
  --text-light: #6b7488;

  --shadow-sm:      0 1px 2px rgba(0,0,0,.5);
  --shadow:         0 4px 16px rgba(0,0,0,.55);
  --shadow-lg:      0 12px 34px rgba(0,0,0,.62);
  --shadow-primary: 0 6px 20px rgba(47,100,204,.35);
}
/* Header légèrement surélevé (2ᵉ couche neutre) + marque lisible */
html[data-theme="dark"] .site-header{ background:#1e2839; }
html[data-theme="dark"] .site-header__brand{ color:#8fb6f5; }

/* Hero : le dégradé bleu vif « glare » sur fond sombre → version profonde et calme,
   qui se fond dans le thème (texte blanc conservé, contraste large). */
html[data-theme="dark"] .hero,
html[data-theme="dark"] .ordo-hero,
html[data-theme="dark"] .cdt-hero,
html[data-theme="dark"] .sem-hero,
html[data-theme="dark"] .sem-tool-hero,
html[data-theme="dark"] .meds-hero{
  background:linear-gradient(135deg,#15233f 0%,#1d3c6e 50%,#16485c 100%);
}
/* Boutons primaires : fond bleu profond (var(--primary) sert au texte, trop clair
   pour porter du blanc) → on fixe le fond + survol. */
html[data-theme="dark"] .btn--primary,
html[data-theme="dark"] .mobile-nav__btn--primary{
  background:#2f64cc; border-color:#2f64cc; color:#fff;
}
html[data-theme="dark"] .btn--primary:hover,
html[data-theme="dark"] .mobile-nav__btn--primary:hover{
  background:#3a72de; border-color:#3a72de;
}

/* ---------- BOUTON BASCULE ---------- */
.theme-toggle{
  width:38px; height:38px; flex-shrink:0;
  border:1px solid var(--border); border-radius:var(--radius-sm);
  background:transparent; color:var(--text-md);
  display:inline-flex; align-items:center; justify-content:center;
  transition:background .15s, color .15s, border-color .15s;
}
.theme-toggle:hover{ background:var(--primary-lt); color:var(--primary); border-color:var(--primary); }
.theme-toggle svg{ width:19px; height:19px; }
.theme-toggle__sun{ display:none; }
html[data-theme="dark"] .theme-toggle__moon{ display:none; }
html[data-theme="dark"] .theme-toggle__sun{ display:block; }
/* Variante pleine largeur dans le menu mobile */
.theme-toggle--mobile{
  width:100%; height:auto; justify-content:flex-start; gap:10px;
  padding:12px 14px; font-family:var(--font-ui); font-weight:500;
  font-size:.95rem; color:var(--text-md);
}
.theme-toggle--mobile .theme-toggle__txt-dark{ display:none; }
html[data-theme="dark"] .theme-toggle--mobile .theme-toggle__txt-dark{ display:inline; }
html[data-theme="dark"] .theme-toggle--mobile .theme-toggle__txt-light{ display:none; }

/* ---------- SURCHARGES PAGES À COULEURS CODÉES EN DUR ---------- */
/* Cartes / panneaux principaux → surface */
html[data-theme="dark"] .pcard,
html[data-theme="dark"] .scard,
html[data-theme="dark"] .ordo-cta,
html[data-theme="dark"] .fiche-card,
html[data-theme="dark"] .fiche-section,
html[data-theme="dark"] .mol-card,
html[data-theme="dark"] .mol-modal-card,
html[data-theme="dark"] .fr-sec,
html[data-theme="dark"] .fr-toc,
html[data-theme="dark"] .cdt-sidebar,
html[data-theme="dark"] .cdt-search{
  background:var(--surface);
  border-color:var(--border);
}
/* Surfaces secondaires / champs / lignes alternées → bg-alt */
html[data-theme="dark"] .sem-search,
html[data-theme="dark"] .scard__top,
html[data-theme="dark"] .equiv-item,
html[data-theme="dark"] .cdt-chip,
html[data-theme="dark"] .cdt-sidebar__item,
html[data-theme="dark"] .cdt-sidebar__item--active,
html[data-theme="dark"] .cdt-empty,
html[data-theme="dark"] .fr-faq,
html[data-theme="dark"] .fr-table th,
html[data-theme="dark"] .fr-adapt th{
  background:var(--bg-alt);
  border-color:var(--border);
}
/* Séparateurs / bordures internes */
html[data-theme="dark"] .scard__foot,
html[data-theme="dark"] .fiche-row,
html[data-theme="dark"] .fr-table td,
html[data-theme="dark"] .fr-adapt td,
html[data-theme="dark"] .mol-list li,
html[data-theme="dark"] .mol-modal-card__body .mol-list li{ border-color:var(--border); }
html[data-theme="dark"] .mol-grid{ background:var(--border); }
html[data-theme="dark"] .mol-wrap{ border-color:var(--border); }

/* Champs de recherche : texte + fond au focus */
html[data-theme="dark"] .sem-search input,
html[data-theme="dark"] .cdt-search input{ color:var(--text); }
html[data-theme="dark"] .sem-search:focus-within,
html[data-theme="dark"] .cdt-search:focus-within{ background:var(--surface); }

/* Titres / textes foncés codés en dur → clairs */
html[data-theme="dark"] .scard__name,
html[data-theme="dark"] .fiche-section__title,
html[data-theme="dark"] .cdt-count strong,
html[data-theme="dark"] .fr-sec__t{ color:var(--text); }
html[data-theme="dark"] .mol-subtitle{ color:var(--text)!important; }
html[data-theme="dark"] .scard__desc,
html[data-theme="dark"] .fiche-text,
html[data-theme="dark"] .mol-card__body,
html[data-theme="dark"] .mol-modal-card__body,
html[data-theme="dark"] .fr-sec__body,
html[data-theme="dark"] .fr-toc a{ color:var(--text-md); }

/* Variantes molécule (pastels → teintes sombres discrètes + titres lisibles) */
html[data-theme="dark"] .mol-card--blue,
html[data-theme="dark"] .mol-modal-card--blue{ background:rgba(110,162,242,.10); }
html[data-theme="dark"] .mol-card--red{    background:rgba(240,138,138,.10); }
html[data-theme="dark"] .mol-card--orange{ background:rgba(233,182,103,.10); }
html[data-theme="dark"] .mol-card--purple{ background:rgba(150,130,230,.12); }
html[data-theme="dark"] .mol-card--blue   .mol-card__title,
html[data-theme="dark"] .mol-modal-card--blue .mol-modal-card__title{ color:#6ea2f2; }
html[data-theme="dark"] .mol-card--red    .mol-card__title{ color:#f08a8a; }
html[data-theme="dark"] .mol-card--orange .mol-card__title{ color:#e9b667; }
html[data-theme="dark"] .mol-card--purple .mol-card__title{ color:#b9a7f5; }
html[data-theme="dark"] .mol-card--gray   .mol-card__title{ color:#aeb7c6; }

/* Bandes d'en-tête de cartes (protocoles / sémiologie) */
html[data-theme="dark"] .pcard__top{ background:var(--bg-alt); border-color:var(--border); }
html[data-theme="dark"] .pcard__foot{ border-color:var(--border); }
html[data-theme="dark"] .pcard__name{ color:var(--text); }
html[data-theme="dark"] .pcard__cta{ color:var(--primary); }
/* Puces de catégorie bleu-clair (#dbeafe) → bleu translucide sombre */
html[data-theme="dark"] .pcard__spec,
html[data-theme="dark"] .scard__domaine{ background:var(--primary-lt); color:var(--primary); }

/* Badge « soft » vert (sémiologie) */
html[data-theme="dark"] .scard__domaine--soft{ background:var(--accent-lt); color:#5fd6ab; }
/* Démarche diagnostique : seule teinte non-token (scopée par #id) */
html[data-theme="dark"] #demarche-dx .dmk-rev--on{ background:rgba(110,162,242,.09); }
/* Hover équivalents */
html[data-theme="dark"] .equiv-item:hover{ background:var(--surface); }
