/* ============================================
   THEME.CSS — Dashboard Facturation Pro
   Thème centralisé + Responsive Mobile/Tablette
   ============================================ */

/* ============================
   1. CSS VARIABLES (CUSTOMISABLES)
   ============================ */
:root {
    /* Couleurs principales */
    --color-primary: #1e3c72;
    --color-secondary: #2a5298;
    --color-accent: #4a90e2;
    --color-success: #28a745;
    --color-success-end: #20c997;
    --color-warning: #f59e0b;
    --color-warning-end: #d97706;
    --color-danger: #e53e3e;
    --color-danger-end: #c53030;
    --color-info: #00bcd4;
    --color-purple: #8b5cf6;
    --color-purple-end: #7c3aed;
    --color-pink: #ec4899;
    --color-pink-end: #db2777;

    /* Couleurs de fond */
    --color-bg-body-start: #1e3c72;
    --color-bg-body-end: #2a5298;
    --color-bg-container: rgba(255, 255, 255, 0.95);
    --color-bg-section: #f7fafc;
    --color-bg-card: #ffffff;
    --color-bg-input: #ffffff;
    --color-bg-hover: #f8f9fa;

    /* Couleurs de texte */
    --color-text-primary: #1e3c72;
    --color-text-body: #2d3748;
    --color-text-secondary: #718096;
    --color-text-light: #a0aec0;
    --color-text-on-dark: #ffffff;

    /* Bordures */
    --color-border: #e2e8f0;
    --color-border-focus: #4a90e2;
    --border-radius-sm: 6px;
    --border-radius: 10px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;

    /* Dégradés */
    --gradient-body: linear-gradient(135deg, var(--color-bg-body-start) 0%, var(--color-bg-body-end) 100%);
    --gradient-primary: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    --gradient-success: linear-gradient(135deg, var(--color-success) 0%, var(--color-success-end) 100%);
    --gradient-danger: linear-gradient(135deg, var(--color-danger) 0%, var(--color-danger-end) 100%);
    --gradient-warning: linear-gradient(135deg, var(--color-warning) 0%, var(--color-warning-end) 100%);
    --gradient-purple: linear-gradient(135deg, var(--color-purple) 0%, var(--color-purple-end) 100%);
    --gradient-pink: linear-gradient(135deg, var(--color-pink) 0%, var(--color-pink-end) 100%);
    --gradient-accent: linear-gradient(135deg, var(--color-accent) 0%, #357abd 100%);

    /* Typographie */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-xs: 11px;
    --font-size-sm: 13px;
    --font-size-base: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 1.8em;
    --font-size-xxl: 2em;
    --font-size-stat: 2.2em;

    /* Espacements */
    --spacing-xs: 5px;
    --spacing-sm: 10px;
    --spacing-md: 15px;
    --spacing-lg: 20px;
    --spacing-xl: 30px;

    /* Ombres */
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.12);
    --shadow-lg: 0 20px 60px rgba(0,0,0,0.3);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.2);

    /* Transitions */
    --transition: all 0.3s ease;

    /* Mobile bottom nav height */
    --nav-height: 0px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* ============================
   2. RESET & BASE
   ============================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background: var(--gradient-body);
    min-height: 100vh;
    padding: var(--spacing-lg);
    padding-bottom: calc(var(--spacing-lg) + var(--nav-height));
    font-size: var(--font-size-base);
    color: var(--color-text-body);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* PWA standalone mode */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top, 20px);
    }
}

/* ============================
   3. CONTAINER
   ============================ */
