/* ════════════════════════════════════════════════════════════════════════════
   Portfolio Manager — Main Stylesheet (v3.3)
   ════════════════════════════════════════════════════════════════════════════

   TABLE DES MATIÈRES  (rechercher  §N.  pour sauter à une section)

   §1.  Theme variables (5 thèmes : light, dark, blue, classic, classic-dark)
   §2.  Base styles & layout
   §3.  Navbar
   §4.  Components — Cards, Stat cards, Tables, Buttons, Forms, Badges
   §5.  Components — Tabs, Page header, Portfolio card, Search box,
                     Charts, Empty state, Alerts, Modal, Gains/Losses
   §6.  Components — Progress, Loading spinner, Theme switcher
   §7.  Responsive (mobile-first breakpoints) & Utility classes
   §8.  Widget — Stock Search (autocomplétion Yahoo)
   §9.  Widget — Fortune Tab (tableau d'évolution mensuelle)
   §10. Widget — Holdings Table (positions, colonnes figées)
   §11. Widget — Bond Yields
   §12-§18. Holdings mobile, treemap, modal titre, IA, nouveautés, manuel,
            vue portefeuille, tableau de bord
   §19. Accessibilité seniors (cibles tactiles, focus, liens, mouvements)

   Note : ce fichier monolithique (~1980 lignes) reste volontairement en un seul
   fichier pour éviter les imports CSS multiples (chacun = 1 requête HTTP).
   Une refonte en modules buildés est planifiée dans Lot 6 (cf. plan refactor).
   ════════════════════════════════════════════════════════════════════════════ */

/* ════════════════════════════════════════════════════════════════════════════
   §1. THEME VARIABLES
   ════════════════════════════════════════════════════════════════════════════ */

/* Light Theme (Default) - SeekingAlpha inspired */
:root,
[data-theme="light"] {
    /* Primary colors */
    --primary: #1a73e8;
    --primary-hover: #1557b0;
    --primary-light: #e8f0fe;
    
    /* Background colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f4;
    --bg-hover: #e8eaed;
    
    /* Text colors */
    --text-primary: #202124;
    --text-secondary: #3c4043;
    --text-muted: #5f6368;
    --text-inverse: #ffffff;
    
    /* Border colors */
    --border-color: #dadce0;
    --border-light: #e8eaed;
    
    /* Status colors */
    --success: #0d904f;
    --success-bg: #e6f4ea;
    --danger: #c5221f;
    --danger-bg: #fce8e6;
    --warning: #e37400;
    --warning-bg: #fef7e0;
    --info: #1a73e8;
    --info-bg: #e8f0fe;
    
    /* Navbar */
    --navbar-bg: #1e222d;
    --navbar-text: #d1d4dc;
    --navbar-text-active: #ffffff;
    --navbar-hover-bg: #2a2e39;
    
    /* Cards */
    --card-bg: #ffffff;
    --card-border: #e0e3eb;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
    
    /* Tables */
    --table-header-bg: #f8f9fa;
    --table-row-hover: #f5f5f5;
    --table-border: #e0e3eb;
    
    /* Charts */
    --chart-grid: #e0e3eb;
    --chart-text: #787b86;
}

/* Dark Theme - TradingView inspired */
[data-theme="dark"] {
    /* Primary colors */
    --primary: #2962ff;
    --primary-hover: #1e53e4;
    --primary-light: #1e3a5f;
    
    /* Background colors */
    --bg-primary: #131722;
    --bg-secondary: #1e222d;
    --bg-tertiary: #2a2e39;
    --bg-hover: #363a45;
    
    /* Text colors */
    --text-primary: #d1d4dc;
    --text-secondary: #b2b5be;
    --text-muted: #9598a1;
    --text-inverse: #131722;
    
    /* Border colors */
    --border-color: #2a2e39;
    --border-light: #363a45;
    
    /* Status colors */
    --success: #26a69a;
    --success-bg: #1a3329;
    --danger: #ef5350;
    --danger-bg: #3d1f1f;
    --warning: #ff9800;
    --warning-bg: #3d2e0f;
    --info: #2196f3;
    --info-bg: #1a2f4d;
    
    /* Navbar */
    --navbar-bg: #0c0e13;
    --navbar-text: #b2b5be;
    --navbar-text-active: #d1d4dc;
    --navbar-hover-bg: #1e222d;
    
    /* Cards */
    --card-bg: #1e222d;
    --card-border: #2a2e39;
    --card-shadow: 0 1px 3px rgba(0,0,0,0.3);
    --card-shadow-hover: 0 4px 12px rgba(0,0,0,0.4);
    
    /* Tables */
    --table-header-bg: #2a2e39;
    --table-row-hover: #2a2e39;
    --table-border: #363a45;
    
    /* Charts */
    --chart-grid: #363a45;
    --chart-text: #787b86;
}

/* Blue Theme - Professional Finance */
[data-theme="blue"] {
    /* Primary colors */
    --primary: #0066cc;
    --primary-hover: #004d99;
    --primary-light: #e6f2ff;
    
    /* Background colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f5f7fa;
    --bg-tertiary: #ebeef3;
    --bg-hover: #dce1e8;
    
    /* Text colors */
    --text-primary: #1a2b42;
    --text-secondary: #2d3748;
    --text-muted: #4a5568;
    --text-inverse: #ffffff;
    
    /* Border colors */
    --border-color: #d2d8e0;
    --border-light: #e2e8f0;
    
    /* Status colors */
    --success: #00875a;
    --success-bg: #e3fcef;
    --danger: #de350b;
    --danger-bg: #ffebe6;
    --warning: #ff8b00;
    --warning-bg: #fffae6;
    --info: #0052cc;
    --info-bg: #deebff;
    
    /* Navbar */
    --navbar-bg: #0a2540;
    --navbar-text: #8898aa;
    --navbar-text-active: #ffffff;
    --navbar-hover-bg: #0f3d66;
    
    /* Cards */
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --card-shadow: 0 1px 3px rgba(10,37,64,0.08);
    --card-shadow-hover: 0 4px 12px rgba(10,37,64,0.15);
    
    /* Tables */
    --table-header-bg: #f5f7fa;
    --table-row-hover: #f0f4f8;
    --table-border: #e2e8f0;
    
    /* Charts */
    --chart-grid: #e2e8f0;
    --chart-text: #718096;
}
/* Classic Theme - Original violet gradient */
[data-theme="classic"] {
    /* Primary colors */
    --primary: #667eea;
    --primary-hover: #764ba2;
    --primary-light: #e8e4f4;
    
    /* Background colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f5f9;
    --bg-hover: #e5e7eb;
    
    /* Text colors */
    --text-primary: #1f2937;
    --text-secondary: #374151;
    --text-muted: #4b5563;
    --text-inverse: #ffffff;
    
    /* Border colors */
    --border-color: #e5e7eb;
    --border-light: #f1f5f9;
    
    /* Status colors */
    --success: #10b981;
    --success-bg: #d1fae5;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --info: #3b82f6;
    --info-bg: #dbeafe;
    
    /* Navbar - violet gradient */
    --navbar-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --navbar-text: rgba(255, 255, 255, 0.85);
    --navbar-text-active: #ffffff;
    --navbar-hover-bg: rgba(255, 255, 255, 0.1);
    
    /* Cards */
    --card-bg: #ffffff;
    --card-border: #e5e7eb;
    --card-shadow: 0 2px 8px rgba(0,0,0,0.08);
    --card-shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
    
    /* Tables */
    --table-header-bg: #f8f9fa;
    --table-row-hover: #f8f9fa;
    --table-border: #e5e7eb;
    
    /* Charts */
    --chart-grid: #e5e7eb;
    --chart-text: #6b7280;
}

[data-theme="classic"] .navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

[data-theme="classic"] .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

[data-theme="classic"] .btn-primary:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Classic Dark - Violet gradient dark mode */
[data-theme="classic-dark"] {
    /* Primary colors */
    --primary: #667eea;
    --primary-hover: #764ba2;
    --primary-light: #2d2a3e;
    
    /* Background colors */
    --bg-primary: #1a1625;
    --bg-secondary: #221d2e;
    --bg-tertiary: #2d2639;
    --bg-hover: #3d3450;
    
    /* Text colors */
    --text-primary: #e2e0e7;
    --text-secondary: #cbc6d4;
    --text-muted: #a8a3b3;
    --text-inverse: #1a1625;
    
    /* Border colors */
    --border-color: #3d3450;
    --border-light: #4a4160;
    
    /* Status colors */
    --success: #10b981;
    --success-bg: #1a332d;
    --danger: #ef4444;
    --danger-bg: #3d1f1f;
    --warning: #f59e0b;
    --warning-bg: #3d2e0f;
    --info: #3b82f6;
    --info-bg: #1a2f4d;
    
    /* Navbar - violet gradient */
    --navbar-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --navbar-text: rgba(255, 255, 255, 0.85);
    --navbar-text-active: #ffffff;
    --navbar-hover-bg: rgba(255, 255, 255, 0.1);
    
    /* Cards */
    --card-bg: #221d2e;
    --card-border: #3d3450;
    --card-shadow: 0 2px 8px rgba(0,0,0,0.3);
    --card-shadow-hover: 0 4px 16px rgba(0,0,0,0.4);
    
    /* Tables */
    --table-header-bg: #2d2639;
    --table-row-hover: #2d2639;
    --table-border: #3d3450;
    
    /* Charts */
    --chart-grid: #3d3450;
    --chart-text: #a8a3b3;
}

[data-theme="classic-dark"] .navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

[data-theme="classic-dark"] .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

