/* ==========================================================================
   DESIGN SYSTEM & CSS RESET - LEVELING IRL (THEME SOMBRE MOBILE-FIRST)
   ========================================================================== */

:root {
    /* Color Palette */
    --bg-primary: #09090b;
    --bg-surface: #121216;
    --bg-surface-hover: #181820;
    --bg-card: #141419;
    --bg-card-hover: #1a1a21;
    
    --border-color: #23232b;
    --border-focus: #6366f1;
    
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    --primary: #5c5bf6;
    --primary-hover: #4f46e5;
    --primary-light: rgba(92, 91, 246, 0.15);
    
    --currency-star: #f59e0b; /* Étoile monnaie ✱ orangée */
    --currency-bg: rgba(245, 158, 11, 0.12);

    --success: #22c55e;
    --success-light: rgba(34, 197, 94, 0.15);
    --warning: #eab308;
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.15);
    --info: #3b82f6;

    /* Sizing & Radius */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    --header-height: 56px;
    --bottom-nav-height: 60px;
    --sidebar-width: 240px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

/* ==========================================================================
   RESET BASE
   ========================================================================== */

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

html, body {
    width: 100%;
    min-height: 100vh;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    background: none;
    border: none;
    outline: none;
}

button {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: var(--radius-sm);
    transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

button:active { transform: scale(0.98); }

/* ==========================================================================
   LAYOUT STRUCTURE (APP CONTAINER & MAIN CONTENT)
   ========================================================================== */

.app-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 100vh;
    padding: 24px 16px calc(var(--bottom-nav-height) + 24px) 16px;
}

.main-content {
    flex: 1;
    width: 100%;
    max-width: 100%;
}

/* En-têtes de page & Headers */
.dashboard-header-row, .page-title-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 20px;
}

.page-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.page-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Carte Utilisateur Solde de Points ✱ */
.user-balance-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--currency-bg);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    color: var(--currency-star);
}

.currency-star { color: var(--currency-star); font-weight: 800; }

/* ==========================================================================
   SIDEBAR DESKTOP REPLIABLE
   ========================================================================== */

.sidebar {
    display: none; /* Masquée sur mobile par défaut */
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-menu-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-user-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-info-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-name { font-weight: 700; font-size: 14px; color: var(--text-primary); }
.user-level { font-size: 11px; font-weight: 600; color: var(--primary); }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

.sidebar-item:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

.sidebar-item.active {
    background-color: var(--primary-light);
    color: #818cf8;
    font-weight: 600;
}

.sidebar-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Sidebar en Mode Replié (collapsed-sidebar) */
.sidebar.collapsed-sidebar {
    width: 72px !important;
    padding: 18px 8px !important;
}

.sidebar.collapsed-sidebar .sidebar-menu-title,
.sidebar.collapsed-sidebar .sidebar-item-text,
.sidebar.collapsed-sidebar .sidebar-user-card {
    display: none !important;
}

.sidebar.collapsed-sidebar .sidebar-header {
    justify-content: center !important;
    padding-bottom: 4px !important;
    border-bottom: none !important;
    width: 100% !important;
}

.sidebar.collapsed-sidebar .sidebar-toggle-btn {
    margin: 0 auto !important;
}

.sidebar.collapsed-sidebar .sidebar-item {
    justify-content: center !important;
    padding: 10px 0 !important;
}

/* ==========================================================================
   UTILITY CLASSES (MARGES, FLEX, TYPO, COULEURS)
   ========================================================================== */

.flex-1 { flex: 1; }
.w-full { width: 100%; }
.cursor-pointer { cursor: pointer; }

.mb-4 { margin-bottom: 4px; }
.mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; }
.mb-10 { margin-bottom: 10px; }
.mb-12 { margin-bottom: 12px; }
.mb-14 { margin-bottom: 14px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }

.mt-4 { margin-top: 4px; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mt-28 { margin-top: 28px; }
.mt-32 { margin-top: 32px; }

.my-6 { margin-top: 6px; margin-bottom: 6px; }
.my-8 { margin-top: 8px; margin-bottom: 8px; }
.my-10 { margin-top: 10px; margin-bottom: 10px; }
.my-12 { margin-top: 12px; margin-bottom: 12px; }

.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }

