/*
 * MOBIKISI — Main Stylesheet
 * Imports the design system, then adds app-specific layout.
 * Copyright (c) 2025 MOA Digital Agency LLC
 */

@import url('design-system/tokens.css');
@import url('design-system/typography.css');
@import url('design-system/glassmorphism.css');
@import url('design-system/animations.css');
@import url('design-system/components.css');

/* ══ RESET ══════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
button { font-family: var(--font-body); }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
svg { display: inline-block; vertical-align: middle; }

/* ══ SCROLLBAR ══════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.28); }

/* ══ PAGE SYSTEM (SPA) ══════════════════════ */
body { min-height: 100vh; overflow-x: hidden; }

.page { display: none; min-height: 100vh; }
.page.active { display: block; animation: fade-in 200ms both; }

.view { display: none; }
.view.active { display: block; animation: fade-in 180ms both; }

/* ══ LANDING PAGE ════════════════════════════ */
#landing-page {
  min-height: 100vh;
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse at 8% 12%, rgba(200,220,255,0.75) 0%, transparent 50%),
    radial-gradient(ellipse at 92% 88%, rgba(255,200,210,0.65) 0%, transparent 50%),
    radial-gradient(ellipse at 55% 45%, rgba(230,240,255,0.45) 0%, transparent 65%),
    radial-gradient(ellipse at 85% 8%,  rgba(215,235,255,0.55) 0%, transparent 40%);
  background-attachment: fixed;
  position: relative;
  overflow: hidden;
}

/* Landing nav */
.landing-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 90;
  display: flex;
  justify-content: center;
  padding: 0.85rem 2rem;
  background: rgba(244,247,255,0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,0.80);
}
.nav-inner {
  width: 100%;
  max-width: 1200px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.landing-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.landing-logo img { height: 32px; }
.landing-logo-text {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.landing-nav-actions { display: flex; align-items: center; gap: var(--sp-3); }

/* Hero */
.landing-hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 7rem 2rem 4rem;
  position: relative;
}
.hero-label {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 5px 14px;
  border-radius: var(--r-full);
  background: var(--brand-light);
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: var(--sp-5);
  animation: slide-down 400ms both;
}
.hero-label svg { width: 12px; height: 12px; }
.hero-headline {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 5rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  max-width: 800px;
  margin-bottom: var(--sp-5);
  animation: slide-up 500ms 100ms both;
}
.hero-headline em {
  font-style: italic;
  color: var(--brand);
}
.hero-sub {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 520px;
  line-height: 1.7;
  margin-bottom: var(--sp-8);
  animation: slide-up 500ms 200ms both;
}
.hero-actions {
  display: flex;
  gap: var(--sp-3);
  flex-wrap: wrap;
  justify-content: center;
  animation: slide-up 500ms 300ms both;
}
.hero-badge {
  margin-top: var(--sp-10);
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  flex-wrap: wrap;
  justify-content: center;
  animation: fade-in 600ms 600ms both;
}
.hero-badge-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.82rem;
  color: var(--text-muted);
}
.hero-badge-item svg { width: 14px; height: 14px; color: var(--success); }

/* Decorative orbs on hero */
.hero-orb-1 {
  position: absolute; top: 15%; left: 5%;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(200,16,46,0.12), transparent 70%);
  filter: blur(60px);
  pointer-events: none;
  animation: float 6s ease-in-out infinite;
}
.hero-orb-2 {
  position: absolute; bottom: 20%; right: 5%;
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(37,99,235,0.12), transparent 70%);
  filter: blur(60px);
  pointer-events: none;
  animation: float 8s ease-in-out infinite reverse;
}

