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

/* SCOPEWRIGHT DESIGN TOKENS
   Source de vérité pour toutes les valeurs visuelles.
   Référence principale : login.html
   Référence secondaire : landing page scopewright.ca

   NE PAS MODIFIER sans vérifier toutes les pages.
   Pages exclues (gardent le vert Stele) : quote.html, pages client-facing */

:root {
  /* Couleurs principales */
  --sw-navy: #0B1220;
  --sw-navy-hover: #080E18;

  /* Texte */
  --sw-text: #0F172A;
  --sw-text-2: #64748B;
  --sw-muted: #94A3B8;

  /* Backgrounds */
  --sw-bg: #F8FAFC;
  --sw-surface: #FFFFFF;

  /* Bordures */
  --sw-border: #E2E8F0;
  --sw-border-2: #F1F5F9;

  /* Rayons */
  --sw-radius-input: 10px;
  --sw-radius-btn: 10px;
  --sw-radius-card: 14px;
  --sw-radius-modal: 16px;
  --sw-radius-dropdown: 12px;
  --sw-radius-pill: 999px;

  /* Ombres */
  --sw-shadow-card: 0 10px 30px rgba(15,23,42,0.06);
  --sw-shadow-modal: 0 40px 80px rgba(15,23,42,0.12);
  --sw-shadow-primary: 0 6px 20px rgba(11,18,32,0.18);
  --sw-shadow-dropdown: 0 20px 50px rgba(15,23,42,0.12);

  /* Focus */
  --sw-focus: 0 0 0 2px rgba(11,18,32,0.22);

  /* Transitions */
  --sw-ease: 180ms ease;
  --sw-ease-modal: 220ms ease;

  /* Spacing (multiples de 8) */
  --sw-space-1: 8px;
  --sw-space-1h: 12px;
  --sw-space-2: 16px;
  --sw-space-3: 24px;
  --sw-space-4: 32px;
  --sw-space-5: 40px;
  --sw-space-6: 48px;
  --sw-space-8: 64px;

  /* Layout */
  --sw-max-width: 1120px;
  --sw-padding-x: 40px;

  /* Typographie */
  --sw-font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Reliability panel row height (SW-DEL-007-V5-POLISH)
     Hauteur partagée entre les 5 sliders (verso) et la dérivation des 3
     bandes (recto). Garantit que le container ne "respire" pas pendant le
     flip 3D : recto et verso ont la même hauteur totale. Calcul bandes :
     (5 × var(--sw-reliability-row-h)) répartis en 3 bandes égales. */
  --sw-reliability-row-h: 32px;

  /* Z-index hierarchy (SW-DEL-UX-FIXES-V2)
     Formalisée pour que les overlays portal-mounted (date picker, tooltips
     portés sur body) se positionnent de façon cohérente au-dessus des modaux.
     nav-bar=100, modal-overlay=1000, date-picker=1200. */
  --sw-z-datepicker: 1200;

  /* Tension tokens — Timeline module (FR-DEL-001)
     Palette ordonnée vert→jaune→ambre→rouge pour encodage sémantique :
     vert = protégé, jaune = absorbé, ambre = dormance (silence), rouge = blâme.
     Valeurs hex alignées sur la palette Scopewright (sw-navy #0B1220, sw-text #0F172A).
     Distinguables en deutéranopie : teintes séparées par ≥30° sur la roue chromatique
     (vert #16A34A 140°, jaune #EAB308 50°, ambre #F59E0B 35°, rouge #DC2626 0°)
     + luminosités étagées pour préserver le contraste après simulation daltonienne. */
  --sw-tension-green:   #16A34A;
  --sw-tension-yellow:  #EAB308;
  --sw-tension-amber:   #F59E0B;
  --sw-tension-red:     #DC2626;
  --sw-tension-neutral: #94A3B8;
  /* Deep variants : texte de badge sur fond pastel clair (contraste AA).
     Utilise par sw-dp-status-badge (sparkline header) et futurs badges. */
  --sw-tension-green-deep: #3B6D11;
  --sw-tension-amber-deep: #854F0B;
  --sw-tension-red-deep:   #A32D2D;
  --sw-tension-gradient: linear-gradient(
    to right,
    var(--sw-tension-green) 0%,
    var(--sw-tension-yellow) 50%,
    var(--sw-tension-red) 100%
  );

  /* Couleurs sémantiques métier — DEC-178
     Hissées du mockup timeline-v2 (Vision v1.2) au tokens.css global.
     Ces tokens encodent la sémantique métier de l'acte, du canal et
     de l'échéance — distincts des tokens --sw-tension-* (sliders score)
     et de #DC2626 (action UI destructive). Voir STYLE_GUIDE.md §2
     "Distinctions critiques rouge" pour la règle gravée.

     Source de vérité = palette timeline (sombre saturé, professionnelle).
     Le re-skin du panel-entry-detail mockup viendra dans SW2 séquentiel
     (consommera ces tokens). */

  /* Impact acte (Vision v1.2 — sémantique défensive) */
  --sw-color-protege: #1B7F4F;
  --sw-color-absorbe: #B8860B;
  --sw-color-cause:   #B91C1C;
  --sw-color-neutre:  #9CA3AF;

  /* SW-KNOWLEDGE-UI-B (DEC-197) — couleur par type de fiche savoir
     (badge type sur le cover + icône liens fiche↔fiche). Valeurs du
     mockup validé Hubert (mockup-knowledge-entry-detail.html). */
  --sw-knl-standard:      #2E75B6;
  --sw-knl-procedure:     #8B5CF6;
  --sw-knl-processus:     #1B7F4F;
  --sw-knl-checklist:     #B8860B;
  --sw-knl-regle_qualite: #B91C1C;

  /* SW-TIMELINE-LIST-REFONTE-P1A — surfaces dérivées impact (pastilles
     score badges 3 zones DEC-168 sur liste projets Timeline). Couleurs
     pastel calibrées pour fond + bordure pill, lisibles sur surface
     blanche. Réutilisables hors liste si besoin futur (e.g. drawer
     entries pills). */
  --sw-color-cause-bg:     #FEE2E2;  /* score < 4.5 (danger zone) */
  --sw-color-cause-border: #FECACA;
  --sw-color-absorbe-bg:     #FEF3C7;  /* 4.5 ≤ score < 6.5 (watch) */
  --sw-color-absorbe-border: #FDE68A;
  --sw-color-protege-bg:     #D1FAE5;  /* score ≥ 6.5 (in control) */
  --sw-color-protege-border: #A7F3D0;

  /* SW-TIMELINE-LIST-REFONTE-P1A — drafts pill highlight (header liste
     projets). Aligné style mockup VIEW 1. evidence = texte ambre foncé
     pour contraste sur highlight-bg jaune pâle. */
  --sw-highlight-bg: #FEF3C7;
  --sw-highlight-border: #FCD34D;
  --sw-evidence: #B45309;

  /* Canal de communication (parent bullet timeline) */
  --sw-color-via-courriel: #2E75B6;
  --sw-color-via-reunion:  #8B5CF6;
  --sw-color-via-appel:    #6B7280;
  --sw-color-via-document: #D4A017;
  --sw-color-via-visite:   #1B7F4F;

  /* Card tag (type de carte timeline) */
  --sw-color-card-tag-decision: #1B7F4F;
  --sw-color-card-tag-probleme: #B91C1C;
  --sw-color-card-tag-question: #2E75B6;
  --sw-color-card-tag-idee:     #8B5CF6;
  --sw-color-card-tag-info:     #6B7280;

  /* Buffer / livraison / today */
  --sw-color-buffer-pos:        #FEF3C7;
  --sw-color-buffer-neg:        #FEE2E2;
  --sw-color-today:             #2E75B6;
  --sw-color-livraison-prevue:  #B8860B;
  --sw-color-livraison-contrat: #B91C1C;

  /* À émettre + low-confidence + highlight */
  --sw-color-orange-emit:  #EA580C;
  --sw-color-low-conf:     #F59E0B;
  --sw-color-highlight-bg: #FEF3C7;
}

