.spin { animation: spin-rotate 1s linear infinite; }
@keyframes spin-rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
button, a, [role="button"] { -webkit-tap-highlight-color: transparent; }
button:focus, a:focus, [role="button"]:focus { outline: none; }

/* ==================================================================
   DESIGN TOKENS — refonte identité visuelle.
   Palette conservée (navy/gold/mint/crème, choisie dès le départ pour éviter le générique
   dégradé violet→bleu "IA" que tout le monde utilise) ; ce qui change ici, c'est la
   typographie (Inter n'était même pas un vrai choix : la police système par défaut) et les
   courbes d'animation ("ease" plat -> une seule courbe de marque, cohérente partout).
   --c-navy / --c-navy2 : couleurs de texte "bleu marine / quasi-noir" utilisées un peu
   partout (titres, libellés...). En mode clair ce sont les teintes foncées d'origine ; en
   mode sombre elles deviennent des bleus clairs, sans quoi ce texte devient illisible sur
   le fond sombre (#14171f).
   ================================================================== */
:root {
  --c-navy: #152238;
  --c-navy2: #1F3864;
  --c-text: #1a1a1a;
  --c-gold: #B8860B;
  --c-mint: #22C08C;
  --c-cream: #FBFAF7;
  --c-green: #0F7B3E;
  --c-red: #B0281E;
  --c-grey: #928a76;

  /* Police d'affichage (titres, montants, tickers) : Space Grotesk — géométrique, distinctive,
     chiffres bien dessinés (essentiel pour une app financière). Police de lecture (libellés,
     paragraphes, formulaires) : Public Sans — conçue par le U.S. Design System pour une
     lisibilité maximale en petite taille, chiffres tabulaires. Aucune des deux n'est
     Inter/Roboto/Arial/system-ui. */
  --font-display: "Space Grotesk", "Public Sans", system-ui, sans-serif;
  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Courbe de marque unique — un "expo-out" plus vif et plus premium qu'un "ease" plat/mécanique
     (banni : signale un travail non fini). Utilisée pour toutes les micro-interactions
     (boutons, cartes, menu, modales). */
  --ease-brand: cubic-bezier(.16, 1, .3, 1);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 2px rgba(21,34,56,.05), 0 8px 20px -12px rgba(21,34,56,.12);
  --shadow-elevated: 0 4px 10px rgba(21,34,56,.08), 0 16px 32px -16px rgba(21,34,56,.18);

  /* --c-surface-navy / --c-surface-navy2 : bleu marine de MARQUE utilisé comme FOND (header,
     hero, boutons d'action principale, barre du rapport PDF) avec du texte blanc dessus.
     Contrairement à --c-navy / --c-navy2 (couleurs de TEXTE, qui s'éclaircissent en mode sombre
     pour rester lisibles sur fond sombre), ces deux-là restent volontairement fixes et sombres
     dans les deux thèmes : ce sont des surfaces "carte flottante", pas du texte sur fond de page,
     donc le contraste blanc-sur-navy reste bon en clair comme en sombre. Avant ce correctif,
     plusieurs boutons/le header utilisaient --c-navy/--c-navy2 aussi bien en fond qu'en texte
     ailleurs : en mode sombre ces variables devenaient CLAIRES, ce qui transformait header/hero/
     boutons principaux en rectangles clairs avec texte blanc illisible — cause principale du mode
     sombre "pas agréable à regarder". */
  --c-surface-navy: #152238;
  --c-surface-navy2: #1F3864;

  /* --c-soft-* : fonds clairs des badges/puces/boutons secondaires (succès, danger, avertissement,
     neutre), associés au texte --c-navy2/--c-red/--c-green/--c-gold correspondant. Codés en dur
     auparavant (#eef1f6, #fdecea, #eef4ee, #fdf2e0, #f4f0e6) : en mode sombre, ce fond restait clair
     alors que le texte associé s'éclaircissait aussi -> texte clair sur fond clair, à peine lisible.
     Ces variables permettent d'assombrir uniquement le FOND en mode sombre, sans toucher au texte. */
  --c-soft-navy: #eef1f6;
  --c-soft-red: #fdecea;
  --c-soft-red-border: #f3c2bd;
  --c-soft-green: #eef4ee;
  --c-soft-gold: #fdf2e0;
  --c-soft-cream: #f4f0e6;
}
body.dark {
  --c-navy: #cfd8ea;
  --c-navy2: #9db3d9;
  --c-text: #e8e6e0;
  --c-gold: #d9ab2e;
  --c-green: #34d399;
  --c-red: #f16565;
  --c-grey: #a8a296;
  --shadow-card: 0 1px 2px rgba(0,0,0,.25), 0 8px 20px -12px rgba(0,0,0,.35);
  --shadow-elevated: 0 4px 10px rgba(0,0,0,.3), 0 16px 32px -16px rgba(0,0,0,.5);

  /* Fonds "surface" un peu plus clairs que la carte (#1d2130) pour rester des accents visibles,
     mais toujours sombres — jamais aussi clairs qu'en mode jour. Associés au texte --c-navy2/
     --c-red/--c-green/--c-gold déjà éclairci ci-dessus : le contraste reste bon dans les deux sens. */
  --c-soft-navy: #262b3d;
  --c-soft-red: rgba(241,101,101,.16);
  --c-soft-red-border: rgba(241,101,101,.4);
  --c-soft-green: rgba(52,211,153,.16);
  --c-soft-gold: rgba(217,171,46,.16);
  --c-soft-cream: rgba(217,171,46,.12);
}

