/* ============================================
   ADMIN PANEL STYLES
   Modern Dashboard Design
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: #f5f7fa;
    color: #2d3748;
}

.admin-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 212px;
    background: linear-gradient(180deg, #1a2332 0%, #2d3e50 100%);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
}

.admin-logo {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.admin-logo img {
    width: 80px;
    margin-bottom: 1rem;
}

.admin-logo h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: #3498db;
}

.admin-nav {
    flex: 1;
    padding: 2rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border-left-color: #3498db;
}

.nav-item.active {
    background: rgba(52, 152, 219, 0.15);
    color: white;
    border-left-color: #3498db;
}

.nav-item i {
    font-size: 1.2rem;
    width: 24px;
}

.admin-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-logout {
    width: 100%;
    padding: 0.9rem;
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid #e74c3c;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-logout:hover {
    background: #e74c3c;
    color: white;
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-left: 212px;
    padding: 1.25rem 1.5rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.admin-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: #1a2332;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger {
    padding: 0.9rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

/* Info Card */
.info-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.info-card i {
    font-size: 2rem;
    opacity: 0.9;
}

.info-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.info-card p {
    font-size: 0.95rem;
    line-height: 1.6;
    opacity: 0.95;
}

/* Projects Manager */
.projects-manager {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.projects-manager h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: #1a2332;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    background: #3498db;
    color: white;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0 0.5rem;
}

/* Sortable Projects List */
.projects-sortable {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.project-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    cursor: move;
    transition: all 0.3s ease;
}

.project-item:hover {
    border-color: #3498db;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
}

.project-item.sortable-ghost {
    opacity: 0.4;
    background: #e3f2fd;
}

.project-item.sortable-drag {
    opacity: 0.8;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.drag-handle {
    font-size: 1.5rem;
    color: #95a5a6;
    cursor: grab;
}

.drag-handle:active {
    cursor: grabbing;
}

.project-thumbnail {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.project-thumbnail i {
    font-size: 2rem;
    color: #95a5a6;
}

.project-info {
    flex: 1;
}

.project-info h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1a2332;
    margin-bottom: 0.5rem;
}

.project-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.project-meta span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: #666;
}

.project-meta i {
    color: #3498db;
    font-size: 0.85rem;
}

.project-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-featured {
    background: #ffeaa7;
    color: #d63031;
}

.badge-priority {
    background: #dfe6e9;
    color: #2d3436;
}

.project-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.btn-edit {
    background: #3498db;
    color: white;
}

.btn-edit:hover {
    background: #2980b9;
    transform: scale(1.1);
}

.btn-delete {
    background: #e74c3c;
    color: white;
}

.btn-delete:hover {
    background: #c0392b;
    transform: scale(1.1);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    color: #1a2332;
}

.modal-close {
    width: 40px;
    height: 40px;
    border: none;
    background: #f8f9fa;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    color: #666;
}

.modal-close:hover {
    background: #e74c3c;
    color: white;
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid #e9ecef;
}

/* Form Styles */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.9rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group textarea {
    resize: vertical;
}

