/* NESSA - Styles communs mutualisés
   Chargé via ae_head_meta.html sur toutes les pages.
   Variables, transitions globales, utilitaires, et composants réutilisables. */

[hidden]{ display:none !important; }

:root {
  --bg: #071e2f;
  --bg-alt: #0b2236;
  --card: #0f2a43;
  --card-hover: #163b5e;
  --stroke: #1a3a5c;
  --ink: #ffffff;
  --ink-dim: rgba(255,255,255,.78);
  --ink-mute: rgba(255,255,255,.62);
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --rose: #e6529c;
  --rose-strong: #b31f5e;
  --gradient-rose-bleu: linear-gradient(135deg, #e6529c 0%, #7d3f9c 50%, #0ea5e9 100%);
  --border-accent: rgba(125, 63, 156, 0.55);

  --ok: var(--rose);
  --warn: var(--rose);
  --err: var(--rose);
  --info: #60a5fa;

  /* Rayons (cohérents iOS-like) */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* Espacement (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Ombres (iOS-inspired : plus douces, moins tranchées) */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.12);
  --shadow-sm: 0 2px 6px rgba(0,0,0,.15);
  --shadow-md: 0 8px 24px rgba(0,0,0,.25);
  --shadow-lg: 0 20px 48px rgba(0,0,0,.35);

  /* Typographie (échelle 1.25) */
  --font: -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', Arial, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Menlo', 'Monaco', monospace;
  --fz-xs: 12px;
  --fz-sm: 13px;
  --fz-md: 14px;
  --fz-lg: 16px;
  --fz-xl: 20px;
  --fz-2xl: 24px;
  --fz-3xl: 32px;
  --lh: 1.5;

  /* Transitions (plus douces, iOS-style) */
  --transition: .2s cubic-bezier(.4,0,.2,1);
  --transition-fast: .15s cubic-bezier(.4,0,.2,1);
  --transition-slow: .35s cubic-bezier(.4,0,.2,1);

  /* Logo (uniforme partout) */
  --logo-height: 32px;

  /* Z-index (pile claire) */
  --z-base: 1;
  --z-sticky: 100;
  --z-modal: 1000;
  --z-tour: 10000;
  --z-toast: 99999;
}

/* Thème clair : fonds atténués mais textes toujours en blanc, conformément
   au choix d'avoir partout un texte blanc lisible sur les surfaces sombres. */
html[data-theme="clair"] {
  --bg: #1b3252;
  --bg-alt: #163351;
  --card: #163351;
  --card-hover: #1f4570;
  --stroke: rgba(255,255,255,0.14);
  --ink: #ffffff;
  --ink-dim: rgba(255,255,255,0.80);
  --ink-mute: rgba(255,255,255,0.60);
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --rose: #e6529c;
  --rose-strong: #b31f5e;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.18);
  --shadow-sm: 0 2px 6px rgba(0,0,0,.22);
  --shadow-md: 0 8px 24px rgba(0,0,0,.32);
  --shadow-lg: 0 20px 48px rgba(0,0,0,.42);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

/* Transitions fluides globales */
a, button, input, select, textarea, .btn, .card, .tuile {
  transition: all var(--transition);
}

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Boutons */
.nessa-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1px solid var(--stroke);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}
.nessa-btn:hover {
  background: var(--card-hover);
  border-color: rgba(255, 255, 255, 0.24);
  color: #fff;
  filter: brightness(1.05);
  transform: translateY(-1px);
}
.nessa-btn:active {
  transform: translateY(0);
}

/* Cards / Tuiles */
.nessa-card {
  background: var(--card);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  padding: 16px;
}
.nessa-card:hover {
  border-color: rgba(56,189,248,.3);
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
}

/* Scrollbar personnalisée */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.22); }

/* Animations d'entrée réutilisables */
@keyframes nessa-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes nessa-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.nessa-animate-in {
  animation: nessa-fade-in .35s ease both;
}

/* Toast / Notifications */
.nessa-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  animation: nessa-slide-up .3s ease both;
  box-shadow: 0 8px 30px rgba(0,0,0,.35);
}
.nessa-toast-ok   { background: rgba(17,47,77,.95); border: 1px solid rgba(179,31,94,.45); color: rgba(234,242,255,.92); }
.nessa-toast-err  { background: rgba(17,47,77,.95); border: 1px solid rgba(179,31,94,.55); color: rgba(234,242,255,.92); }
.nessa-toast-warn { background: rgba(17,47,77,.95); border: 1px solid rgba(179,31,94,.40); color: rgba(234,242,255,.92); }

