/* =========================================================================
   Comptoir des Serruriers — CRM WhatsApp
   Design system maison : sobre, pro, façon SaaS (Linear / Notion / Stripe).
   Accent : Vert WhatsApp #008069 · Sidebar claire · Typo Inter.
   ========================================================================= */

:root {
    /* Surfaces & fonds */
    --bg:               #F0F2F5;
    --surface:          #FFFFFF;
    --sidebar-bg:       #FBFCFD;

    /* Bordures */
    --border:           #E8EAED;
    --border-strong:    #DCDFE4;

    /* Texte */
    --text:             #16191D;
    --text-secondary:   #6B7280;
    --text-tertiary:    #9CA3AF;

    /* Accent (vert WhatsApp) */
    --accent:           #008069;
    --accent-hover:     #006A57;
    --accent-soft:      #E7F4F0;
    --accent-contrast:  #FFFFFF;

    /* Rayons */
    --radius-card:      12px;
    --radius:           8px;
    --radius-sm:        6px;
    --radius-pill:      999px;

    /* Ombres (subtiles) */
    --shadow-sm:        0 1px 2px rgba(16, 24, 40, .04);
    --shadow:           0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-md:        0 4px 12px rgba(16, 24, 40, .08);

    /* Layout */
    --sidebar-w:        248px;

    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ----------------------------------------------------------------- Reset */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

/* ============================================================ App shell */
.app-shell { display: flex; min-height: 100vh; }

/* --- Sidebar --------------------------------------------------------- */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    border-bottom: 1px solid var(--border);
}
.brand-mark {
    width: 34px; height: 34px;
    flex-shrink: 0;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-sm);
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 14px; font-weight: 600; color: var(--text); }
.brand-text span { font-size: 11.5px; color: var(--text-tertiary); }

.sidebar__nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-section { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
               color: var(--text-tertiary); padding: 10px 12px 6px; }

