:root {
    --brand: #0b3d7a;
    --brand-dark: #072a55;
    --accent: #f5b800;
    --bs-primary: #0b3d7a;
    --bs-primary-rgb: 11, 61, 122;
    --bs-body-bg: #f3f5f9;
}

.btn-primary { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark); --bs-btn-active-bg: var(--brand-dark); }
.btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand); --bs-btn-active-bg: var(--brand); }
a { color: var(--brand); }

.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 250px; flex-shrink: 0; background: var(--brand); color: #fff; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { display: flex; align-items: center; gap: .6rem; padding: 1.1rem 1.25rem; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.2rem; border-bottom: 3px solid var(--accent); }
.sidebar .brand i { color: var(--accent); font-size: 1.4rem; }
.sidebar .nav-link { color: rgba(255,255,255,.8); padding: .6rem 1.25rem; display: flex; gap: .7rem; align-items: center; border-left: 3px solid transparent; }
.sidebar .nav-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.sidebar .nav-link.active { color: #fff; background: rgba(255,255,255,.12); border-left-color: var(--accent); }
.sidebar .nav-section { text-transform: uppercase; font-size: .7rem; letter-spacing: .08em; color: rgba(255,255,255,.5); padding: 1.2rem 1.25rem .3rem; }

.main { flex: 1; min-width: 0; }
.topbar { height: 60px; background: #fff; border-bottom: 1px solid #e3e7ee; position: sticky; top: 0; z-index: 10; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 600; }

.card { border: 1px solid #e3e7ee; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; font-weight: 600; }
.kpi .kpi-icon { width: 46px; height: 46px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.kpi .kpi-value { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.table > :not(caption) > * > * { vertical-align: middle; }
.table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; font-weight: 600; background: #f8f9fb; }
.dl-grid { display: grid; grid-template-columns: 170px 1fr; gap: .45rem 1rem; margin: 0; }
.dl-grid dt { color: #6b7280; font-weight: 500; }
.dl-grid dd { margin: 0; }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 1.1rem 2.4rem; }
.timeline li::before { content: ""; position: absolute; left: .85rem; top: 1.8rem; bottom: 0; width: 2px; background: #e3e7ee; }
.timeline li:last-child::before { display: none; }
.timeline .tl-icon { position: absolute; left: 0; top: 0; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: #e8eef7; color: var(--brand); display: flex; align-items: center; justify-content: center; font-size: .85rem; }
.score { display: inline-block; min-width: 2rem; text-align: center; border-radius: 6px; padding: .1rem .35rem; font-weight: 600; font-size: .85rem; }
.score-1, .score-2 { background: #fde2e1; color: #a1251b; }
.score-3 { background: #fff3cd; color: #8a6100; }
.score-4, .score-5 { background: #d9f2e3; color: #19693d; }
.nav-tabs .nav-link { color: #4b5563; }
.nav-tabs .nav-link.active { color: var(--brand); font-weight: 600; }
.chart-box { position: relative; height: 260px; }

/* Messagerie WhatsApp */
.wa-thread { height: 55vh; min-height: 320px; overflow-y: auto; padding: 1rem; background: #efeae2; display: flex; flex-direction: column; gap: .4rem; }
.wa-msg { max-width: 75%; padding: .45rem .7rem .3rem; border-radius: 10px; box-shadow: 0 1px 1px rgba(0, 0, 0, .08); word-wrap: break-word; }
.wa-in { align-self: flex-start; background: #fff; border-top-left-radius: 2px; }
.wa-out { align-self: flex-end; background: #d9fdd3; border-top-right-radius: 2px; }
.wa-failed { background: #fde2e1; }
.wa-meta { font-size: .72rem; color: #6b7280; text-align: right; margin-top: .15rem; }
.wa-img { max-width: 100%; max-height: 260px; border-radius: 6px; display: block; margin-bottom: .25rem; }
.wa-day { align-self: center; margin: .4rem 0; }
.wa-day span { background: #fff; color: #6b7280; font-size: .72rem; padding: .15rem .6rem; border-radius: 6px; }
.min-w-0 { min-width: 0; }
@media (max-width: 575.98px) { .wa-msg { max-width: 90%; } }

.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--brand) 0%, #164f96 100%); padding: 1rem; }
.auth-card { width: 100%; max-width: 420px; }

@media (max-width: 991.98px) {
    .sidebar { position: fixed; left: -260px; z-index: 1040; transition: left .2s; }
    .sidebar.open { left: 0; }
    .dl-grid { grid-template-columns: 1fr; }
    .dl-grid dt { margin-top: .4rem; }
}
