/* ArkaN — Theme V2 ("Charbon Émeraude")
 * Refonte fintech premium niveau Linear / Finary / Bloomberg.
 * Palette charbon (#111111/#1A1A1D), typographie Geist + Inter + JetBrains Mono,
 * courbes cinétiques cubic-bezier(0.19, 1, 0.22, 1), spacing scale 4px.
 *
 * Architecture en 3 couches :
 *  1. Tokens primitifs   — couleurs, polices, dimensions
 *  2. Tokens sémantiques — surface-1, accent-positive, etc. (anciennes vars maintenues pour rétro-compat)
 *  3. Composants         — .panel, .btn, .topbar, .bottom-nav, .skeleton, etc.
 */

:root {
  /* ─── 1. Tokens primitifs ─── */

  /* Charbon : noir profond non-agressif (évite le smear OLED de #000000) */
  --color-charcoal-0:  #0a0a0c;   /* fond ultra-sombre (modal scrim, hero) */
  --color-charcoal-1:  #111111;   /* fond principal — spec utilisateur */
  --color-charcoal-2:  #16161A;   /* surface niveau 1 (panels) */
  --color-charcoal-3:  #1A1A1D;   /* surface niveau 2 — spec utilisateur (cards) */
  --color-charcoal-4:  #232326;   /* surface élevée (modal, popover) */
  --color-charcoal-5:  #2C2C30;   /* hover/elevated */

  /* Émeraude (l'accent positif fintech) */
  --color-emerald-300: #5cd3aa;
  --color-emerald-400: #2eb88a;
  --color-emerald-500: #1d8463;
  --color-emerald-50:  rgba(46, 184, 138, 0.10);

  /* Or rosé (totaux, valeurs nominales premium) */
  --color-gold-300:   #e8c896;
  --color-gold-400:   #d4a574;
  --color-gold-500:   #a87e57;
  --color-gold-50:    rgba(212, 165, 116, 0.10);

  /* Sémantiques iOS */
  --color-green-400:  #34c759;
  --color-red-400:    #ff453a;
  --color-orange-400: #ff9f0a;
  --color-blue-400:   #0a84ff;
  --color-purple-400: #af52de;

  /* Texte — neige nuancée pour texture organique sur charbon */
  --color-text-100:   #f5f5f5;   /* primaire */
  --color-text-200:   #c4c4c8;   /* secondaire */
  --color-text-300:   #888890;   /* tertiaire */
  --color-text-400:   #5c5c64;   /* quaternaire (placeholders) */

  /* Bordures 1px à 0.06-0.10 opacity pour la séparation Linear-style */
  --border-subtle:   rgba(255, 255, 255, 0.06);
  --border-default:  rgba(255, 255, 255, 0.10);
  --border-strong:   rgba(255, 255, 255, 0.16);
  --border-emphasis: rgba(46, 184, 138, 0.30);

  /* Typographie : Geist (Vercel) + Inter (fallback) + JetBrains Mono (chiffres) */
  --font-display: 'Geist', 'Inter', 'Inter Display', -apple-system, system-ui, sans-serif;
  --font-body:    'Geist', 'Inter', -apple-system, system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Geist Mono', 'SF Mono', 'Menlo', monospace;

  /* Spacing scale 4px (multiples 4-8-12-16-20-24-32-40-48-64) */
  --space-1: 4px;   --space-2: 8px;   --space-3: 12px;  --space-4: 16px;
  --space-5: 20px;  --space-6: 24px;  --space-8: 32px;  --space-10: 40px;
  --space-12: 48px; --space-16: 64px; --space-20: 80px;

  /* Radius — 16px généreux pour les cards (spec utilisateur) */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* Courbes cinétiques cubic-bezier(0.19, 1, 0.22, 1) — spec utilisateur (expo.out custom) */
  --ease-fluid:    cubic-bezier(0.19, 1, 0.22, 1);   /* sortie expo : "kiss" Linear */
  --ease-decel:    cubic-bezier(0.16, 1, 0.30, 1);   /* sortie douce alt. */
  --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1); /* spring physique léger */
  --ease-cinema:   cubic-bezier(0.65, 0.05, 0.36, 1); /* in-out cinématique */
  --ease: var(--ease-fluid);

  /* Durées : 150-300ms micro / ≤400ms transitions / 60-70% pour exit */
  --dur-instant: 80ms;
  --dur-fast:    150ms;
  --dur-base:    220ms;
  --dur-slow:    320ms;
  --dur-cinema:  500ms;

  /* Élévations : système consistant */
  --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-md:  0 4px 16px rgba(0, 0, 0, 0.45);
  --shadow-lg:  0 12px 32px rgba(0, 0, 0, 0.55);
  --shadow-xl:  0 24px 64px rgba(0, 0, 0, 0.65);
  --shadow-glow-emerald: 0 0 0 1px rgba(46, 184, 138, 0.20), 0 8px 32px rgba(46, 184, 138, 0.15);
  --shadow-glow-gold:    0 0 0 1px rgba(212, 165, 116, 0.20), 0 8px 32px rgba(212, 165, 116, 0.12);

  /* Z-index orchestré */
  --z-base:     0;
  --z-elevated: 10;
  --z-sticky:   20;
  --z-overlay:  40;
  --z-modal:    100;
  --z-toast:    1000;

  /* ─── 2. Tokens sémantiques (rétro-compat avec V1 + nouveaux noms) ─── */

  /* Backgrounds & surfaces */
  --bg:               var(--color-charcoal-1);
  --bg-1:             var(--color-charcoal-1);
  --bg-2:             var(--color-charcoal-2);
  --surface:          var(--color-charcoal-3);    /* card translucide remplacée par opaque charbon */
  --surface-2:        var(--color-charcoal-3);
  --surface-3:        var(--color-charcoal-4);
  --surface-elevated: var(--color-charcoal-4);

  /* Bordures */
  --border:    var(--border-subtle);
  --border-2:  var(--border-default);
  --border-3:  var(--border-strong);

  /* Texte */
  --text:    var(--color-text-100);
  --text-2:  var(--color-text-200);
  --text-3:  var(--color-text-300);
  --text-4:  var(--color-text-400);

  /* Accents (rétro-compat) */
  --accent:        var(--color-emerald-400);
  --accent-strong: var(--color-emerald-300);
  --accent-dim:    var(--color-emerald-500);
  --accent-soft:   var(--color-emerald-50);
  --gold:          var(--color-gold-400);
  --gold-strong:   var(--color-gold-300);
  --gold-dim:      var(--color-gold-500);
  --gold-soft:     var(--color-gold-50);

  /* Sémantiques */
  --green:    var(--color-green-400);
  --green-dim: #248a3d;
  --green-bg: rgba(52, 199, 89, 0.12);
  --red:      var(--color-red-400);
  --red-dim:  #c8311e;
  --red-bg:   rgba(255, 69, 58, 0.12);
  --orange:   var(--color-orange-400);
  --blue:     var(--color-blue-400);
  --purple:   var(--color-purple-400);
  --pink:     #ff375f;

  /* Anciens alias rétro-compat */
  --r-sm: var(--radius-sm);
  --r-md: var(--radius-md);
  --r-lg: var(--radius-lg);
  --r-xl: var(--radius-xl);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01', 'ss03', 'tnum';
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.005em;       /* Linear-style tightening */
  /* Bloquer tout scroll horizontal involontaire (mobile) */
  overflow-x: hidden;
  max-width: 100vw;
  position: relative;
}
* { max-width: 100%; } /* prévient les overflows sur les enfants */