.form-hint {
    font-size: 0.85rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.form-hint i {
    color: #3498db;
}

/* Image Manager */
.image-manager {
    margin-top: 1rem;
}

.image-upload-zone {
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.image-upload-zone:hover {
    border-color: #3498db;
    background: #e3f2fd;
}

.image-upload-zone.drag-over {
    border-color: #3498db;
    background: #e3f2fd;
    transform: scale(1.02);
}

.image-upload-zone i {
    font-size: 3rem;
    color: #3498db;
    margin-bottom: 1rem;
}

.image-upload-zone p {
    color: #666;
    font-size: 1rem;
}

.images-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: move;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.image-preview-item:hover {
    border-color: #3498db;
    transform: scale(1.05);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    background: #3498db;
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
}

.image-preview-remove {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 30px;
    height: 30px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview-item:hover .image-preview-remove {
    opacity: 1;
}

.image-preview-remove:hover {
    transform: scale(1.1);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #27ae60;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    z-index: 3000;
    transform: translateY(150%);
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
    transform: translateY(0);
}

.toast.error {
    background: #e74c3c;
}

.toast i {
    font-size: 1.3rem;
}

/* Responsive */
@media (max-width: 1280px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .admin-sidebar.active {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
        padding: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .header-actions {
        width: 100%;
        flex-direction: column;
    }

    .images-preview {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

.btn-view-site {
    padding: 0.9rem 1.5rem;
    border: 2px solid #3498db;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #3498db;
    background: white;
}

.btn-view-site:hover {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

/* Crop Modal Styles */
.crop-modal-content {
    max-width: 1000px;
}

.crop-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.5rem;
}

.crop-info i {
    font-size: 1.5rem;
    opacity: 0.9;
}

.crop-info p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.crop-container {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.crop-image-wrapper {
    position: relative;
    max-width: 100%;
    max-height: 600px;
    display: inline-block;
}

.crop-image-wrapper img {
    display: block;
    max-width: 100%;
    max-height: 600px;
    user-select: none;
    -webkit-user-drag: none;
}

.crop-box {
    position: absolute;
    border: 3px solid #3498db;
    cursor: move;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.crop-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 1px dashed rgba(255, 255, 255, 0.5);
    pointer-events: none;
}

.crop-handle {
    position: absolute;
    width: 20px;
    height: 20px;
    background: #3498db;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.crop-handle-nw {
    top: -10px;
    left: -10px;
    cursor: nw-resize;
}

.crop-handle-ne {
    top: -10px;
    right: -10px;
    cursor: ne-resize;
}

.crop-handle-sw {
    bottom: -10px;
    left: -10px;
    cursor: sw-resize;
}

.crop-handle-se {
    bottom: -10px;
    right: -10px;
    cursor: se-resize;
}

.crop-controls {
    margin-top: 1.5rem;
    display: flex;
    justify-content: center;
}

/* Add crop button to image preview */
.image-preview-crop {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    width: 30px;
    height: 30px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.image-preview-item:hover .image-preview-crop {
    opacity: 1;
}

.image-preview-crop:hover {
    transform: scale(1.1);
    background: #2980b9;
}

/* Floating Preview Button */
.floating-preview-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: linear-gradient(135deg, #0076CE 0%, #00569d 100%);
    color: white !important;
    padding: 1rem 1.75rem;
    border-radius: 50px;
    box-shadow: 0 8px 30px rgba(0, 118, 206, 0.4);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 9999;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.floating-preview-btn i {
    font-size: 1.1rem;
    transition: transform 0.3s ease;
}

.floating-preview-btn:hover {
    transform: translateY(-5px) scale(1.03);
    box-shadow: 0 12px 35px rgba(0, 118, 206, 0.5);
    background: linear-gradient(135deg, #0084e6 0%, #0064b8 100%);
    color: white !important;
}

.floating-preview-btn:hover i {
    transform: scale(1.2);
}

.floating-preview-btn:active {
    transform: translateY(-2px) scale(0.98);
}

@media (max-width: 1280px) {
    .floating-preview-btn {
        bottom: 1.5rem;
        right: 1.5rem;
        padding: 0.8rem 1.2rem;
        font-size: 0.9rem;
    }
}

/* ============================================
   STATISTICS DASHBOARD STYLES
   ============================================ */

.stats-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    border: 1px solid #eef2f6;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.stats-card-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stats-card-info {
    flex: 1;
}

.stats-card-label {
    display: block;
    font-size: 0.8rem;
    color: #718096;
    font-weight: 550;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.2rem;
}

.stats-card-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a2332;
    margin: 0;
}

/* Tables styling */
.stats-table {
    width: 100%;
    border-collapse: collapse;
}

.stats-table th {
    padding: 12px 10px;
    font-weight: 600;
    color: #718096;
    font-size: 0.85rem;
    border-bottom: 2px solid #edf2f7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #edf2f7;
    color: #4a5568;
    vertical-align: middle;
}

.stats-table tbody tr {
    transition: background-color 0.2s ease;
}

.stats-table tbody tr:hover {
    background-color: #f7fafc;
}

.stats-table-wrapper {
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 #edf2f7;
}

.stats-table-wrapper::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.stats-table-wrapper::-webkit-scrollbar-track {
    background: #edf2f7;
}

.stats-table-wrapper::-webkit-scrollbar-thumb {
    background-color: #cbd5e0;
    border-radius: 3px;
}

/* Floating Menu Toggle Button (Mobile only) */
.floating-menu-btn {
    display: none;
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a2332 0%, #2d3e50 100%);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    z-index: 1100;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.floating-menu-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.45);
}

.floating-menu-btn:active {
    transform: translateY(-2px) scale(0.95);
}

/* Sidebar Backdrop Overlay */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Responsive Trigger */
@media (max-width: 1280px) {
    .floating-menu-btn {
        display: flex;
    }
}

/* stats table mobile responsive minimum width */
@media (max-width: 1280px) {
    .stats-table {
        min-width: 500px;
    }
    #recentSessionsTable {
        min-width: 750px;
    }
}

/* Double doughnut charts layout */
.stats-double-charts {
    display: flex;
    gap: 1rem;
    height: 200px;
    justify-content: space-around;
    align-items: center;
}

.chart-container-half {
    width: 45%;
    height: 100%;
    position: relative;
}

.stats-double-charts-labels {
    display: flex;
    justify-content: space-around;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: #718096;
    text-align: center;
}

@media (max-width: 1280px) {
    .stats-double-charts {
        flex-direction: column;
        height: auto !important;
        gap: 1.5rem;
    }
    .chart-container-half {
        width: 100% !important;
        height: 180px !important;
    }
    .stats-double-charts-labels {
        display: none;
    }
}

/* ============================================
   CLIENTS CRM MODULE STYLES
   ============================================ */

.clients-table {
    width: 100%;
    border-collapse: collapse;
}

.clients-table th,
.clients-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #edf2f7;
    vertical-align: middle;
}

.clients-table tbody tr {
    transition: background 0.2s ease;
}

.clients-table tbody tr:hover {
    background: #f7fafc;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.status-nouveau {
    background: #e3f2fd;
    color: #0d47a1;
}

.status-en-cours {
    background: #fff3e0;
    color: #e65100;
}

.status-devis-envoyé {
    background: #e8f5e9;
    color: #1b5e20;
}

.status-rappel-prévu {
    background: #f3e5f5;
    color: #4a148c;
}

.status-gagné {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.status-perdu {
    background: #ffebee;
    color: #c62828;
}

/* Interactions timeline */
.interaction-item {
    background: #f7fafc;
    border-left: 3px solid #3182ce;
    padding: 10px 12px;
    border-radius: 0 8px 8px 0;
    font-size: 0.85rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.interaction-meta {
    font-size: 0.75rem;
    color: #718096;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
}

.btn-action-edit {
    background: #ebf8ff;
    color: #2b6cb0;
    border: 1px solid #bee3f8;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-action-edit:hover {
    background: #3182ce;
    color: white;
    border-color: #3182ce;
}

.btn-action-delete {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #fed7d7;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
}

.btn-action-delete:hover {
    background: #e53e3e;
    color: white;
    border-color: #e53e3e;
}

/* CRM Mobile Responsive Overrides */
@media (max-width: 1280px) {
    /* Filters adjustment */
    .clients-filters-bar {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.8rem !important;
        padding: 1rem !important;
    }
    
    .clients-filters-bar > div {
        flex-direction: column;
        align-items: stretch !important;
        width: 100%;
        gap: 0.8rem !important;
    }
    
    .clients-filters-bar select,
    .clients-filters-bar input {
        width: 100% !important;
        max-width: none !important;
    }

    /* Transform Table to Cards */
    .clients-table-wrapper {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    .clients-table {
        display: block;
        width: 100%;
    }

    .clients-table thead {
        display: none; /* Hide headers */
    }

    .clients-table tbody {
        display: block;
        width: 100%;
    }

    .clients-table tr {
        display: block;
        background: white;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        padding: 1.2rem;
        margin-bottom: 1.2rem;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    }

    .clients-table tr:hover {
        background: white;
    }

    .clients-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0 !important;
        border-bottom: 1px solid #edf2f7 !important;
        width: 100%;
        box-sizing: border-box;
        text-align: right;
    }

    .clients-table td:last-child {
        border-bottom: none !important;
        justify-content: flex-end;
        gap: 10px;
        padding-top: 12px !important;
    }

    /* Set labels for table columns on mobile */
    .clients-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #4a5568;
        float: left;
        text-align: left;
        font-size: 0.85rem;
    }

    /* Format Client/Contact cell on mobile */
    .clients-table td[data-label="Client / Contact"] {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        border-bottom: 2px solid #e2e8f0 !important;
        padding-bottom: 12px !important;
    }

    .clients-table td[data-label="Client / Contact"]::before {
        margin-bottom: 6px;
    }

    .clients-table td[data-label="Client / Contact"] > div {
        width: 100%;
    }
}

/* ============================================
   SALESPERSON CRM DASHBOARD
   ============================================ */
.salesperson-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-top: 0.5rem;
}

.sales-col {
    background: #ffffff;
    border: 1.5px solid #cbd5e0;
    border-top: 4px solid #3182ce;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.sales-col:hover {
    transform: translateY(-2px);
    border-color: #a0aec0;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
}

.sales-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #edf2f7;
    padding-bottom: 8px;
    margin-bottom: 6px;
}

.sales-col-header h3 {
    margin: 0;
    font-size: 0.95rem;
    font-family: 'Outfit', sans-serif;
}

.sales-col-count {
    background: #ebf8ff;
    color: #2b6cb0;
    font-size: 0.75rem;
    padding: 2px 7px;
    border-radius: 20px;
    font-weight: 700;
    border: 1px solid #bee3f8;
}

.sales-client-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

.sales-client-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.sales-client-card:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.03);
}

.sales-client-card .client-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: #2d3748;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}

.sales-client-card .client-phone {
    font-size: 0.75rem;
    color: #718096;
    margin-top: 2px;
}

/* Neglected client in red */
.sales-client-card.neglected {
    background: #fff5f5;
    border-color: #feb2b2;
}

.sales-client-card.neglected:hover {
    background: #fed7d7;
    border-color: #fc8181;
}

.sales-client-card.neglected .client-name {
    color: #c53030;
}

.sales-client-card.neglected .client-phone {
    color: #e53e3e;
}

.sales-empty-text {
    font-size: 0.8rem;
    color: #a0aec0;
    text-align: center;
    padding: 15px 0;
    font-style: italic;
}

.client-row-neglected {
    background-color: #fff5f5 !important;
    border-left: 4px solid #f56565 !important;
}

.client-row-neglected:hover {
    background-color: #fed7d7 !important;
}

@media (max-width: 1280px) {
    .salesperson-overview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1280px) {
    .salesperson-overview-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .client-row-neglected {
        border-left: none !important;
        border: 2px solid #f56565 !important;
    }
}

/* Star Rating styling */
.star-rating .star {
    transition: transform 0.15s ease, color 0.15s ease;
}
.star-rating .star:hover {
    transform: scale(1.2);
}
.star-rating .star.active {
    color: #d69e2e;
}

/* Sales Person Table styling */
.sales-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.74rem;
}

.sales-table th {
    background: #f8fafc;
    color: #4a5568;
    font-weight: 700;
    text-align: left;
    padding: 6px 4px;
    border-bottom: 2px solid #edf2f7;
    font-size: 0.63rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sales-table td {
    padding: 6px 4px;
    border-bottom: 1px solid #edf2f7;
    color: #2d3748;
    vertical-align: middle;
}

.sales-table td.col-client {
    padding: 6px 4px;
    max-width: 95px;
    overflow: hidden;
}

.sales-table .client-name-span {
    font-weight: 700;
    color: #2d3748;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    max-width: 100%;
}

.sales-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.sales-table tbody tr:hover {
    background-color: #f7fafc;
}

.sales-table tbody tr.neglected {
    background-color: #fff5f5;
}

.sales-table tbody tr.neglected:hover {
    background-color: #fed7d7;
}

.sales-table .status-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.58rem;
    font-weight: 700;
    white-space: nowrap;
}

/* Chevron collapse toggle button */
.collapse-toggle-btn {
    background: none;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    padding: 6px;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, color 0.2s ease;
    border-radius: 50%;
    width: 24px;
    height: 24px;
}

.collapse-toggle-btn:hover {
    background: #edf2f7;
    color: #4a5568;
}

.sales-col.collapsed .sales-client-list {
    display: none;
}

.sales-col.collapsed {
    padding-bottom: 0.5rem;
}

.sales-col.collapsed .sales-col-header {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* Won Projects Progress Bar */
.progress-bar-container {
    background: #edf2f7;
    border-radius: 20px;
    height: 8px;
    width: 100%;
    overflow: hidden;
    position: relative;
    margin-top: 6px;
    border: 1px solid #e2e8f0;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 20px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill-0 { width: 0%; background: #cbd5e0; }
.progress-fill-25 { width: 25%; background: #f6ad55; }
.progress-fill-50 { width: 50%; background: #4299e1; }
.progress-fill-75 { width: 75%; background: #3182ce; }
.progress-fill-100 { width: 100%; background: #48bb78; }

.progress-label-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    font-size: 0.75rem;
}

.progress-percentage {
    font-weight: 700;
    color: #4a5568;
}

.progress-step-name {
    color: #718096;
    font-weight: 500;
}

/* Direct Devis PDF Button */
.btn-devis-direct {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #fff5f5;
    border: 1px solid #feb2b2;
    color: #c53030;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    margin-top: 6px;
}
.btn-devis-direct:hover {
    background: #c53030;
    border-color: #c53030;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(197, 48, 48, 0.2);
}

/* Payment tracking cell */
.payments-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.payment-badge {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    width: 100%;
    min-width: 140px;
    box-sizing: border-box;
}
.payment-badge.paid {
    background: #e6fffa;
    border: 1px solid #b2f5ea;
    color: #234e52;
}
.payment-badge.pending {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    color: #718096;
}
.payment-total {
    font-weight: 700;
    font-size: 0.85rem;
    color: #2b6cb0;
    border-top: 1px solid #edf2f7;
    padding-top: 4px;
    margin-top: 2px;
    text-align: right;
}

/* Devis changes alert */
.devis-changes-alert {
    background: #fffaf0;
    border: 1px solid #fbd38d;
    border-left: 4px solid #dd6b20;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: #7b341e;
    margin-top: 6px;
    line-height: 1.4;
    word-break: break-word;
}

/* ============================================
   ADMIN PORTABLE OPTIMIZATIONS (V11)
   ============================================ */
.admin-mobile-header {
    display: none;
}

@media (max-width: 1280px) {
    .admin-mobile-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        background: #ffffff;
        border-bottom: 1px solid #edf2f7;
        padding: 12px 16px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1001; /* Above sidebar overlay */
        box-shadow: 0 2px 4px rgba(0,0,0,0.02);
        height: 60px;
        box-sizing: border-box;
        width: 100%;
    }

    .admin-container {
        display: block !important;
        padding-top: 60px !important; /* Space for sticky header */
        width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box;
    }

    .admin-sidebar {
        top: 60px !important; /* Below sticky header */
        height: calc(100vh - 60px) !important;
        z-index: 1002;
    }

    .admin-main {
        margin-left: 0 !important;
        padding: 1rem !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
        overflow-x: hidden !important;
    }

    .floating-menu-btn {
        display: none !important; /* Hide old floating button */
    }

    /* Table Scroll Containment */
    .stats-table-wrapper {
        overflow-x: auto !important;
        max-width: 100% !important;
        margin-bottom: 1.5rem;
        border-radius: 8px;
        border: 1px solid #edf2f7;
        box-sizing: border-box;
        -webkit-overflow-scrolling: touch;
    }

    /* Modal padding optimizations */
    .modal {
        padding: 0.5rem !important;
    }
    .modal-content {
        max-height: 95vh !important;
        border-radius: 8px !important;
        width: 100% !important;
        box-sizing: border-box;
    }
    .modal-header,
    .modal-footer {
        padding: 1rem !important;
    }
    .modal-body {
        padding: 1rem !important;
    }

    /* Headers and actions scaling */
    .admin-header {
        flex-direction: column;
        align-items: stretch !important;
        gap: 12px !important;
    }
    .admin-header h1 {
        font-size: 1.5rem !important;
        margin-bottom: 0;
        line-height: 1.2;
    }
    .header-actions {
        width: 100%;
        flex-direction: column;
        gap: 8px !important;
        margin-top: 0;
    }
    .header-actions button,
    .header-actions a {
        width: 100% !important;
        justify-content: center;
        margin: 0 !important;
        box-sizing: border-box;
    }

    /* Project Item vertical stacking */
    .project-item {
        flex-direction: column;
        align-items: stretch !important;
        padding: 1.25rem !important;
        gap: 1rem !important;
    }
    .project-thumbnail {
        width: 100% !important;
        height: 150px !important;
    }
    .project-thumbnail img {
        width: 100% !important;
        height: 100% !important;
    }
    .project-meta {
        gap: 0.75rem !important;
    }
    .project-actions {
        display: flex;
        justify-content: flex-end;
        gap: 8px;
        margin-top: 8px;
        border-top: 1px solid #edf2f7;
        padding-top: 12px;
    }
    .project-actions .btn-icon {
        flex: 1;
        justify-content: center;
        padding: 10px !important;
        height: auto !important;
    }

    /* Login overlay adjustments */
    #loginOverlay > div {
        padding: 30px 20px !important;
        margin: 16px;
        max-width: calc(100% - 32px) !important;
        box-sizing: border-box;
    }
    #loginOverlay img {
        height: 50px !important;
    }
}

/* ============================================
   WON PROJECTS MOBILE ACCORDION & LAYOUT
   ============================================ */
@media (max-width: 1280px) {
    /* Hide KPI stats on mobile/tablet */
    #wonProjectsTabContent .stats-kpi-container {
        display: none !important;
    }
}

/* Won projects table details row display rules for all screens (standard mode) */
.won-projects-table tr.won-project-details-row {
    display: none;
}
.won-projects-table tr.won-project-details-row.expanded {
    display: table-row;
}
.won-projects-table tr.won-project-main-row {
    cursor: pointer;
}
.won-projects-table tr.won-project-main-row td.col-toggle {
    text-align: center;
    color: #a0aec0;
    font-size: 1rem;
    width: 50px;
}

@media (max-width: 1280px) {
    /* Won projects table mobile optimization */
    .won-projects-table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        padding: 4px !important;
    }

    .won-projects-table tr.won-project-main-row {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 10px 14px !important;
        margin-bottom: 0 !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 8px !important;
        background: white !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.01) !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .won-projects-table tr.won-project-main-row:hover {
        background: #f7fafc !important;
    }

    /* Column behavior inside the main row on mobile */
    .won-projects-table tr.won-project-main-row td {
        display: none !important; /* Hide most columns */
        border: none !important;
        padding: 0 !important;
        width: auto !important;
        background: transparent !important;
        box-shadow: none !important;
        text-align: left !important;
    }

    .won-projects-table tr.won-project-main-row td::before {
        display: none !important; /* Hide mobile labels */
    }

    /* Show only Client, Devis icon, Fabrication Sheet, and Chevron on mobile */
    .won-projects-table tr.won-project-main-row td[data-label="Client / Contact"],
    .won-projects-table tr.won-project-main-row td[data-label="Devis"],
    .won-projects-table tr.won-project-main-row td[data-label="Fiches Fab."],
    .won-projects-table tr.won-project-main-row td.col-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
    }

    /* Client cell: fills remaining space, text clipped to one line */
    .won-projects-table tr.won-project-main-row td[data-label="Client / Contact"] {
        flex: 1 1 0 !important;
        min-width: 0 !important;
        justify-content: flex-start !important;
        overflow: hidden !important;
    }

    /* Inner div: single line, text ellipsis */
    .won-projects-table tr.won-project-main-row td[data-label="Client / Contact"] > div {
        font-size: 0.88rem !important;
        font-weight: 700 !important;
        color: #1a202c !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: flex !important;
        align-items: center !important;
        gap: 5px !important;
        width: 100% !important;
    }

    /* Hide sub-elements of Client cell on mobile */
    .won-projects-table tr.won-project-main-row td[data-label="Client / Contact"] .client-sub-info,
    .won-projects-table tr.won-project-main-row td[data-label="Client / Contact"] .salesperson-tag,
    .won-projects-table tr.won-project-main-row td[data-label="Client / Contact"] .stars-container {
        display: none !important;
    }

    /* Devis cell: compact square icon button */
    .won-projects-table tr.won-project-main-row td[data-label="Devis"] {
        width: 36px !important;
        padding: 0 2px !important;
    }
    .won-projects-table tr.won-project-main-row td[data-label="Devis"] > div {
        gap: 2px !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
    }
    .won-projects-table tr.won-project-main-row td[data-label="Devis"] a,
    .won-projects-table tr.won-project-main-row td[data-label="Devis"] span {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px !important;
        border-radius: 6px !important;
        font-size: 1rem !important;
        background: #fff5f5 !important;
        border: 1px solid #fed7d7 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
    }

    /* Fabrication cell: compact square icon button */
    .won-projects-table tr.won-project-main-row td[data-label="Fiches Fab."] {
        width: 36px !important;
        padding: 0 2px !important;
    }
    .won-projects-table tr.won-project-main-row td[data-label="Fiches Fab."] button {
        width: 30px !important;
        height: 30px !important;
        min-width: 30px !important;
        border-radius: 6px !important;
        font-size: 1rem !important;
        padding: 0 !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* Chevron toggle — minimal width */
    .won-projects-table tr.won-project-main-row td.col-toggle {
        width: 22px !important;
        min-width: 22px !important;
        color: #a0aec0 !important;
        font-size: 0.9rem !important;
        padding: 0 0 0 2px !important;
        background: transparent !important;
    }

    /* Details row expanded on mobile */
    .won-projects-table tr.won-project-details-row {
        display: none !important; /* Controlled by display toggles */
        border: 1px solid #e2e8f0 !important;
        border-top: none !important;
        border-radius: 0 0 8px 8px !important;
        margin-top: -10px !important;
        margin-bottom: 8px !important;
        padding: 14px !important;
        background: #f8fafc !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }

    .won-projects-table tr.won-project-details-row.expanded {
        display: block !important;
    }

    /* Styling of cards in details row */
    .won-projects-table tr.won-project-details-row td {
        display: block !important;
        width: 100% !important;
        text-align: left !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
    }

    .won-projects-table tr.won-project-details-row td::before {
        display: none !important;
    }

    .won-projects-table tr.won-project-details-row td .mobile-details-container {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .won-projects-table tr.won-project-details-row td .mobile-details-item {
        border-bottom: 1px dashed #edf2f7;
        padding-bottom: 8px;
    }
    .won-projects-table tr.won-project-details-row td .mobile-details-item:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
}

/* =============================================================
   SUIVI DES PROJETS — Mobile responsive (won projects tab)
   Using ID selectors for max specificity (overrides inline styles)
   ============================================================= */

/* DESKTOP: show everything that's hidden inline */
@media (min-width: 1281px) {
    #exportWonClientsBtn {
        display: inline-flex !important;
        align-items: center;
        gap: 6px;
    }
    #wonFiltersGroup {
        display: flex !important;
        flex-direction: row;
        gap: 0.8rem;
        align-items: center;
    }
    #wonProjectsCount-wrapper,
    .won-projects-count-wrapper {
        display: block !important;
    }
    .won-filter-toggle-btn {
        display: none !important;
    }
    .desktop-only {
        display: inline !important;
    }
    .hide-pc {
        display: none !important;
    }
}

/* MOBILE: hide desktop-only elements (already hidden via inline style for CSV and filters) */
@media (max-width: 1280px) {
    .desktop-only {
        display: none !important;
    }
    .hide-mobile {
        display: none !important;
    }
    #exportWonClientsBtn {
        display: none !important;
    }
    .won-projects-count-wrapper {
        display: none !important;
    }
    /* Filters hidden by default (also set inline in HTML) */
    #wonFiltersGroup {
        display: none !important;
        flex-direction: column;
        width: 100%;
        gap: 0.8rem;
        padding-top: 0.5rem;
    }
    /* Show filters when expanded */
    #wonFiltersGroup.show-filters {
        display: flex !important;
    }
    #wonFiltersGroup select {
        width: 100%;
        box-sizing: border-box;
    }
    /* Toggle arrow button */
    .won-filter-toggle-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        min-width: 36px;
        background-color: #edf2f7;
        border: 1px solid #cbd5e0;
        color: #4a5568;
        border-radius: 50%;
        padding: 0;
        cursor: pointer;
        font-size: 0.85rem;
        transition: background-color 0.2s;
        flex-shrink: 0;
    }
    .won-filter-toggle-btn:hover {
        background-color: #e2e8f0;
    }
}

