/* ============================================
   SUIVI DE CHANTIER - MP2I SOLUTIONS
   Application de suivi d'affaires BTP
   ============================================ */

:root {
    --primary: #2c3e50;
    --primary-light: #34495e;
    --accent: #3498db;
    --accent-hover: #2980b9;
    --success: #27ae60;
    --success-light: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --danger-hover: #c0392b;
    --bg: #ecf0f1;
    --bg-card: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #dce1e3;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-sm: 4px;
    --sidebar-width: 260px;
    --header-height: 60px;
    --transition: 0.2s ease;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---- SIDEBAR ---- */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.sidebar-header .subtitle {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 4px;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    transition: background var(--transition);
    border-left: 3px solid transparent;
    font-size: 0.9rem;
    gap: 12px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.nav-item.active {
    background: rgba(255,255,255,0.12);
    border-left-color: var(--accent);
    color: #fff;
    font-weight: 600;
}

.nav-item .icon {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
}

.nav-separator {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 8px 20px;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* ---- USER INFO (sidebar footer) ---- */
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    text-transform: uppercase;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.7rem;
    opacity: 0.6;
}

.btn-logout {
    background: rgba(255,255,255,0.1);
    border: none;
    color: rgba(255,255,255,0.7);
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1rem;
    transition: all var(--transition);
    flex-shrink: 0;
}

.btn-logout:hover {
    background: rgba(231,76,60,0.5);
    color: #fff;
}

/* ---- SIDEBAR OVERLAY (mobile) ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* ---- LOGIN PAGE ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, #1a252f 100%);
    padding: 20px;
}

.login-card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.login-header {
    background: var(--primary);
    color: #fff;
    text-align: center;
    padding: 35px 30px 25px;
}

.login-header .login-icon,
.login-header .login-logo {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 1.3rem;
    font-weight: 600;
}

.login-header p {
    font-size: 0.82rem;
    opacity: 0.7;
    margin-top: 5px;
}

.login-body {
    padding: 30px;
}

.login-error {
    background: rgba(231,76,60,0.1);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 16px;
    border-left: 3px solid var(--danger);
}

.password-wrap {
    position: relative;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-light);
    padding: 4px;
}

.btn-login {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
}

.login-footer {
    text-align: center;
    padding: 0 30px 25px;
    font-size: 0.75rem;
    color: var(--text-light);
}

/* ---- LOADING SPINNER ---- */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 12px;
}

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

/* ---- MAIN CONTENT ---- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.page-header {
    background: var(--bg-card);
    padding: 20px 30px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow);
}

.page-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
}

.page-header .header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.page-body {
    padding: 25px 30px;
}

/* ---- CARDS ---- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafbfc;
}

.card-body {
    padding: 20px;
}

/* ---- STATS CARDS ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-icon.blue { background: rgba(52,152,219,0.12); color: var(--accent); }
.stat-icon.green { background: rgba(39,174,96,0.12); color: var(--success); }
.stat-icon.orange { background: rgba(243,156,18,0.12); color: var(--warning); }
.stat-icon.red { background: rgba(231,76,60,0.12); color: var(--danger); }

.stat-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.stat-info p {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
}

/* ---- BUTTONS ---- */
.btn {
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

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

.btn-success {
    background: var(--success);
    color: #fff;
}
.btn-success:hover { background: #219a52; }

.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-danger:hover { background: var(--danger-hover); }

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

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
}

.btn-icon {
    padding: 6px 10px;
    font-size: 1rem;
}

/* ---- FORMS ---- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 5px;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: border-color var(--transition);
    font-family: inherit;
    background: #fff;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(52,152,219,0.1);
}

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

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

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

select.form-control {
    appearance: auto;
}

/* ---- TABLES ---- */
.table-container {
    overflow-x: auto;
}

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

table th,
table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

table th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

table tr:hover {
    background: rgba(52,152,219,0.03);
}

table td.number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

table th.number {
    text-align: right;
}

table .actions {
    white-space: nowrap;
    text-align: center;
    width: 100px;
}

table .actions button {
    margin: 0 2px;
}

.table-footer {
    padding: 10px 14px;
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.85rem;
    border-top: 2px solid var(--border);
}

/* ---- MODAL ---- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

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

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(-20px);
    transition: transform 0.3s;
}

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

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

.modal-header h3 {
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    background: var(--bg);
    color: var(--text);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ---- TABS ---- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    gap: 0;
}

.tab {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
    font-weight: 500;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

/* ---- SUIVI D'AFFAIRE ---- */
.suivi-header-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.suivi-info-group {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.suivi-info-group h4 {
    font-size: 0.85rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.suivi-info-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.9rem;
}

.suivi-info-row .label {
    color: var(--text-light);
}

.suivi-info-row .value {
    font-weight: 600;
}

.valorisation-total {
    background: linear-gradient(135deg, var(--accent) 0%, #2573a7 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

.valorisation-total h3 {
    font-size: 0.9rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.valorisation-total .amount {
    font-size: 2.2rem;
    font-weight: 700;
}

.valorisation-breakdown {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-top: 15px;
    font-size: 0.85rem;
}

.valorisation-breakdown span {
    opacity: 0.85;
}

/* ---- SAISIE HEURES ---- */
.heures-grid {
    overflow-x: auto;
}

.heures-grid table {
    border-collapse: collapse;
}

.heures-grid table th,
.heures-grid table td {
    white-space: nowrap;
}

.heures-grid table input {
    width: 60px;
    padding: 4px 6px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    background: transparent;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.heures-grid table input:hover {
    border-color: var(--accent);
}

.heures-grid table input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(52,152,219,0.15);
    background: white;
}

.heures-grid table input:not(:placeholder-shown),
.heures-grid table input:not([value=""]) {
    font-weight: 600;
}

.gap-5 { gap: 5px; }

.week-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.week-selector select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

/* ---- SEARCH & FILTER ---- */
.search-bar {
    position: relative;
    max-width: 300px;
}

.search-bar input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

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

.search-bar .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
}

/* ---- TOAST ---- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 0.85rem;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
    max-width: 350px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--accent); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; }
}

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-state .icon {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* ---- BADGE ---- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-blue { background: rgba(52,152,219,0.12); color: var(--accent); }
.badge-green { background: rgba(39,174,96,0.12); color: var(--success); }
.badge-orange { background: rgba(243,156,18,0.12); color: var(--warning); }
.badge-red { background: rgba(231,76,60,0.12); color: var(--danger); }

/* ---- TICKET BADGES ---- */
.badge-open { background: rgba(243,156,18,0.15); color: #e67e22; }
.badge-progress { background: rgba(52,152,219,0.15); color: #2980b9; }
.badge-resolved { background: rgba(39,174,96,0.15); color: #27ae60; }
.badge-closed { background: rgba(127,140,141,0.15); color: #7f8c8d; }
.badge-admin { background: rgba(155,89,182,0.15); color: #8e44ad; font-size: 0.65rem; padding: 1px 6px; }

.badge-prio-basse { background: rgba(127,140,141,0.12); color: #7f8c8d; }
.badge-prio-normale { background: rgba(52,152,219,0.12); color: #2980b9; }
.badge-prio-haute { background: rgba(243,156,18,0.15); color: #e67e22; }
.badge-prio-critique { background: rgba(231,76,60,0.18); color: #c0392b; font-weight: 700; }

/* ---- TICKET DETAIL ---- */
.ticket-row.ticket-closed td { opacity: 0.55; }
.ticket-replies { display: flex; flex-direction: column; gap: 12px; max-height: 350px; overflow-y: auto; }
.ticket-reply {
    background: #f0f4f8;
    border-radius: 10px;
    padding: 12px 16px;
    border-left: 3px solid #ddd;
}
.ticket-reply-admin {
    background: #f0e6ff;
    border-left-color: #8e44ad;
}
.ticket-reply-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.85rem;
}
.ticket-reply-date { margin-left: auto; color: #999; font-size: 0.78rem; }
.ticket-reply-body { font-size: 0.9rem; line-height: 1.5; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .page-header {
        padding: 12px 15px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .page-header-left {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .page-header h2 {
        font-size: 1.1rem;
    }

    .header-actions {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .page-body {
        padding: 12px;
    }
    
    .form-row, .form-row-3, .form-row-4 {
        grid-template-columns: 1fr;
    }
    
    .suivi-header-info {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .stat-info h3 {
        font-size: 1.2rem;
    }

    .hide-mobile {
        display: none !important;
    }
    
    .mobile-menu-btn {
        display: block !important;
    }

    .tabs {
        overflow-x: auto;
        gap: 0;
    }

    .tab {
        padding: 8px 12px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .card-body {
        padding: 12px;
    }

    .card-header {
        padding: 12px 15px;
        font-size: 0.9rem;
    }

    .valorisation-total {
        padding: 18px;
    }

    .valorisation-total .amount {
        font-size: 1.6rem;
    }

    .valorisation-breakdown {
        flex-direction: column;
        gap: 5px;
    }

    .search-bar {
        max-width: 100%;
        flex: 1;
    }

    .modal {
        width: 95%;
        max-height: 90vh;
    }

    .modal-body {
        padding: 16px;
    }

    .heures-controls {
        flex-direction: column;
    }

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

    .login-card {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    table th, table td {
        padding: 7px 8px;
        font-size: 0.78rem;
    }

    .btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }

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

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text);
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.heures-controls {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.week-range {
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 75px;
    text-align: center;
}

.sticky-col {
    position: sticky;
    left: 0;
    background: white;
    z-index: 1;
}

table thead .sticky-col {
    background: #f8f9fa;
    z-index: 2;
}

.col-total-header {
    background: #f0f4f8 !important;
}

.current-week {
    background: rgba(52,152,219,0.06) !important;
}

.form-section-title {
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 18px 0 8px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border);
}

/* ---- PRINT ---- */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        background: #fff;
        font-size: 11pt;
    }

    .sidebar, 
    .sidebar-overlay,
    .page-header,
    .mobile-menu-btn,
    .btn,
    .toast-container,
    .modal-overlay {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .page-body {
        padding: 0 !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
        margin-bottom: 12px;
    }

    .card-header {
        background: #f5f5f5 !important;
    }

    .stats-grid {
        display: none !important;
    }

    /* Print header */
    .print-header {
        display: flex !important;
        justify-content: space-between;
        align-items: flex-start;
        padding: 15px 0;
        border-bottom: 3px solid #333;
        margin-bottom: 20px;
    }

    .print-company {
        font-size: 10pt;
        line-height: 1.5;
    }

    .print-company strong {
        font-size: 13pt;
    }

    .print-title {
        text-align: right;
        font-size: 16pt;
        font-weight: 700;
        color: #333;
    }

    .print-footer {
        display: block !important;
        text-align: center;
        font-size: 9pt;
        color: #666;
        padding-top: 15px;
        border-top: 1px solid #ccc;
        margin-top: 20px;
    }

    /* Suivi detail print */
    .print-suivi .suivi-header-info {
        grid-template-columns: 1fr 1fr;
    }

    .print-suivi .suivi-info-group {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .print-suivi .valorisation-total {
        background: #f0f0f0 !important;
        color: #333 !important;
        box-shadow: none;
        border: 2px solid #333;
    }

    .print-suivi .valorisation-total .amount {
        font-size: 1.8rem;
    }

    .print-suivi .badge {
        border: 1px solid currentColor;
    }

    .hide-mobile {
        display: table-cell !important;
    }

    table {
        font-size: 9pt;
    }

    table th, table td {
        padding: 5px 8px;
    }

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

    @page {
        margin: 15mm 10mm;
    }
}

/* Hide print elements on screen */
.print-header, .print-footer {
    display: none;
}

/* ---- UTILITIES ---- */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-light); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-bold { font-weight: 600; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.d-flex { display: flex; }
.gap-10 { gap: 10px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* ---- COLOR PRESETS (Paramètres) ---- */
.color-presets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}

.color-preset {
    cursor: pointer;
    text-align: center;
    padding: 8px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.color-preset:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.preset-preview {
    height: 50px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    display: flex;
    margin-bottom: 6px;
    border: 1px solid rgba(0,0,0,0.08);
}

.color-preset small {
    font-size: 0.73rem;
    color: var(--text-light);
    font-weight: 500;
}

/* ---- COLOR GRID (Paramètres) ---- */
.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 18px;
}

.color-item label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 6px;
}

.color-item small {
    display: block;
    margin-top: 4px;
}

.color-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-picker {
    width: 42px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
    cursor: pointer;
    background: #fff;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

.color-hex {
    max-width: 100px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.82rem !important;
    text-transform: uppercase;
}

/* ---- LIST EDITABLE (Paramètres listes) ---- */
.list-editable-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.list-editable-item .form-control {
    max-width: 350px;
}

.list-editable-item .btn-icon {
    flex-shrink: 0;
}

/* ============================================
   PLANS - Éditeur de Plans
   ============================================ */

/* ---- GRILLE DE PLANS (listing) ---- */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.plan-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition);
    border: 2px solid transparent;
}

.plan-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.plan-card-preview {
    height: 140px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ecf0f1 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.plan-card-icon {
    font-size: 3rem;
    opacity: 0.3;
}

.plan-card-body {
    padding: 15px;
}

.plan-card-body h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.plan-card-body p {
    font-size: 0.82rem;
    margin-bottom: 8px;
}

.plan-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-light);
}

.plan-card-actions {
    padding: 10px 15px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ---- EDITEUR DE PLANS ---- */
.plan-editor-header {
    flex-wrap: nowrap;
}

.plan-editor-header .page-header-left {
    gap: 8px;
}

.plan-name-input {
    max-width: 200px;
    font-weight: 600;
    font-size: 0.95rem;
}

.plan-editor-container {
    display: flex;
    height: calc(100vh - 62px);
    overflow: hidden;
}

/* ---- TOOLBAR GAUCHE ---- */
.plan-toolbar {
    width: 120px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    flex-shrink: 0;
    padding: 8px;
}

.plan-toolbar-section {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.plan-toolbar-section:last-child {
    border-bottom: none;
}

.plan-toolbar-title {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-light);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    padding: 0 4px;
}

.plan-tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 100%;
    padding: 6px 4px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 2px;
    font-family: inherit;
}

.plan-tool-btn:hover {
    background: rgba(52, 152, 219, 0.08);
    border-color: rgba(52, 152, 219, 0.2);
}

.plan-tool-btn.active {
    background: rgba(52, 152, 219, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

.plan-tool-btn span {
    font-size: 1.2rem;
    line-height: 1;
}

.plan-tool-btn small {
    font-size: 0.65rem;
    color: var(--text-light);
    line-height: 1;
}

.plan-tool-btn.active small {
    color: var(--accent);
}

/* ---- OPTIONS PANEL ---- */
.plan-option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 6px;
    padding: 2px 4px;
}

.plan-option-row label {
    font-size: 0.72rem;
    color: var(--text-light);
    white-space: nowrap;
}

.plan-option-row input[type="color"] {
    width: 28px;
    height: 24px;
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px;
    cursor: pointer;
}

.plan-option-row input[type="range"] {
    width: 60px;
    height: 4px;
}

/* Toggle switch */
.plan-toggle {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
    cursor: pointer;
}

.plan-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.plan-toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 18px;
    transition: 0.2s;
}

.plan-toggle-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

.plan-toggle input:checked + .plan-toggle-slider {
    background: var(--accent);
}

.plan-toggle input:checked + .plan-toggle-slider::before {
    transform: translateX(16px);
}

/* ---- ZONE CANVAS ---- */
.plan-canvas-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #dfe6e9;
}

.plan-canvas-wrapper {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.plan-canvas-wrapper canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.plan-status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--text-light);
    flex-shrink: 0;
}

.plan-status-sep {
    color: var(--border);
}

/* ---- PANEL PROPRIÉTÉS ---- */
.plan-props-panel {
    width: 200px;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    flex-shrink: 0;
}

.plan-props-content {
    padding: 12px;
}

.plan-prop-group {
    margin-bottom: 10px;
}

.plan-prop-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 3px;
}

.plan-prop-group .form-control {
    padding: 5px 8px;
    font-size: 0.82rem;
}

.plan-prop-group input[type="color"] {
    width: 36px;
    height: 28px;
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 2px;
    cursor: pointer;
}

/* ---- RESPONSIVE PLANS ---- */
@media (max-width: 768px) {
    .plan-editor-container {
        flex-direction: column;
        height: calc(100vh - 120px);
    }

    .plan-toolbar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        display: flex;
        overflow-x: auto;
        padding: 4px 8px;
        gap: 4px;
    }

    .plan-toolbar-section {
        display: flex;
        align-items: center;
        gap: 2px;
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
        border-right: 1px solid var(--border);
        padding-right: 8px;
        flex-shrink: 0;
    }

    .plan-toolbar-section:last-child {
        border-right: none;
        display: none; /* Hide options on mobile - too crowded */
    }

    .plan-toolbar-title {
        display: none;
    }

    .plan-tool-btn {
        padding: 4px;
        min-width: 40px;
    }

    .plan-tool-btn small {
        display: none;
    }

    .plan-props-panel {
        display: none;
    }

    .plan-name-input {
        max-width: 120px;
    }

    .plan-editor-header .header-actions {
        flex-wrap: nowrap;
        overflow-x: auto;
    }

    .plans-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .plans-grid {
        grid-template-columns: 1fr;
    }
}