[data-theme="classic-dark"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

[data-theme="classic-dark"] ::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

[data-theme="classic-dark"] ::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* ════════════════════════════════════════════════════════════════════════════
   §2. BASE STYLES
   ════════════════════════════════════════════════════════════════════════════ */

* {
    box-sizing: border-box;
}

/* Lisibilité — l'utilisateur principal a 79 ans. Atkinson Hyperlegible
   (Braille Institute) : lettres ouvertes, chiffres non ambigus (1/7,
   3/8), graisses franches. Son zéro barré se confondait avec un 8 :
   les chiffres seuls passent en Public Sans (chargée avec text=0-9, donc
   ne contient que les chiffres ; les lettres retombent sur Atkinson).
   Corps 16px, aucun texte sous ~13px, et
   tailles en rem pour que le mode "Grands caractères" (html 110%) les
   agrandisse toutes. Variables --bs-* : Bootstrap lit les siennes. */
:root {
    --app-font: 'Public Sans', 'Atkinson Hyperlegible Next', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --bs-body-font-family: var(--app-font);
    --bs-body-font-size: 1rem;
    --bs-body-line-height: 1.55;
}

body {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-family: var(--app-font);
    font-size: 1rem;
    line-height: 1.55;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: none;
}

/* ════════════════════════════════════════════════════════════════════════════
   §3. NAVBAR
   ════════════════════════════════════════════════════════════════════════════ */

.navbar {
    background-color: var(--navbar-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1rem;
    height: 48px;
    box-shadow: none;
}

.navbar-brand {
    color: var(--navbar-text-active) !important;
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand i {
    font-size: 1.25rem;
}

.navbar .nav-link {
    color: var(--navbar-text) !important;
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 0.75rem 1rem !important;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

/* Barre dépliée entre 1200 et 1400px : 4 liens + 4 utilitaires + 2 menus
   ne tiennent pas avec le padding standard — les libellés passaient sur
   2 lignes ("Tableau / de bord") et, sous 1200px, la barre débordait
   (menu Admin coupé, défilement horizontal de toute la page). Le repli
   passe donc à xl (<1200px) ; dans cette plage on resserre les liens, et
   Manuel / Nouveautés / Thème y sont en icône seule (libellé en
   d-xxl-inline, repris par title/aria-label). */
@media (min-width: 1200px) and (max-width: 1399.98px) {
    .navbar .nav-link {
        padding: 0.75rem 0.7rem !important;
    }
}

/* Menu replié : la hauteur fixe de 48px ne peut pas contenir la liste
   dépliée, qui débordait sur le contenu entre 768 et 1199px. */
@media (max-width: 1199.98px) {
    .navbar {
        height: auto;
        min-height: 48px;
    }
}

.navbar .nav-link:hover {
    color: var(--navbar-text-active) !important;
    background-color: var(--navbar-hover-bg);
}

.navbar .nav-link.active {
    color: var(--navbar-text-active) !important;
    border-bottom-color: var(--primary);
}

.navbar .dropdown-menu {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow-hover);
    border-radius: 4px;
    padding: 0.5rem 0;
}

.navbar .dropdown-item {
    color: var(--text-primary);
    font-size: 1rem;
    padding: 0.5rem 1rem;
}

.navbar .dropdown-item:hover {
    background-color: var(--bg-hover);
}

.navbar .dropdown-divider {
    border-color: var(--border-light);
}

/* ════════════════════════════════════════════════════════════════════════════
   §4. COMPONENTS — Cards, Stat cards, Tables
   ════════════════════════════════════════════════════════════════════════════ */

.card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    box-shadow: var(--card-shadow);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: none;
}

.card-header {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-light);
    padding: 0.75rem 1rem;
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.card-body {
    padding: 1rem;
}

/* ============================================
   STAT CARDS
   ============================================ */

.stat-card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card .stat-change {
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.stat-card .stat-change.positive {
    color: var(--success);
}

.stat-card .stat-change.negative {
    color: var(--danger);
}

/* Colored stat cards */
.stat-card.primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.stat-card.primary .stat-label,
.stat-card.primary .stat-value,
.stat-card.primary .stat-change {
    color: var(--text-inverse);
}

.stat-card.success {
    background-color: var(--success);
    border-color: var(--success);
}

.stat-card.success .stat-label,
.stat-card.success .stat-value,
.stat-card.success .stat-change {
    color: var(--text-inverse);
}

/* ============================================
   TABLES
   ============================================ */

.table {
    background-color: var(--card-bg);
    color: var(--text-primary);
    margin-bottom: 0;
    font-size: 0.9375rem;
}

.table thead th {
    background-color: var(--table-header-bg);
    border-bottom: 1px solid var(--table-border);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.8125rem;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    border-bottom: 1px solid var(--table-border);
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: var(--table-row-hover);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table tfoot {
    background-color: var(--table-header-bg);
}

.table tfoot td {
    font-weight: 600;
    border-top: 2px solid var(--table-border);
}

/* ════════════════════════════════════════════════════════════════════════════
   §5. COMPONENTS — Buttons, Forms, Badges
   ════════════════════════════════════════════════════════════════════════════ */

.btn {
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: var(--text-inverse);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--bg-hover);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-outline-secondary {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background-color: var(--bg-hover);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-success {
    background-color: var(--success);
    border-color: var(--success);
}

.btn-danger {
    background-color: var(--danger);
    border-color: var(--danger);
}

/* ============================================
   FORMS
   ============================================ */

.form-control {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
    background-color: var(--bg-primary);
    border-color: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-label {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.form-select {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 1rem;
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* ============================================
   BADGES
   ============================================ */

.badge {
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    letter-spacing: 0.02em;
}

.badge.bg-primary {
    background-color: var(--primary) !important;
}

.badge.bg-success {
    background-color: var(--success) !important;
}

.badge.bg-danger {
    background-color: var(--danger) !important;
}

.badge.bg-warning {
    background-color: var(--warning) !important;
    color: var(--text-inverse);
}

.badge.bg-secondary {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-secondary) !important;
}

/* ════════════════════════════════════════════════════════════════════════════
   §6. COMPONENTS — Tabs, Headers, Modals, Alerts, Spinners, Theme switcher
   ════════════════════════════════════════════════════════════════════════════ */

.nav-tabs {
    border-bottom: 1px solid var(--border-color);
}

.nav-tabs .nav-link {
    color: var(--text-secondary) !important;
    font-size: 1rem;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    margin-bottom: -1px;
    transition: all 0.15s ease;
}

.nav-tabs .nav-link:hover {
    color: var(--text-primary) !important;
    border-color: transparent;
    background-color: transparent;
}

.nav-tabs .nav-link.active {
    color: var(--primary) !important;
    font-weight: 600;
    background-color: transparent;
    border-color: transparent;
    border-bottom-color: var(--primary);
}

/* ============================================
   GAINS / LOSSES
   ============================================ */

.gain-positive,
.text-success {
    color: var(--success) !important;
}

.gain-negative,
.text-danger {
    color: var(--danger) !important;
}

.bg-success-subtle {
    background-color: var(--success-bg) !important;
}

.bg-danger-subtle {
    background-color: var(--danger-bg) !important;
}

/* ============================================
   PAGE HEADER
   ============================================ */

.page-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin: 0.25rem 0 0 0;
}

/* Lien retour libellé au-dessus du titre ("← Mes Portefeuilles") : une
   flèche seule ne dit pas où elle mène (public 70+). Zone cliquable
   haute de 44px sans décaler la mise en page. */
.page-back-link {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    min-height: 44px;
    margin: -.5rem 0 .1rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.page-back-link:hover {
    color: var(--primary);
}

/* Titre + bouton Retour des pages outils (Comparer, Signaux politiques) :
   le titre se réduit et passe à la ligne, le bouton reste sur la même
   ligne au lieu d'être repoussé dessous. */
.page-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .75rem;
}
.page-title-row h2 {
    min-width: 0;
    font-size: clamp(1.3rem, 4.5vw, 1.75rem);
    text-wrap: balance;
}
.page-title-row > .btn {
    flex-shrink: 0;
    white-space: nowrap;
}


/* Actions de l'en-tête (Créer / Comparer / Import) : sur mobile, la
   colonne passe sous le titre ; les boutons se partagent la ligne à
   largeur égale au lieu de s'empiler avec des largeurs différentes. */
@media (max-width: 575.98px) {
    .page-header-actions {
        display: flex;
        gap: .5rem;
        width: 100%;
        margin-top: .75rem;
    }
    .page-header-actions > .btn {
        flex: 1 1 0;
        min-width: 0;
        min-height: 44px;
        margin: 0 !important;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: .35rem;
        font-size: .85rem;
    }
    .page-title-row > .btn {
        min-height: 44px;
    }
}

/* ============================================
   SEARCH BOX
   ============================================ */

.search-box {
    position: relative;
}

.search-box .form-control {
    background-color: var(--bg-tertiary);
    border-color: transparent;
    padding-left: 2.5rem;
}

.search-box .form-control:focus {
    background-color: var(--bg-primary);
    border-color: var(--primary);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-shadow: var(--card-shadow-hover);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-results.show {
    display: block;
}

/* ============================================
   CHARTS
   ============================================ */

.chart-container {
    position: relative;
    height: 300px;
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.empty-state h3 {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.9375rem;
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
    border-radius: 4px;
    font-size: 0.9375rem;
    padding: 0.75rem 1rem;
}

.alert-success {
    background-color: var(--success-bg);
    border-color: var(--success);
    color: var(--success);
}

.alert-danger {
    background-color: var(--danger-bg);
    border-color: var(--danger);
    color: var(--danger);
}

.alert-warning {
    background-color: var(--warning-bg);
    border-color: var(--warning);
    color: var(--warning);
}

.alert-info {
    background-color: var(--info-bg);
    border-color: var(--info);
    color: var(--info);
}

/* ============================================
   MODAL
   ============================================ */

.modal-content {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.modal-header {
    border-bottom-color: var(--border-light);
    padding: 1rem;
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body {
    padding: 1rem;
    color: var(--text-primary);
}

.modal-footer {
    border-top-color: var(--border-light);
    padding: 1rem;
}

.btn-close {
    filter: var(--btn-close-filter, none);
}

[data-theme="dark"] .btn-close {
    filter: invert(1);
}

/* ============================================
   PROGRESS BAR
   ============================================ */

.progress {
    background-color: var(--bg-tertiary);
    border-radius: 4px;
    height: 6px;
}

.progress-bar {
    border-radius: 4px;
}

.progress-bar.bg-success {
    background-color: var(--success) !important;
}

.progress-bar.bg-danger {
    background-color: var(--danger) !important;
}

/* ============================================
   LOADING SPINNER
   ============================================ */

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   THEME SWITCHER DROPDOWN
   ============================================ */

.theme-dropdown {
    position: relative;
}

.theme-dropdown-toggle {
    background: var(--navbar-hover-bg);
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--navbar-text);
    cursor: pointer;
    padding: 0.4rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    transition: all 0.2s ease;
}

.theme-dropdown-toggle:hover {
    background: var(--navbar-hover-bg);
    color: var(--navbar-text-active);
}

.theme-dropdown-toggle i {
    font-size: 1rem;
}

.theme-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 180px;
    padding: 0.5rem;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.theme-dropdown.open .theme-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: background 0.15s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.theme-option:hover {
    background: var(--bg-hover);
}

.theme-option.active {
    background: var(--primary);
    color: var(--text-inverse);
}

.theme-option-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}

.theme-option.active .theme-option-icon {
    border-color: rgba(255,255,255,0.5);
}

.theme-option-icon.classic {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.theme-option-icon.classic-dark {
    background: linear-gradient(135deg, #3d3450 50%, #667eea 50%);
}

.theme-option-icon.light {
    background: #ffffff;
}

.theme-option-icon.dark {
    background: #131722;
}

.theme-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.4rem 0.25rem;
}

.theme-option-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.theme-option-toggle:hover {
    background: var(--bg-hover);
}

/* Réglage "Grands caractères" — augmente la taille de police racine, ce qui
   fait suivre proportionnellement tout le système rem de Bootstrap (boutons,
   cartes, tableaux) sans avoir à cibler chaque composant individuellement.
   Accepte un peu plus de défilement horizontal sur les tableaux financiers
   denses en échange d'une lisibilité nettement meilleure pour un public
   presbyte — compromis assumé, cf. webUXUI.md.
   110% plutôt qu'un facteur plus agressif : la barre de navigation a une
   hauteur fixe (48px, §3 NAVBAR) et un padding en rem — un facteur trop
   élevé fait passer ses libellés sur 2 lignes à l'intérieur de cette
   hauteur fixe (ex. "Tableau de / bord"), cf. bug remonté le 2026-09-15. */
html[data-text-scale="lg"] {
    font-size: 110%;
}

/* La navbar reste à taille fixe même en mode "Grands caractères" : c'est de
   la navigation, pas du contenu financier à lire, et sa hauteur fixe (48px)
   ne peut pas absorber un padding en rem qui grandirait avec le reste de la
   page — d'où des libellés coupés sur 2 lignes sans ce correctif. Le
   padding est réécrit en valeurs px (immunisées au rem du root) et la
   hauteur passe en min-height par sécurité si un libellé long dépasse
   malgré tout. */
html[data-text-scale="lg"] .navbar {
    height: auto;
    min-height: 48px;
}
html[data-text-scale="lg"] .navbar .nav-link {
    padding: 12px 16px !important;
    white-space: nowrap;
}

/* ============================================
   SCROLLBAR (Dark theme)
   ============================================ */

[data-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ════════════════════════════════════════════════════════════════════════════
   §7. RESPONSIVE & UTILITIES
   ════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .navbar {
        height: auto;
        padding: 0.5rem 1rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.25rem;
    }
    
    .page-header h1 {
        font-size: 1.25rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.5rem;
    }
}

/* Menu replié (navbar-expand-xl replie < 1200px) : les actions utilitaires
   (Manuel, Nouveautés, Langue, Thème) suivaient un style "bouton" pensé
   pour la barre horizontale desktop (boîte étroite, texte masqué sous
   1400px via d-xxl-inline) — résultat en mobile : icônes seules mal
   alignées au milieu de liens pleine largeur icône+texte. On les aligne
   ici sur le style de `.navbar .nav-link` pour qu'ils forment une liste
   verticale cohérente. */
@media (max-width: 1199.98px) {
    #manualBtn,
    #changelogNewsBtn,
    #navbarNav > .dropdown,
    #navbarNav > .theme-dropdown {
        width: 100%;
        margin: 0 !important;
    }

    #manualBtn,
    #changelogNewsBtn,
    #navbarNav > .dropdown > .dropdown-toggle,
    .theme-dropdown-toggle {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
        font-weight: 500;
        background: transparent;
        border: none;
        border-radius: 0;
        color: var(--navbar-text);
    }

    #manualBtn:hover,
    #changelogNewsBtn:hover,
    #navbarNav > .dropdown > .dropdown-toggle:hover,
    .theme-dropdown-toggle:hover {
        color: var(--navbar-text-active);
        background-color: var(--navbar-hover-bg);
    }

    #manualBtn span,
    #changelogNewsBtn span,
    .theme-dropdown-toggle span {
        display: inline !important;
    }

    #manualBtn {
        border-top: 1px solid var(--border-light);
    }
}

/* ============================================
   UTILITIES
   ============================================ */

.text-muted {
    color: var(--text-muted) !important;
}

.border {
    border-color: var(--border-color) !important;
}

.border-top {
    border-top-color: var(--border-light) !important;
}

.border-bottom {
    border-bottom-color: var(--border-light) !important;
}

.bg-light {
    background-color: var(--bg-tertiary) !important;
}

.fw-bold {
    font-weight: 600 !important;
}

small, .small {
    font-size: 0.875rem;
}


/* Fix theme buttons */
.theme-switcher .theme-btn {
    -webkit-appearance: none;
    appearance: none;
    background-color: transparent;
}
.theme-switcher .theme-btn.light { background: #ffffff !important; }
.theme-switcher .theme-btn.dark { background: #131722 !important; }
.theme-switcher .theme-btn.blue { background: #0a2540 !important; }


/* Ajouter à assets/css/app.css */

/* ════════════════════════════════════════════════════════════════════════════
   §8. WIDGET — Stock Search
   ============================================ */

.performance-card {
    transition: all 0.2s ease;
    border-width: 2px;
}

.performance-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.performance-card.border-success {
    border-color: var(--bs-success) !important;
    background-color: rgba(25, 135, 84, 0.05);
}

.performance-card.border-danger {
    border-color: var(--bs-danger) !important;
    background-color: rgba(220, 53, 69, 0.05);
}

/* Dark theme support */
[data-theme="dark"] .performance-card.border-success {
    background-color: rgba(25, 135, 84, 0.15);
}

[data-theme="dark"] .performance-card.border-danger {
    background-color: rgba(220, 53, 69, 0.15);
}

#stockSearchResults h4 {
    color: var(--bs-body-color);
}

#stockCurrentPrice {
    font-size: 1.75rem;
    font-weight: 600;
}

/* Animation d'apparition des résultats */
#stockSearchResults {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.search-container {
    position: relative;
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    margin-top: 4px;
}

.suggestion-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background-color: #f5f5f5;
}

.suggestion-symbol {
    font-weight: 600;
    font-size: 14px;
    color: #1a73e8;
    min-width: 80px;
}

.suggestion-details {
    display: flex;
    flex-direction: column;
    flex: 1;
    margin-left: 12px;
}

.suggestion-name {
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-exchange {
    font-size: 0.8125rem;
    color: #888;
    margin-top: 2px;
}

/* Mode sombre */
@media (prefers-color-scheme: dark) {
    .search-suggestions {
        background: #2d2d2d;
        border-color: #444;
    }
    
    .suggestion-item {
        border-bottom-color: #444;
    }
    
    .suggestion-item:hover,
    .suggestion-item.selected {
        background-color: #3d3d3d;
    }
    
    .suggestion-name {
        color: #eee;
    }
}



/* CSS pour l'autocomplétion de recherche d'actions */
.search-suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
}

.suggestion-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.15s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background-color: #f8f9fa;
}

.suggestion-symbol {
    font-weight: 600;
    color: #2563eb;
    min-width: 80px;
    font-size: 0.95rem;
}

.suggestion-details {
    display: flex;
    flex-direction: column;
    margin-left: 10px;
    overflow: hidden;
}

.suggestion-name {
    font-size: 0.9rem;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-exchange {
    font-size: 0.8125rem;
    color: #6b7280;
}

/* Style pour les cartes de performance */
.performance-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

.performance-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ════════════════════════════════════════════════════════════════════════════
   §9. WIDGET — Fortune Tab
   À ajouter à la fin de assets/css/app.css
   ============================================ */

/* Fortune Table Base */
.fortune-table {
    font-size: 0.85rem;
    /* background: white; */
}

.fortune-table th,
.fortune-table td {
    vertical-align: middle;
    white-space: nowrap;
}

/* Editable inputs */
.fortune-table .fortune-input {
    width: 100%;
    min-width: 90px;
    text-align: right;
    background: transparent;
    border: none;
    padding: 0.25rem 0.5rem;
}

.fortune-table .fortune-input:focus {
    background: #fff;
    box-shadow: inset 0 0 0 2px var(--bs-primary);
    outline: none;
}

/* Override value highlight */
.fortune-table .bg-warning-subtle {
    background-color: rgba(255, 193, 7, 0.25) !important;
}

/* Row backgrounds */
.fortune-table tr.table-warning td {
    background-color: rgba(255, 193, 7, 0.15);
}

.fortune-table tr.table-danger td {
    background-color: rgba(220, 53, 69, 0.1);
}

/* ──────────────────────────────────────────────────────────────────
   Sticky col (Compte) + sticky header.
   Structure : 1 seule colonne sticky à gauche + N colonnes mois scrollables.
   Les sections sont des "banners" sur toute la largeur (pas de col Section).

   Hiérarchie z-index :
     ┌─────────┬──────────────────────┐
     │ CORNER  │  Header dates        │ ← thead sticky-top, z:6 (corner z:7)
     ├─────────┼──────────────────────┤
     │ COMPTE  │  Cellules valeurs    │ ← tbody, sticky col z:5, autres z:1
     │ STICKY  │                      │
     └─────────┴──────────────────────┘
   ────────────────────────────────────────────────────────────────── */

/* Container scroll horizontal */
#fortuneTableContainer .table-responsive {
    overflow-x: auto;
    overflow-y: visible;
    max-height: none;
    position: relative;
}

/* Header de table : sticky en haut */
.fortune-table thead th {
    position: sticky;
    top: 0;
    z-index: 6;
    background-color: #212529;
    color: #fff;
}

/* Colonne "Compte" (col 1) : sticky à gauche */
.fortune-table th:first-child,
.fortune-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 5;
    width: 200px;
    min-width: 200px;
    max-width: 200px;
    border-right: 2px solid var(--bs-border-color, #dee2e6);
}

/* Corner (intersection thead + sticky col) : au-dessus de tout */
.fortune-table thead th:first-child {
    z-index: 7;
}

/* Background OPAQUE sur la sticky col du body (sinon les cellules
   scrollables traversent visuellement). */
.fortune-table tbody td:first-child {
    background-color: var(--bs-body-bg);
}

/* Si la ligne a une couleur de surlignage (total, all cash, grand total,
   performance), on l'applique aussi à la sticky col pour cohérence. */
.fortune-table tbody tr.table-primary td:first-child {
    background-color: var(--bs-table-primary-bg, #cfe2ff);
}
.fortune-table tbody tr.table-success td:first-child {
    background-color: var(--bs-table-success-bg, #d1e7dd);
}
.fortune-table tbody tr.table-warning td:first-child {
    background-color: var(--bs-table-warning-bg, #fff3cd);
}
.fortune-table tbody tr.table-danger td:first-child {
    background-color: var(--bs-table-danger-bg, #f8d7da);
}

/* Section banner : la classe bg-* est appliquée directement sur CHAQUE <td>
   du tr.fortune-section-row (fixe le bug du <tr class="bg-X"> qui ne se
   propage pas aux <td> vides). La cellule sticky doit aussi garder sa couleur. */
.fortune-table tbody tr.fortune-section-row td.fortune-section-banner-cell.bg-secondary,
.fortune-table tbody tr.fortune-section-row td.bg-secondary {
    background-color: var(--bs-secondary) !important;
    color: #fff;
}
.fortune-table tbody tr.fortune-section-row td.fortune-section-banner-cell.bg-danger,
.fortune-table tbody tr.fortune-section-row td.bg-danger {
    background-color: var(--bs-danger) !important;
    color: #fff;
}
.fortune-table tbody tr.fortune-section-row td.fortune-section-banner-cell.bg-warning,
.fortune-table tbody tr.fortune-section-row td.bg-warning {
    background-color: var(--bs-warning) !important;
}

/* Number formatting */
.fortune-table .text-end {
    font-variant-numeric: tabular-nums;
}

/* Hover effect */
.fortune-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Empty rows for spacing */
.fortune-table .border-0 td {
    border: none !important;
}

/* Section header rows */
.fortune-table .section-header {
    font-weight: bold;
}

/* Performance colors */
.fortune-table .text-success {
    color: #198754 !important;
}

.fortune-table .text-danger {
    color: #dc3545 !important;
}

/* Print styles */
@media print {
    .fortune-table {
        font-size: 8px;
    }

    .fortune-table th:first-child,
    .fortune-table td:first-child {
        position: static;
    }
}

/* ──────────────────────────────────────────────────────────────────
   §9.MOBILE — Fortune Tab sur smartphone (< 768px)
   Vue "1 mois à la fois" : cache toutes les colonnes mois sauf l'active.
   La navigation prev/next/select est dans #fortuneMobileMonthNav.
   ────────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {

    /* Header card : padding réduit */
    .fortune-header-card .card-body {
        padding: 0.5rem 0.75rem !important;
    }
    .fortune-header-card h4 {
        font-size: 1rem !important;
    }
    .fortune-header-card .col-auto {
        margin-top: 0.5rem;
    }

    /* Cache toutes les cellules mois SAUF celle active */
    .fortune-table [data-month-index]:not(.fortune-month-active) {
        display: none !important;
    }

    /* Sur mobile, plus besoin du min-width 110px sur les colonnes mois */
    .fortune-table th.fortune-month-active,
    .fortune-table td.fortune-month-active {
        min-width: 0 !important;
        width: auto !important;
    }
    /* Sticky col 1 (Compte) un peu plus étroite sur mobile */
    .fortune-table th:first-child,
    .fortune-table td:first-child {
        width: 150px !important;
        min-width: 150px !important;
        max-width: 150px !important;
    }

    /* Plus de scroll horizontal nécessaire (seulement 3 colonnes visibles) */
    #fortuneTableContainer .table-responsive {
        overflow-x: hidden !important;
    }

    /* Police table un peu plus petite pour économiser l'espace */
    .fortune-table {
        font-size: 0.78rem;
    }

    /* Navigation mobile : select au centre, boutons compact */
    #fortuneMobileMonthNav {
        display: block !important;
    }
    #fortuneMobileMonthNav .btn {
        min-width: 44px;
        min-height: 36px;
    }
    #fortuneMobileMonthNav .form-select {
        font-weight: 600;
        min-height: 36px;
    }
}

/* Sur desktop : la barre de navigation mobile reste masquée */
@media (min-width: 769px) {
    #fortuneMobileMonthNav {
        display: none !important;
    }
}

/* Rayure dérivée du fond de carte du thème actif : l'ancien gris clair
   figé (#e6e6e7) s'appliquait aussi aux thèmes sombres (ligne claire sous
   du texte clair) et masquait le survol, plus clair que la rayure. */
:root {
    --table-stripe-bg: color-mix(in srgb, var(--card-bg) 94%, var(--text-primary));
}

.table-striped>tbody>tr:nth-of-type(odd)>* {
    --bs-table-color-type: var(--bs-table-striped-color);
    --bs-table-bg-type: var(--table-stripe-bg);
}

.table-hover>tbody>tr:hover>* {
    --bs-table-bg-state: var(--bg-hover);
}

/* ════════════════════════════════════════════════════════════════════════════
   §10. WIDGET — Holdings Table (colonnes figées)
   Version 2.0 - Sélecteurs plus spécifiques pour éviter
   les conflits avec d'autres tableaux (Fortune, etc.)
   ===================================================== */

/* 
 * IMPORTANT: Ces styles s'appliquent UNIQUEMENT au tableau 
 * qui a l'ID "holdingsTable" pour éviter d'affecter 
 * les autres tableaux de l'application
 */

/* Container du tableau Holdings */
#holdingsTable-container,
.holdings-table-container {
    position: relative;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}

/* Table Holdings spécifiquement */
table#holdingsTable {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1400px;
    width: 100%;
}

/* Colonnes figées - UNIQUEMENT pour #holdingsTable */
#holdingsTable th.sticky-col,
#holdingsTable td.sticky-col {
    position: sticky !important;
    z-index: 2;
    background-color: #ffffff !important;
}

/* Colonne #1 - Index */
#holdingsTable th.sticky-col-1,
#holdingsTable td.sticky-col-1 {
    left: 0;
    min-width: 50px;
    width: 50px;
}

