/* ════════════════════════════════════════════════════════════════
   CALLSAT THEME — design system unifié (gestion + intranet)
   Couleurs vraies du logo : navy #2A3680 + rouge #B82038
   Inspiré du style intranet-callsat (gradient + KPI + tables navy)
   ════════════════════════════════════════════════════════════════ */

:root {
  /* ── BRAND ── */
  --cs-navy:        #2A3680;   /* Navy du logo CallSat (Call) */
  --cs-navy-dark:   #1A1F4A;   /* Navy foncé header */
  --cs-red:         #B82038;   /* Rouge du logo CallSat (sat) */
  --cs-red-bright:  #E4002B;   /* Rouge SFR (accents, brand SFR) */
  --cs-yellow:      #FBBF24;   /* Jaune accent (mot CALL'SAT dans h1) */

  /* ── SEMANTIC ── */
  --success:        #10B981;   /* Positif, validé */
  --warning:        #F59E0B;   /* Attention, à venir */
  --danger:         #EF4444;   /* Négatif, retard, erreur */
  --info:           #3B82F6;   /* Info, lien */
  --purple:         #8B5CF6;   /* Variante (challenges, etc.) */

  /* ── NEUTRES ── */
  --bg:             #F1F5F9;   /* Fond principal (slate-100) */
  --bg-card:        #FFFFFF;
  --bg-alt:         #F8FAFC;   /* Alternance lignes table */
  --bg-hover:       #EFF6FF;   /* Hover bleu très clair */
  --border:         #E2E8F0;
  --text:           #1E293B;
  --text-muted:     #64748B;
  --text-faint:     #94A3B8;

  /* ── ÉLÉVATIONS ── */
  --shadow-sm:      0 1px 4px rgba(0,0,0,0.08);
  --shadow-md:      0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:      0 10px 30px rgba(0,0,0,0.12);

  /* ── RAYONS ── */
  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      14px;

  /* ── TYPO ── */
  --font:           'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── RESET LIGHT ── */
* { box-sizing: border-box; }
html {
  -webkit-font-smoothing: antialiased;
  scrollbar-gutter: stable;       /* évite le saut horizontal quand la scrollbar apparaît */
}
/* Force la cohérence body sur TOUTES les pages — override les styles locaux */
body.cs-page,
body {
  font-family: var(--font) !important;
  background: var(--bg) !important;
  color: var(--text) !important;
  margin: 0 !important;
  min-height: 100vh;
}

/* ── STABILITÉ : hauteur header constante + wrapper page uniformisé ── */
.cs-header {
  min-height: 140px;              /* hauteur minimale même si navbar JS pas encore chargée */
  box-sizing: border-box;
}
/* Wrapper page unifié — s'applique aux 3 noms historiques + .cs-content */
.cs-content,
body > .main,
body > main,
body > .container,
body > .wrap {
  max-width: 1500px !important;
  margin: 0 auto !important;
  padding: 24px !important;
  width: 100%;
  box-sizing: border-box;
}
/* Si le contenu est dans un sous-niveau (ex: <body><div class="main">), s'applique aussi */
.main > .cs-section,
main > .cs-section {
  margin-bottom: 20px;
}

/* ════════════════════════════════════════════════════════════════
   HEADER — gradient navy → rouge avec accent jaune
   ════════════════════════════════════════════════════════════════ */
.cs-header {
  background: linear-gradient(135deg, var(--cs-navy-dark) 0%, var(--cs-navy) 55%, var(--cs-red) 100%);
  padding: 18px 28px 14px;
  color: white;
  position: relative;
  overflow: hidden;
}
.cs-header::before {
  /* Touche de texture subtile */
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 50%, rgba(251,191,36,0.08), transparent 60%);
  pointer-events: none;
}
.cs-header > * { position: relative; }
.cs-header h1 {
  font-size: 1.5em;
  font-weight: 800;
  letter-spacing: 0.5px;
  margin: 0;
}
.cs-header h1 .accent { color: var(--cs-yellow); }
.cs-header p {
  opacity: 0.85;
  margin-top: 4px;
  font-size: 0.9em;
  font-weight: 400;
}
.cs-header-meta {
  position: absolute;
  top: 18px; right: 28px;
  font-size: 0.78em;
  opacity: 0.85;
  display: flex; gap: 16px; align-items: center;
}

/* Tabs intégrés au header */
.cs-tabs {
  display: flex;
  gap: 2px;
  margin-top: 12px;
  flex-wrap: nowrap;
  overflow-x: auto;
}
.cs-tab {
  padding: 7px 14px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: white;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  font-weight: 600;
  font-size: 0.82em;
  font-family: var(--font);
  transition: all 0.18s;
  white-space: nowrap;
}
.cs-tab:hover { background: rgba(255,255,255,0.25); }
.cs-tab.active {
  background: var(--bg);
  color: var(--cs-navy-dark);
  box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}

