/* ==========================================================================
   KITSUNE BOT — Design system « Glass » (site, espace client, admin)
   Matière verre façon Apple (flou + saturation, reflets, bords lumineux),
   fond en dégradé vivant, motion design à ressorts, transitions de vue.
   ========================================================================== */

:root {
  /* Fond */
  --bg: #050409;
  --bg-2: #0b0814;

  /* Texte (échelle de labels Apple) */
  --text: rgba(255, 255, 255, 0.96);
  --text-2: rgba(235, 228, 255, 0.68);
  --text-3: rgba(235, 228, 255, 0.44);
  --text-4: rgba(235, 228, 255, 0.26);

  /* Marque */
  --violet-100: #f1e9ff;
  --violet-200: #dccaff;
  --violet-300: #c4a2ff;
  --violet-400: #a874ff;
  --violet: #8b3dff;
  --violet-600: #7428e6;
  --violet-700: #5b17bf;
  --magenta: #c64bff;
  --indigo: #5b5cff;

  /* Couleurs système (mode sombre Apple) */
  --mint: #30d68c;
  --mint-2: #b8ffe0;
  --mint-soft: rgba(48, 214, 140, 0.16);
  --red: #ff453a;
  --red-soft: rgba(255, 69, 58, 0.16);
  --amber: #ffb340;
  --amber-soft: rgba(255, 179, 64, 0.16);

  /* Matière verre */
  --glass-fill: linear-gradient(150deg, rgba(255, 255, 255, 0.11) 0%, rgba(255, 255, 255, 0.045) 45%, rgba(255, 255, 255, 0.025) 100%);
  --glass-fill-strong: linear-gradient(150deg, rgba(40, 30, 64, 0.78) 0%, rgba(22, 16, 38, 0.72) 100%);
  --glass-tint: rgba(18, 12, 32, 0.38);
  --glass-blur: blur(28px) saturate(185%);
  --glass-blur-strong: blur(40px) saturate(200%);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-rim: linear-gradient(140deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0.08) 30%, rgba(255, 255, 255, 0.02) 60%, rgba(255, 255, 255, 0.22) 100%);
  --glass-hi: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -1px 0 rgba(255, 255, 255, 0.03);
  --glass-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 24px 60px -24px rgba(4, 0, 16, 0.8);
  --tile: rgba(255, 255, 255, 0.045);
  --tile-hover: rgba(255, 255, 255, 0.075);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --line-3: rgba(255, 255, 255, 0.24);

  --grad-violet: linear-gradient(180deg, #a56dff 0%, #8b3dff 55%, #6d22e6 100%);
  --grad-text: linear-gradient(100deg, #ffffff 0%, #e3d4ff 35%, #b386ff 70%, #8b3dff 100%);
  --grad-mint: linear-gradient(180deg, #5cf0ad 0%, #30d68c 100%);

  /* Formes */
  --r-xl: 32px;
  --r-card: 26px;
  --r-tile: 18px;
  --r-input: 14px;
  --r-pill: 999px;

  /* Typographie : SF Pro sur les appareils Apple, Inter ailleurs */
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, 'Segoe UI', Roboto, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', system-ui, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  /* Compatibilité */
  --font-body: var(--font);

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --spring-soft: cubic-bezier(0.25, 1.25, 0.5, 1);
  --t-fast: 180ms;
  --t: 320ms;
  --t-slow: 620ms;

  --container: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --shadow-violet: 0 14px 40px -14px rgba(139, 61, 255, 0.75);
  --glow-mint: 0 12px 36px -12px rgba(48, 214, 140, 0.7);

  color-scheme: dark;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv11', 'ss01';
}
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: rgba(139, 61, 255, 0.5); color: #fff; }
:focus-visible { outline: 2px solid var(--violet-300); outline-offset: 3px; border-radius: 10px; }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.028em; line-height: 1.08; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.mono { font-family: var(--font-mono); font-size: .92em; letter-spacing: 0; }
.grad-text { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mint-text, .up { color: var(--mint); }
.down { color: var(--red); }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }

/* ---------- Fond vivant (le verre a besoin de couleur derrière lui) ---------- */
.kb-bg, .kb-ambient { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; background: radial-gradient(120% 80% at 50% -20%, #1a0b3a 0%, var(--bg) 60%); }
.kb-bg::before, .kb-bg::after, .kb-ambient::before, .kb-ambient::after,
.kb-bg i { content: ''; position: absolute; border-radius: 50%; filter: blur(80px); will-change: transform; }
.kb-bg::before, .kb-ambient::before { width: 60vmax; height: 60vmax; left: -18vmax; top: -22vmax; background: radial-gradient(circle, rgba(139, 61, 255, 0.55), transparent 62%); animation: kbDriftA 26s var(--ease-in-out) infinite alternate; }
.kb-bg::after, .kb-ambient::after { width: 52vmax; height: 52vmax; right: -16vmax; bottom: -24vmax; background: radial-gradient(circle, rgba(198, 75, 255, 0.38), transparent 62%); animation: kbDriftB 32s var(--ease-in-out) infinite alternate; }
.kb-bg i:nth-child(1) { width: 34vmax; height: 34vmax; right: 8vmax; top: -10vmax; background: radial-gradient(circle, rgba(91, 92, 255, 0.32), transparent 62%); animation: kbDriftC 28s var(--ease-in-out) infinite alternate; }
.kb-bg i:nth-child(2) { width: 26vmax; height: 26vmax; left: 20vmax; bottom: -8vmax; background: radial-gradient(circle, rgba(48, 214, 140, 0.16), transparent 62%); animation: kbDriftA 36s var(--ease-in-out) infinite alternate-reverse; }
.kb-bg .grain { position: absolute; inset: 0; opacity: .05; mix-blend-mode: overlay; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
@keyframes kbDriftA { to { transform: translate3d(8vmax, 6vmax, 0) scale(1.12); } }
@keyframes kbDriftB { to { transform: translate3d(-10vmax, -6vmax, 0) scale(1.08); } }
@keyframes kbDriftC { to { transform: translate3d(-6vmax, 10vmax, 0) scale(0.9); } }

/* ---------- Matière verre ---------- */
.glass, .card {
  position: relative;
  background: var(--glass-fill), var(--glass-tint);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-card);
  box-shadow: var(--glass-hi), var(--glass-shadow);
  isolation: isolate;
}
/* Bord lumineux (reflet spéculaire, comme le Liquid Glass) */
.glass::before, .card::before {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 0;
  background: var(--glass-rim);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.glass-strong { background: var(--glass-fill-strong); -webkit-backdrop-filter: var(--glass-blur-strong); backdrop-filter: var(--glass-blur-strong); }
/* Tuile intérieure : translucide, sans flou (le flou empilé coûte cher sur mobile) */
.tile { background: var(--tile); border: 1px solid var(--line); border-radius: var(--r-tile); transition: background var(--t) var(--ease), border-color var(--t) var(--ease), transform var(--t) var(--ease); }
.card-pad { padding: clamp(18px, 2.4vw, 28px); }
.card-glow { overflow: hidden; }
.card-glow::after { content: ''; position: absolute; z-index: -1; inset: -40% -20% auto auto; width: 70%; height: 120%; background: radial-gradient(closest-side, rgba(139, 61, 255, 0.28), transparent 70%); pointer-events: none; }
.card-title { font-family: var(--font-display); font-size: 17px; font-weight: 650; letter-spacing: -0.02em; }
.card-sub { font-size: 13px; color: var(--text-3); }
.interactive { transition: transform var(--t) var(--spring-soft), box-shadow var(--t) var(--ease), border-color var(--t) var(--ease); }
@media (hover: hover) { .interactive:hover { transform: translateY(-3px) scale(1.006); border-color: var(--line-3); } }

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .card { background: rgba(26, 19, 42, 0.92); }
}

/* ---------- Marque ---------- */
.kb-brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.03em; white-space: nowrap; view-transition-name: kb-brand; }
.kb-brand img { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 6px 18px -6px rgba(139, 61, 255, 0.8); }
.kb-brand .kb-brand-bot { font-size: 10px; font-weight: 800; letter-spacing: 0.14em; padding: 3px 8px; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.18); color: var(--violet-100); }

/* ---------- Boutons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: var(--r-pill);
  border: 1px solid transparent; cursor: pointer; font-weight: 600; font-size: 15px; letter-spacing: -0.01em;
  transition: transform var(--t) var(--spring), background var(--t) var(--ease), border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), opacity var(--t) var(--ease);
  white-space: nowrap; user-select: none; -webkit-tap-highlight-color: transparent; overflow: hidden;
}
.btn:active { transform: scale(0.96); transition-duration: 90ms; }
.btn[disabled], .btn.is-loading { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--grad-violet); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), var(--shadow-violet); }
.btn-primary::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 55%); pointer-events: none; }
.btn-mint { background: var(--grad-mint); color: #032316; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45), var(--glow-mint); }
.btn-ghost, .btn-glass { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.14); color: var(--text); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12); }
.btn-danger { background: var(--red-soft); border-color: rgba(255, 69, 58, 0.35); color: #ff6b62; }
.btn-plain { background: none; border: 0; color: var(--violet-300); padding: 0 6px; min-height: 32px; }
@media (hover: hover) {
  .btn-primary:hover { transform: translateY(-1px) scale(1.02); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 18px 50px -14px rgba(139, 61, 255, 0.95); }
  .btn-mint:hover { transform: translateY(-1px) scale(1.02); }
  .btn-ghost:hover, .btn-glass:hover { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.24); }
  .btn-danger:hover { background: rgba(255, 69, 58, 0.24); }
  .btn-plain:hover { color: var(--violet-200); }
}
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 13.5px; }
.btn-lg { min-height: 54px; padding: 0 28px; font-size: 16.5px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.01em; white-space: nowrap;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.12); color: var(--text-2);
}
.badge-violet { background: rgba(139, 61, 255, 0.2); border-color: rgba(168, 116, 255, 0.4); color: var(--violet-100); }
.badge-mint { background: var(--mint-soft); border-color: rgba(48, 214, 140, 0.4); color: #6ff0b6; }
.badge-red { background: var(--red-soft); border-color: rgba(255, 69, 58, 0.4); color: #ff7b72; }
.badge-amber { background: var(--amber-soft); border-color: rgba(255, 179, 64, 0.4); color: #ffc56b; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.dot-live { animation: kbPulse 1.8s infinite; }
@keyframes kbPulse { 0% { box-shadow: 0 0 0 0 rgba(48, 214, 140, 0.6); } 70% { box-shadow: 0 0 0 8px rgba(48, 214, 140, 0); } 100% { box-shadow: 0 0 0 0 rgba(48, 214, 140, 0); } }

/* ---------- Formulaires ---------- */
.field { display: grid; gap: 7px; }
.field > span, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input, .select, textarea.input {
  width: 100%; min-height: 48px; padding: 12px 15px; border-radius: var(--r-input);
  background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12); color: var(--text);
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease), box-shadow var(--t) var(--ease); outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
}
.input::placeholder { color: var(--text-4); }
.input:focus, .select:focus { border-color: rgba(168, 116, 255, 0.8); background: rgba(139, 61, 255, 0.08); box-shadow: 0 0 0 4px rgba(139, 61, 255, 0.22); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.select option { background: #1b1430; color: #fff; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); cursor: pointer; }
.check input { margin-top: 2px; accent-color: var(--violet); width: 18px; height: 18px; flex: none; }

/* Curseur */
input[type="range"].range { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 99px; background: linear-gradient(90deg, var(--violet-400) var(--fill, 0%), rgba(255, 255, 255, 0.12) var(--fill, 0%)); outline: none; }
input[type="range"].range::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45), 0 0 0 .5px rgba(0, 0, 0, 0.1); cursor: pointer; transition: transform var(--t-fast) var(--spring); }
input[type="range"].range:active::-webkit-slider-thumb { transform: scale(1.12); }
input[type="range"].range::-moz-range-thumb { width: 24px; height: 24px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45); cursor: pointer; }