/* Colonne #2 - Ticker */
#holdingsTable th.sticky-col-2,
#holdingsTable td.sticky-col-2 {
    left: 50px;
    min-width: 100px;
    width: 100px;
}

/* Colonne #3 - Instrument */
#holdingsTable th.sticky-col-3,
#holdingsTable td.sticky-col-3 {
    left: 150px;
    min-width: 200px;
    width: 200px;
    border-right: 2px solid #dee2e6 !important;
}

/* Ombre pour indiquer le scroll */
#holdingsTable td.sticky-col-3::after,
#holdingsTable th.sticky-col-3::after {
    content: '';
    position: absolute;
    top: 0;
    right: -8px;
    bottom: 0;
    width: 8px;
    background: linear-gradient(to right, rgba(0,0,0,0.08), transparent);
    pointer-events: none;
}

/* Header sticky (scroll vertical) - UNIQUEMENT pour #holdingsTable */
#holdingsTable thead th {
    position: sticky;
    top: 0;
    z-index: 3;
}

/* Header des colonnes figées */
#holdingsTable thead th.sticky-col {
    z-index: 5 !important;
    background-color: var(--table-header-bg) !important; /* table-dark */
    /* background-color: #212529 !important; table-dark */
    /* color: #ffffff; */
}

/* ===== THÈME CLAIR ===== */
[data-theme="light"] #holdingsTable td.sticky-col {
    background-color: #ffffff !important;
}

