/* CandiTrail — Design tokens v1.2 (SPEC_UX §2.0–2.7) */

/* ── Polices ─────────────────────────────────────────────────────────────── */
@import url("https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,600;12..96,700&display=swap");

/* ── Tokens light (défaut) ───────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-primary:   #FFFFFF;
  --bg-secondary: #F7F6F3;
  --bg-hover:     #F1F1EF;
  --bg-selected:  #E8E7E4;

  /* Surfaces (modèle d'élévation par superposition) */
  --surface-1: var(--bg-primary);    /* cartes posées sur le fond */
  --surface-2: #FCFBFA;              /* panneaux légèrement surélevés */
  --surface-sunken: var(--bg-secondary); /* zones en creux (champs, rails) */

  /* Texte */
  --text-primary:     #37352F;
  --text-secondary:   #787774;
  --text-muted:       #9B9A97;
  --text-placeholder: #C5C4C0;
  --text-on-accent:   #FFFFFF;

  /* Bordures */
  --border-default: #E9E9E7;
  --border-strong:  #D3D2CE;

  /* Accent slate #4A5D8F — échelle dérivée (600 = marque) */
  --accent-50:  #F3F5FA;
  --accent-100: #E6EAF3;
  --accent-200: #C9D1E6;
  --accent-300: #A6B2D3;
  --accent-400: #7C8CB6;
  --accent-500: #5C6FA0;
  --accent-600: #4A5D8F;   /* couleur de marque */
  --accent-700: #3B4C78;
  --accent-800: #2F3C60;
  --accent-900: #232C47;

  --accent:              var(--accent-600);
  --accent-hover:        var(--accent-700);
  --accent-light:        var(--accent-100);   /* fond léger + focus ring */
  --accent-subtle:       var(--accent-50);    /* fond très léger (rails, lignes actives) */
  --accent-contrast:     #FFFFFF;
  --on-gradient:         #FFFFFF;   /* texte sur le dégradé (slate dans les 2 thèmes) */
  --gradient-signature:  linear-gradient(135deg, #4A5D8F 0%, #6878A5 55%, #8492BE 100%);

  /* Sémantiques */
  --success:    #448361; --success-bg: #DBEDDB;
  --warning:    #D9730D; --warning-bg: #FAEBDD;
  --error:      #D44C47; --error-bg:   #FBE4E4;
  --info:       #337EA9; --info-bg:    #D3E5EF;

  /* Shadows & élévation — échelle douce multi-stop (premium, light) */
  --shadow-xs: 0 1px 2px rgba(15,18,30,0.05);
  --shadow-sm: 0 1px 2px rgba(15,18,30,0.05), 0 2px 4px rgba(15,18,30,0.04);
  --shadow-md: 0 2px 4px rgba(15,18,30,0.04), 0 8px 20px rgba(15,18,30,0.08);
  --shadow-lg: 0 4px 8px rgba(15,18,30,0.05), 0 16px 32px rgba(15,18,30,0.11);
  --shadow-xl: 0 8px 16px rgba(15,18,30,0.07), 0 28px 56px rgba(15,18,30,0.16);
  /* Glow accent (parcimonie : CTA, cartes accentuées) */
  --shadow-accent: 0 6px 18px rgba(74,93,143,0.22);

  /* Alias historiques (rétro-compat) */
  --shadow-popover:    var(--shadow-md);
  --shadow-modal:      var(--shadow-xl), 0 0 0 1px rgba(15,18,30,0.04);
  --shadow-card:       var(--shadow-xs);          /* ombre de repos discrète */
  --shadow-card-hover: var(--shadow-md);          /* élévation marquée au hover */
  --focus-ring:        0 0 0 3px var(--accent-100);
  --card-sheen:        none;

  /* Espacements (grille 4px) */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;
  --space-9: 80px; --space-10: 96px;

  /* Border-radius — mesuré, intemporel (angles nets côté data) */
  --radius-xs:   6px;    /* boutons, inputs, badges */
  --radius-sm:   8px;    /* petites cartes, toasts */
  --radius-md:   12px;   /* cartes, modales, popovers */
  --radius-lg:   16px;   /* grosses cartes, panneaux héros */
  --radius-xl:   20px;   /* sections vitrine (pricing) */
  --radius-full: 9999px;

  /* Transitions + easing */
  --ease-standard:   cubic-bezier(0.4, 0, 0.2, 1);
  --ease-emphasized: cubic-bezier(0.2, 0, 0, 1);   /* micro-interactions premium */
  --transition-fast:   150ms var(--ease-standard);
  --transition-base:   200ms var(--ease-standard);
  --transition-slow:   300ms var(--ease-standard);
  --transition-bounce: 250ms cubic-bezier(0.34,1.56,0.64,1);

  /* Typographie */
  --font-body:    ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
                  Helvetica, Arial, sans-serif;
  --font-display: "Bricolage Grotesque", var(--font-body);

  /* Line-heights */
  --lh-tight: 1.15; --lh-snug: 1.3; --lh-normal: 1.5;

  /* Sidebar */
  --sidebar-width: 248px;
}