/* Features section */
.landing-features {
  padding: 5rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

/* ── Bandes de fond pleine largeur (alternance entre sections) ── */
.card-showcase, .how-it-works, .security-section { position: relative; }
.card-showcase::before, .how-it-works::before, .security-section::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 100vw;
  transform: translateX(-50%);
  z-index: -1;
  pointer-events: none;
}
/* Bande blanche franche : la section "carte" et "comment ça marche" */
.card-showcase::before,
.how-it-works::before {
  background: #FFFFFF;
  box-shadow: 0 1px 0 rgba(17,24,39,0.04), 0 -1px 0 rgba(17,24,39,0.04);
}
/* Bande douce teintée : la section "sécurité" */
.security-section::before {
  background: linear-gradient(180deg, #FBFCFF 0%, #EEF3FE 100%);
  border-top: 1px solid rgba(37,99,235,0.08);
  border-bottom: 1px solid rgba(37,99,235,0.08);
}
.section-label {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: var(--sp-3);
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--text-primary);
  margin-bottom: var(--sp-10);
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--sp-5);
}
.feature-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--r-xl);
  padding: var(--sp-8) var(--sp-6);
  transition: all var(--t-slow);
}
.feature-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--glass-shadow-lg);
}
.feature-icon {
  width: 52px; height: 52px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-5);
}
.feature-icon svg { width: 24px; height: 24px; }
.feature-icon-brand  { background: var(--brand-light); color: var(--brand); }
.feature-icon-accent { background: var(--accent-light); color: var(--accent); }
.feature-icon-success { background: var(--success-bg); color: var(--success); }
.feature-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--sp-3);
}
.feature-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Landing footer CTA */
.landing-cta {
  text-align: center;
  padding: 5rem 2rem;
}
.landing-footer {
  text-align: center;
  padding: var(--sp-6) 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Sélecteur de langue (nav) ──────────────── */
.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  overflow: hidden;
  background: var(--glass-bg);
}
.lang-opt {
  border: none;
  background: transparent;
  padding: 5px 12px;
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
}
.lang-opt:hover { color: var(--brand); }
.lang-opt.active { background: var(--brand); color: #fff; }

/* Sélecteur de langue (dropdown) — landing, dashboard, mobile */
.lang-switch {
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  background-color: var(--glass-bg);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 30px 6px 12px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 9px center;
  transition: all var(--t-fast);
}
.lang-switch:hover, .lang-switch:focus { border-color: var(--brand); color: var(--brand); outline: none; }
.sidebar-footer .lang-switch { width: 100%; }

/* ── Hero : fond pleine largeur, contenu centré ── */
.hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
}
.hero-split {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: var(--sp-16);
  text-align: left;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
.hero-split .hero-label { margin-top: 0; }
.hero-text { position: relative; z-index: 1; }
.hero-split .hero-headline,
.hero-split .hero-sub { max-width: none; }
.hero-split .hero-actions,
.hero-split .hero-badge { justify-content: flex-start; }
.hero-split .hero-headline em { display: inline; }

.hero-card-visual {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  animation: float 7s ease-in-out infinite;
}
.hero-card-visual img,
.hero-card-visual picture {
  width: 100%;
  max-width: 520px;
  height: auto;
  filter: drop-shadow(0 30px 60px rgba(31, 38, 135, 0.28));
}

/* ── Section "La carte de santé d'urgence" ──── */
.card-showcase {
  padding: 5rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}
.card-showcase-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-12);
  align-items: center;
}
.card-showcase-visual {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}
.card-face {
  width: 100%;
  height: auto;
  border-radius: var(--r-lg);
  box-shadow: var(--glass-shadow-lg);
  transition: transform var(--t-slow);
}
.card-face:hover { transform: translateY(-6px) scale(1.01); }
.card-face:first-child { transform: rotate(-1.5deg); }
.card-face:last-child { transform: rotate(1.5deg); }
.card-showcase-lead {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--sp-6);
}
.card-bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--sp-8);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.card-bullets li {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.5;
}
.card-bullets li svg {
  width: 20px;
  height: 20px;
  color: var(--brand);
  flex-shrink: 0;
  margin-top: 1px;
}

@media (max-width: 880px) {
  .hero-split {
    grid-template-columns: 1fr;
    text-align: center;
    gap: var(--sp-10);
  }
  .hero-split .hero-actions,
  .hero-split .hero-badge { justify-content: center; }
  /* Mobile : on masque la carte du hero (allègement visuel) */
  .hero-card-visual { display: none; }
  .card-showcase-grid { grid-template-columns: 1fr; gap: var(--sp-8); }
  .card-showcase-text { text-align: center; }
  .card-bullets li { text-align: left; }
}

/* ── Hero "wow" : mesh coloré, glow, chips, titre gradient ── */
.hero-mesh {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(40% 50% at 12% 20%, rgba(200,16,46,0.18), transparent 70%),
    radial-gradient(45% 55% at 88% 30%, rgba(37,99,235,0.16), transparent 70%),
    radial-gradient(50% 60% at 70% 85%, rgba(255,138,165,0.20), transparent 70%),
    radial-gradient(40% 50% at 25% 90%, rgba(99,102,241,0.14), transparent 70%);
}
.hero-orb-3 {
  position: absolute; top: 45%; left: 42%;
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(255,138,165,0.22), transparent 70%);
  filter: blur(70px);
  pointer-events: none;
  animation: float 9s ease-in-out infinite;
}
.grad-text {
  font-style: normal;
  background: linear-gradient(100deg, var(--brand) 0%, #FF5C8A 45%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.hero-headline { line-height: 1.04; }

/* Glow + chips flottants autour de la carte hero */
.hero-card-visual { position: relative; }
.hero-card-glow {
  position: absolute;
  inset: 8% 10%;
  z-index: 0;
  background: radial-gradient(circle at 50% 50%, rgba(200,16,46,0.28), rgba(37,99,235,0.18) 55%, transparent 72%);
  filter: blur(48px);
  border-radius: 50%;
  animation: pulse-glow 5s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { opacity: .75; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.08); }
}
.hero-card-visual picture { position: relative; z-index: 1; }
.hero-chip {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--r-full);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-md);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}
.hero-chip svg { width: 15px; height: 15px; }
.hero-chip.chip-1 { top: 6%;  left: -4%;  color: var(--brand);   animation: float 6s ease-in-out infinite; }
.hero-chip.chip-2 { top: 38%; right: -6%; color: var(--accent);  animation: float 7s ease-in-out infinite reverse; }
.hero-chip.chip-3 { bottom: 8%; left: 6%;  color: var(--success); animation: float 8s ease-in-out infinite; }

/* ── Carte recto/verso : flip 3D au clic ──────── */
.flip-card {
  width: 100%;
  max-width: 460px;
  aspect-ratio: 1011 / 638;
  perspective: 1400px;
  cursor: pointer;
  outline: none;
  margin: 0 auto;
}
.flip-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 6px; border-radius: var(--r-lg); }
.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform var(--t-spring);
  transform-style: preserve-3d;
}
.flip-card.flipped .flip-card-inner { transform: rotateY(180deg); }
.flip-card-face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--glass-shadow-lg);
}
.flip-card-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.flip-card-back { transform: rotateY(180deg); }
.flip-card:hover .flip-card-inner { box-shadow: none; }
.flip-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: var(--sp-5) auto 0;
  padding: 7px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  background: var(--glass-bg);
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
}
.flip-hint:hover { color: var(--brand); border-color: var(--brand); }
.flip-hint svg { width: 16px; height: 16px; }
.card-showcase-visual { align-items: center; }

