/* =============================================================================
   ETNA PACK - Interface de Matching IA
   ============================================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #0f172a;
    --accent: #8b5cf6;

    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #3b82f6;
    --info-light: #dbeafe;

    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --radius-sm: 6px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
}

/* =============================================================================
   LOGIN SCREEN
   ============================================================================= */

.login-screen {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(135deg, var(--secondary) 0%, #1e293b 50%, var(--primary-dark) 100%);
    align-items: center;
    justify-content: center;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.login-logo {
    margin-bottom: 32px;
}

.login-logo-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: white;
}

.login-logo-icon svg {
    width: 28px;
    height: 28px;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--secondary);
    letter-spacing: -0.5px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--gray-400);
    margin-top: 4px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.login-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    text-align: left;
    margin-bottom: 6px;
}

.login-field input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.login-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.login-error {
    color: #ef4444;
    font-size: 13px;
    padding: 8px 12px;
    background: #fef2f2;
    border-radius: var(--radius-sm);
}

.login-btn {
    padding: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

.login-btn:hover {
    opacity: 0.9;
}

.login-btn:active {
    transform: scale(0.98);
}

/* =============================================================================
   APP CONTAINER
   ============================================================================= */

.app-container {
    display: flex;
    min-height: 100vh;
}

/* =============================================================================
   SIDEBAR
   ============================================================================= */

.sidebar {
    width: 220px;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-100);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
}

.logo-icon svg {
    width: 22px;
    height: 22px;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--gray-900);
}

.logo-subtitle {
    font-size: 12px;
    color: var(--primary);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
    color: var(--gray-600);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

.nav-item:hover {
    background: var(--gray-100);
    color: var(--gray-800);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    color: var(--primary);
}

.nav-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item span {
    flex: 1;
}

.nav-arrow {
    width: 16px;
    height: 16px;
    opacity: 0.5;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--gray-100);
}

.nav-item.logout {
    color: var(--gray-500);
}

.nav-item.logout:hover {
    color: var(--gray-700);
}

/* =============================================================================
   MAIN CONTENT
   ============================================================================= */

.main-content {
    flex: 1;
    margin-left: 220px;
    padding: 20px 40px;
    min-height: 100vh;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* =============================================================================
   PAGE HEADER
   ============================================================================= */

.page-header {
    margin-bottom: 12px;
}

.page-title {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.title-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    flex-shrink: 0;
}

.title-icon svg {
    width: 24px;
    height: 24px;
}

.page-title h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.page-title p {
    font-size: 14px;
    color: var(--gray-500);
}

/* =============================================================================
   TABS
   ============================================================================= */

.tabs {
    display: flex;
    gap: 4px;
    background: var(--gray-100);
    padding: 4px;
    border-radius: var(--radius-lg);
    width: fit-content;
    margin-bottom: 24px;
}

.tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab:hover {
    color: var(--gray-800);
}

.tab.active {
    background: var(--white);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.tab svg {
    width: 18px;
    height: 18px;
}

.tab-count {
    background: var(--primary);
    color: var(--white);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* =============================================================================
   DEPOT LAYOUT
   ============================================================================= */

.depot-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 16px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.section-header svg {
    width: 20px;
    height: 20px;
    color: var(--gray-500);
}

/* =============================================================================
   DROPZONE
   ============================================================================= */

.dropzone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 16px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--white);
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.02);
}

.dropzone-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 8px;
    background: var(--gray-100);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-400);
}

.dropzone-icon svg {
    width: 28px;
    height: 28px;
}

.dropzone-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 4px;
}

.dropzone-hint {
    font-size: 14px;
    color: var(--gray-400);
}

/* File List */
.file-list {
    margin-top: 16px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.file-item-icon {
    width: 36px;
    height: 36px;
    background: var(--info-light);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--info);
}

.file-item-icon svg {
    width: 18px;
    height: 18px;
}

.file-item-info {
    flex: 1;
}

.file-item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-800);
}

.file-item-size {
    font-size: 12px;
    color: var(--gray-400);
}

.file-item-remove {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--gray-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-item-remove:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* =============================================================================
   CRITERES SECTION
   ============================================================================= */

.criteres-section {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--gray-800);
    background: var(--white);
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--gray-400);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Filtres stricts - Checkboxes */
.filtres-stricts {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    transition: all 0.2s ease;
}

.checkbox-label:hover {
    background: var(--gray-100);
    border-color: var(--primary-light);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox-label .checkbox-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
}