/* Responsive utilitaires */
@media (max-width: 600px) {
  .nessa-hide-mobile { display: none !important; }
}
@media (min-width: 601px) {
  .nessa-hide-desktop { display: none !important; }
}

/* Responsive global (smartphone) */
@media (max-width: 768px) {
  /* Navigation */
  .ae-nav {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    margin-top: 8px;
    border-radius: 8px;
  }
  .ae-nav .links { gap: 6px; margin-left: 0; font-size: 13px; }
  .ae-nav .right { margin-left: 0; width: 100%; justify-content: space-between; font-size: 12px; }
  .ae-switch { padding: 6px 10px; font-size: 12px; }

  /* Containers globaux */
  body > div, main, .container, [style*="max-width:1200px"],
  [style*="max-width: 1200px"], [style*="max-width:1100px"],
  [style*="max-width: 1100px"] {
    max-width: 100% !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  /* Grilles et flex wrapping */
  .grid, [style*="grid-template-columns"], [style*="display:grid"],
  [style*="display: grid"] {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Tables responsives */
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; font-size: 13px; }
  th, td { padding: 8px 10px !important; white-space: nowrap; }

  /* Forms */
  input[type="text"], input[type="search"], input[type="email"],
  input[type="password"], input[type="url"], input[type="number"],
  select, textarea {
    font-size: 16px !important;
    max-width: 100% !important;
  }

  /* Cards, tuiles et boutons */
  .nessa-card { padding: 12px; }
  .nessa-btn { padding: 10px 14px; font-size: 13px; width: 100%; justify-content: center; }

  /* Fix scrolling iOS */
  html { -webkit-text-size-adjust: 100%; }

  /* Flex containers */
  [style*="display:flex"][style*="gap:2"], [style*="display: flex"][style*="gap:2"],
  [style*="display:flex"][style*="gap:3"], [style*="display: flex"][style*="gap:3"] {
    flex-wrap: wrap !important;
  }

  /* Images */
  img { max-width: 100%; height: auto; }

  /* Large headings */
  h1 { font-size: 1.5rem !important; }
  h2 { font-size: 1.25rem !important; }
  h3 { font-size: 1.1rem !important; }

  /* Toasts */
  .nessa-toast { left: 12px; right: 12px; bottom: 12px; }

  /* Profile menu overlay */
  .profil-menu-panel { width: 100vw !important; max-width: 100vw !important; right: 0 !important; border-radius: 0 !important; }
}

@media (max-width: 480px) {
  .ae-nav .links a { font-size: 12px; }
  .ae-nav > a { font-size: 14px; }
  body { font-size: 14px; }
}

/* Skeleton loading */
.nessa-skeleton {
  background: linear-gradient(90deg, var(--card) 25%, rgba(255,255,255,.06) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: nessa-shimmer 1.5s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes nessa-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Utilitaires de texte */
.nessa-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Page transitions (pour un chargement fluide) */
body {
  animation: nessa-page-in .3s ease both;
}
@keyframes nessa-page-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Animations avatar / compagnon */
@keyframes ae-avatar-breathe {
  0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
  25%      { transform: translateY(-3px) scale(1.015) rotate(.5deg); }
  50%      { transform: translateY(-5px) scale(1.03) rotate(0deg); }
  75%      { transform: translateY(-3px) scale(1.015) rotate(-.5deg); }
}
@keyframes ae-avatar-blink {
  0%, 90%, 100% { clip-path: inset(0 0 0 0); }
  94%            { clip-path: inset(30% 5% 30% 5%); }
}
@keyframes ae-avatar-speak-bounce {
  0%   { transform: translateY(20px) scale(.6); opacity: 0; }
  18%  { transform: translateY(-18px) scale(1.1); opacity: 1; }
  30%  { transform: translateY(3px) scale(.96); }
  42%  { transform: translateY(-12px) scale(1.07); }
  54%  { transform: translateY(2px) scale(.98); }
  66%  { transform: translateY(-7px) scale(1.04); }
  78%  { transform: translateY(0) scale(1); }
  88%  { transform: translateY(-3px) scale(1.02); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes ae-avatar-entrance {
  0%   { transform: translateY(30px) scale(.6); opacity: 0; }
  40%  { transform: translateY(-12px) scale(1.08); opacity: 1; }
  60%  { transform: translateY(4px) scale(.97); }
  80%  { transform: translateY(-3px) scale(1.02); }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

.ae-notif-bulle-avatar img,
.ae-companion-avatar img,
.ae-loading-avatar img,
.ae-bye-avatar img,
.ae-msg1-avatar img,
.ae-demande-avatar img,
.ae-welcome-avatar img {
  animation:
    ae-avatar-entrance .7s cubic-bezier(.34,1.56,.64,1) both,
    ae-avatar-breathe 3.5s ease-in-out infinite .7s,
    ae-avatar-blink 5s ease infinite 1s;
  transform-origin: center bottom;
}

/* Phase « parle » : entrée + rebond amplifié */
.ae-avatar-speaking img,
.ae-notif-bulle-avatar.speaking img,
.ae-loading-avatar.speaking img,
.ae-bye-avatar.speaking img,
.ae-msg1-avatar.speaking img,
.ae-demande-avatar.speaking img,
.ae-welcome-avatar.speaking img {
  animation: ae-avatar-speak-bounce 1.2s cubic-bezier(.22,1,.36,1) both,
    ae-avatar-breathe 3.5s ease-in-out infinite 1.2s,
    ae-avatar-blink 5s ease infinite 1.5s;
  transform-origin: center bottom;
}

/* Après parole : juste respiration + clignotement, SANS rejouer l'entrée */
.ae-notif-bulle-avatar.ae-entered img,
.ae-companion-avatar.ae-entered img,
.ae-loading-avatar.ae-entered img,
.ae-bye-avatar.ae-entered img,
.ae-msg1-avatar.ae-entered img,
.ae-demande-avatar.ae-entered img,
.ae-welcome-avatar.ae-entered img {
  animation:
    ae-avatar-breathe 3.5s ease-in-out infinite,
    ae-avatar-blink 5s ease infinite;
  transform-origin: center bottom;
}

@keyframes ae-bulle-pop {
  0%   { opacity: 0; transform: scale(.85) translateY(6px); }
  60%  { opacity: 1; transform: scale(1.03) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
.ae-notif-bulle-wrapper .ae-notif-bulle,
.ae-bye-bulle,
.ae-loading-bulle,
.ae-msg1-bulle {
  animation: ae-bulle-pop .4s cubic-bezier(.34,1.56,.64,1) both;
}

/* Focus-visible global (nav clavier claire, iOS/macOS-like). */
a:focus-visible, button:focus-visible,
[role="button"]:focus-visible, [tabindex]:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible,
.nessa-btn:focus-visible, .tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Toast unifié : remplace les alert(), console + zone aria-live pour les
   lecteurs d'écran. Usage JS : NessaToast.ok("Sauvegardé"), .err("Oups"),
   .warn("Attention"). */
#nessa-toast-region {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 14px;
  z-index: var(--z-toast);
  pointer-events: none;
}
#nessa-toast-region .nessa-toast-wrap {
  display: flex; align-items: flex-end; gap: 10px;
  pointer-events: auto;
  animation: nessa-toast-in .35s cubic-bezier(.22,1.61,.36,1) both;
}
#nessa-toast-region .nessa-toast-avatar {
  width: 74px; height: 74px; flex-shrink: 0;
  display: flex; align-items: flex-end; justify-content: center;
}
#nessa-toast-region .nessa-toast-avatar img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  transform-origin: center bottom;
  animation: nessa-companion-bounce 1.1s cubic-bezier(.28,.84,.42,1) 2;
}
@keyframes nessa-companion-bounce {
  0%   { transform: translateY(0)     scaleY(1); }
  25%  { transform: translateY(-12px) scaleY(1.05); }
  45%  { transform: translateY(0)     scaleY(.92); }
  55%  { transform: translateY(0)     scaleY(1.04); }
  70%  { transform: translateY(-5px)  scaleY(1.02); }
  100% { transform: translateY(0)     scaleY(1); }
}
@keyframes nessa-toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
#nessa-toast-region .nessa-toast-wrap.nessa-toast--leaving {
  animation: nessa-slide-down .2s ease both;
}
#nessa-toast-region .nessa-toast {
  position: static;
  pointer-events: auto;
  min-width: 220px;
  max-width: 380px;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  font-size: var(--fz-md);
  line-height: 1.4;
  animation: nessa-slide-up .28s cubic-bezier(.4,0,.2,1) both;
}
#nessa-toast-region .nessa-toast.nessa-toast--leaving {
  animation: nessa-slide-down .2s ease both;
}
@keyframes nessa-slide-down {
  to { opacity: 0; transform: translateY(10px); }
}
#nessa-toast-region .nessa-toast-wrap--no-avatar { padding-left: 0; }
@media (max-width: 600px) {
  #nessa-toast-region { left: 12px; right: 12px; bottom: 12px; }
  #nessa-toast-region .nessa-toast { max-width: none; }
}

/* Logo : taille uniforme dans la nav et le header. */
.nessa-logo-img {
  height: var(--logo-height);
  width: auto;
  display: inline-block;
  vertical-align: middle;
}

/* Bouton primaire unique : inspiration iOS, couleur pleine et radius doux. */
.nessa-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #062032;
  font-weight: 700;
  font-size: var(--fz-md);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition-fast), box-shadow var(--transition);
}
.nessa-btn-primary:hover {
  filter: brightness(1.1) saturate(1.05);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.nessa-btn-primary:active { transform: translateY(0); }
.nessa-btn-primary:disabled { opacity: .5; cursor: not-allowed; }

/* Impression : export PDF d'une note via Cmd/Ctrl + P. */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .ae-nav, .ae-toolbar, .tox-toolbar, .tox-statusbar,
  #ae-tour-backdrop, #ae-tour-hole, .ae-tour-card,
  #ae-quiz-overlay, .ae-msg-bubble, .nessa-noprint,
  #nessa-toast-region {
    display: none !important;
  }
  #note-titre, .note-titre, h1, h2, h3 { color: #000 !important; }
  #note-contenu, .mce-content-body, .prose, article.note {
    color: #000 !important;
    background: #fff !important;
    max-width: 100% !important;
    padding: 0 !important;
    box-shadow: none !important;
  }
  @page { margin: 18mm 16mm; }
}

