/* ==========================================================================
   Pour CRM — feuille de styles
   ========================================================================== */

:root {
    --primary: #16a34a;
    --primary-dark: #166534;
    --primary-soft: #e7f7ee;
    --accent: #059669;
    --green: #16a34a;
    --green-soft: #e7f7ee;
    --red: #dc2626;
    --red-soft: #fdecec;
    --dark: #0f172a;
    --text: #1e293b;
    --muted: #64748b;
    --line: #e2e8f0;
    --surface: #ffffff;
    --bg: #f4f6fb;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 6px 20px rgba(15, 23, 42, .07);
    --shadow-lg: 0 18px 50px rgba(15, 23, 42, .18);
    --header-h: 62px;
    --tabbar-h: 66px;
    --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
}

body.modal-open { overflow: hidden; }

a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--dark); }
h1 { font-size: 1.35rem; letter-spacing: -.01em; }
h2 { font-size: 1.02rem; letter-spacing: -.01em; }
h3 { font-size: 1.05rem; }
p { margin: 0; }

svg { display: block; }

/* ------------------------------------------------------------------ Marque */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
    width: 38px; height: 38px; flex: 0 0 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--primary), #4ade80);
    color: #ffffff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.05rem;
    box-shadow: 0 4px 12px rgba(22, 163, 74, .35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; font-weight: 700; color: var(--dark); }
.brand-text small { font-weight: 500; font-size: .68rem; color: var(--muted); letter-spacing: .02em; text-transform: uppercase; }
.brand-light .brand-text { color: #fff; }
.brand-light .brand-text small { color: rgba(255, 255, 255, .72); }
.brand-mobile { display: none; }

/* ---------------------------------------------------- En-tête application */
.app-header {
    position: sticky; top: 0; z-index: 40;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding-top: env(safe-area-inset-top, 0px);
}
.app-header-inner {
    max-width: 1180px; margin: 0 auto;
    height: var(--header-h);
    padding: 0 14px;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.brand-header .brand-text small { text-transform: none; letter-spacing: 0; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
    width: 38px; height: 38px; border-radius: 11px;
    border: 1px solid var(--line); background: #fff; color: var(--text);
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary-dark); border-color: #a7e8c0; }

.user-menu { position: relative; }
.user-trigger {
    display: inline-flex; align-items: center; gap: 8px;
    background: #fff; border: 1px solid var(--line); border-radius: 30px;
    padding: 4px 12px 4px 4px; cursor: pointer; color: var(--text); font-size: .85rem; font-weight: 600;
}
.user-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
    width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary-dark);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .8rem;
}
.user-dropdown {
    position: absolute; right: 0; top: calc(100% + 8px); width: 232px;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); overflow: hidden; z-index: 60;
}
.user-dropdown-head { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; }
.user-dropdown-head strong { font-size: .9rem; }
.user-dropdown-head span { font-size: .76rem; color: var(--muted); }
.user-dropdown a, .user-dropdown button {
    display: block; width: 100%; text-align: left; padding: 11px 14px;
    background: none; border: 0; border-bottom: 1px solid #f1f5f9;
    font: inherit; font-size: .87rem; color: var(--text); cursor: pointer;
}
.user-dropdown a:hover, .user-dropdown button:hover { background: #f8fafc; text-decoration: none; }
.user-dropdown button:last-child { color: var(--red); border-bottom: 0; }

/* --------------------------------------------------------------- Conteneur */
.app-main {
    max-width: 1180px; margin: 0 auto;
    padding: 18px 14px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 26px);
}

.page-head {
    display: flex; flex-direction: column; gap: 12px;
    margin-bottom: 16px;
}
.page-sub { color: var(--muted); font-size: .87rem; margin-top: 3px; }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------- Boutons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    border-radius: var(--radius-sm); border: 1px solid transparent;
    padding: 10px 16px; font: inherit; font-size: .88rem; font-weight: 600;
    cursor: pointer; transition: background .15s, box-shadow .15s, color .15s;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #ffffff; box-shadow: 0 4px 12px rgba(22, 163, 74, .35); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 8px 13px; font-size: .82rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.mini-link { font-size: .78rem; font-weight: 600; }