body {
  /* Charbon profond non-agressif + 2 sources lumineuses ambient (émeraude top-left, or rosé bottom-right) */
  background:
    radial-gradient(ellipse 60% 50% at 15% 8%,  rgba(46, 184, 138, 0.07), transparent 60%),
    radial-gradient(ellipse 50% 40% at 88% 92%, rgba(212, 165, 116, 0.04), transparent 60%),
    var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Grille subtile niveau Linear (presque invisible, juste pour la texture) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
  z-index: 0;
  mask-image:      radial-gradient(ellipse at center, black 25%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 25%, transparent 75%);
}

/* Scrollbars Linear-style (ultra-fines, presque invisibles) */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 3px; transition: background var(--dur-fast) var(--ease); }
*::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.24); }
*::-webkit-scrollbar-corner { background: transparent; }

::selection { background: rgba(46, 184, 138, 0.40); color: #fff; }

.ico { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; flex-shrink: 0; }

/* Reduced motion : respect WCAG */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─────────────── Topbar Linear-style (sticky, blur, hairline border) ─────────────── */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-8);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  background: rgba(17, 17, 17, 0.78);
  position: sticky; top: 0; z-index: var(--z-sticky);
}
.brand {
  display: inline-flex; align-items: center; gap: 11px;
  font-family: var(--font-display); font-weight: 600; font-size: 19px;
  letter-spacing: -.3px;
  justify-self: start;
  text-decoration: none; color: var(--text);
}
.brand svg { width: 32px; height: 32px; }
.brand-text { letter-spacing: .3px; font-weight: 500; }
.brand-text .accent-text { color: var(--gold-strong); font-weight: 700; }

.nav-links {
  display: flex;
  gap: 2px;
  justify-self: center;
  position: relative;
}
.nav-link {
  padding: 9px 14px;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 9px;
  transition: all .2s var(--ease);
  display: inline-flex; align-items: center; gap: 7px;
  letter-spacing: .1px;
  white-space: nowrap;
}
.nav-link .ico { width: 14px; height: 14px; opacity: .85; }
.nav-link.active {
  background: linear-gradient(135deg, rgba(46, 184, 138, .18), rgba(46, 184, 138, .06));
  color: var(--accent-strong);
  box-shadow: 0 0 0 1px rgba(46, 184, 138, .25) inset;
}
.nav-link.active .ico { opacity: 1; }
.nav-link:hover:not(.active) { color: var(--text); background: rgba(255, 255, 255, .03); }