.checkbox-label small {
    font-size: 12px;
    color: var(--gray-500);
    margin-left: auto;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-text {
    color: var(--primary);
}

/* =============================================================================
   ACTION BAR
   ============================================================================= */

.action-bar {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

.btn-primary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary svg {
    width: 20px;
    height: 20px;
}

/* =============================================================================
   FILTERS BAR
   ============================================================================= */

.filters-bar {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
}

.filters-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 16px;
}

.filters-header svg {
    width: 18px;
    height: 18px;
    color: var(--gray-500);
}

.filters-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-input {
    position: relative;
    flex: 1;
    min-width: 150px;
    max-width: 200px;
}

.filter-input svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--gray-400);
}

.filter-input input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--gray-800);
}

.filter-input input:focus {
    outline: none;
    border-color: var(--primary);
}

.filter-select {
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--gray-600);
    background: var(--white);
    cursor: pointer;
    min-width: 150px;
}

.filter-sort {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.filter-sort svg {
    width: 18px;
    height: 18px;
    color: var(--gray-400);
}

.btn-reset {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--gray-500);
    font-size: 14px;
    cursor: pointer;
    border-radius: var(--radius);
}

.btn-reset:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-reset svg {
    width: 16px;
    height: 16px;
}

/* =============================================================================
   RESULTS
   ============================================================================= */

.results-info {
    font-size: 14px;
    color: var(--gray-600);
    margin-bottom: 20px;
}

.results-info span {
    font-weight: 600;
    color: var(--gray-800);
}

.results-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Result Card */
.result-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}

.result-card.has-of {
    border-left: 4px solid var(--success);
    background: var(--success-light);
}

.of-badge {
    display: inline-block;
    padding: 2px 8px;
    background: var(--success);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
}

/* Bilan de production */
.bilan-production {
    margin-bottom: 16px;
}

.bilan-header {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.bilan-tag {
    display: inline-block;
    padding: 4px 10px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
}

.bilan-tag.en-cours {
    background: #fef3c7;
    color: #f59e0b;
}

.bilan-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.bilan-table th {
    text-align: left;
    padding: 8px 12px;
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
    font-weight: 600;
    color: var(--gray-600);
    font-size: 11px;
    text-transform: uppercase;
}

.bilan-table td {
    padding: 6px 12px;
    border-bottom: 1px solid var(--gray-100);
}

.bilan-row-label {
    font-weight: 600;
    color: var(--gray-700);
}

.bilan-row-total {
    background: var(--gray-50);
    font-weight: 700;
}

.bilan-row-total td {
    border-top: 2px solid var(--gray-300);
    padding-top: 8px;
    padding-bottom: 8px;
}

.ecart-positif {
    color: var(--success);
    font-weight: 600;
    font-size: 12px;
}

.ecart-negatif {
    color: #ef4444;
    font-weight: 600;
    font-size: 12px;
}

.of-card-hours {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

.result-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--gray-300);
}

.result-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.result-ref {
    display: inline-flex;
    padding: 4px 10px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
}

.result-client {
    font-size: 13px;
    color: var(--gray-500);
}

.result-score {
    margin-left: auto;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
}

.result-score.high {
    background: var(--success-light);
    color: var(--success);
}

.result-score.medium {
    background: var(--info-light);
    color: var(--info);
}

.result-score.low {
    background: var(--warning-light);
    color: var(--warning);
}

.result-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
    line-height: 1.4;
}

.result-description {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 16px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--gray-600);
}

.result-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-meta-item svg {
    width: 16px;
    height: 16px;
    color: var(--gray-400);
}

.result-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.result-tag {
    padding: 4px 10px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--gray-600);
}

.btn-detail {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--secondary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: auto;
}

.btn-detail:hover {
    background: var(--gray-700);
}

