/* =============================================================
 * MultiNewsletter+ — Compose (landing fork, popup)
 *
 * Structure = landing-drop-create.css : un préambule « overlay » ci-dessous,
 * puis la COPIE INTÉGRALE de zic_admin_python/.../admin-newsletter.css (la
 * feuille est autonome : ses 22 variables --nl-* vivent sur .nl-root).
 *
 * Deux substitutions mécaniques dans la copie — les seules — pour que
 * l'accent suive le remap bleu :
 *   1. rgba(123, 63, 242, x)  →  rgba(var(--nl-accent-rgb), x)   (13 littéraux)
 *   2. .nl-cover-ph-icon { background:#EDE9FE }  →  var(--nl-purple-bg)
 * Contrôle : `grep -n '123, *63, *242'` ne doit renvoyer que la ligne de
 * définition de --nl-accent-rgb.
 * ============================================================= */

/* ---------- Overlay popup (landing seulement) ----------
 *
 * Architecture (alignée sur landing-drop-create.css) :
 *   .zl-nlc-overlay (position: fixed, inset:0, flex, backdrop+blur)
 *     └─ .zl-nlc-overlay-card (max-width 920px, max-height vh, radius 22px)
 *          ├─ .zl-nlc-overlay-close (X en haut à droite de la card)
 *          └─ #nl-root (le compose verbatim, scrolle dans la card)
 *
 * Mobile (≤720px) : la card occupe tout l'écran (100vw × 100dvh, no radius).
 * Le scroll vit dans #nl-root (overflow-y: auto), pas dans l'overlay.
 * ---------------------------------------------------------- */
.zl-nlc-overlay {
  position: fixed;
  inset: 0;
  z-index: 4500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--pp-scrim, rgba(10, 6, 28, 0.55));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms cubic-bezier(0.4, 0, 0.2, 1);
}
.zl-nlc-overlay[hidden] { display: none !important; }
.zl-nlc-overlay:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}