/* ── Footer élaboré (panneau sombre brandé) ──── */
.site-footer {
  margin-top: var(--sp-12);
  background: linear-gradient(160deg, #2A0710 0%, #5E0715 50%, #3A0A14 100%);
  color: rgba(255,255,255,0.78);
  padding: var(--sp-16) 2.5rem var(--sp-8);
}
.footer-main {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.2fr;
  gap: var(--sp-10);
}
.footer-brand img { height: 34px; filter: brightness(0) invert(1); margin-bottom: var(--sp-4); }
.footer-tagline { font-size: 0.9rem; line-height: 1.7; color: rgba(255,255,255,0.68); max-width: 320px; }
.footer-badges { display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-5); }
.footer-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: var(--r-full);
  background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.16);
  font-size: 0.76rem; font-weight: 700; color: #fff;
}
.footer-badge svg { width: 14px; height: 14px; }
.footer-col-title {
  font-family: var(--font-display);
  font-size: 0.95rem; font-weight: 700; color: #fff;
  margin-bottom: var(--sp-4);
}
.footer-col a {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,0.72);
  font-size: 0.875rem;
  text-decoration: none;
  padding: 5px 0;
  transition: color var(--t-fast);
}
.footer-col a:hover { color: #fff; }
.footer-col a svg { width: 15px; height: 15px; opacity: .8; }
.footer-lang { display: inline-flex; margin-top: var(--sp-3); border: 1px solid rgba(255,255,255,0.22); border-radius: var(--r-full); overflow: hidden; }
.footer-lang .lang-opt { color: rgba(255,255,255,0.75); background: transparent; }
.footer-lang .lang-opt.active { background: #fff; color: var(--brand); }
.footer-bottom {
  max-width: 1100px;
  margin: var(--sp-10) auto 0;
  padding-top: var(--sp-6);
  border-top: 1px solid rgba(255,255,255,0.14);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: var(--sp-3);
  font-size: 0.8rem; color: rgba(255,255,255,0.6);
}
.footer-bottom strong { color: rgba(255,255,255,0.85); font-weight: 700; }
.footer-bottom-left, .footer-bottom-right { display: inline-flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.footer-dot { opacity: .5; }
.footer-version { font-family: var(--font-mono); }

@media (max-width: 880px) {
  .hero-chip.chip-1 { left: 2%; }
  .hero-chip.chip-2 { right: 0; }
  .footer-main { grid-template-columns: 1fr 1fr; gap: var(--sp-8); }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 540px) {
  .footer-main { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

/* ── Sécurité : 3 piliers développés + bandeau réassurance ── */
.security-head { text-align: center; max-width: 720px; margin: 0 auto var(--sp-10); }
.security-intro {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.7;
  margin-top: var(--sp-2);
}
.security-pillars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-6);
  align-items: stretch;
}
.security-pillar {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--r-xl);
  padding: var(--sp-8) var(--sp-6) var(--sp-6);
  overflow: hidden;
  transition: transform var(--t-slow), box-shadow var(--t-slow);
}
.security-pillar::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--brand);
  opacity: 0.9;
}
.security-pillar-accent::before  { background: var(--accent); }
.security-pillar-success::before { background: var(--success); }
.security-pillar:hover {
  transform: translateY(-6px);
  box-shadow: var(--glass-shadow-lg);
}
.security-pillar-icon {
  width: 58px; height: 58px;
  border-radius: var(--r-lg);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: var(--sp-5);
  background: var(--brand-light);
  color: var(--brand);
}
.security-pillar-accent  .security-pillar-icon { background: var(--accent-light); color: var(--accent); }
.security-pillar-success .security-pillar-icon { background: var(--success-bg);  color: var(--success); }
.security-pillar-icon svg { width: 27px; height: 27px; }
.security-pillar-title {
  font-family: var(--font-display);
  font-size: 1.25rem; font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  margin-bottom: var(--sp-3);
}
.security-pillar-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--sp-5);
}
.security-pillar-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.security-pillar-list li {
  display: flex; align-items: flex-start; gap: var(--sp-2);
  font-size: 0.85rem;
  color: var(--text-primary);
  line-height: 1.5;
}
.security-pillar-list svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--success);
}
.security-assurance {
  display: flex; align-items: center; gap: var(--sp-3);
  max-width: 760px;
  margin: var(--sp-8) auto 0;
  padding: var(--sp-5) var(--sp-6);
  border-radius: var(--r-lg);
  background: var(--glass-bg-strong);
  border: 1px solid var(--glass-border-subtle);
  box-shadow: var(--glass-shadow);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.55;
}
.security-assurance svg {
  width: 26px; height: 26px;
  flex-shrink: 0;
  color: var(--brand);
}
@media (max-width: 980px) {
  .security-pillars { grid-template-columns: 1fr; max-width: 560px; margin: 0 auto; }
}