.btn-sim-matiere {
    padding: 4px 10px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-sim-matiere:hover {
    background: var(--primary-dark, #4338ca);
    transform: translateY(-1px);
}

/* Modal simulation matiere */
.sim-mat-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); z-index: 10000;
    display: flex; align-items: center; justify-content: center;
}
.sim-mat-container {
    background: white; border-radius: 12px; width: 90%; max-width: 800px;
    max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.sim-mat-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px; border-bottom: 1px solid var(--gray-200);
}
.sim-mat-header h3 { margin: 0; font-size: 18px; color: var(--gray-800); }
.sim-mat-close {
    font-size: 28px; cursor: pointer; color: var(--gray-400);
    line-height: 1; padding: 0 4px;
}
.sim-mat-close:hover { color: var(--gray-700); }
.sim-mat-body { padding: 24px; }
.sim-mat-section { margin-bottom: 24px; }
.sim-mat-section h4 {
    font-size: 14px; font-weight: 600; color: var(--gray-600);
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px;
}
.sim-mat-info {
    display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
    padding: 12px 16px; background: var(--gray-50); border-radius: 8px;
    font-size: 13px;
}
.sim-mat-form { display: flex; flex-direction: column; gap: 12px; }
.sim-mat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.sim-mat-field label {
    display: block; font-size: 12px; font-weight: 500; color: var(--gray-600);
    margin-bottom: 4px;
}
.sim-mat-field input {
    width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300);
    border-radius: 6px; font-size: 14px; box-sizing: border-box;
}
.sim-mat-field input:focus, .sim-mat-field select:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.sim-mat-field select {
    width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300);
    border-radius: 6px; font-size: 14px; box-sizing: border-box;
    background: white;
}
.sim-mat-btn {
    padding: 10px 24px; background: var(--primary); color: white;
    border: none; border-radius: 8px; font-size: 14px; font-weight: 600;
    cursor: pointer; align-self: flex-start; transition: all 0.2s;
}
.sim-mat-btn:hover { background: var(--primary-dark, #4338ca); }
.btn-simulate-auto {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
}
.btn-simulate-auto:hover {
    background: linear-gradient(135deg, #d97706, #b45309) !important;
}
.sim-fab-edit-btn {
    background: none; border: none; cursor: pointer; font-size: 16px; padding: 2px 6px;
    color: var(--gray-500); border-radius: 4px; transition: all 0.2s;
}
.sim-fab-edit-btn:hover { background: var(--gray-100); color: var(--primary); }
.sim-fab-edit-input {
    padding: 4px 6px; border: 1px solid var(--gray-300); border-radius: 4px; font-size: 12px;
}
.sim-mat-loading { text-align: center; padding: 20px; color: var(--gray-500); }
.sim-mat-error { color: #dc2626; padding: 12px; background: #fef2f2; border-radius: 8px; }
.sim-mat-table-wrapper { overflow-x: auto; }
.sim-mat-table {
    width: 100%; border-collapse: collapse; font-size: 13px;
}
.sim-mat-table th, .sim-mat-table td {
    padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--gray-200);
}
.sim-mat-table th {
    background: var(--gray-50); font-weight: 600; color: var(--gray-600);
    font-size: 12px; text-transform: uppercase;
}
.sim-mat-table tr.sim-mat-total { background: var(--gray-50); font-weight: 600; }
.sim-mat-diff {
    margin-top: 16px; padding: 12px 16px; border-radius: 8px;
    font-weight: 600; font-size: 15px; text-align: center;
    background: var(--gray-100); color: var(--gray-700);
}
.sim-mat-diff.sim-mat-up { background: #fef2f2; color: #dc2626; }
.sim-mat-diff.sim-mat-down { background: #f0fdf4; color: #16a34a; }

.btn-detail svg {
    width: 18px;
    height: 18px;
}

.result-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    margin-top: auto;
}

.result-actions .btn-detail {
    margin-top: 0;
}

.result-actions-sim {
    display: flex;
    gap: 6px;
}

.btn-simulate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 12px;
    background: var(--primary, #6366f1);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex: 1;
}

.btn-simulate:hover {
    background: #4f46e5;
}

.btn-simulate svg {
    width: 14px;
    height: 14px;
}

.btn-simulate-auto {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    font-size: 11px;
}
.btn-simulate-auto:hover {
    background: linear-gradient(135deg, #d97706, #b45309) !important;
}

/* =============================================================================
   RESULTS SECTIONS (Dimensions / Caracteristiques)
   ============================================================================= */

.results-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    margin-bottom: 12px;
    margin-top: 20px;
    border-bottom: 2px solid var(--gray-200);
}

.results-section-header:first-of-type {
    margin-top: 0;
}

.results-section-header.dimensions {
    border-bottom-color: #3b82f6;
}

.results-section-header.caracteristiques {
    border-bottom-color: #f59e0b;
}

.results-section-header .section-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.results-section-header.dimensions .section-icon {
    background: #dbeafe;
    color: #3b82f6;
}

.results-section-header.caracteristiques .section-icon {
    background: #fef3c7;
    color: #f59e0b;
}

.results-section-header .section-icon svg {
    width: 18px;
    height: 18px;
}

.results-section-header .section-info h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.results-section-header .section-info p {
    font-size: 12px;
    color: var(--gray-500);
    margin: 0;
}

.results-section-header .section-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.results-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.results-cards .result-card {
    flex: 1 1 280px;
    max-width: 350px;
}

/* Visual distinction for caracteristiques cards - subtle style */
.result-card.caracteristiques {
    border: 1px solid var(--gray-200);
}

.result-card.dimensions {
    border: 1px solid var(--gray-200);
}

/* Match type badge */
.match-badge {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.match-badge.dimensions {
    background: #dbeafe;
    color: #1d4ed8;
}

.match-badge.caracteristiques {
    background: #fef3c7;
    color: #b45309;
}

.match-badge.matiere {
    background: #d1fae5;
    color: #047857;
}

/* Section matiere styles */
.results-section-header.matiere {
    border-bottom-color: #10b981;
}

.results-section-header.matiere .section-icon {
    background: #d1fae5;
    color: #10b981;
}

.result-card.matiere {
    border: 1px solid #a7f3d0;
    background: linear-gradient(to bottom, #f0fdf4, white);
}

/* Matiere info block - ratio and estimated price */
.matiere-info {
    display: flex;
    gap: 8px;
    margin: 8px 0;
    flex-wrap: wrap;
}

.ratio-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background: #dbeafe;
    color: #1d4ed8;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
}

.prix-estime {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background: #d1fae5;
    color: #047857;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
}

.aussi-dimensions-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    background: #fef3c7;
    color: #92400e;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #fcd34d;
}

/* =============================================================================
   HISTORIQUE
   ============================================================================= */

.history-filters {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.search-bar {
    flex: 1;
    position: relative;
    max-width: 600px;
}

.search-bar svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--gray-400);
}

.search-bar input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-size: 14px;
    color: var(--gray-800);
    background: var(--white);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
}

.history-sort {
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-sort svg {
    width: 18px;
    height: 18px;
    color: var(--gray-400);
}

.history-sort select {
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--gray-600);
    background: var(--white);
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* History Card */
.history-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all 0.2s ease;
}

.history-card:hover {
    box-shadow: var(--shadow-md);
}

.history-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-score {
    padding: 3px 8px;
    background: var(--success-light);
    color: var(--success);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    margin-left: auto;
}

.history-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 16px;
}

.history-date svg {
    width: 14px;
    height: 14px;
}

.history-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.history-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--gray-600);
}