/* ========================================
   TYPOGRAPHIE
   ======================================== */

body {
  font-family: var(--sw-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--sw-text);
  background: var(--sw-bg);
}

/* ========================================
   BOUTON PRIMAIRE
   ======================================== */

.sw-btn-primary {
  height: 44px;
  padding: 0 20px;
  background: var(--sw-navy);
  color: white;
  font-weight: 500;
  font-size: 14px;
  border: none;
  border-radius: var(--sw-radius-btn);
  box-shadow: var(--sw-shadow-primary);
  cursor: pointer;
  transition: background var(--sw-ease);
}

.sw-btn-primary:hover {
  background: var(--sw-navy-hover);
}

/* ========================================
   BOUTON SECONDAIRE
   ======================================== */

.sw-btn-secondary {
  height: 44px;
  padding: 0 20px;
  background: var(--sw-surface);
  color: var(--sw-text);
  font-weight: 500;
  font-size: 14px;
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-btn);
  cursor: pointer;
  transition: background var(--sw-ease);
}

.sw-btn-secondary:hover {
  background: var(--sw-border-2);
}

/* ========================================
   INPUTS
   ======================================== */

.sw-input {
  height: 44px;
  padding: 0 14px;
  background: var(--sw-surface);
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-input);
  font-size: 14px;
  color: var(--sw-text);
  transition: border var(--sw-ease);
}