[data-theme="light"] #holdingsTable thead th.sticky-col {
    background-color: #212529 !important;
}

/* ===== THÈME SOMBRE ===== */
[data-theme="dark"] #holdingsTable td.sticky-col {
    background-color: #1e222d !important;
}

[data-theme="dark"] #holdingsTable thead th.sticky-col {
    background-color: #131722 !important;
    color: #d1d4dc;
}

[data-theme="dark"] #holdingsTable td.sticky-col-3 {
    border-right-color: #363a45 !important;
}

[data-theme="dark"] #holdingsTable td.sticky-col-3::after,
[data-theme="dark"] #holdingsTable th.sticky-col-3::after {
    background: linear-gradient(to right, rgba(0,0,0,0.3), transparent);
}

/* ===== Bootstrap data-bs-theme ===== */
[data-bs-theme="dark"] #holdingsTable td.sticky-col {
    background-color: var(--bs-body-bg, #212529) !important;
}

[data-bs-theme="dark"] #holdingsTable thead th.sticky-col {
    background-color: var(--bs-dark, #212529) !important;
}

/* ===== TABLE-STRIPED + HOVER =====
   Les colonnes figées doivent rester opaques (le contenu défile dessous) :
   même rayure que le reste de la ligne (--table-stripe-bg), fond de carte
   sinon — valable pour les 5 thèmes. Le survol est déclaré en dernier et
   avec la même spécificité pour l'emporter sur la rayure. */
