/* ============================================================
   UX BOOST — 20 améliorations design & expérience utilisateur
   Luafi.com · Chargé en dernier, surcharge uniquement
   ============================================================ */

/* ============================================================
   AMÉLIORATION #1 — DESIGN SYSTEM COHÉRENT
   Palette raffinée, sémantique claire, compat ascendante
   ============================================================ */
:root {
    /* Couleur primaire raffinée - Indigo plus profond */
    --ux-primary: #4f46e5;
    --ux-primary-hover: #4338ca;
    --ux-primary-soft: #eef2ff;
    --ux-primary-softer: #f5f7ff;

    /* Couleurs sémantiques raffinées */
    --ux-success: #059669;
    --ux-success-soft: #ecfdf5;
    --ux-warning: #d97706;
    --ux-warning-soft: #fffbeb;
    --ux-danger: #dc2626;
    --ux-danger-soft: #fef2f2;
    --ux-info: #0284c7;
    --ux-info-soft: #f0f9ff;

    /* Neutres avec une touche de chaleur */
    --ux-gray-50: #fafafa;
    --ux-gray-100: #f4f4f5;
    --ux-gray-200: #e4e4e7;
    --ux-gray-300: #d4d4d8;
    --ux-gray-400: #a1a1aa;
    --ux-gray-500: #71717a;
    --ux-gray-600: #52525b;
    --ux-gray-700: #3f3f46;
    --ux-gray-800: #27272a;
    --ux-gray-900: #18181b;

    /* Surfaces */
    --ux-surface: #ffffff;
    --ux-surface-raised: #ffffff;
    --ux-surface-sunken: #fafafa;
    --ux-surface-overlay: rgba(255, 255, 255, 0.96);

    /* Override des variables existantes pour cohérence */
    --primary-color: var(--ux-primary);
    --primary-hover: var(--ux-primary-hover);
    --primary-light: #818cf8;
    --primary-lighter: var(--ux-primary-soft);
    --text-primary: var(--ux-gray-900);
    --text-secondary: var(--ux-gray-600);
    --text-muted: var(--ux-gray-500);
    --bg-primary: var(--ux-surface);
    --bg-secondary: var(--ux-surface-sunken);
    --bg-tertiary: var(--ux-gray-100);
    --border-color: var(--ux-gray-200);

    /* Rayons plus modernes */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-2xl: 28px;
    --radius-full: 9999px;

    /* Espacements fluides */
    --spacing-xs: 0.375rem;
    --spacing-sm: 0.625rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2.25rem;
    --spacing-2xl: 3.5rem;

    /* Transitions standardisées - spring easing */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --transition-fast: 120ms var(--ease-out);
    --transition-normal: 200ms var(--ease-out);
    --transition-slow: 350ms var(--ease-out);
    --transition-spring: 400ms var(--ease-spring);

    /* Ombres douces et cohérentes */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -2px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 12px 28px -6px rgba(15, 23, 42, 0.10), 0 6px 12px -4px rgba(15, 23, 42, 0.05);
    --shadow-xl: 0 24px 48px -12px rgba(15, 23, 42, 0.16), 0 12px 24px -8px rgba(15, 23, 42, 0.08);
    --shadow-2xl: 0 32px 64px -16px rgba(15, 23, 42, 0.24);
    --shadow-colored: 0 8px 24px -6px rgba(79, 70, 229, 0.32), 0 4px 8px -2px rgba(79, 70, 229, 0.18);

    /* Anneau de focus accessible */
    --ux-ring: 0 0 0 3px rgba(79, 70, 229, 0.18);
    --ux-ring-danger: 0 0 0 3px rgba(220, 38, 38, 0.18);
}

/* ============================================================
   AMÉLIORATION #2 — TYPOGRAPHIE AÉRÉE
   ============================================================ */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11', 'ss01';
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.011em;
    background: var(--ux-surface-sunken);
}

h1, h2, h3, h4, h5, h6 {
    letter-spacing: -0.025em;
    font-weight: 700;
    line-height: 1.2;
}

.logo-text {
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--ux-primary) 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================================
   AMÉLIORATION #3 — CONTRASTES AA
   ============================================================ */
.text-muted, .text-secondary,
.todo-meta, .todo-subtitle,
.empty-subtitle,
.footer {
    color: var(--ux-gray-600) !important;
}

.connection-status {
    color: var(--ux-gray-600);
    font-weight: 500;
}

