/* SafeBet V2.1 — Composants */
/* ─── KPI GRID ───────────────────────────────────────────── */
.kgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.kpi {
  background: linear-gradient(180deg, #FFFFFF 0%, #FBFDFE 100%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--sh-sm);
  transition: transform .14s, box-shadow .14s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--sh-md); }
.kpi::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--r) var(--r) 0 0;
}
.kpi.green::before  { background: linear-gradient(90deg, var(--green), var(--green-l)); }
.kpi.gold::before   { background: linear-gradient(90deg, var(--gold), #E8B420); }
.kpi.red::before    { background: linear-gradient(90deg, var(--red), #F04550); }
.kpi.blue::before   { background: linear-gradient(90deg, var(--blue), #2E7EE0); }
.kpi.orange::before { background: linear-gradient(90deg, var(--orange), #E88B10); }
.kpi.teal::before   { background: linear-gradient(90deg, var(--teal), #14B8A6); }
.kpi.purple::before { background: linear-gradient(90deg, var(--purple), #9B59E8); }
.kpi-accent {
  position: absolute;
  top: -30px; right: -24px;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: .06;
}
.kpi.green  .kpi-accent { background: var(--green); }
.kpi.gold   .kpi-accent { background: var(--gold); }
.kpi.red    .kpi-accent { background: var(--red); }
.kpi.blue   .kpi-accent { background: var(--blue); }
.kpi.orange .kpi-accent { background: var(--orange); }
.kpi.teal   .kpi-accent { background: var(--teal); }
.kpi.purple .kpi-accent { background: var(--purple); }
.kpi-l {
  font-size: 10px;
  font-weight: 800;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-bottom: 8px;
}
.kpi-v {
  font-size: 22px;
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -.5px;
  line-height: 1.15;
}
.kpi-s {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
  margin-top: 5px;
}

/* ─── CARDS ──────────────────────────────────────────────── */
.card {
  background: linear-gradient(180deg, #FFFFFF 0%, #FBFDFE 100%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px;
  box-shadow: var(--sh-sm);
  transition: transform .16s, box-shadow .16s;
}
.card:hover { box-shadow: var(--sh-md); }
.card-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 14px; font-weight: 800; color: var(--ink2); display: flex; align-items: center; gap: 7px; }
.card-title .ti { font-size: 17px; }
.cgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.sep { height: 1px; background: var(--line); margin: 18px 0; }

/* ─── BUTTONS ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 17px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: 'Inter', sans-serif;
  transition: all .14s;
  white-space: nowrap;
}
.btn-green {
  background: var(--green);
  color: #fff;
  box-shadow: 0 8px 20px rgba(14,155,111,.22);
}
.btn-green:hover { background: var(--green-l); transform: translateY(-1px); box-shadow: 0 12px 28px rgba(14,155,111,.28); }
.btn-gold {
  background: var(--gold);
  color: #fff;
  box-shadow: 0 8px 20px rgba(200,147,10,.22);
}
.btn-gold:hover { background: #E8A810; transform: translateY(-1px); }
.btn-ghost {
  background: var(--sf);
  color: var(--ink3);
  border-color: var(--line2);
  box-shadow: var(--sh-sm);
}
.btn-ghost:hover { background: var(--green-bg); color: var(--green); border-color: var(--green-b); }
.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: rgba(212,43,52,.25);
}
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-full { width: 100%; justify-content: center; }
.flex-g { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ─── FORMS ──────────────────────────────────────────────── */
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 14px; }
.fg { display: flex; flex-direction: column; gap: 6px; }
.fl { font-size: 12px; font-weight: 700; color: var(--ink3); }
.fc {
  background: var(--sf);
  border: 1.5px solid var(--line2);
  border-radius: var(--r-sm);
  padding: 10px 13px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border .14s, box-shadow .14s;
  width: 100%;
}
.fc:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(14,155,111,.12); }
.fc::placeholder { color: var(--dim); }
.fc option { background: var(--sf); color: var(--text); }

/* ─── UTILITIES ──────────────────────────────────────────── */
.mt16 { margin-top: 16px; }
.mt20 { margin-top: 20px; }
.mb14 { margin-bottom: 14px; }
.tsm  { font-size: 12px; }
.txs  { font-size: 11px; }
.tc-green  { color: var(--green); }
.tc-red    { color: var(--red); }
.tc-gold   { color: var(--gold); }
.tc-orange { color: var(--orange); }
.tc-blue   { color: var(--blue); }
.tc-muted  { color: var(--muted); }

/* ─── TABLE ──────────────────────────────────────────────── */
.tw { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 10px 12px;
  background: var(--s2);
  border-bottom: 1px solid var(--line);
}
td {
  padding: 11px 12px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink2);
  border-bottom: 1px solid var(--line);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--green-bg); }
.bdg {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
}
.bdg-g { background: var(--green-bg); color: #087A57; }
.bdg-r { background: var(--red-bg);   color: #A82228; }
.bdg-o { background: var(--orange-bg); color: #A35200; }
.bdg-gray { background: var(--s3); color: var(--muted); }

/* ─── MODAL ──────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(11,31,51,.48);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--sf);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 40px 100px rgba(11,31,51,.22);
  width: 100%;
  max-width: 490px;
  max-height: 92vh;
  overflow-y: auto;
}
.modal-hd {
  padding: 20px 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 16px; font-weight: 900; color: var(--ink); }
.modal-body  { padding: 0 24px 24px; }

/* ─── ALERTS (anti-tilt) ─────────────────────────────────── */
.al-list { display: flex; flex-direction: column; gap: 10px; }
.al-item {
  background: var(--sf);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 15px 17px;
  display: flex;
  gap: 13px;
  box-shadow: var(--sh-sm);
}
.al-item.danger  { border-left: 3px solid var(--red);    background: var(--red-bg); }
.al-item.warning { border-left: 3px solid var(--gold);   background: var(--gold-bg); }
.al-item.ok      { border-left: 3px solid var(--green);  background: var(--green-bg); }
.al-item.info    { border-left: 3px solid var(--blue);   background: var(--blue-bg); }
.al-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.al-item.danger  .al-icon { color: var(--red); }
.al-item.warning .al-icon { color: var(--gold); }
.al-item.ok      .al-icon { color: var(--green); }
.al-item.info    .al-icon { color: var(--blue); }
.al-t { font-size: 14px; font-weight: 800; color: var(--ink); margin-bottom: 3px; }
.al-d { font-size: 13px; color: var(--muted); font-weight: 500; line-height: 1.55; }

/* ─── COACH ──────────────────────────────────────────────── */
.coach-wrap {
  background: linear-gradient(135deg, #EDF9F4 0%, #F5FFF9 60%, #FFFDF4 100%);
  border: 1px solid var(--green-b);
  border-radius: var(--r);
  padding: 22px;
  box-shadow: 0 12px 36px rgba(14,155,111,.08);
}
.coach-av {
  width: 46px; height: 46px;
  background: var(--green-bg);
  border: 1.5px solid var(--green-b);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  margin-bottom: 14px;
}
.coach-msg {
  background: var(--sf);
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: var(--r-sm);
  padding: 12px 15px;
  margin-bottom: 9px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink2);
  line-height: 1.6;
  box-shadow: var(--sh-sm);
}

/* ─── PROGRESS BAR ───────────────────────────────────────── */
.prog-wrap { background: var(--s3); border-radius: 20px; height: 10px; overflow: hidden; margin: 8px 0 5px; }
.prog-bar  { height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--green), #3DD68C); transition: width .6s ease; }

/* ─── CHECKPOINT CARD ────────────────────────────────────── */
.cp-card {
  background: linear-gradient(135deg, var(--gold-bg) 0%, #FFFDF4 45%, #FFF 100%);
  border: 1px solid var(--gold-b);
  border-left: 4px solid var(--gold);
  border-radius: var(--r);
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: 0 12px 32px rgba(200,147,10,.10);
  transition: transform .16s, box-shadow .16s;
}
.cp-card:hover { box-shadow: 0 16px 40px rgba(200,147,10,.16); }
.cp-sub { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 3px; }
.cp-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-top: 12px;
}

/* ─── EMPTY STATE ────────────────────────────────────────── */
.empty { text-align: center; padding: 40px 20px; }
.empty-icon { font-size: 38px; color: var(--dim); margin-bottom: 10px; }
.empty-title { font-size: 14px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.empty-desc  { font-size: 12px; color: var(--dim); }

/* ─── TOAST ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--sf);
  color: var(--ink);
  border: 1px solid var(--green-b);
  border-radius: var(--r-sm);
  padding: 12px 18px;
  font-size: 13.5px;
  font-weight: 700;
  z-index: 400;
  box-shadow: var(--sh-lg);
  transform: translateY(10px);
  opacity: 0;
  transition: all .22s;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-color: rgba(212,43,52,.3); color: var(--red); }

/* ─── SPINNER ────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── SECURITÉ BLOCK (retrait) ───────────────────────────── */
.secur-block {
  background: var(--green-bg);
  border: 1px solid var(--green-b);
  border-left: 3px solid var(--green);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  margin-top: 14px;
}
.secur-hint { font-size: 12px; color: var(--green); font-weight: 600; margin-top: 6px; }

/* ─── ONBOARDING ─────────────────────────────────────────── */
.init-banner{
  background:linear-gradient(135deg,#0E9B6F 0%,#12BC87 58%,#C8930A 100%);
  color:#fff;border-radius:18px;padding:20px 22px;margin-bottom:22px;
  box-shadow:0 16px 44px rgba(14,155,111,.22);display:none;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap
}
.init-banner h3{font-size:18px;font-weight:900;margin-bottom:3px}.init-banner p{font-size:13px;color:rgba(255,255,255,.9);max-width:720px}.init-banner .btn{background:#fff;color:#0B1F33;border-color:rgba(255,255,255,.45)}
.init-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}.init-box{background:var(--s2);border:1px solid var(--line);border-radius:14px;padding:14px}.init-box-title{font-weight:900;color:var(--ink);font-size:13px;margin-bottom:10px}.init-preview{background:linear-gradient(135deg,#F8FBFD,#EBF9F4);border:1px solid var(--green-b);border-radius:14px;padding:14px;margin-top:14px}.init-preview-row{display:flex;justify-content:space-between;gap:10px;padding:7px 0;border-bottom:1px solid var(--line)}.init-preview-row:last-child{border-bottom:0}.init-preview-row span{color:var(--muted);font-weight:700}.init-preview-row strong{font-weight:900}.init-help{font-size:12px;color:var(--muted);font-weight:500;line-height:1.5;margin-top:8px}.chart-empty{height:100%;min-height:170px;display:flex;align-items:center;justify-content:center;text-align:center;color:var(--muted);font-weight:700;background:linear-gradient(135deg,#F8FBFD,#FFF);border-radius:12px;border:1px dashed var(--line2);padding:18px}.svg-chart{width:100%;height:100%;min-height:180px}.svg-chart text{font-family:Inter,system-ui,sans-serif;font-size:11px;fill:#6B7A8A;font-weight:700}
@media(max-width:700px){.init-grid{grid-template-columns:1fr}.init-banner{display:none}.init-banner.open{display:flex}}


/* ─── HERO DASHBOARD ─────────────────────────────────────── */
.hero {
  background: linear-gradient(120deg, #0B1F33 0%, #123A4E 48%, #0E9B6F 135%);
  border-radius: 20px;
  padding: 26px 28px;
  margin-bottom: 22px;
  color: #fff;
  box-shadow: 0 20px 50px rgba(11,31,51,.18);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.hero::after {
  content: '';
  position: absolute;
  right: -70px; top: -70px;
  width: 240px; height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(18,188,135,.4), transparent 70%);
}
.hero-hello { font-size: 24px; font-weight: 900; letter-spacing: -.5px; }
.hero-situation { font-size: 14px; color: rgba(255,255,255,.88); margin-top: 6px; max-width: 640px; line-height: 1.6; font-weight: 500; }
.hero-date { font-size: 12px; color: rgba(255,255,255,.55); font-weight: 700; margin-top: 10px; text-transform: capitalize; }
.hero .btn { position: relative; z-index: 1; background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.3); backdrop-filter: blur(6px); }
.hero .btn:hover { background: rgba(255,255,255,.2); }

/* ─── DELTAS KPI ─────────────────────────────────────────── */
.kpi-delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 800;
  margin-top: 8px; padding: 3px 9px; border-radius: 20px;
}
.kpi-delta.up   { background: var(--green-bg); color: #087A57; }
.kpi-delta.down { background: var(--red-bg);   color: #A82228; }
.kpi-delta.flat { background: var(--s3);       color: var(--muted); }
.kpi-delta small { font-weight: 600; opacity: .85; }

/* ─── COACH INCARNÉ ──────────────────────────────────────── */
.coach-hd { display: flex; align-items: center; gap: 12px; }
.coach-face {
  width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(135deg, var(--green), #09755A);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: 0 10px 24px rgba(14,155,111,.3);
  position: relative; flex-shrink: 0;
}
.coach-face::after {
  content: '';
  position: absolute; bottom: -2px; right: -2px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #12BC87; border: 2px solid #fff;
}
.coach-name { font-size: 14px; font-weight: 900; color: var(--ink); }
.coach-role { font-size: 11px; color: var(--muted); font-weight: 600; }
.coach-bubble {
  background: var(--sf);
  border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px;
  padding: 12px 15px;
  margin-bottom: 9px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink2);
  line-height: 1.6;
  box-shadow: var(--sh-sm);
  animation: bubbleIn .22s ease-out backwards;
}
.coach-bubble:nth-child(2) { animation-delay: .06s; }
.coach-bubble:nth-child(3) { animation-delay: .12s; }
.coach-bubble:nth-child(4) { animation-delay: .18s; }
.coach-bubble b { color: var(--green); }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ─── TIMELINE HISTORIQUE ────────────────────────────────── */
.tl-day {
  font-size: 11px; font-weight: 800; color: var(--dim);
  text-transform: uppercase; letter-spacing: .7px;
  margin: 14px 0 10px 2px;
}
.tl-day:first-child { margin-top: 0; }
.tl-item { display: flex; gap: 13px; position: relative; padding-bottom: 14px; }
.tl-item::before {
  content: '';
  position: absolute; left: 17px; top: 40px; bottom: -2px;
  width: 2px; background: var(--line);
}
.tl-item:last-child::before, .tl-item.tl-end::before { display: none; }
.tl-ic {
  width: 36px; height: 36px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; flex-shrink: 0;
  box-shadow: var(--sh-sm); z-index: 1;
}
.tl-ic.dep { background: var(--red-bg);   color: var(--red); }
.tl-ic.wd  { background: var(--green-bg); color: var(--green); }
.tl-body {
  flex: 1;
  background: var(--sf);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 15px;
  box-shadow: var(--sh-sm);
  transition: transform .14s, box-shadow .14s;
}
.tl-body:hover { transform: translateY(-1px); box-shadow: var(--sh-md); }
.tl-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.tl-amt { font-size: 15px; font-weight: 900; letter-spacing: -.3px; }
.tl-meta { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 5px; display: flex; align-items: center; gap: 5px; }

/* ─── GRAPHIQUES PLEINE LARGEUR ──────────────────────────── */
.gstack { display: grid; grid-template-columns: 1fr; gap: 16px; }
.gstack .chart-box { position: relative; height: 300px; }
@media (max-width: 768px) { .gstack .chart-box { height: 230px; } }

/* ─── SEGMENTED TOGGLE ───────────────────────────────────── */
.seg { display: inline-flex; background: var(--s3); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button {
  border: none; background: transparent; cursor: pointer;
  padding: 6px 13px; border-radius: 8px;
  font-size: 12.5px; font-weight: 700; color: var(--muted);
  font-family: 'Inter', sans-serif;
  transition: all .14s;
  display: inline-flex; align-items: center; gap: 5px;
}
.seg button.on { background: var(--sf); color: var(--green); box-shadow: var(--sh-sm); }


/* ─── FEEDBACK BÊTA ──────────────────────────────────────── */
.fab-fb {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--green), var(--green-d));
  color: #fff; border: none; cursor: pointer; font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 14px 34px rgba(14,155,111,.4);
  transition: transform .16s, box-shadow .16s;
}
.fab-fb:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 18px 42px rgba(14,155,111,.5); }
.fb-choices { display: flex; gap: 8px; }
.fb-choice {
  flex: 1; padding: 11px 8px; text-align: center; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--sf); font-size: 12.5px; font-weight: 700; color: var(--muted);
  font-family: 'Inter', sans-serif;
  transition: all .14s;
}
.fb-choice:hover { border-color: var(--green); }
.fb-choice.on { border-color: var(--green); background: var(--green-bg); color: var(--green-d); }
.fb-choice span { display: block; font-size: 19px; margin-bottom: 3px; }
@media (max-width: 768px) { .fab-fb { right: 14px; bottom: 14px; } }