/* ------------------------------------------------------------ Formulaires */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.field label { font-size: .8rem; font-weight: 600; color: #475569; }
.field input, .field select, .field textarea {
    width: 100%; padding: 11px 12px; font: inherit; font-size: .9rem;
    border: 1px solid var(--line); border-radius: var(--radius-sm);
    background: #fff; color: var(--text);
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22, 163, 74, .28);
}
.field-password { position: relative; }
.field-password input { padding-right: 78px; }
.pw-toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    background: none; border: 0; color: var(--primary-dark); font: inherit; font-size: .78rem;
    font-weight: 600; cursor: pointer; padding: 6px;
}
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
.form-error {
    margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
    background: var(--red-soft); color: #991b1b; font-size: .84rem; font-weight: 500;
}
.form-success {
    margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm);
    background: var(--green-soft); color: #166534; font-size: .84rem; font-weight: 500;
}

/* -------------------------------------------------------------- Panneaux */
.panel {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 15px; margin-bottom: 14px;
}
.panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-bottom: 13px; flex-wrap: wrap;
}
.panel-hint { font-size: .8rem; color: var(--muted); }
.panel-link { font-size: .8rem; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 14px; }
.chart-box { position: relative; height: 250px; }

/* ------------------------------------------------------------------ KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.kpi {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 13px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 4px;
}
.kpi-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 1.24rem; font-weight: 800; color: var(--dark); letter-spacing: -.02em; }
.kpi-foot { font-size: .74rem; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--green); }
.dot-blue { background: var(--primary); }
.dot-amber { background: var(--accent); }
.dot-red { background: var(--red); }

.progress { height: 10px; border-radius: 6px; background: #eaeff7; overflow: hidden; }
.progress-bar { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--primary), #4ade80); transition: width .5s ease; }

/* ----------------------------------------------------------------- Listes */
.list { list-style: none; margin: 0; padding: 0; }
.list-item {
    display: flex; align-items: center; gap: 11px;
    padding: 11px 0; border-bottom: 1px solid #f1f5f9;
}
.list-item:last-child { border-bottom: 0; }
.list-body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.list-body strong { font-size: .87rem; color: var(--dark); overflow-wrap: anywhere; }
.list-meta { font-size: .77rem; color: var(--muted); }
.list-empty { padding: 18px 0; color: var(--muted); font-size: .85rem; text-align: center; list-style: none; }
.time-badge {
    flex: 0 0 48px; text-align: center; font-size: .78rem; font-weight: 700; color: var(--primary-dark);
    background: var(--primary-soft); border-radius: 8px; padding: 6px 0;
}
.amount { font-weight: 700; color: var(--dark); font-size: .88rem; white-space: nowrap; }
.text-danger { color: var(--red); }

.check {
    width: 20px; height: 20px; flex: 0 0 20px; border-radius: 6px;
    border: 1.8px solid #cbd5e1; background: #fff; cursor: pointer; padding: 0;
}
.check:hover { border-color: var(--green); background: var(--green-soft); }