/* ── CTA "Prêt à commencer" : bannière dégradée ── */
.landing-cta { padding: 5rem 2rem; }
.cta-banner {
  position: relative;
  overflow: hidden;
  max-width: 1100px;
  margin: 0 auto;
  border-radius: var(--r-xl);
  background: linear-gradient(120deg, var(--brand) 0%, #E11D48 38%, #7C3AED 100%);
  box-shadow: 0 30px 70px rgba(124, 58, 237, 0.30);
  padding: var(--sp-12) var(--sp-12);
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  align-items: center;
  gap: var(--sp-10);
  color: #fff;
}
.cta-orb { position: absolute; border-radius: 50%; filter: blur(50px); pointer-events: none; }
.cta-orb-a { width: 320px; height: 320px; background: rgba(255,255,255,0.22); top: -120px; right: 10%; }
.cta-orb-b { width: 260px; height: 260px; background: rgba(37,99,235,0.35); bottom: -120px; left: -40px; }
.cta-banner-text { position: relative; z-index: 1; }
.cta-eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 13px; border-radius: var(--r-full);
  background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.28);
  font-size: 0.76rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  margin-bottom: var(--sp-4);
}
.cta-eyebrow svg { width: 14px; height: 14px; }
.cta-banner-text h2 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  font-weight: 700; letter-spacing: -0.02em; line-height: 1.1;
  color: #fff; margin-bottom: var(--sp-3);
}
.cta-banner-text p { color: rgba(255,255,255,0.88); font-size: 1.02rem; line-height: 1.6; max-width: 460px; margin-bottom: var(--sp-6); }
.cta-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.btn-cta-light { background: #fff; color: var(--brand); box-shadow: var(--shadow-md); }
.btn-cta-light:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); background: #fff; }
.btn-cta-ghost { background: rgba(255,255,255,0.12); color: #fff; border: 1px solid rgba(255,255,255,0.40); }
.btn-cta-ghost:hover { background: rgba(255,255,255,0.22); transform: translateY(-2px); }
.cta-banner-visual { position: relative; z-index: 1; display: flex; justify-content: center; }
.cta-banner-visual img {
  width: 100%; max-width: 340px; height: auto;
  border-radius: var(--r-lg);
  box-shadow: 0 20px 50px rgba(0,0,0,0.30);
  transform: rotate(-4deg);
  transition: transform var(--t-slow);
}
.cta-banner-visual img:hover { transform: rotate(0deg) scale(1.03); }

@media (max-width: 820px) {
  .cta-banner { grid-template-columns: 1fr; text-align: center; padding: var(--sp-10) var(--sp-6); }
  .cta-actions { justify-content: center; }
  .cta-banner-text p { margin-left: auto; margin-right: auto; }
  .cta-banner-visual { order: -1; }
  .cta-banner-visual img { max-width: 260px; }
}

/* ── Mention "Made in DRC · by Congolese" ───── */
.made-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: var(--sp-5);
  padding: 7px 14px;
  border-radius: var(--r-full);
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.20);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: rgba(255,255,255,0.90);
}
.made-flag {
  position: relative;
  width: 24px; height: 16px;
  border-radius: 3px;
  flex-shrink: 0;
  background:
    linear-gradient(45deg,
      transparent 40%, #FCD116 40%, #FCD116 45%,
      #CE1021 45%, #CE1021 55%,
      #FCD116 55%, #FCD116 60%, transparent 60%),
    #0085CA;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.30);
}
.made-flag::before {
  content: '★';
  position: absolute;
  top: -1px; left: 2px;
  font-size: 8px;
  line-height: 1;
  color: #FCD116;
}
.made-text { display: inline-flex; align-items: baseline; gap: 2px; }
.made-tm { font-size: 0.7em; opacity: 0.75; }

/* ── Badges de rôle manquants ───────────────── */
.role-doctor { background: var(--accent-light); color: var(--accent-600); }
.role-staff  { background: #EEF2FF; color: #4338CA; }

/* ── Salutation dashboard ───────────────────── */
.greeting-card {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-6);
  margin-bottom: var(--sp-5);
  border-radius: var(--r-lg);
  background: linear-gradient(120deg, var(--brand-light), rgba(37,99,235,0.06));
  border: 1px solid var(--glass-border);
}
.greeting-avatar {
  width: 52px; height: 52px;
  border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  background: var(--brand); color: #fff;
  font-weight: 700; font-size: 1.1rem; flex-shrink: 0;
}
.greeting-hello { font-family: var(--font-display); font-size: 1.35rem; color: var(--text-primary); }
.greeting-sub { display: flex; align-items: center; gap: var(--sp-3); margin-top: 4px; flex-wrap: wrap; }
.greeting-affil { display: inline-flex; align-items: center; gap: 5px; font-size: 0.85rem; color: var(--text-secondary); }
.greeting-affil svg { width: 14px; height: 14px; }

/* ── Dashboard patient : infos vitales & pills ── */
.vital-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: var(--sp-3);
}
.vital-chip {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
}
.vital-chip-brand { background: var(--brand-light); border-color: var(--brand-200); }
.vital-chip-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.vital-chip-value { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--text-primary); margin-top: 2px; }
.vital-chip-brand .vital-chip-value { color: var(--brand); }
.dash-sub-label { font-size: 0.78rem; font-weight: 600; color: var(--text-secondary); margin-bottom: var(--sp-2); }
.pill-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: var(--r-full);
  background: var(--neutral-bg); color: var(--text-secondary);
  font-size: 0.82rem; font-weight: 600;
}
.pill svg { width: 14px; height: 14px; }
.pill-danger { background: var(--danger-bg); color: var(--danger); }
.pill-ok { background: var(--success-bg); color: var(--success); }

/* ── Item box (validations / invitations) ───── */
.item-box {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
  background: var(--bg-elevated);
}
.item-header { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-2); }
.item-header h4 { display: inline-flex; align-items: center; gap: 6px; font-size: 0.95rem; }
.item-header h4 svg { width: 16px; height: 16px; color: var(--brand); }
.item-detail { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text-secondary); margin: 2px 0; }
.item-detail svg { width: 14px; height: 14px; }

/* ── Vue API & Intégrations ─────────────────── */
.api-example {
  background: #1E1B2E;
  color: #E9E6F5;
  border-radius: var(--r-md);
  padding: var(--sp-4);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}
