/* =============================================================
   VITEXUP — Pilotage BTP · dashboard.css
   Style : premium, sobre, orienté direction. Optimisé 1920×1080.
   ============================================================= */

:root {
  /* Palette marque */
  --green: #0F6A3B;
  --green-600: #0D5C34;
  --green-700: #0A4A2A;
  --yellow: #FFD500;
  --red: #F30909;
  --success: #008E2A;

  /* Texte & surfaces */
  --ink: #172033;
  --ink-2: #667085;
  --bg: #F6F8FA;
  --white: #FFFFFF;
  --border: #E5E7EB;

  /* Tints dérivées (états) */
  --red-tint: #FEECEC;
  --red-tint-2: #FDE2E2;
  --green-tint: #E5F4EB;
  --green-tint-2: #DBF0E3;
  --amber-tint: #FFF6D1;
  --amber-ink: #8A6A00;

  /* Dimensions */
  --sidebar-w: 248px;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.04);
  --shadow: 0 2px 6px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
  --shadow-lg: 0 10px 30px rgba(16,24,40,.10), 0 2px 8px rgba(16,24,40,.06);

  --ease: cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, p { margin: 0; }
a { color: inherit; text-decoration: none; }

/* ===================== APP LAYOUT ===================== */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.brand-mark { display: grid; place-items: center; filter: drop-shadow(0 4px 10px rgba(15,106,59,.25)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 800; letter-spacing: .04em; font-size: 17px; color: var(--ink); }
.brand-sub { font-size: 11.5px; color: var(--ink-2); font-weight: 600; letter-spacing: .02em; }

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--ink-2); font-weight: 600; font-size: 14px;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav-item .nav-ico { display: grid; place-items: center; color: var(--ink-2); transition: color .18s; }
.nav-item:hover { background: #F2F4F7; color: var(--ink); }
.nav-item:hover .nav-ico { color: var(--ink); }
.nav-item.active {
  background: var(--green-tint);
  color: var(--green);
}
.nav-item.active .nav-ico { color: var(--green); }

.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.user { display: flex; align-items: center; gap: 11px; padding: 6px 8px; border-radius: 10px; }
.user-avatar {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 50%; background: var(--green-tint); color: var(--green); flex: none;
}
.user-text { display: flex; flex-direction: column; line-height: 1.2; }
.user-name { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.user-role { font-size: 11.5px; color: var(--ink-2); font-weight: 500; }

/* ===================== MAIN ===================== */
.main {
  padding: 26px 32px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1680px;
  width: 100%;
}

/* ---------- TOPBAR ---------- */
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.top-meta { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; flex-wrap: wrap; }
.live {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; color: var(--success);
  background: var(--green-tint); padding: 4px 10px; border-radius: 999px;
}
.live-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 0 rgba(0,142,42,.5); animation: pulseDot 2s infinite;
}
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(0,142,42,.5); }
  70% { box-shadow: 0 0 0 7px rgba(0,142,42,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,142,42,0); }
}
.top-date { font-size: 13px; font-weight: 600; color: var(--ink); }
.top-upd { font-size: 12.5px; color: var(--ink-2); }

.page-title { font-size: 28px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
.page-sub { font-size: 14px; color: var(--ink-2); margin-top: 2px; font-weight: 500; }

.pill-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--white); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; color: var(--ink-2);
  font-weight: 500;
}
.pill strong { color: var(--ink); font-weight: 700; }
.pill-muted { color: var(--ink-2); }
.pill-alert { border-color: var(--red-tint-2); background: var(--red-tint); color: var(--red); }
.pill-alert strong { color: var(--red); }
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); margin-right: 6px; }

.topbar-right { display: flex; align-items: center; gap: 14px; flex: none; padding-top: 4px; }
.selector { display: flex; flex-direction: column; gap: 6px; }
.selector label { font-size: 11.5px; font-weight: 600; color: var(--ink-2); padding-left: 2px; }
.select-wrap { position: relative; }
.select-wrap select {
  appearance: none; -webkit-appearance: none;
  font-family: inherit; font-size: 14px; font-weight: 600; color: var(--ink);
  background: var(--white); border: 1px solid var(--border); border-radius: 11px;
  padding: 11px 42px 11px 14px; min-width: 232px; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: border-color .18s, box-shadow .18s;
}
.select-wrap select:hover { border-color: #D0D5DD; }
.select-wrap select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(15,106,59,.14); }
.select-caret { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; display: grid; }