/* ── Tokens dark ─────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-primary:   #191919;
  --bg-secondary: #202020;
  --bg-hover:     #2A2A2A;
  --bg-selected:  #303030;

  --surface-1: #1F1F1F;            /* cartes : légèrement au-dessus du fond */
  --surface-2: #262626;            /* panneaux surélevés */
  --surface-sunken: #151515;       /* zones en creux */

  --text-primary:     rgba(255,255,255,0.9);
  --text-secondary:   rgba(255,255,255,0.6);
  --text-muted:       rgba(255,255,255,0.4);
  --text-placeholder: rgba(255,255,255,0.3);
  --text-on-accent:   #0F1320;

  --border-default: rgba(255,255,255,0.10);
  --border-strong:  rgba(255,255,255,0.15);

  /* Accent slate — échelle dark (éclaircie pour le contraste sur fond sombre) */
  --accent-50:  rgba(132,146,190,0.10);
  --accent-100: rgba(132,146,190,0.18);
  --accent-200: rgba(132,146,190,0.30);
  --accent-300: #6E7DAE;
  --accent-400: #8492BE;
  --accent-500: #97A3CA;
  --accent-600: #A6B1D4;
  --accent-700: #B8C1DE;
  --accent-800: #CDD4E9;
  --accent-900: #E2E6F2;

  --accent:             #8492BE;
  --accent-hover:       #9CA8CE;
  --accent-light:       rgba(132,146,190,0.18);
  --accent-subtle:      rgba(132,146,190,0.10);
  --accent-contrast:    #0F1320;
  --gradient-signature: linear-gradient(135deg, #8492BE 0%, #A2AED2 60%, #C0C9E4 100%);

  /* Ombres dark plus marquées + sheen « cher » */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.40);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.40), 0 2px 6px rgba(0,0,0,0.36);
  --shadow-md: 0 2px 6px rgba(0,0,0,0.40), 0 10px 24px rgba(0,0,0,0.50);
  --shadow-lg: 0 4px 10px rgba(0,0,0,0.45), 0 18px 38px rgba(0,0,0,0.58);
  --shadow-xl: 0 8px 18px rgba(0,0,0,0.50), 0 30px 60px rgba(0,0,0,0.65);
  --shadow-accent: 0 6px 20px rgba(132,146,190,0.30);

  --shadow-popover:    var(--shadow-md);
  --shadow-modal:      var(--shadow-xl), 0 0 0 1px rgba(255,255,255,0.05);
  --shadow-card:       var(--card-sheen);
  --shadow-card-hover: var(--shadow-md);
  --card-sheen:        inset 0 1px 0 rgba(255,255,255,0.05);
}

/* ── Reset minimal ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-primary);
  transition: background var(--transition-base), color var(--transition-base);
}

/* ── Typographie display ─────────────────────────────────────────────────── */
h1, h2 {
  font-family: var(--font-display);
  letter-spacing: -0.025em;
}
/* Tailles fluides : interpolent entre mobile et desktop sans media-query. */
h1 { font-size: clamp(2rem, 1.5rem + 2.2vw, 2.5rem); font-weight: 700; line-height: var(--lh-tight); }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 1.875rem); font-weight: 600; line-height: var(--lh-snug); }
h3 { font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.5rem); font-weight: 600; line-height: var(--lh-snug); letter-spacing: -0.015em; }
h4 { font-size: clamp(1.125rem, 1.05rem + 0.35vw, 1.25rem); font-weight: 600; line-height: var(--lh-snug); }