/* Nav with sub-menu */
.nav-group { position: relative; }
.nav-group-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  padding: 6px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px);
  z-index: 80;
  animation: menuIn .15s var(--ease-spring);
}
.nav-group[data-open="1"] .nav-group-menu { display: block; }
.nav-sub-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  color: var(--text-2);
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  border-radius: 9px;
  transition: all .15s;
}
.nav-sub-link .ico { width: 14px; height: 14px; color: var(--text-3); }
.nav-sub-link:hover { background: rgba(255, 255, 255, .04); color: var(--text); }
.nav-sub-link:hover .ico { color: var(--accent); }
.nav-sub-link.active { background: var(--accent-soft); color: var(--accent-strong); }
.nav-sub-link.active .ico { color: var(--accent); }

@keyframes menuIn {
  from { transform: translateX(-50%) translateY(-6px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.right-actions { justify-self: end; display: flex; gap: 8px; align-items: center; }

/* Profile chip */
.profile-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 5px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 99px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  position: relative;
}
.profile-chip:hover { border-color: var(--border-3); }
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-strong), var(--gold));
  color: #0a1812;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-family: var(--font-display); font-size: 13px;
  box-shadow: 0 0 0 2px rgba(212, 165, 116, .25);
  flex-shrink: 0;
}
.profile-chip .ico-down { width: 12px; height: 12px; color: var(--text-3); transition: transform .2s; }
.profile-chip[data-open="1"] .ico-down { transform: rotate(180deg); }

.profile-menu {
  position: absolute;
  top: calc(100% + 6px); right: 0;
  min-width: 260px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  padding: 6px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px);
  z-index: 80;
  display: none;
  animation: dropIn .15s var(--ease-spring);
}
.profile-chip[data-open="1"] .profile-menu { display: block; }
@keyframes dropIn { from { transform: translateY(-6px) scale(.98); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
.profile-row {
  padding: 9px 11px; border-radius: 9px; font-size: 13px;
  color: var(--text-2); cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  transition: all .15s; font-weight: 500;
}
.profile-row:hover { background: rgba(255, 255, 255, .04); color: var(--text); }
.profile-row.active { background: var(--accent-soft); color: var(--accent-strong); }
.profile-row .mini-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 11px;
  color: #fff; flex-shrink: 0;
}
.profile-divider { height: 1px; background: var(--border); margin: 5px 6px; }
.profile-action {
  padding: 9px 11px; border-radius: 9px; font-size: 12.5px;
  color: var(--text-3); cursor: pointer;
  display: flex; align-items: center; gap: 9px;
  transition: all .15s; font-weight: 500;
}
.profile-action:hover { background: rgba(255, 255, 255, .04); color: var(--text-2); }
.profile-action .ico { width: 14px; height: 14px; }

/* ─────────────── Buttons ─────────────── */
.btn {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-2);
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  cursor: pointer;
  font-family: var(--font-body); font-weight: 500;
  transition: all .2s var(--ease);
  display: inline-flex; align-items: center; gap: 7px;
  text-decoration: none; white-space: nowrap;
  letter-spacing: .1px;
}
.btn .ico { width: 13px; height: 13px; }
.btn:hover {
  color: var(--text);
  border-color: var(--border-3);
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.btn-primary {
  border: none;
  color: #1a1408;
  background: linear-gradient(135deg, var(--gold-strong), var(--gold));
  font-weight: 700;
  padding: 11px 20px;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(212, 165, 116, .3);
  border-radius: 11px;
  cursor: pointer;
  font-family: var(--font-body);
  display: inline-flex; align-items: center; gap: 8px;
  transition: all .25s var(--ease-spring);
  letter-spacing: .2px;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(212, 165, 116, .45);
}
.btn-primary.btn-emerald {
  color: #0a1812;
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-dim));
  box-shadow: 0 6px 20px rgba(46, 184, 138, .35);
}
.btn-primary:disabled, .btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-edit {
  background: linear-gradient(135deg, rgba(46, 184, 138, .12), rgba(122, 150, 182, .08));
  border: 1px solid rgba(46, 184, 138, .25);
  color: var(--accent);
}
.btn-edit[data-on="1"] {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent-dim));
  color: #fff;
  border-color: var(--accent);
}

.icon-btn {
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border-2);
  background: rgba(0, 0, 0, .3);
  color: var(--text-3);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.icon-btn:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.icon-btn.danger:hover { color: var(--red); border-color: var(--red); }
.icon-btn .ico { width: 14px; height: 14px; }

