/* =============================================================
   IFC Analyzer — Design System
   Palette : Notion + Stripe + dashboard industriel BIM
   Variables, typographie, composants harmonisés
   ============================================================= */

/* ====== TOKENS ====== */
:root {
    /* Couleurs primaires (indigo) */
    --primary-50:  #eef2ff;
    --primary-100: #e0e7ff;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;

    /* Neutres (slate) */
    --slate-50:  #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    /* Statuts sémantiques */
    --success-50:  #ecfdf5;
    --success-500: #10b981;
    --success-600: #059669;
    --success-700: #047857;
    --warning-50:  #fffbeb;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --danger-50:   #fef2f2;
    --danger-500:  #ef4444;
    --danger-600:  #dc2626;
    --info-50:     #eff6ff;
    --info-500:    #3b82f6;
    --info-600:    #2563eb;

    /* Couleurs de statut métier (Tracker) */
    --status-in_building: #64748b;
    --status-démonté:     #f59e0b;
    --status-transporté:  #3b82f6;
    --status-stocké:      #a855f7;
    --status-réutilisé:   #10b981;
    --status-recycler:    #ef4444;

    /* Surfaces */
    --bg-app:     var(--slate-50);
    --bg-surface: #ffffff;
    --bg-muted:   var(--slate-100);

    /* Bordures */
    --border:        var(--slate-200);
    --border-strong: var(--slate-300);

    /* Texte */
    --text-strong: var(--slate-900);
    --text-base:   var(--slate-700);
    --text-muted:  var(--slate-500);
    --text-faint:  var(--slate-400);

    /* Ombres (subtiles, style Stripe) */
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, .08), 0 2px 4px -2px rgba(15, 23, 42, .04);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, .08), 0 4px 6px -4px rgba(15, 23, 42, .04);

    /* Rayons */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Espacements (échelle 4px) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* Layout */
    --sidebar-width: 240px;
    --topbar-height: 64px;

    /* Transitions */
    --t-fast: 120ms ease;
    --t-base: 200ms ease;
    --t-slow: 320ms cubic-bezier(.4, 0, .2, 1);
}

/* ====== RESET & BASE ====== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { height: 100%; }
body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-base);
    background: var(--bg-app);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--primary-600); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--primary-700); }

h1, h2, h3, h4, h5, h6 {
    color: var(--text-strong);
    font-weight: 600;
    line-height: 1.3;
}

ul { list-style: none; }
img, svg { display: block; max-width: 100%; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--slate-200); border-radius: 5px; border: 2px solid var(--bg-app); }
::-webkit-scrollbar-thumb:hover { background: var(--slate-300); }

/* ====== LAYOUT (sidebar + topbar + contenu) ====== */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    min-height: 100vh;
}

/* ----- Sidebar ----- */
.app-sidebar {
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 20;
}

.app-sidebar-header {
    padding: var(--space-5) var(--space-5) var(--space-4);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.app-sidebar-logo {
    width: 36px; height: 36px;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    display: grid; place-items: center;
    color: white;
    box-shadow: var(--shadow-sm);
}
.app-sidebar-logo svg { width: 20px; height: 20px; }
.app-sidebar-brand {
    display: flex; flex-direction: column;
    line-height: 1.2;
}
.app-sidebar-brand-name {
    font-weight: 700;
    color: var(--text-strong);
    font-size: 15px;
}
.app-sidebar-brand-sub {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.app-sidebar-nav {
    padding: var(--space-3);
    flex: 1;
    overflow-y: auto;
}
.app-sidebar-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: var(--space-3) var(--space-3) var(--space-2);
}
.app-nav-link {
    display: flex; align-items: center; gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--text-base);
    font-size: 14px;
    font-weight: 500;
    transition: background var(--t-fast), color var(--t-fast);
    margin-bottom: 2px;
}
.app-nav-link:hover {
    background: var(--bg-muted);
    color: var(--text-strong);
}
.app-nav-link svg {
    width: 18px; height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.app-nav-link:hover svg { color: var(--text-base); }

.app-nav-link.is-active {
    background: var(--primary-50);
    color: var(--primary-700);
    font-weight: 600;
}
.app-nav-link.is-active svg { color: var(--primary-600); }
.app-nav-link .nav-badge {
    margin-left: auto;
    background: var(--bg-muted);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
}
.app-nav-link.is-active .nav-badge {
    background: var(--primary-100);
    color: var(--primary-700);
}

.app-sidebar-footer {
    padding: var(--space-3) var(--space-4) var(--space-4);
    border-top: 1px solid var(--border);
}

.app-sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
}

.app-sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-100);
    color: var(--primary-600);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.app-sidebar-user-avatar i {
    width: 16px;
    height: 16px;
}