/* Chiffres héros */
.stat {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* ── Layout app ──────────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
  z-index: 10;
}

.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0; /* permet aux enfants (tableaux) de rétrécir au lieu de déborder */
  min-height: 100vh;
  padding: var(--space-6);
}

/* Burger + overlay : masqués sur desktop, activés en mobile via @media (768px) */
.sidebar-burger {
  display: none;
  align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: 0 0 40px; padding: 0;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--text-secondary); cursor: pointer;
}
.sidebar-burger:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-burger:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.sidebar-overlay { display: none; }

/* ── Composants de base ──────────────────────────────────────────────────── */

/* Base commune aux boutons */
.btn-primary, .btn-secondary, .btn-ghost, .btn-gradient {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 8px 14px;
  border-radius: var(--radius-xs);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 550;
  line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition-fast), border-color var(--transition-fast),
              color var(--transition-fast), box-shadow var(--transition-fast),
              transform var(--transition-fast);
}
.btn-primary:focus-visible, .btn-secondary:focus-visible,
.btn-ghost:focus-visible, .btn-gradient:focus-visible {
  outline: none; box-shadow: var(--focus-ring);
}
.btn-primary:active, .btn-secondary:active,
.btn-ghost:active, .btn-gradient:active { transform: translateY(0.5px); }

/* Bouton primaire */
.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-accent);
  transform: translateY(-1px);
}

/* Bouton secondaire */
.btn-secondary {
  background: var(--surface-1);
  color: var(--text-primary);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }

/* Bouton fantôme (icône / inline, sans bord ni fond au repos) */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

/* CTA signature — dégradé de marque (parcimonie : ≤3-4 usages) */
.btn-gradient {
  background: var(--gradient-signature);
  color: var(--on-gradient);
  box-shadow: var(--shadow-accent);
}
.btn-gradient:hover { filter: brightness(1.05); transform: translateY(-1px); box-shadow: var(--shadow-lg); }

/* Input */
input, textarea, select {
  background: var(--surface-sunken);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color var(--transition-base), box-shadow var(--transition-base),
              background var(--transition-base);
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  background: var(--bg-primary);
}
input::placeholder { color: var(--text-placeholder); }

/* Carte */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-card), var(--card-sheen);
  transition: box-shadow var(--transition-base), border-color var(--transition-base),
              transform var(--transition-base);
}
/* Tous les .card réagissent légèrement (comportement historique conservé). */
.card:hover {
  box-shadow: var(--shadow-card-hover), var(--card-sheen);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}
/* Cartes explicitement interactives : élévation plus marquée (audacieux). */
a.card:hover, button.card:hover,
.card.is-interactive:hover, .card--interactive:hover {
  box-shadow: var(--shadow-lg), var(--card-sheen);
  transform: translateY(-2px);
}

/* ── Utilitaires ─────────────────────────────────────────────────────────── */
.text-secondary { color: var(--text-secondary); }
.text-muted     { color: var(--text-muted); }
.text-sm        { font-size: 14px; }
.text-xs        { font-size: 12px; }
.tnum           { font-variant-numeric: tabular-nums; }
.text-gradient  {
  background: var(--gradient-signature);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ── Primitives partagées (consolidation §3/§4) ──────────────────────────────
   Composants réutilisables centralisés ici pour cohérence inter-pages. Les
   zones (dashboard, candidatures…) migreront progressivement vers ces classes. */

/* En-tête de page générique */
.page-eyebrow {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); margin-bottom: var(--space-2);
}

/* Carte de section (panneau de contenu posé) */
.section-card {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-card), var(--card-sheen);
}
.section-card__title {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-secondary); margin: 0 0 var(--space-4);
}

/* Badge / pastille de statut */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 550; line-height: 1.5;
  white-space: nowrap;
  background: var(--bg-secondary); color: var(--text-secondary);
  border: 1px solid transparent;
}
/* Point coloré : opt-in (.badge--dot) pour ne pas polluer les badges qui ont
   déjà une icône SVG ou un puce manuelle dans les templates existants. */