.d-flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-row { display: flex; flex-direction: row; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.text-purple { color: #818cf8; }
.text-emerald { color: #34d399; }
.text-amber { color: #f59e0b; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-danger { color: var(--danger) !important; }

.font-mono { font-family: 'JetBrains Mono', monospace; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

.bg-purple { background-color: var(--primary); }
.bg-emerald { background-color: var(--success); }
.bg-amber { background-color: var(--warning); }
.bg-muted-track { background-color: var(--text-muted); }
.bg-surface { background-color: var(--bg-surface); }

/* Progress Track & Bar & Footer Row */
.level-progress-card {
    display: flex;
    flex-direction: column;
}

.progress-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-subtitle {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.xp-counter {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: #818cf8;
}

.progress-track {
    width: 100%;
    background-color: var(--bg-surface);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-track-sm { height: 8px; }

.progress-bar {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.level-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

/* Carte Événement Hebdomadaire */
.event-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px;
}

.event-card-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.event-info {
    display: flex;
    flex-direction: column;
}

.event-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.event-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}

.event-timer-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background-color: var(--bg-surface);
    padding: 4px 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

/* ==========================================================================
   PAGE BOUTIQUE (CATALOGUE & INVENTAIRE)
   ========================================================================== */

.shop-balance-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 24px;
}

.shop-balance-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.shop-balance-amount {
    font-size: 20px;
    font-weight: 800;
    color: var(--currency-star);
    display: flex;
    align-items: center;
    gap: 6px;
}

.shop-section {
    width: 100%;
}

.section-title-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.shop-grid-two {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.shop-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.shop-card:hover {
    border-color: #2e2e38;
    background-color: var(--bg-card-hover);
}

.shop-card-category {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.shop-card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.35;
}

.shop-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}

.shop-card-price {
    font-size: 12px;
    font-weight: 700;
    color: var(--currency-star);
    display: flex;
    align-items: center;
    gap: 4px;
}

.inventory-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.inventory-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ==========================================================================
   PAGE NOTES (GRILLE, RECHERCHE & MASTER-DETAIL DESKTOP)
   ========================================================================== */

/* Barre d'Outils Formatage Rich-Text */
.note-formatting-toolbar {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 4px 8px;
}

.toolbar-btn {
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 4px 8px;
    font-size: 12px;
    height: 28px;
    min-width: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast), color var(--transition-fast);
}

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

.toolbar-btn .lucide {
    width: 14px;
    height: 14px;
}

/* Recommandations de Tags (Option 1) */
.tag-recommendations-box {
    margin-top: 10px;
    padding: 10px 12px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-md);
}

.tag-chip-btn {
    cursor: pointer;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: #818cf8;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.tag-chip-btn:hover {
    background-color: var(--primary-light);
    border-color: var(--primary);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Menu déroulant Autocomplétion de Tags à l'écriture */
.tag-autocomplete-dropdown {
    position: absolute;
    bottom: 100%;
    top: auto;
    left: 0;
    right: 0;
    z-index: 99999 !important;
    background-color: #1a1a24;
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.7);
    margin-bottom: 6px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.tag-autocomplete-item {
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

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

.tag-autocomplete-item:hover {
    background-color: var(--primary-light);
}

/* Panneau de filtres directement intégré sous la barre de recherche */
.inline-filter-panel {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
}

.inline-filter-panel .filter-input-box {
    position: relative;
}

.min-w-200 {
    min-width: 200px;
}

/* Sur Mobile Modale : déborder librement vers le haut sans découpage */
.modal-form, .modal-form .form-group {
    position: relative;
    overflow: visible !important;
}

/* Modale de Filtres des Notes : Ajustement Desktop compact centré */
@media (min-width: 1024px) {
    #modalFilterNotes .modal-container {
        max-width: 440px !important;
        width: 90% !important;
        margin: auto !important;
        border-radius: var(--radius-xl) !important;
        border: 1px solid var(--border-color) !important;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6) !important;
        transform: scale(0.95);
    }
    
    #modalFilterNotes.active .modal-container {
        transform: scale(1);
    }

    #modalFilterNotes .drag-handle {
        display: none;
    }

    /* Modales d'Ajout et Détail de Tâches : Ajustement Desktop compact centré */
    #modalAddTask .modal-container,
    #modalTaskDetail .modal-container {
        max-width: 540px !important;
        width: 90% !important;
        margin: auto !important;
        border-radius: var(--radius-xl) !important;
        border: 1px solid var(--border-color) !important;
        box-shadow: 0 24px 50px rgba(0, 0, 0, 0.7) !important;
    }

    #modalAddTask .drag-handle,
    #modalTaskDetail .drag-handle {
        display: none;
    }
}