/* Liens : contraste suffisant */
a {
    color: var(--ux-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover {
    color: var(--ux-primary-hover);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1.5px;
}

/* ============================================================
   AMÉLIORATION #4 — CARTES ET OMBRES DOUCES
   ============================================================ */
.todo-list,
.todo-form-compact .form,
.unified-filters-compact,
.settings-content,
.bulk-actions-bar,
.profile-card,
.timer-panel {
    box-shadow: var(--shadow-md) !important;
    border: 1px solid var(--ux-gray-200) !important;
    background: var(--ux-surface) !important;
}

main .container .todo-list {
    border-radius: var(--radius-xl) !important;
    overflow: hidden;
}

/* ============================================================
   AMÉLIORATION #5 — RADIUS COHÉRENTS + FOCUS ACCESSIBLE
   ============================================================ */
input, select, textarea, button {
    border-radius: var(--radius-md);
}

/* Anneau de focus visible partout */
*:focus-visible {
    outline: none !important;
    box-shadow: var(--ux-ring) !important;
    border-radius: var(--radius-md);
    transition: box-shadow var(--transition-fast);
}

/* Bouton danger focus */
button.danger:focus-visible,
.todo-btn.delete:focus-visible,
.bulk-delete-btn:focus-visible {
    box-shadow: var(--ux-ring-danger) !important;
}

/* ============================================================
   AMÉLIORATION #6 — TODO ITEMS : CARTES SCANNABLES
   ============================================================ */
.todo-item {
    padding: var(--spacing-md) var(--spacing-lg) !important;
    border-bottom: 1px solid var(--ux-gray-100) !important;
    transition: background var(--transition-fast), transform var(--transition-fast),
                box-shadow var(--transition-fast) !important;
    position: relative;
}

.todo-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    transition: background var(--transition-fast);
}

.todo-item:hover {
    background: var(--ux-primary-softer) !important;
    transform: translateX(2px);
}

.todo-item:hover::before {
    background: var(--ux-primary);
}

.todo-item.completed {
    background: var(--ux-gray-50) !important;
    opacity: 1;
}

.todo-item.completed .todo-text {
    text-decoration: line-through;
    text-decoration-color: var(--ux-gray-400);
    text-decoration-thickness: 1.5px;
    color: var(--ux-gray-500);
}

.todo-item.completed::before {
    background: var(--ux-success);
}

.todo-text {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.5;
}

/* ============================================================
   AMÉLIORATION #7 — FORMULAIRES MODERNES
   ============================================================ */
.input-lg,
.search-input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
textarea,
select {
    border: 1.5px solid var(--ux-gray-200) !important;
    border-radius: var(--radius-md) !important;
    background: var(--ux-surface) !important;
    color: var(--ux-gray-900) !important;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
                background var(--transition-fast) !important;
    font-size: 0.95rem !important;
}

.input-lg::placeholder,
.search-input::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--ux-gray-400);
}

.input-lg:focus,
.search-input:focus,
input:focus,
textarea:focus,
select:focus {
    border-color: var(--ux-primary) !important;
    box-shadow: var(--ux-ring) !important;
    outline: none !important;
}

/* Boutons : aspect moderne */
.btn-lg,
.btn-primary,
.todo-composer-submit button,
button[type="submit"] {
    background: var(--ux-primary) !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--radius-md) !important;
    font-weight: 600 !important;
    padding: 0.625rem 1.25rem !important;
    transition: background var(--transition-fast), transform var(--transition-fast),
                box-shadow var(--transition-fast) !important;
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.24), 0 2px 8px -2px rgba(79, 70, 229, 0.24) !important;
}

.btn-lg:hover,
.btn-primary:hover,
.todo-composer-submit button:hover,
button[type="submit"]:hover {
    background: var(--ux-primary-hover) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -2px rgba(79, 70, 229, 0.4) !important;
}

.btn-lg:active,
.btn-primary:active,
.todo-composer-submit button:active,
button[type="submit"]:active {
    transform: translateY(0);
}

/* ============================================================
   AMÉLIORATION #8 — BADGES PRIORITÉ LISIBLES
   ============================================================ */