/* ─────────────── Layout ─────────────── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 80px;
  position: relative;
  z-index: 2;
}

/* Page hero — V2 fintech (charbon avec aurora subtile) */
.page-hero {
  background:
    radial-gradient(ellipse 60% 80% at 100% 0%, rgba(46, 184, 138, 0.08), transparent 60%),
    radial-gradient(ellipse 50% 60% at 0% 100%, rgba(212, 165, 116, 0.05), transparent 60%),
    var(--color-charcoal-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-8) var(--space-7);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-5);
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute;
  top: 0; left: var(--space-6); right: var(--space-6);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.40;
}
.page-hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 36px;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: var(--space-2);
}
.page-hero .subtitle {
  color: var(--gold);
  font-size: 13px;
  font-family: var(--font-mono);
  letter-spacing: 0.3px;
  font-weight: 500;
}
.page-hero h1 .accent {
  background: linear-gradient(135deg, var(--accent-strong) 0%, var(--gold-strong) 50%, var(--accent-strong) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 8s linear infinite;
}
@keyframes shimmer { to { background-position: 200% center; } }

/* Total figure (Finary-like) */
.total-figure {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 48px;
  letter-spacing: -2px;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin-top: 4px;
}

/* Delta pills (Finary-like : "+9 955 €  +1.93%") */
.delta-row { display: inline-flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; font-family: var(--font-mono); font-size: 14px; font-weight: 500; }
.delta-amt { color: var(--text-2); font-variant-numeric: tabular-nums; }
.delta-amt.pos { color: var(--green); }
.delta-amt.neg { color: var(--red); }
.delta-pill {
  padding: 3px 9px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: center; gap: 3px;
}
.delta-pill.pos { background: var(--green-bg); color: var(--green); }
.delta-pill.neg { background: var(--red-bg); color: var(--red); }

/* Panels — fintech card niveau Linear/Finary (charbon mat, radius 16, hover discret) */
.panel {
  background: var(--color-charcoal-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: border-color var(--dur-base) var(--ease), transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}
.panel:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
/* Hairline supérieur émeraude pour les panels héro (à activer ponctuellement) */
.panel.is-hero::before {
  content: '';
  position: absolute; top: 0; left: var(--space-6); right: var(--space-6);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.40;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.panel h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.3px;
  display: flex; align-items: center; gap: 10px;
  color: var(--text);
}
.panel h3 .ico { width: 18px; height: 18px; color: var(--accent); }
.panel .sub {
  color: var(--gold);
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: .2px;
  margin-top: 4px;
}
.panel .sub strong, .panel .sub b { color: var(--gold-strong); font-weight: 600; }

/* Helpers couleurs sémantiques harmonisées */
.amt-pos { color: var(--green) !important; }
.amt-neg { color: var(--red) !important; }
.amt-total { color: var(--gold-strong) !important; }
.amt-saving { color: var(--accent-strong) !important; }

/* Collapsible panels */
.panel[data-collapsible="1"] .panel-head { cursor: pointer; user-select: none; }
.panel-collapse-btn {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-3);
  width: 28px; height: 28px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .2s;
  flex-shrink: 0;
}
.panel-collapse-btn:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.panel-collapse-btn .ico { width: 14px; height: 14px; transition: transform .25s; }
.panel[data-collapsed="1"] .panel-collapse-btn .ico { transform: rotate(-90deg); }
.panel[data-collapsed="1"] .panel-body { display: none; }
.panel[data-collapsed="1"] { padding-bottom: 18px; }
.panel[data-collapsed="1"] .panel-head { margin-bottom: 0; }

/* Forms */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-3);
  font-weight: 600;
  margin-bottom: 7px;
}
.field input, .field select, .field textarea {
  width: 100%;
  background: rgba(0, 0, 0, .35);
  border: 1px solid var(--border-2);
  color: var(--text);
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 14px;
  font-family: var(--font-body);
  outline: none;
  transition: all .2s var(--ease);
  resize: vertical;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 184, 138, .14);
  background: rgba(0, 0, 0, .5);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-4); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.field .help {
  font-size: 11px; color: var(--text-4);
  margin-top: 5px;
  font-family: var(--font-mono);
  line-height: 1.4;
}

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .75);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; padding: 20px;
  animation: fadeIn .15s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface-elevated);
  border: 1px solid var(--border-2);
  border-radius: 20px;
  padding: 28px;
  max-width: 540px;
  width: 100%;
  backdrop-filter: blur(28px) saturate(1.4);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(46, 184, 138, .06);
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .25s var(--ease);
}
.modal-large { max-width: 760px; }
.modal-xl { max-width: 940px; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 22px; padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -.5px;
}
.modal-head .sub { color: var(--text-3); font-size: 12px; margin-top: 4px; font-family: var(--font-mono); }
.modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 11px;
  font-size: 13px;
  margin: 10px 0;
  display: flex; gap: 10px; align-items: flex-start;
  line-height: 1.55;
}
.alert.ok    { background: var(--green-bg); border: 1px solid rgba(52, 199, 89, .3); color: var(--green); }
.alert.err   { background: var(--red-bg); border: 1px solid rgba(255, 69, 58, .3); color: var(--red); }
.alert.info  { background: rgba(10, 132, 255, .08); border: 1px solid rgba(10, 132, 255, .25); color: var(--blue); }
.alert.warn  { background: rgba(255, 159, 10, .08); border: 1px solid rgba(255, 159, 10, .25); color: var(--orange); }