.chip {
    font-size: .7rem; font-weight: 700; padding: 4px 9px; border-radius: 20px;
    text-transform: capitalize; white-space: nowrap;
}
.chip-blue { background: var(--primary-soft); color: var(--primary-dark); }
.chip-red { background: var(--red-soft); color: #b91c1c; }
.chip-green { background: var(--green-soft); color: #15803d; }
.chip-grey { background: #eef2f7; color: #475569; }
.chip-amber { background: #fef3c7; color: #92400e; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid #f1f5f9; }
.timeline-item:last-child { border-bottom: 0; }
.timeline-item p { font-size: .84rem; color: #334155; margin: 3px 0; }
.timeline-dot {
    width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex: 0 0 10px;
    background: var(--muted);
}
.timeline-dot.type-appel { background: var(--primary); }
.timeline-dot.type-email { background: var(--accent); }
.timeline-dot.type-reunion { background: var(--green); }
.timeline-dot.type-note { background: #94a3b8; }

.source-list { list-style: none; margin: 0; padding: 0; }
.source-row { display: grid; grid-template-columns: 1fr; gap: 6px; padding: 9px 0; border-bottom: 1px solid #f1f5f9; }
.source-row:last-child { border-bottom: 0; }
.source-name { font-size: .84rem; font-weight: 600; }
.source-bar { display: block; height: 8px; background: #eef2f7; border-radius: 5px; overflow: hidden; }
.source-bar span { display: block; height: 100%; background: var(--primary); border-radius: 5px; }
.source-count { font-size: .78rem; color: var(--muted); }

/* --------------------------------------------------------------- Tableaux */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .85rem; }
table.data th {
    text-align: left; padding: 10px 12px; font-size: .72rem; text-transform: uppercase;
    letter-spacing: .04em; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 11px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
.table-empty { text-align: center; color: var(--muted); padding: 22px 0; }
.cell-user { display: flex; align-items: center; gap: 9px; font-weight: 600; }

/* ------------------------------------------------------------- Filtres */
.filters {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 12px; margin-bottom: 14px; display: grid; grid-template-columns: 1fr; gap: 9px;
}
.filters input, .filters select {
    width: 100%; padding: 10px 12px; font: inherit; font-size: .87rem;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff;
}
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-wrap input { padding-left: 36px; }

/* ---------------------------------------------------------- Cartes clients */
.contact-grid { display: grid; grid-template-columns: 1fr; gap: 11px; }
.contact-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 13px; display: flex; gap: 12px; align-items: flex-start;
    box-shadow: var(--shadow-sm); cursor: pointer; transition: box-shadow .15s, transform .15s, border-color .15s;
}
.contact-card:hover { box-shadow: var(--shadow); border-color: #a7e8c0; }
.contact-photo {
    width: 46px; height: 46px; flex: 0 0 46px; border-radius: 12px; object-fit: cover;
    background: var(--primary-soft);
}
.contact-photo-fallback {
    width: 46px; height: 46px; flex: 0 0 46px; border-radius: 12px;
    background: var(--primary-soft); color: var(--primary-dark);
    display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.contact-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.contact-name { font-weight: 700; font-size: .92rem; color: var(--dark); }
.contact-company { font-size: .8rem; color: var(--muted); }
.contact-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.contact-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 0; }
.pagination span { font-size: .82rem; color: var(--muted); }

/* -------------------------------------------------------------- Kanban */
.kanban-wrap { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 10px; -webkit-overflow-scrolling: touch; }
.kanban-col {
    flex: 0 0 268px; background: #eef2f8; border-radius: var(--radius);
    padding: 11px; display: flex; flex-direction: column; min-height: 220px;
}
.kanban-col.drag-over { background: var(--primary-soft); outline: 2px dashed var(--primary); }
.kanban-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.kanban-title { display: flex; align-items: center; gap: 7px; font-size: .84rem; font-weight: 700; color: var(--dark); }
.stage-dot { width: 9px; height: 9px; border-radius: 50%; }
.kanban-count { font-size: .74rem; color: var(--muted); font-weight: 600; }
.kanban-total { font-size: .76rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 8px; }
.kanban-cards { display: flex; flex-direction: column; gap: 9px; flex: 1; }
.kanban-card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
    padding: 11px; box-shadow: var(--shadow-sm); cursor: grab;
    touch-action: pan-y; -webkit-user-select: none; user-select: none;
}
.kanban-card.dragging { opacity: .45; }
.kanban-card-name { font-weight: 700; font-size: .85rem; color: var(--dark); }
.kanban-card-company { font-size: .76rem; color: var(--muted); margin-top: 2px; }
.kanban-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; }
.kanban-empty { border: 1px dashed #cbd5e1; border-radius: var(--radius-sm); padding: 14px; text-align: center; color: var(--muted); font-size: .78rem; }
.kanban-hint { font-size: .78rem; color: var(--muted); margin-bottom: 10px; }

/* -------------------------------------------------------------- Agenda */
.agenda-tabs { display: flex; gap: 6px; background: #eef2f8; padding: 4px; border-radius: 12px; margin-bottom: 14px; overflow-x: auto; }
.agenda-tab {
    flex: 1; border: 0; background: none; padding: 9px 12px; border-radius: 9px;
    font: inherit; font-size: .84rem; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.agenda-tab.is-active { background: #fff; color: var(--dark); box-shadow: var(--shadow-sm); }

.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cal-title { font-weight: 700; font-size: .95rem; text-transform: capitalize; }
.cal-nav { display: flex; gap: 6px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: .68rem; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 6px 0; }
.cal-cell {
    min-height: 62px; border-radius: 9px; border: 1px solid var(--line); background: #fff;
    padding: 5px; display: flex; flex-direction: column; gap: 3px; cursor: pointer;
}
.cal-cell.is-out { opacity: .42; }
.cal-cell.is-today { border-color: var(--primary); background: var(--primary-soft); }
.cal-cell:hover { border-color: var(--primary); }
.cal-daynum { font-size: .76rem; font-weight: 700; color: #334155; }
.cal-event { font-size: .66rem; padding: 2px 5px; border-radius: 5px; background: var(--primary); color: #ffffff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event.statut-termine { background: var(--green); }
.cal-event.statut-annule { background: #94a3b8; text-decoration: line-through; }
.cal-more { font-size: .64rem; color: var(--muted); }

.agenda-list { list-style: none; margin: 0; padding: 0; }
.agenda-day-group { margin-bottom: 14px; }
.agenda-day-title { font-size: .8rem; font-weight: 700; color: var(--primary-dark); text-transform: capitalize; margin-bottom: 6px; }
.agenda-item {
    display: flex; gap: 11px; align-items: flex-start; background: #fff; border: 1px solid var(--line);
    border-left: 4px solid var(--primary); border-radius: var(--radius-sm); padding: 11px; margin-bottom: 8px;
}
.agenda-item.statut-termine { border-left-color: var(--green); }
.agenda-item.statut-annule { border-left-color: #94a3b8; opacity: .75; }
.agenda-time { font-size: .78rem; font-weight: 700; color: var(--dark); flex: 0 0 46px; }
.agenda-body { flex: 1; min-width: 0; }
.agenda-body strong { font-size: .87rem; }
.agenda-actions { display: flex; gap: 6px; }

.task-row { display: flex; align-items: center; gap: 11px; padding: 11px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; }
.task-row.is-done { opacity: .6; }
.task-row.is-done .task-title { text-decoration: line-through; }

/* ------------------------------------------------------------- Paramètres */
.profile-card { display: flex; align-items: center; gap: 13px; margin-bottom: 4px; }
.profile-avatar { width: 54px; height: 54px; border-radius: 16px; background: var(--primary-soft); color: var(--primary-dark); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid #f1f5f9; flex-wrap: wrap; }
.settings-row:last-child { border-bottom: 0; }
.settings-row strong { font-size: .87rem; display: block; }
.settings-row span { font-size: .78rem; color: var(--muted); }
.domain-box { background: linear-gradient(135deg, #eafaf0, #f7fdf9); border: 1px solid #b8ecc9; border-radius: var(--radius); padding: 14px; }

/* ----------------------------------------------------------------- Modales */
.modal-root { position: fixed; inset: 0; z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .5); }
.modal {
    position: relative; background: #fff; width: 100%; max-width: 620px;
    border-radius: 18px 18px 0 0; max-height: 92vh; display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg); animation: modal-in .22s ease;
}
.modal-sm { max-width: 420px; }
@keyframes modal-in { from { transform: translateY(22px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
.modal-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 15px 16px; border-bottom: 1px solid var(--line);
}
.modal-x { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 5px; border-radius: 8px; }
.modal-x:hover { background: #f1f5f9; color: var(--dark); }
.modal-body { padding: 16px; overflow-y: auto; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
.modal-foot {
    display: flex; gap: 9px; justify-content: flex-end; padding: 13px 16px;
    border-top: 1px solid var(--line); background: #fafbfe;
    padding-bottom: calc(13px + env(safe-area-inset-bottom, 0px));
}
.confirm-text { font-size: .9rem; color: #334155; }

/* --------------------------------------------------------------- Toasts */
.toast-root { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom, 0px)); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; width: calc(100% - 32px); max-width: 420px; pointer-events: none; }
.toast {
    background: var(--dark); color: #fff; padding: 11px 16px; border-radius: 11px;
    font-size: .85rem; font-weight: 500; box-shadow: var(--shadow-lg); animation: toast-in .2s ease;
    width: 100%; text-align: center;
}
.toast-success { background: #166534; }
.toast-error { background: #991b1b; }
.toast-out { opacity: 0; transform: translateY(8px); transition: all .3s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ------------------------------------------------------ Barre de navigation */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: rgba(255, 255, 255, .97); backdrop-filter: blur(8px);
    border-top: 1px solid var(--line);
    display: grid; grid-template-columns: repeat(5, 1fr);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
}
.tabbar-item {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 5px 2px; color: var(--muted); font-size: .68rem; font-weight: 600;
}
.tabbar-item:hover { text-decoration: none; }
.tabbar-item.is-active { color: var(--primary-dark); }
.tabbar-item.is-active svg { transform: translateY(-1px); }
button.tabbar-item { background: none; border: 0; cursor: pointer; font-family: inherit; }
.admin-header .tabbar-item.is-active { color: #6ee7a8; }

/* ----------------------------------------------------------------- Connexion */
.auth-body { background: var(--bg); }
.auth-layout { display: grid; grid-template-columns: 1fr; min-height: 100vh; }
.auth-aside {
    display: none;
    background: linear-gradient(150deg, #052e16, #14532d 60%, #16a34a);
    color: #fff; padding: 42px 40px;
}
.auth-aside-inner { max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.auth-aside h1 { color: #fff; font-size: 1.7rem; line-height: 1.25; }
.auth-aside-lead { color: rgba(255, 255, 255, .85); font-size: .92rem; }
.auth-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.auth-points li { display: flex; align-items: center; gap: 9px; font-size: .88rem; color: rgba(255, 255, 255, .93); }
.auth-points li::before {
    content: ""; width: 18px; height: 18px; border-radius: 50%; flex: 0 0 18px;
    background: rgba(255, 255, 255, .18);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
    background-size: 11px; background-position: center; background-repeat: no-repeat;
}
.auth-aside-img { width: 100%; height: 200px; object-fit: cover; border-radius: var(--radius); margin-top: 6px; }
.auth-main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 26px 16px calc(var(--tabbar-h) + 90px + env(safe-area-inset-bottom, 0px)); }
.auth-card {
    width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line);
    border-radius: 18px; padding: 24px 20px; box-shadow: var(--shadow);
}
.auth-card h2 { font-size: 1.25rem; }
.auth-sub { color: var(--muted); font-size: .86rem; margin: 6px 0 20px; }
.auth-foot { margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 9px; }
.auth-hint { font-size: .78rem; color: var(--muted); }
.auth-admin-link { font-size: .82rem; font-weight: 600; }
.install-bar {
    margin-top: 16px; display: inline-flex; align-items: center; gap: 9px;
    background: #fff; border: 1px solid var(--line); border-radius: 30px;
    padding: 10px 18px; font: inherit; font-size: .84rem; font-weight: 600; color: var(--text);
    cursor: pointer; box-shadow: var(--shadow-sm);
}
.install-bar:hover { border-color: var(--primary); color: var(--primary-dark); }
.install-icon {
    width: 18px; height: 18px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23166534' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3v12m0 0-4.5-4.5M12 15l4.5-4.5M5 20h14'/%3E%3C/svg%3E");
    background-size: contain; background-repeat: no-repeat;
}

.install-steps { display: flex; flex-direction: column; gap: 12px; }
.install-step { display: flex; gap: 12px; align-items: flex-start; }
.install-step svg { color: var(--primary-dark); flex: 0 0 auto; }
.install-step strong { display: block; font-size: .88rem; }
.install-step span { font-size: .8rem; color: var(--muted); }

/* -------------------------------------------------------------- Chargement */
.skeleton { background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 50%, #eef2f7 75%); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ------------------------------------------------------------------ Desktop */
@media (min-width: 700px) {
    .page-head { flex-direction: row; align-items: flex-end; justify-content: space-between; }
    h1 { font-size: 1.55rem; }
    .kpi-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr 1fr; }
    .field-full { grid-column: 1 / -1; }
    .filters { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
    .contact-grid { grid-template-columns: repeat(2, 1fr); }
    .source-row { grid-template-columns: 150px 1fr 40px; align-items: center; }
    .modal-root { align-items: center; }
    .modal { border-radius: 18px; max-height: 88vh; }
    .auth-main { padding: 40px; }
    .agenda-tab { flex: 0 0 auto; }
}

@media (min-width: 1020px) {
    .auth-layout { grid-template-columns: 1.05fr .95fr; }
    .auth-aside { display: block; }
    .brand-mobile { display: none; }
    .kpi-grid { grid-template-columns: repeat(6, 1fr); }
    .contact-grid { grid-template-columns: repeat(3, 1fr); }
    .app-main { padding-left: 20px; padding-right: 20px; }
    .tabbar { max-width: 760px; margin: 0 auto; border-radius: 16px 16px 0 0; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

@media (max-width: 480px) {
    .user-name { display: none; }
    .kpi-value { font-size: 1.1rem; }
    .cal-cell { min-height: 54px; }
}

/* ------------------------------------------------------------- Admin */
.admin-body { background: #f2f5fa; }
.admin-header { background: var(--dark); border-bottom: 0; }
.admin-header .brand-text { color: #fff; }
.admin-header .brand-text small { color: rgba(255, 255, 255, .6); }
.admin-header .icon-btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); color: #fff; }
.admin-header .icon-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .3); }
.admin-header .user-trigger { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); color: #fff; }
.admin-header .avatar { background: rgba(255, 255, 255, .16); color: #fff; }
.admin-tabs { display: flex; gap: 6px; background: #e4eaf4; padding: 4px; border-radius: 12px; margin-bottom: 15px; overflow-x: auto; }
.admin-tab { flex: 1; border: 0; background: none; padding: 9px 13px; border-radius: 9px; font: inherit; font-size: .83rem; font-weight: 600; color: #5b6b83; cursor: pointer; white-space: nowrap; }
.admin-tab.is-active { background: #fff; color: var(--dark); box-shadow: var(--shadow-sm); }
.admin-gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.admin-gate-card { width: 100%; max-width: 430px; background: #fff; border-radius: 20px; padding: 26px 22px; box-shadow: var(--shadow-lg); }
.admin-badge { display: inline-block; font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: rgba(255, 255, 255, .14); color: #fff; padding: 4px 9px; border-radius: 20px; }
.table-scroll-hint { font-size: .74rem; color: var(--muted); margin-bottom: 8px; }

/* ------------------------------------------------------------ WhatsApp */
.btn-wa { background: #25d366; color: #fff; border-color: #1ebe5b; box-shadow: 0 4px 12px rgba(37, 211, 102, .28); }
.btn-wa:hover { background: #1ebe5b; color: #fff; }
.wa-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: #25d366; color: #fff; border: 1px solid #1ebe5b; border-radius: 8px;
    padding: 7px 12px; font: inherit; font-size: .78rem; font-weight: 600;
    line-height: 1.1; cursor: pointer; flex: 0 0 auto;
}
.wa-btn:hover { background: #1ebe5b; }
.wa-btn.wa-mini { padding: 6px; border-radius: 8px; }
.wa-btn.wa-mini svg { display: block; }
.wa-link { background: none; border: 0; padding: 0; color: #128c4a; cursor: pointer; }
.row-actions { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.field-hint { font-size: .72rem; color: var(--muted); line-height: 1.4; }
.wa-preview-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 4px; }
.wa-preview-head strong { font-size: .8rem; color: #475569; }
.wa-preview {
    background: #e7f8ef; border: 1px solid #c3ecd8; border-radius: 10px;
    padding: 11px 13px; font-size: .84rem; line-height: 1.5; color: #14532d;
    white-space: pre-wrap; word-break: break-word; margin-top: 6px;
}
.wa-recipients-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 15px 0 8px; }
.wa-recipients-head strong { font-size: .82rem; color: #475569; }
.wa-recipients { max-height: 230px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.wa-recipient { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-bottom: 1px solid #f1f5f9; }
.wa-recipient:last-child { border-bottom: 0; }
.wa-recipient.is-off { opacity: .55; }
.wa-recipient input[type="checkbox"] { width: 18px; height: 18px; accent-color: #25d366; flex: 0 0 auto; margin: 0; }
.wa-recipient-name { flex: 1; min-width: 0; font-size: .84rem; font-weight: 600; color: var(--dark); }
.wa-recipient-name small { display: block; font-size: .74rem; font-weight: 400; color: var(--muted); }
.kanban-foot-actions { display: flex; align-items: center; gap: 6px; }
.timeline-dot.type-whatsapp { background: #25d366; }

@media (max-width: 480px) {
    .modal-foot { flex-wrap: wrap; }
    .modal-foot .btn-wa { flex: 1 1 100%; }
}