.scope-list { display: flex; flex-direction: column; gap: var(--sp-2); max-height: 280px; overflow-y: auto; padding: var(--sp-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.scope-check { display: flex; align-items: flex-start; gap: var(--sp-2); font-size: 0.85rem; cursor: pointer; padding: 5px; border-radius: var(--r-sm); }
.scope-check:hover { background: var(--bg-subtle); }
.scope-check input { margin-top: 3px; flex-shrink: 0; }
.scope-check code { background: var(--neutral-bg); padding: 2px 6px; border-radius: var(--r-xs); font-size: 0.78rem; color: var(--brand); flex-shrink: 0; }
.scope-check span { color: var(--text-secondary); }
.token-reveal {
  background: var(--bg-subtle);
  border: 1px dashed var(--brand-200);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  word-break: break-all;
}
.token-reveal code { font-family: var(--font-mono); font-size: 0.9rem; color: var(--brand-700); }

/* ── Dossier patient : groupes & titres évidents ── */
.detail-group {
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.detail-group:last-child { margin-bottom: 0; padding-bottom: 0; border-bottom: none; }
.detail-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: var(--sp-3);
  padding: 6px 0 8px 12px;
  border-left: 3px solid var(--brand);
  background: linear-gradient(90deg, var(--brand-light), transparent 60%);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.detail-group-title > span { display: inline-flex; align-items: center; gap: 6px; }
.detail-group-title svg { width: 15px; height: 15px; }

/* Bannière lecture seule */
.readonly-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-md);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: var(--sp-5);
}
.readonly-banner svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ══ LOGIN PAGE ══════════════════════════════ */
#login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse at 15% 15%, rgba(200,220,255,0.75) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 85%, rgba(255,200,210,0.65) 0%, transparent 50%);
  background-attachment: fixed;
  padding: var(--sp-4);
  position: relative;
}
.login-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 900px;
  width: 100%;
  gap: 0;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow-lg);
  border-radius: var(--r-xl);
  overflow: hidden;
  animation: scale-in 400ms cubic-bezier(0.34,1.56,0.64,1) both;
}
.login-brand-panel {
  background: linear-gradient(150deg, var(--brand-700), var(--brand-500));
  padding: var(--sp-10) var(--sp-8);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-brand-panel::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 250px; height: 250px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}
.login-brand-panel::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -40px;
  width: 180px; height: 180px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}
.login-brand-logo { position: relative; z-index: 1; }
.login-brand-logo img { height: 36px; filter: brightness(0) invert(1); }
.login-brand-tagline {
  position: relative; z-index: 1;
}
.login-brand-tagline h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: rgba(255,255,255,0.95);
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-3);
}
.login-brand-tagline p {
  font-size: 0.875rem;
  color: rgba(255,255,255,0.65);
  line-height: 1.6;
}
.login-form-panel {
  padding: var(--sp-10) var(--sp-8);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-form-panel h1 {
  font-size: 1.5rem;
  margin-bottom: var(--sp-2);
  color: var(--text-primary);
}
.login-form-panel .subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--sp-8);
}
.login-back {
  position: absolute;
  top: var(--sp-5);
  left: var(--sp-5);
}

@media (max-width: 640px) {
  .login-wrapper { grid-template-columns: 1fr; }
  .login-brand-panel { display: none; }
}

/* Demo accounts (compact) */
.demo-accounts {
  margin-top: var(--sp-6);
  padding: var(--sp-4);
  background: var(--neutral-bg);
  border-radius: var(--r-md);
}
.demo-accounts-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
}
.demo-account-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background var(--t-fast);
  text-align: left;
  font-family: var(--font-body);
  font-size: 0.8rem;
}
.demo-account-btn:hover { background: rgba(255,255,255,0.70); }
.demo-account-email { color: var(--text-primary); font-weight: 500; }
.demo-account-role { font-size: 0.7rem; color: var(--text-muted); }

/* ══ APP LAYOUT ══════════════════════════════ */
#dashboard-page {
  display: none;
  min-height: 100vh;
  background: var(--bg-base);
  background-image:
    radial-gradient(ellipse at 8% 12%, rgba(200,220,255,0.65) 0%, transparent 50%),
    radial-gradient(ellipse at 92% 88%, rgba(255,200,210,0.55) 0%, transparent 50%);
  background-attachment: fixed;
}
#dashboard-page.active {
  display: flex;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  height: 100vh;
  position: sticky;
  top: 0;
  flex-shrink: 0;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);
  border-right: 1px solid var(--glass-border);
  box-shadow: 4px 0 24px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-logo {
  padding: var(--sp-6) var(--sp-5) var(--sp-4);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo img { height: 28px; }
.sidebar-logo-text {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.sidebar-logo-sub {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 400;
  display: block;
}
.sidebar-nav {
  flex: 1;
  padding: var(--sp-4) var(--sp-3);
  overflow-y: auto;
}
.sidebar-footer {
  padding: var(--sp-4) var(--sp-3);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  background: rgba(0,0,0,0.03);
  margin-bottom: var(--sp-3);
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role { font-size: 0.72rem; color: var(--text-muted); }

/* Main content */
.app-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}
.main-content {
  padding: var(--sp-8) var(--sp-8);
  max-width: none;
  width: 100%;
}

/* Top bar */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
}
.view-header h1 {
  font-size: 1.6rem;
  color: var(--text-primary);
}
.view-header h2 {
  font-size: 1.4rem;
  color: var(--text-primary);
}
.header-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; }

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

/* Cards grid (patients) */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--sp-4);
}

/* Two column dashboard */
.dashboard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
  margin-top: var(--sp-5);
}
@media (max-width: 900px) {
  .dashboard-row { grid-template-columns: 1fr; }
}

/* Patient detail */
.patient-detail-container {
  display: grid;
  gap: var(--sp-5);
}
.patient-detail-header-card {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  flex-wrap: wrap;
}
.patient-detail-actions { margin-left: auto; display: flex; gap: var(--sp-3); }