.badge--dot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0; opacity: 0.85;
}
.badge--accent  { background: var(--accent-light);   color: var(--accent); }
.badge--success { background: var(--success-bg);      color: var(--success); }
.badge--warning { background: var(--warning-bg);      color: var(--warning); }
.badge--error   { background: var(--error-bg);        color: var(--error); }
.badge--info    { background: var(--info-bg);         color: var(--info); }
.badge--muted   { background: var(--bg-secondary);    color: var(--text-muted); }

/* Tag rectangulaire discret (labels, métadonnées) */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--radius-xs);
  font-size: 12px; font-weight: 500;
  background: var(--bg-secondary); color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

/* Contrôle segmenté (sélecteurs période / vue / filtre exclusif) */
.segmented {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px; border-radius: var(--radius-sm);
  background: var(--surface-sunken); border: 1px solid var(--border-default);
}
.seg-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 5px 12px; border: 0; border-radius: calc(var(--radius-sm) - 3px);
  background: transparent; color: var(--text-secondary);
  font-size: 13px; font-weight: 550; cursor: pointer; text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast),
              box-shadow var(--transition-fast);
}
.seg-btn:hover { color: var(--text-primary); }
.seg-btn.is-active, .seg-btn.active {
  background: var(--surface-1); color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}
.seg-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

/* Table de données partagée */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table thead th {
  text-align: left; padding: var(--space-3) var(--space-4);
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); border-bottom: 1px solid var(--border-default);
  white-space: nowrap;
}
.data-table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-default);
  color: var(--text-primary); vertical-align: middle;
}
.data-table tbody tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.data-table tbody tr:last-child td { border-bottom: 0; }

/* Séparateur */
.divider { height: 1px; background: var(--border-default); border: 0; margin: var(--space-4) 0; }

/* Lien retour (← Section) */
.back-link {
  display: inline-flex; align-items: center; gap: var(--space-1);
  font-size: 13px; color: var(--text-secondary); text-decoration: none;
  transition: color var(--transition-fast);
}
.back-link:hover { color: var(--text-primary); }
.back-link:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-xs); }

/* ── Sidebar : structure ─────────────────────────────────────────────────── */
.sidebar-logo {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--border-default);
  text-decoration: none;
}
/* Logo de marque (inline SVG, currentColor → suit le thème). */
.brand-logo { display: block; width: auto; color: var(--text-primary); }
.brand-logo--full { height: 34px; }
.brand-logo--icon { height: 26px; }
.sidebar-logo .brand-logo--full { height: 38px; }
.sidebar-scroll { flex: 1; padding: var(--space-4) 0; overflow-y: auto; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 var(--space-3); }
.sidebar-section-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-muted); padding: var(--space-3) var(--space-3) var(--space-2);
}
.sidebar-footer {
  padding: var(--space-3); border-top: 1px solid var(--border-default);
  display: flex; flex-direction: column; gap: var(--space-1);
}

/* ── Sidebar : liens ─────────────────────────────────────────────────────── */
.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 8px var(--space-3);
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-weight: 550;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}
.sidebar-link svg { flex-shrink: 0; opacity: 0.85; }
.sidebar-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-link:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.sidebar-link.active { background: var(--accent-light); color: var(--accent); }
.sidebar-link.active svg { opacity: 1; }
/* Barre d'accent à gauche de l'item actif (signal premium) */
.sidebar-link.active::before {
  content: ""; position: absolute; left: -3px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: var(--radius-full);
  background: var(--accent);
}
.sidebar-link--danger { color: var(--text-secondary); }
.sidebar-link--danger:hover { background: var(--error-bg); color: var(--error); }
.sidebar-theme-toggle { width: 100%; margin-top: var(--space-1); font-size: 13px; }

/* ── Pages auth ──────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  margin-left: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  /* Ambiance : halo de marque subtil derrière la carte (signature) */
  background:
    radial-gradient(900px 500px at 50% -8%, var(--accent-subtle), transparent 65%),
    var(--bg-secondary);
}

/* Masque la sidebar sur les pages auth */
body.auth-layout .sidebar      { display: none; }
body.auth-layout .main-content { margin-left: 0; padding: 0; }