.app-sidebar-user-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.app-sidebar-user-email {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-base);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar-user-logout {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.app-sidebar-user-logout:hover {
    background: var(--danger-50);
    color: var(--danger-600);
}

.app-sidebar-user-logout i {
    width: 16px;
    height: 16px;
}

/* ----- Topbar ----- */
.app-content {
    display: flex; flex-direction: column;
    min-width: 0;
    background: var(--bg-app);
}
.app-topbar {
    height: var(--topbar-height);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0 var(--space-8);
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 10;
}
.app-topbar-title {
    display: flex; flex-direction: column;
}
.app-topbar-eyebrow {
    font-size: 11px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 600;
}
.app-topbar-h1 {
    font-size: 18px;
    color: var(--text-strong);
    font-weight: 600;
}
.app-topbar-actions {
    display: flex; align-items: center; gap: var(--space-2);
}

.app-page {
    padding: var(--space-8);
    max-width: 1400px;
    width: 100%;
}

/* ====== TYPOGRAPHIE / LAYOUT HELPERS ====== */
.h-section {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-faint);
    display: flex; align-items: center; gap: var(--space-2);
    margin-bottom: var(--space-3);
}
.h-section svg { width: 14px; height: 14px; }

.h-page {
    font-size: 22px;
    color: var(--text-strong);
    margin-bottom: var(--space-1);
}
.h-page-sub {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: var(--space-6);
}

.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.row-end { display: flex; align-items: center; gap: var(--space-2); justify-content: flex-end; flex-wrap: wrap; }
.grow { flex: 1; }

/* ====== BOUTONS ====== */
.btn {
    display: inline-flex; align-items: center; gap: var(--space-2);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    transition: all var(--t-fast);
    white-space: nowrap;
    user-select: none;
    border: 1px solid transparent;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-lg { padding: 10px 18px; font-size: 14px; }

.btn-primary {
    background: var(--primary-600);
    color: white;
    box-shadow: var(--shadow-xs);
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-700);
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-base);
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--bg-muted);
    border-color: var(--border-strong);
    color: var(--text-strong);
}

.btn-ghost {
    background: transparent;
    color: var(--text-base);
}
.btn-ghost:hover:not(:disabled) {
    background: var(--bg-muted);
    color: var(--text-strong);
}

.btn-success {
    background: var(--success-600);
    color: white;
}
.btn-success:hover:not(:disabled) { background: var(--success-700); }

.btn-danger {
    background: var(--danger-600);
    color: white;
}
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-icon {
    padding: 8px;
    width: 36px; height: 36px;
    justify-content: center;
}

/* ====== CARTES ====== */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--t-base);
}
.card-pad   { padding: var(--space-6); }
.card-pad-sm { padding: var(--space-4); }
.card-hover:hover { box-shadow: var(--shadow-sm); }

.card-header {
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--space-3);
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-strong);
    display: flex; align-items: center; gap: var(--space-2);
}
.card-title svg { width: 18px; height: 18px; color: var(--text-muted); }
.card-body  { padding: var(--space-6); }
.card-footer {
    padding: var(--space-3) var(--space-6);
    border-top: 1px solid var(--border);
    background: var(--slate-50);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* KPI cards (Dashboard) */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
}
.kpi {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--t-base), transform var(--t-base);
}
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
    display: flex; align-items: center; gap: var(--space-2);
}
.kpi-label svg {
    width: 14px; height: 14px;
}
.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-strong);
    margin: var(--space-2) 0 var(--space-1);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.kpi-trend {
    font-size: 12px;
    color: var(--text-muted);
    display: flex; align-items: center; gap: 4px;
}
.kpi-trend.up    { color: var(--success-600); }
.kpi-trend.down  { color: var(--danger-600); }
.kpi-trend svg { width: 12px; height: 12px; }
.kpi-icon {
    position: absolute; top: var(--space-4); right: var(--space-4);
    width: 36px; height: 36px;
    border-radius: var(--radius-md);
    background: var(--primary-50);
    color: var(--primary-600);
    display: grid; place-items: center;
}
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-icon.success { background: var(--success-50); color: var(--success-600); }
.kpi-icon.warning { background: var(--warning-50); color: var(--warning-600); }
.kpi-icon.danger  { background: var(--danger-50);  color: var(--danger-600); }
.kpi-icon.info    { background: var(--info-50);    color: var(--info-600); }

/* ====== FORMULAIRES ====== */
.form-field { display: flex; flex-direction: column; gap: var(--space-2); }
.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-base);
}
.form-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.input, .select, .textarea {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-strong);
    transition: border-color var(--t-fast), box-shadow var(--t-fast);
    box-shadow: var(--shadow-xs);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .15);
}
.select {
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}
.textarea { resize: vertical; min-height: 88px; }