/* Empty */
.empty {
  padding: 36px 22px;
  text-align: center;
  color: var(--text-3);
  border: 1.5px dashed var(--border-2);
  border-radius: 14px;
  background: rgba(0, 0, 0, .15);
}
.empty .ico { width: 36px; height: 36px; opacity: .35; margin-bottom: 12px; color: var(--accent); }
.empty h4 { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty p { font-size: 12.5px; line-height: 1.55; max-width: 420px; margin: 0 auto; }

/* Loading */
.loading { padding: 60px; text-align: center; }
.spinner {
  width: 40px; height: 40px;
  border: 3px solid rgba(46, 184, 138, .15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .9s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Period tabs */
.period-tabs {
  display: inline-flex;
  background: rgba(0, 0, 0, .35);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.period-tab {
  padding: 6px 14px;
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-body);
  border-radius: 7px;
  transition: all .15s;
  letter-spacing: .3px;
}
.period-tab:hover:not(.active) { color: var(--text-2); }
.period-tab.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  box-shadow: 0 0 0 1px rgba(46, 184, 138, .25) inset;
}

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--green-bg);
  border: 1px solid rgba(52, 199, 89, .3);
  border-radius: 7px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  font-weight: 600;
  color: var(--green);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .6; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.1); } }
.badge.steel {
  background: var(--accent-soft);
  border-color: rgba(46, 184, 138, .3);
  color: var(--accent-strong);
}
.badge.steel .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* Sandbox edit-mode bar */
.sandbox-bar {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: 18px;
  display: none;
  align-items: center; gap: 12px;
  padding: 10px 16px;
  background: var(--surface-elevated);
  border: 1px solid var(--accent);
  border-radius: 99px;
  box-shadow: 0 10px 36px rgba(46, 184, 138, .2), 0 0 0 1px rgba(46, 184, 138, .15) inset;
  backdrop-filter: blur(20px);
  z-index: 200;
  font-size: 12.5px;
  color: var(--text-2);
  font-weight: 500;
}
body[data-edit="1"] .sandbox-bar { display: inline-flex; }
.sandbox-bar .ico { width: 14px; height: 14px; color: var(--accent); }

/* Hamburger : retiré, plus de drawer mobile (on utilise une bottom-nav) */
.nav-burger { display: none !important; }
.nav-drawer-backdrop { display: none !important; }

/* ─────────────── Bottom Nav mobile — Frosted Glass Finary-style ───────────────
 * Spec utilisateur : blur 15px, opacité 70%, indicateur élastique avec spring.
 * Z-index élevé. Safe area inset bottom respectée.
 */
.bottom-nav {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-overlay);
  padding: var(--space-2) var(--space-2) calc(var(--space-2) + env(safe-area-inset-bottom));
  background: rgba(17, 17, 17, 0.70);                    /* 70% opacity (spec) */
  border-top: 1px solid var(--border-subtle);
  backdrop-filter: blur(15px) saturate(1.8);             /* 15px blur (spec) */
  -webkit-backdrop-filter: blur(15px) saturate(1.8);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.04), 0 -12px 32px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
}
.bottom-nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-1);
  max-width: 100%;
  margin: 0 auto;
  position: relative;
}
.bottom-nav-item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: var(--space-1);
  padding: 8px 4px 6px;
  text-decoration: none;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition:
    color var(--dur-base) var(--ease),
    background var(--dur-base) var(--ease),
    transform var(--dur-base) var(--ease-spring);
  background: transparent;
  border: none;
  font-family: var(--font-body);
  position: relative;
  min-height: 56px;          /* ≥44pt touch target */
}
.bottom-nav-item .ico {
  width: 24px; height: 24px;     /* spec utilisateur 24x24px */
  transition: transform var(--dur-slow) var(--ease-spring), filter var(--dur-base) var(--ease);
}
.bottom-nav-item .label { line-height: 1.05; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bottom-nav-item:hover { color: var(--text-2); }
.bottom-nav-item:active { transform: scale(0.96); }
.bottom-nav-item.active {
  color: var(--accent-strong);
}
.bottom-nav-item.active .ico {
  transform: translateY(-2px) scale(1.08);
  filter: drop-shadow(0 0 8px rgba(46, 184, 138, 0.50));
}
/* Indicateur élastique : pill émeraude qui glisse avec spring physique */
.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%) scaleX(1);
  width: 28px; height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-strong), var(--accent));
  box-shadow: 0 0 10px rgba(46, 184, 138, 0.55);
  animation: navPillIn var(--dur-slow) var(--ease-spring);
}
@keyframes navPillIn {
  0%   { transform: translateX(-50%) scaleX(0.3); opacity: 0; }
  60%  { transform: translateX(-50%) scaleX(1.15); opacity: 1; }
  100% { transform: translateX(-50%) scaleX(1); opacity: 1; }
}