.nav-item {
    display: flex; align-items: center; gap: 11px;
    padding: 8px 12px;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-weight: 500;
    transition: background-color .12s ease, color .12s ease;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav-item:hover { background: rgba(16, 24, 40, .04); color: var(--text); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.is-active svg { opacity: 1; }
.nav-item.is-disabled { color: var(--text-tertiary); cursor: default; }
.nav-item.is-disabled:hover { background: transparent; color: var(--text-tertiary); }
.nav-item .nav-soon { margin-left: auto; font-size: 10px; font-weight: 600; color: var(--text-tertiary);
                      background: rgba(16,24,40,.05); padding: 2px 7px; border-radius: var(--radius-pill); }

.sidebar__footer { padding: 12px; border-top: 1px solid var(--border); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-meta strong { font-size: 13px; font-weight: 600; }
.user-meta a { font-size: 12px; color: var(--text-tertiary); }
.user-meta a:hover { color: var(--accent); }

/* --- Zone principale ------------------------------------------------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* Barre supérieure mobile (cachée en desktop) */
.topbar { display: none; }

.content { padding: 28px 32px 48px; max-width: 1180px; width: 100%; }

/* En-tête de page */
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.page-head h1 { font-size: 22px; }
.page-head .subtitle { color: var(--text-secondary); font-size: 13.5px; margin-top: 3px; }
.page-head .subtitle b { color: var(--text); font-weight: 600; }

/* ============================================================== Filtres */
.toolbar {
    display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 14px 16px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 500; color: var(--text-secondary); }

.select, .input {
    appearance: none; -webkit-appearance: none;
    font: inherit; color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 8px 12px;
    min-width: 170px;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.select {
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236B7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='4 6 8 10 12 6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 11px center;
    cursor: pointer;
}
.select:focus, .input:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 128, 105, .14);
}
.toolbar__actions { display: flex; gap: 8px; margin-left: auto; }

/* =============================================================== Boutons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    font: inherit; font-weight: 600; font-size: 13.5px;
    padding: 8px 15px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color .12s ease, border-color .12s ease, color .12s ease;
    white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--text-secondary); border-color: var(--border-strong); }
.btn-ghost:hover { background: rgba(16,24,40,.03); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 12px 22px; font-size: 15px; border-radius: 12px; }
.btn-create { box-shadow: 0 6px 16px rgba(0,128,105,.28); }
.btn-create:hover { box-shadow: 0 8px 20px rgba(0,128,105,.34); }

/* ============================================================ Shop tabs */
.shop-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.shop-tab {
    display: inline-flex; align-items: center;
    padding: 8px 16px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border-strong);
    color: var(--text-secondary); font-weight: 600; font-size: 13.5px;
    transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.shop-tab:hover { background: rgba(16,24,40,.03); color: var(--text); }
.shop-tab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.shop-tab.is-active:hover { background: var(--accent-hover); color: #fff; }

/* Indication d'avertissement sous un champ de formulaire */
.hint--warn { color: #B45309; }

/* Champ avec bouton « Améliorer (IA) » */
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.field-head label { margin: 0; }
.ai-btn { color: var(--accent); border-color: var(--border-strong); background: var(--surface); }
.ai-btn:hover { background: var(--accent-soft); color: var(--accent-hover); }
.ai-btn:disabled { opacity: .6; cursor: default; }

/* Liste des choix du bot (lignes éditables) */
.prob-row { display: grid; grid-template-columns: 1fr 1.3fr 210px 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.prob-row .input, .prob-row .select { min-width: 0; width: 100%; }
.prob-del { color: #B91C1C; padding: 6px 10px; }
.prob-del:hover { background: #FEF2F2; color: #991B1B; }
@media (max-width: 720px) {
    .prob-row { grid-template-columns: 1fr; }
}

/* Boutiques éditables */
.bq-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr 36px; gap: 8px; align-items: center; margin-bottom: 8px; }
.bq-row .input, .bq-row .select { min-width: 0; width: 100%; }
.bq-del { color: #B91C1C; padding: 6px 10px; }
.bq-del:hover { background: #FEF2F2; color: #991B1B; }
@media (max-width: 720px) {
    .bq-row { grid-template-columns: 1fr; }
}

/* ============================================ Onglets de vue + Inbox WhatsApp */
.view-tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.view-tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 16px; font-weight: 600; font-size: 14px; color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.view-tab:hover { color: var(--text); }
.view-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.vt-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #25D366; color: #fff; font-size: 11px; font-weight: 700; }

.inbox { display: grid; grid-template-columns: 330px 1fr; height: calc(100vh - 200px); min-height: 380px;
         background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; box-shadow: var(--shadow-sm); }
.inbox__list { border-right: 1px solid var(--border); overflow-y: auto; min-height: 0; }
.conv-item { display: flex; align-items: center; gap: 11px; padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.conv-item:hover { background: rgba(16,24,40,.03); }
.conv-item.is-selected { background: var(--accent-soft); }
.conv-avatar { width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; background: #D7E5E0; color: #045446;
               display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.conv-main { min-width: 0; flex: 1; }
.conv-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.conv-top strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-time { font-size: 11.5px; color: var(--text-tertiary); white-space: nowrap; flex-shrink: 0; }
.conv-snippet { font-size: 13px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv-item.is-unread .conv-snippet { color: var(--text); font-weight: 600; }
.conv-item.is-unread .conv-top strong { font-weight: 700; }

.inbox__chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #efeae2; }
.inbox__chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 14px; background: #008069; color: #fff; }
.ic-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.inbox__chat-head .conv-avatar { width: 38px; height: 38px; background: rgba(255,255,255,.25); color: #fff; }
.ic-meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ic-meta strong { font-size: 14px; font-weight: 600; }
.ic-sub { font-size: 11.5px; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic-actions { display: flex; gap: 6px; flex-shrink: 0; }
.ic-actions .btn-ghost { background: rgba(255,255,255,.18); border-color: transparent; color: #fff; }
.ic-actions .btn-ghost:hover { background: rgba(255,255,255,.30); color: #fff; }
.inbox__thread { flex: 1; min-height: 0; max-height: none; border-radius: 0; }
.inbox__input { border-radius: 0; align-items: flex-end; }
.inbox__hint { font-size: 11.5px; color: var(--text-tertiary); padding: 7px 14px; background: var(--surface); border-top: 1px solid var(--border); }
.inbox__empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-tertiary); gap: 8px; text-align: center; }
.inbox__empty-ic { font-size: 42px; }

@media (max-width: 860px) {
    .inbox { grid-template-columns: 1fr; height: auto; }
    .inbox__list { max-height: 38vh; border-right: 0; border-bottom: 1px solid var(--border); }
    .inbox__chat { min-height: 60vh; }
}

/* ================================================================ Table */
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.leads-table { width: 100%; border-collapse: collapse; }
.leads-table thead th {
    text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .03em;
    text-transform: uppercase; color: var(--text-tertiary);
    padding: 12px 16px; background: #FCFCFD; border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.leads-table tbody td {
    padding: 14px 16px; border-bottom: 1px solid var(--border);
    color: var(--text); vertical-align: middle;
}
.leads-table tbody tr:last-child td { border-bottom: 0; }
.leads-table tbody tr { transition: background-color .1s ease; }
.leads-table tbody tr:hover { background: #FBFBFE; }

.cell-id { color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
/* Pastille « non lu » + ligne mise en avant (façon WhatsApp) */
.subtitle-unread { color: #15803D; }
.unread-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #25D366; margin-right: 7px; vertical-align: middle; box-shadow: 0 0 0 3px rgba(37,211,102,.15); }
.leads-table tbody tr.is-unread { background: #F1FCF5; }
.leads-table tbody tr.is-unread:hover { background: #E7F9EE; }
.leads-table tbody tr.is-unread .cell-strong { font-weight: 700; color: var(--text); }
.cell-mono { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-secondary); }
.cell-strong { font-weight: 500; }
.cell-muted { color: var(--text-tertiary); }

/* ============================================================== Badges */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600;
    padding: 3px 10px 3px 8px;
    border-radius: var(--radius-pill);
    white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.badge--nouveau  { background: #EFF4FF; color: #1D4ED8; }
.badge--qualifie { background: #F4F3FF; color: #5925DC; }
.badge--en_cours { background: #FEF6E7; color: #B45309; }
.badge--traite   { background: #ECFDF3; color: #067647; }
.badge--annule   { background: #F2F4F7; color: #475467; }
.badge--default  { background: #F2F4F7; color: #475467; }

/* ============================================================ État vide */
.empty-state {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-card); box-shadow: var(--shadow-sm);
    padding: 56px 24px; text-align: center; color: var(--text-secondary);
}
.empty-state .empty-icon {
    width: 44px; height: 44px; margin: 0 auto 14px;
    border-radius: 12px; background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center;
}
.empty-state h3 { font-size: 15px; color: var(--text); margin-bottom: 4px; }
.empty-state p { margin: 0; font-size: 13.5px; }

/* =========================================================== Login page */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card {
    width: 100%; max-width: 380px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-card); box-shadow: var(--shadow-md);
    padding: 30px 28px;
}
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand .brand-mark { width: 44px; height: 44px; border-radius: 12px; }
.auth-brand .brand-mark svg { width: 24px; height: 24px; }
.auth-brand h1 { font-size: 18px; }
.auth-brand p { margin: 0; font-size: 13px; color: var(--text-tertiary); }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.form-group .input { width: 100%; min-width: 0; }
.alert-error {
    background: #FEF3F2; border: 1px solid #FECDCA; color: #B42318;
    border-radius: var(--radius); padding: 10px 12px; font-size: 13px; margin-bottom: 16px;
}
.btn-block { width: 100%; }

/* Bouton « Se connecter avec Google » + séparateur sur la page de login */
.btn-google {
    gap: 10px; background: #fff; color: #3c4043;
    border: 1px solid var(--border-strong); font-weight: 600;
}
.btn-google:hover { background: #f7f8fa; color: #202124; box-shadow: var(--shadow-sm); }
.auth-sep { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--text-tertiary); font-size: 12.5px; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ========================================================== Responsive */

/* Drawer mobile : la sidebar coulisse hors-écran et se révèle via le checkbox */
.nav-cb { display: none; }
.nav-overlay { display: none; }

@media (max-width: 860px) {
    .topbar {
        display: flex; align-items: center; gap: 12px;
        padding: 12px 16px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        position: sticky; top: 0; z-index: 30;
    }
    .topbar .hamburger {
        display: flex; align-items: center; justify-content: center;
        width: 38px; height: 38px; border-radius: var(--radius);
        border: 1px solid var(--border-strong); background: var(--surface);
        cursor: pointer; color: var(--text);
    }
    .topbar .topbar-title { font-weight: 600; font-size: 15px; }

    .sidebar {
        position: fixed; top: 0; left: 0; z-index: 50;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: var(--shadow-md);
    }
    .nav-cb:checked ~ .app-shell .sidebar { transform: translateX(0); }
    .nav-cb:checked ~ .app-shell .nav-overlay {
        display: block; position: fixed; inset: 0; z-index: 40;
        background: rgba(16, 24, 40, .35);
    }

    .content { padding: 18px 16px 40px; }
    .page-head h1 { font-size: 19px; }
    .toolbar { padding: 12px; }
    .toolbar__actions { margin-left: 0; width: 100%; }
    .select, .input { min-width: 0; width: 100%; }
    .field { flex: 1 1 140px; }

    /* Tableau -> cartes empilées */
    .table-card { background: transparent; border: 0; box-shadow: none; border-radius: 0; overflow: visible; }
    .leads-table, .leads-table tbody, .leads-table tr, .leads-table td { display: block; width: 100%; }
    .leads-table thead { display: none; }
    .leads-table tbody tr {
        background: var(--surface); border: 1px solid var(--border);
        border-radius: var(--radius-card); box-shadow: var(--shadow-sm);
        padding: 6px 14px; margin-bottom: 12px;
    }
    .leads-table tbody tr:hover { background: var(--surface); }
    .leads-table tbody td {
        display: flex; align-items: center; justify-content: space-between; gap: 16px;
        padding: 9px 0; border-bottom: 1px solid var(--border);
    }
    .leads-table tbody tr td:last-child { border-bottom: 0; }
    .leads-table tbody td::before {
        content: attr(data-label);
        font-size: 12px; font-weight: 600; color: var(--text-secondary);
        text-transform: uppercase; letter-spacing: .03em;
    }
}

/* =========================================================================
   Composants additionnels : flash, panneaux, formulaires, switch,
   vue détail, formulaire de saisie.
   ========================================================================= */

/* --- Messages flash -------------------------------------------------- */
.flash {
    border-radius: var(--radius); padding: 11px 14px; margin-bottom: 16px;
    font-size: 13.5px; font-weight: 500; border: 1px solid transparent;
}
.flash--success { background: #ECFDF3; color: #067647; border-color: #ABEFC6; }
.flash--error   { background: #FEF3F2; color: #B42318; border-color: #FECDCA; }
.flash--info    { background: var(--accent-soft); color: var(--accent-hover); border-color: #BFE3DA; }

/* --- Panneaux (cartes de section) ----------------------------------- */
.panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-card); box-shadow: var(--shadow-sm);
    margin-bottom: 20px; overflow: hidden;
}
.panel__head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 18px; border-bottom: 1px solid var(--border); background: #FCFCFD;
}
.panel__head h2 { font-size: 14px; font-weight: 600; }
.panel__empty { padding: 28px 18px; color: var(--text-secondary); font-size: 13.5px; text-align: center; }
.panel > .form-inline, .panel > .settings-list, .panel > .form-stack { padding: 18px; }
.muted-count { font-size: 12.5px; color: var(--text-tertiary); }
.opt { color: var(--text-tertiary); font-weight: 400; }

/* --- Formulaire en ligne (ajout) ------------------------------------ */
.form-inline { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .field { flex: 1 1 200px; }
.form-inline .input { width: 100%; min-width: 0; }
.form-inline__action { flex: 0 0 auto; }

/* --- Liste de gestionnaires (lignes éditables) ---------------------- */
.settings-list { display: flex; flex-direction: column; gap: 10px; }
.settings-row {
    display: flex; align-items: flex-end; gap: 14px;
    padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface);
}
.settings-row.is-inactive { background: #FAFAFB; opacity: .85; }
.settings-row__field { display: flex; flex-direction: column; gap: 5px; flex: 1 1 180px; min-width: 0; }
.settings-row__field label { font-size: 11.5px; font-weight: 500; color: var(--text-secondary); }
.settings-row__field .input { width: 100%; min-width: 0; }

/* --- Switch actif/inactif ------------------------------------------- */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; padding-bottom: 6px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
    width: 36px; height: 20px; border-radius: 999px; background: var(--border-strong);
    position: relative; transition: background-color .15s ease; flex-shrink: 0;
}
.switch__thumb {
    position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
    background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s ease;
}
.switch input:checked + .switch__track { background: var(--accent); }
.switch input:checked + .switch__track .switch__thumb { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px rgba(0,128,105,.18); }
.switch__label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); min-width: 46px; }

/* --- Formulaire vertical (saisie / édition) ------------------------- */
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-stack .field { display: flex; flex-direction: column; gap: 6px; }
.form-stack .field > label { font-size: 13px; font-weight: 500; color: var(--text); }
.form-stack .field .hint { font-size: 12px; color: var(--text-tertiary); }
.form-stack .input, .form-stack .select, .form-stack .textarea { width: 100%; min-width: 0; }
.textarea {
    appearance: none; font: inherit; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius); padding: 9px 12px; resize: vertical; min-height: 84px;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,128,105,.14); }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 4px; }
.required-star { color: #D92D20; }

/* --- Cartes radio (type de client) ---------------------------------- */
.radio-cards { display: flex; gap: 12px; flex-wrap: wrap; }
.radio-card {
    flex: 1 1 160px; position: relative; border: 1px solid var(--border-strong);
    border-radius: var(--radius); padding: 14px; cursor: pointer; transition: all .12s ease; background: var(--surface);
}
.radio-card input { position: absolute; opacity: 0; }
.radio-card__title { font-weight: 600; font-size: 14px; display: block; }
.radio-card__desc { font-size: 12px; color: var(--text-tertiary); margin-top: 3px; display: block; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent); }
.radio-card:has(input:focus-visible) { box-shadow: 0 0 0 3px rgba(0,128,105,.18); }

/* --- Lignes de tableau cliquables ----------------------------------- */
.leads-table tbody tr.is-clickable { cursor: pointer; }
.row-link { color: var(--accent); font-weight: 600; }
.row-link:hover { text-decoration: underline; }

/* --- Vue détail d'un lead ------------------------------------------- */
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.back-link:hover { color: var(--accent); }
.detail-cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }

/* Fiche lead : infos au centre, écran WhatsApp à droite */
.lead-layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 20px; align-items: start; margin-bottom: 20px; }
.lead-main { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.lead-side { min-width: 0; position: sticky; top: 16px; }
.lead-side .wa-phone { max-width: none; margin: 16px; }
.lead-side .wa-thread { max-height: 520px; }

/* Carrousel des médias (bas de fiche) */
.media-head { display: flex; align-items: center; justify-content: space-between; }
.media-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; margin-left: 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.media-nav { display: flex; gap: 6px; }
.media-arrow { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-secondary); font-size: 18px; line-height: 1; cursor: pointer; transition: background-color .12s ease, color .12s ease; }
.media-arrow:hover { background: rgba(16,24,40,.04); color: var(--text); }
.media-track { display: flex; gap: 14px; overflow-x: auto; padding: 16px 18px; scroll-behavior: smooth; scroll-snap-type: x mandatory; }
.media-card { flex: 0 0 auto; width: 190px; scroll-snap-align: start; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); margin: 0; }
/* Toutes les vignettes (photo ET vidéo) au même format, recadrées */
.media-thumb { display: block; width: 100%; height: 140px; background: #000; overflow: hidden; }
.media-thumb > button { display: block; width: 100%; height: 100%; padding: 0; margin: 0; border: 0; background: none; cursor: zoom-in; }
.media-thumb img, .media-thumb video { display: block; width: 100%; height: 100%; object-fit: cover; }
.media-card__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 11px; font-size: 12.5px; color: var(--text-secondary); }
.media-dl { color: var(--accent); font-weight: 600; white-space: nowrap; }
.media-dl:hover { color: var(--accent-hover); }

/* Historique du numéro (doublons) */
.hist-list { display: flex; flex-direction: column; }
.hist-row { display: grid; grid-template-columns: 92px 1fr auto; gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--border); color: var(--text); }
.hist-row:last-of-type { border-bottom: 0; }
.hist-row:hover { background: rgba(16,24,40,.03); }
.hist-date { color: var(--text-secondary); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.hist-demande { font-size: 13.5px; word-break: break-word; }

/* Visionneuse plein écran (même page) */
.wa-img-btn { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.82); padding: 30px; }
.lightbox[hidden] { display: none; }
.lightbox__img { max-width: 92vw; max-height: 88vh; border-radius: 8px; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.lightbox__close { position: absolute; top: 18px; right: 24px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255,255,255,.15); color: #fff; font-size: 28px; line-height: 1; cursor: pointer; }
.lightbox__close:hover { background: rgba(255,255,255,.28); }
.lightbox__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border: 0; border-radius: 50%; background: rgba(255,255,255,.15); color: #fff; font-size: 34px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lightbox__nav:hover { background: rgba(255,255,255,.30); }
.lightbox__prev { left: 24px; }
.lightbox__next { right: 24px; }

.info-list { display: flex; flex-direction: column; }
.info-section-title {
    padding: 10px 18px 6px;
    font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-tertiary); background: var(--accent-soft);
    border-bottom: 1px solid var(--border);
}
.info-section-title:first-child { border-top: 0; }
.info-item { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.info-item:last-child { border-bottom: 0; }
.info-item dt { color: var(--text-secondary); font-size: 13px; margin: 0; }
.info-item dd { margin: 0; font-size: 13.5px; color: var(--text); word-break: break-word; }
.info-item dd.empty { color: var(--text-tertiary); }
.info-item dd a { word-break: break-all; }

/* --- Responsive composants ------------------------------------------ */
@media (max-width: 1024px) {
    .lead-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .detail-cols { grid-template-columns: 1fr; }
    .info-item { grid-template-columns: 1fr; gap: 2px; padding: 10px 14px; }
    .info-item dt { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
    .settings-row { flex-direction: column; align-items: stretch; }
    .form-inline .field { flex-basis: 100%; }
    .form-inline__action, .form-inline__action .btn { width: 100%; }
}

/* =========================================================================
   Conversation WhatsApp (écran type téléphone) dans la fiche lead
   ========================================================================= */
.wa-phone {
    margin: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: #efeae2;
    max-width: 460px;
}
.wa-topbar {
    display: flex; align-items: center; gap: 10px;
    background: #008069; color: #fff; padding: 10px 14px;
}
.wa-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: rgba(255,255,255,.25); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 12px; flex-shrink: 0;
}
.wa-who { display: flex; flex-direction: column; line-height: 1.2; }
.wa-who strong { font-size: 14px; font-weight: 600; }
.wa-who span { font-size: 11.5px; opacity: .85; }

.wa-thread {
    padding: 14px; display: flex; flex-direction: column; gap: 8px;
    max-height: 460px; overflow-y: auto;
    background-color: #efeae2;
    background-image: radial-gradient(rgba(0,0,0,.025) 1px, transparent 1px);
    background-size: 16px 16px;
}
.wa-msg {
    position: relative; max-width: 78%; padding: 7px 10px 18px;
    border-radius: 8px; font-size: 13.5px; line-height: 1.4;
    box-shadow: 0 1px 1px rgba(0,0,0,.06); word-wrap: break-word; white-space: normal;
}
.wa-msg--in  { align-self: flex-start; background: #fff; border-top-left-radius: 2px; }
.wa-msg--out { align-self: flex-end; background: #d9fdd3; border-top-right-radius: 2px; }
.wa-body { display: block; color: #111b21; }
.wa-time { position: absolute; right: 8px; bottom: 4px; font-size: 10px; color: #667781; }
.wa-img { display: block; max-width: 200px; border-radius: 6px; margin-bottom: 4px; }
.wa-media-ph { display: inline-block; color: #667781; font-style: italic; margin-bottom: 4px; }
.wa-empty { text-align: center; color: #667781; font-size: 13px; padding: 24px 0; }

.wa-input {
    display: flex; gap: 8px; padding: 10px 12px; background: #f0f2f5; border-top: 1px solid var(--border);
}
.wa-input input[type="text"] {
    flex: 1; min-width: 0; border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill); padding: 8px 14px; font: inherit; background: #fff;
}
.wa-input input[type="text"]:focus { outline: none; border-color: var(--accent); }

@media (max-width: 860px) {
    .wa-phone { margin: 14px 0; max-width: none; }
}

/* =========================================================================
   Statistiques
   ========================================================================= */
.kpi-grid {
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 20px;
}
.kpi {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm); padding: 16px; display: flex; flex-direction: column; gap: 4px;
}
.kpi-val { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.kpi-label { font-size: 12px; color: var(--text-secondary); }
.kpi--accent { background: var(--accent-soft); border-color: #BFE3DA; }
.kpi--accent .kpi-val { color: var(--accent); }

.stats-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }

.stat-list { padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.stat-row { display: grid; grid-template-columns: 150px 1fr 36px; align-items: center; gap: 12px; }
.stat-key { font-size: 13px; color: var(--text); }
.stat-bar { height: 8px; background: #EEF0F3; border-radius: 999px; overflow: hidden; }
.stat-bar__fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; min-width: 2px; }
.stat-n { font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }

.bars { display: flex; align-items: flex-end; gap: 6px; padding: 18px; height: 200px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bar__col { flex: 1; width: 60%; display: flex; align-items: flex-end; }
.bar__fill { width: 100%; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; transition: height .2s ease; }
.bar__lbl { font-size: 10px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }

@media (max-width: 980px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
    .stats-cols { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-row { grid-template-columns: 110px 1fr 30px; }
}

/* =========================================================================
   ✦ WAOUWW — couche graphique : dégradés vifs, cartes statistiques,
     animations marquées (apparition en cascade, survol en relief, compteurs,
     badges pulsants, graphiques animés). Clair, festif, reste lisible.
     Respecte prefers-reduced-motion (animations désactivées).
   ========================================================================= */

:root {
    --grad-green:  linear-gradient(135deg, #15C28A 0%, #008069 100%);
    --grad-blue:   linear-gradient(135deg, #4E9BFF 0%, #2563EB 100%);
    --grad-amber:  linear-gradient(135deg, #FFB24C 0%, #F97316 100%);
    --grad-violet: linear-gradient(135deg, #A78BFA 0%, #6D28D9 100%);
    --grad-cyan:   linear-gradient(135deg, #34D7E0 0%, #0E9AA8 100%);
    --grad-pink:   linear-gradient(135deg, #FB7FB5 0%, #DB2777 100%);
}

/* Fond : très léger halo coloré (fixe) pour donner de la profondeur. */
body {
    background-image:
        radial-gradient(60vw 50vh at 0% -5%, rgba(21, 194, 138, .07), transparent 60%),
        radial-gradient(55vw 45vh at 100% 0%, rgba(78, 155, 255, .06), transparent 55%);
    background-attachment: fixed;
}

/* --------------------------------------------- Cartes statistiques (hero) */
.stat-hero {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-hero--6 { grid-template-columns: repeat(6, 1fr); }

.stat-card {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    padding: 18px 20px 17px;
    color: #fff;
    min-height: 116px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    box-shadow: 0 12px 26px -10px var(--card-glow, rgba(16, 24, 40, .3));
    transform: translateY(0);
    transition: transform .28s cubic-bezier(.2, .8, .2, 1), box-shadow .28s ease;
    will-change: transform;
    animation: card-rise .6s both;
}
.stat-card:hover {
    transform: translateY(-6px) scale(1.012);
    box-shadow: 0 22px 40px -12px var(--card-glow, rgba(16, 24, 40, .4));
}
.stat-card--green  { background: var(--grad-green);  --card-glow: rgba(0, 128, 105, .55); }
.stat-card--blue   { background: var(--grad-blue);   --card-glow: rgba(37, 99, 235, .5); }
.stat-card--amber  { background: var(--grad-amber);  --card-glow: rgba(249, 115, 22, .5); }
.stat-card--violet { background: var(--grad-violet); --card-glow: rgba(109, 40, 217, .5); }
.stat-card--cyan   { background: var(--grad-cyan);   --card-glow: rgba(14, 154, 168, .5); }
.stat-card--pink   { background: var(--grad-pink);   --card-glow: rgba(219, 39, 119, .5); }

/* Bulles décoratives translucides */
.stat-card__deco {
    position: absolute; border-radius: 50%;
    background: rgba(255, 255, 255, .16);
    pointer-events: none;
}
.stat-card__deco { width: 120px; height: 120px; right: -34px; top: -38px; }
.stat-card__deco--2 { width: 64px; height: 64px; right: 38px; bottom: -30px; background: rgba(255, 255, 255, .12); }

.stat-card__ic {
    position: absolute; top: 14px; right: 16px;
    font-size: 20px; line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .18));
    opacity: .95;
}
.stat-card__val {
    font-size: 38px; font-weight: 800; letter-spacing: -.03em; line-height: 1;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}
.stat-card__label {
    margin-top: 5px; font-size: 13px; font-weight: 600;
    opacity: .92; letter-spacing: .01em;
}

/* Apparition en cascade des cartes du hero */
.stat-hero .stat-card:nth-child(1) { animation-delay: .04s; }
.stat-hero .stat-card:nth-child(2) { animation-delay: .12s; }
.stat-hero .stat-card:nth-child(3) { animation-delay: .20s; }
.stat-hero .stat-card:nth-child(4) { animation-delay: .28s; }
.stat-hero .stat-card:nth-child(5) { animation-delay: .36s; }
.stat-hero .stat-card:nth-child(6) { animation-delay: .44s; }

@keyframes card-rise {
    from { opacity: 0; transform: translateY(16px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ------------------------------------------------ Apparition « reveal » */
.reveal { animation: reveal-up .55s both; }
@keyframes reveal-up {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------- Badges « non lu » pulsants */
.unread-dot {
    animation: dot-pulse 1.8s ease-out infinite;
}
@keyframes dot-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(37, 211, 102, .45); }
    70%  { box-shadow: 0 0 0 7px rgba(37, 211, 102, 0); }
    100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}
.vt-badge { animation: badge-pop 1.8s ease-out infinite; }
@keyframes badge-pop {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 211, 102, .5); }
    50%      { transform: scale(1.08); box-shadow: 0 0 0 5px rgba(37, 211, 102, 0); }
}

/* -------------------------------------------------- Boutons en dégradé */
.btn-primary {
    background: var(--grad-green);
    box-shadow: 0 4px 14px -4px rgba(0, 128, 105, .5);
}
.btn-primary:hover { background: var(--grad-green); filter: brightness(1.05); }
.btn-create { box-shadow: 0 10px 22px -6px rgba(0, 128, 105, .5); }
.btn-create:hover { box-shadow: 0 14px 28px -6px rgba(0, 128, 105, .58); transform: translateY(-1px); }
.btn { transition: background-color .12s ease, border-color .12s ease, color .12s ease, transform .12s ease, box-shadow .15s ease, filter .15s ease; }

/* Onglet boutique actif : dégradé + relief */
.shop-tab.is-active { background: var(--grad-green); border-color: transparent; box-shadow: 0 6px 14px -6px rgba(0, 128, 105, .5); }
.shop-tab.is-active:hover { background: var(--grad-green); filter: brightness(1.04); }

/* ----------------------------------------------- KPI page Stats (héritage) */
/* Si d'anciens .kpi subsistent, on leur donne un survol en relief discret. */
.kpi { transition: transform .2s ease, box-shadow .2s ease; }
.kpi:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

/* ------------------------------------------- Graphiques animés (stats) */
.stat-bar__fill {
    background: var(--grad-green);
    transform-origin: left center;
    animation: grow-x .9s cubic-bezier(.2, .8, .2, 1) both;
}
.bar__fill {
    background: linear-gradient(180deg, #15C28A 0%, #008069 100%);
    transform-origin: bottom center;
    animation: grow-y .85s cubic-bezier(.2, .8, .2, 1) both;
}
.bars .bar:nth-child(odd) .bar__fill { animation-delay: .04s; }
.bar:hover .bar__fill { filter: brightness(1.08); }
.bar__col { position: relative; }

@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes grow-y { from { transform: scaleY(0); } to { transform: scaleY(1); } }

/* Lignes du tableau : léger relief au survol (déjà coloré ailleurs) */
.leads-table tbody tr.is-clickable:hover { box-shadow: inset 3px 0 0 var(--accent); }

/* -------------------------------------------------------- Responsive */
@media (max-width: 980px) {
    .stat-hero, .stat-hero--6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 560px) {
    .stat-hero, .stat-hero--6 { grid-template-columns: repeat(2, 1fr); }
    .stat-card { min-height: 100px; padding: 15px 16px 14px; }
    .stat-card__val { font-size: 30px; }
}

/* Accessibilité : on coupe tout mouvement si l'utilisateur le demande. */
@media (prefers-reduced-motion: reduce) {
    .stat-card, .reveal, .stat-bar__fill, .bar__fill,
    .unread-dot, .vt-badge { animation: none !important; }
    .stat-card { transform: none !important; }
}

/* =========================================================================
   Étiquettes gestionnaire (couleur stable) + recherche instantanée
   ========================================================================= */

/* Pastille gestionnaire : couleur calculée côté serveur (Twig gestionnaire_color). */
.g-tag {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 11px; font-weight: 700; letter-spacing: .01em;
    padding: 2px 9px 2px 7px; border-radius: var(--radius-pill);
    white-space: nowrap; line-height: 1.5;
}
.g-tag__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; opacity: .85; }
.g-tag--none { background: #F2F4F7; color: #667085; }

/* Étiquette dans l'aperçu de conversation (liste inbox) */
.conv-gest { margin-top: 5px; }
/* Étiquette dans l'en-tête du chat (sur fond vert) */
.ic-gest { flex-shrink: 0; margin-left: 4px; }
.ic-gest .g-tag { box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* Champ de recherche (loupe + input) */
.search-box {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 0 12px;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,128,105,.14); }
.search-box svg { color: var(--text-tertiary); flex-shrink: 0; }
.search-box input {
    appearance: none; -webkit-appearance: none;
    border: 0; outline: none; background: transparent;
    font: inherit; color: var(--text);
    padding: 8px 0; width: 100%; min-width: 0;
}
.search-box input::placeholder { color: var(--text-tertiary); }
.search-box input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
.field--search { flex: 1 1 240px; }
.field--search .search-box { min-width: 200px; }

/* Barre au-dessus de l'inbox : recherche + filtre gestionnaire */
.conv-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.conv-toolbar .search-box { flex: 1 1 260px; }
.conv-filter { flex: 0 0 auto; }
.conv-filter .select { min-width: 210px; }

/* Ligne « aucun résultat » du tableau */
.leads-noresult td { padding: 22px 16px; text-align: center; color: var(--text-tertiary); font-size: 13.5px; }

@media (max-width: 560px) {
    .conv-toolbar { flex-direction: column; align-items: stretch; }
    .conv-filter .select, .conv-toolbar .search-box { width: 100%; min-width: 0; }
}

/* ------------------------------------------- Photos exemples de clés (Bot) */
.cle-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.cle-photo { display: flex; flex-direction: column; gap: 8px; }
.cle-photo__preview {
    height: 130px; border: 1px solid var(--border); border-radius: var(--radius);
    background: #FAFBFC; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.cle-photo__preview img { width: 100%; height: 100%; object-fit: contain; }
.cle-photo__empty { font-size: 12.5px; color: var(--text-tertiary); }
.cle-photo__label { font-size: 13px; font-weight: 600; }
.cle-photo .input { width: 100%; min-width: 0; font-size: 12.5px; padding: 6px 8px; }
@media (max-width: 560px) { .cle-photos { grid-template-columns: 1fr; } }

/* ------------------------------------------------- Catalogue de prix */
#catalog { display: flex; flex-direction: column; gap: 16px; max-width: 820px; }
.cat-block {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-card); box-shadow: var(--shadow-sm); padding: 16px 18px;
}
.cat-head { display: flex; align-items: center; gap: 10px; }
.cat-block.is-collapsed .cat-head { margin-bottom: 0; }
.cat-toggle { flex-shrink: 0; width: 28px; height: 28px; border: 0; background: none; cursor: pointer; color: var(--text-secondary); font-size: 12px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }
.cat-toggle:hover { background: rgba(16,24,40,.05); color: var(--text); }
.cat-chevron { line-height: 1; }
.cat-head .cat-icon { width: 52px; min-width: 0; text-align: center; font-size: 18px; }
.cat-head .cat-name { flex: 1; min-width: 0; font-weight: 600; }
.cat-count { flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--text-tertiary); background: rgba(16,24,40,.05); padding: 3px 9px; border-radius: var(--radius-pill); white-space: nowrap; }
.cat-head .cat-del { color: #B91C1C; flex-shrink: 0; }
.cat-head .cat-del:hover { background: #FEF2F2; color: #991B1B; }
.cat-body { margin-top: 14px; }
.cat-body[hidden] { display: none; }
.cat-items { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.item-row { display: grid; grid-template-columns: 1.4fr 0.8fr 0.8fr 1.3fr 34px; gap: 8px; align-items: center; }
.item-row .input { width: 100%; min-width: 0; font-size: 12.5px; padding: 7px 9px; }
.item-row .item-del { color: #B91C1C; padding: 6px 8px; }
.item-row .item-del:hover { background: #FEF2F2; color: #991B1B; }
.catalog-actions { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 820px; margin-top: 18px; }
@media (max-width: 720px) {
    .item-row { grid-template-columns: 1fr 1fr; }
    .item-row .item-del { grid-column: 2; justify-self: end; }
    .cat-count { display: none; }
}

/* ------------------------------------------- Réponses-types « / » (inbox) */
.qr-wrap { position: relative; flex: 1; min-width: 0; }
.qr-wrap input[type="text"] { width: 100%; }
/* Saisie multi-lignes (auto-extensible) : un modèle long reste lisible. */
#inbox-msg {
    width: 100%; min-width: 0; box-sizing: border-box; display: block;
    border: 1px solid var(--border-strong); border-radius: 18px;
    padding: 9px 14px; font: inherit; line-height: 1.4; background: #fff;
    resize: none; max-height: 160px; overflow-y: auto;
}
#inbox-msg:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,128,105,.14); }
.qr-dropdown {
    position: absolute; bottom: calc(100% + 8px); left: 0; right: 0; z-index: 60;
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius); box-shadow: var(--shadow-md);
    max-height: 280px; overflow-y: auto; padding: 4px;
}
.qr-dropdown[hidden] { display: none; }
.qr-item {
    display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left;
    padding: 8px 10px; border: 0; background: none; border-radius: var(--radius-sm);
    cursor: pointer; font: inherit;
}
.qr-item:hover, .qr-item.is-active { background: var(--accent-soft); }
.qr-title { font-size: 12.5px; font-weight: 700; color: var(--accent); }
.qr-body { font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------- Sélecteur de couleur (Paramètres) */
.swatches { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.swatch { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 0; height: 0; }
.swatch__dot {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--sw, #fff);
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px var(--border-strong);
    transition: transform .1s ease, box-shadow .12s ease;
}
.swatch:hover .swatch__dot { transform: scale(1.12); }
.swatch input:checked + .swatch__dot {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--sw, var(--accent));
    transform: scale(1.12);
}
.swatch input:focus-visible + .swatch__dot { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--sw, var(--accent)); }
/* Pastille « Auto » : damier neutre + libellé */
.swatch--auto { gap: 6px; }
.swatch--auto .swatch__dot {
    background:
        linear-gradient(135deg, #E7F4F0 0 50%, #EFF4FF 50% 100%);
    border-style: dashed; border-color: var(--text-tertiary);
    box-shadow: none;
}
.swatch--auto input:checked + .swatch__dot { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.swatch__txt { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.settings-row__field--color { flex: 1 1 260px; }
.settings-row__field--color label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
