/* ================================================================
   briefing.css — Le Briefing iPilot PME
   Complète pulse.css (chargé via base.html)
   Variables héritées : --navy, --teal, --amber, --red, --soft, --ink, --muted
   ================================================================ */

/* ── Variables briefing ──────────────────────────────────────────── */
:root {
  --b-vert:    #22c55e;
  --b-vert-bg: rgba(34, 197, 94, 0.1);
  --b-orange:  #f6a400;
  --b-ora-bg:  rgba(246, 164, 0, 0.1);
  --b-rouge:   #ef4e3a;
  --b-rou-bg:  rgba(239, 78, 58, 0.1);
  --b-ia:      #4f6df5;
  --b-ia-bg:   rgba(79, 109, 245, 0.08);
  --b-card-bg: rgba(255, 255, 255, 0.92);
  --b-border:  rgba(17, 24, 39, 0.1);
  --b-shadow:  0 2px 12px rgba(15, 23, 42, 0.07);
}

/* ── Animation RAG rouge ─────────────────────────────────────────── */
@keyframes pulse-rouge {
  0%   { box-shadow: 0 0 0 0   rgba(239, 78, 58, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(239, 78, 58, 0); }
  100% { box-shadow: 0 0 0 0   rgba(239, 78, 58, 0); }
}
@keyframes b-fadein {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Hero header (page-hero override pour le briefing) ───────────── */
.b-hero {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
  align-items: stretch;
}

.b-hero-card {
  background: linear-gradient(135deg, #101c35 0%, #073f45 60%, #00786f 100%);
  border-radius: 8px;
  padding: 28px 32px 24px;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 170px;
  position: relative;
  overflow: hidden;
}
.b-hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(90deg, transparent, black 30%, black 75%, transparent);
  pointer-events: none;
}
.b-hero-eyebrow {
  font-size: 10.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: rgba(255,255,255,.55);
}
.b-hero-week {
  font-size: 13px;
  font-weight: 900;
  color: var(--teal);
  margin-top: 14px;
  position: relative;
  z-index: 1;
}
.b-hero-title {
  font-size: 30px;
  font-weight: 900;
  line-height: 1.05;
  position: relative;
  z-index: 1;
}
.b-hero-period {
  font-size: 13px;
  color: rgba(255,255,255,.6);
  position: relative;
  z-index: 1;
  margin-top: 4px;
}

/* ── Panneau statut (côté droit du hero) ─────────────────────────── */
.b-status-panel {
  background: var(--b-card-bg);
  border-radius: 8px;
  border: 1px solid var(--b-border);
  box-shadow: var(--b-shadow);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.b-status-label {
  font-size: 9.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #667085;
}

/* ── Mood badge ──────────────────────────────────────────────────── */
.b-mood {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 900;
  font-size: 14px;
}
.b-mood.rouge  { background: var(--b-rou-bg); color: var(--b-rouge); }
.b-mood.orange { background: var(--b-ora-bg); color: var(--b-orange); }
.b-mood.vert   { background: var(--b-vert-bg); color: #16a34a; }

.b-mood-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.b-mood.rouge  .b-mood-dot {
  background: var(--b-rouge);
  animation: pulse-rouge 1.4s ease-in-out infinite;
}
.b-mood.orange .b-mood-dot { background: var(--b-orange); }
.b-mood.vert   .b-mood-dot { background: var(--b-vert); }

/* ── Chips d'alerte (dans le panneau statut) ─────────────────────── */
.b-chip-list { display: flex; flex-direction: column; gap: 6px; }
.b-chip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  background: #f6f7f4;
  color: #374151;
}
.b-chip.rouge  { border-left: 3px solid var(--b-rouge); }
.b-chip.orange { border-left: 3px solid var(--b-orange); }
.b-chip.vert   { border-left: 3px solid var(--b-vert); }

/* ── Tabs navigation (sticky sous la nav principale) ─────────────── */
.briefing-tabs-wrap {
  position: sticky;
  top: 76px;
  z-index: 90;
  background: var(--soft);
  padding: 8px 0 6px;
  width: 100%;
}
.briefing-tabs {
  width: 100%;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding: 0 0 1px;
}
.briefing-tabs::-webkit-scrollbar { display: none; }

.b-tab {
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(17,24,39,0.1);
  background: white;
  color: #667085;
  transition: all .15s;
  user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.b-tab:hover { color: var(--navy); border-color: var(--navy); }
.b-tab.active { background: var(--navy); color: white; border-color: var(--navy); }

.b-tab-dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  position: relative; top: -1px;
}
.b-tab-dot.rouge  { background: var(--b-rouge); }
.b-tab-dot.orange { background: var(--b-orange); }
.b-tab-dot.vert   { background: var(--b-vert); }

/* ── Corps de contenu ────────────────────────────────────────────── */
.briefing-body {
  width: 100%;
  padding-bottom: 60px;
}

.b-section {
  display: none;
}
.b-section.active {
  display: block;
  animation: b-fadein .2s ease;
}

.b-section-hd {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 14px;
}
.b-section-ico {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: var(--navy);
  color: white;
  display: grid;
  place-items: center;
  font-size: 18px;
  flex-shrink: 0;
}
.b-section-hd h2 {
  font-size: 18px;
  font-weight: 900;
  color: var(--navy);
  margin: 0;
}
.b-section-hd p {
  font-size: 12px;
  color: #667085;
  margin: 2px 0 0;
}

/* ── Grille KPI ──────────────────────────────────────────────────── */
.b-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.b-kpi-grid.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.b-kpi-grid.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ── Carte KPI ───────────────────────────────────────────────────── */
.b-kpi {
  background: white;
  border: 1px solid var(--b-border);
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: var(--b-shadow);
  position: relative;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.b-kpi-lbl {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #667085;
  padding-right: 18px; /* espace pour le badge RAG */
}
.b-kpi-val {
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--navy);
  line-height: 1;
  margin: 6px 0 4px;
}
.b-kpi-val.rouge  { color: var(--b-rouge); }
.b-kpi-val.orange { color: var(--b-orange); }
.b-kpi-val.vert   { color: #16a34a; }

.b-kpi-sub {
  font-size: 11px;
  font-weight: 700;
  color: #667085;
}
.b-kpi-sub.up   { color: #16a34a; }
.b-kpi-sub.down { color: var(--b-rouge); }
.b-kpi-sub.warn { color: var(--b-orange); }

/* ── Badge RAG (coin supérieur droit de la carte) ────────────────── */
.b-rag {
  position: absolute;
  top: 12px; right: 12px;
  width: 9px; height: 9px;
  border-radius: 50%;
}
.b-rag.vert   { background: var(--b-vert); }
.b-rag.orange { background: var(--b-orange); }
.b-rag.rouge  {
  background: var(--b-rouge);
  animation: pulse-rouge 1.4s ease-in-out infinite;
}

/* ── Bloc commentaire IA ─────────────────────────────────────────── */
.b-ai {
  background: var(--b-ia-bg);
  border: 1px solid rgba(79,109,245,0.18);
  border-left: 3px solid var(--b-ia);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 14px;
}
.b-ai-hd {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}
.b-ai-hd .ico { font-size: 14px; }
.b-ai-hd span {
  font-size: 10.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--b-ia);
}
.b-ai p {
  font-size: 13px;
  line-height: 1.65;
  color: #374151;
  margin: 0;
}

/* ── Carte synthèse : humeur + chiffre clé ───────────────────────── */
.b-synth-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.b-mood-card {
  background: linear-gradient(140deg, #2d1010 0%, #5a1a10 100%);
  border-radius: 8px;
  padding: 22px 24px;
  color: white;
  min-height: 155px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.b-mood-card .mc-eyebrow {
  font-size: 9.5px; font-weight: 900; text-transform: uppercase;
  letter-spacing: 1.2px; color: rgba(255,255,255,.5);
}
.b-mood-card .mc-val {
  font-size: 2.5rem; font-weight: 900; line-height: 1; margin: 10px 0 4px;
}
.b-mood-card .mc-desc {
  font-size: 11.5px; color: rgba(255,255,255,.68); line-height: 1.4;
}
.b-key-num {
  background: var(--navy);
  border-radius: 8px;
  padding: 22px 24px;
  color: white;
  min-height: 155px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.b-key-num .kn-eye {
  font-size: 9.5px; font-weight: 900; text-transform: uppercase;
  letter-spacing: 1.2px; color: rgba(255,255,255,.5);
}
.b-key-num .kn-val {
  font-size: 2.6rem; font-weight: 900; line-height: 1; margin: 10px 0 4px;
  color: white;
}
.b-key-num .kn-trend {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700;
  color: var(--b-rouge);
  background: rgba(239,78,58,0.2);
  padding: 3px 9px; border-radius: 4px;
  width: fit-content;
}

/* ── Liste d'alertes (synthèse) ──────────────────────────────────── */
.b-alert-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.b-alert-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  background: white;
  border: 1px solid var(--b-border);
  border-radius: 8px;
}
.b-alert-ico {
  width: 30px; height: 30px;
  border-radius: 6px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 900;
  color: white; flex-shrink: 0;
}
.b-alert-ico.rouge  { background: var(--b-rouge); }
.b-alert-ico.orange { background: var(--b-orange); }
.b-alert-ico.vert   { background: var(--b-vert); }
.b-alert-txt strong {
  display: block; font-size: 13px; font-weight: 800; color: var(--navy);
}
.b-alert-txt span { font-size: 11.5px; color: #667085; }
.b-alert-v {
  margin-left: auto;
  font-size: 14px; font-weight: 900; color: var(--navy);
  white-space: nowrap;
}

/* ── Cartes actions suggérées ────────────────────────────────────── */
.b-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.b-action {
  background: white;
  border: 1px solid var(--b-border);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.b-action-ico {
  width: 34px; height: 34px;
  border-radius: 6px;
  background: var(--navy);
  color: white;
  display: grid; place-items: center;
  font-size: 15px; flex-shrink: 0;
}
.b-action-ico.teal   { background: var(--teal); }
.b-action-ico.rouge  { background: var(--b-rouge); }
.b-action-ico.orange { background: var(--b-orange); }
.b-action-body strong {
  display: block; font-size: 13px; font-weight: 800; color: var(--navy); margin-bottom: 2px;
}
.b-action-body span { font-size: 11.5px; color: #667085; line-height: 1.4; }

/* ── Barre de progression (objectif CA) ──────────────────────────── */
.b-progress-wrap {
  background: white;
  border: 1px solid var(--b-border);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.b-progress-hd {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 10px;
}
.b-progress-hd span { font-size: 11px; font-weight: 900; color: #667085; text-transform: uppercase; letter-spacing: .06em; }
.b-progress-hd strong { font-size: 13px; font-weight: 900; color: var(--navy); }
.b-progress-bar {
  height: 10px;
  background: #e9ecef;
  border-radius: 999px;
  overflow: hidden;
}
.b-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--teal), var(--b-orange));
  transition: width .6s ease;
}
.b-progress-labels {
  display: flex; justify-content: space-between;
  margin-top: 6px;
  font-size: 11px; color: #667085; font-weight: 700;
}

/* ── Tableau liste (factures, OF, contrats...) ───────────────────── */
.b-table-wrap {
  background: white;
  border: 1px solid var(--b-border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: var(--b-shadow);
}
.b-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.b-table thead { background: #f6f7f4; }
.b-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: #667085;
}
.b-table td {
  padding: 10px 14px;
  border-top: 1px solid rgba(17,24,39,0.06);
  color: #374151;
}
.b-table tr:hover td { background: #fafafa; }
.b-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 900;
}
.b-tag.rouge  { background: var(--b-rou-bg); color: var(--b-rouge); }
.b-tag.orange { background: var(--b-ora-bg); color: #b45309; }
.b-tag.vert   { background: var(--b-vert-bg); color: #15803d; }
.b-tag.blue   { background: rgba(79,109,245,0.1); color: var(--b-ia); }

/* ── Cartes info contexte ────────────────────────────────────────── */
.b-info-list { display: grid; gap: 10px; margin-bottom: 14px; }
.b-info-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: white;
  border: 1px solid var(--b-border);
  border-radius: 8px;
  padding: 14px 18px;
  box-shadow: var(--b-shadow);
}
.b-info-ico { font-size: 22px; flex-shrink: 0; padding-top: 1px; }
.b-info-card strong { display: block; font-size: 14px; font-weight: 800; color: var(--navy); margin-bottom: 3px; }
.b-info-card span   { font-size: 12.5px; color: #667085; line-height: 1.5; }

/* ── Navigateur semaines (entre hero et tabs) ────────────────────── */
.b-weeknav-wrap {
  width: 100%;
  margin: 8px 0 4px;
}
.b-weeknav {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.b-weeknav::-webkit-scrollbar { display: none; }

.b-week-tile {
  flex-shrink: 0;
  min-width: 52px;
  padding: 8px 10px 7px;
  border-radius: 6px;
  background: white;
  border: 1px solid var(--b-border);
  text-align: center;
  cursor: pointer;
  transition: all .15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.b-week-tile:hover { border-color: var(--navy); background: #f0f2f8; }
.b-week-tile.current { background: var(--navy); color: white; border-color: var(--navy); }
.b-week-tile.current:hover { background: var(--navy); }
.b-week-tile .wt-num {
  font-size: 12px; font-weight: 900; text-transform: uppercase;
  letter-spacing: .05em; color: inherit;
}
.b-week-tile .wt-date {
  font-size: 10px; font-weight: 600; color: inherit; opacity: .6;
  margin-top: 3px; white-space: nowrap;
}
.b-week-tile.current .wt-date { opacity: .75; }

/* ── Cartes d'alerte cliquables (goto onglet) ────────────────────── */
.b-alert-row.b-goto {
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .1s;
}
.b-alert-row.b-goto:hover {
  background: #f8f9ff;
  border-color: rgba(79,109,245,0.25);
  transform: translateX(2px);
}
.b-goto-arrow {
  margin-left: 8px;
  font-size: 18px;
  font-weight: 700;
  color: #c5cad6;
  flex-shrink: 0;
  line-height: 1;
  transition: color .12s, transform .12s;
}
.b-alert-row.b-goto:hover .b-goto-arrow {
  color: var(--b-ia);
  transform: translateX(2px);
}

/* ── Sparkline (micro-graphe dans les cartes KPI) ────────────────── */
.b-sparkline-wrap {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 44px;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
  opacity: .72;
}

/* ── Carte radar synthese ──────────────────────────────────── */
.b-radar-card {
  background: var(--navy);
  border-radius: 8px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}
.b-radar-chart { position: relative; width: 400px; height: 400px; flex-shrink: 0; }
.b-radar-scores { display: flex; flex-direction: column; gap: 10px; }
.b-radar-title {
  font-size: 10.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: rgba(255,255,255,.45);
  margin-bottom: 4px;
}

/* ── Lignes score radar ─────────────────────────────────────── */
.b-score-row {
  display: grid;
  grid-template-columns: 80px 1fr 28px;
  align-items: center;
  gap: 8px;
}
.b-score-lbl {
  font-size: 11.5px;
  font-weight: 700;
  color: rgba(255,255,255,.75);
  white-space: nowrap;
}
.b-score-bar {
  height: 4px;
  background: rgba(255,255,255,.12);
  border-radius: 999px;
  overflow: hidden;
}
.b-score-fill {
  height: 100%;
  border-radius: 999px;
  width: 0;
  transition: width .7s ease;
}
.b-score-fill.vert   { background: var(--b-vert); }
.b-score-fill.orange { background: var(--b-orange); }
.b-score-fill.rouge  { background: var(--b-rouge); }
.b-score-fill.blue   { background: var(--b-ia); }
.b-score-val {
  font-size: 12px;
  font-weight: 900;
  color: rgba(255,255,255,.85);
  text-align: right;
}

/* ── Fade-in (IntersectionObserver) ───────────────────────────── */
.b-fade {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .35s ease, transform .35s ease;
}
.b-fade.b-visible {
  opacity: 1;
  transform: translateY(0);
}



/* ── Questions IA (bas de chaque section) ──────────────────────────── */
.b-questions {
  margin-top: 18px;
  padding: 14px 16px 16px;
  background: #f6f7f4;
  border-radius: 8px;
  border-top: 2px solid rgba(17,24,39,0.06);
}
.b-questions-hd {
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #667085;
  margin-bottom: 10px;
}
.b-questions-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.b-question-chip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 13px;
  background: white;
  border: 1px solid rgba(17,24,39,0.1);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--navy);
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  line-height: 1.45;
}
.b-question-chip:hover {
  border-color: rgba(79,109,245,0.4);
  background: #f8f9ff;
  text-decoration: none;
}
.bq-arrow {
  flex-shrink: 0;
  font-size: 15px;
  color: var(--b-ia, #4f6df5);
  margin-top: 1px;
}

/* ── Responsive ──────────────────────────────────────────────────── */

/* Tablette : ≤ 960px */
@media (max-width: 960px) {
  .b-hero { grid-template-columns: 1fr; }
  .b-status-panel { display: none; }
  .b-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .b-kpi-grid.g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .b-synth-top { grid-template-columns: 1fr; }
  .b-actions { grid-template-columns: 1fr; }
  .briefing-tabs-wrap { top: 76px; }
  .b-radar-card { grid-template-columns: 1fr; }
  .b-radar-chart { width: 100%; max-width: 400px; height: 320px; margin: 0 auto; }
}

/* Mobile ≤ 768px : scroll zones flush sur les bords */
@media (max-width: 768px) {
  /* Tabs : pas de sticky sur mobile, scroll naturel */
  .briefing-tabs-wrap { position: relative; top: auto; }
  .briefing-tabs { padding: 0 12px 1px; gap: 5px; }
  .b-tab { padding: 8px 10px; font-size: 11.5px; }

  /* WeekNav */
  .b-weeknav { padding: 0 12px 2px; }
}

/* Mobile ≤ 540px */
@media (max-width: 540px) {
  .b-tab { padding: 7px 9px; font-size: 11px; }
  .b-week-tile { min-width: 44px; padding: 6px 8px; }
  .b-week-tile .wt-num { font-size: 11px; }
  .b-week-tile .wt-date { font-size: 9.5px; }
  .b-kpi-grid { grid-template-columns: 1fr; }
  .b-radar-chart { height: 260px; }
}