/* Sous-menu Patrimoine (popover ascendant) */
.bottom-nav-popover {
  display: none;
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(78px + env(safe-area-inset-bottom));
  background: var(--surface-elevated);
  border: 1px solid var(--border-2);
  border-radius: 16px;
  padding: 6px;
  min-width: 240px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px);
  z-index: 95;
  animation: dropIn .18s var(--ease-spring);
}
.bottom-nav-popover.show { display: block; }
.bottom-nav-popover .nav-sub-link {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 12px;
  color: var(--text-2);
  font-size: 14px; font-weight: 500;
  text-decoration: none;
  border-radius: 10px;
}
.bottom-nav-popover .nav-sub-link .ico { width: 16px; height: 16px; color: var(--text-3); }
.bottom-nav-popover .nav-sub-link:hover { background: rgba(255, 255, 255, .04); color: var(--text); }
.bottom-nav-popover .nav-sub-link:hover .ico { color: var(--accent); }
.bottom-nav-popover .nav-sub-link.active { background: var(--accent-soft); color: var(--accent-strong); }
.bottom-nav-popover .nav-sub-link.active .ico { color: var(--accent); }

/* Mobile */
@media (max-width: 880px) {
  /* Garantie anti-scroll horizontal et centrage */
  html, body { width: 100%; max-width: 100vw; overflow-x: clip; }
  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }
  .container, .topbar, .panel, .modal, .page-hero {
    max-width: 100% !important;
    box-sizing: border-box;
  }
  .topbar {
    grid-template-columns: 1fr auto;
    padding: 12px 14px;
    gap: 8px;
    width: 100%;
  }
  .brand { font-size: 17px; justify-self: start; }
  .brand svg { width: 28px; height: 28px; }

  /* Nav top : cachée → remplacée par bottom-nav */
  .nav-links { display: none !important; }

  /* Right actions : avatar + bouton déconnexion */
  .right-actions { gap: 6px; justify-self: end; }
  .profile-chip span#userName { display: none; }
  .profile-chip { padding: 4px 4px 4px 4px; }
  .profile-chip .ico-down { display: none; }
  .right-actions .icon-btn[onclick*="logout"] { display: inline-flex; }

  /* Bottom-nav visible */
  .bottom-nav { display: block; }

  /* Layout */
  .container { padding: 18px 16px 30px; }
  .page-hero { padding: 24px 20px; border-radius: 18px; }
  .page-hero h1 { font-size: 24px; }
  .total-figure { font-size: 36px; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; }

  /* Modals fullscreen — laisse de la place pour le bottom-nav */
  .modal-backdrop { padding: 0; padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
  .modal {
    max-width: 100% !important;
    max-height: calc(100vh - 78px - env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
    padding: 20px 18px;
    border-left: none; border-right: none;
  }

  .panels-area { grid-template-columns: 1fr !important; }

  /* Period tabs mobile */
  .period-tabs { width: 100%; justify-content: space-between; overflow-x: auto; }
  .period-tab { padding: 8px 10px; font-size: 11px; }

  /* Sandbox / mode édition */
  .sandbox-bar { font-size: 11.5px; padding: 8px 12px; bottom: calc(82px + env(safe-area-inset-bottom)); }

  /* Profile menu : reste visible mais ne déborde pas */
  .profile-menu { right: 0; max-height: 70vh; overflow-y: auto; min-width: 240px; }

  /* Boutons : zone tactile minimum 44px (HIG Apple) sur mobile */
  .btn { min-height: 40px; padding: 10px 14px; font-size: 13px; }
  .btn-primary { padding: 11px 18px; font-size: 13.5px; min-height: 44px; }
  .icon-btn { width: 36px; height: 36px; }
  .panel-collapse-btn { width: 32px; height: 32px; }
  .panel-head .btn-primary { padding: 8px 14px; min-height: 38px; font-size: 12.5px; }

  /* Period tab + bouton Détail dans header */
  .panel-head { gap: 8px; flex-wrap: wrap; }
}

/* Très petits écrans */
@media (max-width: 480px) {
  .total-figure { font-size: 32px; letter-spacing: -1.5px; }
  .page-hero h1 { font-size: 22px; }
  .panel { padding: 18px 16px; }
  .modal { padding: 16px 14px; }
  .modal-head h2 { font-size: 18px; }
  .bottom-nav-item { font-size: 9.5px; padding: 7px 2px 5px; }
  .bottom-nav-item .ico { width: 18px; height: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
 *  COUCHE 3.b — COMPOSANTS V2 FINTECH PREMIUM
 *  Skeleton loaders, glass cards, hero gradient, sidebar desktop, KPI fintech,
 *  numeric tabular, motion utilities
 * ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Numeric tabular (chiffres alignés sur grille mathématique) ─── */
.num, .nums, [data-num], .acc-bal, .total-figure, .delta-amt, .delta-pill, .fin-line .amt, .kpi-card .val, .ad-stat .val {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum', 'zero', 'ss01';
  letter-spacing: -0.01em;
}

/* ─── Skeleton loaders (gradient 45° pulse 1.5s — spec utilisateur) ─── */
.skeleton {
  position: relative;
  background: var(--color-charcoal-3);
  border-radius: var(--radius-md);
  overflow: hidden;
  isolation: isolate;
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    45deg,
    transparent 0%,
    rgba(255, 255, 255, 0.04) 35%,
    rgba(46, 184, 138, 0.10) 50%,
    rgba(255, 255, 255, 0.04) 65%,
    transparent 100%
  );
  background-size: 200% 200%;
  animation: skeletonPulse 1.5s var(--ease-cinema) infinite;
}
@keyframes skeletonPulse {
  0%   { background-position: 100% 100%; }
  100% { background-position: -100% -100%; }
}
.skeleton-text { height: 12px; margin: 6px 0; border-radius: 4px; }
.skeleton-text.lg { height: 22px; }
.skeleton-text.xl { height: 36px; }
.skeleton-circle { border-radius: 50%; }
.skeleton-card { height: 120px; border-radius: var(--radius-lg); }

/* ─── Glassmorphism cards (translucidité 65%, blur 20px — spec utilisateur) ─── */
.glass-card {
  background: rgba(26, 26, 29, 0.65);
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.glass-card-strong {
  background: rgba(35, 35, 38, 0.78);
  backdrop-filter: blur(28px) saturate(1.8);
  -webkit-backdrop-filter: blur(28px) saturate(1.8);
}

/* ─── Hero animated gradient (landing page) ─── */
.hero-gradient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
}
.hero-gradient::before,
.hero-gradient::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
  will-change: transform;
}
.hero-gradient::before {
  width: 60%; aspect-ratio: 1;
  top: -10%; left: -10%;
  background: radial-gradient(circle, rgba(46, 184, 138, 0.45) 0%, transparent 70%);
  animation: heroBlobA 14s ease-in-out infinite;
}
.hero-gradient::after {
  width: 55%; aspect-ratio: 1;
  bottom: -15%; right: -12%;
  background: radial-gradient(circle, rgba(212, 165, 116, 0.32) 0%, transparent 70%);
  animation: heroBlobB 18s ease-in-out infinite;
}
@keyframes heroBlobA {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(8%, 4%) scale(1.08); }
  66%      { transform: translate(-4%, 8%) scale(0.95); }
}
@keyframes heroBlobB {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-6%, -8%) scale(1.12); }
}