.priority-badge,
.todo-priority,
.priority-indicator {
    font-weight: 600 !important;
    font-size: 0.75rem !important;
    padding: 0.25rem 0.625rem !important;
    border-radius: var(--radius-full) !important;
    display: inline-flex !important;
    align-items: center;
    gap: 0.375rem;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.priority-badge::before,
.todo-priority::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.priority-badge.priority-urgent,
.todo-priority.priority-urgent {
    background: var(--ux-danger-soft) !important;
    color: var(--ux-danger) !important;
}

.priority-badge.priority-high,
.todo-priority.priority-high {
    background: var(--ux-warning-soft) !important;
    color: var(--ux-warning) !important;
}

.priority-badge.priority-medium,
.todo-priority.priority-medium {
    background: var(--ux-info-soft) !important;
    color: var(--ux-info) !important;
}

.priority-badge.priority-low,
.todo-priority.priority-low {
    background: var(--ux-success-soft) !important;
    color: var(--ux-success) !important;
}

/* Bandeau gauche coloré selon priorité */
.todo-item[data-priority="urgent"]::before { background: var(--ux-danger); }
.todo-item[data-priority="high"]::before { background: var(--ux-warning); }
.todo-item[data-priority="medium"]::before { background: var(--ux-info); }
.todo-item[data-priority="low"]::before { background: var(--ux-success); }
.todo-item[data-priority="none"]::before,
.todo-item[data-priority=""]::before { background: transparent; }
.todo-item[data-priority="urgent"]:hover::before,
.todo-item[data-priority="high"]:hover::before,
.todo-item[data-priority="medium"]:hover::before,
.todo-item[data-priority="low"]:hover::before { background: currentColor; opacity: 0.9; }

/* ============================================================
   AMÉLIORATION #9 — FAB AVEC LABELS + FEEDBACK
   ============================================================ */
.floating-actions {
    left: 24px;
    gap: 12px;
}

.floating-btn {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-lg) !important;
    position: relative;
    transition: all var(--transition-spring) !important;
}

.floating-btn:hover {
    transform: scale(1.06) !important;
    box-shadow: var(--shadow-xl) !important;
}

.floating-btn:active {
    transform: scale(0.96) !important;
}

/* Tooltip label au survol */
.floating-btn::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(-6px);
    background: var(--ux-gray-900);
    color: #fff;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.floating-btn:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

.floating-btn-count {
    background: var(--ux-primary) !important;
    color: #fff !important;
    font-size: 0.6875rem;
    font-weight: 700;
    border: 2px solid var(--ux-surface);
}

/* ============================================================
   AMÉLIORATION #10 — FILTRES EN PILLS UNIFIÉS
   ============================================================ */
.priority-filter-btn,
.status-filter-btn,
.filter-btn,
.view-btn {
    border-radius: var(--radius-full) !important;
    font-weight: 600 !important;
    font-size: 0.8125rem !important;
    padding: 0.5rem 0.875rem !important;
    transition: all var(--transition-fast) !important;
    border: 1.5px solid transparent !important;
    background: var(--ux-surface) !important;
    color: var(--ux-gray-600) !important;
    box-shadow: var(--shadow-xs) !important;
}

.priority-filter-btn:hover,
.status-filter-btn:hover,
.filter-btn:hover,
.view-btn:hover {
    background: var(--ux-primary-soft) !important;
    color: var(--ux-primary) !important;
    border-color: var(--ux-primary-soft) !important;
}

.priority-filter-btn.active,
.status-filter-btn.active,
.filter-btn.active,
.view-btn.active {
    background: var(--ux-primary) !important;
    color: #fff !important;
    border-color: var(--ux-primary) !important;
    box-shadow: 0 4px 12px -2px rgba(79, 70, 229, 0.4) !important;
}

/* ============================================================
   AMÉLIORATION #11 — ANIMATIONS SPRING + REDUCED MOTION
   ============================================================ */