.zl-nlc-overlay-card {
  position: relative;
  width: 100%;
  max-width: 920px;
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  background: var(--nl-bg, #F7F6FB);
  border-radius: 22px;
  box-shadow: 0 30px 80px var(--pp-shadow, rgba(8, 4, 22, 0.45));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* NE JAMAIS passer cette transform à `none` (même en reduced-motion) :
     elle crée le containing-block des `position:fixed` internes (.nl-modal,
     .nl-toasts) → ils restent collés à la card, et son stacking context
     isole leurs z-index du reste du landing. */
  transform: translateY(12px) scale(0.985);
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
}
.zl-nlc-overlay:not([hidden]) .zl-nlc-overlay-card {
  transform: translateY(0) scale(1);
}

/* Bouton close, posé sur la card (au-dessus du contenu scrollé). */
.zl-nlc-overlay-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--pp-border, #e5e7eb);
  background: var(--pp-card, #ffffff);
  color: var(--pp-text, #1f2937);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 160ms, transform 160ms;
}
.zl-nlc-overlay-close:hover {
  background: var(--pp-card-light, #f3f4f6);
  transform: scale(1.05);
}
.zl-nlc-overlay-close:focus-visible {
  outline: 2px solid var(--nl-purple, #3B82F6);
  outline-offset: 2px;
}
.zl-nlc-overlay-close svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* Le compose à l'intérieur de la card : scrolle en interne, jamais le body.
 *
 * CRITIQUE (V1) — `.nl-root` n'a AUCUN padding propre (ni horizontal ni top) :
 * dans l'admin c'est `.aw-main` du workspace_shell qui le fournit
 * (padding: 24px 20px 48px). Hors du shell, il faut le poser ici — asymétrie
 * vs le Drop, dont `.adc-root` porte son propre padding. 56px à droite =
 * bouton X (36px) + right:14px + marge, pour que le X ne recouvre pas la
 * carte « Audience ». admin-newsletter.css n'ayant AUCUN reset box-sizing
 * (contrairement à admin-drop-create.css), on le pose aussi. */
.zl-nlc-overlay-card .nl-root {
  min-height: 0;
  height: 100%;
  width: 100%;
  max-width: none;
  margin: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border-radius: 22px;
  box-sizing: border-box;
  padding: 26px 56px 40px 26px;
}
.zl-nlc-overlay-card .nl-root *,
.zl-nlc-overlay-card .nl-root *::before,
.zl-nlc-overlay-card .nl-root *::after {
  box-sizing: border-box;
}

/* Le bouton « Retour » intra-popup (data-zl-nlc-overlay-close) ferme le popup
   au lieu de naviguer vers le dashboard admin. C'est un <button>, pas un <a>. */
.zl-nlc-root .nl-back.zl-nlc-back {
  cursor: pointer;
  background: none;
  border: 0;
  font: inherit;
  padding: 0;
}

/* Quand le popup est ouvert : freeze body scroll. Par CLASSE et non par style
   inline : confirmAction() fait `body.style.overflow = ""` à sa fermeture, ce
   qui effacerait un verrou posé en inline — la classe, elle, reprend la main. */
body.zl-nlc-open {
  overflow: hidden;
}

/* La card est containing-block ET stacking context des `position:fixed`
   internes (cf. transform) : on bumpe seulement leurs z-index au-dessus du
   contenu scrollé. */
.zl-nlc-overlay .nl-modal  { z-index: 50; }
.zl-nlc-overlay .nl-toasts { z-index: 60; }

/* ────────────────────────────────────────────────────────────
   Accent bleu (#3B82F6 = accent de la slide 4 / module news).
   Remap du CHROME uniquement : --seg-color / --tpl-accent sont des DONNÉES
   (couleurs des segments seedés et du catalogue de templates) — intouchées.
   --nl-blue existe déjà dans le jeu de tokens admin avec cette valeur.
   ──────────────────────────────────────────────────────────── */
.zl-nlc-overlay .zl-nlc-root {
  --nl-purple: #3B82F6;
  --nl-purple-dk: #2563EB;
  --nl-purple-bg: #EFF6FF;
  --nl-accent-rgb: 59, 130, 246;
}

/* Neutralisation des fuites landing → popup : mobile.css (chargé par
   base.html sur toutes les pages) impose `:focus-visible { outline: 2px solid
   #7c3aed; border-radius: 4px }`. La cascade étant PAR DÉCLARATION, il faut
   re-déclarer outline-color ET border-radius sous l'overlay. */
.zl-nlc-overlay :focus-visible {
  outline-color: var(--nl-purple, #3B82F6);
}
.zl-nlc-overlay .nl-input:focus-visible,
.zl-nlc-overlay .nl-textarea:focus-visible { border-radius: 9px; }
.zl-nlc-overlay .nl-btn:focus-visible { border-radius: 10px; }
.zl-nlc-overlay .nl-chip:focus-visible { border-radius: 6px; }
.zl-nlc-overlay .nl-cover:focus-visible { border-radius: 12px; }
.zl-nlc-overlay .nl-segment:focus-within,
.zl-nlc-overlay .nl-template-opt:focus-within { border-radius: 9px; }

/* Colonnes du compose dans la card 920px : le `1fr 420px` admin laisserait
   ~400px à l'éditeur — on resserre l'aside. SCOPE ≥1024px obligatoire : à
   (0,2,0) cette règle bat la bascule 1 colonne du bloc mobile admin (0,1,0),
   qui doit reprendre la main sous 1024px. */
@media (min-width: 1024px) {
  .zl-nlc-overlay .nl-compose {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}

/* promptEmail() / confirmAction() : panneau étroit via classe (un style
   inline max-width battrait les media queries mobile) + erreur de champ. */
.zl-nlc-overlay .nl-modal-panel--sm { max-width: 420px; }
.zl-nlc-overlay .nl-field-err {
  margin: 8px 0 0;
  font-size: 12.5px;
  font-weight: 600;
  color: #DC2626;
}

/* ────────────────────────────────────────────────────────────
   Mobile (≤720px) : card fullscreen, sans radius ni ombre.
   Le padding du root est RÉ-ÉCRIT ici : le shorthand du préambule
   (spécificité 0,2,0) écrase le `padding-bottom: 32px` du bloc mobile
   admin (0,1,0) — cette ré-écriture est obligatoire, pas décorative.
   ──────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .zl-nlc-overlay {
    padding: 0;
    align-items: stretch;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(10, 6, 28, 0.75);
  }
  .zl-nlc-overlay-card {
    max-width: 100vw;
    width: 100vw;
    max-height: 100vh;
    max-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
  .zl-nlc-overlay-card .nl-root {
    border-radius: 0;
    padding: 20px 52px 32px 16px;
  }
  .zl-nlc-overlay-close {
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    box-shadow: 0 4px 12px var(--pp-shadow-soft, rgba(15, 0, 36, 0.18));
  }
}

/* ────────────────────────────────────────────────────────────
   Tablette 721–1024px : card pleine largeur (moins marges 16px).
   ──────────────────────────────────────────────────────────── */
@media (max-width: 1024px) and (min-width: 721px) {
  .zl-nlc-overlay {
    padding: 16px;
  }
  .zl-nlc-overlay-card {
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
  }
}

/* ────────────────────────────────────────────────────────────
   Cibles tactiles ≥44px (mesuré : .nl-btn ≈37.6px, .nl-segment ≈35px,
   .nl-cover-remove 28px, .nl-modal-close 32px).
   ──────────────────────────────────────────────────────────── */
@media (pointer: coarse) {
  .zl-nlc-overlay .nl-btn,
  .zl-nlc-overlay .nl-segment,
  .zl-nlc-overlay .nl-template-opt,
  .zl-nlc-overlay .nl-mode-card { min-height: 44px; }
  .zl-nlc-overlay .nl-cover-remove,
  .zl-nlc-overlay .nl-modal-close { width: 44px; height: 44px; }
  .zl-nlc-overlay .nl-vars { gap: 10px; }
  .zl-nlc-overlay .nl-chip { position: relative; }
  .zl-nlc-overlay .nl-chip::after {
    content: "";
    position: absolute;
    inset: -8px -5px;
  }
}

/* =============================================================
 * Ci-dessous : copie intégrale de admin-newsletter.css (fork).
 * Ne pas éditer à la main hors re-sync — cf. en-tête du fichier.
 * ============================================================= */

/* =============================================================================
 * ZIC Admin — MultiNewsletter+
 * Préfixe `.nl-*` pour éviter toute collision avec le shell workspace.
 *
 * Breakpoints :
 *   mobile  < 768px         (stack vertical, tableaux → cartes, modal full-screen)
 *   tablet  768 – 1023px    (grilles 2-col, sidebar compose sous l'éditeur)
 *   desktop ≥ 1024px        (grilles 3-4 col, sidebar compose à droite)
 *   wide    ≥ 1280px        (max-width container)
 *
 * Tokens couleurs alignés sur window.W du JSX :
 * ============================================================================= */

/* `[hidden]` doit toujours masquer — sinon nos `.nl-btn { display: inline-flex }`
   le surchargent (même spécificité, déclaré plus tard). Scopé à .nl-root pour
   ne rien casser ailleurs dans l'admin. */
.nl-root [hidden],
[hidden][data-nl-modal],
[hidden][data-nl-step-pane] {
  display: none !important;
}

.nl-root {
  --nl-purple: #7B3FF2;
  --nl-accent-rgb: 123, 63, 242;
  --nl-purple-dk: #5B1FCF;
  --nl-purple-bg: #F4F3FB;
  --nl-text: #1F1340;
  --nl-text-muted: #6B7280;
  --nl-border: rgba(31, 19, 64, 0.08);
  --nl-border-strong: rgba(31, 19, 64, 0.16);
  --nl-card-bg: #fff;
  --nl-card-shadow: 0 1px 2px rgba(31, 19, 64, 0.04);
  --nl-card-radius: 14px;
  --nl-input-bg: #FAFAFB;
  --nl-green: #16A34A;
  --nl-green-bg: #DCFCE7;
  --nl-amber: #F59E0B;
  --nl-amber-bg: #FEF3C7;
  --nl-pink: #EC4899;
  --nl-pink-bg: #FCE7F3;
  --nl-blue: #3B82F6;
  --nl-blue-bg: #DBEAFE;
  --nl-sidebar-bg: #1F1340;
  --nl-font: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --nl-font-display: "Space Grotesk", "DM Sans", sans-serif;

  font-family: var(--nl-font);
  color: var(--nl-text);
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1280px;
  margin: 0 auto;
  padding-bottom: 40px;
}

/* ---------------------------------------------------------------------------
 * Tabs sticky
 * --------------------------------------------------------------------------- */

.nl-tabs {
  display: flex;
  gap: 4px;
  background: var(--nl-card-bg);
  border-radius: var(--nl-card-radius);
  padding: 6px;
  box-shadow: var(--nl-card-shadow);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: sticky;
  top: 0;
  z-index: 5;
  margin-top: -4px;
}
.nl-tabs::-webkit-scrollbar { display: none; }

.nl-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 9px;
  text-decoration: none;
  color: var(--nl-text-muted);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.nl-tab svg { width: 16px; height: 16px; flex-shrink: 0; }
.nl-tab:hover { background: var(--nl-input-bg); color: var(--nl-text); }
.nl-tab.is-active {
  background: linear-gradient(135deg, var(--nl-purple-dk), var(--nl-purple));
  color: #fff;
  box-shadow: 0 4px 12px rgba(var(--nl-accent-rgb), 0.3);
}
.nl-tab:focus-visible { outline: 2px solid var(--nl-purple); outline-offset: 2px; }

/* ---------------------------------------------------------------------------
 * Cards & buttons (atomes)
 * --------------------------------------------------------------------------- */

.nl-card {
  background: var(--nl-card-bg);
  border-radius: var(--nl-card-radius);
  box-shadow: var(--nl-card-shadow);
  padding: 22px;
}

.nl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-family: var(--nl-font);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  background: var(--nl-card-bg);
  color: var(--nl-text);
  transition: transform 0.08s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.2;
}
.nl-btn:focus-visible { outline: 2px solid var(--nl-purple); outline-offset: 2px; }
.nl-btn:active { transform: translateY(1px); }
.nl-btn--primary {
  background: linear-gradient(135deg, var(--nl-purple-dk), var(--nl-purple));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(var(--nl-accent-rgb), 0.35);
}
.nl-btn--primary:hover { box-shadow: 0 8px 22px rgba(var(--nl-accent-rgb), 0.45); }
.nl-btn--ghost {
  background: var(--nl-card-bg);
  color: var(--nl-text);
  border-color: var(--nl-border);
}
.nl-btn--ghost:hover { background: var(--nl-input-bg); }
.nl-btn--light {
  background: #fff;
  color: var(--nl-purple-dk);
  border-color: transparent;
}
.nl-btn--danger {
  background: #DC2626;
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.35);
}
.nl-btn--danger:hover { box-shadow: 0 8px 22px rgba(220, 38, 38, 0.45); }
.nl-btn--lg { padding: 13px 22px; font-size: 14px; }
.nl-btn--sm { padding: 8px 12px; font-size: 12px; }
.nl-btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.nl-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--nl-border);
  color: var(--nl-text-muted);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.nl-icon-btn:hover { background: var(--nl-input-bg); color: var(--nl-text); }
.nl-icon-btn--danger:hover { color: #DC2626; background: #FEE2E2; }
.nl-icon-btn:focus-visible { outline: 2px solid var(--nl-purple); outline-offset: 2px; }

.nl-link {
  color: var(--nl-purple);
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.nl-link:hover { text-decoration: underline; }
.nl-link--sm { font-size: 12px; }

.nl-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--nl-text-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 14px;
}
.nl-back:hover { color: var(--nl-text); }

/* ---------------------------------------------------------------------------
 * Hero
 * --------------------------------------------------------------------------- */

.nl-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  background: linear-gradient(135deg, var(--nl-sidebar-bg) 0%, var(--nl-purple-dk) 60%, var(--nl-purple) 100%);
  color: #fff;
  padding: 24px 28px;
}
.nl-hero--onboarding { padding: 30px 32px; }
.nl-hero-bg {
  position: absolute;
  right: -60px; top: -60px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  filter: blur(40px);
  pointer-events: none;
}
.nl-hero-icon {
  width: 54px; height: 54px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.16);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.nl-hero-content { flex: 1; min-width: 240px; position: relative; }
.nl-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  opacity: 0.78;
  margin-bottom: 4px;
}
.nl-hero-title {
  margin: 0 0 4px;
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.5px;
  line-height: 1.15;
}
.nl-hero--onboarding .nl-hero-title { font-size: 28px; letter-spacing: -0.8px; }
.nl-hero-subtitle {
  margin: 0;
  font-size: 14px;
  opacity: 0.88;
  line-height: 1.5;
}
.nl-hero-cta { position: relative; }

/* ---------------------------------------------------------------------------
 * Grids
 * --------------------------------------------------------------------------- */

.nl-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.nl-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.nl-grid-templates {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ---------------------------------------------------------------------------
 * Onboarding steps
 * --------------------------------------------------------------------------- */

.nl-step {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}
.nl-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nl-step-icon {
  width: 38px; height: 38px;
  border-radius: 11px;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--nl-font-display);
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(var(--nl-accent-rgb), 0.35);
}
.nl-step-icon svg { width: 18px; height: 18px; }
.nl-step-icon--purple { background: linear-gradient(135deg, #7B3FF2, #7B3FF2AA); }
.nl-step-icon--amber  { background: linear-gradient(135deg, #F59E0B, #F59E0BAA); box-shadow: 0 6px 16px rgba(245, 158, 11, 0.35); }
.nl-step-icon--green  { background: linear-gradient(135deg, #22C55E, #22C55EAA); box-shadow: 0 6px 16px rgba(34, 197, 94, 0.35); }
.nl-step-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #FAFAFB;
  color: var(--nl-text-muted);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 12px;
  border: 1px solid var(--nl-border);
}
.nl-step-title {
  margin: 0 0 4px;
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.2px;
  color: var(--nl-text);
  line-height: 1.3;
}
.nl-step-desc {
  margin: 0;
  font-size: 13px;
  color: var(--nl-text-muted);
  line-height: 1.5;
}
.nl-step-cta { margin-top: auto; align-self: flex-start; }

/* ---------------------------------------------------------------------------
 * KPI stats
 * --------------------------------------------------------------------------- */

.nl-stat {
  background: var(--nl-card-bg);
  border-radius: var(--nl-card-radius);
  box-shadow: var(--nl-card-shadow);
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 130px;
}
.nl-stat--compact { min-height: 90px; padding: 14px 18px; gap: 6px; }
.nl-stat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nl-stat-label {
  font-size: 11px;
  color: var(--nl-text-muted);
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.nl-stat-icon {
  width: 30px; height: 30px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
}
.nl-stat-icon svg { width: 16px; height: 16px; }
.nl-stat-icon--purple { background: #EDE9FE; color: var(--nl-purple); }
.nl-stat-icon--green  { background: var(--nl-green-bg);  color: var(--nl-green); }
.nl-stat-icon--amber  { background: var(--nl-amber-bg);  color: var(--nl-amber); }
.nl-stat-icon--pink   { background: var(--nl-pink-bg);   color: var(--nl-pink); }
.nl-stat-icon--blue   { background: var(--nl-blue-bg);   color: var(--nl-blue); }
.nl-stat-value {
  margin: 0;
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 28px;
  color: var(--nl-text);
  letter-spacing: -0.6px;
  line-height: 1;
}
.nl-stat-sub { margin: 0; font-size: 11.5px; color: var(--nl-text-muted); }

/* ---------------------------------------------------------------------------
 * Recent campaigns list (dashboard)
 * --------------------------------------------------------------------------- */

.nl-recent { padding: 0; overflow: hidden; }
.nl-recent-head {
  padding: 16px 22px;
  border-bottom: 1px solid var(--nl-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nl-recent-title {
  margin: 0;
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.3px;
}
.nl-recent-item {
  padding: 14px 22px;
  border-bottom: 1px solid var(--nl-border);
  display: flex;
  align-items: center;
  gap: 14px;
}
.nl-recent-item:last-child { border-bottom: none; }
.nl-recent-main { flex: 1; min-width: 0; }
.nl-recent-item-title {
  margin: 0 0 3px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--nl-text);
}
.nl-recent-item-meta {
  margin: 0;
  font-size: 11.5px;
  color: var(--nl-text-muted);
}
.nl-recent-rates { display: flex; gap: 12px; align-items: center; }
.nl-recent-rate {
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 13.5px;
}
.nl-recent-rate--green { color: var(--nl-green); }
.nl-recent-rate--amber { color: var(--nl-amber); }

/* ---------------------------------------------------------------------------
 * Status pills
 * --------------------------------------------------------------------------- */

.nl-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 100px;
  font-weight: 700;
  font-size: 11.5px;
  white-space: nowrap;
}
.nl-pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.nl-pill--sent       { background: var(--nl-green-bg); color: var(--nl-green); }
.nl-pill--scheduled  { background: var(--nl-amber-bg); color: var(--nl-amber); }
.nl-pill--sending    { background: var(--nl-blue-bg);  color: var(--nl-blue); }
.nl-pill--draft      { background: var(--nl-purple-bg); color: var(--nl-text-muted); }
.nl-pill--failed     { background: #FEE2E2; color: #DC2626; }

/* ---------------------------------------------------------------------------
 * Empty states
 * --------------------------------------------------------------------------- */

.nl-empty-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #FAFAFB;
  border: 1px dashed var(--nl-border);
  box-shadow: none;
}
.nl-empty-icon {
  width: 48px; height: 48px;
  border-radius: 13px;
  background: rgba(var(--nl-accent-rgb), 0.1);
  color: var(--nl-purple);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.nl-empty-title {
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 15px;
  color: var(--nl-text);
  margin-bottom: 3px;
}
.nl-empty-body {
  font-size: 13px;
  color: var(--nl-text-muted);
  line-height: 1.5;
  margin: 0;
}
.nl-empty-line {
  text-align: center;
  color: var(--nl-text-muted);
  font-size: 13px;
  padding: 28px 16px;
  margin: 0;
}
.nl-empty-block {
  text-align: center;
  padding: 36px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.nl-empty-block .nl-empty-title { font-size: 16px; }
.nl-empty-block .nl-empty-body { max-width: 360px; }
.nl-empty-block .nl-btn { margin-top: 8px; }

/* ---------------------------------------------------------------------------
 * Compose
 * --------------------------------------------------------------------------- */

.nl-compose {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 18px;
  align-items: flex-start;
}
.nl-compose-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.nl-compose-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.nl-compose-card { padding: 24px 26px; }
.nl-compose-title {
  margin: 0 0 18px;
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.4px;
}
.nl-compose-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.nl-compose-actions-spacer { flex: 1; min-width: 0; }

.nl-field { display: block; margin-bottom: 14px; min-width: 0; }
.nl-field:last-child { margin-bottom: 0; }
.nl-field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--nl-text-muted);
  margin-bottom: 6px;
}
.nl-field-help {
  margin: 0 0 8px;
  font-size: 12.5px;
  color: var(--nl-text-muted);
}
.nl-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
/* Grid items doivent pouvoir shrink en dessous de leur contenu intrinseque,
   sinon les inputs (largeur min = leur valeur/placeholder) debordent. */
.nl-field-row > .nl-field { min-width: 0; }

.nl-input, .nl-textarea, .nl-select {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;   /* padding + border inclus dans width 100% */
  min-width: 0;             /* permet le shrink dans flex/grid */
  padding: 12px 14px;
  background: var(--nl-input-bg);
  border: 1px solid var(--nl-border);
  border-radius: 9px;
  font-family: var(--nl-font);
  font-size: 14px;
  color: var(--nl-text);
  outline: none;
  font-weight: 500;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.nl-input:focus, .nl-textarea:focus, .nl-select:focus {
  border-color: var(--nl-purple);
  box-shadow: 0 0 0 3px rgba(var(--nl-accent-rgb), 0.15);
}
.nl-textarea { resize: vertical; line-height: 1.6; min-height: 200px; }
.nl-select { appearance: none; padding-right: 32px; 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'><path d='M6 9l6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 10px center; }

.nl-vars {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.nl-chip {
  padding: 4px 10px;
  background: rgba(var(--nl-accent-rgb), 0.08);
  color: var(--nl-purple);
  border: 1px solid rgba(var(--nl-accent-rgb), 0.2);
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.nl-chip:hover { background: rgba(var(--nl-accent-rgb), 0.15); }
.nl-chip:focus-visible { outline: 2px solid var(--nl-purple); outline-offset: 2px; }

.nl-side-title {
  margin: 0 0 12px;
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: -0.2px;
}
.nl-side-head {
  display: flex; align-items: center; justify-content: space-between;
}
.nl-side-head .nl-side-title { margin-bottom: 0; }

/* Segments radios */
.nl-segments { display: flex; flex-direction: column; gap: 4px; }
.nl-segment {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--nl-border);
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.nl-segment input { accent-color: var(--seg-color, var(--nl-purple)); flex-shrink: 0; }
.nl-segment-label {
  flex: 1;
  font-size: 12.5px;
  color: var(--nl-text);
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nl-segment-count {
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 12px;
  color: var(--seg-color, var(--nl-purple));
}
.nl-segment:has(input:checked) {
  background: color-mix(in srgb, var(--seg-color, var(--nl-purple)) 10%, transparent);
  border-color: var(--seg-color, var(--nl-purple));
}
/* Fallback pour browsers sans :has() */
@supports not (selector(:has(*))) {
  .nl-segment input:checked { box-shadow: 0 0 0 2px var(--seg-color, var(--nl-purple)); }
}

/* Inbox preview */
.nl-inbox-preview {
  padding: 12px 14px;
  background: var(--nl-input-bg);
  border: 1px solid var(--nl-border);
  border-radius: 10px;
}
.nl-inbox-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.nl-inbox-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--nl-purple), var(--nl-purple-dk));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 11px;
  flex-shrink: 0;
}
.nl-inbox-meta { flex: 1; min-width: 0; }
.nl-inbox-from { font-weight: 700; font-size: 12.5px; color: var(--nl-text); }
.nl-inbox-addr { font-size: 10.5px; color: var(--nl-text-muted); }
.nl-inbox-subject {
  font-family: var(--nl-font-display);
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nl-inbox-preheader {
  font-size: 11.5px;
  color: var(--nl-text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.nl-spam-score {
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--nl-green-bg);
  border-radius: 7px;
  font-size: 11.5px;
  color: var(--nl-green);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Template picker */
.nl-template-picker { display: flex; flex-direction: column; gap: 8px; }
.nl-template-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--tpl-accent, var(--nl-purple)) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--tpl-accent, var(--nl-purple)) 20%, transparent);
  border-radius: 9px;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.nl-template-opt input { display: none; }
.nl-template-opt.is-active {
  background: color-mix(in srgb, var(--tpl-accent, var(--nl-purple)) 14%, transparent);
  border-color: var(--tpl-accent, var(--nl-purple));
}
.nl-template-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--tpl-accent, var(--nl-purple));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}
.nl-template-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nl-template-name { font-weight: 700; font-size: 12.5px; color: var(--nl-text); }
.nl-template-desc {
  font-size: 10.5px;
  color: var(--nl-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------------------------------------------------------------------------
 * Page head (campaigns, subscribers, templates)
 * --------------------------------------------------------------------------- */

.nl-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.nl-page-title {
  margin: 0 0 4px;
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -0.5px;
}
.nl-page-subtitle {
  margin: 0;
  font-size: 13.5px;
  color: var(--nl-text-muted);
}
.nl-page-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Filter chips */
.nl-filter-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.nl-filter-chip {
  padding: 8px 14px;
  background: var(--nl-card-bg);
  color: var(--nl-text-muted);
  border: 1px solid var(--nl-border);
  border-radius: 100px;
  font-family: var(--nl-font);
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.nl-filter-chip:hover { color: var(--nl-text); }
.nl-filter-chip.is-active {
  background: var(--nl-text);
  color: #fff;
  border-color: var(--nl-text);
}

/* Toolbar (subscribers) */
.nl-toolbar {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  padding: 14px 16px;
}
.nl-toolbar-search { min-width: 0; }

/* ---------------------------------------------------------------------------
 * Tables
 * --------------------------------------------------------------------------- */

.nl-table-wrap { padding: 0; overflow: hidden; }
.nl-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.nl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.nl-th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--nl-text-muted);
  border-bottom: 1px solid var(--nl-border);
  background: var(--nl-input-bg);
  white-space: nowrap;
}
.nl-th--actions { width: 100px; }
.nl-tr { transition: background-color 0.15s ease; }
.nl-tr:hover { background: rgba(var(--nl-accent-rgb), 0.04); }
.nl-td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--nl-border);
  color: var(--nl-text);
  vertical-align: middle;
}
.nl-td--muted { color: var(--nl-text-muted); }
.nl-td--actions { text-align: right; white-space: nowrap; }
.nl-td--actions .nl-icon-btn + .nl-icon-btn { margin-left: 6px; }
.nl-cell-avatar { display: inline-flex; align-items: center; gap: 10px; }
.nl-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--nl-purple), var(--nl-purple-dk));
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 11px;
  flex-shrink: 0;
}
.nl-cell-name { font-weight: 600; }
.nl-tag {
  display: inline-block;
  padding: 2px 7px;
  background: var(--nl-input-bg);
  border: 1px solid var(--nl-border);
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--nl-text-muted);
  margin-right: 4px;
}

/* ---------------------------------------------------------------------------
 * Templates gallery
 * --------------------------------------------------------------------------- */

.nl-template-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.nl-template-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(31, 19, 64, 0.08);
}
.nl-template-card::before {
  content: "";
  display: block;
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--tpl-accent, var(--nl-purple));
  border-radius: var(--nl-card-radius) var(--nl-card-radius) 0 0;
}
.nl-template-card-head {
  display: flex;
  align-items: center;
  margin-top: 6px;
}
.nl-template-card-icon {
  width: 44px; height: 44px;
  border-radius: 11px;
  background: var(--tpl-accent, var(--nl-purple));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 22px;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--tpl-accent, var(--nl-purple)) 40%, transparent);
}
.nl-template-card-title {
  margin: 0;
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 15px;
  color: var(--nl-text);
  letter-spacing: -0.2px;
}
.nl-template-card-desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--nl-text-muted);
  line-height: 1.5;
  flex: 1;
}
.nl-template-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.nl-template-card-actions .nl-btn { flex: 1; }