/* ============================================
   DAILY TASKS / PLANNING GRID LAYOUT
   ============================================ */
.tasks-grid-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 769px) and (max-width: 1024px) {
    .tasks-grid-layout {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1025px) {
    .tasks-grid-layout {
        grid-template-columns: repeat(3, 1fr);
    }
}

.task-col {
    background: white;
    border-radius: 12px;
    border: 1.5px solid #cbd5e0;
    border-top: 4px solid #3182ce;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.task-col:hover {
    transform: translateY(-2px);
    border-color: #a0aec0;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
}

.task-col.today-col {
    border-color: #e53e3e !important;
    border-top: 4px solid #e53e3e !important;
}
.task-col.today-col:hover {
    border-color: #e53e3e !important;
}

.task-col-header {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.task-col-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    color: #2d3748;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.task-col-badge {
    background: #edf2f7;
    color: #4a5568;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
}

.task-list {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
    min-height: 150px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    transition: background 0.2s;
}

.task-item.completed {
    background: #f0fff4;
    border-color: #c6f6d5;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: #a0aec0;
}

.task-checkbox {
    width: 22px !important;
    height: 22px !important;
    margin: 0 !important;
    cursor: pointer;
    flex-shrink: 0;
}

.task-text {
    font-size: 0.95rem;
    color: #2d3748;
    line-height: 1.4;
    flex-grow: 1;
    word-break: break-word;
}

.task-delete-btn {
    background: none;
    border: none;
    color: #a0aec0;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-delete-btn:hover {
    color: #e53e3e;
}

.task-add-container {
    padding: 1rem 1.25rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

.task-add-form {
    display: flex;
    gap: 8px;
}

.task-input {
    flex-grow: 1;
    padding: 10px 14px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    background: white;
    transition: border-color 0.2s;
}

.task-input:focus {
    border-color: #3182ce;
}

.task-add-btn {
    background: #3182ce;
    color: white;
    border: none;
    border-radius: 8px;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 1.1rem;
}

.task-add-btn:hover {
    background: #2b6cb0;
}

@media (max-width: 768px) {
    #tasksTabContent .admin-header {
        margin-bottom: 0.5rem !important;
    }
    #tasksWorkspace > div:first-child {
        margin-bottom: 0.75rem !important;
    }
    #planningTabContent .admin-header {
        margin-bottom: 0.5rem !important;
    }

    /* Mobile CRM Padding & Layout Optimizations */
    .admin-main {
        padding: 0.4rem !important;
    }
    .salesperson-overview-container {
        padding: 0.4rem !important;
    }
    .sales-col {
        padding: 0.4rem !important;
    }
    .sales-client-list {
        padding-right: 0 !important;
        overflow-x: hidden !important; /* Prevent horizontal scroll inside commercial columns */
    }
    .sales-table td, .sales-table th {
        padding: 6px 2px !important;
    }
    .sales-table .col-projet {
        display: none !important;
    }
    .clients-table td[data-label="Intérêt / Projet"] {
        display: none !important;
    }
    .hook-icon-ok {
        display: none !important;
    }
    
    /* Prevent table from exceeding column width and scrolling horizontally */
    .sales-table {
        table-layout: fixed !important;
        width: 100% !important;
    }
    .sales-table th.col-client, .sales-table td.col-client {
        width: 54% !important;
    }
    .sales-table th:nth-child(2), .sales-table td:nth-child(2) {
        width: 24% !important;
    }
    .sales-table th:nth-child(4), .sales-table td:nth-child(4) {
        width: 22% !important;
    }

    /* Expand Client Name fully without ellipsis */
    .sales-table td.col-client {
        max-width: none !important;
        overflow: visible !important;
    }
    .sales-table .client-name-span {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        word-break: break-word;
    }

    /* Allow long status badges like Devis envoyé / Rappel prévu to wrap to two lines */
    .sales-table .status-badge {
        white-space: normal !important;
        text-align: center !important;
        display: inline-block !important;
        word-break: break-word !important;
        padding: 2px 4px !important;
        line-height: 1.1 !important;
    }
}