/* ============== Boîtes de dialogue NESSA (confirm/alert/prompt) ============== */
#nessa-dialog-root .nessa-dlg-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 30, 47, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 20px;
}
#nessa-dialog-root .nessa-dlg-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}
#nessa-dialog-root .nessa-dlg-box {
  position: relative;
  background: linear-gradient(180deg, rgba(11, 34, 54, 0.98), rgba(7, 30, 47, 0.98));
  border-radius: 18px;
  padding: 18px 22px 16px;
  width: min(440px, 92vw);
  color: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid transparent;
  background-clip: padding-box;
  transform: translateY(14px) scale(0.96);
  opacity: 0;
  transition:
    transform 0.38s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
#nessa-dialog-root .nessa-dlg-backdrop.is-open .nessa-dlg-box {
  transform: translateY(0) scale(1);
  opacity: 1;
}
#nessa-dialog-root .nessa-dlg-box::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, #e6529c 0%, #7d3f9c 50%, #0ea5e9 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
#nessa-dialog-root .nessa-dlg-avatar {
  position: absolute;
  top: -44px;
  left: 18px;
  width: 84px;
  height: 84px;
  border-radius: 0;
  background: transparent;
  border: none;
  overflow: visible;
  display: grid;
  place-items: center;
}
#nessa-dialog-root .nessa-dlg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center bottom;
  animation: nessa-companion-bounce 1.15s cubic-bezier(.28,.84,.42,1) 2;
}
#nessa-dialog-root .nessa-dlg-content {
  margin-top: 32px;
  margin-bottom: 14px;
}
#nessa-dialog-root .nessa-dlg-title {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}
#nessa-dialog-root .nessa-dlg-msg {
  font-size: 14px;
  line-height: 1.5;
  color: #fff;
  white-space: pre-wrap;
}
#nessa-dialog-root .nessa-dlg-input {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: 10px;
  padding: 9px 12px;
  color: #fff;
  font-size: 14px;
  outline: none;
}
#nessa-dialog-root .nessa-dlg-input:focus {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}
#nessa-dialog-root .nessa-dlg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
#nessa-dialog-root .nessa-dlg-btn {
  border: 1px solid rgba(255, 255, 255, 0.20);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  padding: 9px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: filter 0.12s, transform 0.12s, background 0.12s;
}
#nessa-dialog-root .nessa-dlg-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
  filter: brightness(1.05);
  transform: translateY(-1px);
}
#nessa-dialog-root .nessa-dlg-btn-primary {
  background: linear-gradient(135deg, #e6529c 0%, #7d3f9c 50%, #0ea5e9 100%);
  border: none;
  color: #fff;
  box-shadow: 0 6px 18px rgba(125, 63, 156, 0.30);
}
#nessa-dialog-root .nessa-dlg-btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
@media (max-width: 480px) {
  #nessa-dialog-root .nessa-dlg-box { padding: 16px 18px 14px; }
  #nessa-dialog-root .nessa-dlg-avatar { width: 54px; height: 54px; top: -28px; }
  #nessa-dialog-root .nessa-dlg-actions { flex-wrap: wrap; }
  #nessa-dialog-root .nessa-dlg-btn { flex: 1 0 auto; }
}

