:root { 
    --primary-color: #3498db; 
    --secondary-color: #2c3e50; 
    --success-color: #27ae60; 
    --bg-light: #f8f9fa; 
}
* { box-sizing: border-box; }
body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
    padding: 0; 
    margin: 0; 
    display: flex; 
    flex-direction: column; 
    height: 100vh; 
    background: var(--bg-light);
}
.header { 
    background: linear-gradient(135deg, var(--secondary-color), #1a252f); 
    color: white; 
    padding: 12px 15px; 
}
.header-content { display: flex; justify-content: space-between; align-items: center; }
.logo-section { display: flex; align-items: center; gap: 10px; }
.logo-icon { font-size: 28px; }
.main-title { font-size: 18px; font-weight: 700; }
.subtitle { font-size: 11px; opacity: 0.8; display: block; }
.settings-btn { background: rgba(255,255,255,0.2); border: none; padding: 8px 12px; border-radius: 5px; cursor: pointer; font-size: 16px; }
.settings-panel { background: #fff; padding: 15px; border-bottom: 1px solid #ddd; }
.settings-panel.hidden { display: none; }
.form-group { margin-bottom: 10px; }
.form-group label { display: block; font-size: 12px; margin-bottom: 4px; color: #666; }
.form-group input { width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 4px; }
.save-btn { background: var(--success-color); color: white; border: none; padding: 8px 15px; border-radius: 4px; cursor: pointer; }
.tabs { 
    display: flex; 
    flex-wrap: wrap;
    background: #fff; 
    border-bottom: 1px solid #ddd;
    padding: 4px 6px;
    gap: 2px;
    justify-content: center;
}
.tab { 
    padding: 6px 9px; 
    cursor: pointer; 
    white-space: nowrap; 
    font-size: 11px;
    border-bottom: 2px solid transparent;
    border-radius: 4px;
    transition: all 0.2s;
    flex: 0 0 auto;
}
.tab:hover { background: #f0f0f0; }
.tab.active { 
    background: #eaf4fb; 
    color: var(--primary-color); 
    border-bottom: 2px solid var(--primary-color);
    font-weight: 600;
}
.main-content { 
    flex: 1; 
    overflow-y: auto; 
    padding: 15px; 
}
.section { margin-bottom: 15px; }
.section-title { font-weight: 600; margin-bottom: 10px; color: var(--secondary-color); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.drop-zone { 
    border: 2px dashed #ccc; 
    padding: 25px; 
    text-align: center; 
    cursor: pointer; 
    margin-bottom: 10px;
    border-radius: 8px;
    background: #fff;
    transition: all 0.2s;
}
.drop-zone:hover { border-color: var(--primary-color); background: #f8f9ff; }
.drop-text { color: #888; font-size: 13px; }
.file-list { max-height: 120px; overflow-y: auto; }
.file-item { 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    background: #fff; 
    padding: 8px 12px; 
    margin: 5px 0; 
    border: 1px solid #eee;
    border-radius: 5px;
    font-size: 12px;
}
.file-item button { background: none; border: none; cursor: pointer; color: #e74c3c; font-size: 16px; }
.brief-input { 
    width: 100%; 
    min-height: 80px; 
    padding: 10px; 
    border: 1px solid #ddd; 
    border-radius: 5px;
    resize: vertical;
    font-family: inherit;
}
.primary-btn { 
    width: 100%; 
    padding: 12px; 
    color: white; 
    background: var(--primary-color); 
    border: none; 
    border-radius: 6px; 
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.1s, opacity 0.2s;
}
.primary-btn:hover { opacity: 0.9; }
.primary-btn:active { transform: scale(0.98); }
.mt-10 { margin-top: 10px; }
.help-text { font-size: 12px; color: #888; margin: 10px 0; }
.api-row { display: flex; gap: 10px; }
.api-row input, .api-row select { flex: 1; padding: 8px; border: 1px solid #ddd; border-radius: 4px; }
.methodology-info { background: #e8f5e9; padding: 12px; border-radius: 5px; font-size: 13px; }
.chat-section { margin-top: 15px; }
.chat-container { 
    max-height: 200px; 
    overflow-y: auto; 
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    padding: 10px;
}
.message { 
    padding: 10px 12px; 
    margin: 6px 0; 
    border-radius: 8px; 
    font-size: 13px;
    line-height: 1.5;
}
.message.system { background: #e3f2fd; color: #1565c0; }
.message.user { background: var(--secondary-color); color: white; text-align: right; margin-left: 20%; }
.message.ai { background: #f5f5f5; border-left: 3px solid var(--primary-color); margin-right: 20%; }
.chat-footer { 
    background: #fff; 
    padding: 10px 15px; 
    border-top: 1px solid #eee; 
}
.chat-input-wrapper { display: flex; gap: 8px; }
.chat-input { 
    flex: 1; 
    padding: 10px; 
    border: 1px solid #ddd; 
    border-radius: 20px;
    outline: none;
}
.chat-input:focus { border-color: var(--primary-color); }
.send-btn { 
    background: var(--primary-color); 
    color: white; 
    border: none; 
    width: 40px; 
    height: 40px; 
    border-radius: 50%; 
    cursor: pointer;
    font-size: 16px;
}
.generated-image { max-width: 100%; border-radius: 8px; margin-top: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }


/* Bouton Réinitialisation Projet */
.reset-btn {
    width: 100%;
    margin-top: 10px;
    padding: 8px 15px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}
.reset-btn:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}


/* ============================================
   ARCHI-EXPERT v8.0 - NOUVELLES FONCTIONNALITÉS
   ============================================ */

/* MODAL GÉNÉRIQUE */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal.hidden { display: none; }
.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 90%;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.modal-large { width: 95%; max-height: 90vh; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--secondary-color), #1a252f);
    color: white;
}
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
}
.modal-close:hover { opacity: 1; }
.modal-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    display: flex;
    gap: 10px;
    border-top: 1px solid #eee;
}
.modal-footer .primary-btn { flex: 1; }

/* FORMULAIRE ÉDITION */
.edit-form {
    padding: 20px;
    overflow-y: auto;
    max-height: 60vh;
}
.edit-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}
.edit-section h4 {
    margin: 0 0 15px 0;
    color: var(--secondary-color);
    font-size: 14px;
}
.edit-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 10px;
}
.edit-field {
    display: flex;
    flex-direction: column;
}
.edit-field label {
    font-size: 11px;
    color: #666;
    margin-bottom: 3px;
}
.edit-field input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}
.edit-field input:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* PREVIEW */
.preview-content {
    padding: 20px;
    overflow-y: auto;
    max-height: 65vh;
    background: white;
}
.preview-content iframe {
    width: 100%;
    height: 500px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

/* HISTORIQUE */
.history-list {
    margin-top: 15px;
    max-height: 150px;
    overflow-y: auto;
}
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    margin: 5px 0;
    border-radius: 5px;
    font-size: 12px;
}
.history-item:hover { background: #e8f4fc; }
.history-item button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
}
.history-item .delete-btn { background: #e74c3c; margin-left: 5px; }

/* SETTINGS ACTIONS */
.settings-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.settings-actions button { flex: 1; min-width: 100px; }


/* ============================================
   ARCHI-EXPERT v9.0 - NOUVELLES FONCTIONNALITÉS
   ============================================ */

/* MODE SOMBRE */
body.dark-mode {
    --primary-color: #5dade2;
    --secondary-color: #1a252f;
    --success-color: #2ecc71;
    --bg-light: #1e272e;
    --text-color: #ecf0f1;
    --border-color: #34495e;
}
body.dark-mode { background: var(--bg-light); color: var(--text-color); }
body.dark-mode .header { background: linear-gradient(135deg, #0d1b2a, #1b263b); }
body.dark-mode .tabs { background: #1e272e; border-color: #34495e; }
body.dark-mode .tab { color: #bdc3c7; }
body.dark-mode .tab.active { background: #2c3e50; color: var(--primary-color); }
body.dark-mode .drop-zone { background: #2c3e50; border-color: #5dade2; }
body.dark-mode .file-item { background: #2c3e50; border-color: #34495e; }
body.dark-mode .chat-container { background: #2c3e50; border-color: #34495e; }
body.dark-mode .message.system { background: #1b4f72; color: #85c1e9; }
body.dark-mode .message.ai { background: #2c3e50; border-color: var(--primary-color); }
body.dark-mode .chat-footer { background: #1e272e; border-color: #34495e; }
body.dark-mode .chat-input { background: #2c3e50; border-color: #34495e; color: #ecf0f1; }
body.dark-mode .settings-panel { background: #2c3e50; border-color: #34495e; }
body.dark-mode .form-group input, body.dark-mode .form-group select { 
    background: #1e272e; border-color: #34495e; color: #ecf0f1; 
}
body.dark-mode .modal-content { background: #2c3e50; }
body.dark-mode .modal-footer { background: #1e272e; }
body.dark-mode .edit-section { background: #1e272e; }
body.dark-mode .edit-field input { background: #2c3e50; color: #ecf0f1; }
body.dark-mode .brief-input { background: #2c3e50; border-color: #34495e; color: #ecf0f1; }

/* HEADER ACTIONS */
.header-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.25); }
.icon-btn.active { background: var(--primary-color); }

/* BARRE PROJETS */
.projects-bar {
    display: flex;
    background: #ecf0f1;
    padding: 5px 10px;
    border-bottom: 1px solid #ddd;
    align-items: center;
    overflow-x: auto;
}
body.dark-mode .projects-bar { background: #1e272e; border-color: #34495e; }
.project-tabs { display: flex; gap: 5px; flex: 1; }
.project-tab {
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
}
body.dark-mode .project-tab { background: #2c3e50; border-color: #34495e; color: #ecf0f1; }
.project-tab.active { 
    background: var(--primary-color); 
    color: white; 
    border-color: var(--primary-color); 
}
.project-tab .close-tab {
    margin-left: 8px;
    opacity: 0.6;
    font-weight: bold;
}
.project-tab .close-tab:hover { opacity: 1; }
.add-project-btn {
    background: var(--success-color);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
}

/* SETTINGS SECTIONS */
.settings-section {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}
body.dark-mode .settings-section { border-color: #34495e; }
.settings-section h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    color: var(--secondary-color);
}
body.dark-mode .settings-section h4 { color: #bdc3c7; }

/* DICTÉE VOCALE */
.voice-btn { font-size: 18px; }
.voice-btn.recording { 
    background: #e74c3c !important; 
    animation: pulse 1s infinite; 
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* CADASTRE */
.cadastre-results {
    margin-top: 15px;
    max-height: 200px;
    overflow-y: auto;
}
.cadastre-item {
    padding: 10px;
    background: #f8f9fa;
    margin: 5px 0;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
}
body.dark-mode .cadastre-item { background: #1e272e; }
.cadastre-item:hover { background: #e8f4fc; }
body.dark-mode .cadastre-item:hover { background: #2c3e50; }

/* MODAL BODY */
.modal-body { padding: 20px; }

/* OFFLINE INDICATOR */
.offline-indicator {
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    background: #e74c3c;
    color: white;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 1001;
    display: none;
}
.offline-indicator.show { display: block; }

/* PWA / RESPONSIVE */
@media (max-width: 480px) {
    .tabs { padding: 3px 4px; gap: 1px; }
    .tab { padding: 5px 7px; font-size: 10px; }
    .settings-actions { flex-direction: column; }
    .settings-actions button { width: 100%; }
    .modal-footer { flex-wrap: wrap; }
    .modal-footer .primary-btn { min-width: 45%; }
}

/* ============================================
   BARRE D'ACTIONS PROJET (Nouveau / Sauvegarder / Projets / Imprimer)
   ============================================ */
.project-action-bar {
    display: flex;
    gap: 6px;
    margin-top: 10px;
}
.pab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 4px 6px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    color: white;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.pab-btn span {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    opacity: 0.92;
}
.pab-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.pab-btn:active { transform: translateY(0); }

.pab-reset  { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.pab-reset:hover  { background: linear-gradient(135deg, #c0392b, #a93226); }
.pab-save   { background: linear-gradient(135deg, #2980b9, #1a5276); }
.pab-save:hover   { background: linear-gradient(135deg, #1a5276, #154360); }
.pab-projets { background: linear-gradient(135deg, #27ae60, #1e8449); }
.pab-projets:hover { background: linear-gradient(135deg, #1e8449, #196f3d); }
.pab-print  { background: linear-gradient(135deg, #8e44ad, #6c3483); }
.pab-print:hover  { background: linear-gradient(135deg, #6c3483, #5b2c6f); }

/* Projet cards dans modal Mes Projets */
.projet-card {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.projet-card-info { flex: 1; min-width: 0; }
.projet-card-name { font-size: 12px; font-weight: 700; color: #2c3e50; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.projet-card-meta { font-size: 10px; color: #7f8c8d; margin-top: 2px; }
.projet-card-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; }
.projet-tag { background: #eaf4fb; color: #2980b9; border-radius: 3px; padding: 1px 5px; font-size: 9px; font-weight: 600; }
.projet-card-actions { display: flex; gap: 4px; flex-shrink: 0; }
.btn-load-projet { background: #27ae60; color: white; border: none; border-radius: 4px; padding: 5px 10px; font-size: 10px; cursor: pointer; font-weight: 600; }
.btn-del-projet  { background: #e74c3c; color: white; border: none; border-radius: 4px; padding: 5px 8px; font-size: 10px; cursor: pointer; }
.btn-load-projet:hover { background: #1e8449; }
.btn-del-projet:hover  { background: #c0392b; }

/* ============================================
   ARCHI-EXPERT v11.2 - TABLEAU DE BORD PRO
   ============================================ */

/* ── MODAL BASE ── */
#dashboard-modal .modal-content { width:99vw; max-width:99vw; height:97vh; max-height:97vh; border-radius:10px; display:flex; flex-direction:column; overflow:hidden; }

/* ── TOPBAR ── */
.db-topbar { background:linear-gradient(135deg,#0f2744,#1a3a6b); color:#fff; padding:10px 16px; display:flex; align-items:center; gap:10px; flex-shrink:0; }
.db-topbar-logo { font-size:20px; }
.db-topbar-title { font-size:15px; font-weight:700; flex:1; }
.db-topbar-subtitle { font-size:10px; opacity:.7; margin-top:1px; }

/* ── KPI CARDS ── */
.db-kpi-bar { display:flex; gap:8px; background:#f0f4f8; padding:10px 14px; border-bottom:1px solid #dde3ec; flex-shrink:0; flex-wrap:wrap; }
.db-kpi { background:#fff; border:1px solid #e2e8f0; border-radius:8px; padding:10px 14px; display:flex; align-items:center; gap:10px; flex:1; min-width:120px; max-width:200px; box-shadow:0 1px 3px rgba(0,0,0,.06); transition:box-shadow .2s; }
.db-kpi:hover { box-shadow:0 4px 12px rgba(0,0,0,.1); }
.db-kpi-icon { font-size:22px; flex-shrink:0; }
.db-kpi-val { font-size:22px; font-weight:800; line-height:1; color:#0f2744; }
.db-kpi-label { font-size:10px; color:#64748b; font-weight:600; text-transform:uppercase; letter-spacing:.4px; margin-top:2px; }
.db-kpi.alert { border-color:#fca5a5; background:#fff5f5; }
.db-kpi.alert .db-kpi-val { color:#dc2626; }
.db-kpi.success { border-color:#86efac; background:#f0fdf4; }
.db-kpi.success .db-kpi-val { color:#15803d; }
.db-kpi.blue { border-color:#93c5fd; background:#eff6ff; }
.db-kpi.blue .db-kpi-val { color:#1d4ed8; }

/* ── TOOLBAR (vues + filtres + search) ── */
.db-toolbar { display:flex; gap:8px; padding:8px 14px; background:#fff; border-bottom:1px solid #e2e8f0; align-items:center; flex-wrap:wrap; flex-shrink:0; }
.db-view-switcher { display:flex; gap:2px; background:#f1f5f9; padding:3px; border-radius:7px; flex-shrink:0; }
.db-view-btn { padding:5px 11px; border:none; border-radius:5px; font-size:11px; font-weight:600; cursor:pointer; background:transparent; color:#64748b; transition:all .18s; white-space:nowrap; }
.db-view-btn.active { background:#fff; color:#1d4ed8; box-shadow:0 1px 4px rgba(0,0,0,.12); }
.db-view-btn:hover:not(.active) { background:#e2e8f0; }
.db-toolbar-sep { width:1px; height:24px; background:#e2e8f0; flex-shrink:0; }
.db-filter-chip { padding:5px 10px; border:1px solid #e2e8f0; border-radius:6px; font-size:11px; color:#374151; background:#fff; cursor:pointer; outline:none; }
.db-filter-chip:focus { border-color:#3b82f6; }
.db-search-box { flex:1; min-width:120px; padding:5px 10px; border:1px solid #e2e8f0; border-radius:6px; font-size:12px; outline:none; }
.db-search-box:focus { border-color:#3b82f6; box-shadow:0 0 0 3px rgba(59,130,246,.15); }
.db-toolbar-actions { display:flex; gap:6px; margin-left:auto; flex-shrink:0; }
.db-btn-sm { padding:5px 11px; border:none; border-radius:6px; font-size:11px; font-weight:600; cursor:pointer; transition:all .2s; white-space:nowrap; }
.db-btn-sm.green { background:#16a34a; color:#fff; }
.db-btn-sm.green:hover { background:#15803d; }
.db-btn-sm.blue  { background:#2563eb; color:#fff; }
.db-btn-sm.blue:hover  { background:#1d4ed8; }
.db-btn-sm.gray  { background:#f1f5f9; color:#374151; border:1px solid #e2e8f0; }
.db-btn-sm.gray:hover  { background:#e2e8f0; }

/* ── ALERTE BARRE ── */
.db-alert-bar { background:#fef3c7; border-bottom:2px solid #fbbf24; padding:6px 14px; font-size:11px; color:#92400e; font-weight:600; display:none; flex-shrink:0; }
.db-alert-bar.show { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }

/* ── ZONE PRINCIPALE ── */
.db-main { flex:1; overflow:hidden; display:flex; }
.db-view { display:none; width:100%; height:100%; overflow:hidden; }
.db-view.active { display:flex; }

/* ─────────────────────────────────────────────
   VUE LISTE
───────────────────────────────────────────── */
.db-list-view { flex-direction:column; overflow:hidden; }
.db-table-wrap { flex:1; overflow:auto; }
.db-table { width:100%; border-collapse:collapse; font-size:12px; }
.db-table thead th { position:sticky; top:0; background:#f8fafc; border-bottom:2px solid #e2e8f0; padding:9px 12px; text-align:left; font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; color:#64748b; white-space:nowrap; cursor:pointer; user-select:none; }
.db-table thead th:hover { background:#f1f5f9; color:#1e293b; }
.db-table thead th .sort-arrow { margin-left:4px; opacity:.4; }
.db-table thead th.sorted .sort-arrow { opacity:1; color:#3b82f6; }
.db-table tbody tr { border-bottom:1px solid #f1f5f9; cursor:pointer; transition:background .12s; }
.db-table tbody tr:hover { background:#f8fafc; }
.db-table tbody tr.selected { background:#eff6ff; }
.db-table td { padding:9px 12px; color:#1e293b; vertical-align:middle; }
.db-table td.muted { color:#94a3b8; font-style:italic; }
.db-table td.urgent { color:#dc2626; font-weight:700; }
.db-table td.warn   { color:#d97706; font-weight:600; }
.db-table td.ok     { color:#16a34a; }
.db-row-nom { font-weight:700; color:#0f2744; }
.db-row-sub { font-size:10px; color:#94a3b8; margin-top:1px; }

/* ─────────────────────────────────────────────
   VUE KANBAN
───────────────────────────────────────────── */
.db-kanban-view { overflow-x:auto; align-items:stretch; gap:0; padding:12px; background:#f0f4f8; }
.db-kanban-col { min-width:200px; max-width:220px; display:flex; flex-direction:column; background:#f8fafc; border-radius:10px; border:1px solid #e2e8f0; overflow:hidden; flex-shrink:0; }
.db-kanban-col + .db-kanban-col { margin-left:10px; }
.db-col-header { padding:10px 12px; font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.4px; display:flex; align-items:center; justify-content:space-between; flex-shrink:0; }
.db-col-count { background:rgba(0,0,0,.12); color:inherit; border-radius:10px; padding:1px 7px; font-size:10px; font-weight:700; }
.db-col-cards { flex:1; overflow-y:auto; padding:8px; display:flex; flex-direction:column; gap:7px; min-height:80px; }
.db-kanban-card { background:#fff; border-radius:7px; padding:9px 10px; border:1px solid #e2e8f0; cursor:pointer; box-shadow:0 1px 3px rgba(0,0,0,.06); transition:all .18s; }
.db-kanban-card:hover { box-shadow:0 4px 12px rgba(0,0,0,.12); transform:translateY(-2px); border-color:#93c5fd; }
.db-kanban-card-name { font-size:11px; font-weight:700; color:#0f2744; margin-bottom:4px; }
.db-kanban-card-sub  { font-size:10px; color:#64748b; }
.db-kanban-card-date { font-size:10px; color:#3b82f6; margin-top:5px; font-weight:600; }
.db-kanban-card-alert{ font-size:10px; color:#dc2626; font-weight:700; margin-top:3px; }
.db-kanban-empty { text-align:center; padding:20px 8px; color:#cbd5e1; font-size:11px; }

/* Couleurs colonnes Kanban */
.db-col-en_preparation .db-col-header { background:#fef9e7; color:#b7791f; border-bottom:3px solid #f6c90e; }
.db-col-depose         .db-col-header { background:#eff6ff; color:#1d4ed8; border-bottom:3px solid #3b82f6; }
.db-col-en_instruction .db-col-header { background:#faf5ff; color:#6d28d9; border-bottom:3px solid #8b5cf6; }
.db-col-complements    .db-col-header { background:#fff7ed; color:#c2410c; border-bottom:3px solid #f97316; }
.db-col-obtenu         .db-col-header { background:#f0fdf4; color:#15803d; border-bottom:3px solid #22c55e; }
.db-col-tacite         .db-col-header { background:#fffde7; color:#b45309; border-bottom:3px solid #eab308; }
.db-col-refuse         .db-col-header { background:#fff5f5; color:#b91c1c; border-bottom:3px solid #ef4444; }

/* ─────────────────────────────────────────────
   VUE CALENDRIER
───────────────────────────────────────────── */
.db-cal-view { flex-direction:column; overflow:hidden; }
.db-cal-nav { display:flex; align-items:center; justify-content:center; gap:16px; padding:10px 14px; background:#fff; border-bottom:1px solid #e2e8f0; flex-shrink:0; }
.db-cal-nav-btn { background:#f1f5f9; border:none; border-radius:6px; padding:5px 12px; font-size:16px; cursor:pointer; color:#374151; }
.db-cal-nav-btn:hover { background:#e2e8f0; }
.db-cal-month-title { font-size:14px; font-weight:700; color:#0f2744; min-width:160px; text-align:center; }
.db-cal-legend { display:flex; gap:14px; padding:4px 14px 6px; font-size:10px; font-weight:600; border-bottom:1px solid #f1f5f9; flex-shrink:0; }
.db-cal-legend span { display:flex; align-items:center; gap:4px; }
.db-cal-dot { width:9px; height:9px; border-radius:50%; display:inline-block; }
.db-cal-grid { flex:1; overflow-y:auto; padding:12px; }
.db-cal-table { width:100%; border-collapse:collapse; table-layout:fixed; }
.db-cal-table th { padding:6px; text-align:center; font-size:10px; font-weight:700; color:#64748b; text-transform:uppercase; letter-spacing:.5px; border-bottom:2px solid #e2e8f0; }
.db-cal-table td { border:1px solid #f1f5f9; vertical-align:top; width:14.28%; min-height:70px; padding:5px; }
.db-cal-day-num { font-size:11px; font-weight:600; color:#374151; margin-bottom:3px; }
.db-cal-day-num.today { background:#3b82f6; color:#fff; border-radius:50%; width:20px; height:20px; display:flex; align-items:center; justify-content:center; font-size:10px; }
.db-cal-day-num.other-month { color:#d1d5db; }
.db-cal-event { font-size:9px; border-radius:3px; padding:2px 5px; margin:2px 0; cursor:pointer; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-weight:600; }
.db-cal-event.depot   { background:#dbeafe; color:#1e40af; border-left:3px solid #3b82f6; }
.db-cal-event.permis  { background:#dcfce7; color:#166534; border-left:3px solid #22c55e; }
.db-cal-event.alerte  { background:#fee2e2; color:#991b1b; border-left:3px solid #ef4444; }

/* ─────────────────────────────────────────────
   VUE STATISTIQUES
───────────────────────────────────────────── */
.db-stats-view { flex-direction:column; overflow-y:auto; padding:16px; background:#f0f4f8; gap:14px; }
.db-stats-row { display:grid; gap:14px; }
.db-stats-row.col-2 { grid-template-columns:1fr 1fr; }
.db-stats-row.col-3 { grid-template-columns:1fr 1fr 1fr; }
.db-stat-card { background:#fff; border-radius:10px; border:1px solid #e2e8f0; padding:16px; box-shadow:0 1px 4px rgba(0,0,0,.06); }
.db-stat-card-title { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; color:#64748b; margin-bottom:14px; display:flex; align-items:center; gap:6px; }
.db-donut-wrap { display:flex; align-items:center; gap:16px; }
.db-donut-legend { display:flex; flex-direction:column; gap:6px; flex:1; }
.db-donut-leg-item { display:flex; align-items:center; gap:7px; font-size:11px; }
.db-donut-leg-dot { width:10px; height:10px; border-radius:50%; flex-shrink:0; }
.db-donut-leg-label { flex:1; color:#374151; }
.db-donut-leg-val { font-weight:700; color:#0f2744; }
.db-donut-leg-pct { color:#94a3b8; font-size:10px; }
.db-bar-chart { display:flex; flex-direction:column; gap:7px; }
.db-bar-row { display:flex; align-items:center; gap:8px; }
.db-bar-label { font-size:10px; color:#374151; width:100px; flex-shrink:0; text-align:right; }
.db-bar-track { flex:1; background:#f1f5f9; border-radius:4px; height:16px; overflow:hidden; }
.db-bar-fill  { height:100%; border-radius:4px; transition:width .6s ease; display:flex; align-items:center; justify-content:flex-end; padding-right:5px; }
.db-bar-count { font-size:9px; font-weight:700; color:#fff; }
.db-rate-big  { font-size:42px; font-weight:800; color:#16a34a; text-align:center; line-height:1; }
.db-rate-sub  { text-align:center; font-size:11px; color:#64748b; margin-top:4px; }
.db-stat-row-item { display:flex; justify-content:space-between; padding:7px 0; border-bottom:1px solid #f1f5f9; font-size:12px; }
.db-stat-row-item:last-child { border-bottom:none; }
.db-stat-row-label { color:#64748b; }
.db-stat-row-val   { font-weight:700; color:#0f2744; }

/* ── PANNEAU DÉTAIL (slide-in droite) ── */
.db-detail-drawer { position:absolute; top:0; right:0; width:400px; height:100%; background:#fff; border-left:1px solid #e2e8f0; box-shadow:-4px 0 24px rgba(0,0,0,.12); z-index:50; display:flex; flex-direction:column; transform:translateX(100%); transition:transform .25s cubic-bezier(.4,0,.2,1); }
.db-detail-drawer.open { transform:translateX(0); }
.db-drawer-header { padding:14px 16px; background:linear-gradient(135deg,#0f2744,#1a3a6b); color:#fff; display:flex; align-items:flex-start; justify-content:space-between; flex-shrink:0; }
.db-drawer-title { font-size:14px; font-weight:700; margin-bottom:3px; }
.db-drawer-meta  { font-size:10px; opacity:.8; }
.db-drawer-close { background:rgba(255,255,255,.2); border:none; color:#fff; width:26px; height:26px; border-radius:5px; cursor:pointer; font-size:16px; flex-shrink:0; display:flex; align-items:center; justify-content:center; margin-top:-2px; }
.db-drawer-body  { flex:1; overflow-y:auto; }
.db-drawer-section { padding:12px 16px; border-bottom:1px solid #f1f5f9; }
.db-drawer-section-title { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; color:#94a3b8; margin-bottom:8px; }
.db-field-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.db-field { }
.db-field-label { font-size:10px; color:#94a3b8; font-weight:600; margin-bottom:2px; }
.db-field-val   { font-size:12px; color:#1e293b; font-weight:500; }
.db-field-val.empty { color:#cbd5e1; font-style:italic; }
.db-field-val.urgent { color:#dc2626; font-weight:700; }
.db-field.full { grid-column:1/-1; }

/* Timeline drawer */
.db-tl-mini { display:flex; align-items:center; margin:4px 0; }
.db-tl-mini-dot { width:12px; height:12px; border-radius:50%; flex-shrink:0; border:2px solid #fff; box-shadow:0 0 0 2px #cbd5e1; }
.db-tl-mini-dot.done   { background:#22c55e; box-shadow:0 0 0 2px #22c55e; }
.db-tl-mini-dot.active { background:#3b82f6; box-shadow:0 0 0 2px #3b82f6; animation:pulse 1.5s infinite; }
.db-tl-mini-line { flex:1; height:2px; background:#e2e8f0; margin:0 6px; }
.db-tl-mini-line.done { background:#22c55e; }

/* Drawer footer actions */
.db-drawer-footer { padding:10px 14px; background:#f8fafc; border-top:1px solid #e2e8f0; display:flex; flex-direction:column; gap:8px; flex-shrink:0; }
.db-drawer-edit-row { display:flex; gap:6px; }
.db-drawer-edit-row select, .db-drawer-edit-row input { flex:1; padding:7px; border:1px solid #e2e8f0; border-radius:6px; font-size:11px; outline:none; }
.db-drawer-edit-row select:focus, .db-drawer-edit-row input:focus { border-color:#3b82f6; }
.db-drawer-textarea { width:100%; padding:7px; border:1px solid #e2e8f0; border-radius:6px; font-size:11px; min-height:50px; resize:vertical; font-family:inherit; outline:none; }
.db-drawer-textarea:focus { border-color:#3b82f6; }
.db-drawer-action-btns { display:flex; gap:6px; }
.db-drawer-action-btns .db-btn-sm { flex:1; }

/* BADGE statut (refacto) */
.db-badge { display:inline-flex; align-items:center; gap:3px; font-size:9px; font-weight:700; padding:2px 8px; border-radius:10px; text-transform:uppercase; letter-spacing:.3px; white-space:nowrap; }
.db-badge-en_preparation { background:#fef9c3; color:#854d0e; }
.db-badge-depose         { background:#dbeafe; color:#1e40af; }
.db-badge-en_instruction { background:#ede9fe; color:#5b21b6; }
.db-badge-complements    { background:#ffedd5; color:#9a3412; }
.db-badge-obtenu         { background:#dcfce7; color:#14532d; }
.db-badge-tacite         { background:#fef9c3; color:#713f12; }
.db-badge-refuse         { background:#fee2e2; color:#7f1d1d; }

/* Dark mode adaptations */
body.dark-mode #dashboard-modal .modal-content { background:#1e272e; }
body.dark-mode .db-kpi-bar, body.dark-mode .db-toolbar { background:#1a252f; border-color:#2c3e50; }
body.dark-mode .db-kpi { background:#2c3e50; border-color:#34495e; }
body.dark-mode .db-kpi-val { color:#ecf0f1; }
body.dark-mode .db-table thead th { background:#1a252f; color:#bdc3c7; border-color:#2c3e50; }
body.dark-mode .db-table tbody tr { border-color:#2c3e50; }
body.dark-mode .db-table tbody tr:hover { background:#2c3e50; }
body.dark-mode .db-table td { color:#ecf0f1; }
body.dark-mode .db-row-nom { color:#85c1e9; }
body.dark-mode .db-kanban-view { background:#1a252f; }
body.dark-mode .db-kanban-col { background:#2c3e50; border-color:#34495e; }
body.dark-mode .db-kanban-card { background:#1e272e; border-color:#34495e; }
body.dark-mode .db-detail-drawer { background:#2c3e50; border-color:#34495e; }
body.dark-mode .db-drawer-body { background:#2c3e50; }
body.dark-mode .db-drawer-section { border-color:#34495e; }
body.dark-mode .db-field-val { color:#ecf0f1; }
body.dark-mode .db-stat-card { background:#2c3e50; border-color:#34495e; }
body.dark-mode .db-stats-view { background:#1a252f; }
body.dark-mode .db-bar-track { background:#1e272e; }
body.dark-mode .db-cal-table td { border-color:#2c3e50; }
body.dark-mode .db-search-box, body.dark-mode .db-filter-chip { background:#2c3e50; border-color:#34495e; color:#ecf0f1; }
body.dark-mode .db-view-switcher { background:#1a252f; }
body.dark-mode .db-view-btn.active { background:#2c3e50; }
body.dark-mode .db-alert-bar { background:#7c3e00; border-color:#f97316; color:#fed7aa; }
body.dark-mode .db-drawer-footer { background:#1e272e; border-color:#34495e; }
body.dark-mode .db-stat-row-item { border-color:#34495e; }

/* Carte dossier dans la liste */
.db-card {
    background: #fff;
    border: 2px solid #e8ecef;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 7px;
    cursor: pointer;
    transition: all 0.18s ease;
    position: relative;
}
.db-card:hover { border-color: #3498db; background: #f0f7ff; transform: translateX(2px); }
.db-card.selected { border-color: #3498db; background: #e8f4fd; box-shadow: 0 2px 8px rgba(52,152,219,0.2); }
.db-card-name { font-size: 12px; font-weight: 700; color: #2c3e50; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-card-sub  { font-size: 10px; color: #7f8c8d; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.db-card-date { font-size: 10px; color: #95a5a6; }

/* Badge statut */
.db-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}
.db-badge-en_preparation { background:#fef9e7; color:#d4ac0d; border:1px solid #f7dc6f; }
.db-badge-depose         { background:#eaf4fb; color:#2980b9; border:1px solid #aed6f1; }
.db-badge-en_instruction { background:#fdf2f8; color:#8e44ad; border:1px solid #d2b4de; }
.db-badge-complements    { background:#fef5e7; color:#ca6f1e; border:1px solid #f0b27a; }
.db-badge-obtenu         { background:#e9f7ef; color:#196f3d; border:1px solid #82e0aa; }
.db-badge-tacite         { background:#fffde7; color:#b7950b; border:1px solid #f9e79f; }
.db-badge-refuse         { background:#fdedec; color:#a93226; border:1px solid #f1948a; }

/* Section détail dossier */
.db-detail-header {
    padding: 18px 20px 14px;
    background: linear-gradient(135deg, #1a3a5c, #2980b9);
    color: white;
}
.db-detail-title { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.db-detail-meta  { font-size: 11px; opacity: 0.85; }

.db-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}
.db-info-item {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    border-right: 1px solid #f0f0f0;
}
.db-info-item:nth-child(even) { border-right: none; }
.db-info-label { font-size: 10px; color: #95a5a6; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 3px; }
.db-info-value { font-size: 12px; color: #2c3e50; font-weight: 500; }
.db-info-value.empty { color: #bdc3c7; font-style: italic; }

/* Timeline délais */
.db-timeline {
    padding: 14px 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    margin: 0 0 12px 0;
}
.db-timeline-title { font-size: 12px; font-weight: 700; color: #2c3e50; margin-bottom: 10px; }
.db-timeline-bar {
    display: flex;
    align-items: center;
    gap: 0;
    overflow-x: auto;
    padding: 4px 0;
}
.db-tl-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 80px;
    text-align: center;
}
.db-tl-dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    background: #bdc3c7;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #bdc3c7;
    z-index: 1;
}
.db-tl-dot.done   { background: #27ae60; box-shadow: 0 0 0 2px #27ae60; }
.db-tl-dot.active { background: #3498db; box-shadow: 0 0 0 2px #3498db; animation: pulse 1.5s infinite; }
.db-tl-dot.warn   { background: #f39c12; box-shadow: 0 0 0 2px #f39c12; }
.db-tl-line { flex: 1; height: 2px; background: #e0e0e0; min-width: 20px; }
.db-tl-line.done { background: #27ae60; }
.db-tl-label { font-size: 9px; color: #7f8c8d; margin-top: 4px; max-width: 80px; line-height: 1.3; }
.db-tl-date  { font-size: 9px; color: #3498db; font-weight: 600; margin-top: 1px; }

/* Actions sur le détail */
.db-detail-actions {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: #fff;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
}
.db-act-btn {
    flex: 1;
    min-width: 100px;
    padding: 8px 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: white;
    transition: all 0.2s;
}
.db-act-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.db-act-edit   { background: #3498db; }
.db-act-load   { background: #27ae60; }
.db-act-delete { background: #e74c3c; }

/* Dark mode dashboard */
body.dark-mode .db-card             { background:#2c3e50; border-color:#34495e; color:#ecf0f1; }
body.dark-mode .db-card:hover       { background:#1e3a5f; border-color:#3498db; }
body.dark-mode .db-card.selected    { background:#1a3a5c; border-color:#3498db; }
body.dark-mode .db-card-name        { color:#ecf0f1; }
body.dark-mode .db-info-item        { border-color:#34495e; }
body.dark-mode .db-info-value       { color:#bdc3c7; }
body.dark-mode .db-timeline         { background:#1e272e; border-color:#34495e; }
body.dark-mode #db-list-panel       { background:#1e272e; border-color:#34495e; }
body.dark-mode #db-detail-content   { background:#2c3e50; }