/* Mesh-gradient overlay aurora (style Linear/Vercel) */
.aurora-bg {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.aurora-bg::before {
  content: '';
  position: absolute; inset: -50%;
  z-index: -1;
  background:
    conic-gradient(from 180deg at 50% 50%,
      rgba(46, 184, 138, 0.18) 0deg,
      rgba(92, 211, 170, 0.12) 90deg,
      rgba(212, 165, 116, 0.10) 180deg,
      rgba(15, 22, 38, 0)       270deg,
      rgba(46, 184, 138, 0.18) 360deg);
  filter: blur(60px);
  animation: auroraSpin 30s linear infinite;
}
@keyframes auroraSpin { to { transform: rotate(360deg); } }

/* ─── Sidebar desktop collapsible (>= 1024px) ─── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w, 240px) 1fr;
  min-height: 100vh;
  transition: grid-template-columns var(--dur-base) var(--ease);
}
.app-shell[data-sidebar="collapsed"] { --sidebar-w: 64px; }
@media (max-width: 1023px) { .app-shell { grid-template-columns: 1fr; } }

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--color-charcoal-2);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
  gap: var(--space-2);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: var(--z-sticky);
}
@media (max-width: 1023px) { .sidebar { display: none; } }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--space-3);
  text-decoration: none;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.3px;
}
.sidebar-brand .accent-text { color: var(--gold-strong); font-weight: 700; }
[data-sidebar="collapsed"] .sidebar-brand-text { display: none; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  color: var(--text-3);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-md);
  transition:
    color var(--dur-base) var(--ease),
    background var(--dur-base) var(--ease),
    transform var(--dur-fast) var(--ease-spring);
  white-space: nowrap;
  position: relative;
}
.sidebar-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.sidebar-link:active { transform: scale(0.98); }
.sidebar-link .ico { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-link.active {
  color: var(--accent-strong);
  background: linear-gradient(135deg, rgba(46, 184, 138, 0.16), rgba(46, 184, 138, 0.04));
  box-shadow: inset 0 0 0 1px rgba(46, 184, 138, 0.20);
}
.sidebar-link.active::before {
  content: '';
  position: absolute; left: -8px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 60%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--accent);
}
[data-sidebar="collapsed"] .sidebar-link {
  justify-content: center;
  padding: var(--space-3);
}
[data-sidebar="collapsed"] .sidebar-link-text,
[data-sidebar="collapsed"] .sidebar-section-title { display: none; }

.sidebar-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-4);
  font-weight: 600;
  padding: var(--space-3) var(--space-3) var(--space-2);
  margin-top: var(--space-2);
}

.sidebar-toggle {
  margin-top: auto;
  padding: var(--space-3);
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-size: 12px;
  font-weight: 500;
  transition: color var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}
.sidebar-toggle:hover { color: var(--text); border-color: var(--border-strong); }
.sidebar-toggle .ico { width: 16px; height: 16px; transition: transform var(--dur-base) var(--ease); }
[data-sidebar="collapsed"] .sidebar-toggle .ico { transform: rotate(180deg); }
[data-sidebar="collapsed"] .sidebar-toggle-label { display: none; }

/* App shell : main column avec topbar masquée si sidebar présente */
.sidebar + .app-main { min-width: 0; }
.app-main { display: flex; flex-direction: column; min-width: 0; }

/* Quand la sidebar est active, on cache la nav-links de la topbar pour éviter la duplication */
.app-shell .topbar .nav-links { display: none; }
.app-shell .topbar { grid-template-columns: 1fr auto; padding-left: var(--space-6); padding-right: var(--space-6); }

/* ─── Layout app-shell sur le body (≥1024px) ─── */
@media (min-width: 1024px) {
  body[data-arkan-shell="app"] {
    padding-left: 240px;
    transition: padding-left var(--dur-base) var(--ease);
  }
  html[data-sidebar="collapsed"] body[data-arkan-shell="app"] {
    padding-left: 64px;
  }
  body[data-arkan-shell="app"] .sidebar {
    position: fixed;
    left: 0; top: 0;
    width: 240px;
    height: 100vh;
    transition: width var(--dur-base) var(--ease);
  }
  html[data-sidebar="collapsed"] body[data-arkan-shell="app"] .sidebar {
    width: 64px;
  }
  /* Topbar n'inclut plus la nav links (la sidebar a tout) */
  body[data-arkan-shell="app"] .topbar .nav-links { display: none; }
  body[data-arkan-shell="app"] .topbar {
    grid-template-columns: 1fr auto;
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
  /* Brand caché dans la topbar quand la sidebar a déjà le brand */
  body[data-arkan-shell="app"] .topbar .brand { visibility: hidden; }
}
@media (max-width: 1023px) {
  body[data-arkan-shell="app"] .sidebar { display: none; }
}

/* ─── KPI fintech (Linear/Finary) ─── */
.kpi-stat {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--color-charcoal-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  transition:
    border-color var(--dur-base) var(--ease),
    transform var(--dur-base) var(--ease);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.kpi-stat:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.kpi-stat::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--accent, currentColor) 50%, transparent 100%);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease);
}
.kpi-stat:hover::before { opacity: 0.5; }
.kpi-stat .kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.3px;
  color: var(--text-3);
  font-weight: 600;
  display: flex; align-items: center; gap: var(--space-2);
}
.kpi-stat .kpi-label .ico { width: 13px; height: 13px; opacity: 0.85; }
.kpi-stat .kpi-value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  letter-spacing: -0.6px;
  line-height: 1.1;
  color: var(--text);
}
.kpi-stat .kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  margin-top: auto;
}
.kpi-stat .kpi-delta.pos { color: var(--green); }
.kpi-stat .kpi-delta.neg { color: var(--red); }