/* ============== Cohérence globale : texte blanc, contours rose-bleu ============== */
body, .nessa-card, .ae-card, .card, .modal, .dialog, .panel, .panneau,
.encart, .surface, .menu, [role="dialog"] {
  color: var(--ink);
}
input, select, textarea, button {
  color: inherit;
}
input::placeholder, textarea::placeholder {
  color: var(--ink-mute);
}

/* Encarts à liseré dégradé rose-bleu (1px de bord lumineux discret) */
.nessa-bordered, .ae-bordered, [data-bordered="rose-bleu"] {
  position: relative;
  isolation: isolate;
}
.nessa-bordered::before, .ae-bordered::before, [data-bordered="rose-bleu"]::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--gradient-rose-bleu);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  z-index: 1;
}

/* ========== Survol global : léger éclaircissement (sans dégradé) ==========
   Ajoutez la classe .ae-no-hover sur un contrôle pour désactiver ce style.
   Les boutons primaires déjà en dégradé fort (.nessa-btn-primary, etc.)
   utilisent surtout filter + ombre pour rester lisibles. */
button:not([disabled]):not([aria-disabled="true"]):not(.ae-no-hover):hover,
input[type="submit"]:not([disabled]):not(.ae-no-hover):hover,
input[type="button"]:not([disabled]):not(.ae-no-hover):hover,
input[type="reset"]:not([disabled]):not(.ae-no-hover):hover,
a.btn:not([aria-disabled="true"]):not(.ae-no-hover):hover,
button.btn:not([disabled]):not(.ae-no-hover):hover,
.ae-btn:not([disabled]):not([aria-disabled="true"]):not(.ae-no-hover):hover,
[role="button"]:not([aria-disabled="true"]):not(.ae-no-hover):hover {
  background-image: none;
  filter: brightness(1.06);
  border-color: rgba(255, 255, 255, 0.22);
}