/* ---------------------------------------------------------------------------
 * Skeleton loading (templates grid pendant le fetch JS)
 * --------------------------------------------------------------------------- */

.nl-skel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}
.nl-skel-block {
  background: linear-gradient(90deg,
    rgba(31, 19, 64, 0.06) 0%,
    rgba(31, 19, 64, 0.12) 50%,
    rgba(31, 19, 64, 0.06) 100%);
  background-size: 200% 100%;
  animation: nl-skel-shimmer 1.4s linear infinite;
}
@keyframes nl-skel-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------------------------------------------------------------------------
 * Modal
 * --------------------------------------------------------------------------- */

.nl-modal[hidden] { display: none !important; }
.nl-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.nl-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 19, 64, 0.5);
  backdrop-filter: blur(4px);
}
.nl-modal-panel {
  position: relative;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(31, 19, 64, 0.25);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: nl-modal-in 0.18s ease-out;
}
.nl-modal-panel--lg { max-width: 900px; }
@keyframes nl-modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.nl-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--nl-border);
}
.nl-modal-title {
  margin: 0;
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.3px;
}
.nl-modal-close {
  background: transparent;
  border: 0;
  width: 32px; height: 32px;
  border-radius: 8px;
  font-size: 20px;
  color: var(--nl-text-muted);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.nl-modal-close:hover { background: var(--nl-input-bg); color: var(--nl-text); }
.nl-modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}
.nl-modal-body--iframe { padding: 0; }
.nl-modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--nl-border);
  background: var(--nl-input-bg);
}