.history-stat.success {
    background: var(--success-light);
    color: var(--success);
}

.history-actions {
    display: flex;
    gap: 12px;
}

.btn-consult {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    background: transparent;
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-consult svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-consult:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.btn-consult:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-download:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-download {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    color: var(--gray-400);
    cursor: pointer;
}

.btn-download:hover {
    background: var(--gray-50);
    color: var(--gray-600);
}

.btn-download svg {
    width: 18px;
    height: 18px;
}

/* =============================================================================
   MODAL
   ============================================================================= */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    color: var(--gray-500);
    cursor: pointer;
}

.modal-close:hover {
    background: var(--gray-100);
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.detail-section {
    margin-bottom: 24px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-100);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 12px;
    color: var(--gray-500);
}

.detail-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-800);
}

/* =============================================================================
   LOADING
   ============================================================================= */

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 2000;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.loading-overlay.active {
    display: flex;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay p {
    font-size: 16px;
    font-weight: 500;
    color: var(--gray-600);
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */

@media (max-width: 1200px) {
    .depot-layout {
        grid-template-columns: 1fr;
    }

    .criteres-section {
        order: -1;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        flex-direction: row;
        padding: 12px;
    }

    .sidebar-nav {
        display: flex;
        flex: 1;
        padding: 0;
        gap: 8px;
    }

    .nav-item {
        padding: 8px 12px;
    }

    .sidebar-footer {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .filters-row {
        flex-direction: column;
    }

    .filter-input {
        max-width: none;
    }
}

/* =============================================================================
   EMPTY STATE
   ============================================================================= */

.empty-state {
    text-align: center;
    padding: 60px 40px;
    color: var(--gray-500);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--gray-300);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* =============================================================================
   EXTRACTION INFO
   ============================================================================= */

.extraction-info {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 16px;
}

.extraction-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-700);
    margin-bottom: 10px;
}

.extraction-header svg {
    width: 16px;
    height: 16px;
}

.extraction-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.extraction-item {
    background: var(--white);
    border-radius: var(--radius-sm);
    padding: 10px;
    border: 1px solid var(--gray-100);
}

.extraction-filename {
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-800);
    margin-bottom: 6px;
}