/* ══ DASHBOARD ENRICHI ═══════════════════════ */
.stats-grid-6 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.dashboard-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--sp-5);
  margin-bottom: var(--sp-5);
}
@media (max-width: 1100px) {
  .dashboard-row-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .dashboard-row-3 { grid-template-columns: 1fr; }
}

/* ── Dashboard refondu : tuiles ajustées, max 4 colonnes ── */
.dash-section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: .95rem; font-weight: 700; color: var(--text-primary);
  margin: 0 0 var(--sp-3);
}
.dash-section-title svg { width: 17px; height: 17px; color: var(--brand); }
/* Badge de périmètre des statistiques (rôle) */
.stats-scope {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(200,16,46,0.08); color: var(--brand);
  border: 1px solid rgba(200,16,46,0.16); border-radius: 999px;
  padding: 6px 14px; font-size: .8rem; font-weight: 600; margin-bottom: var(--sp-5);
}
.stats-scope svg { width: 15px; height: 15px; }
.dash-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .dash-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .dash-grid { grid-template-columns: 1fr; } }

/* Tuile statistique */
.dash-stat {
  position: relative; background: rgba(255,255,255,0.65);
  border: 1px solid var(--border-subtle); border-radius: var(--r-lg, 16px);
  padding: var(--sp-4); overflow: hidden; transition: all var(--t-base);
}
.dash-stat:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.dash-stat::before { content:''; position:absolute; left:0; top:0; bottom:0; width:4px; background: var(--brand); }
.dash-stat.accent::before  { background: var(--accent); }
.dash-stat.success::before { background: var(--success); }
.dash-stat.warn::before    { background: var(--warning); }
.dash-stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); }
.dash-stat-ico { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; }
.dash-stat-ico svg { width: 19px; height: 19px; }
.dash-stat-val { font-size: 1.9rem; font-weight: 800; line-height: 1; color: var(--text-primary); letter-spacing: -.02em; }
.dash-stat-lbl { font-size: .82rem; font-weight: 600; color: var(--text-primary); margin-top: 6px; }
.dash-stat-sub { font-size: .72rem; color: var(--text-muted); margin-top: 1px; }

/* Tuile action rapide */
.dash-action {
  display: flex; align-items: center; gap: var(--sp-3);
  background: rgba(255,255,255,0.65); border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg, 16px); padding: var(--sp-4);
  cursor: pointer; text-align: left; transition: all var(--t-base);
  font-family: var(--font-body); width: 100%;
}
.dash-action:hover { box-shadow: var(--shadow-sm); transform: translateY(-2px); border-color: var(--border-strong); }
.dash-action.primary { background: linear-gradient(135deg, var(--brand), #9B0D22); border-color: transparent; }
.dash-action.primary .dash-action-ico { background: rgba(255,255,255,.22); color: #fff; }
.dash-action.primary .dash-action-lbl { color: #fff; }
.dash-action.primary .dash-action-sub { color: rgba(255,255,255,.82); }
.dash-action-ico { width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.dash-action-ico svg { width: 20px; height: 20px; }
.dash-action-txt { min-width: 0; }
.dash-action-lbl { font-size: .9rem; font-weight: 700; color: var(--text-primary); }
.dash-action-sub { font-size: .73rem; color: var(--text-muted); margin-top: 1px; }
.dash-action-badge { margin-left: auto; background: var(--warning); color: #fff; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 2px 8px; flex-shrink: 0; }

/* Aperçus : activité (large) + colonne latérale (genre + alertes) */
.dash-insights { display: grid; grid-template-columns: 1.7fr 1fr; gap: var(--sp-5); align-items: start; }
.dash-insights-side { display: flex; flex-direction: column; gap: var(--sp-5); }
@media (max-width: 980px) { .dash-insights { grid-template-columns: 1fr; } }

/* Activity timeline */
.activity-timeline { display: flex; flex-direction: column; gap: 0; }
.activity-timeline-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}
.activity-timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
  margin-top: 5px;
}
.timeline-dot-accent { background: var(--accent); }
.timeline-dot-success { background: var(--success); }
.timeline-dot-neutral { background: var(--text-muted); }
.timeline-content { flex: 1; min-width: 0; }
.timeline-action { font-size: .875rem; font-weight: 500; color: var(--text-primary); }
.timeline-meta { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }
.timeline-time { font-size: .72rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

/* Quick actions grid */
.quick-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-top: var(--sp-2);
}
.quick-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-4);
  border-radius: var(--r-md);
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--t-base);
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}
.quick-action-btn:hover {
  background: rgba(255,255,255,0.90);
  color: var(--text-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.quick-action-btn svg { width: 20px; height: 20px; }
.quick-action-icon {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
}

/* Alert items */
.alert-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-2);
  font-size: .825rem;
}
.alert-row:last-child { margin-bottom: 0; }
.alert-row-warning { background: var(--warning-bg); color: var(--warning); }
.alert-row-danger  { background: var(--danger-bg);  color: var(--danger); }
.alert-row-success { background: var(--success-bg); color: var(--success); }
.alert-row svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Donut SVG */
.donut-wrapper { display: flex; flex-direction: column; align-items: center; gap: var(--sp-4); }
.donut-legend { width: 100%; display: flex; flex-direction: column; gap: var(--sp-2); }
.donut-legend-item {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: .8rem; color: var(--text-secondary);
}
.donut-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* Recent patients mini */
.recent-patient-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--t-fast);
}
.recent-patient-item:last-child { border-bottom: none; }
.recent-patient-item:hover { opacity: .75; }
.recent-patient-name { font-size: .875rem; font-weight: 500; color: var(--text-primary); }
.recent-patient-meta { font-size: .75rem; color: var(--text-muted); }