/* Sélection de texte de marque — plus premium que le bleu par défaut du navigateur, lisible
   sur fond clair et sombre. */
::selection { background: var(--c-gold); color: white; }

/* États focus clavier : visibles ET sur-mesure (jamais l'anneau bleu générique du navigateur,
   jamais supprimés — les deux sacrifices sont interdits). Le :focus simple (souris/tactile)
   reste sans anneau ; seul :focus-visible (clavier) l'affiche. */
button:focus-visible, a:focus-visible, [role="button"]:focus-visible,
input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2.5px solid var(--c-gold);
  outline-offset: 2px;
  border-radius: 4px;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--c-cream);
  color: #1a1a1a;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

input, select, button { font-family: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -0.01em; }

.btn {
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  /* display:inline-flex — sans ça, l'icône SVG (display:block) casse la ligne à l'intérieur
     du bouton/label et retombe au-dessus du texte au lieu de rester alignée à côté : visible
     notamment sur "Restaurer depuis un fichier JSON" (un <label>, pas un <button>) en mobile. */
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  line-height: 1.3;
  transition: transform .1s var(--ease-brand), opacity .18s var(--ease-brand), box-shadow .18s var(--ease-brand);
}
.btn:hover { opacity: .88; }
.btn:active { transform: scale(0.97); }

.card {
  background: white;
  border: 1px solid #e3ddd0;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow .2s var(--ease-brand), border-color .2s var(--ease-brand);
}
body.dark .card { box-shadow: var(--shadow-card); }
/* Retour visuel au survol pour les cartes cliquables (listes de positions, modules de
   formation, etc.) — n'affecte que les <button class="card">, pas les cartes statiques. Utile
   surtout à la souris (ordinateur) : sur tactile, :hover ne se déclenche jamais donc rien ne
   change sur mobile. */
button.card:hover { box-shadow: 0 4px 14px rgba(21,34,56,.12); border-color: #d8d2c3; }
body.dark button.card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.35); border-color: #3a4058; }