/* Liens légaux discrets sous la carte auth */
.auth-legal {
  position: absolute; bottom: var(--space-5); left: 0; right: 0;
  display: flex; justify-content: center; align-items: center; gap: var(--space-2);
  font-size: 13px; color: var(--text-muted);
}
.auth-legal a { color: var(--text-secondary); text-decoration: none; }
.auth-legal a:hover { color: var(--accent); }

/* Pied de page légal partagé (pages légales + landing) — voir _footer.html */
.legal-footer { border-top: 1px solid var(--border-default); background: var(--bg-primary); }
.legal-footer__inner {
  max-width: 760px; margin: 0 auto; padding: var(--space-5);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4);
  color: var(--text-muted); font-size: 13px;
}
.legal-footer__links { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.legal-footer a { color: var(--text-secondary); text-decoration: none; }
.legal-footer a:hover { color: var(--accent); }
.legal-footer a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.legal-footer__spacer { flex: 1 1 auto; }

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-7) var(--space-6) var(--space-6);
  box-shadow: var(--shadow-xl), var(--card-sheen);
}

/* Marque (logo de marque) en tête de carte auth */
.auth-brand {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.auth-brand .brand-logo--full { height: 56px; }

.auth-header { text-align: center; margin-bottom: var(--space-6); }
.auth-title  { font-size: 24px; font-weight: 700; font-family: var(--font-display);
               letter-spacing: -0.025em; line-height: var(--lh-tight); margin: 0 0 var(--space-1); }
.auth-subtitle { font-size: 14px; color: var(--text-secondary); margin: 0; }

.auth-form   { display: flex; flex-direction: column; gap: var(--space-4); }
.form-group  { display: flex; flex-direction: column; gap: var(--space-2); }
.form-label  { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.form-input  { font-size: 16px !important; /* anti-zoom iOS */ }

.btn-full    { width: 100%; justify-content: center; }

.auth-link-small {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  align-self: flex-end;
}
.auth-link-small:hover { color: var(--accent); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) 0;
  color: var(--text-muted);
  font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border-default);
}

.btn-oauth {
  width: 100%;
  justify-content: center;
  gap: var(--space-2);
}

.auth-footer {
  text-align: center;
  margin: var(--space-5) 0 0;
  font-size: 14px;
  color: var(--text-secondary);
}
.auth-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.auth-link:hover { text-decoration: underline; }

/* Alerts */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-xs);
  font-size: 14px;
  margin-bottom: var(--space-4);
}
.alert-error   { background: var(--error-bg);   color: var(--error); }
.alert-success { background: var(--success-bg); color: var(--success); }

/* ── Page Settings ───────────────────────────────────────────────────────── */
.page-container { max-width: 720px; }
.page-header    { margin-bottom: var(--space-6); }
.page-title     {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 1.875rem); font-weight: 700;
  letter-spacing: -0.025em; line-height: var(--lh-tight); margin: 0;
}

.settings-layout      { display: flex; flex-direction: column; gap: var(--space-5); }
.settings-section     { padding: var(--space-5); }
.settings-section-title {
  font-size: 15px; font-weight: 600; margin: 0 0 var(--space-4);
  color: var(--text-primary);
}
.settings-section .form-group { margin-bottom: var(--space-4); }
.settings-section .form-group:last-child { margin-bottom: 0; }

.radio-group  { display: flex; gap: var(--space-4); flex-wrap: wrap; }
.radio-option {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: 14px; cursor: pointer;
}
.radio-option input[type="radio"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
}

.save-indicator { font-size: 13px; color: var(--success); min-height: 20px; }

.settings-danger        { border-color: var(--error-bg) !important; }
.settings-danger-title  { color: var(--error); }
.settings-danger-desc   { font-size: 14px; color: var(--text-secondary);
                           margin: 0 0 var(--space-4); }
.btn-danger { color: var(--error) !important; border-color: var(--error) !important; }
.btn-danger:hover { background: var(--error-bg) !important; }

/* ── Topbar + notifications (§5.12) ──────────────────────────────────────── */
[x-cloak] { display: none !important; }

/* Barre fine pleine largeur, alignée à droite. Marges négatives pour annuler
   le padding de .main-content et coller la barre au bord haut. */
