/* ============================================================
   CRM Lina Finance — style.css (navy/gold, Fraunces + DM Sans)
   ============================================================ */
:root {
    --navy: #061D39;
    --navy-light: #0A2E5C;
    --gold: #DCC59C;
    --gold-dark: #C4A96E;
    --bg: #F5F5F0;
    --text: #2B2B2B;
    --text-gray: #6B6B6B;
    --green: #2E7D52;
    --red: #C1292E;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(6,29,57,0.08);
    --font-h: 'Raleway', Arial, sans-serif;
    --font-b: 'Raleway', Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; }
body { font-family: var(--font-b); background: var(--bg); color: var(--text); font-size: 14px; }
h1, h2, h3 { font-family: var(--font-h); color: var(--navy); font-weight: 700; letter-spacing: -0.01em; }
a { color: var(--navy-light); text-decoration: none; }

/* --- Layout --- */
.sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 220px; background: var(--navy); display: flex; flex-direction: column; z-index: 10; }
.sidebar-logo { font-family: var(--font-h); color: #fff; font-size: 20px; padding: 24px 20px; }
.sidebar-logo span { color: var(--gold); }
.sidebar-logo small { display: block; color: var(--gold); font-family: var(--font-b); font-size: 10px; letter-spacing: 3px; text-transform: uppercase; margin-top: 2px; }
.sidebar nav { flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,0.75); padding: 12px 20px; font-size: 14px; }
.sidebar nav a:hover { background: var(--navy-light); color: #fff; }
.sidebar nav a.active { background: var(--navy-light); color: var(--gold); border-left: 3px solid var(--gold); padding-left: 17px; }
.nav-icon { color: var(--gold); width: 16px; text-align: center; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.advisor-name { color: #fff; font-weight: 500; }
.logout-link { color: rgba(255,255,255,0.5); font-size: 12px; }
.main { margin-left: 220px; padding: 24px 32px; min-height: 100vh; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.topbar h1 { font-size: 26px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* --- Boutons / inputs --- */
button, .btn-gold, .btn-navy, .btn-outline { font-family: var(--font-b); cursor: pointer; border: none; border-radius: var(--radius); padding: 9px 16px; font-size: 14px; font-weight: 500; }
.btn-gold { background: var(--gold); color: var(--navy); }
.btn-gold:hover { background: var(--gold-dark); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-light); }
.btn-outline { border: 1px solid var(--gold); color: var(--navy); background: transparent; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
input, select, textarea { font-family: var(--font-b); font-size: 14px; padding: 9px 12px; border: 1px solid #ddd; border-radius: var(--radius); background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
label { display: block; font-size: 12px; color: var(--text-gray); margin: 12px 0 4px; font-weight: 500; }

/* --- Cards / KPIs --- */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px; }
.card-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--gold); padding-bottom: 10px; margin-bottom: 14px; }
.card-header h2 { font-size: 17px; }
.card-link { background: none; border: none; color: var(--navy-light); font-size: 13px; cursor: pointer; padding: 0; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi-card { display: block; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; border-bottom: 3px solid var(--gold); }
.kpi-card.gold { background: var(--gold); border-color: var(--gold-dark); }
.kpi-card.gold .kpi-value, .kpi-card.gold .kpi-label { color: var(--navy); }
.kpi-card.navy { background: var(--navy); border-color: var(--gold); }
.kpi-card.navy .kpi-value { color: var(--gold); }
.kpi-card.navy .kpi-label { color: rgba(255,255,255,0.7); }
.kpi-value { font-family: var(--font-h); font-size: 24px; color: var(--navy); font-weight: 600; }
.kpi-label { font-size: 12px; color: var(--text-gray); margin-top: 4px; }
.two-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; }
.fiche-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 20px; }
@media (max-width: 1100px) { .two-cols, .fiche-grid { grid-template-columns: 1fr; } }

/* --- Tables --- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-gray); padding: 8px 10px; border-bottom: 2px solid var(--gold); }
.table td { padding: 10px; border-bottom: 1px solid #eee; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--bg); }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .strong { font-weight: 600; color: var(--navy); }
.potentiel { color: var(--gold-dark); font-weight: 700; }
.table-count { color: var(--text-gray); font-size: 12px; margin-top: 10px; }
.empty { color: var(--text-gray); font-style: italic; padding: 8px 0; }

/* --- Badges --- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-prospect { background: #E8F0FE; color: var(--navy-light); }
.badge-client { background: var(--gold); color: var(--navy); }
.badge-inactif { background: #eee; color: var(--text-gray); }
.badge-perdu { background: #FBE9E9; color: var(--red); }
.badge-envoye { background: #E8F0FE; color: var(--navy-light); }
.badge-signe { background: #FFF3D6; color: #8a6d1d; }
.badge-fonds_recus { background: #E3F2E8; color: var(--green); }
.badge-investi { background: var(--navy); color: var(--gold); }
.badge-annule { background: #FBE9E9; color: var(--red); }
.badge-stage-gagne { background: var(--navy); color: var(--gold); }
.badge-stage-perdu { background: #FBE9E9; color: var(--red); }
[class*="badge-stage-"]:not(.badge-stage-gagne):not(.badge-stage-perdu) { background: #E8F0FE; color: var(--navy-light); }

/* --- Filtres --- */
.filters { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.filters input[type=search] { max-width: 240px; }
.filters select { width: auto; }

/* --- Kanban --- */
.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; align-items: start; }
.kanban-col { background: rgba(6,29,57,0.04); border-radius: var(--radius); padding: 10px; min-height: 300px; }
.kanban-col-header { font-family: var(--font-h); color: var(--navy); font-weight: 600; font-size: 14px; padding: 6px 8px 10px; display: flex; align-items: center; gap: 8px; }
.kanban-count { background: var(--gold); color: var(--navy); border-radius: 20px; padding: 1px 8px; font-size: 11px; font-family: var(--font-b); }
.kanban-sum { margin-left: auto; font-size: 11px; color: var(--text-gray); font-family: var(--font-b); font-weight: 400; }
.kanban-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px; margin-bottom: 10px; cursor: grab; position: relative; border-left: 3px solid var(--gold); }
.kanban-card:active { cursor: grabbing; }
.kanban-card-name { font-weight: 600; color: var(--navy); display: block; }
.kanban-card-title { font-size: 12px; color: var(--text-gray); margin: 3px 0; }
.kanban-card-meta { display: flex; justify-content: space-between; font-size: 12px; margin-top: 6px; }
.kanban-card-amount { font-weight: 700; color: var(--gold-dark); }
.kanban-card-advisor { font-size: 11px; color: var(--text-gray); margin-top: 4px; }
.kanban-card-actions { position: absolute; top: 8px; right: 8px; display: none; gap: 4px; }
.kanban-card:hover .kanban-card-actions { display: flex; }
.kanban-card-actions button { padding: 2px 7px; font-size: 11px; border-radius: 4px; background: var(--bg); }
@media (max-width: 1200px) { .kanban { grid-template-columns: repeat(3, 1fr); } }

/* --- Fiche --- */
.dl { display: grid; grid-template-columns: 130px 1fr; row-gap: 9px; }
.dl dt { color: var(--text-gray); font-size: 13px; }
.dl dd { font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.potentiel-card { border-left: 4px solid var(--gold); }
.pot-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid #f0f0f0; }
.pot-total { font-size: 16px; }
.pot-total strong { color: var(--gold-dark); font-family: var(--font-h); font-size: 20px; }
.sub-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #f0f0f0; gap: 10px; }
.sub-provider { color: var(--text-gray); font-size: 12px; margin-left: 6px; }
.sub-meta { font-size: 12px; color: var(--text-gray); margin-top: 2px; }
.sub-status { width: auto; font-size: 12px; padding: 5px 8px; border-radius: 20px; border: 1px solid #ddd; }

/* --- Tâches / timeline --- */
.task-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f0f0f0; }
.task-row > div { flex: 1; }
.task-row input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--navy); }
.task-title { font-weight: 500; }
.task-title-sub { font-size: 12px; color: var(--text-gray); }
.task-contact { font-size: 12px; }
.task-adv { font-size: 11px; color: var(--text-gray); margin-left: 8px; }
.task-date { font-size: 12px; color: var(--text-gray); white-space: nowrap; }
.task-date.late { color: var(--red); font-weight: 600; }
.task-add, .act-add { display: flex; gap: 8px; margin-bottom: 12px; }
.task-add input[type=date], .act-add select { width: auto; }
.timeline-item { padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.timeline-type { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; font-weight: 700; color: var(--gold-dark); }
.timeline-content { margin: 4px 0; }
.timeline-meta { font-size: 11px; color: var(--text-gray); }
.dot-rappel { margin-left: 4px; font-size: 12px; }

/* --- Modal --- */
.modal-bg { display: none; position: fixed; inset: 0; background: rgba(6,29,57,0.5); z-index: 50; align-items: center; justify-content: center; }
.modal-bg.open { display: flex; }
.modal { background: #fff; border-radius: var(--radius); padding: 28px; width: 460px; max-width: 92vw; max-height: 90vh; overflow-y: auto; }
.modal h2 { margin-bottom: 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* --- Toast --- */
.toast { position: fixed; bottom: 24px; right: 24px; background: var(--navy); color: var(--gold); padding: 12px 20px; border-radius: var(--radius); box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); transition: all 0.25s; z-index: 100; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--red); color: #fff; }

/* --- Login --- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--navy); }
.login-card { background: #fff; border-radius: var(--radius); padding: 40px; width: 380px; max-width: 92vw; }
.login-logo { font-family: var(--font-h); font-size: 28px; color: var(--navy); text-align: center; }
.login-logo span { color: var(--gold-dark); }
.login-sub { text-align: center; color: var(--text-gray); font-size: 13px; letter-spacing: 2px; text-transform: uppercase; margin: 4px 0 20px; }
.alert-error { background: #FBE9E9; color: var(--red); padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin-bottom: 12px; }
.login-card button { margin-top: 20px; }

/* --- Suivi éthique --- */
.ethique-card { border-left: 4px solid var(--navy); }
.eth-item { padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.eth-item:last-child { border-bottom: none; }
.eth-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.eth-name { font-size: 13px; font-weight: 600; color: var(--navy); }
.eth-date { width: 150px; padding: 6px 8px; font-size: 13px; }
.eth-sub { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; color: var(--text-gray); justify-content: flex-end; }
.seg { display: inline-flex; border: 1px solid var(--gold); border-radius: 20px; overflow: hidden; flex-shrink: 0; }
.seg-btn { padding: 6px 14px; font-size: 12px; background: #fff; color: var(--text-gray); border: none; border-radius: 0; cursor: pointer; }
.seg-btn.active { background: var(--navy); color: var(--gold); font-weight: 600; }

/* Séparateur stock / flux dans le bloc potentiel */
.pot-sep { border-top: 2px solid var(--gold); margin: 8px 0 2px; }

/* --- Hint / explication --- */
.hint { font-size: 12px; color: var(--text-gray); margin: 0 0 10px; line-height: 1.5; }

/* --- Attribution en masse --- */
.bulk-bar { display: flex; align-items: center; gap: 12px; background: var(--navy); color: #fff; border-radius: var(--radius); padding: 10px 16px; margin-bottom: 14px; }
.bulk-bar select { width: auto; }
#bulk-count { font-size: 13px; color: var(--gold); font-weight: 600; min-width: 110px; }
.col-check { width: 34px; text-align: center; }
.col-check input { width: 16px; height: 16px; accent-color: var(--navy); cursor: pointer; }