#holdingsTable.table-striped tbody tr:nth-of-type(odd) td.sticky-col {
    background-color: var(--table-stripe-bg) !important;
}

#holdingsTable.table-striped tbody tr:nth-of-type(even) td.sticky-col {
    background-color: var(--card-bg) !important;
}

#holdingsTable.table-striped tbody tr:hover td.sticky-col {
    background-color: var(--bg-hover) !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    #holdingsTable th.sticky-col-3,
    #holdingsTable td.sticky-col-3 {
        position: relative !important;
        left: auto !important;
        border-right: none !important;
    }
    
    #holdingsTable th.sticky-col-3::after,
    #holdingsTable td.sticky-col-3::after {
        display: none;
    }
    
    #holdingsTable th.sticky-col-2,
    #holdingsTable td.sticky-col-2 {
        border-right: 2px solid #dee2e6 !important;
    }
}

/* ===== SCROLLBAR ===== */
#holdingsTable-container::-webkit-scrollbar,
.holdings-table-container::-webkit-scrollbar {
    height: 8px;
}

#holdingsTable-container::-webkit-scrollbar-track,
.holdings-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#holdingsTable-container::-webkit-scrollbar-thumb,
.holdings-table-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

/* =====================================================
   RESET: Annuler les effets sur les AUTRES tableaux
   Ceci empêche les styles sticky-col d'affecter
   les tableaux qui ne sont pas #holdingsTable
   ===================================================== */

/* Fortune table : on NE retire PAS le sticky — voir §9 et §9.MOBILE plus bas.
   (Le reset destructeur précédent cassait les sticky cols/header Fortune.) */

/* Tableaux dans d'autres onglets - pas de sticky */
#performance table:not(#holdingsTable) th,
#performance table:not(#holdingsTable) td,
#allocation table:not(#holdingsTable) th,
#allocation table:not(#holdingsTable) td,
#transactions table:not(#holdingsTable) th,
#transactions table:not(#holdingsTable) td {
    position: static !important;
    left: auto !important;
    z-index: auto !important;
}

/* Reset générique pour tous les tableaux sauf holdingsTable */
table:not(#holdingsTable) .sticky-col {
    position: static !important;
    left: auto !important;
    background-color: inherit !important;
}

/* ════════════════════════════════════════════════════════════════════════════
   §11. WIDGET — Bond Yields
   ===================================================== */

/* Entête de région */
.bond-table .region-header td {
    background-color: var(--bs-gray-100, #f8f9fa);
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    letter-spacing: 0.05em;
}
[data-bs-theme="dark"] .bond-table .region-header td {
    background-color: rgba(255,255,255,0.05);
}

/* Lignes de données */
.bond-table .bond-row td {
    vertical-align: middle;
    padding: 0.35rem 0.5rem;
    font-size: 0.875rem;
}

/* Flag emoji */
.bond-table .flag {
    font-size: 1rem;
}

/* Valeur du rendement */
.bond-table .yield-value {
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

/* Barre de fourchette 3 mois */
.range-bar-container {
    padding: 4px 2px;
}
.range-bar-track {
    position: relative;
    height: 6px;
    background: linear-gradient(to right, #198754, #fd7e14, #dc3545);
    border-radius: 3px;
    margin: 4px 4px;
}
.range-bar-dot {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    cursor: pointer;
}
.range-avg-marker {
    position: absolute;
    top: -3px;
    transform: translateX(-50%);
    width: 2px;
    height: 12px;
    background: rgba(255,255,255,0.8);
    border-radius: 1px;
    opacity: 0.7;
}

/* Wrapper responsive */
.bond-yields-wrapper {
    min-height: 80px;
}

/* ── Bond Yields Widget ─────────────────────────── */

.bond-table td,
.bond-table th {
    padding: 0.3rem 0.5rem;
    vertical-align: middle;
    border-color: transparent;
}
.bond-table tbody tr:hover {
    background-color: var(--bs-tertiary-bg);
}

/* Barre de fourchette 3 mois */
.bond-range-wrap {
    min-width: 80px;
}
.bond-range-bar {
    position: relative;
    height: 6px;
    background: var(--bs-border-color);
    border-radius: 3px;
    overflow: visible;
}
.bond-range-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    border-radius: 3px;
    opacity: 0.4;
}
.bond-range-marker {
    position: absolute;
    top: -3px;
    width: 3px;
    height: 12px;
    background: var(--bs-body-color);
    border-radius: 1px;
    transform: translateX(-50%);
}

/* Sections groupées */
.bond-table .table-light td {
    padding-top: 0.5rem;
    padding-bottom: 0.2rem;
    border-top: 1px solid var(--bs-border-color-translucent);
}
.bond-table .table-light:first-child td {
    border-top: none;
}



@media (max-width: 768px) {
  
  /* Tableaux transformés en cards */
  .table-mobile-cards thead {
    display: none; /* On cache les headers, ils seront inline */
  }
  
  .table-mobile-cards tbody tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 0.75rem;
    background: var(--bs-body-bg);
    max-width: 90vw;
  }
  
  .table-mobile-cards td {
    display: flex;
    /* justify-content: space-between; */
    align-items: center;
    padding: 0.3rem 0;
    border: none;
    border-bottom: 1px solid var(--bs-border-color-translucent);
    font-size: 0.875rem;
  }
  
  .table-mobile-cards td:last-child {
    border-bottom: none;
  }
  
  /* Le label vient du data-label="..." posé sur chaque <td> */
  .table-mobile-cards td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--bs-secondary-color);
    font-size: 0.8125rem;
    letter-spacing: 0.05em;
    flex-shrink: 0;
    margin-right: 0.5rem;
  }
  
  /* Valeur alignée à droite */
  .table-mobile-cards td > * {
    text-align: right;
  }
  
  /* Colonnes "actions" (boutons) : pleine largeur */
  .table-mobile-cards td.td-actions {
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.5rem;
  }
  
  .table-mobile-cards td.td-actions::before {
    display: none;
  }

  /* Tableaux simples (peu de colonnes) : scroll horizontal propre */
  .table-scroll-mobile {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  /* Navigation et layout général */
  .navbar-brand img {
    max-height: 28px;
  }
  
  /* Cards du dashboard */
  .card-stat {
    margin-bottom: 0.75rem;
  }
  
  /* Graphiques Chart.js */
  canvas {
    max-height: 250px !important;
  }
  
  /* Boutons d'action en toolbar */
  .btn-toolbar-mobile {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .btn-toolbar-mobile .btn {
    flex: 1;
    min-width: 120px;
    font-size: 0.8rem;
  }
  #holdingsTable.table-striped tbody tr td.sticky-col {
    display: inline-block;
  }
  .account-col {
    padding-left: 2em !important;
  }
  .table thead th,
    .table tbody td .account-col {
    padding: 0;
  }

  /* display:inline (au lieu du inline-flex par défaut de Bootstrap) pour
     laisser les groupes de boutons de toolbar passer à la ligne sur mobile.
     Scopé au mobile uniquement : en desktop cela cassait le calcul de
     position de Popper.js pour les menus déroulants (.dropdown-menu),
     qui se retrouvaient rendus hors de l'écran (ex. menu "Exporter"). */
  .btn-group, .btn-group-vertical {
      position: relative;
      display: inline;
      vertical-align: middle;
  }
}

/* Toolbar de l'onglet Avoirs (conversion, recherche, filtres, actions) : pas
   de flex-wrap en dehors du mode mobile dédié (§12 ci-dessous), donc à toute
   largeur intermédiaire (fenêtre pas maximisée, "Grands caractères" actif...)
   où le contenu ne tient plus sur une seule ligne, les contrôles se
   comprimaient au lieu de passer à la ligne. */
.holdings-card-header {
    flex-wrap: wrap;
    row-gap: .5rem;
}

/* Barre de filtres — 1 seule rangée par défaut : recherche + Filtres
   (popover regroupant conversion/devise/compte/colonnes) + Comparer +
   menu ⋯ pour les actions peu fréquentes. Remplace l'ancienne liste à
   plat de 12 contrôles sans hiérarchie. Cf. webUXUI.md. */
.holdings-toolbar {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    width: 100%;
}
.holdings-search-group {
    flex: 1 1 220px;
    max-width: 320px;
}
/* z-index : le thead du tableau utilise l'utilitaire Bootstrap .sticky-top
   (z-index: 1020) pour rester visible au scroll vertical — plus haut que le
   z-index par défaut d'un .dropdown-menu (1000). Sans ce correctif, le
   header du tableau passe visuellement AU-DESSUS des panneaux Filtres/Actions
   ouverts juste au-dessus de lui. Cf. webUXUI.md. */
.holdings-toolbar .dropdown-menu {
    z-index: 1030;
}