/* Sources list (add subs modal) */
.nl-source-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.nl-source {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--nl-card-bg);
  border: 1px solid var(--nl-border);
  border-radius: 11px;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.15s, border-color 0.15s;
}
.nl-source:hover:not([disabled]) {
  background: var(--nl-input-bg);
  border-color: var(--nl-purple);
}
.nl-source[disabled] { opacity: 0.55; cursor: not-allowed; }
.nl-source-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--src-c, var(--nl-purple));
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
}
.nl-source-content { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.nl-source-title {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--nl-text);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.nl-source-desc { font-size: 12px; color: var(--nl-text-muted); line-height: 1.4; }
.nl-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  background: var(--nl-input-bg);
  color: var(--nl-text-muted);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.nl-badge--rec { background: var(--nl-green-bg); color: var(--nl-green); }

/* CSV drop zone */
.nl-csv-drop {
  border: 2px dashed var(--nl-border-strong);
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  background: var(--nl-input-bg);
  transition: border-color 0.15s, background-color 0.15s;
}
.nl-csv-drop.is-dragover {
  border-color: var(--nl-purple);
  background: rgba(var(--nl-accent-rgb), 0.05);
}
.nl-csv-drop-text { margin: 0 0 6px; font-weight: 600; color: var(--nl-text); }
.nl-csv-drop-hint { margin: 0 0 14px; font-size: 12px; color: var(--nl-text-muted); }
.nl-csv-summary {
  margin-top: 14px;
  padding: 14px;
  background: var(--nl-input-bg);
  border-radius: 10px;
  font-size: 13px;
}

/* Result success */
.nl-result-success { text-align: center; padding: 12px 20px 8px; }
.nl-result-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--nl-green-bg);
  color: var(--nl-green);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 14px;
}
.nl-result-title {
  font-family: var(--nl-font-display);
  font-weight: 800;
  font-size: 18px;
  margin-bottom: 12px;
}
.nl-result-meta { list-style: none; margin: 0; padding: 0; color: var(--nl-text-muted); font-size: 13px; line-height: 1.7; }