@keyframes ux-fade-up {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes ux-pop-in {
    0%   { opacity: 0; transform: scale(0.96); }
    60%  { opacity: 1; transform: scale(1.02); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes ux-shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.todo-item {
    animation: ux-fade-up 280ms var(--ease-out) both;
}

.todo-item:nth-child(n+8) {
    animation: none; /* évite le flash sur longues listes */
}

/* Respect des préférences utilisateur */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .todo-item,
    .floating-btn,
    .btn-lg,
    .btn-primary {
        animation: none !important;
    }
}

/* ============================================================
   AMÉLIORATION #12 — EMPTY STATES CHALEUREUX
   ============================================================ */
.empty-state {
    padding: var(--spacing-2xl) var(--spacing-xl) !important;
    background: linear-gradient(180deg, var(--ux-surface) 0%, var(--ux-primary-softer) 100%) !important;
    border-radius: var(--radius-2xl) !important;
    border: 1.5px dashed var(--ux-gray-200) !important;
}

.empty-state p {
    color: var(--ux-gray-700) !important;
    font-weight: 600 !important;
    font-size: 1.0625rem !important;
    background: none !important;
    -webkit-text-fill-color: var(--ux-gray-700) !important;
}

.empty-subtitle {
    color: var(--ux-gray-500) !important;
    font-size: 0.9375rem !important;
    margin-top: 0.5rem;
}

.empty-state svg {
    color: var(--ux-primary) !important;
    opacity: 0.8;
}

/* ============================================================
   AMÉLIORATION #13 — FOCUS MODE IMMERSIF
   ============================================================ */
body.focus-mode .main,
body.extreme-focus .main {
    background: radial-gradient(ellipse at center, var(--ux-surface) 0%, var(--ux-gray-100) 100%);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    padding: var(--spacing-xl) !important;
    margin: var(--spacing-lg) auto !important;
    max-width: 920px;
}

body.focus-mode .header,
body.extreme-focus .header {
    opacity: 0.55;
    transition: opacity var(--transition-normal);
}

body.focus-mode .header:hover,
body.extreme-focus .header:hover {
    opacity: 1;
}

body.focus-mode .floating-actions,
body.extreme-focus .floating-actions {
    opacity: 0.4;
    transition: opacity var(--transition-normal);
}

body.focus-mode .floating-actions:hover,
body.extreme-focus .floating-actions:hover {
    opacity: 1;
}

/* ============================================================
   AMÉLIORATION #14 — SIDEBAR PLUS CLAIRE
   ============================================================ */
.view-controls-sidebar {
    background: var(--ux-surface) !important;
    border: 1px solid var(--ux-gray-200) !important;
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-sm) !important;
    padding: 0.625rem !important;
    gap: 0.25rem !important;
}

.view-btn {
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    justify-content: center !important;
    border-radius: var(--radius-md) !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    position: relative;
}

.view-btn:hover {
    background: var(--ux-primary-soft) !important;
    color: var(--ux-primary) !important;
    transform: none !important;
}

.view-btn.active {
    background: var(--ux-primary-soft) !important;
    color: var(--ux-primary) !important;
    box-shadow: none !important;
}

.view-btn.active::after {
    content: '';
    position: absolute;
    left: -0.625rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--ux-primary);
    border-radius: 0 2px 2px 0;
}

.view-btn-shortcut {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 0.5625rem !important;
    font-weight: 700;
    color: var(--ux-gray-400);
    background: transparent !important;
}

.sidebar-separator {
    height: 1px !important;
    background: var(--ux-gray-200) !important;
    margin: 0.375rem 0.25rem !important;
}

/* ============================================================
   AMÉLIORATION #15 — MOBILE : TOUCH TARGETS + SAFE AREA
   ============================================================ */
@media (max-width: 768px) {
    /* Safe areas pour notches */
    .header,
    .main,
    .footer,
    .floating-actions {
        padding-top: env(safe-area-inset-top, 0);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    .floating-actions {
        left: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0));
        top: auto !important;
        transform: none !important;
        flex-direction: row;
    }

    /* Touch targets minimum 44px */
    .todo-btn,
    .floating-btn,
    .view-btn,
    .filter-btn,
    .priority-filter-btn,
    .status-filter-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .todo-checkbox {
        width: 28px !important;
        height: 28px !important;
    }

    .todo-item {
        padding: 0.875rem 1rem !important;
    }

    .todo-text {
        font-size: 0.9375rem !important;
    }

    /* Toujours afficher les actions sur mobile */
    .todo-actions {
        opacity: 1 !important;
    }

    /* Sidebar transformée en bottom bar sur mobile */
    .view-controls-sidebar {
        position: fixed;
        bottom: calc(12px + env(safe-area-inset-bottom, 0));
        left: 50%;
        transform: translateX(-50%);
        flex-direction: row !important;
        max-width: calc(100vw - 24px);
        overflow-x: auto;
        z-index: 90;
    }

    .view-controls-sidebar .sidebar-section {
        flex-direction: row !important;
    }

    .view-btn-shortcut {
        display: none !important;
    }
}