.holdings-filters-menu {
    width: 280px;
    padding: .9rem 1rem;
}
.holdings-filters-menu .form-label {
    letter-spacing: .04em;
    font-size: .78rem;
}
.holdings-switch-row {
    font-size: .9375rem;
    font-weight: 600;
    color: var(--text-primary);
}
.holdings-switch {
    width: 40px;
    height: 23px;
    border-radius: 999px;
    background: var(--border-color);
    border: none;
    position: relative;
    flex-shrink: 0;
    cursor: pointer;
    padding: 0;
    transition: background-color .15s ease;
}
.holdings-switch .holdings-switch-dot {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 19px;
    height: 19px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .15s ease;
}
.holdings-switch.is-on {
    background: var(--primary);
}
.holdings-switch.is-on .holdings-switch-dot {
    transform: translateX(17px);
}
/* Menu Actions : libellé visible (et non "⋯" seul) — public 70+. */
.holdings-actions-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════
   §12. Holdings — Mode compact mobile (< 768px) — Apple Stocks style
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── A. Désactive le scroll horizontal forcé par min-width:1400px ── */
    .holdings-table-container {
        overflow-x: hidden !important;
        overflow-y: visible !important;
        max-height: none !important;
        max-width: 100% !important;
    }
    #holdingsTable.table-mobile-cards {
        min-width: 0 !important;
        width: 100% !important;
    }

    /* ── B. Toolbar mobile : recherche sur sa propre ligne (cible tactile
       pleine largeur), puis Filtres / Comparer / Actions se partagent la
       ligne suivante — au lieu des 8+ contrôles empilés verticalement
       de l'ancienne barre. Cibles ≥44px pour un public senior. ── */
    .holdings-toolbar {
        gap: .5rem;
    }
    .holdings-search-group {
        flex: 1 1 100%;
        max-width: 100%;
    }
    .holdings-search-group .form-control,
    .holdings-search-group .input-group-text,
    .holdings-search-group .btn {
        min-height: 44px;
    }
    /* Base 0 + min-width 0 : avec une base "auto", le width:100% des
       boutons devenait leur base flex et chacun prenait une ligne entière
       (4 rangées empilées au lieu de 2). */
    .holdings-filters-dropdown,
    #btnCompareSelected {
        flex: 1 1 0;
        min-width: 0;
    }
    .holdings-filters-btn,
    #btnCompareSelected {
        min-height: 44px;
        white-space: nowrap;
    }
    .holdings-filters-btn {
        width: 100%;
    }
    /* En vue compacte, les cases à cocher de comparaison sont masquées :
       le bouton Comparer resterait désactivé en permanence. Il réapparaît
       en "Vue complète", où les cases sont visibles. */
    .card:has(#holdingsTable.table-mobile-cards:not(.mobile-full)) #btnCompareSelected {
        display: none;
    }
    .holdings-actions-btn {
        min-height: 44px;
    }
    .holdings-filters-menu {
        width: min(92vw, 320px);
    }

    /* ── C. Mode COMPACT : seules les .mobile-essential restent visibles ── */
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody td:not(.mobile-essential) {
        display: none !important;
    }

    /* ── D. Reset Bootstrap table styling sur les TR/TD en compact ─────
       (élimine le striping ligne-sur-deux qui se voit cellule par cellule,
       les borders inter-cellules et tout fond hérité de .table-striped) */
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody tr,
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody tr > * {
        --bs-table-bg-type:    transparent !important;
        --bs-table-bg-state:   transparent !important;
        --bs-table-accent-bg:  transparent !important;
        --bs-table-striped-bg: transparent !important;
    }
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody tr > * {
        background: transparent !important;
        background-color: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
    /* Override spécifique pour les sticky-col qui ont des règles theme/striped
       avec spécificité plus haute (#holdingsTable.table-striped ... td.sticky-col) */
    #holdingsTable.table-striped.table-mobile-cards:not(.mobile-full) tbody tr:nth-of-type(odd)  td.sticky-col,
    #holdingsTable.table-striped.table-mobile-cards:not(.mobile-full) tbody tr:nth-of-type(even) td.sticky-col,
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody tr td.sticky-col,
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody tr td.sticky-col-1,
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody tr td.sticky-col-2,
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody tr td.sticky-col-3 {
        background: transparent !important;
        background-color: transparent !important;
        position: static !important;
        left: auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: 100% !important;
        border-right: none !important;
        box-shadow: none !important;
    }
    /* Et tue le ::after (ombre verticale) de sticky-col-3 sur mobile */
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody tr td.sticky-col-3::after,
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody tr td.sticky-col::after {
        display: none !important;
        content: none !important;
    }

    /* ── E. La CARTE = le <tr> entier, look Apple Stocks ──────────── */
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody tr {
        display: grid !important;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "ticker  value"
            "name    pnl"
            "actions actions";
        gap: 0.3rem 1rem;
        align-items: center;
        background: var(--bs-body-bg) !important;
        border: 1px solid var(--bs-border-color-translucent) !important;
        border-radius: 14px !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
        margin-bottom: 0.6rem !important;
        padding: 1rem 1.1rem !important;
        max-width: 100% !important;
        transition: background-color 0.15s ease, transform 0.1s ease;
    }
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody tr:active {
        background: var(--bs-tertiary-bg, rgba(0, 0, 0, 0.04)) !important;
        transform: scale(0.99);
    }

    /* ── F. Pas de label ::before en mode compact ──── */
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody td.mobile-essential::before {
        display: none !important;
    }

    /* ── G. Typographie + alignement strict ──────────
       Force ticker et name à occuper toute la première colonne
       du grid (justify-self: start), peu importe sticky-col-X.
       Le NOM est mis en avant (grande ligne du haut) et le TICKER
       en secondaire (petite ligne du dessous) — un ticker ("ZGLD.SW")
       ne veut rien dire pour la plupart des utilisateurs, le nom si.
       Cf. webUXUI.md. */
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody td.mobile-cell-name {
        grid-area: ticker;
        justify-self: start !important;
        width: 100% !important;
        font-size: 1.15rem !important;
        font-weight: 700 !important;
        line-height: 1.2;
        text-align: left !important;
        padding-left: 0 !important;
        margin-left: 0 !important;
    }
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody td.mobile-cell-name strong {
        color: var(--bs-body-color) !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody td.mobile-cell-name .text-truncate {
        max-width: none !important;
        display: inline !important;
        padding: 0 !important;
        margin: 0 !important;
        white-space: normal !important;
    }

    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody td.mobile-cell-ticker {
        grid-area: name;
        justify-self: start !important;
        width: 100% !important;
        font-size: 0.82rem !important;
        color: var(--bs-secondary-color) !important;
        text-align: left !important;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
        padding-left: 0 !important;
        margin-left: 0 !important;
    }

    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody td.mobile-cell-value {
        grid-area: value;
        font-size: 1.1rem !important;
        font-weight: 600 !important;
        text-align: right !important;
        line-height: 1.2;
        color: var(--bs-body-color) !important;
        font-variant-numeric: tabular-nums;
    }

    /* ── H. P/L % en pill badge coloré (Apple Stocks signature) ──── */
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody td.mobile-cell-pnl {
        grid-area: pnl;
        justify-self: end !important;
        align-self: center;
        font-size: 0.85rem !important;
        font-weight: 600 !important;
        text-align: center !important;
        padding: 0.28rem 0.7rem !important;
        border-radius: 8px !important;
        min-width: 78px;
        color: #fff !important;
        font-variant-numeric: tabular-nums;
    }
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody td.mobile-cell-pnl.text-success {
        background: #34c759 !important; /* Apple green */
    }
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody td.mobile-cell-pnl.text-danger {
        background: #ff3b30 !important; /* Apple red */
    }

    /* ── I. Bouton Détails : ghost, séparé par un divider ──────── */
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody td.mobile-cell-actions {
        grid-area: actions;
        justify-self: stretch;
        margin-top: 0.35rem !important;
        padding-top: 0.4rem !important;
        border-top: 1px solid var(--bs-border-color-translucent) !important;
    }
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody td.mobile-cell-actions .btn-stock-detail {
        width: 100%;
        min-height: 32px !important;
        height: 32px;
        padding: 0.25rem 0.5rem !important;
        font-size: 0.85rem;
        font-weight: 500;
        line-height: 1;
        border: none !important;
        background: transparent !important;
        color: var(--bs-primary) !important;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
    }
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody td.mobile-cell-actions .btn-stock-detail::after {
        content: " Détails";
        font-weight: 500;
        font-size: 0.85rem;
    }
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody td.mobile-cell-actions .btn-stock-detail:hover,
    #holdingsTable.table-mobile-cards:not(.mobile-full) tbody td.mobile-cell-actions .btn-stock-detail:active {
        background: var(--bs-tertiary-bg, rgba(0, 0, 0, 0.04)) !important;
        color: var(--bs-primary) !important;
    }

    /* ── J. Footer (totaux) : caché en compact, en card en mode full ── */
    #holdingsTable.table-mobile-cards:not(.mobile-full) tfoot {
        display: none !important;
    }
    #holdingsTable.table-mobile-cards.mobile-full tfoot tr {
        display: block;
        margin-top: 1rem;
        padding: 0.75rem;
        background: var(--bs-tertiary-bg, rgba(0, 0, 0, 0.03));
        border-radius: 0.5rem;
        border: 1px solid var(--bs-border-color);
    }

    /* ── K. Mode FULL : tap target boost sur le bouton actions ──── */
    #holdingsTable.table-mobile-cards.mobile-full tbody td.mobile-cell-actions .btn-stock-detail {
        min-height: 44px;
        min-width: 44px;
    }

    /* ── L. Cards mobile : retirer le max-width: 90vw global gênant ── */
    .table-mobile-cards tbody tr {
        max-width: 100% !important;
    }
}

/* ============================================
   §13. Treemap portfolio view (WinDirStat-like)
   ============================================ */

.treemap-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1rem;
    align-items: start;
}

/* Sidebar liste */
.treemap-sidebar {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    background: var(--bs-body-bg);
    overflow: hidden;
    max-height: 600px;
    display: flex;
    flex-direction: column;
}
.treemap-sidebar-header {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--bs-border-color);
    background: var(--bs-tertiary-bg, rgba(0, 0, 0, 0.03));
    font-size: 0.875rem;
}
.treemap-sidebar-header strong { font-size: 1rem; }
.treemap-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
}
.treemap-list-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--bs-border-color);
    font-size: 0.875rem;
    outline: none;
    transition: background-color 0.12s ease;
}
.treemap-list-item:last-child { border-bottom: none; }
.treemap-list-item:hover,
.treemap-list-item:focus-visible {
    background: var(--bs-tertiary-bg, rgba(13, 110, 253, 0.06));
}
.treemap-list-item.active {
    background: rgba(13, 110, 253, 0.12);
    font-weight: 600;
}
.treemap-list-item.active .treemap-color-dot {
    box-shadow: 0 0 0 2px var(--bs-primary, #0d6efd);
}
.treemap-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
    background: #ccc;
}
.treemap-list-ticker {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.treemap-list-weight {
    flex-shrink: 0;
    color: var(--bs-secondary-color, #6c757d);
    font-variant-numeric: tabular-nums;
    font-size: 0.8125rem;
}

/* Canvas treemap */
.treemap-canvas-wrapper {
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    background: var(--bs-body-bg);
}
.treemap-canvas-scroll {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}
#treemapCanvas {
    width: 100% !important;
    height: 600px !important;
    display: block;
}

/* Légende */
.treemap-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.8125rem;
    color: var(--bs-secondary-color, #6c757d);
}
.treemap-legend:empty { display: none; }
.treemap-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}
.treemap-legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
}