/* ============================================
   WEEKLY PLANNING TAB SPECIAL STYLES
   ============================================ */
#planningWorkspace {
    margin-bottom: 1.5rem;
}

.planning-section-header {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e2e8f0;
}
.planning-section-header.atelier-header {
    background-color: #ebf8ff;
    color: #2b6cb0;
    border-top: 1px solid #bee3f8;
}
.planning-section-header.chantier-header {
    background-color: #f0fff4;
    color: #2f855a;
    border-top: 1px solid #c6f6d5;
}
.planning-list {
    min-height: 100px !important;
    padding: 0.75rem 1rem !important;
}

/* ============================================
   LOADING OVERLAY & SPINNER
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay-content {
    background: white;
    padding: 2rem 2.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: #2d3748;
    max-width: 320px;
    text-align: center;
}

.spinner-loader {
    width: 44px;
    height: 44px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #3182ce;
    border-radius: 50%;
    animation: spin-loader 0.8s linear infinite;
}

@keyframes spin-loader {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
    font-family: 'Outfit', sans-serif;
}

/* =============================================================
   EXPANDED ROWS BORDER FRAMING (LIKE DASHBOARD CARDS)
   ============================================================= */

/* PC View Frame border styling for expanded rows */
@media (min-width: 1281px) {
    /* Style the main row cells when expanded */
    tr.parent-expanded td {
        border-top: 4px solid #3182ce !important;
        border-bottom: none !important;
    }
    tr.parent-expanded td:first-child {
        border-left: 2px solid #cbd5e0 !important;
        border-top-left-radius: 8px !important;
    }
    tr.parent-expanded td:last-child {
        border-right: 2px solid #cbd5e0 !important;
        border-top-right-radius: 8px !important;
    }

    /* Style the details row cells when expanded */
    tr.client-details-row.expanded td,
    tr.potential-client-details-row.expanded td,
    tr.won-project-details-row.expanded td {
        border-top: none !important;
        border-bottom: 2px solid #cbd5e0 !important;
        border-left: 2px solid #cbd5e0 !important;
        border-right: 2px solid #cbd5e0 !important;
        border-bottom-left-radius: 8px !important;
        border-bottom-right-radius: 8px !important;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02) !important;
        background: #f8fafc !important;
    }
}