/* ============================================================
   AMÉLIORATION #16 — DARK MODE RAFFINÉ
   ============================================================ */
body.dark,
[data-theme="dark"] {
    --ux-surface: #0f1117;
    --ux-surface-raised: #181a23;
    --ux-surface-sunken: #0a0c12;
    --ux-surface-overlay: rgba(24, 26, 35, 0.96);
    --ux-gray-50: #181a23;
    --ux-gray-100: #1f2230;
    --ux-gray-200: #2a2e3d;
    --ux-gray-300: #3f4458;
    --ux-gray-400: #6b7187;
    --ux-gray-500: #9aa0b6;
    --ux-gray-600: #c2c8db;
    --ux-gray-700: #dde2ee;
    --ux-gray-800: #eef0f6;
    --ux-gray-900: #f5f6fa;

    --bg-primary: var(--ux-surface);
    --bg-secondary: var(--ux-surface-sunken);
    --bg-tertiary: var(--ux-gray-100);
    --text-primary: var(--ux-gray-900);
    --text-secondary: var(--ux-gray-600);
    --text-muted: var(--ux-gray-500);
    --border-color: var(--ux-gray-200);

    --ux-primary-soft: rgba(79, 70, 229, 0.18);
    --ux-primary-softer: rgba(79, 70, 229, 0.08);

    background: var(--ux-surface-sunken) !important;
    color: var(--ux-gray-900) !important;
}

body.dark .todo-list,
body.dark .todo-form-compact .form,
body.dark .unified-filters-compact,
body.dark .settings-content,
body.dark .bulk-actions-bar,
body.dark .view-controls-sidebar,
[data-theme="dark"] .todo-list,
[data-theme="dark"] .todo-form-compact .form,
[data-theme="dark"] .unified-filters-compact,
[data-theme="dark"] .settings-content,
[data-theme="dark"] .bulk-actions-bar,
[data-theme="dark"] .view-controls-sidebar {
    background: var(--ux-surface) !important;
    border-color: var(--ux-gray-200) !important;
}

body.dark .todo-item:hover,
[data-theme="dark"] .todo-item:hover {
    background: var(--ux-gray-100) !important;
}

body.dark .input-lg,
body.dark input,
body.dark textarea,
body.dark select,
[data-theme="dark"] .input-lg,
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: var(--ux-gray-100) !important;
    color: var(--ux-gray-900) !important;
    border-color: var(--ux-gray-200) !important;
}

/* ============================================================
   AMÉLIORATION #17 — CHECKBOX ANIMÉE SATISFAISANTE
   ============================================================ */
.todo-checkbox {
    width: 22px !important;
    height: 22px !important;
    border-radius: 7px !important;
    border: 2px solid var(--ux-gray-300) !important;
    background: var(--ux-surface) !important;
    transition: all var(--transition-spring) !important;
    cursor: pointer;
    position: relative;
}

.todo-checkbox:hover {
    border-color: var(--ux-primary) !important;
    background: var(--ux-primary-soft) !important;
    transform: scale(1.08);
}

.todo-checkbox.checked {
    background: var(--ux-success) !important;
    border-color: var(--ux-success) !important;
    transform: scale(1);
}

.todo-checkbox.checked::after {
    content: '';
    width: 6px;
    height: 11px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) translate(-1px, -1px);
    animation: ux-check-pop 280ms var(--ease-spring);
}

@keyframes ux-check-pop {
    0%   { transform: rotate(45deg) scale(0); opacity: 0; }
    60%  { transform: rotate(45deg) scale(1.3); opacity: 1; }
    100% { transform: rotate(45deg) scale(1); opacity: 1; }
}

/* ============================================================
   AMÉLIORATION #18 — TOASTS / NOTIFICATIONS ÉLÉGANTS
   ============================================================ */
.ux-toast-container {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0));
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: calc(100vw - 48px);
}

.ux-toast {
    background: var(--ux-surface);
    border: 1px solid var(--ux-gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: 0.875rem 1rem 0.875rem 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 280px;
    max-width: 380px;
    pointer-events: auto;
    animation: ux-toast-in 320ms var(--ease-spring) both;
    border-left: 4px solid var(--ux-primary);
}

.ux-toast.ux-toast-success { border-left-color: var(--ux-success); }
.ux-toast.ux-toast-warning { border-left-color: var(--ux-warning); }
.ux-toast.ux-toast-danger  { border-left-color: var(--ux-danger); }

.ux-toast-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--ux-primary-soft);
    color: var(--ux-primary);
    font-weight: 700;
}