/* Masquer la barre de défilement blanche native ("slider") sur les modales */
.modal-container,
#modalTaskDetail .modal-container,
#modalAddTask .modal-container,
#modalFilterNotes .modal-container {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.modal-container::-webkit-scrollbar,
#modalTaskDetail .modal-container::-webkit-scrollbar,
#modalAddTask .modal-container::-webkit-scrollbar,
#modalFilterNotes .modal-container::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Bouton Enregistrer agrandi en hauteur */
.btn-save-note {
    min-height: 40px !important;
    padding: 8px 22px !important;
    font-size: 14px !important;
    font-weight: 600;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Éditeur Rich Text Contenteditable */
.note-rich-editor {
    width: 100%;
    min-height: 220px;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.6;
    outline: none;
    padding: 8px 0;
    overflow-y: auto;
    word-wrap: break-word;
    word-break: break-word;
}

.note-rich-editor:empty::before {
    content: attr(placeholder);
    color: var(--text-muted);
    pointer-events: none;
    display: block;
}

.note-rich-editor h2 {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 12px 0 6px 0;
    border-bottom: none;
    padding-bottom: 0;
}

.note-rich-editor h3 {
    font-size: 14px;
    font-weight: 700;
    color: #818cf8;
    margin: 10px 0 4px 0;
}

.note-rich-editor strong, .note-rich-editor b {
    font-weight: 700;
    color: #ffffff;
}

.note-rich-editor hr {
    border: none;
    border-top: 1px dashed var(--border-color);
    margin: 14px 0;
}

.note-rich-editor ul {
    padding-left: 20px;
    margin: 8px 0;
}

.note-rich-editor li {
    margin-bottom: 4px;
}

.search-filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 12px;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input-wrapper .form-input {
    padding-left: 36px;
}

.notes-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.note-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.note-card:hover {
    border-color: #2e2e38;
    background-color: var(--bg-card-hover);
}

.note-card.active-note {
    border-color: var(--primary);
    background-color: #171722;
}

.note-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.note-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    user-select: text;
    -webkit-user-select: text;
}

.note-card-excerpt {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    user-select: text;
    -webkit-user-select: text;
}

.note-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

.note-desktop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.back-link-align {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
}

.back-link-align:hover { color: var(--text-primary); }

.note-category-footer {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

/* ==========================================================================
   PAGE PROFIL (EN-TÊTE & CARTES D'OPTIONS)
   ========================================================================== */

.profile-header {
    margin-bottom: 20px;
}

.profile-name {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 6px;
}

.profile-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-subtext {
    font-size: 12px;
    color: var(--text-muted);
}

.menu-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-item-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px;
    color: var(--text-primary);
    text-decoration: none;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.menu-item-card:hover {
    border-color: #2e2e38;
    background-color: var(--bg-card-hover);
}

.menu-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-item-icon {
    width: 18px;
    height: 18px;
    color: var(--primary);
    flex-shrink: 0;
}

.menu-item-text {
    font-size: 13px;
    font-weight: 600;
}

.menu-item-arrow {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

/* ==========================================================================
   FLATPICKR ERGONOMIE MOBILE LISIBILITÉ & HEURE TACTILE
   ========================================================================== */

.flatpickr-time {
    height: 52px !important;
    line-height: 52px !important;
    border-top: 1px solid var(--border-color) !important;
    margin-top: 10px !important;
    padding-top: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
}

.flatpickr-time .flatpickr-hour,
.flatpickr-time .flatpickr-minute {
    font-size: 20px !important;
    font-weight: 800 !important;
    color: var(--primary) !important;
    background: var(--bg-surface) !important;
    border-radius: 8px !important;
    padding: 2px 8px !important;
}

.flatpickr-time .flatpickr-time-separator {
    font-size: 20px !important;
    font-weight: 800 !important;
    color: var(--text-primary) !important;
}

/* ==========================================================================
   BARRE DE FILTRES PILLS
   ========================================================================== */

.filter-pills-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 14px;
    scrollbar-width: none;
}

.filter-pills-bar::-webkit-scrollbar { display: none; }

.pill-btn {
    padding: 5px 12px;
    border-radius: var(--radius-full);
    background-color: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid var(--border-color);
}

.pill-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }
.pill-btn.active { background-color: var(--primary); color: #ffffff; border-color: var(--primary); font-weight: 600; }

/* ==========================================================================
   BADGES, BOUTONS & COULEURS
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: var(--radius-md);
    font-size: 10px;
    font-weight: 500;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
}

.badge-primary {
    background-color: var(--primary-light);
    color: #818cf8;
    border-color: rgba(92, 91, 246, 0.3);
}

.badge-danger-subtle {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.35);
    font-weight: 600;
}

.badge-info-subtle {
    background-color: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border-color: rgba(59, 130, 246, 0.3);
}

.badge-success-subtle {
    background-color: rgba(34, 197, 94, 0.15);
    color: #34d399;
    border-color: rgba(34, 197, 94, 0.3);
}

.badge-amber-subtle {
    background-color: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border-color: rgba(245, 158, 11, 0.3);
}

.badge-secondary { background-color: var(--bg-surface); color: var(--text-secondary); }

.priority-dot { width: 7px; height: 7px; border-radius: var(--radius-full); background-color: #818cf8; }
.priority-dot-gray { background-color: #71717a; }
.priority-dot-blue { background-color: #3b82f6; }
.priority-dot-purple { background-color: #818cf8; }
.priority-dot-red { background-color: #ef4444; }

/* Buttons */
.btn { padding: 8px 14px; font-weight: 600; border-radius: var(--radius-md); font-size: 12px; }
.btn-sm { padding: 4px 10px; font-size: 11px; border-radius: var(--radius-sm); }
.btn-lg { padding: 10px 16px; font-size: 13px; }
.btn-block { width: 100%; }

.btn-primary { background-color: var(--primary); color: #ffffff; }
.btn-primary:hover { background-color: var(--primary-hover); }

.btn-secondary { background-color: #20202b; color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background-color: #282836; }

.btn-danger-outline { background-color: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger-outline:hover { background-color: var(--danger-light); }

.btn-icon-subtle {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
}

.btn-icon-subtle:hover { color: var(--text-primary); }

.btn-subtask-del {
    width: 21px !important;
    height: 21px !important;
    padding: 0 !important;
}

.btn-subtask-del svg, .btn-subtask-del i {
    width: 13px !important;
    height: 13px !important;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.btn-icon:hover { color: var(--text-primary); border-color: var(--border-focus); }

/* Forms & Cards */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px;
    margin-bottom: 12px;
    width: 100%;
}

.form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.form-label { font-size: 10px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.05em; text-transform: uppercase; }

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 8px 10px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 12px;
    transition: border-color var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--border-focus); }

.input-with-button {
    display: flex;
    gap: 8px;
    width: 100%;
}

.task-article-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 12px;
}

.task-title-frameless {
    font-size: 18px !important;
    font-weight: 800 !important;
    line-height: 1.3 !important;
    background: transparent !important;
    border: 1px transparent solid !important;
    padding: 3px 4px !important;
    border-radius: var(--radius-sm) !important;
    color: var(--text-primary) !important;
    width: 100%;
    outline: none;
    overflow: hidden;
    resize: none;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.task-title-frameless:focus {
    border-color: var(--border-focus) !important;
    background-color: var(--bg-surface) !important;
}

.task-desc-frameless {
    font-size: 13px !important;
    color: var(--text-secondary) !important;
    line-height: 1.5 !important;
    background: transparent !important;
    border: 1px transparent solid !important;
    padding: 4px 6px !important;
    border-radius: var(--radius-sm) !important;
    width: 100%;
    min-height: 180px;
    outline: none;
    resize: vertical;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.task-desc-frameless:focus {
    border-color: var(--border-focus) !important;
    background-color: var(--bg-surface) !important;
}

.grid-two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.dropdown-selector-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
    width: 100%;
}

.dropdown-selector-box:hover { border-color: var(--border-focus); }

.task-summary-box {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 12px;
}

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.summary-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.summary-value {
    font-size: 12px;
    font-weight: 600;
}

.summary-divider {
    border-top: 1px solid var(--border-color);
    margin: 8px 0;
}

.category-selection-list, .priority-selection-list, .categories-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.category-selection-list .menu-item-card,
.priority-selection-list .menu-item-card,
.category-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    text-align: left;
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.category-selection-list .menu-item-card:hover,
.priority-selection-list .menu-item-card:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--border-focus);
}