/* Mobile View Frame border styling for expanded rows */
@media (max-width: 1280px) {
    tr.parent-expanded {
        border: 2px solid #cbd5e0 !important;
        border-top: 4px solid #3182ce !important;
        border-bottom: none !important;
        border-radius: 8px 8px 0 0 !important;
        background: #f8fafc !important;
    }
    /* Let's clear any internal cell borders on mobile parent row */
    tr.parent-expanded td {
        border: none !important;
    }

    /* Details rows on mobile are display: block */
    tr.client-details-row.expanded,
    tr.potential-client-details-row.expanded,
    tr.won-project-details-row.expanded {
        border: 2px solid #cbd5e0 !important;
        border-top: none !important;
        border-radius: 0 0 8px 8px !important;
        background: #f8fafc !important;
        margin-top: 0 !important; /* Avoid space between parent and details */
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02) !important;
    }
}

/* Mobile Sort Mini Buttons styling — base (desktop with text) */
.btn-sort-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Outfit', sans-serif;
    outline: none;
    user-select: none;
    white-space: nowrap;
}

.btn-sort-mini i {
    font-size: 0.85rem;
    transition: transform 0.2s;
}

.btn-sort-mini.active {
    background: #3182ce;
    border-color: #3182ce;
    color: white;
    box-shadow: 0 2px 6px rgba(49, 130, 206, 0.35);
}

.btn-sort-mini:hover:not(.active) {
    background: #edf2f7;
    border-color: #cbd5e0;
    color: #2d3748;
}

.btn-sort-mini:active {
    transform: scale(0.93);
}

/* Tablette (481px - 1280px): texte masqué, style pill compact */
@media (max-width: 1280px) and (min-width: 481px) {
    .hide-mobile-text {
        display: none !important;
    }
    .btn-sort-mini {
        padding: 7px 10px;
        gap: 0;
        border-radius: 8px;
    }
    .btn-sort-mini i {
        font-size: 0.9rem;
    }
}

/* Mobile (≤ 480px): carrés compacts icône seulement */
@media (max-width: 480px) {
    .hide-mobile-text {
        display: none !important;
    }

    /* Conteneur des boutons de tri — aligné sur la même ligne que le titre */
    .mobile-sort-container {
        display: flex !important;
        gap: 4px !important;
        align-items: center !important;
        flex-shrink: 0 !important;
    }

    /* Bouton carré compact : icône seulement */
    .btn-sort-mini {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        padding: 0 !important;
        gap: 0 !important;
        border-radius: 8px !important;
        border: 1.5px solid #e2e8f0 !important;
        background: #f7fafc !important;
        color: #718096 !important;
        font-size: 0 !important;      /* cache tout texte résiduel */
        box-shadow: none;
    }

    .btn-sort-mini i {
        font-size: 0.85rem !important;
        margin: 0 !important;
    }

    /* Etat actif: fond bleu vif */
    .btn-sort-mini.active {
        background: #3182ce !important;
        border-color: #3182ce !important;
        color: white !important;
        box-shadow: 0 2px 5px rgba(49,130,206,0.4) !important;
    }
    .btn-sort-mini.active i {
        color: white !important;
    }

    /* Hover */
    .btn-sort-mini:hover:not(.active) {
        background: #ebf4ff !important;
        border-color: #90cdf4 !important;
        color: #3182ce !important;
    }

    /* Header "Projets en cours" : titre + boutons sur 1 ligne */
    #wonProjectsTabContent .admin-header {
        flex-wrap: nowrap !important;
        padding: 8px 12px !important;
        gap: 6px !important;
    }
    #wonProjectsTabContent .admin-header > div:first-child {
        flex-wrap: nowrap !important;
        gap: 6px !important;
        align-items: center !important;
        min-width: 0 !important;
    }
    #wonProjectsTabContent .admin-header h1 {
        white-space: nowrap !important;
    }
}

/* =============================================
   Bouton Rapport PDF — cercle vert comme la flèche filtre
   ============================================= */

/* Base (desktop > 1280px) : pilule verte avec texte */
.btn-report-pdf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #27ae60;
    border: 1px solid #219a52;
    color: white;
    padding: 6px 14px;
    height: 36px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    white-space: nowrap;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
}
.btn-report-pdf:hover {
    background: #219a52;
}
.btn-report-pdf:active {
    transform: scale(0.93);
}
.btn-report-pdf i {
    font-size: 0.9rem;
}

/* Desktop : masquer dans la barre de recherche (elle est dans le header) */
/* Mobile / Tablette ≤ 1280px : cercle vert identique à won-filter-toggle-btn */
@media (max-width: 1280px) {
    .btn-report-pdf {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        padding: 0 !important;
        gap: 0 !important;
        border-radius: 50% !important;
        background-color: #27ae60 !important;
        border: 1px solid #219a52 !important;
        color: white !important;
        font-size: 0 !important;      /* cache texte résiduel */
        flex-shrink: 0 !important;
        cursor: pointer;
        transition: background-color 0.2s;
    }
    .btn-report-pdf:hover {
        background-color: #219a52 !important;
    }
    .btn-report-pdf i {
        font-size: 0.9rem !important;
        margin: 0 !important;
        color: white !important;
    }
}