table { border-collapse: collapse; width: 100%; }
th, td { padding: 10px 12px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
tbody tr:not(:last-child) { border-bottom: 1px solid #eee5d4; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(21,34,56,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
  animation: modal-overlay-fade-in .18s var(--ease-brand);
}
@keyframes modal-overlay-fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-elevated);
  animation: modal-pop-in .22s var(--ease-brand);
}
@keyframes modal-pop-in {
  from { transform: translateY(10px) scale(.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.sim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 18px 16px;
}
@media (max-width: 480px) {
  .sim-grid { grid-template-columns: 1fr; gap: 14px; }
}

.field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #7a7263;
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}
.field input, .field select {
  width: 100%;
  border: 1px solid #d8d2c3;
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  font-size: 14px;
  background: #fdfcf9;
  transition: border-color .15s var(--ease-brand), box-shadow .15s var(--ease-brand);
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--c-gold);
  box-shadow: 0 0 0 3px rgba(184,134,11,.18);
}
.select-trigger {
  width: 100%; border: 1px solid #d8d2c3; border-radius: var(--radius-sm); padding: 9px 10px;
  font-size: 13px; background: #fdfcf9; color: var(--c-navy);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  cursor: pointer; text-align: left; font-family: inherit;
  transition: transform .1s var(--ease-brand), border-color .15s var(--ease-brand);
}
.select-trigger:active { transform: scale(0.99); }
.select-trigger-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.dark .select-trigger { background: #262b3d; border-color: #3a4058; color: #e8e6e0; }
.select-picker-option {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 1px solid #e5ded0; border-radius: var(--radius-md); padding: 10px 12px; background: #fdfcf9;
  cursor: pointer; font-family: inherit;
  transition: border-color .15s var(--ease-brand), background .15s var(--ease-brand);
}
.select-picker-option:hover { border-color: #d8d2c3; }
.select-picker-option.active { border-color: var(--c-gold); background: rgba(184,134,11,.07); }
body.dark .select-picker-option { background: #232838; border-color: #2c3145; }
body.dark .select-picker-option.active { border-color: var(--c-gold); background: rgba(184,134,11,.14); }

/* ==================================================================
   V4 — Listes mobiles en cartes (zéro défilement horizontal) + identité
   visuelle : avatars de ticker, badges de statut, pastilles segmentées.
   ================================================================== */

/* Avatar rond avec les 2-3 premières lettres du ticker */
.ticker-avatar {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; letter-spacing: -.02em;
  color: white; font-family: var(--font-display);
}

/* Ligne de carte compacte : utilisée pour positions / transactions / dividendes / frais */
.row-card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 13px 14px;
}
.row-card + .row-card { border-top: 1px solid #eee5d4; }
body.dark .row-card + .row-card { border-top-color: #2c3145; }

.row-card-top { display: flex; align-items: center; gap: 10px; }
.row-card-title { font-weight: 700; font-size: 14px; line-height: 1.25; }
.row-card-sub { font-size: 11px; color: #928a76; margin-top: 1px; }
body.dark .row-card-sub { color: #9a97a8; }

.row-card-metrics {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 10px;
}
@media (min-width: 460px) {
  .row-card-metrics { grid-template-columns: repeat(3, 1fr); }
}
.metric-cell { min-width: 0; }
.metric-cell .metric-label {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .04em;
  color: #a39c88; font-weight: 700; margin-bottom: 1px;
}
body.dark .metric-cell .metric-label { color: #6b7086; }
.metric-cell .metric-value {
  font-size: 13px; font-weight: 700; font-family: var(--font-display); font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 20px;
  white-space: nowrap;
}
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px; flex: none;
}
.icon-btn svg { pointer-events: none; }

/* ==================================================================
   V6 — Barre d'onglets FIXE EN BAS (façon app mobile type OKX/exchange) :
   icône au-dessus du libellé, répartition égale, onglet actif mis en
   avant par la couleur, le reste discret. Toujours visible, jamais de
   défilement horizontal sur cette barre.
   ================================================================== */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: stretch; justify-content: flex-start;
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  background: rgba(255,253,248,.96); backdrop-filter: blur(10px);
  border-top: 1px solid #eee5d4;
  padding: 6px 2px calc(6px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -2px 10px rgba(20,20,20,.05);
}
.bottom-nav::-webkit-scrollbar { display: none; }
body.dark .bottom-nav { background: rgba(20,23,31,.96); border-top-color: #2c3145; box-shadow: 0 -2px 10px rgba(0,0,0,.3); }
.bottom-nav-item {
  border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; flex: 1 0 auto; min-width: 68px; padding: 5px 8px 4px;
  scroll-snap-align: start;
  color: #a39c88; transition: color .15s var(--ease-brand), transform .1s var(--ease-brand);
}
.bottom-nav-item:active { transform: scale(0.93); }
.bottom-nav-item.active { color: #1F3864; }
body.dark .bottom-nav-item { color: #6b7086; }
body.dark .bottom-nav-item.active { color: #cdb26b; }
.bottom-nav-icon { display: flex; align-items: center; justify-content: center; height: 20px; }
.bottom-nav-item.active .bottom-nav-icon { transform: translateY(-1px); }
.bottom-nav-label {
  font-size: 9.5px; font-weight: 700; text-align: center; white-space: nowrap;
  letter-spacing: -.01em;
}
@media (max-width: 360px) { .bottom-nav-label { font-size: 8.5px; } .bottom-nav-icon svg { width: 18px; height: 18px; } }

/* Carte "solde" façon exchange mobile */
.hero-balance { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: -0.02em; }

/* Boutons d'action rapide ronds (façon Envoyer/Recevoir des apps d'échange) */
.quick-action {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer; flex: 1; min-width: 0;
}
.quick-action .quick-action-circle {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.quick-action .quick-action-label { font-size: 10.5px; font-weight: 600; text-align: center; }

/* ==================================================================
   V7 — Vrais tableaux complets façon brvm.org (positions / transactions /
   dividendes / frais / historique) : TOUTES les colonnes sont affichées
   (aucune troncature, aucun repli au tap) ; le tableau défile
   horizontalement pour voir les colonnes supplémentaires ET
   verticalement (en-tête figé/sticky) quand il y a beaucoup de lignes.
   ================================================================== */
.fin-table-hint {
  font-size: 10.5px; color: #a39c88; margin: 0 0 6px; padding: 0 2px;
  display: flex; align-items: center; gap: 5px;
}
body.dark .fin-table-hint { color: #6b7086; }
.fin-table-wrap {
  width: 100%; max-height: 460px; overflow: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid #eee5d4; border-radius: 10px;
}
body.dark .fin-table-wrap { border-color: #2c3145; }
.fin-table { width: 100%; min-width: max-content; border-collapse: collapse; font-size: 11.5px; }
.fin-table th, .fin-table td {
  padding: 9px 11px; text-align: right; white-space: nowrap;
}
.fin-table th:first-child, .fin-table td:first-child { text-align: left; }
.fin-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: #f7f4ec; color: #7a7263; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .02em; white-space: nowrap;
  line-height: 1.15; padding: 9px 11px; box-shadow: 0 1px 0 #eee5d4;
}
body.dark .fin-table thead th { background: #202433; color: #9a97a8; box-shadow: 0 1px 0 #2c3145; }
.fin-table tbody tr { border-top: 1px solid #eee5d4; }
.fin-table tbody tr:nth-child(even) { background: #fbfaf7; }
body.dark .fin-table tbody tr { border-top-color: #2c3145; }
body.dark .fin-table tbody tr:nth-child(even) { background: #181c28; }
.fin-table td, .fin-table th { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.fin-table td:first-child, .fin-table th:first-child { font-family: inherit; }
@media (max-width: 400px) {
  .fin-table { font-size: 10.5px; }
  .fin-table th, .fin-table td { padding: 7px 8px; }
}

/* Tableaux du module Formation BRVM (ratios, repères...) : même principe que .fin-table-wrap —
   défilement horizontal au lieu d'écraser le texte des colonnes sur mobile étroit. */
.formation-table-wrap {
  width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
  border: 1px solid #eee5d4; border-radius: 8px;
}
body.dark .formation-table-wrap { border-color: #2c3145; }
.formation-table th:first-child, .formation-table td:first-child { font-weight: 700; color: var(--c-navy, #1F3864); }
body.dark .formation-table th:first-child, body.dark .formation-table td:first-child { color: #cdb26b; }

/* ---- Mode sombre ---- */
body.dark { background: #14171f; color: #e8e6e0; }
.plan-banner { background: white; }
.plan-banner.plan-banner-active { background: #fffdf7; }
body.dark .plan-banner { background: #232838; }
body.dark .plan-banner.plan-banner-active { background: #2a2f42; }
body.dark .card { background: #1d2130; border-color: #2c3145; }
body.dark table { color: #e8e6e0; }
body.dark thead tr { background: #262b3d !important; color: #c9c6ba !important; }
body.dark tbody tr:not(:last-child) { border-bottom-color: #2c3145; }
body.dark .modal { background: #1d2130; color: #e8e6e0; }
body.dark .modal-overlay { background: rgba(4,6,12,.7); }
body.dark .field input, body.dark .field select { background: #262b3d; border-color: #3a4058; color: #e8e6e0; }
body.dark .field label { color: #9a97a8; }
body.dark ::placeholder { color: #6b7086; }

/* ==================================================================
   V8 — Menu latéral (☰) redessiné : panneau avec en-tête dégradé,
   sections groupées, icônes sur pastille colorée, indicateur actif,
   animation de glissement à l'ouverture, badge de plan en pied de menu.
   ================================================================== */
.side-menu-panel {
  box-shadow: var(--shadow-elevated);
  background: #FBFAF7;
  position: fixed; top: 0; left: 0; bottom: 0; width: min(80vw, 300px);
  padding: 14px 12px; overflow-y: auto; display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform .24s var(--ease-brand);
}
body.dark .side-menu-panel { background: #1d2130; }
.side-menu-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(21,34,56,0); pointer-events: none;
  transition: background .2s var(--ease-brand);
}
.side-menu-overlay.open { background: rgba(21,34,56,.55); pointer-events: auto; }
.side-menu-overlay.open .side-menu-panel { transform: translateX(0); box-shadow: 2px 0 18px rgba(0,0,0,.25); }
.side-menu-header {
  background: linear-gradient(135deg, #1F3864 0%, #152238 100%);
  border-radius: 12px;
  padding: 16px 14px;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.side-menu-header-icon {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.15);
}
.side-menu-section-label {
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: #a39c88; margin: 14px 8px 6px; display: flex; align-items: center; gap: 6px;
}
body.dark .side-menu-section-label { color: #6b7086; }
.side-menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: none; border: none; border-radius: 11px; cursor: pointer;
  padding: 10px 10px; position: relative;
  transition: background .12s var(--ease-brand), transform .08s var(--ease-brand);
}
.side-menu-item:active { transform: scale(0.98); }
.side-menu-item:hover { background: #f4f0e6; }
body.dark .side-menu-item:hover { background: #232838; }
.side-menu-item.active { background: #f4f0e6; }
body.dark .side-menu-item.active { background: #262b3d; }
.side-menu-item.active::before {
  content: ""; position: absolute; left: -2px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 3px; background: #B8860B;
}
.side-menu-icon-badge {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.side-menu-item-label { font-size: 13.5px; }
.side-menu-plan-footer {
  margin-top: 16px; padding: 12px 12px; border-radius: 11px;
  background: #f7f4ec; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
body.dark .side-menu-plan-footer { background: #1a1e2b; }

/* ==================================================================
   V9 — Sélecteur de devise : bouton compact dans le header + fenêtre
   modale listant chaque devise avec symbole, libellé et repère de
   sélection (remplace le <select> natif, peu lisible et incohérent
   entre navigateurs/plateformes).
   ================================================================== */
.currency-trigger {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.14); color: white;
  border: 1px solid rgba(255,255,255,.25); border-radius: 9px;
  padding: 0 10px; height: 32px; font-size: 12.5px; font-weight: 700;
  cursor: pointer; font-family: inherit;
}
.currency-trigger:active { transform: scale(0.97); }
.currency-option {
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: 1.5px solid #e3ddd0; border-radius: 12px; background: #fdfcf9;
  padding: 11px 12px; cursor: pointer; text-align: left; font-family: inherit;
  transition: border-color .12s var(--ease-brand), background .12s var(--ease-brand);
}
.currency-option:hover { border-color: #d8d2c3; }
.currency-option.active { border-color: #B8860B; background: rgba(184,134,11,.07); }
body.dark .currency-option { background: #232838; border-color: #2c3145; }
body.dark .currency-option.active { border-color: #B8860B; background: rgba(184,134,11,.14); }
.currency-option-symbol {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: #eef1f6; color: #1F3864; font-weight: 800; font-size: 15px;
}
body.dark .currency-option-symbol { background: #2c3145; color: #cfd8ea; }
.currency-option.active .currency-option-symbol { background: #B8860B; color: white; }

/* ---- Rapport PDF (impression) ----
   Le rapport est généré avec le "Imprimer / Enregistrer en PDF" natif du navigateur plutôt
   qu'une librairie externe : ça marche 100% hors-ligne, sans dépendance réseau, contrairement
   à une lib PDF chargée depuis un CDN. À l'écran, .print-report s'affiche en plein écran par
   dessus l'app (voir app.js) ; à l'impression, on cache tout SAUF .print-report. */
.print-report-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.print-report-table th, .print-report-table td { padding: 6px 8px; text-align: right; border-bottom: 1px solid #e5ded0; }
.print-report-table th:first-child, .print-report-table td:first-child { text-align: left; }
.print-report-table thead th { background: #f7f4ec; font-size: 10px; text-transform: uppercase; letter-spacing: .02em; color: #7a7263; }
/* Aperçu à l'écran du rapport (individuel/consolidé) en mode sombre : le conteneur passe déjà en
   fond sombre via un style inline conditionnel (voir RapportPDF/RapportPDFGlobal dans app.js),
   mais le tableau gardait un en-tête et des bordures clairs codés en dur — texte clair (NAVY
   éclairci par le thème) sur fond d'en-tête clair, quasi illisible. */
body.dark .print-report-table th, body.dark .print-report-table td { border-bottom-color: #2c3145; }
body.dark .print-report-table thead th { background: #202433; color: #9a97a8; }
@media print {
  /* .app-shell regroupe TOUT le reste de l'app (header, onglets, barre du bas, modales).
     En display:none (et non plus visibility:hidden), il ne réserve plus aucune hauteur dans le
     flux du document : c'était la cause des pages blanches supplémentaires avant/après le
     rapport (le navigateur paginait sur la hauteur totale de l'app cachée, pas seulement sur
     celle du rapport). */
  .app-shell { display: none !important; }
  .print-report { position: static !important; width: 100%; height: auto !important; overflow: visible !important; margin: 0; padding: 0; }
  .no-print { display: none !important; }
  .print-report-table { page-break-inside: auto; }
  .print-report-table tr { page-break-inside: avoid; }
  .print-section { page-break-inside: avoid; }
  html, body { height: auto !important; margin: 0; padding: 0; }
  @page { margin: 14mm 12mm; }
  /* L'impression/export PDF doit TOUJOURS rester lisible sur papier (fond blanc, texte foncé,
     économie d'encre), même si l'aperçu à l'écran était en mode sombre — on force donc le thème
     clair ici, quel que soit l'état de body.dark. */
  .print-report, .print-report * { background: #FBFAF7 !important; color: #1a1a1a !important; box-shadow: none !important; }
  .print-report-table th, .print-report-table td { border-bottom: 1px solid #e5ded0 !important; }
  .print-report-table thead th { background: #f7f4ec !important; color: #7a7263 !important; }
}

/* ==================================================================
   V10 — Largeur de contenu sur grand écran. Le menu latéral reste un
   tiroir (overlay + ☰ + croix qui ferme, tiroir masqué par transform)
   et la barre d'onglets du bas reste affichée, quelle que soit la
   largeur d'écran — un seul comportement, identique mobile/web, plus
   simple et sans le bug où la croix ne fermait plus rien sur ordinateur
   (le panneau permanent forçait transform:none !important). Seule la
   largeur max du contenu est élargie sur grand écran.
   ================================================================== */
.app-main {
  max-width: 1000px; margin: 0 auto;
  padding: 18px 16px calc(84px + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 900px) {
  .app-main { max-width: 1100px; }
}
