/* ═══════════════════════════════════════════════════════════════════════════
   BetaPRO+ — Design tokens (côté interne uniquement)
   Deux thèmes, mêmes composants : seuls ces tokens varient.
     • Swiss Premium   → html[data-theme="light"]  (défaut)
     • Dark Enterprise → html[data-theme="dark"]
   Règle : aucun composant ne code une couleur en dur — toujours var(--bp-…).

   Migration progressive : une page non encore migrée porte
   data-bp-page="legacy". En thème sombre, son CONTENU reste en tokens clairs
   (ses couleurs historiques codées en dur resteraient illisibles sur fond
   sombre) ; seul le cadre (.bp-shell : sidebar + header) passe en sombre.
   Une page migrée déclare {% block bp_page %}ready{% endblock %}.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens indépendants du thème ─────────────────────────────────────────── */
:root {
  /* Typographie */
  --bp-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bp-font-mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --bp-fs-xs: .6875rem;   /* 11px — méta, en-têtes de tableau */
  --bp-fs-sm: .75rem;     /* 12px — texte secondaire */
  --bp-fs-md: .8125rem;   /* 13px — texte courant (densité fiduciaire) */
  --bp-fs-lg: .9375rem;   /* 15px — titres de bloc */
  --bp-fs-xl: 1.25rem;    /* 20px — valeurs KPI */
  --bp-fs-2xl: 1.5rem;    /* 24px — titre de page */
  --bp-fw-regular: 400;
  --bp-fw-medium: 500;
  --bp-fw-semibold: 600;
  --bp-fw-bold: 700;
  --bp-lh: 1.45;

  /* Espacements (base 4px) */
  --bp-sp-1: .25rem;
  --bp-sp-2: .5rem;
  --bp-sp-3: .75rem;
  --bp-sp-4: 1rem;
  --bp-sp-5: 1.25rem;
  --bp-sp-6: 1.5rem;
  --bp-sp-8: 2rem;

  /* Rayons */
  --bp-radius-sm: 6px;
  --bp-radius: 8px;
  --bp-radius-lg: 12px;
  --bp-radius-pill: 999px;

  /* Contrôles & gabarit */
  --bp-control-h: 36px;
  --bp-control-h-sm: 30px;
  --bp-header-h: 56px;
  --bp-sidebar-w: 248px;
  --bp-sidebar-w-compact: 64px;
  --bp-transition: .15s ease;
}

/* Anciens tokens navy/or de base.html : le bleu nuit historique suit désormais le
   token primaire (utile aux styles inline/JS existants : var(--bp-navy)). */
html[data-bp-ui="staff"] { --bp-navy: var(--bp-primary); --bp-navy2: var(--bp-primary-hover); }

/* ── Swiss Premium (light) ────────────────────────────────────────────────── */
:root,
html[data-theme="dark"][data-bp-page="legacy"] body {
  color-scheme: light;

  --bp-background: #F5F7FA;
  --bp-surface: #FFFFFF;
  --bp-surface-secondary: #F8FAFC;
  --bp-surface-hover: #F1F4F8;

  --bp-text-primary: #0F1B2D;
  --bp-text-secondary: #5B6779;
  --bp-text-muted: #8A94A6;
  --bp-text-on-primary: #FFFFFF;

  --bp-border: #E4E8EE;
  --bp-border-strong: #D3D9E2;

  --bp-primary: #0F2E5C;
  --bp-primary-rgb: 15, 46, 92;
  --bp-primary-hover: #173F7A;
  --bp-primary-soft: #E9EEF6;
  --bp-link: #1B56B8;
  --bp-focus-ring: rgba(27, 86, 184, .28);

  --bp-success: #157F3D;
  --bp-success-rgb: 21, 127, 61;
  --bp-success-soft: #E7F5EC;
  --bp-warning: #B45309;
  --bp-warning-rgb: 180, 83, 9;
  --bp-warning-soft: #FDF3E1;
  --bp-danger: #B42318;
  --bp-danger-rgb: 180, 35, 24;
  --bp-danger-soft: #FCEBE9;
  --bp-info: #1B56B8;
  --bp-info-rgb: 27, 86, 184;
  --bp-info-soft: #E8F0FC;
  --bp-neutral-soft: #EEF1F5;

  --bp-shadow: 0 1px 2px rgba(15, 27, 45, .04), 0 1px 3px rgba(15, 27, 45, .05);
  --bp-shadow-raised: 0 4px 12px rgba(15, 27, 45, .08), 0 1px 3px rgba(15, 27, 45, .05);
  --bp-shadow-overlay: 0 12px 32px rgba(15, 27, 45, .14), 0 2px 6px rgba(15, 27, 45, .06);
  --bp-backdrop: rgba(15, 27, 45, .45);

  /* Graphiques */
  --bp-chart-1: #1B56B8;
  --bp-chart-2: #157F3D;
  --bp-chart-3: #B45309;
  --bp-chart-grid: #E4E8EE;
}

/* ── Dark Enterprise (dark) ───────────────────────────────────────────────── */
html[data-theme="dark"],
html[data-theme="dark"] .bp-shell {
  color-scheme: dark;

  --bp-background: #0A101A;
  --bp-surface: #111926;
  --bp-surface-secondary: #161F2F;
  --bp-surface-hover: #1B263A;

  --bp-text-primary: #E6EBF2;
  --bp-text-secondary: #9CA8BA;
  --bp-text-muted: #6F7C90;
  --bp-text-on-primary: #FFFFFF;

  --bp-border: #202B3D;
  --bp-border-strong: #2D3A50;

  --bp-primary: #3A76E0;
  --bp-primary-rgb: 58, 118, 224;
  --bp-primary-hover: #5189EA;
  --bp-primary-soft: rgba(58, 118, 224, .16);
  --bp-link: #7FAAF2;
  --bp-focus-ring: rgba(81, 137, 234, .42);

  --bp-success: #3CC282;
  --bp-success-rgb: 60, 194, 130;
  --bp-success-soft: rgba(60, 194, 130, .14);
  --bp-warning: #EDA63A;
  --bp-warning-rgb: 237, 166, 58;
  --bp-warning-soft: rgba(237, 166, 58, .14);
  --bp-danger: #F0646B;
  --bp-danger-rgb: 240, 100, 107;
  --bp-danger-soft: rgba(240, 100, 107, .14);
  --bp-info: #6FA0F0;
  --bp-info-rgb: 111, 160, 240;
  --bp-info-soft: rgba(111, 160, 240, .14);
  --bp-neutral-soft: rgba(156, 168, 186, .12);

  --bp-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --bp-shadow-raised: 0 6px 16px rgba(0, 0, 0, .4);
  --bp-shadow-overlay: 0 16px 40px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .04);
  --bp-backdrop: rgba(3, 7, 13, .7);

  --bp-chart-1: #6FA0F0;
  --bp-chart-2: #3CC282;
  --bp-chart-3: #EDA63A;
  --bp-chart-grid: #202B3D;
}