.btn-demo {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: inherit; font-size: 14px; font-weight: 700; color: var(--white);
  background: var(--green); border: none; border-radius: 11px;
  padding: 12px 18px; cursor: pointer; align-self: flex-end;
  box-shadow: 0 6px 16px rgba(15,106,59,.26); transition: transform .15s var(--ease), background .18s, box-shadow .18s;
}
.btn-demo:hover { background: var(--green-600); transform: translateY(-1px); box-shadow: 0 10px 22px rgba(15,106,59,.3); }
.btn-demo:active { transform: translateY(0); }
.btn-demo-ico { font-size: 11px; }
.btn-demo.is-running { background: var(--ink); box-shadow: 0 6px 16px rgba(23,32,51,.25); }

/* ---------- ALERTE BANNER ---------- */
.alerte-banner {
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(0deg, var(--red-tint), var(--red-tint));
  border: 1px solid var(--red-tint-2); border-left: 4px solid var(--red);
  border-radius: 14px; padding: 14px 20px;
  box-shadow: 0 6px 18px rgba(243,9,9,.1);
}
.alerte-banner[hidden] { display: none; }
.alerte-banner.show { animation: alertIn .5s var(--ease) both; }
@keyframes alertIn {
  from { opacity: 0; transform: translateY(-8px) scale(.99); }
  to { opacity: 1; transform: none; }
}
.ab-ico { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: var(--red); color: #fff; flex: none; animation: abPulse 1.8s infinite; }
@keyframes abPulse { 0%,100%{ box-shadow: 0 0 0 0 rgba(243,9,9,.35);} 60%{ box-shadow: 0 0 0 10px rgba(243,9,9,0);} }
.ab-text { display: flex; flex-direction: column; gap: 2px; }
.ab-title { font-size: 13px; font-weight: 800; letter-spacing: .06em; color: var(--red); }
.ab-desc { font-size: 14px; color: var(--ink); }
.ab-desc strong { color: var(--red); }
.ab-stats { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.ab-stat { display: flex; flex-direction: column; align-items: flex-end; font-size: 11.5px; color: var(--ink-2); font-weight: 600; line-height: 1.15; }
.ab-stat em { font-style: normal; font-size: 20px; font-weight: 800; color: var(--ink); }
.ab-stat-bad em { color: var(--red); }
.ab-vs { font-size: 12px; font-weight: 700; color: var(--ink-2); }

/* ===================== KPI ROW ===================== */
.kpi-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.kpi {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 18px 16px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 10px; min-height: 132px;
  transition: box-shadow .25s var(--ease), transform .25s var(--ease), border-color .25s;
  position: relative;
}
.kpi-head { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); text-transform: none; }
.kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); line-height: 1; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi-value.pos { color: var(--success); }
.kpi-value.neg { color: var(--red); }
.kpi-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-sub { font-size: 12.5px; color: var(--ink-2); }
.kpi-chip {
  font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: #F2F4F7; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.kpi-chip.bad { background: var(--red-tint); color: var(--red); }
.kpi-chip.good { background: var(--green-tint); color: var(--success); }

.kpi-trans[hidden] { display: none; }
.kpi-trans {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--red-tint); border: 1px dashed var(--red-tint-2);
  color: var(--ink); padding: 5px 10px; border-radius: 9px; width: max-content;
  animation: transIn .5s var(--ease) both;
}
.kpi-trans .from { color: var(--success); }
.kpi-trans .arrow { color: var(--ink-2); }
.kpi-trans .to { color: var(--red); }
@keyframes transIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