/* ========== Fenêtres / modales : entrée fluide (type macOS) ========== */
@keyframes nessa-modal-backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes nessa-modal-panel-in {
  from {
    opacity: 0;
    transform: scale(0.94) translateY(18px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Overlays IA & partage : le panneau est enfant direct de [role="dialog"] */
.ae-recherche-overlay.show,
.ae-corrige-overlay.show,
.ae-quiz-overlay.show,
.ae-expli-overlay.show,
.ae-pp-overlay.show {
  animation: nessa-modal-backdrop-in 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.ae-recherche-overlay.show > [role="dialog"],
.ae-corrige-overlay.show > [role="dialog"],
.ae-quiz-overlay.show > [role="dialog"],
.ae-expli-overlay.show > [role="dialog"],
.ae-pp-overlay.show > [role="dialog"] {
  animation: nessa-modal-panel-in 0.42s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Palette Cmd+K : overlay = dialog, la boîte est l'enfant */
.nessa-cmdk-overlay:not([hidden]) {
  animation: nessa-modal-backdrop-in 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.nessa-cmdk-overlay:not([hidden]) .nessa-cmdk-box {
  animation: nessa-modal-panel-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Modale « ajouter un document » (home) */
.ajout-menu.open {
  animation: nessa-modal-panel-in 0.38s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* PDF perso / document public : modale cartes + inactivité */
.modal-backdrop.is-open {
  animation: nessa-modal-backdrop-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.modal-backdrop.is-open .modal-card {
  animation: nessa-modal-panel-in 0.42s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.ae-inactivite-overlay.ae-overlay-open {
  animation: nessa-modal-backdrop-in 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.ae-inactivite-overlay.ae-overlay-open .ae-inactivite-box {
  animation: nessa-modal-panel-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Responsive global : tablette + smartphone */
@media (max-width: 1024px) {
  body { font-size: 14px; }
  .ae-container, .container, main { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 768px) {
  body { font-size: 13.5px; }
  h1 { font-size: 22px; }
  h2 { font-size: 18px; }
  h3 { font-size: 16px; }
  table { display: block; overflow-x: auto; max-width: 100%; }
  img, video { max-width: 100%; height: auto; }
  .ae-grid, .grid { grid-template-columns: 1fr !important; }
  .ae-row, .row { flex-direction: column; }
}
@media (max-width: 480px) {
  body { font-size: 13px; }
  button, .btn, .ae-btn { min-height: 44px; }
  input, select, textarea { font-size: 16px; }  /* évite le zoom iOS */
}
