﻿* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f0f4f8; color: #1a1a2e; font-size: 14px; }

/* LOGIN */
#login-screen { display:flex; width:100%; height:100vh; }

/* APP */
#app { display: none; height: 100vh; flex-direction: column; }

/* TOPBAR */
.topnav { background: #fff; border-bottom: 2px solid #e8edf2; padding: 0 16px; min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.topnav-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.logo-square { width: 42px; height: 42px; background: linear-gradient(135deg, #1a3a6b, #2563eb); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800; color: #fff; letter-spacing: -1px; flex-shrink: 0; }
.topnav-brand { display: flex; flex-direction: column; }
.topnav-brand strong { font-size: 16px; font-weight: 700; color: #1a3a6b; letter-spacing: -0.3px; }
.topnav-brand span { font-size: 11px; color: #94a3b8; }
.nav-tabs { display: flex; gap: 2px; margin-left: 10px; min-width: 0; flex-wrap: nowrap; }
.nav-tab { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 12px; color: #64748b; border: none; background: transparent; font-family: inherit; font-weight: 600; transition: all 0.15s; line-height: 1.15; max-width: 92px; }
.nav-tab:hover { background: #f0f4f8; color: #1a3a6b; }
.nav-tab.active { background: #1a3a6b; color: #fff; font-weight: 600; }
.topnav-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.user-pill { background: #f0f4f8; border: 1px solid #e2e8f0; border-radius: 99px; padding: 6px 14px; font-size: 12px; color: #475569; font-weight: 500; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: 8px; border: 1.5px solid #e2e8f0; font-size: 13px; cursor: pointer; background: #fff; font-family: inherit; color: #334155; font-weight: 600; transition: all 0.15s; }
.btn:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-primary { background: #1a3a6b; color: #fff; border-color: #1a3a6b; }
.btn-primary:hover { background: #1e4080; border-color: #1e4080; }
.btn-success { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-success:hover { background: #15803d; }
.btn-danger { background: #fff; color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; }
.btn-full { width: 100%; justify-content: center; padding: 13px; font-size: 15px; border-radius: 10px; }

/* MAIN */
.main-content { flex: 1; overflow: hidden; display: flex; }
.page { display: none; flex: 1; overflow-y: auto; padding: 28px; }
.page.active { display: block; }

/* PAGE HEADER */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid #e8edf2; }
.page-header h2 { font-size: 22px; font-weight: 700; color: #1a3a6b; letter-spacing: -0.4px; }
.page-header p { font-size: 13px; color: #94a3b8; margin-top: 2px; }
.page-header-actions { display: flex; gap: 10px; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 28px; }
.stat-card { background: #fff; border-radius: 12px; padding: 18px 20px; border: 1.5px solid #e8edf2; position: relative; overflow: hidden; }
.stat-card .lbl { font-size: 11px; color: #94a3b8; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.stat-card .val { font-size: 32px; font-weight: 800; color: #1a3a6b; line-height: 1; }
.stat-card .val.green { color: #16a34a; }
.stat-card .val.orange { color: #d97706; }
.stat-card .val.blue { color: #2563eb; }
.stat-card .val.red { color: #dc2626; }
.stat-card .sub { font-size: 12px; color: #94a3b8; margin-top: 6px; }

/* CARDS */
.card { background: #fff; border: 1.5px solid #e8edf2; border-radius: 12px; margin-bottom: 14px; overflow: hidden; }
.card-header { padding: 14px 20px; border-bottom: 1.5px solid #f1f5f9; display: flex; align-items: center; justify-content: space-between; background: #f8fafc; }
.card-header h3 { font-size: 13px; font-weight: 700; color: #1a3a6b; text-transform: uppercase; letter-spacing: 0.04em; }

/* DOSSIERS */
.dossier-row { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: background 0.1s; }
.dossier-row:last-child { border-bottom: none; }
.dossier-row:hover { background: #f8fafc; }
.dossier-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.dossier-icon.vente { background: #dbeafe; }
.dossier-icon.achat { background: #dcfce7; }
.dossier-icon.location { background: #fef3c7; }
.dossier-info { flex: 1; min-width: 0; }
.dossier-info strong { font-size: 13px; font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #1a3a6b; }
.dossier-info span { font-size: 12px; color: #94a3b8; }
.dossier-meta { text-align: right; flex-shrink: 0; }
.dossier-meta .count { font-size: 12px; color: #94a3b8; display: block; margin-bottom: 4px; }

/* PILLS */
.pill { font-size: 11px; padding: 3px 10px; border-radius: 99px; display: inline-block; font-weight: 700; letter-spacing: 0.02em; }
.pill.actif { background: #dcfce7; color: #166534; }
.pill.offre { background: #fef3c7; color: #92400e; }
.pill.finalise { background: #dbeafe; color: #1e40af; }
.pill.annule { background: #fee2e2; color: #991b1b; }
.pill.ferme { background: #f1f5f9; color: #64748b; }

/* SECTION TITLE */
.section-title { font-size: 13px; font-weight: 700; color: #1a3a6b; margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; text-transform: uppercase; letter-spacing: 0.04em; }

/* AI COMPOSE */
.ai-compose { background: #fff; border: 1.5px solid #e8edf2; border-radius: 12px; padding: 22px; }
.type-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 16px; }
.type-btn { padding: 10px 8px; border: 1.5px solid #e2e8f0; border-radius: 8px; font-size: 12px; text-align: center; cursor: pointer; color: #64748b; background: #f8fafc; font-family: inherit; font-weight: 600; transition: all 0.15s; }
.type-btn:hover, .type-btn.sel { border-color: #1a3a6b; color: #1a3a6b; background: #eff6ff; }

/* FORMS */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.form-row.one { grid-template-columns: 1fr; }
.fg { display: flex; flex-direction: column; gap: 6px; }
.fg label { font-size: 11px; color: #64748b; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.fg input, .fg select, .fg textarea { padding: 10px 14px; border: 1.5px solid #e2e8f0; border-radius: 8px; font-size: 13px; font-family: inherit; background: #fff; color: #1a1a2e; transition: border-color 0.2s; }
.fg input:focus, .fg select:focus, .fg textarea:focus { outline: none; border-color: #1a3a6b; box-shadow: 0 0 0 3px rgba(26,58,107,0.08); }
.fg textarea { resize: vertical; }

/* RESULT BOX */
.result-box { background: #f8fafc; border: 1.5px solid #e2e8f0; border-radius: 10px; padding: 18px; margin-top: 16px; }
.result-box .sujet { font-size: 11px; color: #64748b; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
.result-box .corps { font-size: 13px; line-height: 1.8; white-space: pre-wrap; color: #334155; }
.actions-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

/* BADGE */
.badge { font-size: 10px; background: #dc2626; color: #fff; padding: 2px 7px; border-radius: 99px; font-weight: 700; margin-left: 4px; }
.badge-ai { font-size: 10px; background: #eff6ff; color: #1d4ed8; padding: 3px 9px; border-radius: 99px; font-weight: 700; letter-spacing: 0.05em; }

/* EMAILS */
.email-row { padding: 14px 20px; border-bottom: 1px solid #f1f5f9; cursor: pointer; transition: background 0.1s; }
.email-row:last-child { border-bottom: none; }
.email-row:hover { background: #f8fafc; }
.email-row .em-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.email-row .em-to { font-size: 12px; font-weight: 700; color: #1a3a6b; }
.email-row .em-date { font-size: 11px; color: #94a3b8; }
.email-row .em-sujet { font-size: 13px; color: #334155; font-weight: 600; margin-bottom: 2px; }
.email-row .em-preview { font-size: 12px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* MODAL */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 100; align-items: center; justify-content: center; backdrop-filter: blur(2px); }
.modal-bg.open { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 660px; max-width: 95vw; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal-header { padding: 18px 24px; border-bottom: 1.5px solid #f1f5f9; display: flex; align-items: center; justify-content: space-between; background: #f8fafc; }
.modal-header h3 { font-size: 15px; font-weight: 700; color: #1a3a6b; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1.5px solid #f1f5f9; display: flex; justify-content: flex-end; gap: 10px; background: #f8fafc; }

/* SECTION COLORS */
.section-purple { font-size: 11px; font-weight: 700; color: #7c3aed; text-transform: uppercase; letter-spacing: 0.06em; margin: 16px 0 10px; padding-bottom: 4px; border-bottom: 2px solid #ede9fe; }
.section-blue { font-size: 11px; font-weight: 700; color: #1d4ed8; text-transform: uppercase; letter-spacing: 0.06em; margin: 16px 0 10px; padding-bottom: 4px; border-bottom: 2px solid #dbeafe; }

/* MISC */
.loading { color: #1a3a6b; font-size: 13px; padding: 16px 0; }
.err { color: #dc2626; font-size: 13px; padding: 10px 14px; background: #fef2f2; border-radius: 8px; border: 1.5px solid #fecaca; margin-top: 8px; }
.empty { text-align: center; padding: 48px; color: #94a3b8; font-size: 13px; }
select { -webkit-appearance: none; }
hr { border: none; border-top: 1.5px solid #f1f5f9; margin: 14px 0; }
.dossier-links{display:flex;gap:6px;margin-top:8px;flex-wrap:wrap}.mini-link{border:1px solid #dbeafe;background:#eff6ff;color:#1d4ed8;border-radius:8px;padding:5px 9px;font-weight:700;cursor:pointer}.mini-link:hover{background:#dbeafe}.pill.brouillon{background:#eef2ff;color:#1e3a8a}.pill.envoye{background:#dcfce7;color:#166534}.pill.archive{background:#f3f4f6;color:#374151}

/* ANALYSE VM AI */
.vm-grid{display:grid;grid-template-columns:minmax(420px,0.95fr) minmax(420px,1.05fr);gap:18px;align-items:start}
.vm-panel{min-width:0}
.vm-import-tabs{display:flex;gap:8px;margin-bottom:12px}
.vm-dropzone{border:1.5px dashed #bfdbfe;background:#f8fbff;border-radius:12px;padding:20px;text-align:center;color:#64748b;position:relative}
.vm-dropzone i{font-size:34px;color:#1a3a6b;display:block;margin-bottom:8px}
.vm-dropzone strong{display:block;color:#1a3a6b;margin-bottom:4px}
.vm-dropzone span{display:block;font-size:12px;line-height:1.5;max-width:440px;margin:0 auto 12px}
.vm-dropzone input{margin-top:8px}
.vm-image-card{display:flex;gap:12px;align-items:center;border:1.5px solid #e8edf2;background:#fff;border-radius:12px;margin-top:12px;padding:10px}
.vm-image-card img{width:96px;height:64px;object-fit:cover;border-radius:8px;border:1px solid #e2e8f0}
.vm-image-card strong{display:block;color:#1a3a6b;font-size:13px}
.vm-image-card span{font-size:12px;color:#64748b}
.vm-result-empty{border:1.5px dashed #cbd5e1;border-radius:12px;background:#f8fafc;color:#64748b;padding:28px;text-align:center;line-height:1.6}
.vm-summary-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;margin-bottom:14px}
.vm-summary-grid div{background:#f8fafc;border:1.5px solid #e8edf2;border-radius:12px;padding:13px}
.vm-summary-grid span{display:block;font-size:10px;text-transform:uppercase;letter-spacing:.06em;color:#64748b;font-weight:800;margin-bottom:5px}
.vm-summary-grid strong{font-size:18px;color:#1a3a6b}
.vm-note{background:#eef6f1;border:1.5px solid #bbf7d0;color:#1f2937;border-radius:12px;padding:14px 16px;line-height:1.55;margin-bottom:14px}
.vm-final-edit{background:#fff8e7;border:2px solid #f2c94c;border-radius:12px;padding:15px 16px;margin:14px 0;box-shadow:0 8px 20px rgba(146,105,0,.08)}
.vm-final-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:10px}
.vm-final-head span{font-size:10px;text-transform:uppercase;letter-spacing:.06em;color:#8a5b00;font-weight:900}
.vm-final-head strong{color:#1a3a6b;font-size:15px;text-align:right}
.vm-final-edit label{display:block;color:#1f2937;font-size:12px;font-weight:800;margin-bottom:7px}
.vm-final-edit textarea{width:100%;min-height:118px;border:1.5px solid #e0b323;border-radius:10px;background:#fff;font-size:13px;line-height:1.6;color:#1f2937;padding:11px;resize:vertical}
.vm-final-edit textarea:focus{outline:none;border-color:#1a3a6b;box-shadow:0 0 0 3px rgba(26,58,107,.12)}
.vm-final-help{font-size:12px;color:#64748b;line-height:1.45;margin-top:8px}
.vm-table-wrap{overflow:auto;border:1.5px solid #e8edf2;border-radius:12px;background:#fff}
.vm-table{width:100%;border-collapse:collapse;font-size:12px}
.vm-table th{background:#e8eef5;color:#1f2937;text-align:left;padding:10px;border-bottom:1px solid #d9e2ec}
.vm-table td{padding:9px 10px;border-bottom:1px solid #eef2f7;color:#334155}
.vm-table td:nth-child(2),.vm-table td:nth-child(3),.vm-table td:nth-child(5){text-align:right;white-space:nowrap}
.vm-table tr:last-child td{border-bottom:none}
@media(max-width:1100px){.vm-grid{grid-template-columns:1fr}.vm-summary-grid{grid-template-columns:1fr}}

.vm-soft-hint{min-height:41px;display:flex;align-items:center;border:1.5px solid #e8edf2;border-radius:8px;background:#f8fafc;color:#64748b;font-size:12px;line-height:1.45;padding:10px 14px}

.dv-verdict{border-radius:12px;padding:16px;margin-bottom:14px;border:1.5px solid #d9e2ec;background:#f8fafc}
.dv-verdict span{display:block;font-size:10px;text-transform:uppercase;letter-spacing:.06em;color:#64748b;font-weight:900;margin-bottom:6px}
.dv-verdict strong{font-size:22px;color:#1a3a6b}
.dv-risk-low{background:#eef6f1;border-color:#bbf7d0}
.dv-risk-mid{background:#fff8e7;border-color:#f2c94c}
.dv-risk-high{background:#fff1f2;border-color:#fecdd3}
.dv-list{background:#fff;border:1.5px solid #e8edf2;border-radius:12px;padding:14px 18px 14px 28px;margin:0 0 14px;color:#334155;line-height:1.55}
.dv-list li{margin-bottom:8px}
.dv-list li:last-child{margin-bottom:0}

.doc-pill{display:inline-flex;align-items:center;gap:6px;border:1.5px solid #d9e2ec;border-radius:999px;background:#fff;padding:6px 10px;font-size:12px;color:#334155;margin:4px 6px 4px 0}

.user-info{display:block;max-width:120px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#0c2340;font-size:12px;font-weight:700}

.doc-center-controls{display:grid;grid-template-columns:minmax(220px,1fr) 220px auto;gap:12px;align-items:end;margin-bottom:16px}
.doc-table-wrap{overflow:auto;border:1.5px solid #e8edf2;border-radius:10px;background:#fff}
.doc-table{width:100%;border-collapse:collapse;font-size:12px}
.doc-table th{background:#e8eef5;color:#1f2937;text-align:left;padding:10px;border-bottom:1px solid #d9e2ec;white-space:nowrap}
.doc-table td{padding:10px;border-bottom:1px solid #eef2f7;color:#334155;vertical-align:top}
.doc-table tr:last-child td{border-bottom:none}
.doc-type-badge{display:inline-flex;border-radius:999px;background:#eef6f1;border:1px solid #bbf7d0;color:#1f4d78;font-weight:800;padding:4px 8px;white-space:nowrap}
@media(max-width:900px){.doc-center-controls{grid-template-columns:1fr}.doc-table{min-width:850px}}

.dossier-ai-history{border:1.5px solid #e8edf2;border-radius:10px;background:#fff;overflow:hidden;margin-bottom:12px}
.dossier-ai-row{padding:12px 14px;border-bottom:1px solid #eef2f7}
.dossier-ai-row:last-child{border-bottom:none}
.dossier-ai-row strong{display:block;color:#1a3a6b;font-size:13px;margin-bottom:3px}
.dossier-ai-row span{display:block;color:#64748b;font-size:11px;margin-bottom:5px}
.dossier-ai-row small{display:block;color:#334155;font-size:12px;line-height:1.45}