.extraction-details {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: var(--gray-600);
}

.extraction-details span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.extraction-details strong {
    color: var(--gray-700);
}

.extraction-warning {
    color: var(--warning) !important;
}

.extraction-warning strong {
    color: var(--warning) !important;
}

/* Composants details table */
.composants-details {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.composants-details-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.composants-details-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--primary);
    border-radius: 2px;
}

.composants-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
    overflow: hidden;
}

.composants-table thead {
    background: var(--gray-100);
}

.composants-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-200);
}

.composants-table td {
    padding: 10px 12px;
    color: var(--gray-600);
    border-bottom: 1px solid var(--gray-100);
}

.composants-table tbody tr:last-child td {
    border-bottom: none;
}

.composants-table tbody tr:hover {
    background: var(--white);
}

.composants-table td strong {
    color: var(--gray-800);
    font-weight: 600;
}

/* =============================================================================
   API MESSAGES
   ============================================================================= */

.api-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    margin-bottom: 20px;
    grid-column: 1 / -1;
}

.api-message svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.api-message.warning {
    background: var(--warning-light);
    border: 1px solid var(--warning);
    color: #92400e;
}

.api-message.warning svg {
    color: var(--warning);
}

.api-message.success {
    background: var(--success-light);
    border: 1px solid var(--success);
    color: #065f46;
}

.api-message.success svg {
    color: var(--success);
}

/* =============================================================================
   DIMENSIONS INPUTS
   ============================================================================= */

.dimensions-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dimensions-inputs input {
    flex: 1;
    min-width: 0;
}

.dim-separator {
    color: var(--gray-400);
    font-weight: 500;
    font-size: 14px;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
}

/* =============================================================================
   MULTI-FORMAT SELECTION
   ============================================================================= */

.formats-multiples {
    margin-top: 12px;
    padding: 12px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}

.formats-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 10px;
}

.formats-title svg {
    color: var(--gray-500);
}

.formats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.format-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 8px 12px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: left;
}

.format-btn:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.format-btn.active {
    border-color: var(--primary);
    background: #eef2ff;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.format-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-800);
    margin-bottom: 2px;
}

.format-dims {
    font-size: 12px;
    color: var(--primary);
    font-weight: 500;
}

.format-qty {
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 2px;
}

.format-ref {
    font-size: 10px;
    color: var(--gray-400);
    font-family: monospace;
}

.format-design {
    font-size: 10px;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 1px 6px;
    border-radius: 3px;
    margin-top: 2px;
}

.format-matiere {
    font-size: 9px;
    color: var(--gray-500);
    margin-top: 2px;
    font-style: italic;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.format-type {
    font-size: 11px;
    color: var(--gray-600);
    font-weight: 500;
    margin-bottom: 2px;
}

.format-composants {
    font-size: 10px;
    color: var(--success);
    font-weight: 500;
    margin-top: 3px;
    padding: 2px 6px;
    background: #ecfdf5;
    border-radius: 3px;
    display: inline-block;
}

.format-finitions {
    font-size: 10px;
    color: var(--primary);
    margin-top: 4px;
    font-style: italic;
}

/* =============================================================================
   DETAIL ENRICHI - Vue detail avec chiffrage
   ============================================================================= */

/* Loading */
.loading-detail {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
    color: var(--gray-500);
    font-size: 14px;
}

.loading-detail::before {
    content: '';
    width: 36px;
    height: 36px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Section titles */
.detail-section-title-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gray-200);
}

.detail-section-title-bar .section-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.detail-section-title-bar .section-icon svg {
    width: 16px;
    height: 16px;
}

.detail-section-title-bar.comparison {
    border-bottom-color: var(--primary);
}