/* ====== TABLES ====== */
.table-wrap {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table thead {
    background: var(--slate-50);
}
.table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}
.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-base);
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--t-fast); }
.table tbody tr:hover { background: var(--slate-50); }

/* ====== BADGES ====== */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: .03em;
}
.badge-neutral  { background: var(--slate-100); color: var(--slate-700); }
.badge-primary  { background: var(--primary-50); color: var(--primary-700); }
.badge-success  { background: var(--success-50); color: var(--success-700); }
.badge-warning  { background: var(--warning-50); color: var(--warning-600); }
.badge-danger   { background: var(--danger-50); color: var(--danger-600); }
.badge-info     { background: var(--info-50); color: var(--info-600); }

/* Badges de statut métier (Tracker) */
.status-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}
.status-badge::before {
    content: ""; width: 6px; height: 6px; border-radius: 50%;
    background: currentColor;
}
.status-in_building { background: #f1f5f9; color: var(--slate-700); }
.status-démonté     { background: #fef3c7; color: #92400e; }
.status-transporté  { background: #dbeafe; color: #1e40af; }
.status-stocké      { background: #f3e8ff; color: #6b21a8; }
.status-réutilisé   { background: #d1fae5; color: #065f46; }
.status-recycler    { background: #fee2e2; color: #991b1b; }
.status-recycler::before, .status-réutilisé::before { background: currentColor; }

/* ====== ALERTES ====== */
.alert {
    display: flex; align-items: flex-start; gap: var(--space-3);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid;
    font-size: 13px;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-50); border-color: #a7f3d0; color: var(--success-700); }
.alert-warning { background: var(--warning-50); border-color: #fde68a; color: #92400e; }
.alert-danger  { background: var(--danger-50); border-color: #fecaca; color: var(--danger-600); }
.alert-info    { background: var(--info-50); border-color: #bfdbfe; color: var(--info-600); }

/* ====== MODALES ====== */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .5);
    backdrop-filter: blur(4px);
    display: grid; place-items: center;
    z-index: 1000;
    padding: var(--space-4);
    animation: fadeIn var(--t-base);
}
.modal-overlay.hidden { display: none; }
.modal-box {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 480px; width: 100%;
    max-height: 90vh; overflow-y: auto;
    animation: slideUp var(--t-slow);
}
.modal-header {
    padding: var(--space-5) var(--space-6) var(--space-3);
    display: flex; align-items: center; gap: var(--space-3);
    border-bottom: 1px solid var(--border);
}
.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-strong);
    display: flex; align-items: center; gap: var(--space-2);
}
.modal-title svg { width: 18px; height: 18px; color: var(--primary-600); }
.modal-body { padding: var(--space-5) var(--space-6); }
.modal-footer {
    padding: var(--space-3) var(--space-6) var(--space-5);
    display: flex; justify-content: flex-end; gap: var(--space-2);
    border-top: 1px solid var(--border);
}
.modal-field { margin-bottom: var(--space-4); }
.modal-field label { display: block; margin-bottom: var(--space-2); font-size: 13px; font-weight: 500; color: var(--text-base); }
.modal-radio-group { display: flex; gap: var(--space-4); }
.modal-radio-group label { display: flex; align-items: center; gap: var(--space-2); margin: 0; font-weight: 400; cursor: pointer; }

/* ====== SKELETONS ====== */
.skeleton {
    background: linear-gradient(90deg, var(--slate-100) 0%, var(--slate-200) 50%, var(--slate-100) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
    border-radius: var(--radius-sm);
    color: transparent;
    pointer-events: none;
}
@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ====== SPINNER ====== */
.spinner {
    width: 24px; height: 24px;
    border: 2px solid var(--slate-200);
    border-top-color: var(--primary-600);
    border-radius: 50%;
    animation: spin 800ms linear infinite;
}
.spinner-lg { width: 40px; height: 40px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ====== LOADER OVERLAY ====== */
.loader-block {
    display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
    padding: var(--space-12);
    color: var(--text-muted);
    font-size: 13px;
}

/* ====== ZONE D'UPLOAD ====== */
.dropzone {
    background: var(--bg-surface);
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: var(--space-12) var(--space-8);
    text-align: center;
    transition: all var(--t-base);
    cursor: pointer;
}
.dropzone:hover, .dropzone.is-dragover {
    border-color: var(--primary-500);
    background: var(--primary-50);
}
.dropzone-icon {
    width: 56px; height: 56px;
    border-radius: var(--radius-lg);
    background: var(--primary-50);
    color: var(--primary-600);
    display: grid; place-items: center;
    margin: 0 auto var(--space-4);
}
.dropzone-icon svg { width: 28px; height: 28px; }
.dropzone h3 {
    font-size: 16px;
    color: var(--text-strong);
    margin-bottom: var(--space-1);
}
.dropzone p {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: var(--space-5);
}
.dropzone .file-name {
    margin-top: var(--space-3);
    font-size: 13px;
    color: var(--success-700);
    font-weight: 500;
}

/* ====== GRILLES (résultats / KPI) ====== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3);
}

/* ====== CHIPS / FILTERS ====== */
.chip {
    display: inline-flex; align-items: center; gap: var(--space-2);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-base);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--t-fast);
}
.chip:hover { border-color: var(--border-strong); color: var(--text-strong); }
.chip.is-active {
    background: var(--primary-600);
    color: white;
    border-color: var(--primary-600);
}

/* ====== UTILITIES ====== */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-strong { color: var(--text-strong); }
.text-success { color: var(--success-600); }
.text-danger  { color: var(--danger-600); }
.text-warning { color: var(--warning-600); }
.text-mono { font-family: 'SF Mono', Consolas, Monaco, monospace; font-size: 12px; }
.text-sm { font-size: 12px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 20px; }
.font-bold { font-weight: 600; }
.font-semibold { font-weight: 500; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }

/* ====== ANIMATIONS ====== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.fade-in { animation: fadeIn var(--t-base); }
.slide-up { animation: slideUp var(--t-slow); }

/* ====== COMPAT — classes utilisées par script.js existant ====== */
.upload-card.drag-over,
.dropzone.drag-over {
    border-color: var(--primary-500);
    background: var(--primary-50);
}
.warning-item {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 10px 14px;
    background: var(--warning-50);
    border: 1px solid #fde68a;
    border-radius: var(--radius-md);
    color: #92400e;
    font-size: 13px;
    margin-bottom: 8px;
}
.warning-item svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }

/* Cartes de stats / type-count (style script.js renderSummary / renderTypeCount) */
.stat-card, .type-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--t-base), transform var(--t-base);
}
.stat-card:hover, .type-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.stat-value, .type-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-strong);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.stat-label, .type-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 500;
    margin-top: 6px;
}
.type-card { display: flex; flex-direction: column; gap: 4px; }