/* ══ PROFILE RICHE ════════════════════════════ */
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: var(--sp-5);
}
@media (max-width: 900px) {
  .profile-grid { grid-template-columns: 1fr; }
}
.permission-list { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-4); }
.permission-item {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: .825rem; color: var(--text-secondary);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.permission-item:last-child { border-bottom: none; }
.permission-item svg { width: 14px; height: 14px; color: var(--success); flex-shrink: 0; }
.security-status { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-3); }
.security-status-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .85rem; padding: var(--sp-2) 0; border-bottom: 1px solid var(--border-subtle);
}
.security-status-row:last-child { border-bottom: none; }

/* ══ NOUVELLES VUES ═══════════════════════════ */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: var(--sp-5);
}
@media (max-width: 700px) { .settings-grid { grid-template-columns: 1fr; } }

.security-check-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: .875rem;
}
.security-check-row:last-child { border-bottom: none; }
.check-ok   { color: var(--success); display: flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 600; }
.check-warn { color: var(--warning); display: flex; align-items: center; gap: 4px; font-size: .8rem; font-weight: 600; }
.check-ok svg, .check-warn svg { width: 14px; height: 14px; }

.db-stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); margin-top: var(--sp-4);
}
.db-stat-item {
  padding: var(--sp-4); border-radius: var(--r-md);
  background: rgba(255,255,255,.55); border: 1px solid var(--border-subtle);
  text-align: center;
}
.db-stat-value { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; color: var(--text-primary); }
.db-stat-label { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }

.how-it-works { padding: 5rem 2rem; max-width: 1000px; margin: 0 auto; }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-6); }
@media (max-width: 700px) { .steps-grid { grid-template-columns: 1fr; } }
.step-item { text-align: center; }
.step-number {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--brand-light); color: var(--brand);
  font-family: var(--font-display); font-size: 1.25rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto var(--sp-4);
}
.step-title { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; margin-bottom: var(--sp-2); }
.step-desc { font-size: .875rem; color: var(--text-secondary); line-height: 1.6; }
.step-connector { display: none; }

.security-section { padding: 4rem 2rem; max-width: 1140px; margin: 0 auto; }

/* ══ PATIENTS — FILTRES PRO & TOGGLE ═════════ */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-4);
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-5);
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 220px;
}
.search-input-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.search-input-wrap input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.4rem;
  background: rgba(255,255,255,0.70);
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: all var(--t-base);
  outline: none;
}
.search-input-wrap input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(200,16,46,0.10);
}

.filter-select {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.filter-select select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0.55rem 2.2rem 0.55rem 0.9rem;
  background: rgba(255,255,255,0.70);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
  outline: none;
}
.filter-select select:hover { border-color: var(--border-strong); }
.filter-select select:focus { border-color: var(--brand); }
.filter-select::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.filter-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  flex-shrink: 0;
}

/* Toggle grille / liste */
.view-toggle {
  display: inline-flex;
  background: rgba(0,0,0,0.04);
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}
.view-toggle button {
  width: 34px; height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--t-fast);
}
.view-toggle button svg { width: 16px; height: 16px; }
.view-toggle button:hover { color: var(--text-primary); }
.view-toggle button.active {
  background: #fff;
  color: var(--brand);
  box-shadow: var(--shadow-xs);
}

/* Liste patients (table) */
.patients-table-wrap {
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--r-lg);
  padding: var(--sp-2) var(--sp-4);
  overflow-x: auto;
}
.patient-row-name {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.patient-row-name .avatar {
  width: 34px; height: 34px;
  font-size: 0.8rem;
}
.patient-row-actions { display: flex; gap: var(--sp-2); justify-content: flex-end; }

/* ══ DOSSIER PATIENT — ONGLETS & SECTIONS ════ */
.record-tabs {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
  padding: var(--sp-1);
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  width: fit-content;
  max-width: 100%;
}
.record-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.record-tab svg { width: 15px; height: 15px; }
.record-tab:hover { background: rgba(0,0,0,0.04); color: var(--text-primary); }
.record-tab.active {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-brand);
}

/* Sections cliniques : grille 2 colonnes */
#clinical-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
  align-content: start;
  margin-bottom: var(--sp-5);   /* sépare la grille du bloc Documents (anti-collage) */
}
@media (max-width: 1000px) { #clinical-sections { grid-template-columns: 1fr; } }
.patient-detail-container { display: block; }
.patient-detail-container > .card { margin-bottom: var(--sp-5); }
/* Le bloc Documents est plein largeur et clairement séparé */
.patient-detail-container > .card[data-tab="documents"] { margin-top: var(--sp-2); }
.section-items { display: flex; flex-direction: column; gap: var(--sp-3); }

/* ══ FORMULAIRES 2 COLONNES ══════════════════ */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3) var(--sp-4);
}
.form-grid-2 .form-group { margin-bottom: 0; }
.form-grid-2 textarea { min-height: 60px; }
@media (max-width: 560px) { .form-grid-2 { grid-template-columns: 1fr; } }
.form-section-label {
  grid-column: 1 / -1;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--border-subtle);
  margin-top: var(--sp-2);
}
.form-section-label:first-child { border-top: none; padding-top: 0; margin-top: 0; }

/* Modale élargie quand elle contient un formulaire 2 colonnes */
.modal-glass:has(.form-grid-2) { max-width: 720px; }