/* Template preview iframe */
.nl-tpl-iframe {
  width: 100%;
  height: min(75vh, 720px);
  border: 0;
  display: block;
}

/* ---------------------------------------------------------------------------
 * Toasts
 * --------------------------------------------------------------------------- */

.nl-toasts {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 48px);
}
.nl-toast {
  background: var(--nl-text);
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(31, 19, 64, 0.3);
  pointer-events: auto;
  animation: nl-toast-in 0.22s ease-out;
  max-width: 360px;
}
.nl-toast--success { background: var(--nl-green); }
.nl-toast--error   { background: #DC2626; }
.nl-toast--warn    { background: var(--nl-amber); color: #1F1340; }
@keyframes nl-toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------------------
 * Responsive — Tablet (768–1023px)
 * --------------------------------------------------------------------------- */

/* ---------------------------------------------------------------------------
 * Compose — Mode (Actualité publique vs Email personnalisé) + Cover
 * --------------------------------------------------------------------------- */

/* Visibilité selon le mode (data-mode porté par .nl-compose) */
.nl-compose[data-mode="article"] .nl-only-perso { display: none !important; }
.nl-compose[data-mode="perso"] .nl-only-article { display: none !important; }

/* Sélecteur de mode : 2 cartes radio */
.nl-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.nl-mode-opt { position: relative; display: block; cursor: pointer; min-width: 0; }
.nl-mode-opt input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.nl-mode-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1.5px solid var(--nl-border);
  border-radius: 12px;
  background: var(--nl-input-bg);
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.nl-mode-opt input:checked + .nl-mode-card {
  border-color: var(--nl-purple);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(var(--nl-accent-rgb), .12);
}
.nl-mode-opt input:focus-visible + .nl-mode-card { outline: 2px solid var(--nl-purple); outline-offset: 2px; }
.nl-mode-name { font-weight: 700; font-size: 14px; color: var(--nl-text); }
.nl-mode-desc { font-size: 12px; color: var(--nl-text-muted); }

/* Image de couverture */
.nl-cover {
  position: relative;
  border: 1.5px dashed var(--nl-border-strong);
  border-radius: 12px;
  background: var(--nl-input-bg);
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .18s, background .18s;
}
.nl-cover:hover { border-color: var(--nl-purple); }
.nl-cover.has-image { border-style: solid; }
.nl-cover-preview { width: 100%; max-height: 280px; object-fit: cover; display: block; }
.nl-cover-ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: var(--nl-text-muted);
}
.nl-cover-ph-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: var(--nl-purple-bg);
}
.nl-cover-ph-text { font-size: 13px; font-weight: 600; }
.nl-cover-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: none;
  background: rgba(11, 4, 25, .6);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nl-cover-remove:hover { background: rgba(11, 4, 25, .85); }