/* Panneau détail mobile (remplace le tooltip qui couvrait le canvas) */
.treemap-detail-panel { display: none; }

/* Mobile : sidebar masquée, canvas plein écran, panneau détail sous le canvas */
@media (max-width: 768px) {
    .treemap-layout {
        grid-template-columns: 1fr;
    }
    .treemap-sidebar {
        display: none;
    }
    .treemap-canvas-scroll {
        overflow-x: hidden;
    }
    #treemapCanvas {
        width: 100% !important;
        height: 380px !important;
    }
    .treemap-detail-panel[data-active="1"] {
        display: block;
        margin-top: 0.75rem;
        padding: 0.75rem;
        border: 1px solid var(--bs-border-color);
        border-radius: 0.5rem;
        background: var(--bs-tertiary-bg, rgba(0, 0, 0, 0.03));
        font-size: 0.875rem;
    }
    .treemap-detail-panel .tdp-title {
        font-weight: 700;
        font-size: 1rem;
        font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
        margin-bottom: 0.125rem;
    }
    .treemap-detail-panel .tdp-name {
        color: var(--bs-secondary-color, #6c757d);
        font-size: 0.8125rem;
        margin-bottom: 0.5rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .treemap-detail-panel .tdp-stats {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem 1rem;
        margin-bottom: 0.5rem;
        font-variant-numeric: tabular-nums;
    }
    .treemap-detail-panel .tdp-stat-label {
        color: var(--bs-secondary-color, #6c757d);
        margin-right: 0.25rem;
    }
    .treemap-detail-panel .tdp-pnl-pos { color: #198754; font-weight: 600; }
    .treemap-detail-panel .tdp-pnl-neg { color: #dc3545; font-weight: 600; }
    .treemap-detail-panel .tdp-breakdown {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--bs-border-color);
        font-size: 0.8125rem;
    }
    .treemap-detail-panel .tdp-breakdown-item {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    .treemap-detail-panel .tdp-swatch {
        width: 10px;
        height: 10px;
        border-radius: 2px;
        flex-shrink: 0;
    }
    .treemap-detail-panel .tdp-acc-name { flex: 1; min-width: 0; }
    .treemap-detail-panel .tdp-acc-value {
        color: var(--bs-secondary-color, #6c757d);
        font-variant-numeric: tabular-nums;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   §13. Stock Detail Modal — Fullscreen toggles pour les 3 charts + Analyse Approfondie
   - .chartjs-only-mode  → masque tout sauf le card Chart.js du haut
   - .tv-only-mode       → masque tout sauf le card TradingView du bas
   - .value-only-mode    → masque tout sauf le card "Valeur par compte"
   - .da-only-mode       → masque la colonne chart, étend la carte Analyse IA
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Mode Chart.js plein écran ── */
#stockDetailModal .modal-body.chartjs-only-mode .col-lg-4 {
    display: none;
}
#stockDetailModal .modal-body.chartjs-only-mode .col-lg-8 {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
}
#stockDetailModal .modal-body.chartjs-only-mode .col-lg-8 > *:not(#modalChartJsCard) {
    display: none !important;
}
#stockDetailModal .modal-body.chartjs-only-mode #modalChartJsContainer {
    height: calc(100vh - 220px) !important;
}

/* ── Mode TradingView plein écran ── */
#stockDetailModal .modal-body.tv-only-mode .col-lg-4 {
    display: none;
}
#stockDetailModal .modal-body.tv-only-mode .col-lg-8 {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
}
#stockDetailModal .modal-body.tv-only-mode .col-lg-8 > *:not(#modalTvChartCard) {
    display: none !important;
}
#stockDetailModal .modal-body.tv-only-mode #modalTvChart {
    height: calc(100vh - 200px) !important;
}

/* ── Badge "chargement historique" (lazy-load zoom-out façon TradingView) ── */
#modalTvChart {
    position: relative; /* ancre pour le badge ci-dessous */
}
#modalTvChart .tv-history-loading {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 5;
    background: rgba(19, 23, 34, 0.85);
    color: #d1d4dc;
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Mode chart "Valeur par compte" plein écran ── */
#stockDetailModal .modal-body.value-only-mode .col-lg-4 {
    display: none;
}
#stockDetailModal .modal-body.value-only-mode .col-lg-8 {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
}
#stockDetailModal .modal-body.value-only-mode .col-lg-8 > *:not(#modalValueByAccountCard) {
    display: none !important;
}
#stockDetailModal .modal-body.value-only-mode #modalValueByAccountContainer {
    height: calc(100vh - 220px) !important;
}

/* ── Mode Analyse Approfondie plein écran ── */
#stockDetailModal .modal-body.da-only-mode .col-lg-8 {
    display: none;
}
#stockDetailModal .modal-body.da-only-mode .col-lg-4 {
    width: 100%;
    max-width: 100%;
    flex: 0 0 100%;
}
#stockDetailModal .modal-body.da-only-mode .col-lg-4 > *:not(#modalDeepAnalysisCardWrapper) {
    display: none !important;
}

/* Dropdown "Indicateurs" — style TradingView (checkboxes inline) */
#modalChartIndicators .dropdown-menu label.dropdown-item {
    cursor: pointer;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}
#modalChartIndicators .dropdown-menu label.dropdown-item:hover {
    background-color: rgba(41, 98, 255, 0.08);
}
#modalChartIndicators .dropdown-menu input[type="checkbox"]:checked + span {
    font-weight: 600;
    color: #2962FF;
}
#modalChartIndicators .dropdown-header {
    font-size: 0.8125rem;
    letter-spacing: 0.05em;
    color: #6c757d;
}

/* ═══════════════════════════════════════════════════════════════════════════
   §14. Panneau Analyse Approfondie (portfolio) — mode plein écran
   ═══════════════════════════════════════════════════════════════════════════ */

#portfolio-analysis-panel.pda-fullscreen-mode {
    position: fixed;
    inset: 0;
    z-index: 1040;
    margin: 0;
    max-width: 100%;
    overflow-y: auto;
    background-color: var(--bg-primary);
}
#portfolio-analysis-panel.pda-fullscreen-mode .card {
    height: 100%;
    border-radius: 0;
}

#portfolioPerfCard.chart-fullscreen-mode {
    position: fixed;
    inset: 0;
    z-index: 1040;
    margin: 0;
    max-width: 100%;
    overflow-y: auto;
    background-color: var(--bg-primary);
    border-radius: 0;
}
#portfolioPerfCard.chart-fullscreen-mode .chart-container {
    height: calc(100vh - 160px) !important;
}

#currencyChartCard.chart-fullscreen-mode {
    position: fixed;
    inset: 0;
    z-index: 1040;
    margin: 0;
    max-width: 100%;
    overflow-y: auto;
    background-color: var(--bg-primary);
    border-radius: 0;
}
#currencyChartCard.chart-fullscreen-mode #currencyChartWrapper {
    height: calc(100vh - 160px) !important;
}

#compareChartCard.chart-fullscreen-mode {
    position: fixed;
    inset: 0;
    z-index: 1040;
    margin: 0;
    max-width: 100%;
    overflow-y: auto;
    background-color: var(--bg-primary);
    border-radius: 0;
}
#compareChartCard.chart-fullscreen-mode .card-body {
    height: calc(100vh - 120px) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   §15. Nouveautés (changelog) — splashscreen, historique, éditeur admin
   ═══════════════════════════════════════════════════════════════════════════ */

.changelog-lines .changelog-ico {
    display: inline-block;
    width: 1.2em;
    text-align: center;
}
.changelog-badge-nouveau {
    background-color: #198754; /* vert Bootstrap 'success' */
}
.changelog-badge-ameliore {
    background-color: #0d6efd; /* bleu Bootstrap 'primary' */
}
.changelog-badge-corrige {
    background-color: #fd7e14; /* orange Bootstrap 'warning'/'orange' */
}

/* ═══════════════════════════════════════════════════════════════════════════
   §16. Manuel d'utilisation — contenu du modal (#manualModal)
   ═══════════════════════════════════════════════════════════════════════════ */

#mn-sommaire {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
}
#mn-sommaire h6 {
    font-size: 0.8125rem;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
#mn-sommaire ol {
    margin: 0;
    padding-left: 20px;
}
#mn-sommaire li {
    padding: 2px 0;
    font-size: 0.9rem;
}