.segmented-control {
    display: flex;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 2px;
    gap: 2px;
}

.segmented-btn {
    flex: 1;
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
}

.segmented-btn.active {
    background-color: var(--primary);
    color: #ffffff;
    font-weight: 600;
}

/* ==========================================================================
   COMPOSANT : CARTE TÂCHE & DRAG AND DROP SORTABLEJS
   ========================================================================== */

.category-group { margin-bottom: 14px; }

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 2px;
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.category-title { display: flex; align-items: center; gap: 6px; }
.bullet-dot { font-size: 14px; color: var(--text-muted); font-weight: bold; }

.accordion-arrow {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.category-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 20px;
}

.task-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 10px 12px;
    cursor: grab;
    user-select: none;
    transition: border-color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast);
}

.task-card:active { cursor: grabbing; }
.task-card:hover { border-color: #2e2e38; background-color: var(--bg-card-hover); }
.task-card.active-card { border-color: var(--primary); background-color: #171722; }

.task-card.completed {
    opacity: 0.5;
    background-color: rgba(18, 18, 24, 0.5) !important;
    border-color: #1a1a22 !important;
}

.task-card.completed .task-title {
    text-decoration: line-through;
    color: var(--text-muted) !important;
}

.task-card.completed .task-xp-badge {
    opacity: 0.6;
}

.task-sortable-ghost {
    opacity: 0.3 !important;
    background-color: #1c1c28 !important;
    border: 1px dashed var(--primary) !important;
}

.task-sortable-chosen {
    background-color: #1d1d2b !important;
    border-color: var(--primary) !important;
}

.task-sortable-drag {
    opacity: 0.9 !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6) !important;
    transform: scale(1.02) !important;
}

.task-card-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }

.task-checkbox {
    position: relative;
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    border-radius: var(--radius-full);
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Hitbox tactile élargie invisible 44px x 44px */
.task-checkbox::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: transparent;
    z-index: 5;
}