.detail-section-title-bar.comparison .section-icon {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.detail-section-title-bar.chiffrage {
    border-bottom-color: var(--success);
}

.detail-section-title-bar.chiffrage .section-icon {
    background: var(--success-light);
    color: var(--success);
}

.detail-section-title-bar.elements {
    border-bottom-color: var(--warning);
}

.detail-section-title-bar.elements .section-icon {
    background: var(--warning-light);
    color: var(--warning);
}

/* Comparison Table (PQF vs Devis) */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.comparison-table thead th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comparison-table thead th:first-child {
    background: var(--gray-100);
    color: var(--gray-600);
    width: 30%;
}

.comparison-table thead th.col-pqf {
    background: rgba(99, 102, 241, 0.08);
    color: var(--primary);
}

.comparison-table thead th.col-devis {
    background: rgba(16, 185, 129, 0.08);
    color: var(--success);
}

.comparison-table thead th.col-match {
    background: var(--gray-50);
    color: var(--gray-600);
    width: 60px;
    text-align: center;
}

.comparison-table tbody td {
    padding: 10px 14px;
    border-top: 1px solid var(--gray-100);
    color: var(--gray-700);
}

.comparison-table tbody td:first-child {
    font-weight: 500;
    color: var(--gray-600);
    font-size: 12px;
}

.comparison-table tbody td.match-ok {
    color: var(--success);
}

.comparison-table tbody td.match-partial {
    color: var(--warning);
}

.comparison-table .match-indicator {
    display: flex;
    justify-content: center;
}

.match-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.match-dot.green { background: var(--success); }
.match-dot.orange { background: var(--warning); }
.match-dot.red { background: #ef4444; }
.match-dot.gray { background: var(--gray-300); }

/* Chiffrage Section */
.chiffrage-section {
    margin-bottom: 20px;
}

.chiffrage-subtitle {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chiffrage-subtitle::before {
    content: '';
    width: 3px;
    height: 14px;
    border-radius: 2px;
}

.chiffrage-subtitle.matieres::before { background: #3b82f6; }
.chiffrage-subtitle.fabrication::before { background: #f59e0b; }
.chiffrage-subtitle.sous-traitance::before { background: #ef4444; }

.chiffrage-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-bottom: 14px;
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.chiffrage-table thead th {
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-600);
    background: var(--gray-50);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.chiffrage-table tbody td {
    padding: 7px 10px;
    color: var(--gray-700);
    border-top: 1px solid var(--gray-50);
}

.chiffrage-table tbody tr:hover {
    background: var(--gray-50);
}

/* Cost Summary Block */
.cost-summary {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 12px;
}

.cost-summary-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 10px;
}

.cost-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.cost-summary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cost-summary-item .cost-label {
    font-size: 11px;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.cost-summary-item .cost-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
}

.cost-summary-item.total .cost-value {
    color: var(--primary);
    font-size: 18px;
}

/* Elements Table */
.elements-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.elements-table thead th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-600);
    background: var(--gray-100);
    font-size: 11px;
    text-transform: uppercase;
}

.elements-table tbody td {
    padding: 10px 12px;
    color: var(--gray-700);
    border-top: 1px solid var(--gray-100);
}

.elements-table tbody tr:hover {
    background: var(--gray-50);
}

.elements-table tbody tr.matched-row {
    background: rgba(99, 102, 241, 0.06);
    border-left: 3px solid var(--primary);
}

.elements-table tbody tr.matched-row td:first-child {
    font-weight: 600;
    color: var(--primary);
}

.elements-table tfoot td {
    padding: 10px 12px;
    font-weight: 700;
    color: var(--gray-800);
    background: var(--gray-50);
    border-top: 2px solid var(--gray-200);
}

.matched-badge {
    display: inline-flex;
    padding: 2px 6px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 6px;
}

/* Emballage info */
.emballage-info {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--gray-600);
}

.emballage-info strong {
    color: var(--gray-700);
}

/* OF Cards */
.of-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0;
    align-items: flex-start;
}
.of-card {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 12px;
    width: 250px;
    flex: 0 0 250px;
}
.of-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.of-number {
    background: var(--primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}
.of-ref {
    font-size: 12px;
    color: var(--gray-500);
    font-family: monospace;
}
.of-status {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.of-card-body {
    font-size: 13px;
    color: var(--gray-700);
    line-height: 1.4;
}
.of-card-qty {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 4px;
}

/* Gamme de fabrication */
.gamme-list {
    padding: 12px 16px;
}
.gamme-step {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
}
.gamme-step-number {
    background: var(--primary);
    color: var(--white);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}
.gamme-step-text {
    font-size: 13.5px;
    color: var(--gray-700);
    line-height: 1.4;
}

/* No data message */
.no-data {
    padding: 20px;
    text-align: center;
    color: var(--gray-400);
    font-size: 13px;
    font-style: italic;
}

/* Detail error */
.detail-error {
    padding: 20px;
    text-align: center;
    color: #ef4444;
    font-size: 14px;
}

/* Responsive for detail tables */
.detail-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