.nl-cover-spinner {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(var(--nl-accent-rgb), .25);
  border-top-color: var(--nl-purple);
  animation: nl-spin .7s linear infinite;
}
@keyframes nl-spin { to { transform: rotate(360deg); } }

/* Aide article (sous le contenu) */
.nl-help {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: var(--nl-blue-bg);
  color: #1E40AF;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.5;
}

@media (max-width: 1023px) {
  .nl-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .nl-grid-3 { grid-template-columns: repeat(2, 1fr); }
  .nl-grid-3 > :nth-child(3) { grid-column: 1 / -1; }
  .nl-grid-templates { grid-template-columns: repeat(2, 1fr); }
  .nl-compose {
    grid-template-columns: 1fr;
  }
  .nl-compose-side {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 14px;
  }
  .nl-compose-side > .nl-card { flex: 1 1 280px; min-width: 240px; }
  .nl-hero { padding: 20px 24px; }
  .nl-hero--onboarding { padding: 24px 24px; }
  .nl-toolbar { grid-template-columns: 1fr 1fr; }
  .nl-toolbar-search { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------------------
 * Responsive — Mobile (<768px)
 * --------------------------------------------------------------------------- */

@media (max-width: 767px) {
  .nl-root { gap: 14px; padding-bottom: 32px; }
  .nl-card { padding: 18px 16px; border-radius: 12px; }
  .nl-tabs { padding: 4px; }
  .nl-tab { padding: 9px 11px; font-size: 12px; }
  .nl-tab span { display: none; }
  .nl-tab svg { width: 18px; height: 18px; }
  .nl-tab.is-active span { display: inline; }

  .nl-grid-3, .nl-grid-4, .nl-grid-templates {
    grid-template-columns: 1fr;
  }
  .nl-grid-3 > :nth-child(3) { grid-column: auto; }

  .nl-hero {
    padding: 18px 20px;
    flex-direction: column;
    align-items: flex-start;
  }
  .nl-hero-cta { width: 100%; justify-content: center; }
  .nl-hero-title { font-size: 19px; }
  .nl-hero-subtitle { font-size: 13px; }
  .nl-hero--onboarding .nl-hero-title { font-size: 22px; }
  .nl-hero-icon { width: 44px; height: 44px; }

  .nl-page-head { flex-direction: column; align-items: stretch; }
  .nl-page-title { font-size: 20px; }
  .nl-page-head-actions { flex-direction: column; align-items: stretch; }
  .nl-page-head-actions .nl-btn { width: 100%; }

  .nl-compose-actions { flex-direction: column; align-items: stretch; }
  .nl-compose-actions .nl-btn { width: 100%; }
  .nl-compose-actions-spacer { display: none; }
  .nl-compose-side { flex-direction: column; }
  .nl-compose-side > .nl-card { flex: 0 0 auto; min-width: 0; }
  .nl-compose-title { font-size: 18px; }

  .nl-field-row { grid-template-columns: 1fr; }

  .nl-stat { min-height: auto; padding: 14px 16px; }
  .nl-stat-value { font-size: 24px; }

  .nl-recent-item { padding: 14px 16px; flex-wrap: wrap; }
  .nl-recent-rates { margin-left: auto; }

  /* Tableaux : on cache les colonnes non essentielles, le scroll horizontal reste possible */
  .nl-hide-mobile { display: none; }
  .nl-th, .nl-td { padding: 10px 12px; }

  .nl-toolbar { grid-template-columns: 1fr; gap: 8px; }

  /* Modale full-screen mobile */
  .nl-modal { padding: 0; align-items: stretch; }
  .nl-modal-panel {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
  .nl-modal-panel--lg { max-width: 100%; }
  .nl-modal-foot { flex-direction: column-reverse; align-items: stretch; }
  .nl-modal-foot .nl-btn { width: 100%; }

  .nl-tpl-iframe { height: calc(100vh - 130px); }

  .nl-toasts { bottom: 12px; right: 12px; left: 12px; max-width: none; }
  .nl-toast { max-width: 100%; }
}

/* ---------------------------------------------------------------------------
 * Reduced motion
 * --------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .nl-tab, .nl-btn, .nl-icon-btn, .nl-tr, .nl-template-card, .nl-input, .nl-textarea, .nl-select {
    transition: none !important;
  }
  .nl-modal-panel { animation: none !important; }
  .nl-toast { animation: none !important; }
  .nl-cover-spinner { animation: none !important; }
}

/* Compose mode toggle : empilé sur mobile */
@media (max-width: 767px) {
  .nl-mode { grid-template-columns: 1fr; }
}