.topbar {
  display: flex; align-items: center; justify-content: flex-end; gap: var(--space-3);
  margin: calc(-1 * var(--space-6)) calc(-1 * var(--space-6)) var(--space-6);
  padding: var(--space-3) var(--space-5);
  min-height: 56px;
  border-bottom: 1px solid var(--border-default);
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg-primary) 82%, transparent);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
}

/* ── Barre de recherche topbar (§4.11) ──────────────────────────────────────── */
.topbar-search {
  position: relative;
  flex: 1; max-width: 440px; margin-right: auto;
}
.topbar-search__icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); line-height: 0; pointer-events: none;
  transition: color var(--transition-fast);
}
.topbar-search:focus-within .topbar-search__icon { color: var(--accent); }
.topbar-search__input {
  width: 100%; padding: 9px 14px 9px 36px;
  background: var(--surface-sunken); border: 1px solid var(--border-default);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
              background var(--transition-fast);
}
.topbar-search__input:focus {
  outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); background: var(--bg-primary);
}
.search-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--bg-primary); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); box-shadow: var(--shadow-popover), var(--card-sheen);
  max-height: 60vh; overflow-y: auto; z-index: 60; padding: var(--space-2);
}
.search-group { margin-bottom: var(--space-2); }
.search-group:last-child { margin-bottom: 0; }
.search-group__label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); padding: var(--space-2) var(--space-3) var(--space-1);
}
.search-hit {
  display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left;
  padding: var(--space-2) var(--space-3); border: 0; background: transparent;
  border-radius: var(--radius-xs); cursor: pointer; color: var(--text-primary);
}
.search-hit.is-active { background: var(--accent-light); }
.search-hit__title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-hit__sub   { font-size: 12px; color: var(--text-muted); }
.search-loading, .search-empty {
  padding: var(--space-4) var(--space-3); text-align: center;
  color: var(--text-muted); font-size: 13px;
}
@media (max-width: 640px) {
  .topbar-search { max-width: none; }
  .topbar-search__input { font-size: 16px; } /* anti-zoom iOS */
}

.notif { position: relative; }
.notif__btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex: 0 0 36px; padding: 0;
  border-radius: var(--radius-sm);
  background: transparent; border: 1px solid transparent; cursor: pointer;
  color: var(--text-secondary);
}
/* Icône taille fixe quel que soit le contexte (défense contre tout reset SVG). */
.notif__btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.notif__btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-default); }
.notif__btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.notif-badge {
  position: absolute; top: 1px; right: 1px;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--accent); color: var(--accent-contrast);
  font-size: 10px; font-weight: 700; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg-primary);
}

.notif__panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 360px; max-width: 90vw;
  background: var(--bg-primary); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); box-shadow: var(--shadow-card-hover);
  z-index: 50; overflow: hidden;
}
.notif-dd__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border-default);
  font-weight: 600; font-size: 14px;
}
.notif-dd__readall {
  background: transparent; border: 0; cursor: pointer;
  color: var(--accent); font-size: 12px; font-weight: 500; padding: 2px 4px;
}
.notif-dd__readall:hover { text-decoration: underline; }
.notif-dd__list { max-height: 360px; overflow-y: auto; }
.notif-dd__foot {
  display: block; text-align: center; padding: var(--space-3);
  border-top: 1px solid var(--border-default);
  font-size: 13px; color: var(--accent); text-decoration: none;
}
.notif-dd__foot:hover { background: var(--bg-hover); }

.notif-item {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) var(--space-4); text-decoration: none;
  color: var(--text-primary); border-bottom: 1px solid var(--border-default);
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--bg-hover); }
.notif-item--unread { background: var(--accent-light); }
.notif-item--unread:hover { background: var(--accent-light); }
.notif-item__icon {
  flex: 0 0 28px; width: 28px; height: 28px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-secondary); color: var(--accent);
}
.notif-item__body { flex: 1; min-width: 0; }
.notif-item__title { font-size: 13px; font-weight: 600; }
.notif-item__text { font-size: 12px; color: var(--text-secondary); }
.notif-item__time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.notif-empty { padding: var(--space-6) var(--space-4); text-align: center;
               color: var(--text-muted); font-size: 13px; }

body.auth-layout .topbar { display: none; }

/* Page notifications */
.notif-page { max-width: 720px; }
.notif-page__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-5); gap: var(--space-3);
}