.task-checkbox.checked { color: #ffffff; background-color: #22c55e; border: 1px solid #22c55e; }
.task-checkbox svg { width: 18px; height: 18px; pointer-events: none; }

.task-info { display: flex; flex-direction: column; min-width: 0; }
.task-title { font-weight: 600; font-size: 13px; color: var(--text-primary); }

.task-meta { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 10px; color: var(--text-muted); flex-wrap: wrap; }
.task-cat-badge { font-size: 9px; padding: 1px 5px; }

.task-card-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.task-xp-badge {
    background-color: #20202d;
    color: #818cf8;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-md);
}

.fab-btn {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 14px);
    right: 18px;
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    background-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 10px 20px -5px rgba(92, 91, 246, 0.5);
    z-index: 90;
}

/* ==========================================================================
   NAVIGATION BASSE MOBILE (BOTTOM-NAV)
   ========================================================================== */

.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--bottom-nav-height);
    background-color: #0d0d11;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    padding: 0 4px;
}

.bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    height: 100%;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
}

.bottom-nav .nav-item svg { width: 18px; height: 18px; stroke-width: 2px; }
.bottom-nav .nav-item.active { color: var(--primary); }

/* ==========================================================================
   MODALES & BOTTOM SHEETS
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal-container.bottom-sheet {
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    padding: 16px;
    box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.5);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-container.bottom-sheet { transform: translateY(0); }

.drag-handle { width: 32px; height: 4px; border-radius: var(--radius-full); background-color: var(--border-color); margin: 0 auto 12px auto; cursor: pointer; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-title { font-size: 15px; font-weight: 700; }
.modal-close { background: none; border: none; color: var(--text-muted); padding: 4px; border-radius: var(--radius-sm); }
.modal-close:hover { color: var(--text-primary); }

.modal-container.modal-center {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 440px;
    padding: 24px;
    margin: auto !important;
    transform: scale(0.95);
    transition: transform 0.25s ease;
}
.modal-overlay.active .modal-container.modal-center {
    transform: scale(1);
}

/* Correctif Icône Étoile dans les champs d'input (Formulaire de création) */
.input-icon-wrapper {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
}
.input-icon-wrapper .form-input {
    padding-left: 36px !important;
    width: 100% !important;
}
.input-icon-wrapper .input-icon {
    position: absolute !important;
    left: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 16px !important;
    height: 16px !important;
    color: var(--currency-star) !important;
    pointer-events: none !important;
}

/* Sidebar Repliée : Masquage complet de la carte utilisateur et du badge de solde */
.sidebar.collapsed-sidebar .sidebar-user-card {
    display: none !important;
}

/* ==========================================================================
   MEDIA QUERIES - RESPONSIVE MOBILE (< 1024px) & DESKTOP (>= 1024px)
   ========================================================================== */

@media (max-width: 1023px) {
    .page-title-header .btn-primary,
    .dashboard-header-row .btn-primary,
    .desktop-only-btn { display: none !important; }
    
    /* Gagner de l'espace visuel sur mobile : Masquer le badge +XP sur la liste principale */
    .task-card-right .task-xp-badge { display: none !important; }
    
    .desktop-task-editor-panel, .desktop-note-view-panel { display: none !important; }
    
    .desktop-dashboard-layout { display: flex; flex-direction: column; gap: 20px; }
    .dashboard-side-col { display: flex; flex-direction: column; width: 100%; }
    .dashboard-side-col .card { display: none !important; }

    .stats-header-row { flex-direction: column; align-items: flex-start; gap: 12px; }
    .stats-filter-control { width: 100% !important; }

    /* Calendrier Flatpickr ergonomique grand écran sur mobile */
    .flatpickr-calendar.open {
        width: 92vw !important;
        max-width: 360px !important;
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        z-index: 99999 !important;
        box-shadow: 0 15px 50px rgba(0, 0, 0, 0.85) !important;
        border: 1px solid var(--primary) !important;
        border-radius: 16px !important;
        padding: 14px !important;
        background: #14141d !important;
    }

    .flatpickr-day {
        height: 42px !important;
        line-height: 42px !important;
        font-size: 14px !important;
        font-weight: 600 !important;
    }

    .flatpickr-day.selected {
        background: var(--primary) !important;
        border-color: var(--primary) !important;
    }
}