.sw-input::placeholder {
  color: var(--sw-muted);
}

.sw-input:focus {
  outline: none;
  box-shadow: var(--sw-focus);
}

/* ========================================
   BADGES
   ======================================== */

.sw-badge {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--sw-radius-pill);
  font-size: 12px;
  font-weight: 500;
}

/* ========================================
   CARDS
   ======================================== */

.sw-card {
  background: var(--sw-surface);
  border: 1px solid var(--sw-border);
  border-radius: var(--sw-radius-card);
  padding: var(--sw-space-3);
  transition: box-shadow var(--sw-ease);
}

.sw-card:hover {
  box-shadow: var(--sw-shadow-card);
}

/* ========================================
   NAV-RIGHT (groupe AI btn + status à droite)
   ======================================== */

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ========================================
   BOUTON ASSISTANT AI
   ======================================== */

.ai-assistant-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
}

.ai-assistant-btn::after {
  content: '';
  display: block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--sw-navy);
  opacity: 0.85;
  box-shadow: 0 0 0 4px rgba(11,18,32,0.06);
  transition: all var(--sw-ease);
  animation: ai-breathe 3s ease-in-out infinite;
}

.ai-assistant-btn:hover::after {
  opacity: 1;
  transform: scale(1.05);
}

.ai-assistant-btn.active::after {
  opacity: 1;
  box-shadow: 0 0 0 4px rgba(11,18,32,0.15);
  animation: none;
}

/* Version blanche (pour fonds sombres, ex: bande meuble calculateur) */
.ai-assistant-btn--light::after {
  background: white;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.15);
}

@keyframes ai-breathe {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

/* ========================================
   SPLIT PANEL (login + dashboard)
   ======================================== */

.sw-split-panel {
  background: var(--sw-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.sw-split-panel .sw-brand-name {
  color: rgba(255,255,255,0.7);
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 12px;
}

.sw-split-panel .sw-brand-tagline {
  color: rgba(255,255,255,0.5);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

/* ── Loading spinner standard ── */
@keyframes sw-spin { to { transform: rotate(360deg); } }
.sw-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--sw-border, #e5e7eb);
  border-top-color: var(--sw-navy, #0B1220);
  border-radius: 50%;
  animation: sw-spin 0.8s linear infinite;
  vertical-align: middle;
}
.sw-spinner--lg { width: 32px; height: 32px; border-width: 3px; }
.sw-spinner--white { border-color: rgba(255,255,255,0.2); border-top-color: #fff; }