/* ── Skeletons / shimmer (§4.3) ──────────────────────────────────────────────
   Jamais de spinner blanc au chargement initial : on affiche un squelette animé.
   Tout via variables → suit automatiquement le dark mode. */
@keyframes shimmer {
  0%   { background-position: -1000px 0; }
  100% { background-position:  1000px 0; }
}
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-secondary) 0%, var(--bg-hover) 50%, var(--bg-secondary) 100%);
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
  border-radius: var(--radius-xs);
}
.skeleton-text  { height: 12px; margin: 6px 0; }
.skeleton-text.sk-sm { width: 40%; }
.skeleton-text.sk-md { width: 60%; }
.skeleton-text.sk-lg { width: 85%; }
.skeleton-row   { height: 44px;  border-radius: var(--radius-sm); margin-bottom: var(--space-2); }
.skeleton-card  { height: 120px; border-radius: var(--radius-sm); }
.skeleton-chart { height: 220px; border-radius: var(--radius-sm); }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

/* ── Empty states (§4.4) ─────────────────────────────────────────────────────
   Illustration SVG sobre + message + CTA. */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; gap: var(--space-3);
  padding: var(--space-8) var(--space-5);
}
.empty-state__icon { color: var(--text-muted); line-height: 0; }
.empty-state__icon svg { width: 56px; height: 56px; }
.empty-state__title { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.empty-state__text  { font-size: 14px; color: var(--text-secondary); max-width: 420px; margin: 0; }
.empty-state__cta   { margin-top: var(--space-2); }

/* ── Toasts (§4.5) ───────────────────────────────────────────────────────────
   Desktop bas-droite (max 3 géré côté JS) ; mobile bottom sheet pleine largeur.
   Bouton Annuler obligatoire sur action destructrice (variant undo). */
.toast-container {
  position: fixed; bottom: var(--space-5); right: var(--space-5);
  display: flex; flex-direction: column; gap: var(--space-2);
  z-index: 9999; max-width: 360px; pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-left: 3px solid var(--text-muted);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-popover), var(--card-sheen);
  font-size: 14px; color: var(--text-primary);
  pointer-events: auto;
}
.toast--success { border-left-color: var(--success); }
.toast--error   { border-left-color: var(--error); }
.toast--info    { border-left-color: var(--accent); }
.toast--undo    { border-left-color: var(--text-secondary); }
.toast__icon { flex: 0 0 18px; margin-top: 1px; line-height: 0; }
.toast__icon svg { width: 18px; height: 18px; }
.toast--success .toast__icon { color: var(--success); }
.toast--error   .toast__icon { color: var(--error); }
.toast--info    .toast__icon { color: var(--accent); }
.toast__body  { flex: 1; min-width: 0; }
.toast__action {
  background: transparent; border: 0; cursor: pointer;
  color: var(--accent); font-weight: 600; font-size: 13px; padding: 2px 4px;
  white-space: nowrap;
}
.toast__action:hover { text-decoration: underline; }
.toast__close {
  background: transparent; border: 0; cursor: pointer;
  color: var(--text-muted); line-height: 0; padding: 2px;
}
.toast__close:hover { color: var(--text-primary); }
@media (max-width: 640px) {
  .toast-container {
    left: var(--space-4); right: var(--space-4); bottom: var(--space-4); max-width: none;
  }
}

/* ── Command palette ⌘K (§4.1) ───────────────────────────────────────────────
   Réutilise les tokens modale + focus (SPEC_UX §2.6). */