/* Interrupteur iOS */
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: rgba(120, 120, 128, 0.32); transition: background var(--t) var(--ease); cursor: pointer; }
.switch span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25), 0 3px 1px rgba(0, 0, 0, 0.06); transition: transform var(--t) var(--spring), width var(--t-fast) var(--ease); }
.switch input:active + span::after { width: 33px; }
.switch input:checked + span { background: var(--mint); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:checked:active + span::after { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 2px solid var(--violet-300); outline-offset: 2px; }

/* Contrôle segmenté iOS (l'indicateur glisse) */
.seg { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: 12px; background: rgba(118, 118, 128, 0.24); isolation: isolate; }
.seg button { position: relative; z-index: 1; border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: 13px; padding: 6px 14px; border-radius: 9px; cursor: pointer; white-space: nowrap; transition: color var(--t) var(--ease); }
.seg button[aria-pressed="true"] { color: #fff; }
.seg .seg-thumb { position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 0; border-radius: 9px; background: rgba(255, 255, 255, 0.16); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.18); transition: transform var(--t) var(--spring-soft), width var(--t) var(--spring-soft); }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background var(--t-fast) var(--ease); }
.table tbody tr:hover td { background: rgba(255, 255, 255, 0.035); }

/* ---------- Mise en page ---------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: grid; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 980px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .grid-2, .grid-4 { grid-template-columns: 1fr; } }
.hide { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* ---------- Notifications (toasts) ---------- */
.kb-toasts { position: fixed; z-index: 200; left: 50%; top: 16px; transform: translateX(-50%); display: grid; gap: 10px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.kb-toast {
  display: flex; gap: 10px; align-items: center; padding: 13px 18px; border-radius: 20px; font-size: 14px; font-weight: 550;
  background: rgba(40, 32, 60, 0.72); border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(30px) saturate(190%); backdrop-filter: blur(30px) saturate(190%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 20px 50px -18px rgba(0, 0, 0, 0.9);
  animation: kbToastIn var(--t-slow) var(--spring) both; pointer-events: auto;
}
.kb-toast::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--violet-300); flex: none; }
.kb-toast.success::before { background: var(--mint); }
.kb-toast.error::before { background: var(--red); }
.kb-toast.leaving { animation: kbToastOut var(--t) var(--ease) both; }
@keyframes kbToastIn { from { opacity: 0; transform: translateY(-16px) scale(0.92); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes kbToastOut { to { opacity: 0; transform: translateY(-10px) scale(0.96); filter: blur(4px); } }

/* ---------- Fenêtre modale (feuille iOS) ---------- */
.kb-modal { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 16px; background: rgba(4, 2, 10, 0.5); -webkit-backdrop-filter: blur(12px) saturate(120%); backdrop-filter: blur(12px) saturate(120%); animation: kbFade var(--t) var(--ease) both; }
.kb-modal-box { width: 100%; max-width: 520px; max-height: calc(100dvh - 32px); overflow: auto; animation: kbSheetIn var(--t-slow) var(--spring-soft) both; }
.kb-modal.closing { animation: kbFadeOut var(--t) var(--ease) both; }
.kb-modal.closing .kb-modal-box { animation: kbSheetOut var(--t) var(--ease) both; }
@media (max-width: 560px) {
  .kb-modal { place-items: end center; padding: 0; }
  .kb-modal-box { max-width: none; border-radius: 30px 30px 0 0; max-height: 90dvh; padding-bottom: calc(20px + env(safe-area-inset-bottom)); animation-name: kbSheetUp; }
  .kb-modal.closing .kb-modal-box { animation-name: kbSheetDown; }
}
@keyframes kbFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes kbFadeOut { to { opacity: 0; } }
@keyframes kbSheetIn { from { opacity: 0; transform: translateY(18px) scale(0.94); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes kbSheetOut { to { opacity: 0; transform: translateY(10px) scale(0.96); filter: blur(4px); } }
@keyframes kbSheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes kbSheetDown { to { transform: translateY(100%); } }

/* ---------- Motion : entrées en cascade ---------- */
.rise { animation: kbRise var(--t-slow) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes kbRise { from { opacity: 0; transform: translateY(16px) scale(0.985); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
.pop { animation: kbPop var(--t-slow) var(--spring) both; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes kbPop { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: none; } }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; animation: kbSpin .8s linear infinite; flex: none; }
@keyframes kbSpin { to { transform: rotate(360deg); } }

/* Apparition au défilement (pilotée par le scroll quand le navigateur sait le faire) */
.reveal { opacity: 0; transform: translateY(28px) scale(0.98); filter: blur(8px); transition: opacity .9s var(--ease-out), transform .9s var(--ease-out), filter .9s var(--ease-out); transition-delay: calc(var(--i, 0) * 70ms); }
.reveal.is-in { opacity: 1; transform: none; filter: none; }

/* ---------- Transitions de page (View Transitions API) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: kbVtOut 280ms var(--ease-in-out) both; }
::view-transition-new(root) { animation: kbVtIn 520ms var(--ease-out) both; }
::view-transition-group(kb-brand) { animation-duration: 560ms; animation-timing-function: var(--spring-soft); }
:root.kb-vt-inpage::view-transition-old(root), :root.kb-vt-inpage::view-transition-new(root) { animation: none; }
:root.kb-vt-inpage::view-transition-group(kb-brand) { animation: none; }
::view-transition-old(kb-view) { animation: kbViewOut 220ms var(--ease-in-out) both; }
::view-transition-new(kb-view) { animation: kbViewIn 480ms var(--ease-out) both; }
@keyframes kbVtOut { to { opacity: 0; transform: scale(0.985); filter: blur(6px); } }
@keyframes kbVtIn { from { opacity: 0; transform: scale(1.015); filter: blur(10px); } }
@keyframes kbViewOut { to { opacity: 0; transform: translateY(-8px); filter: blur(6px); } }
@keyframes kbViewIn { from { opacity: 0; transform: translateY(14px); filter: blur(8px); } }

/* ---------- Avertissement risques ---------- */
.risk-note { font-size: 12px; line-height: 1.6; color: var(--text-3); }
.risk-note strong { color: var(--text-2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important; transition-duration: .01ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; filter: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- Graphiques ---------- */
.kb-chart { position: relative; width: 100%; touch-action: pan-y; }
.kb-chart svg { overflow: visible; cursor: crosshair; }
.kb-chart .kb-draw .kb-line { transition: stroke-dashoffset 1.6s var(--ease-out); }
.kb-chart .kb-draw .kb-area { animation: kbFade 1.2s var(--ease-out) .25s both; }
.kb-chart .kb-draw .kb-end { animation: kbPop .6s var(--spring) 1.2s both; transform-box: fill-box; transform-origin: center; }
.kb-chart .kb-grow .kb-bar { animation: kbBarGrow .7s var(--spring-soft) both; }
@keyframes kbBarGrow { from { transform: scaleY(0); opacity: 0; } to { transform: none; opacity: 1; } }
.kb-chart-tip { position: absolute; z-index: 2; pointer-events: none; display: grid; gap: 1px; white-space: nowrap; padding: 8px 12px; border-radius: 14px; font-size: 12.5px; font-variant-numeric: tabular-nums; background: rgba(36, 28, 56, 0.72); border: 1px solid rgba(255, 255, 255, 0.16); -webkit-backdrop-filter: blur(24px) saturate(180%); backdrop-filter: blur(24px) saturate(180%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 14px 34px -12px rgba(0, 0, 0, 0.9); }
.kb-chart-tip span { color: var(--text-3); font-size: 11.5px; }
.kb-chart-tip strong { font-weight: 650; }
.kb-chart-empty { display: grid; place-items: center; min-height: 160px; color: var(--text-3); font-size: 13.5px; text-align: center; padding: 20px; }