/* Mobile Responsive Optimizations for Volets Tab */
@media (max-width: 768px) {
    .volet-mobile-hide {
        display: none !important;
    }
    
    #addVoletForm {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.75rem !important;
        align-items: stretch !important;
    }
    
    #addVoletForm > div {
        width: 100% !important;
    }
    
    #addVoletForm button {
        width: 100% !important;
        margin-top: 4px;
        box-sizing: border-box;
    }
}

/* ============================================
   PURCHASE SEARCH SUGGESTION DROPDOWN
   ============================================ */
.purchase-suggestion-item {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 15px !important;
    padding: 10px 14px !important;
    border-bottom: 1px solid #edf2f7 !important;
    cursor: pointer !important;
    transition: background 0.15s !important;
    font-family: 'Outfit', sans-serif !important;
}

.purchase-suggestion-item:hover {
    background: #f7fafc !important;
}

.purchase-suggestion-left {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    min-width: 0 !important;
    flex: 1 !important;
}

.purchase-suggestion-img {
    height: 40px !important;
    width: 40px !important;
    object-fit: contain !important;
    border-radius: 6px !important;
    border: 1px solid #e2e8f0 !important;
    background: white !important;
    padding: 2px !important;
    flex-shrink: 0 !important;
}

.purchase-suggestion-info {
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 2px !important;
}

.purchase-suggestion-header {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.purchase-suggestion-ref {
    font-weight: 800 !important;
    font-size: 0.95rem !important;
    color: #1a202c !important;
}

.purchase-suggestion-color-badge {
    font-size: 0.7rem !important;
    background: #ebf8ff !important;
    color: #2b6cb0 !important;
    padding: 1px 6px !important;
    border-radius: 4px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
}

.purchase-suggestion-desig {
    font-size: 0.78rem !important;
    color: #718096 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.purchase-suggestion-provider {
    flex-shrink: 0 !important;
    text-align: left !important;
    width: 140px !important;
}

.purchase-suggestion-brand {
    flex-shrink: 0 !important;
    text-align: left !important;
    width: 110px !important;
}

@media (max-width: 576px) {
    .purchase-suggestion-provider,
    .purchase-suggestion-brand {
        display: none !important;
    }
}

.purchase-suggestion-right {
    text-align: right !important;
    flex-shrink: 0 !important;
    min-width: 85px !important;
}

.purchase-suggestion-price {
    font-weight: 800 !important;
    font-size: 0.92rem !important;
    color: #2b6cb0 !important;
}

.purchase-suggestion-secondary-meta {
    font-size: 0.7rem !important;
    color: #a0aec0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}
@media (max-width: 576px) {
    .purchase-suggestion-price-label {
        display: none !important;
    }
}
@media (min-width: 577px) {
    .purchase-suggestion-secondary-meta {
        display: none !important;
    }
}

.purchase-suggestion-item.keyboard-selected {
    background-color: #ebf8ff !important;
    border-left: 4px solid #3182ce !important;
    outline: none;
}

/* Custom CSS for Visual Window Configurator V2 */
.visual-window-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
}
.visual-window-preview-col {
    flex: 1.2;
    min-width: 320px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}
.visual-window-inspector-col {
    flex: 0.8;
    min-width: 320px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    gap: 15px;
}
@media (max-width: 992px) {
    .visual-window-container {
        flex-direction: column;
    }
    .visual-window-inspector-col {
        width: 100%;
    }
}
.window-svg-wrapper {
    width: 100%;
    max-width: 550px;
    height: 400px;
    position: relative;
    border: 1px dashed #cbd5e0;
    background: #f8fafc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-sizing: border-box;
}
.window-svg-clickable {
    cursor: pointer;
    transition: all 0.2s ease;
    stroke-width: 3px;
}
.window-svg-clickable:hover {
    stroke: #3182ce !important;
    stroke-width: 5px !important;
    filter: drop-shadow(0px 0px 4px rgba(49, 130, 206, 0.6));
}
.window-svg-clickable.active {
    stroke: #2b6cb0 !important;
    stroke-width: 6px !important;
    filter: drop-shadow(0px 0px 6px rgba(43, 108, 176, 0.8));
}
.profile-img-preview-box {
    width: 100px;
    height: 100px;
    border: 1.5px solid #cbd5e0;
    border-radius: 8px;
    background: #edf2f7;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}
.profile-img-preview-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
.v2-config-group {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
}

/* ==========================================================================
   MOBILE RESPONSIVE OPTIMIZATIONS FOR DEVIS CONFIGURATOR & SIMULATOR
   ========================================================================== */
@media (max-width: 768px) {
    /* Modal Layouts General - Appears as a full page on mobile */
    #devisSimulatorModal .modal-content,
    #devisTemplateModal .modal-content,
    #devisTemplateModalV2 .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0px !important;
        margin: 0 !important;
        box-shadow: none !important;
    }
    
    #devisSimulatorModal.modal,
    #devisTemplateModal.modal,
    #devisTemplateModalV2.modal {
        padding: 0 !important;
    }

    #devisSimulatorModal .modal-header,
    #devisTemplateModal .modal-header,
    #devisTemplateModalV2 .modal-header {
        padding: 0.8rem 1rem !important;
        border-radius: 0px !important;
    }

    #devisSimulatorModal .modal-header h2,
    #devisTemplateModal .modal-header h2,
    #devisTemplateModalV2 .modal-header h2 {
        font-size: 1.05rem !important;
        flex: 1;
        white-space: normal;
    }

    #devisSimulatorModal .modal-body,
    #devisTemplateModal .modal-body,
    #devisTemplateModalV2 .modal-body {
        padding: 0.8rem !important;
        gap: 0.8rem !important;
    }

    /* Card visual overrides inspired by the Tasks page (.task-col style) */
    #simDormantCardWrapper,
    #simOuvrantCardWrapper,
    #simColorCardWrapper,
    #simGlazingCardWrapper,
    #simParcloseStyleCardWrapper,
    #simAccessoriesSelectionSection {
        background: white !important;
        border-radius: 12px !important;
        border: 1.5px solid #cbd5e0 !important;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02) !important;
        overflow: hidden !important;
        padding: 0.8rem 1rem !important;
    }

    #simDormantCardWrapper { border-top: 4px solid #3182ce !important; }
    #simOuvrantCardWrapper { border-top: 4px solid #276749 !important; }
    #simColorCardWrapper { border-top: 4px solid #805ad5 !important; }
    #simGlazingCardWrapper { border-top: 4px solid #dd6b20 !important; }
    #simParcloseStyleCardWrapper { border-top: 4px solid #3182ce !important; }
    #simAccessoriesSelectionSection { border-top: 4px solid #e67e22 !important; }

    /* 1. Simulator Modal & Page Layout Customizations */
    #devisSimulatorTabContent .admin-content > div[style*="display: grid"],
    #devisSimulatorTabContent .admin-content > div[style*="grid-template-columns"],
    #devisSimulatorModal .modal-body > div[style*="display: grid"],
    #devisSimulatorModal .modal-body > div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 0.8rem !important;
    }

    #devisSimulatorTabContent div[style*="grid-template-columns: 2fr 1fr 1fr"],
    #devisSimulatorModal div[style*="grid-template-columns: 2fr 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    #devisSimulatorTabContent div[style*="grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr)"],
    #devisSimulatorModal div[style*="grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr)"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Compact simulator tables on mobile to prevent stretching */
    #devisSimulatorTabContent table,
    #devisSimulatorModal table,
    #devisTemplateModal table,
    #devisTemplateModalV2 table {
        width: 100% !important;
        table-layout: auto !important;
    }

    #devisSimulatorModal table th,
    #devisSimulatorModal table td,
    #devisTemplateModal table th,
    #devisTemplateModal table td,
    #devisTemplateModalV2 table th,
    #devisTemplateModalV2 table td {
        padding: 5px 3px !important;
        font-size: 0.74rem !important;
    }

    #devisSimulatorModal table td img,
    #devisTemplateModal table td img,
    #devisTemplateModalV2 table td img {
        width: 32px !important;
        height: 32px !important;
    }

    /* Ensure scroll wrapper behaves correctly */
    #devisSimulatorModal div[style*="overflow-x: auto"],
    #devisTemplateModal div[style*="overflow-x: auto"],
    #devisTemplateModalV2 div[style*="overflow-x: auto"] {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
    }

    /* 2. Devis Template Modal V2 Customizations */
    #devisTemplateModalV2 div[style*="grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))"] {
        grid-template-columns: 1fr !important;
    }

    /* Horizontal scroll slider for navigation tabs on mobile */
    .v2-tab-nav {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 4px 4px 10px 4px !important;
        margin-top: 4px !important;
        margin-bottom: 12px !important;
        border-bottom: 2px solid #e2e8f0 !important;
        gap: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        position: relative !important;
        z-index: 20 !important;
        scrollbar-width: thin !important;
        flex-shrink: 0 !important;
    }

    .v2-tab-btn {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
        padding: 8px 14px !important;
        font-size: 0.82rem !important;
        border-radius: 8px !important;
        background: #f8fafc !important;
        border: 1.5px solid #cbd5e0 !important;
        color: #4a5568 !important;
        cursor: pointer !important;
        display: inline-flex !important;
        align-items: center !important;
        gap: 6px !important;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05) !important;
        transition: all 0.2s ease !important;
    }

    .v2-tab-btn.active {
        background: #0076CE !important;
        color: white !important;
        border: 1.5px solid #0076CE !important;
        border-bottom: 1.5px solid #0076CE !important;
        border-radius: 8px !important;
        font-weight: 800 !important;
        box-shadow: 0 2px 6px rgba(0,118,206,0.35) !important;
    }

    /* Visual designer adjustments */
    .visual-window-container {
        flex-direction: column !important;
        gap: 12px !important;
    }

    .visual-window-preview-col {
        width: 100% !important;
        min-width: 0 !important;
        padding: 10px !important;
        box-sizing: border-box !important;
    }

    .visual-window-inspector-col {
        width: 100% !important;
        min-width: 0 !important;
        padding: 12px !important;
        box-sizing: border-box !important;
    }

    /* Shrink the preview window height to fit S23 Ultra screen height nicely */
    .window-svg-wrapper,
    #windowV2SvgContainer,
    #windowV2ParcloseSvgContainer {
        height: 250px !important;
        max-height: 250px !important;
        padding: 8px !important;
    }

    /* 3. V1 Configurator Modal adjustments */
    #devisTemplateModal div[style*="grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))"] {
        grid-template-columns: 1fr !important;
    }
    
    #devisTemplateModal div[style*="grid-column: span 2"] {
        grid-column: span 1 !important;
    }

    #devisProfilesContainer > div {
        padding: 10px !important;
    }

    /* Stacking dormant and ouvrant choice cards on mobile */
    #simDormantTypesGrid > div,
    #simOuvrantTypesGrid > div,
    #simAlternativesGrid > div {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
        height: auto !important;
        padding: 10px !important;
    }

    #simDormantTypesGrid > div > div:first-child,
    #simOuvrantTypesGrid > div > div:first-child,
    #simAlternativesGrid > div > div:first-child {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        gap: 6px !important;
    }

    #simDormantTypesGrid > div > div:first-child > div,
    #simOuvrantTypesGrid > div > div:first-child > div,
    #simAlternativesGrid > div > div:first-child > div {
        width: 100% !important;
        box-sizing: border-box !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }

    #simDormantTypesGrid div[style*="width: 140px"],
    #simOuvrantTypesGrid div[style*="width: 140px"] {
        width: 100% !important;
        flex-shrink: 1 !important;
    }

    #simDormantTypesGrid div[style*="padding: 4px 10px"],
    #simOuvrantTypesGrid div[style*="padding: 4px 10px"] {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Force text wrapping inside table cells to prevent wide elements from stretching the viewport */
    #devisSimulatorModal td,
    #devisTemplateModal td,
    #devisTemplateModalV2 td {
        white-space: normal !important;
        word-break: break-word !important;
        word-wrap: break-word !important;
    }

    /* General responsive utility to prevent main overflow */
    #devisSimulatorModal,
    #devisTemplateModal,
    #devisTemplateModalV2 {
        overflow-x: hidden !important;
    }
}