.container {
    max-width: 1800px;
    margin: 0 auto;
    background: var(--color-bg-container);
    border-radius: var(--border-radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================
   4. HEADER & TOOLBAR
   ============================ */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 3px solid var(--color-accent);
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.header-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

h1 {
    color: var(--color-text-primary);
    font-size: var(--font-size-xxl);
    font-weight: 700;
}

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

/* Accent couleur par page (à ajouter sur le body) */
.page-crm .header { border-bottom-color: var(--color-purple); }
.page-devis .header { border-bottom-color: var(--color-accent); }
.page-factures .header { border-bottom-color: var(--color-accent); }
.page-contrats .header { border-bottom-color: var(--color-purple); }
.page-depenses .header { border-bottom-color: var(--color-danger); }

/* Toolbar desktop - masquée sur mobile (remplacée par bottom nav) */
.toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* ============================
   5. BOUTONS
   ============================ */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: 600;
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    min-height: 40px;
    -webkit-user-select: none;
    user-select: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary { background: var(--gradient-accent); color: white; }
.btn-success { background: var(--gradient-success); color: white; }
.btn-danger { background: var(--gradient-danger); color: white; }
.btn-warning { background: var(--gradient-warning); color: white; }
.btn-secondary { background: #6c757d; color: white; }
.btn-info { background: linear-gradient(135deg, var(--color-info) 0%, #0097a7 100%); color: white; }
.btn-purple { background: var(--gradient-purple); color: white; }
.btn-pink { background: var(--gradient-pink); color: white; }
.btn-dashboard { background: #334155; color: white; }
.btn-outline { background: transparent; border: 2px solid var(--color-border); color: var(--color-text-body); }
.btn-outline:hover { border-color: var(--color-accent); color: var(--color-accent); }

.btn-sm {
    padding: 6px 14px;
    font-size: var(--font-size-xs);
    min-height: 32px;
    border-radius: var(--border-radius-sm);
}

.btn-detail { 
    padding: 6px 14px;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    background: var(--color-accent);
    color: white;
    text-decoration: none;
    transition: var(--transition);
}
.btn-detail:hover { background: #357abd; }

/* ============================
   6. STATS CARDS
   ============================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: 25px;
}

.stat-card {
    padding: 20px 22px;
    border-radius: 12px;
    color: white;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    pointer-events: none;
}

.stat-label { font-size: 0.85em; opacity: 0.9; margin-bottom: 5px; }
.stat-value { font-size: var(--font-size-stat); font-weight: 700; }

/* Couleurs des stat cards */
.stat-card.blue { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }
.stat-card.green { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.stat-card.orange { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); }
.stat-card.pink { background: linear-gradient(135deg, #ec4899 0%, #db2777 100%); }
.stat-card.purple { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-card.red { background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%); }
.stat-card.teal { background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%); }
.stat-card.indigo { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); }
.stat-card.total { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.stat-card.brouillon { background: linear-gradient(135deg, #ffc107, #ff9800); }
.stat-card.envoye { background: linear-gradient(135deg, #2196f3, #1976d2); }
.stat-card.signe { background: linear-gradient(135deg, #4caf50, #388e3c); }

/* ============================
   7. TABLEAUX
   ============================ */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -10px;
    padding: 0 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--gradient-primary);
    color: white;
}

th {
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    font-size: var(--font-size-sm);
    white-space: nowrap;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
    font-size: var(--font-size-sm);
    vertical-align: middle;
}

tr:hover {
    background: var(--color-bg-hover);
}

/* ============================
   8. STATUS BADGES
   ============================ */
.status-badge {
    padding: 4px 12px;
    border-radius: 15px;
    font-size: var(--font-size-xs);
    font-weight: 600;
    display: inline-block;
    white-space: nowrap;
}

.status-brouillon { background: #ffc107; color: #333; }
.status-envoy, .status-envoyé, .status-envoyee, .status-envoye { background: #2196f3; color: white; }
.status-payee, .status-payé { background: #4caf50; color: white; }
.status-signe, .status-signé { background: #4caf50; color: white; }
.status-en-retard, .status-retard { background: #f44336; color: white; }
.status-annule, .status-annulé { background: #f44336; color: white; }
.status-accepte, .status-accepté { background: #4caf50; color: white; }
.status-refuse, .status-refusé { background: #f44336; color: white; }
.status-gagné, .status-gagne { background: #4caf50; color: white; }
.status-perdu { background: #f44336; color: white; }
.status-nouveau { background: #3b82f6; color: white; }
.status-contacté, .status-contacte { background: #8b5cf6; color: white; }
.status-devis-envoyé, .status-devis-envoye { background: #f59e0b; color: #333; }

/* ============================
   9. FORMULAIRES
   ============================ */
.form-section {
    background: var(--color-bg-section);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 25px;
    border-left: 4px solid var(--color-accent);
}

.form-section.client-section { border-left-color: #4a90e2; }
.form-section.event-section { border-left-color: #8b5cf6; }
.form-section.general-section { border-left-color: #6c757d; }
.form-section.attachments-section { border-left-color: #ec4899; }

.section-title {
    color: var(--color-text-primary);
    font-size: 1.1em;
    margin-bottom: 20px;
    font-weight: 700;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label, .form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--color-text-body);
    font-size: var(--font-size-sm);
}

.form-input, .form-select, .form-textarea,
input[type="text"], input[type="email"], input[type="tel"],
input[type="number"], input[type="date"], input[type="search"],
select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    transition: var(--transition);
    background: var(--color-bg-input);
    color: var(--color-text-body);
    min-height: 42px;
    -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus,
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--color-border-focus);
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.15);
}

textarea, .form-textarea {
    min-height: 80px;
    resize: vertical;
}

/* Search bar */
.search-bar {
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid var(--color-border);
    border-radius: var(--border-radius);
    font-size: var(--font-size-base);
}

.search-bar input:focus {
    border-color: var(--color-border-focus);
    outline: none;
}

/* Filters */
.filters {
    background: var(--color-bg-card);
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* ============================
   10. MODALS
   ============================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal.active, .modal.show, .modal:not(.hidden) {
    display: flex;
}
.modal.hidden { display: none !important; }

.modal-content {
    background: white;
    border-radius: var(--border-radius-xl);
    padding: var(--spacing-xl);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
    animation: modalIn 0.3s ease-out;
    -webkit-overflow-scrolling: touch;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--color-border);
}

.modal-header h2 {
    color: var(--color-text-primary);
    font-size: var(--font-size-xl);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--color-border);
}

/* ============================
   11. INFO CARDS & DETAILS
   ============================ */
.client-info-card {
    background: var(--color-bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: var(--font-size-base);
    color: var(--color-text-body);
    font-weight: 500;
}

/* Notes card */
.notes-card {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 12px;
    padding: 15px 20px;
    margin-top: 15px;
}

.notes-card h4 { color: #92400e; margin-bottom: 8px; }
.notes-content { color: #78350f; font-size: var(--font-size-sm); line-height: 1.6; }

/* ============================
   12. UTILITAIRES
   ============================ */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.font-bold { font-weight: 700; }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }

.loading {
    text-align: center;
    padding: 60px;
    color: var(--color-accent);
    font-size: 1.2em;
}

.empty {
    text-align: center;
    padding: 60px;
    color: var(--color-text-light);
}

/* Montants */
.montant { font-weight: 700; font-family: 'Tabular Nums', monospace; }
.montant-positif { color: var(--color-success); }
.montant-negatif { color: var(--color-danger); }

/* ============================
   13. BOTTOM NAVIGATION (MOBILE)
   ============================ */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.12);
    z-index: 9990;
    padding-bottom: var(--safe-area-bottom);
    border-top: 1px solid var(--color-border);
}

.bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 60px;
    max-width: 600px;
    margin: 0 auto;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--color-text-secondary);
    font-size: 10px;
    font-weight: 600;
    gap: 2px;
    padding: 6px 2px;
    min-width: 52px;
    border-radius: 8px;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item .nav-icon {
    font-size: 22px;
    line-height: 1;
}

.bottom-nav-item .nav-label {
    font-size: 10px;
    line-height: 1;
    white-space: nowrap;
}

.bottom-nav-item.active {
    color: var(--color-accent);
}

.bottom-nav-item.active .nav-icon {
    transform: scale(1.15);
}

.bottom-nav-item:active {
    background: rgba(74, 144, 226, 0.08);
}

/* Style Editor toggle button - ajusté pour mobile */
.btn-style-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    border: none;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: var(--transition);
    z-index: 9995;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-style-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

/* ============================
   14. RESPONSIVE — TABLETTE (< 1024px)
   ============================ */
@media (max-width: 1024px) {
    body {
        padding: 15px;
    }

    .container {
        padding: 20px;
        border-radius: 16px;
    }

    h1 {
        font-size: 1.6em;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================
   15. RESPONSIVE — MOBILE (< 768px)
   ============================ */
@media (max-width: 768px) {
    :root {
        --nav-height: calc(60px + var(--safe-area-bottom));
    }

    body {
        padding: 4px;
        padding-bottom: calc(4px + var(--nav-height));
        background: var(--gradient-body);
        min-height: 100dvh;
    }

    .container {
        padding: 8px;
        border-radius: 12px;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        margin-bottom: 8px;
        padding-bottom: 6px;
    }

    h1 { font-size: 1.3em; }

    .toolbar .nav-link-desktop { display: none; }

    .toolbar {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 6px;
        flex-wrap: nowrap;
        padding-bottom: 4px;
    }

    .toolbar .btn {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 36px;
        flex-shrink: 0;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
        margin-bottom: 8px;
    }

    .stat-card { padding: 10px 12px; }
    .stat-value { font-size: 1.5em; }
    .stat-label { font-size: 0.72em; }

    .bottom-nav { display: block; }

    .btn-style-toggle {
        bottom: calc(70px + var(--safe-area-bottom));
        right: 10px;
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .table-wrapper { margin: 0 -8px; padding: 0 8px; }
    table { min-width: 600px; }
    th, td { padding: 8px 6px; font-size: 12px; }

    .form-section { padding: 10px; margin-bottom: 10px; }
    .form-grid { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr 1fr; }

    .modal { padding: 0; align-items: flex-end; }
    .modal-content {
        max-height: 90vh;
        padding: 16px;
        border-radius: 18px 18px 0 0;
        width: 100%;
        animation: modalSlideUp 0.3s ease-out;
    }
    @keyframes modalSlideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
    .modal-actions { flex-direction: column; }
    .modal-actions .btn { width: 100%; }

    .filters { flex-direction: column; align-items: stretch; }
    .filters select, .filters input { width: 100%; }

    .search-input, input[type="search"], #searchInput { width: 100%; font-size: 16px; }

    .btn { min-height: 44px; min-width: 44px; }
    .btn-sm { min-height: 36px; }
}

/* ============================
   16. RESPONSIVE — PETIT MOBILE (< 480px)
   ============================ */
@media (max-width: 480px) {
    body {
        padding: 2px;
        padding-bottom: calc(2px + var(--nav-height));
    }

    .container {
        padding: 6px;
        border-radius: 10px;
    }

    h1 { font-size: 1.15em; }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 4px;
    }

    .stat-card { padding: 8px; }
    .stat-value { font-size: 1.3em; }
    .info-grid { grid-template-columns: 1fr; }
}

/* ============================
   17. ANIMATIONS UTILES
   ============================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

/* ============================
   18. SCROLLBAR CUSTOM
   ============================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: #c1c9d6;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0aab8;
}

/* ============================
   19. MOBILE CARDS VIEW (remplace les tableaux)
   ============================ */
.mobile-cards-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-card {
    background: var(--color-bg-card);
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 1px solid var(--color-border);
    transition: var(--transition);
}

.mobile-card:active {
    transform: scale(0.99);
    background: var(--color-bg-hover);
}

.mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    gap: 6px;
}

.mobile-card-id {
    font-size: 11px;
    font-weight: 700;
    color: var(--color-accent);
    background: rgba(74, 144, 226, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
}

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

.mobile-card-subtitle {
    font-size: 12px;
    color: var(--color-text-secondary);
    margin-bottom: 6px;
}

.mobile-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.mobile-card-row:last-of-type {
    border-bottom: none;
}

.mobile-card-label {
    color: var(--color-text-secondary);
    font-size: 11px;
    font-weight: 600;
}

.mobile-card-amount {
    font-size: 17px;
    font-weight: 700;
    color: var(--color-text-primary);
    text-align: right;
    margin: 6px 0 2px;
}

.mobile-card-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
    flex-wrap: wrap;
}

.mobile-card-actions a,
.mobile-card-actions button,
.mobile-card-actions .mobile-action-btn,
.mobile-card-actions .btn-action {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    padding: 8px 4px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    min-height: 40px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: white !important;
}

.mobile-card-actions .btn-voir,
.mobile-card-actions .btn-detail,
.mobile-card-actions button[onclick*="voir"] { background: #10b981 !important; }
.mobile-card-actions .btn-generer,
.mobile-card-actions button[onclick*="generer"] { background: #22c55e !important; }
.mobile-card-actions .btn-telecharger,
.mobile-card-actions button[onclick*="telecharger"] { background: #3b82f6 !important; }
.mobile-card-actions .btn-dupliquer,
.mobile-card-actions button[onclick*="Duplication"] { background: #8b5cf6 !important; }
.mobile-card-actions .btn-paiements,
.mobile-card-actions button[onclick*="Paiements"] { background: #f97316 !important; }
.mobile-card-actions .btn-facture,
.mobile-card-actions button[onclick*="convertir"] { background: #eab308 !important; }
.mobile-card-actions .btn-edit,
.mobile-card-actions button[onclick*="edit"],
.mobile-card-actions button[onclick*="Edit"] { background: #f59e0b !important; }
.mobile-card-actions .btn-delete,
.mobile-card-actions button[onclick*="supprimer"] { background: #ef4444 !important; }
.mobile-card-actions .btn-detail-action,
.mobile-card-actions button[onclick*="voirDetail"] { background: #64748b !important; }
.mobile-card-actions .btn-statut-action,
.mobile-card-actions button[onclick*="ouvrirStatut"] { background: #8b5cf6 !important; }
.mobile-card-actions .btn-devis-action,
.mobile-card-actions button[onclick*="creerDevis"] { background: #3b82f6 !important; }
.mobile-card-actions .btn-client-action,
.mobile-card-actions button[onclick*="ouvrirConversion"] { background: #10b981 !important; }

@media (max-width: 400px) {
    .mobile-card-actions { gap: 3px; }
    .mobile-card-actions a,
    .mobile-card-actions button,
    .mobile-card-actions .mobile-action-btn {
        flex: 1 1 calc(50% - 3px);
        min-width: calc(50% - 3px);
        font-size: 10px !important;
        padding: 7px 3px !important;
    }
}

/* ============================
   20. WIZARD FORMULAIRE MOBILE
   ============================ */
.wizard-indicator {
    margin-bottom: 12px;
    padding: 0;
}

.wizard-steps {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2px;
    margin-bottom: 6px;
}

.wizard-step-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
    flex: 1 1 0;
    min-width: 0;
    -webkit-tap-highlight-color: transparent;
}

.dot-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    background: #e2e8f0;
    color: var(--color-text-secondary);
    transition: var(--transition);
    flex-shrink: 0;
}

.dot-label {
    font-size: 8px;
    color: var(--color-text-light);
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.1;
}

.wizard-step-dot.active .dot-num {
    background: var(--color-accent);
    color: white;
    transform: scale(1.1);
    box-shadow: 0 2px 6px rgba(74, 144, 226, 0.4);
}

.wizard-step-dot.active .dot-label {
    color: var(--color-accent);
    font-weight: 700;
}

.wizard-step-dot.done .dot-num {
    background: var(--color-success);
    color: white;
}

.wizard-step-dot.done .dot-label {
    color: var(--color-success);
}

.wizard-progress {
    height: 3px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}

.wizard-progress-bar {
    height: 100%;
    background: var(--color-accent);
    border-radius: 2px;
    transition: width 0.4s ease;
    width: 0%;
}

.wizard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding: 8px 0;
    gap: 8px;
}

.wizard-btn {
    padding: 12px 20px !important;
    font-size: 14px !important;
    border-radius: 10px !important;
    min-height: 48px;
    font-weight: 700 !important;
    flex: 1;
    text-align: center;
    justify-content: center;
}

.wizard-prev { background: #6c757d; color: white; }
.wizard-next { background: var(--color-accent); color: white; }

.wizard-counter {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text-secondary);
    flex-shrink: 0;
    white-space: nowrap;
}

/* Masquer le wizard sur desktop */
@media (min-width: 769px) {
    .wizard-indicator,
    .wizard-nav {
        display: none !important;
    }
}

/* ============================
   21. PRINT
   ============================ */
@media print {
    body { background: white; padding: 0; }
    .container { box-shadow: none; border-radius: 0; }
    .bottom-nav, .btn-style-toggle, .toolbar { display: none !important; }
}