.ux-toast.ux-toast-success .ux-toast-icon { background: var(--ux-success-soft); color: var(--ux-success); }
.ux-toast.ux-toast-warning .ux-toast-icon { background: var(--ux-warning-soft); color: var(--ux-warning); }
.ux-toast.ux-toast-danger  .ux-toast-icon { background: var(--ux-danger-soft);  color: var(--ux-danger); }

.ux-toast-body {
    flex: 1;
    min-width: 0;
}

.ux-toast-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--ux-gray-900);
}

.ux-toast-message {
    font-size: 0.8125rem;
    color: var(--ux-gray-600);
    margin-top: 2px;
}

.ux-toast-close {
    background: none;
    border: none;
    color: var(--ux-gray-400);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.ux-toast-close:hover {
    background: var(--ux-gray-100);
    color: var(--ux-gray-600);
}

.ux-toast.ux-toast-leaving {
    animation: ux-toast-out 220ms var(--ease-in-out) forwards;
}

@keyframes ux-toast-in {
    from { opacity: 0; transform: translateX(20px) scale(0.96); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes ux-toast-out {
    to { opacity: 0; transform: translateX(20px) scale(0.96); }
}

/* ============================================================
   AMÉLIORATION #19 — SCROLLBARS DISCRÈTES
   ============================================================ */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--ux-gray-300) transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--ux-gray-300);
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--ux-gray-400);
    background-clip: padding-box;
    border: 2px solid transparent;
}

/* Scrollbar fine sur des conteneurs spécifiques */
.view-controls-sidebar::-webkit-scrollbar,
.settings-content::-webkit-scrollbar,
.todo-list::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

/* ============================================================
   AMÉLIORATION #20 — SKELETONS DE CHARGEMENT
   ============================================================ */
.ux-skeleton {
    background: linear-gradient(
        90deg,
        var(--ux-gray-100) 0%,
        var(--ux-gray-200) 50%,
        var(--ux-gray-100) 100%
    );
    background-size: 200% 100%;
    animation: ux-shimmer 1.4s linear infinite;
    border-radius: var(--radius-md);
    color: transparent !important;
    user-select: none;
    pointer-events: none;
}

.ux-skeleton * {
    visibility: hidden;
}

.ux-skeleton-line {
    height: 12px;
    margin: 8px 0;
    border-radius: var(--radius-sm);
}

.ux-skeleton-line.ux-skeleton-line-short { width: 60%; }
.ux-skeleton-line.ux-skeleton-line-long  { width: 100%; }

.ux-skeleton-todo {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--ux-gray-100);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ux-skeleton-circle {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ux-skeleton-text {
    flex: 1;
    height: 14px;
    border-radius: var(--radius-sm);
}

/* État loading sur la liste */
.todo-list.is-loading .todo-item {
    background: var(--ux-skeleton);
    color: transparent !important;
}

.todo-list.is-loading .todo-item * {
    visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .ux-skeleton {
        animation: none;
        background: var(--ux-gray-100);
    }
}

/* ============================================================
   BONUS : Affinage header et bouton thème
   ============================================================ */
.header {
    background: var(--ux-surface) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--ux-gray-200);
    box-shadow: var(--shadow-xs) !important;
}

.timer-mode-btn {
    border-radius: var(--radius-md) !important;
    transition: all var(--transition-fast) !important;
}

.timer-mode-btn.active {
    background: var(--ux-primary) !important;
    color: #fff !important;
    box-shadow: 0 2px 6px -1px rgba(79, 70, 229, 0.4) !important;
}

/* Footer plus discret */
.footer {
    background: var(--ux-surface) !important;
    border-top: 1px solid var(--ux-gray-200) !important;
    box-shadow: none !important;
    color: var(--ux-gray-500) !important;
    font-size: 0.8125rem;
}

/* Sélection de texte */
::selection {
    background: rgba(79, 70, 229, 0.2);
    color: var(--ux-primary);
}

body.dark ::selection,
[data-theme="dark"] ::selection {
    background: rgba(129, 140, 248, 0.3);
    color: #fff;
}

/* Désactiver le surlignage tactile bleu sur mobile */
button, a, .todo-item, .view-btn, .floating-btn {
    -webkit-tap-highlight-color: transparent;
}