.mn-section {
    padding: 16px 0 4px;
    border-top: 1px solid var(--border-light);
}
.mn-section:first-of-type {
    border-top: none;
    padding-top: 0;
}
.mn-section h5 {
    margin-bottom: 8px;
}
.mn-intro {
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.5;
    margin-bottom: 10px;
}
.mn-texte {
    line-height: 1.55;
    margin-bottom: 10px;
}
.mn-etapes {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 11px;
}
.mn-etapes h6 {
    font-size: 0.8125rem;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.mn-etapes ol {
    margin: 0;
    padding-left: 19px;
}
.mn-etapes li {
    padding: 2px 0;
}
.mn-astuce,
.mn-attention {
    font-size: 0.92rem;
    line-height: 1.5;
    padding: 9px 13px;
    border-radius: 6px;
    margin-bottom: 11px;
}
.mn-astuce {
    background-color: rgba(13, 110, 253, 0.08);
    border: 1px solid rgba(13, 110, 253, 0.25);
}
.mn-attention {
    background-color: rgba(220, 53, 69, 0.08);
    border: 1px solid rgba(220, 53, 69, 0.25);
}
.mn-astuce::before {
    content: 'Astuce — ';
    font-weight: 600;
}
.mn-attention::before {
    content: 'Attention — ';
    font-weight: 600;
}

/* Impression du manuel : bornée par la classe posée sur <body>, distincte
   de l'impression générale du site (@media print plus haut). Sans cette
   séparation, imprimer le manuel imprimerait aussi la page derrière lui. */
@media print {
    body.impression-manuel > *:not(#manualModal) {
        display: none !important;
    }
    body.impression-manuel #manualModal {
        display: block !important;
        position: static;
        inset: auto;
        padding: 0;
        background: none;
    }
    body.impression-manuel #manualModal .modal-dialog {
        max-width: 100%;
        margin: 0;
    }
    body.impression-manuel #manualModal .modal-content {
        border: none;
        box-shadow: none;
    }
    body.impression-manuel #manualModal .modal-body {
        overflow: visible;
        max-height: none;
    }
    body.impression-manuel #manualModal .btn-close,
    body.impression-manuel #manualModal .modal-footer {
        display: none !important;
    }
    body.impression-manuel #mn-sommaire {
        background: none;
        border: none;
        padding: 0;
    }
    body.impression-manuel .mn-section,
    body.impression-manuel .mn-etapes,
    body.impression-manuel .mn-astuce,
    body.impression-manuel .mn-attention {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   §17. Vue Portefeuille — Carte de valeur unique + résumé IA promu +
   navigation réduite (onglet "Plus"). Remplace les 4 cartes KPI +
   9 onglets à plat par un écran hiérarchisé pour un public senior /
   mobile — cf. webUXUI.md.
   ═══════════════════════════════════════════════════════════════════ */

.portfolio-value-card {
    background: linear-gradient(155deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: #fff;
    border-radius: 16px;
    padding: 1.4rem 1.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
}
.portfolio-value-card .pvc-label {
    font-size: .9rem;
    opacity: .85;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.portfolio-value-card .pvc-amount {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -.01em;
    margin-top: .15rem;
}
.portfolio-value-card .pvc-delta {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-top: .6rem;
    background: rgba(255, 255, 255, .18);
    border-radius: 100px;
    padding: .3rem .8rem;
    font-weight: 700;
    font-size: .92rem;
}
.portfolio-value-card .pvc-delta .pvc-pct { opacity: .85; font-weight: 400; }
.portfolio-value-card .pvc-footnote {
    font-size: .82rem;
    opacity: .78;
    margin-top: .75rem;
}

.portfolio-ai-summary {
    background: var(--bg-hover, #f1eefc);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: .9rem 1.1rem;
    display: flex;
    gap: .8rem;
    align-items: flex-start;
    height: 100%;
}
.portfolio-ai-summary .pas-icon { font-size: 1.35rem; line-height: 1; flex-shrink: 0; color: var(--primary); }
.portfolio-ai-summary .pas-title { margin: 0; font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.portfolio-ai-summary p { margin: 0; font-size: .9rem; line-height: 1.45; color: var(--text-primary); }
.portfolio-ai-summary p + p { margin-top: .3rem; font-size: .9rem; color: var(--text-muted); font-weight: 400; }
.portfolio-ai-summary .pas-score { font-weight: 700; }
.portfolio-ai-summary a,
.portfolio-ai-summary button.pas-link {
    display: inline-block;
    margin-top: .4rem;
    font-weight: 700;
    font-size: .9375rem;
    color: var(--primary);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Bouton "Modifier" au contact du nom du portefeuille — plutôt que perdu
   dans une rangée d'actions séparée en haut à droite. */
.portfolio-edit-chip {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .875rem;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    border-radius: 8px;
    padding: .3rem .6rem;
    text-decoration: none;
    line-height: 1;
}
.portfolio-edit-chip:hover { color: var(--primary-hover); background: var(--primary-light); }

/* Onglet "Plus" — regroupe les onglets secondaires dans un menu déroulant
   au lieu de les afficher tous à plat (9 → 3 entrées visibles). */
.nav-tabs .nav-item.dropdown .nav-link.dropdown-toggle::after {
    vertical-align: middle;
    margin-left: .35rem;
}
.nav-tabs .nav-item.dropdown .dropdown-menu {
    font-size: .9rem;
}
.nav-tabs .nav-item.dropdown .dropdown-item.active,
.nav-tabs .nav-item.dropdown .dropdown-item.active:hover {
    background: var(--primary);
    color: #fff;
}
/* Le toggle "Plus" se met en évidence quand l'onglet actif est à l'intérieur */
.nav-tabs .nav-item.dropdown.has-active-child > .nav-link {
    color: var(--primary);
    font-weight: 700;
    border-bottom-color: var(--primary);
}

@media (max-width: 768px) {
    .portfolio-value-card .pvc-amount { font-size: 1.7rem; }
}

/* ═══════════════════════════════════════════════════════════════════
   §18. Tableau de bord — Hero patrimoine, cartes portefeuille (+
   mini-chart), accordéon marché replié par défaut. Reprend les
   variables de thème existantes (--primary, --success/--danger,
   --card-bg, --border-color…), aucune nouvelle couleur introduite —
   cf. webUXUI.md.
   ═══════════════════════════════════════════════════════════════════ */

.pcd-card {
    border: 1px solid var(--card-border);
}

.pcd-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
}

.pcd-perf-badge {
    font-size: .85rem;
    padding: .35rem .65rem;
    align-self: flex-start;
}

.pcd-chart-panel {
    border-top: 1px solid var(--border-light);
    margin-top: .5rem;
}

.pcd-chart-panel .pcd-chart-inner {
    padding-top: .75rem;
}

.pcd-chart-title {
    font-size: .8rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: .03em;
}

.pcd-chart-wrapper {
    height: 180px;
    position: relative;
}

/* Boutons tactiles ≥48px sur mobile (audit senior — cf. webUXUI.md) */
@media (max-width: 576px) {
    .pcd-card .btn {
        min-height: 48px;
    }
}

/* Accordéon marché : Bootstrap 5 pilote ses couleurs via les variables
   --bs-accordion-*, non mappées par défaut sur le design system du
   projet (qui vivent dans --card-bg/--border-color/--primary…). On les
   raccroche ici plutôt que de laisser Bootstrap imposer ses couleurs
   par défaut (bleu clair) dans les thèmes dark/blue/classic-dark. */
#marketAccordion.accordion {
    --bs-accordion-bg: var(--card-bg);
    --bs-accordion-border-color: var(--card-border);
    --bs-accordion-color: var(--text-primary);
    --bs-accordion-btn-color: var(--text-primary);
    --bs-accordion-btn-bg: var(--card-bg);
    --bs-accordion-active-bg: var(--bg-hover);
    --bs-accordion-active-color: var(--primary);
    --bs-accordion-btn-focus-box-shadow: 0 0 0 2px var(--primary-light);
}

/* Graphiques Devises / Indices boursiers : repliés par défaut sur mobile
   (denses, plusieurs séries superposées — difficiles à lire sur petit
   écran) derrière le bouton .dash-chart-toggle-btn, dépliables à la
   demande. Custom class plutôt que les utilitaires Bootstrap d-none/d-*
   (qui posent !important et empêcheraient le toggle JS de les battre). */
@media (max-width: 767.98px) {
    .dash-chart-mobile-wrap {
        display: none;
    }
    .dash-chart-mobile-wrap.dash-chart-visible {
        display: block;
    }
}


/* ═══════════════════════════════════════════════════════════════════
   §19. Accessibilité seniors (utilisateurs principaux : 70 ans et +)
   Règles transverses, volontairement globales : cibles tactiles,
   focus clavier visible, liens identifiables, animations réduites.
   ═══════════════════════════════════════════════════════════════════ */

/* Cibles : 40px minimum à la souris, 44px au doigt (WCAG 2.5.5). Les
   .btn-sm, très utilisés, étaient à ~31px — trop petits pour une main
   qui tremble ou une vue qui baisse. */
.btn,
.btn-sm,
.form-control,
.form-select,
.form-control-sm,
.form-select-sm,
.input-group-sm > .form-control,
.input-group-sm > .btn,
.input-group-sm > .input-group-text {
    min-height: 40px;
}
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* En flex, l'espace entre icône et texte est supprimé : gap le remplace. */
    gap: .4rem;
}
.dropdown-item {
    padding-top: .6rem;
    padding-bottom: .6rem;
}
@media (pointer: coarse) {
    .btn,
    .btn-sm,
    .form-control,
    .form-select,
    .form-control-sm,
    .form-select-sm,
    .input-group-sm > .form-control,
    .input-group-sm > .btn,
    .input-group-sm > .input-group-text {
        min-height: 44px;
    }
    .dropdown-item {
        padding-top: .8rem;
        padding-bottom: .8rem;
    }
    .form-check-input {
        width: 1.35em;
        height: 1.35em;
    }
}
/* Les boutons "fermer" (×) des modales : cible de 16px par défaut. */
.btn-close {
    width: 1.25em;
    height: 1.25em;
    padding: .6em;
}

/* Focus clavier : l'anneau Bootstrap (halo pâle 0.25rem) est presque
   invisible pour une vue faible. Contour plein, décalé, dans la couleur
   d'action du thème. */
:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    box-shadow: none;
}

/* Liens dans du texte courant : la couleur seule ne suffit pas à les
   repérer (daltonisme, contraste réduit) — soulignés. */
main p a:not(.btn),
main li a:not(.btn):not(.dropdown-item):not(.nav-link),
.alert a:not(.btn),
.modal-body p a:not(.btn) {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Mouvements réduits si le système le demande (vertiges, distraction). */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}