@media (min-width: 1024px) {
    .bottom-nav, .fab-btn { display: none !important; }

    .app-container { flex-direction: row; padding: 0; min-height: 100vh; }

    .sidebar {
        display: flex !important;
        flex-direction: column;
        width: var(--sidebar-width);
        height: 100vh;
        position: sticky;
        top: 0;
        background-color: var(--bg-surface);
        border-right: 1px solid var(--border-color);
        padding: 18px 14px;
        gap: 16px;
        flex-shrink: 0;
    }

    .main-content { padding: 24px 32px; max-width: 1500px; }

    .modal-overlay { align-items: center; }
    .modal-container.bottom-sheet { width: 90%; max-width: 520px; border-radius: var(--radius-lg); transform: translateY(0); margin: auto; }

    .desktop-dashboard-layout { display: grid !important; grid-template-columns: 1.8fr 1fr !important; gap: 24px !important; align-items: start !important; width: 100% !important; }
    .dashboard-side-col { display: flex !important; flex-direction: column !important; width: 100% !important; }
    .dashboard-side-col .card { display: block !important; }

    .desktop-stats-middle-grid { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 20px !important; width: 100% !important; }

    .desktop-tasks-layout { display: flex; width: 100%; gap: 24px; align-items: start; }
    .desktop-tasks-layout .tasks-main-col { width: 100%; transition: width 0.25s ease; }
    .desktop-tasks-layout.has-active-task .tasks-main-col { width: 330px; flex-shrink: 0; }
    .desktop-task-editor-panel { display: none !important; flex: 1; width: 100%; }
    .desktop-tasks-layout.has-active-task .desktop-task-editor-panel { display: block !important; }

    .desktop-notes-layout { display: flex; width: 100%; gap: 24px; align-items: stretch; }
    .desktop-notes-layout .notes-main-col { width: 100%; transition: width 0.25s ease; }
    .desktop-notes-layout.has-active-note .notes-main-col { width: 380px; flex-shrink: 0; }
    .desktop-note-view-panel { 
        display: none !important; 
        flex: 1; 
        width: 100%; 
        min-height: 550px; 
        background-color: var(--bg-card); 
        border: 1px solid var(--border-color); 
        border-radius: var(--radius-lg); 
        padding: 24px; 
        flex-direction: column; 
        justify-content: space-between; 
    }
    .desktop-notes-layout.has-active-note .desktop-note-view-panel { display: flex !important; }
    .desktop-note-view-panel .task-desc-frameless { min-height: 340px !important; }
}

#modalNoteEditor .task-desc-frameless {
    min-height: 220px !important;
}

/* Toast Notification Translucide & Clics Traversants (Pass-through) */
.toastify {
    pointer-events: none !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0.9 !important;
}

/* ==========================================================================
   PAGE STATISTIQUES & HISTORIQUE
   ========================================================================== */

.stats-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stats-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-circle-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.back-circle-btn:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--border-focus);
}

/* 4 Cartes de Métriques Clés (Grid 4 colonnes Desktop / 2x2 Mobile) */
.stats-metrics-four {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .stats-metrics-four {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-metrics-four {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .metric-card {
        padding: 12px;
    }
    
    .metric-value {
        font-size: 15px;
    }
}

.metric-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color var(--transition-fast), transform var(--transition-fast);
}

.metric-card:hover {
    border-color: var(--border-focus);
    transform: translateY(-2px);
}

.metric-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-primary);
}

/* Infobulles / Tooltips interactifs au survol (PC) et au touch/clic (Mobile) */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background-color: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    font-size: 11px;
    font-weight: 600;
    padding: 5px 9px;
    border-radius: var(--radius-md);
    white-space: normal;
    max-width: 220px;
    width: max-content;
    text-align: center;
    pointer-events: none;
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 999;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
}

[data-tooltip]:hover::after,
[data-tooltip]:focus::after,
[data-tooltip]:active::after {
    display: block;
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.text-purple {
    color: #a855f7 !important;
}

.text-amber {
    color: #f59e0b !important;
}

.text-emerald {
    color: #10b981 !important;
}

/* Grille des Visualisations (Stacked 100% Full Width) */
.desktop-stats-middle-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
    width: 100%;
    box-sizing: border-box;
}

.chart-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    width: 100%;
    box-sizing: border-box;
}

.chart-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

/* Graphique en bâtons Épuré (Full-width, sans glow) */
.bar-chart-visual {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 140px;
    gap: 8px;
    padding: 16px 8px 4px 8px;
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    width: 100%;
    box-sizing: border-box;
}

.bar-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    height: 100%;
    justify-content: flex-end;
    gap: 8px;
    position: relative;
    cursor: pointer;
}

.bar-fill {
    width: 100%;
    max-width: 28px;
    background-color: var(--primary);
    border-radius: 4px 4px 0 0;
    transition: height 0.3s ease;
}

/* Sélection / Jour de Pic (Couleur violette distincte plate sans glow) */
.bar-fill.bg-purple {
    background-color: #a855f7 !important;
}

.bar-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}

.bar-label.text-purple {
    color: #a855f7 !important;
    font-weight: 700;
}

/* Répartition par Catégorie */
.category-dist-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    box-sizing: border-box;
}

.category-dist-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
}

.dist-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    width: 100%;
    box-sizing: border-box;
}