/* Global Simulator Card Styles (inspired by the Tasks page .task-col style) */
.sim-card {
    background: white !important;
    border-radius: 12px !important;
    border: 1.5px solid #cbd5e0 !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02) !important;
    overflow: hidden !important;
    padding: 1.2rem 1.4rem !important;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    box-sizing: border-box;
}

.sim-card:hover {
    transform: translateY(-2px);
    border-color: #a0aec0 !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.06), 0 10px 10px -5px rgba(0, 0, 0, 0.03) !important;
}

.sim-card-dormant { border-top: 4px solid #3182ce !important; }
.sim-card-ouvrant { border-top: 4px solid #276749 !important; }
.sim-card-color { border-top: 4px solid #1b365d !important; }
.sim-card-glazing { border-top: 4px solid #800020 !important; }
.sim-card-parclose { border-top: 4px solid #3182ce !important; }
.sim-card-accessories { border-top: 4px solid #e53e3e !important; }
.sim-card-results { border-top: 4px solid #27ae60 !important; }

/* Navigation Tabs for V2 Configurator - Desktop Design */
.v2-tab-nav {
    display: flex;
    gap: 8px;
    margin-top: 5px;
    margin-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 6px;
    flex-wrap: wrap;
}

.v2-tab-btn {
    padding: 10px 16px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
    font-weight: 700;
    border: none;
    border-radius: 6px 6px 0 0;
    background: transparent;
    cursor: pointer;
    color: #4a5568;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}

.v2-tab-btn:hover {
    color: #2b6cb0;
    background: #f7fafc;
}

.v2-tab-btn.active {
    color: #0076CE !important;
    background: transparent !important;
    border: none !important;
    border-bottom: 3px solid #0076CE !important;
    border-radius: 0 !important;
    font-weight: 800 !important;
    box-shadow: none !important;
}








/* ========================================================
   MASTER 4-COLUMN GRID & MOBILE-SAFE MODALS
   ======================================================== */

/* Modal Base Rule - GUARANTEES HIDDEN BY DEFAULT */
.modal,
#cropModal,
#projectModal,
#addCatalogueModal {
    display: none !important;
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.75) !important;
    backdrop-filter: blur(4px) !important;
    z-index: 999999 !important;
    align-items: center !important;
    justify-content: center !important;
    overflow-y: auto !important;
}

.modal.active,
#cropModal.active,
#projectModal.active {
    display: flex !important;
}

/* 4-Column Projects Grid */
.projects-manager {
    background: #ffffff !important;
    border-radius: 16px !important;
    padding: 1.5rem !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04) !important;
}

#projectsList.projects-sortable,
.projects-sortable {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 1.5rem !important;
    margin-top: 1.5rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

@media (max-width: 1450px) {
    #projectsList.projects-sortable,
    .projects-sortable {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 1.25rem !important;
    }
}

@media (max-width: 1050px) {
    #projectsList.projects-sortable,
    .projects-sortable {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 1rem !important;
    }
}

@media (max-width: 650px) {
    #projectsList.projects-sortable,
    .projects-sortable {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }
}

/* Project Card */
.project-item {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 14px !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    overflow: hidden !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06) !important;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s ease !important;
    user-select: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.project-item:hover {
    transform: translateY(-4px) !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 14px 28px rgba(59, 130, 246, 0.15) !important;
}

.project-thumbnail {
    width: 100% !important;
    height: 280px !important;
    min-height: 280px !important;
    max-height: 280px !important;
    border-radius: 0 !important;
    overflow: hidden !important;
    position: relative !important;
    background: #f1f5f9 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

@media (max-width: 650px) {
    .project-thumbnail {
        height: 240px !important;
        min-height: 240px !important;
        max-height: 240px !important;
    }
}

.project-thumbnail img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    image-orientation: from-image !important;
    transition: transform 0.4s ease !important;
}

.project-priority-badge {
    position: absolute !important;
    top: 12px !important;
    left: 12px !important;
    background: rgba(15, 23, 42, 0.85) !important;
    color: #ffffff !important;
    backdrop-filter: blur(8px) !important;
    padding: 5px 12px !important;
    border-radius: 20px !important;
    font-size: 0.82rem !important;
    font-weight: 800 !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    z-index: 2 !important;
}

.project-photo-count {
    position: absolute !important;
    bottom: 12px !important;
    right: 12px !important;
    background: rgba(0, 0, 0, 0.7) !important;
    color: #ffffff !important;
    backdrop-filter: blur(4px) !important;
    padding: 4px 10px !important;
    border-radius: 8px !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    z-index: 2 !important;
}

.project-info {
    padding: 1.1rem 1.25rem !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    background: #ffffff !important;
}

.project-info h3 {
    font-family: 'Outfit', sans-serif !important;
    font-size: 1.05rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    margin: 0 0 0.75rem 0 !important;
    line-height: 1.35 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.drag-handle-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    padding: 10px 12px !important;
    background: #f8fafc !important;
    border: 1px dashed #cbd5e1 !important;
    border-radius: 8px !important;
    color: #475569 !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    cursor: grab !important;
    margin-bottom: 0.85rem !important;
    box-sizing: border-box !important;
}

.project-actions {
    display: flex !important;
    gap: 8px !important;
    padding-top: 0.8rem !important;
    border-top: 1px solid #f1f5f9 !important;
    align-items: center !important;
}

.btn-card-edit {
    flex: 1 !important;
    background: #f0f7ff !important;
    color: #0284c7 !important;
    border: 1px solid #bae6fd !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
}

.btn-card-delete {
    background: #fef2f2 !important;
    color: #ef4444 !important;
    border: 1px solid #fecaca !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    font-size: 0.85rem !important;
    cursor: pointer !important;
}

/* Image previews */
.images-preview {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)) !important;
    gap: 12px !important;
    margin-top: 15px !important;
}

.image-preview-item {
    position: relative !important;
    height: 130px !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    border: 2px solid #e2e8f0 !important;
    background: #f8fafc !important;
}

.image-preview-item.is-main-photo {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25) !important;
}

.image-preview-item img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    image-orientation: from-image !important;
    pointer-events: none !important;
}

.preview-actions-bar {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    padding: 6px !important;
    display: flex !important;
    gap: 6px !important;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%) !important;
    z-index: 10 !important;
}