/* ══ PIÈCES JOINTES (fichiers chiffrés) ══════ */
.attach-list {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px dashed var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.attach-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.attach-label svg { width: 12px; height: 12px; }
.attach-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px 8px;
  background: rgba(255,255,255,0.60);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  font-size: 0.8rem;
}
.attach-chip > i { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; }
.attach-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.attach-size { font-size: 0.72rem; color: var(--text-muted); flex-shrink: 0; }
.attach-act {
  width: 26px; height: 26px;
  border: none; background: transparent; cursor: pointer;
  border-radius: var(--r-xs); color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  transition: all var(--t-fast); flex-shrink: 0;
}
.attach-act svg { width: 14px; height: 14px; }
.attach-act:hover { background: rgba(0,0,0,0.06); color: var(--text-primary); }
.attach-del:hover { background: var(--danger-bg); color: var(--danger); }

/* ══ PHOTO PATIENT ═══════════════════════════ */
.patient-photo-holder {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
}
.patient-photo-avatar {
  width: 72px; height: 72px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, var(--brand-light), var(--accent-light));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 700;
  color: var(--brand); overflow: hidden; flex-shrink: 0;
  border: 2px solid var(--glass-border);
}
.patient-photo-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ══ CHRONOLOGIE / TIMELINE ══════════════════ */
.timeline-track {
  position: relative;
  padding-left: var(--sp-6);
}
.timeline-track::before {
  content: '';
  position: absolute;
  left: 15px; top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(var(--brand-light), var(--border));
}
.timeline-event {
  position: relative;
  display: flex;
  gap: var(--sp-4);
  padding-bottom: var(--sp-5);
}
.timeline-event:last-child { padding-bottom: 0; }
.timeline-event-dot {
  position: absolute;
  left: -28px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--brand);
  flex-shrink: 0;
}
.timeline-event-dot svg { width: 15px; height: 15px; }
.timeline-event-body {
  flex: 1;
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
}
.timeline-event-head {
  display: flex; align-items: center; gap: var(--sp-2);
  margin-bottom: 2px;
}
.timeline-event-date { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.timeline-event-label { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.timeline-event-detail { font-size: 0.82rem; color: var(--text-secondary); margin-top: 2px; }

/* ══ PARTAGE D'ACCÈS — onglets ═══════════════ */
.share-tabs {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
  background: rgba(0,0,0,0.04);
  padding: 4px;
  border-radius: var(--r-md);
}
.share-tabs button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.5rem 0.75rem;
  border: none;
  background: transparent;
  border-radius: var(--r-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.share-tabs button svg { width: 15px; height: 15px; }
.share-tabs button.active {
  background: #fff;
  color: var(--brand);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}

/* ══ RESPONSIVE ══════════════════════════════ */
/* Barre supérieure mobile + backdrop (cachés en desktop) */
.app-topbar { display: none; }
.sidebar-backdrop { display: none; }

@media (max-width: 768px) {
  /* Sidebar → tiroir coulissant */
  .app-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    transition: transform var(--t-base);
    z-index: 210;
    box-shadow: 8px 0 40px rgba(0,0,0,0.18);
  }
  .app-sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(17,24,39,0.45);
    z-index: 200;
  }
  .sidebar-backdrop.show { display: block; }

  /* Barre supérieure mobile */
  .app-topbar {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 0.6rem 1rem;
    position: sticky; top: 0;
    z-index: 90;
    background: var(--glass-bg-strong);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
  }
  .topbar-burger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    border: 1px solid var(--border); border-radius: var(--r-md);
    background: var(--bg-elevated); cursor: pointer; color: var(--text-primary);
  }
  .topbar-burger svg { width: 22px; height: 22px; }
  .topbar-logo { height: 26px; }

  .app-main { width: 100%; }
  .main-content { padding: var(--sp-4); }
  .view-header { flex-direction: column; align-items: flex-start; }
  .landing-nav { padding: 0.75rem 1rem; }
  /* Sur mobile : on masque les ancres, on garde logo + langue + connexion */
  .landing-nav-actions .btn-ghost { display: none; }
  .landing-nav-actions { gap: var(--sp-2); }
  .landing-hero { padding-top: 6rem; }

  /* En-tête de vue : le bouton d'action passe sous le titre, pleine largeur */
  .view-header > .btn:not(#back-to-patients) { width: 100%; justify-content: center; margin-top: var(--sp-2); }
  /* Dossier patient : les onglets défilent horizontalement proprement */
  .record-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .record-tabs .record-tab { flex: 0 0 auto; }
}

/* ── Tables → cartes empilées sur petit écran (liste patients, etc.) ── */
@media (max-width: 640px) {
  .patients-table-wrap { overflow-x: visible; }
  .data-table thead { display: none; }
  .data-table, .data-table tbody { display: block; width: 100%; }
  .data-table tr {
    display: block; border: 1px solid var(--border-subtle); border-radius: 14px;
    background: rgba(255,255,255,0.62); margin-bottom: var(--sp-3); padding: 12px 14px;
  }
  .data-table td {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 5px 0; border: none; text-align: right;
  }
  .data-table td::before {
    content: attr(data-label); font-size: .7rem; font-weight: 700; text-align: left;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em;
  }
  .data-table td.td-patient { padding: 0 0 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border-subtle); }
  .data-table td.td-patient::before,
  .data-table td.td-actions::before { content: none; }
  .data-table td.td-actions { justify-content: flex-end; padding-top: 10px; }

  /* Modals : feuille pleine largeur, confortable au pouce */
  .modal { align-items: flex-end; }
  .modal-glass { width: 100% !important; max-width: 100% !important; max-height: 92vh;
                 border-radius: 20px 20px 0 0; margin: 0; }

  /* En-têtes de cartes : titre + bouton sur deux lignes si serré */
  .card-header { flex-wrap: wrap; gap: var(--sp-2); }
}