/* Boutons de filtre (script.js renderFilters) */
.filter-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-base);
    cursor: pointer;
    transition: all var(--t-fast);
}
.filter-btn:hover { border-color: var(--border-strong); color: var(--text-strong); }
.filter-btn.active {
    background: var(--primary-600);
    color: white;
    border-color: var(--primary-600);
}
.filter-buttons { display: flex; flex-wrap: wrap; gap: 8px; }

/* Sections (compat avec scripts de masquage hidden) */
.summary-section, .type-count-section, .filter-section, .table-section {
    margin-top: var(--space-6);
}
.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-strong);
    display: flex; align-items: center; gap: var(--space-2);
    margin-bottom: var(--space-4);
}
.section-title svg { width: 18px; height: 18px; color: var(--primary-600); }

.no-results {
    padding: var(--space-8);
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.export-buttons {
    display: flex; flex-wrap: wrap; gap: 8px;
}

.warnings { margin-top: var(--space-3); }

.file-name {
    margin-top: var(--space-3);
    font-size: 13px;
    color: var(--success-700);
    font-weight: 500;
}

/* Loader (script.js show/hide) */
.loader {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: var(--space-8);
    color: var(--text-muted);
}

/* Tableau de données extraites (réutilise .table mais avec id #dataTable) */
#dataTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
#dataTable thead {
    background: var(--slate-50);
    position: sticky; top: 0; z-index: 1;
}
#dataTable th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}
#dataTable td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-base);
}
#dataTable tbody tr:hover { background: var(--slate-50); }
.table-wrapper {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: auto;
    max-height: 600px;
    box-shadow: var(--shadow-xs);
}

/* Format picker popover (script.js) */
.fmt-picker { animation: slideUp var(--t-base); }
.fmt-opt {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 16px; width: 100%; text-align: left;
    background: white; cursor: pointer; transition: background var(--t-fast);
    font-size: 13px; color: var(--text-base);
}
.fmt-opt:hover { background: var(--slate-50); }

/* ====== RESPONSIVE ====== */
@media (max-width: 1024px) {
    .app-shell { grid-template-columns: 1fr; }
    .app-sidebar {
        position: fixed; top: 0; left: 0;
        transform: translateX(-100%);
        transition: transform var(--t-base);
        width: var(--sidebar-width);
    }
    .app-sidebar.is-open { transform: translateX(0); }
    .app-page { padding: var(--space-4); }
    .app-topbar { padding: 0 var(--space-4); }
}