/* ════════════════════════════════════════════════════════════════
   CONTENT — wrapper standard
   ════════════════════════════════════════════════════════════════ */
.cs-content { max-width: 1500px; margin: 0 auto; padding: 24px; }

.cs-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.cs-section-title {
  font-size: 1.05em;
  font-weight: 800;
  color: var(--cs-navy-dark);
  margin: 0 0 16px 0;
  border-bottom: 2px solid var(--cs-red);
  padding-bottom: 8px;
}

/* ════════════════════════════════════════════════════════════════
   KPI CARDS — border-left coloré sémantique
   ════════════════════════════════════════════════════════════════ */
.cs-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.cs-kpi {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--cs-red);
  transition: box-shadow 0.18s, transform 0.18s;
}
.cs-kpi:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.cs-kpi-label {
  font-size: 0.72em;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cs-kpi-value {
  font-size: 1.7em;
  font-weight: 800;
  color: var(--cs-navy-dark);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.cs-kpi-sub {
  font-size: 0.75em;
  color: var(--text-muted);
  margin-top: 2px;
}
.cs-kpi.green  { border-left-color: var(--success); }
.cs-kpi.green  .cs-kpi-value { color: var(--success); }
.cs-kpi.orange { border-left-color: var(--warning); }
.cs-kpi.orange .cs-kpi-value { color: var(--warning); }
.cs-kpi.red    { border-left-color: var(--danger); }
.cs-kpi.red    .cs-kpi-value { color: var(--danger); }
.cs-kpi.blue   { border-left-color: var(--info); }
.cs-kpi.blue   .cs-kpi-value { color: var(--info); }
.cs-kpi.purple { border-left-color: var(--purple); }
.cs-kpi.purple .cs-kpi-value { color: var(--purple); }
.cs-kpi.navy   { border-left-color: var(--cs-navy); }
.cs-kpi.navy   .cs-kpi-value { color: var(--cs-navy); }

/* ════════════════════════════════════════════════════════════════
   TABLES — header navy + alternance + hover
   ════════════════════════════════════════════════════════════════ */
.cs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
}
.cs-table thead th {
  background: var(--cs-navy-dark);
  color: white;
  padding: 10px 12px;
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 700;
  white-space: nowrap;
  text-align: left;
  position: sticky; top: 0;
}
.cs-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}
.cs-table tbody tr:nth-child(even) { background: var(--bg-alt); }
.cs-table tbody tr:hover { background: var(--bg-hover); }
.cs-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.cs-table .ctr { text-align: center; }
.cs-table .bold { font-weight: 700; }

/* ════════════════════════════════════════════════════════════════
   BADGES & TAGS
   ════════════════════════════════════════════════════════════════ */
.cs-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72em;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.cs-badge.success { background: #D1FAE5; color: #065F46; }
.cs-badge.warning { background: #FEF3C7; color: #92400E; }
.cs-badge.danger  { background: #FEE2E2; color: #991B1B; }
.cs-badge.info    { background: #DBEAFE; color: #1E40AF; }
.cs-badge.neutral { background: #F1F5F9; color: var(--text-muted); }

/* Tags boutique — utilisés avec BTQ_COLORS depuis JS */
.cs-btq-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72em;
  font-weight: 700;
  color: white;
  white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════════════ */
.cs-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85em;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.cs-btn.primary { background: var(--cs-red); color: white; }
.cs-btn.primary:hover { background: #9F1B30; transform: translateY(-1px); }
.cs-btn.secondary { background: var(--cs-navy); color: white; }
.cs-btn.secondary:hover { background: var(--cs-navy-dark); }
.cs-btn.ghost { background: transparent; color: var(--cs-navy); border: 1px solid var(--border); }
.cs-btn.ghost:hover { background: var(--bg-alt); }

/* ════════════════════════════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════════════════════════════ */
.cs-positive { color: var(--success); font-weight: 700; }
.cs-negative { color: var(--danger);  font-weight: 700; }
.cs-muted    { color: var(--text-muted); }
.cs-mono     { font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace; }

/* ════════════════════════════════════════════════════════════════
   GRIDS
   ════════════════════════════════════════════════════════════════ */
.cs-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.cs-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.cs-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

@media (max-width: 900px) {
  .cs-grid-2, .cs-grid-3, .cs-grid-4 { grid-template-columns: 1fr; }
  .cs-content { padding: 16px; }
  .cs-header  { padding: 14px 16px 10px; }
}