.cmdk-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.4);
}
.cmdk {
  position: fixed; top: 12vh; left: 50%; transform: translateX(-50%);
  width: 92%; max-width: 600px; z-index: 201;
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal), var(--card-sheen);
  overflow: hidden;
}
.cmdk__input {
  width: 100%; border: 0; border-bottom: 1px solid var(--border-default);
  border-radius: 0; background: transparent;
  padding: var(--space-4); font-size: 16px; color: var(--text-primary);
}
.cmdk__input:focus { outline: none; box-shadow: none; background: transparent; }
.cmdk__list { max-height: 50vh; overflow-y: auto; padding: var(--space-2); }
.cmdk__group { margin-bottom: var(--space-2); }
.cmdk__group-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted); padding: var(--space-2) var(--space-3);
}
.cmdk__item {
  display: flex; align-items: center; gap: var(--space-3); width: 100%;
  padding: var(--space-2) var(--space-3); border: 0; background: transparent;
  border-radius: var(--radius-xs); cursor: pointer; text-align: left;
  color: var(--text-primary); font-size: 14px;
}
.cmdk__item.is-active { background: var(--accent-light); }
.cmdk__item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk__item-sub  { color: var(--text-muted); font-size: 12px; }
.cmdk__item-hint {
  color: var(--text-muted); font-size: 11px; font-weight: 600;
  border: 1px solid var(--border-default); border-radius: var(--radius-xs); padding: 1px 6px;
}
.cmdk__empty { padding: var(--space-5); text-align: center; color: var(--text-muted); font-size: 14px; }
@media (max-width: 640px) {
  .cmdk { top: 0; left: 0; transform: none; width: 100%; max-width: none; height: 100%; border-radius: 0; }
  .cmdk__list { max-height: calc(100vh - 62px); }
}

/* ── Chips clavier (.kbd) + page raccourcis (§4.13) ──────────────────────────── */
.kbd {
  display: inline-block; min-width: 22px; text-align: center;
  padding: 2px 7px; font-size: 12px; font-weight: 600; line-height: 1.4;
  font-family: var(--font-body);
  color: var(--text-secondary);
  background: var(--surface-1);
  border: 1px solid var(--border-strong); border-radius: var(--radius-xs);
  box-shadow: var(--shadow-xs), inset 0 -1px 0 var(--border-default);
}
.shortcuts-list { display: flex; flex-direction: column; }
.shortcuts-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-3) 0; border-bottom: 1px solid var(--border-default);
}
.shortcuts-row:last-child { border-bottom: 0; }
.shortcuts-row__label { font-size: 14px; color: var(--text-primary); }
.shortcuts-row__keys  { display: flex; align-items: center; gap: var(--space-1); flex-shrink: 0; }
.shortcuts-note { font-size: 13px; color: var(--text-muted); margin-top: var(--space-4); }

/* ── Animations de réussite (§4.14) ──────────────────────────────────────────
   Subtil. Désactivé si l'utilisateur a demandé moins de mouvement. */
@keyframes ct-pulse-kf {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}
.ct-pulse { animation: ct-pulse-kf var(--transition-bounce); }

@keyframes ct-streak-pop-kf {
  0%   { transform: scale(0.85); }
  55%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}
.ct-streak-pop { animation: ct-streak-pop-kf 600ms cubic-bezier(0.34,1.56,0.64,1); }

@media (prefers-reduced-motion: reduce) {
  .ct-pulse, .ct-streak-pop { animation: none; }
}

/* ── QA responsive mobile/tablette (§3.9) ────────────────────────────────────
   Sidebar off-canvas + burger, anti-zoom iOS (inputs ≥16px), cibles ≥44px. */
@media (max-width: 768px) {
  /* Sidebar off-canvas */
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-base);
    box-shadow: var(--shadow-modal);
    z-index: 100;
  }
  .sidebar.sidebar--open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: var(--space-4); }

  /* La topbar annule le padding du main-content : aligner sa marge négative sur
     le padding mobile (space-4) sinon elle déborde → scroll horizontal. */
  .topbar {
    margin: calc(-1 * var(--space-4)) calc(-1 * var(--space-4)) var(--space-4);
    padding: var(--space-2) var(--space-4);
  }

  .sidebar-burger { display: inline-flex; width: 44px; height: 44px; flex-basis: 44px; margin-right: auto; }
  .sidebar-overlay {
    display: block; position: fixed; inset: 0; z-index: 90;
    background: rgba(0,0,0,0.4);
  }

  /* Anti-zoom iOS : tout champ de saisie ≥16px */
  input, textarea, select { font-size: 16px; }

  /* Cibles tactiles ≥44px sur les éléments interactifs principaux */
  .btn-primary, .btn-secondary { min-height: 44px; }
  .sidebar-link { min-height: 44px; }
  .notif__btn { width: 44px; height: 44px; flex-basis: 44px; }
  .notif__btn svg { width: 22px; height: 22px; }
}