/* ===================== CONTENT GRID ===================== */
.content-grid { display: grid; grid-template-columns: minmax(0,1.62fr) minmax(0,1fr); gap: 16px; align-items: start; }
.col-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.col-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* ---------- Card générique ---------- */
.card {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.card-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.card-hint { font-size: 11.5px; color: var(--ink-2); font-weight: 500; }

.tag { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: #F2F4F7; color: var(--ink-2); white-space: nowrap; }
.tag-amber { background: var(--amber-tint); color: var(--amber-ink); }
.tag.bad { background: var(--red-tint); color: var(--red); }
.tag.good { background: var(--green-tint); color: var(--success); }

/* ---------- CHART rentabilité ---------- */
.legend { display: flex; gap: 16px; }
.lg { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.lg i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.lg-av i { background: var(--green); }
.lg-bu i { background: #C9D3E0; }

.chart { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; height: 272px; padding-top: 8px; }
.ch-group {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  gap: 10px; position: relative; border-radius: 12px; padding: 8px 6px 0;
  transition: background .25s var(--ease), opacity .3s var(--ease), transform .3s var(--ease);
}
.ch-group.dim { opacity: .34; }
.ch-group.active { background: #F8FAFC; }
.ch-bars { display: flex; align-items: flex-end; gap: 10px; height: 176px; width: 100%; justify-content: center; }
.ch-bar { width: 34px; border-radius: 7px 7px 0 0; height: 0; transition: height .9s var(--ease); position: relative; }
.ch-bar.av { background: linear-gradient(180deg, #1A7A47, var(--green)); }
.ch-bar.bu { background: linear-gradient(180deg, #D7DEE8, #C9D3E0); }
.ch-bar.bu.over { background: linear-gradient(180deg, #FF4D4D, var(--red)); }
.ch-bar .bar-val {
  position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
  font-size: 11.5px; font-weight: 700; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums;
  opacity: 0; transition: opacity .4s ease .5s;
}
.ch-group.show .ch-bar .bar-val { opacity: 1; }
.ch-depass {
  position: absolute; top: -2px; right: 2px;
  font-size: 10px; font-weight: 800; letter-spacing: .04em;
  background: var(--red); color: #fff; padding: 3px 7px; border-radius: 999px;
  box-shadow: 0 4px 10px rgba(243,9,9,.3); animation: abPulse 1.8s infinite;
}
.ch-marge {
  font-size: 12.5px; font-weight: 800; font-variant-numeric: tabular-nums;
  padding: 2px 8px; border-radius: 999px;
}
.ch-marge.pos { color: var(--success); background: var(--green-tint); }
.ch-marge.neg { color: var(--red); background: var(--red-tint); }
.ch-name { font-size: 12px; font-weight: 600; color: var(--ink-2); text-align: center; line-height: 1.25; height: 32px; display: flex; align-items: center; }
.ch-group.active .ch-name { color: var(--ink); }

/* ---------- TABLE ---------- */
.table-wrap { overflow-x: auto; }
.chantiers-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.chantiers-table thead th {
  text-align: left; font-size: 11.5px; font-weight: 700; color: var(--ink-2);
  text-transform: uppercase; letter-spacing: .04em; padding: 0 14px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.chantiers-table th.num, .chantiers-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.chantiers-table tbody td { padding: 14px; border-bottom: 1px solid #F0F2F5; }
.chantiers-table tbody tr { cursor: pointer; transition: background .16s var(--ease); }
.chantiers-table tbody tr:hover { background: #F8FAFC; }
.chantiers-table tbody tr:last-child td { border-bottom: none; }
.chantiers-table .c-name { font-weight: 700; color: var(--ink); }
.chantiers-table td.pos { color: var(--success); font-weight: 700; }
.chantiers-table td.neg { color: var(--red); font-weight: 700; }
.chantiers-table td.warn { color: var(--amber-ink); font-weight: 700; }
.chantiers-table tr.row-alert { background: var(--red-tint); }
.chantiers-table tr.row-alert:hover { background: var(--red-tint-2); }
.chantiers-table tr.row-alert td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.chantiers-table tr.selected { background: #EEF4FF; box-shadow: inset 0 0 0 2px rgba(15,106,59,.35); }

.status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .03em;
  padding: 4px 11px; border-radius: 999px; white-space: nowrap;
}
.status-badge i { width: 7px; height: 7px; border-radius: 50%; }
.status-OK { background: var(--green-tint); color: var(--success); }
.status-OK i { background: var(--success); }
.status-ALERTE { background: var(--red-tint); color: var(--red); }
.status-ALERTE i { background: var(--red); }
.status-SURVEILLANCE { background: var(--amber-tint); color: var(--amber-ink); }
.status-SURVEILLANCE i { background: var(--yellow); }

/* ---------- WHY card ---------- */
.card-why { border-color: var(--red-tint-2); background: linear-gradient(180deg, #FFFBFB, var(--white)); }
.card-why .card-title { color: var(--ink); }
.card-why[hidden] { display: none; }
.card-why.show { animation: alertIn .45s var(--ease) both !important; }
.why-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; counter-reset: why; }
.why-item { display: flex; gap: 14px; align-items: flex-start; }
.why-num {
  flex: none; width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; font-size: 13px; font-weight: 800;
  background: var(--red-tint); color: var(--red);
}
.why-body { display: flex; flex-direction: column; gap: 3px; }
.why-title { font-size: 14px; font-weight: 700; color: var(--ink); }
.why-desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.4; }
.why-desc b { color: var(--ink); font-weight: 700; }
.why-badge { align-self: flex-start; margin-top: 3px; font-size: 12px; font-weight: 800; color: var(--red); background: var(--red-tint); padding: 2px 9px; border-radius: 999px; }

/* ---------- HEURES chart ---------- */
.heures-chart { display: flex; align-items: flex-end; justify-content: space-around; gap: 16px; height: 150px; padding: 8px 4px 0; }
.he-col { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; height: 100%; justify-content: flex-end; }
.he-bar-wrap { display: flex; align-items: flex-end; height: 108px; width: 100%; justify-content: center; }
.he-bar {
  width: 46px; border-radius: 8px 8px 0 0; height: 0; transition: height .9s var(--ease);
  position: relative; background: #DFE4EC;
}
.he-bar.prev { background: #DFE4EC; }
.he-bar.act { background: linear-gradient(180deg, #9FB0C4, #7E92AB); }
.he-bar.proj { background: linear-gradient(180deg, #FF4D4D, var(--red)); box-shadow: 0 8px 18px rgba(243,9,9,.25); }
.he-val { position: absolute; top: -21px; left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 800; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.he-bar.proj .he-val { color: var(--red); }
.he-lab { font-size: 11.5px; font-weight: 600; color: var(--ink-2); text-align: center; }
.he-col.is-proj .he-lab { color: var(--red); font-weight: 700; }
.heures-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.heures-ecart { font-size: 13px; font-weight: 700; color: var(--amber-ink); }
.heures-ecart.bad { color: var(--red); }

/* ---------- FACTURATION ---------- */
.fact-bars { display: flex; flex-direction: column; gap: 16px; }
.fact-row-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.fact-row-top strong { font-size: 15px; color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; }
.bar { height: 12px; background: #EEF1F5; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 999px; transition: width .95s var(--ease); }
.bar-green { background: linear-gradient(90deg, #1A7A47, var(--green)); }
.bar-amber { background: linear-gradient(90deg, #FFD500, #F0A500); }
.fact-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.fact-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fact-note-label { font-size: 12.5px; color: var(--ink-2); }
.fact-note-val { font-size: 17px; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- PLANNING ---------- */
.plan-body { display: flex; align-items: center; gap: 20px; }
.plan-big { display: flex; flex-direction: column; }
.plan-val { font-size: 30px; font-weight: 800; letter-spacing: -.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.plan-val.bad { color: var(--red); }
.plan-cap { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.plan-detail { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; text-align: right; padding: 8px 14px; background: #F8FAFC; border-radius: 11px; }
.plan-poste { font-size: 14px; font-weight: 700; color: var(--ink); }
.plan-detail.bad { background: var(--red-tint); }
.plan-detail.bad .plan-poste { color: var(--red); }
.plan-poste-cap { font-size: 11.5px; color: var(--ink-2); margin-top: 1px; }

/* ---------- FOOTER ---------- */
.main-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 2px 2px; font-size: 11.5px; color: var(--ink-2); }
.foot-note em { font-style: italic; color: var(--ink-2); }

/* ===================== ENTRÉE (chargement) ===================== */
.kpi { opacity: 0; transform: translateY(12px); }
.content-grid .card { opacity: 0; transform: translateY(12px); }
body.loaded .kpi { animation: rise .6s var(--ease) forwards; }
body.loaded .content-grid .card { animation: rise .6s var(--ease) forwards; }
body.loaded .kpi:nth-child(1) { animation-delay: .05s; }
body.loaded .kpi:nth-child(2) { animation-delay: .12s; }
body.loaded .kpi:nth-child(3) { animation-delay: .19s; }
body.loaded .kpi:nth-child(4) { animation-delay: .26s; }
body.loaded .kpi:nth-child(5) { animation-delay: .33s; }
body.loaded .col-main .card:nth-child(1) { animation-delay: .40s; }
body.loaded .col-main .card:nth-child(2) { animation-delay: .50s; }
body.loaded .col-side .card:nth-child(1) { animation-delay: .44s; }
body.loaded .col-side .card:nth-child(2) { animation-delay: .52s; }
body.loaded .col-side .card:nth-child(3) { animation-delay: .60s; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ===================== FOCUS / DÉMO ===================== */
.focusable { transition: box-shadow .3s var(--ease), transform .3s var(--ease), opacity .3s var(--ease), filter .3s var(--ease); }
body.focus-mode .focusable:not(.focused) { opacity: .32; filter: saturate(.85); }
body.focus-mode .focused {
  position: relative; z-index: 3;
  box-shadow: 0 0 0 2px var(--green), var(--shadow-lg);
  transform: translateY(-2px);
}
.kpi.flash { animation: flashKpi 1.1s var(--ease); }
@keyframes flashKpi {
  0% { box-shadow: var(--shadow-sm); }
  30% { box-shadow: 0 0 0 3px rgba(255,213,0,.55), var(--shadow); }
  100% { box-shadow: var(--shadow-sm); }
}

/* ---------- Overlay vidéo ---------- */
.demo-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; background: transparent; z-index: 60; pointer-events: none;
}
.demo-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--yellow)); transition: width .25s linear; }
.demo-progress.on { background: rgba(15,106,59,.12); }

.demo-caption {
  position: fixed; left: 50%; bottom: 40px; transform: translate(-50%, 16px);
  z-index: 60; pointer-events: none; opacity: 0;
  transition: opacity .45s var(--ease), transform .45s var(--ease);
  max-width: min(720px, 86vw);
}
.demo-caption.show { opacity: 1; transform: translate(-50%, 0); }
.demo-caption-inner {
  display: inline-block; text-align: center;
  background: rgba(23,32,51,.92); color: #fff; backdrop-filter: blur(8px);
  font-size: 22px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3;
  padding: 16px 28px; border-radius: 16px;
  box-shadow: 0 18px 44px rgba(16,24,40,.32);
  border: 1px solid rgba(255,255,255,.08);
}

.demo-replay {
  position: fixed; left: 50%; bottom: 116px; transform: translateX(-50%);
  z-index: 61; font-family: inherit; font-size: 14px; font-weight: 700; color: var(--ink);
  background: var(--white); border: 1px solid var(--border); border-radius: 999px;
  padding: 11px 20px; cursor: pointer; box-shadow: var(--shadow-lg);
  display: inline-flex; align-items: center; gap: 8px; transition: transform .15s var(--ease), background .18s;
}
.demo-replay[hidden] { display: none; }
.demo-replay:hover { background: #F8FAFC; transform: translateX(-50%) translateY(-2px); }
.demo-replay span { color: var(--green); font-size: 16px; }

.demo-badge {
  position: fixed; top: 16px; right: 20px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink); color: #fff; font-size: 12px; font-weight: 700;
  padding: 7px 13px; border-radius: 999px; box-shadow: var(--shadow-lg);
}
.demo-badge[hidden] { display: none; }
.demo-badge-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: pulseDot 1.6s infinite; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1480px) {
  .kpi-value { font-size: 27px; }
  .page-title { font-size: 25px; }
}
@media (max-width: 1240px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center;
    border-right: none; border-bottom: 1px solid var(--border); padding: 12px 18px; gap: 18px;
  }
  .brand { padding: 0; }
  .nav { flex-direction: row; margin: 0; gap: 4px; overflow-x: auto; }
  .nav-item span:not(.nav-ico) { display: none; }
  .nav-item { padding: 9px; }
  .nav-item.active span:not(.nav-ico) { display: inline; }
  .sidebar-foot { margin: 0 0 0 auto; padding: 0; border: none; }
  .user-text { display: none; }
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .main { padding: 18px; }
  .topbar { flex-direction: column; }
  .topbar-right { width: 100%; justify-content: space-between; }
  .select-wrap select { min-width: 0; width: 100%; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .ab-stats { display: none; }
  .demo-caption-inner { font-size: 18px; padding: 13px 20px; }
}
@media (max-width: 520px) {
  .kpi-row { grid-template-columns: 1fr 1fr; }
  .plan-body { flex-direction: column; align-items: flex-start; }
  .plan-detail { margin-left: 0; align-items: flex-start; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .08s !important; }
}