.dist-name {
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.dist-percent {
    white-space: nowrap;
    flex-shrink: 0;
}

.dist-bar-track {
    width: 100%;
    height: 8px;
    background-color: var(--bg-surface);
    border-radius: 999px;
    overflow: hidden;
}

.dist-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.bg-emerald { background-color: #10b981 !important; }
.bg-purple { background-color: #818cf8 !important; }
.bg-amber { background-color: #f59e0b !important; }
.bg-muted-track { background-color: #3f3f46 !important; }

.bar-w-15 { width: 15%; }
.bar-w-22 { width: 22%; }
.bar-w-28 { width: 28%; }
.bar-w-35 { width: 35%; }
.bar-w-50 { width: 50%; }
.bar-w-75 { width: 75%; }
.bar-w-100 { width: 100%; }

/* Historique d'activité des tâches complétées */
.completed-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.completed-task-row {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.completed-task-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.completed-task-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.completed-task-date {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
}

.completed-task-xp {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.task-card-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==========================================================================
   BOUTON ÉTOILE "MA JOURNÉE" & SUPPORT SORTABLEJS
   ========================================================================== */
.star-toggle-btn {
    background: none !important;
    border: none !important;
    padding: 2px;
    margin: 0;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.15s ease, transform 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.star-toggle-btn svg {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    fill: none;
    transition: fill 0.15s ease, stroke 0.15s ease, color 0.15s ease;
}

.star-toggle-btn:hover {
    color: #f59e0b;
    transform: scale(1.2);
}

.star-toggle-btn.active,
.star-toggle-btn.active svg {
    color: #f59e0b !important;
    fill: #f59e0b !important;
    stroke: #f59e0b !important;
}

/* Micro-animations lors du drag */
.task-card.task-sortable-ghost {
    opacity: 0.4;
    background: rgba(92, 91, 246, 0.15) !important;
    border: 1px dashed var(--primary) !important;
}

.task-card.task-sortable-chosen {
    background: var(--bg-card-hover) !important;
}

/* ==========================================================================
   SECTION : ROUTINES & SUIVI D'HABITUDES (STREAKS 🔥)
   ========================================================================== */

/* Header compact actions (Statistiques & Catégories dans le profil) */
.header-compact-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon-card {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.btn-icon-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon-card:active {
    transform: scale(0.95);
}

/* Grille des Habitudes (1 col mobile, 2 cols desktop) */
.habits-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 1024px) {
    .habits-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

/* Carte d'habitude - Flexbox 3 parties alignées verticalement au centre */
.habit-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.habit-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: var(--bg-card-hover);
}

/* Partie 1 (Gauche) : Coche Principale alignée verticalement au centre du bloc */
.habit-card-left {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: center;
}

/* Coche identique aux To-Do tasks mais +30% plus grande (Sans lueur / box-shadow) */
.habit-task-check.task-checkbox {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    box-shadow: none !important;
    transition: transform 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.habit-task-check.task-checkbox svg {
    width: 30px;
    height: 30px;
    stroke: currentColor;
    fill: none;
    transition: all 0.15s ease;
}

.habit-task-check.task-checkbox.checked {
    color: var(--success);
    box-shadow: none !important;
}

.habit-task-check.task-checkbox.checked svg {
    stroke: var(--success);
    fill: rgba(34, 197, 94, 0.15);
}

.habit-task-check.task-checkbox:hover {
    transform: scale(1.15);
    color: var(--success);
}

/* Partie 2 (Milieu) : Titre, Sous-titre & Bulles (flex: 1) */
.habit-card-middle {
    flex: 1;
    min-width: 0;
}

.habit-title {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.habit-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Partie 3 (Droite) : Streak Badge Colonne (Flamme AU-DESSUS du texte) */
.habit-card-right {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    align-self: flex-end;
    flex-shrink: 0;
    margin-left: 8px;
}

.streak-badge-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
    background: transparent !important;
    border: none !important;
    padding: 0;
}

.streak-badge-col.active {
    color: #22c55e;
}

.streak-fire-icon {
    width: 22px;
    height: 22px;
    stroke-width: 2.2px;
    stroke: currentColor;
    fill: currentColor;
}

/* Bulles des jours (L M M J V S D) et Semaines (S30 S31 S32 S33) */
.habit-bubbles-row {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
}

.habit-bubble-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.bubble-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.bubble-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: all 0.15s ease;
}

.bubble-dot i, .bubble-dot svg {
    width: 12px;
    height: 12px;
    stroke-width: 3.5px;
    color: #ffffff;
    opacity: 0;
}

.bubble-dot.checked {
    background: var(--primary);
    color: #ffffff;
}

.bubble-dot.checked i, .bubble-dot.checked svg {
    opacity: 1;
}

/* Bouton d'ajout de routine */
.btn-add-habit-trigger {
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 14px;
    color: var(--text-secondary);
    font-weight: 600;
    transition: all var(--transition-fast);
}

.btn-add-habit-trigger:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    color: var(--primary);
}

/* Controls Modale (Segmented Control & Toggle Switch) */
.segmented-control {
    display: flex;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 3px;
    gap: 4px;
}

.segmented-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    transition: all var(--transition-fast);
}

.segmented-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(92, 91, 246, 0.3);
}

/* Switch Toggle Component */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.15);
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Bouton Danger Subtle (Archivage / Suppression - Plus petit et discret) */
.btn-danger-subtle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 38px !important;
    padding: 0 12px !important;
    margin-top: 10px !important;
    background: rgba(239, 68, 68, 0.08) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    text-align: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}
.btn-danger-subtle:hover {
    background: rgba(239, 68, 68, 0.16) !important;
    border-color: rgba(239, 68, 68, 0.35) !important;
}

/* Formulaire d'objectif côte à côte */
.habit-objective-row {
    display: flex !important;
    flex-direction: row !important;
    gap: 12px !important;
    align-items: center !important;
    width: 100% !important;
}

.habit-objective-row .form-input {
    flex: 1 1 50% !important;
    width: 50% !important;
    min-width: 0 !important;
}

/* Bloc Rappel / Notification dans la modale (Pixel Perfect Image 1 & 2) */
.form-group-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 14px 16px !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 14px !important;
    margin-bottom: 24px !important;
}

.toggle-info-left {
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
}

.toggle-icon-circle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    height: 44px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border-radius: 50% !important;
    flex-shrink: 0 !important;
}

.toggle-icon-circle i,
.toggle-icon-circle svg {
    width: 22px !important;
    height: 22px !important;
    stroke: #ffffff !important;
    stroke-width: 2 !important;
    color: #ffffff !important;
}

.toggle-title {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    line-height: 1.2 !important;
    margin-bottom: 2px !important;
}

.toggle-subtitle {
    font-size: 13px !important;
    font-weight: 400 !important;
    color: rgba(255, 255, 255, 0.5) !important;
    line-height: 1.2 !important;
}

/* Switch iOS / Dark Theme Pixel Perfect (Image 2) */
.form-group-toggle .switch {
    position: relative !important;
    display: inline-block !important;
    width: 50px !important;
    height: 28px !important;
    flex-shrink: 0 !important;
}

.form-group-toggle .switch input {
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
}

.form-group-toggle .slider {
    position: absolute !important;
    cursor: pointer !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background-color: rgba(255, 255, 255, 0.15) !important;
    transition: 0.3s ease !important;
    border-radius: 28px !important;
}

.form-group-toggle .slider:before {
    position: absolute !important;
    content: "" !important;
    height: 22px !important;
    width: 22px !important;
    left: 3px !important;
    bottom: 3px !important;
    background-color: #ffffff !important;
    transition: 0.3s ease !important;
    border-radius: 50% !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

.form-group-toggle input:checked + .slider {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%) !important;
}

.form-group-toggle input:checked + .slider:before {
    transform: translateX(22px) !important;
}

/* ==========================================================================
   MODALE DE GESTION DES CATÉGORIES (#modalCategories)
   ========================================================================== */

/* Ligne d'ajout de catégorie (Input + Bouton Créer côte à côte) */
.category-add-row {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
}

.category-add-row .form-input {
    flex: 1 1 auto !important;
    height: 46px !important;
}

.btn-add-cat {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 46px !important;
    padding: 0 22px !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    border-radius: var(--radius-md, 10px) !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
}

/* Ligne d'élément de catégorie */
.category-item-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 14px 16px !important;
    background: var(--bg-surface, #15151c) !important;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08)) !important;
    border-radius: var(--radius-lg, 12px) !important;
    margin-bottom: 10px !important;
}

.category-item-left {
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
    flex: 1 !important;
    min-width: 0 !important;
}

.category-item-left i,
.category-item-left svg {
    display: inline-block !important;
    width: 20px !important;
    height: 20px !important;
    stroke: var(--text-secondary, rgba(255, 255, 255, 0.6)) !important;
    stroke-width: 2 !important;
    vertical-align: middle !important;
    flex-shrink: 0 !important;
}

.category-name-text {
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    color: #ffffff !important;
    line-height: 1.3 !important;
    display: inline-block !important;
    vertical-align: middle !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* Barre de progression XP de la Sidebar Desktop */
.sidebar-xp-bar-wrapper {
    width: 100% !important;
    height: 6px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border-radius: 6px !important;
    overflow: hidden !important;
    margin-top: 8px !important;
}

.sidebar-xp-bar-fill {
    height: 100% !important;
    background: linear-gradient(90deg, #6366f1 0%, #a855f7 100%) !important;
    border-radius: 6px !important;
    transition: width 0.4s ease !important;
}