/* ─── Motion utilities (vanilla, sans framer-motion requis) ─── */
.motion-fade-in {
  animation: motionFadeIn var(--dur-cinema) var(--ease) both;
}
.motion-rise {
  animation: motionRise var(--dur-cinema) var(--ease) both;
}
.motion-stagger > * {
  opacity: 0;
  animation: motionRise var(--dur-cinema) var(--ease) forwards;
}
.motion-stagger > *:nth-child(1) { animation-delay: 0ms; }
.motion-stagger > *:nth-child(2) { animation-delay: 60ms; }
.motion-stagger > *:nth-child(3) { animation-delay: 120ms; }
.motion-stagger > *:nth-child(4) { animation-delay: 180ms; }
.motion-stagger > *:nth-child(5) { animation-delay: 240ms; }
.motion-stagger > *:nth-child(6) { animation-delay: 300ms; }
.motion-stagger > *:nth-child(7) { animation-delay: 360ms; }
.motion-stagger > *:nth-child(8) { animation-delay: 420ms; }

@keyframes motionFadeIn {
  0%   { opacity: 0; }
  100% { opacity: 1; }
}
@keyframes motionRise {
  0%   { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ─── Container layout (max-width consistent) ─── */
.container-narrow { max-width: 720px;  margin: 0 auto; padding: 0 var(--space-5); }
.container-base   { max-width: 1080px; margin: 0 auto; padding: 0 var(--space-5); }
.container-wide   { max-width: 1280px; margin: 0 auto; padding: 0 var(--space-5); }
.container-full   { max-width: 1440px; margin: 0 auto; padding: 0 var(--space-5); }

/* ─── Status pill (success/warning/danger) ─── */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px var(--space-3);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.status-pill.success { background: var(--green-bg); color: var(--green); }
.status-pill.warn    { background: rgba(255, 159, 10, 0.12); color: var(--orange); }
.status-pill.danger  { background: var(--red-bg); color: var(--red); }
.status-pill.info    { background: rgba(10, 132, 255, 0.12); color: var(--blue); }
.status-pill .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: pulseDot 2s ease-in-out infinite;
}
@keyframes pulseDot { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