.btn-preview-crop {
    flex: 1 !important;
    background: #38bdf8 !important;
    color: #0f172a !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 6px 8px !important;
    font-size: 0.78rem !important;
    font-weight: 800 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3) !important;
    touch-action: manipulation !important;
    pointer-events: auto !important;
}

.btn-preview-remove {
    width: 28px !important;
    height: 28px !important;
    background: rgba(239, 68, 68, 0.9) !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.8rem !important;
    touch-action: manipulation !important;
    pointer-events: auto !important;
}

/* Crop Modal Dialog Styles (ONLY ACTIVE WHEN MODAL IS ACTIVE) */
.crop-modal-content {
    max-width: 900px !important;
    width: 95% !important;
    background: #1e293b !important;
    color: #ffffff !important;
    border-radius: 16px !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

.crop-modal-content .modal-header {
    background: #0f172a !important;
    border-bottom: 1px solid #334155 !important;
    padding: 1rem 1.5rem !important;
}

.crop-modal-content .modal-header h2 {
    color: #ffffff !important;
    font-size: 1.15rem !important;
}

.crop-modal-content .modal-close {
    color: #94a3b8 !important;
}

.crop-modal-body {
    padding: 1.25rem !important;
    display: grid !important;
    grid-template-columns: 1.3fr 1fr !important;
    gap: 1.5rem !important;
    background: #1e293b !important;
    max-height: calc(85vh - 130px) !important;
    overflow-y: auto !important;
}

@media (max-width: 768px) {
    #cropModal.active .crop-modal-content {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        margin: 0 !important;
    }
    #cropModal.active .crop-modal-body {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        padding: 1rem !important;
        max-height: calc(100vh - 130px) !important;
    }
}

.crop-workspace-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

.crop-container {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    border-radius: 12px !important;
    padding: 0.75rem !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 260px !important;
    max-height: 46vh !important;
    overflow: hidden !important;
    touch-action: none !important;
}

.crop-image-wrapper {
    position: relative !important;
    max-width: 100% !important;
    max-height: 44vh !important;
    display: inline-block !important;
    touch-action: none !important;
}

.crop-image-wrapper img {
    display: block !important;
    max-width: 100% !important;
    max-height: 44vh !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
    pointer-events: none !important;
}

.crop-box {
    position: absolute !important;
    border: 3px solid #38bdf8 !important;
    cursor: grab !important;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.75) !important;
    touch-action: none !important;
    box-sizing: border-box !important;
}

.crop-box::before {
    content: '' !important;
    position: absolute !important;
    inset: 0 !important;
    border: 1px dashed rgba(255, 255, 255, 0.8) !important;
    pointer-events: none !important;
}

.crop-box-crosshair {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    color: rgba(255, 255, 255, 0.7) !important;
    font-size: 1rem !important;
    pointer-events: none !important;
}

.crop-handle {
    position: absolute !important;
    width: 32px !important;
    height: 32px !important;
    background: #38bdf8 !important;
    border: 3px solid #ffffff !important;
    border-radius: 50% !important;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5) !important;
    z-index: 20 !important;
    touch-action: none !important;
}

.crop-handle::after {
    content: '';
    position: absolute;
    inset: -10px;
}

.crop-handle-nw { top: -16px !important; left: -16px !important; }
.crop-handle-ne { top: -16px !important; right: -16px !important; }
.crop-handle-sw { bottom: -16px !important; left: -16px !important; }
.crop-handle-se { bottom: -16px !important; right: -16px !important; }

/* Controls Panel */
.crop-controls-panel {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
}

.crop-mini-preview-box {
    background: #0f172a !important;
    padding: 0.85rem !important;
    border-radius: 12px !important;
    border: 1px solid #334155 !important;
}

.crop-mini-preview-label {
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    margin-bottom: 0.5rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.crop-live-preview-card {
    width: 100% !important;
    height: 120px !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    background: #000 !important;
    position: relative !important;
}

.crop-live-preview-img-container {
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
    position: relative !important;
}

.crop-live-preview-img-container img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: transform 0.1s ease, object-position 0.1s ease !important;
}

.crop-panel-section {
    background: #0f172a !important;
    padding: 0.85rem !important;
    border-radius: 12px !important;
    border: 1px solid #334155 !important;
}

.crop-panel-label {
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    color: #94a3b8 !important;
    margin-bottom: 0.6rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

.crop-grid-3x3 {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
}

.btn-crop-tile {
    background: #334155 !important;
    color: #f1f5f9 !important;
    border: 1px solid #475569 !important;
    padding: 9px 6px !important;
    border-radius: 8px !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    transition: all 0.15s ease !important;
}

.btn-crop-tile:hover, .btn-crop-tile:active {
    background: #38bdf8 !important;
    color: #0f172a !important;
    border-color: #38bdf8 !important;
}

.btn-crop-tile.active-center {
    background: #0284c7 !important;
    color: #ffffff !important;
    border-color: #38bdf8 !important;
}

.crop-zoom-actions {
    display: flex !important;
    gap: 6px !important;
}

.btn-zoom-action {
    flex: 1 !important;
    background: #334155 !important;
    color: #f1f5f9 !important;
    border: 1px solid #475569 !important;
    padding: 8px 6px !important;
    border-radius: 8px !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
}

.btn-zoom-action:hover, .btn-zoom-action:active {
    background: #38bdf8 !important;
    color: #0f172a !important;
}

.crop-modal-footer {
    background: #0f172a !important;
    border-top: 1px solid #334155 !important;
    padding: 0.85rem 1.25rem !important;
    display: flex !important;
    justify-content: flex-end !important;
    gap: 10px !important;
}

.btn-apply-crop {
    background: #10b981 !important;
    border-color: #10b981 !important;
    color: #ffffff !important;
    font-weight: 800 !important;
    padding: 10px 20px !important;
    font-size: 0.95rem !important;
}
