/* =====================================================================
   Support WhatsApp — dashboard
   Clair et calme par défaut, sombre automatiquement.
   Couleurs à sens unique :
     lagon   = actions, nouveaux messages
     feuille = « à moi »
     safran  = rappels
     braise  = client sans réponse (le seul rouge de l'interface)
   ===================================================================== */

:root {
    --paper: #F3F5F2;
    --paper-2: #E9EDE8;
    --surface: #FFFFFF;
    --ink: #18212B;
    --muted: #5E6A75;
    --line: #DCE1DA;
    --line-strong: #C7CEC5;

    --lagoon: #0E2E66;
    --lagoon-hover: #0A2350;
    --lagoon-tint: #E3E9F5;
    --lagoon-ink: #0A2350;
    --on-lagoon: #FFFFFF;

    --leaf: #128A02;
    --leaf-tint: #DFF5D8;

    --saffron: #B87A00;
    --saffron-tint: #FDF0D2;
    --saffron-ink: #6E4A00;

    --ember: #D2342A;
    --ember-tint: #FBE4E1;
    --ember-ink: #8E1E16;

    --bubble-in: #FFFFFF;
    --bubble-agent: #E3E9F5;
    --bubble-bot: #ECEFEA;

    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;

    --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --sidebar-w: 248px;
    --tabbar-h: 64px;

    /* Anciens noms (styles en ligne des pages existantes) */
    --text: var(--ink);
    --text-muted: var(--muted);
    --primary: var(--lagoon);
    --primary-hover: var(--lagoon-hover);
    --bg: var(--paper);
    --border: var(--line);
    --surface-hover: var(--paper-2);
    --success: var(--leaf);
    --danger: var(--ember);
    --warning: var(--saffron);
    --radius: var(--r-md);

    color-scheme: light;
}

/* Sombre : choisi par l'agent (data-theme="dark")… */
:root[data-theme="dark"] {
    --paper: #151B21;
    --paper-2: #1C242C;
    --surface: #1E262E;
    --ink: #E7ECEF;
    --muted: #9AA6B0;
    --line: #2C3741;
    --line-strong: #3A4752;

    --lagoon: #7EA2F0;
    --lagoon-hover: #9DB9F5;
    --lagoon-tint: #18264A;
    --lagoon-ink: #BCD0FA;
    --on-lagoon: #061335;

    --leaf: #4CD13A;
    --leaf-tint: #15331A;

    --saffron: #E7B341;
    --saffron-tint: #3A2E12;
    --saffron-ink: #F3D58F;

    --ember: #FF5A4E;
    --ember-tint: #3E1C1A;
    --ember-ink: #FFB4AD;

    --bubble-in: #26313A;
    --bubble-agent: #18414F;
    --bubble-bot: #222B33;

    color-scheme: dark;
}

/* …ou automatique, selon le réglage du téléphone / de l'ordinateur. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper: #151B21;
        --paper-2: #1C242C;
        --surface: #1E262E;
        --ink: #E7ECEF;
        --muted: #9AA6B0;
        --line: #2C3741;
        --line-strong: #3A4752;

        --lagoon: #7EA2F0;
        --lagoon-hover: #9DB9F5;
        --lagoon-tint: #18264A;
        --lagoon-ink: #BCD0FA;
        --on-lagoon: #061335;

        --leaf: #4CD13A;
        --leaf-tint: #15331A;

        --saffron: #E7B341;
        --saffron-tint: #3A2E12;
        --saffron-ink: #F3D58F;

        --ember: #FF5A4E;
        --ember-tint: #3E1C1A;
        --ember-ink: #FFB4AD;

        --bubble-in: #26313A;
        --bubble-agent: #18414F;
        --bubble-bot: #222B33;

        color-scheme: dark;
    }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
    font-family: var(--font);
    font-size: 0.9375rem; /* 15 px, suit la taille du texte choisie */
    line-height: 1.5;
    background: var(--paper);
    color: var(--ink);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--lagoon); }
a:hover { color: var(--lagoon-hover); }
strong { font-weight: 700; }
code { font-size: 0.85em; background: var(--paper-2); padding: 1px 5px; border-radius: 4px; }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--lagoon) 55%, transparent); outline-offset: 2px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.hint { font-size: 0.82rem; color: var(--muted); }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */

.layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

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

/* ---------- Sidebar (ordinateur) ---------- */

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px 14px;
    background: var(--surface);
    border-right: 1px solid var(--line);
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 18px;
    font-weight: 700;
    font-size: 1.05rem;
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: var(--r-md);
    background: var(--lagoon-tint);
    font-size: 1.1rem;
}

.nav-primary, .nav-secondary { display: flex; flex-direction: column; gap: 2px; }

.nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: var(--r-md);
    color: var(--muted);
    text-decoration: none;
    font-size: 0.95rem;
}
.nav-link:hover { background: var(--paper); color: var(--ink); }
.nav-link.active { background: var(--lagoon-tint); color: var(--lagoon-ink); font-weight: 700; }
.label-short { display: none; }
.nav-icon { width: 22px; text-align: center; font-size: 1.05rem; line-height: 1; }
.nav-label { flex: 1; }

.nav-count {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    color: var(--on-lagoon);
    background: var(--lagoon);
}
.nav-count-due { background: var(--saffron); color: #fff; }
.nav-count-late { background: var(--ember); color: #fff; }
.nav-count-mine { background: transparent; color: var(--muted); border: 1px solid var(--line-strong); }

.nav-more { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); flex: 1; display: flex; flex-direction: column; }
.nav-more > summary { list-style: none; }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more-toggle { display: none; }
.nav-more-panel { display: flex; flex-direction: column; justify-content: space-between; flex: 1; gap: 16px; }

.me {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 4px 10px;
    padding: 12px;
    border-radius: var(--r-md);
    background: var(--paper);
}
.me form { grid-column: 1 / -1; }
.me .btn { width: 100%; }
.me-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.me-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { font-size: 0.8rem; color: var(--muted); }

/* ---------- Titres ---------- */

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}
.page-title {
    font-size: 1.65rem;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: 20px;
}
.page-head .page-title { margin-bottom: 0; }
.section-title { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }

/* ---------- Cartes ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 22px;
    margin-bottom: 20px;
    overflow-x: auto;
}
.card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 14px; }
.card-edit { border-color: var(--lagoon); box-shadow: 0 0 0 3px var(--lagoon-tint); }

/* ---------- Boutons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--r-md);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--lagoon); color: var(--on-lagoon); }
.btn-primary:hover { background: var(--lagoon-hover); color: var(--on-lagoon); }
.btn-outline { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--lagoon); color: var(--lagoon-ink); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); }
.btn-danger { background: var(--ember); color: #fff; }
.btn-danger:hover { background: var(--ember-ink); color: #fff; }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: 0.84rem; }

/* ---------- Formulaires ---------- */

.form-group { margin-bottom: 16px; }
.form-group label, .field-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.88rem;
    font-weight: 700;
}
.form-group .hint { margin-top: 6px; }

input[type="text"], input[type="password"], input[type="number"], input[type="url"], input[type="tel"],
input[type="search"], input[type="datetime-local"], input[type="email"], select, textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    color: var(--ink);
    font: inherit;
    font-size: 16px; /* évite le zoom automatique sur iPhone */
}
textarea { resize: vertical; min-height: 90px; line-height: 1.45; }
.textarea-large { min-height: 160px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--lagoon); box-shadow: 0 0 0 3px var(--lagoon-tint); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.8; }

.select-sm, .input-sm { min-height: 34px; padding: 5px 9px; font-size: 0.88rem; width: auto; }
.input-sm { width: 180px; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.toggle { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.form-group label.toggle { display: inline-flex; margin-bottom: 0; }
.toggle .slider { display: block; position: relative; width: 44px; height: 26px; background: var(--line-strong); border-radius: 999px; transition: background 0.2s; flex-shrink: 0; }
.toggle .slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: transform 0.2s; }
.toggle input:checked + .slider { background: var(--leaf); }
.toggle input:checked + .slider::after { transform: translateX(18px); }
.toggle input:focus-visible + .slider { outline: 3px solid var(--lagoon-tint); outline-offset: 2px; }
.toggle-label { cursor: pointer; }

/* ---------- Alertes ---------- */

.alert {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    border-radius: var(--r-md);
    font-size: 0.93rem;
    border: 1px solid transparent;
}
.alert-success { background: var(--leaf-tint); color: var(--leaf); border-color: color-mix(in srgb, var(--leaf) 30%, transparent); }
.alert-error { background: var(--ember-tint); color: var(--ember-ink); border-color: color-mix(in srgb, var(--ember) 30%, transparent); }
.alert-info { background: var(--lagoon-tint); color: var(--lagoon-ink); border-color: color-mix(in srgb, var(--lagoon) 30%, transparent); }
.alert-info a { color: inherit; font-weight: 700; }
.alert-grow { flex: 1; min-width: 200px; }
.alert-wait { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.alert-late { background: var(--ember-tint); color: var(--ember-ink); border-color: color-mix(in srgb, var(--ember) 40%, transparent); font-size: 1rem; }

/* ---------- Le rond rouge « client sans réponse » ---------- */

.late-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--ember);
    border: 2px solid var(--surface);
    animation: late-blink 1.4s ease-in-out infinite;
}
.late-dot-inline { position: relative; top: auto; right: auto; display: inline-block; width: 11px; height: 11px; border: 0; flex-shrink: 0; }

@keyframes late-blink {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 color-mix(in srgb, var(--ember) 60%, transparent); }
    50% { opacity: 0.35; box-shadow: 0 0 0 7px color-mix(in srgb, var(--ember) 0%, transparent); }
}

/* ---------- Avatars ---------- */

.avatar {
    position: relative;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: hsl(var(--hue, 200) 42% 86%);
    color: hsl(var(--hue, 200) 45% 25%);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}
.avatar-sm { width: 34px; height: 34px; font-size: 0.8rem; }
:root[data-theme="dark"] .avatar { background: hsl(var(--hue, 200) 30% 26%); color: hsl(var(--hue, 200) 50% 82%); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .avatar { background: hsl(var(--hue, 200) 30% 26%); color: hsl(var(--hue, 200) 50% 82%); }
}

/* ---------- Puces d'état ---------- */

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--r-sm);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
    background: var(--paper-2);
    color: var(--muted);
}
.chip-me { background: var(--leaf-tint); color: var(--leaf); }
.chip-owner { background: var(--paper-2); color: var(--ink); }
.chip-free { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong); }
.chip-bot, .chip-neutral { background: var(--paper-2); color: var(--muted); font-weight: 400; }
.chip-reminder { background: var(--saffron-tint); color: var(--saffron-ink); }
.chip-due { background: var(--saffron); color: #fff; }
.chip-late { background: var(--ember); color: #fff; }
.chip-wait { background: var(--ember-tint); color: var(--ember-ink); font-weight: 400; }

.count-pill { padding: 0 8px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; color: var(--on-lagoon); background: var(--lagoon); }
.count-due { background: var(--saffron); }

/* Anciens badges (pages Entraînement, Statistiques…) */
.badge { display: inline-block; padding: 2px 8px; border-radius: var(--r-sm); font-size: 0.76rem; font-weight: 700; background: var(--paper-2); color: var(--muted); }
.badge-in { background: var(--lagoon-tint); color: var(--lagoon-ink); }
.badge-out { background: var(--leaf-tint); color: var(--leaf); }
.badge-keyword { background: var(--saffron-tint); color: var(--saffron-ink); }
.badge-ai { background: color-mix(in srgb, #7A4FD1 16%, var(--surface)); color: color-mix(in srgb, #7A4FD1 80%, var(--ink)); }
.badge-default { background: var(--paper-2); color: var(--muted); }
.badge-human { background: var(--lagoon-tint); color: var(--lagoon-ink); }
.badge-new { background: var(--lagoon); color: var(--on-lagoon); margin-left: 6px; }
.badge-due { background: var(--saffron); color: #fff; }
.badge-reminder { background: var(--saffron-tint); color: var(--saffron-ink); }
.badge-assigned { background: var(--paper-2); color: var(--ink); }
.badge-assigned-me { background: var(--leaf-tint); color: var(--leaf); }
.badge-unassigned { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* ---------- Rappels (haut de la page Messages) ---------- */

.reminders-strip { margin-bottom: 18px; }
.reminders-empty { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.9rem; color: var(--muted); }
.reminders-empty a { font-weight: 700; }
.reminders-strip.has-due {
    padding: 16px 18px;
    border-radius: var(--r-lg);
    background: var(--saffron-tint);
    border: 1px solid color-mix(in srgb, var(--saffron) 45%, transparent);
}
.reminders-strip.has-due .section-title { color: var(--saffron-ink); margin-bottom: 8px; }
.reminder-list { list-style: none; display: flex; flex-direction: column; }
.reminder-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid color-mix(in srgb, var(--saffron) 25%, transparent);
}
.reminder-row:first-child { border-top: 0; }
.reminder-main { display: flex; flex-direction: column; min-width: 0; color: var(--ink); text-decoration: none; }
.reminder-main:hover .reminder-who { text-decoration: underline; }
.reminder-who { font-weight: 700; }
.reminder-note { color: var(--ink); }
.reminder-meta { font-size: 0.82rem; color: var(--muted); }

/* ---------- Boîte de réception ---------- */

.inbox-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.inbox-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: var(--r-md);
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
}
.tab:hover { background: var(--paper); color: var(--ink); }
.tab.active { background: var(--ink); color: var(--surface); }
.tab-count { font-size: 0.78rem; padding: 0 7px; border-radius: 999px; background: var(--ember); color: #fff; }
.tab-late:not(.active) { color: var(--ember-ink); }

.search { display: flex; gap: 8px; flex: 1; max-width: 420px; min-width: 240px; }
.search input { min-height: 40px; }

.inbox { list-style: none; }
.inbox li + li .inbox-item { border-top: 1px solid var(--line); }

.inbox-item {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    color: var(--ink);
    text-decoration: none;
}
.inbox-item:hover { background: var(--paper); color: var(--ink); }
.inbox-item::before {
    content: "";
    position: absolute;
    left: 0; top: 10px; bottom: 10px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: transparent;
}
.inbox-item.is-new::before { background: var(--lagoon); }
.inbox-item.is-due::before { background: var(--saffron); }
.inbox-item.is-late::before { background: var(--ember); }

.inbox-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.inbox-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.inbox-name { font-weight: 700; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-time { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.inbox-item.is-new .inbox-time { color: var(--lagoon); font-weight: 700; }
.inbox-preview {
    color: var(--muted);
    font-size: 0.92rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.inbox-item.is-new .inbox-preview { color: var(--ink); }
.preview-who { font-weight: 700; color: var(--muted); }
.inbox-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 3px; }

.unread-pill {
    display: grid;
    place-items: center;
    min-width: 24px;
    height: 24px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--lagoon);
    color: var(--on-lagoon);
    font-size: 0.8rem;
    font-weight: 700;
}

.empty-state { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty-state p + p { margin-top: 6px; }
.empty-state strong { color: var(--ink); }

.pagination { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px; border-top: 1px solid var(--line); }
.pagination-info { font-size: 0.88rem; color: var(--muted); }

/* ---------- Tableaux ---------- */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.82rem; font-weight: 700; color: var(--muted); background: var(--paper); }
tbody tr:hover td { background: var(--paper); }
table.history tbody tr { cursor: pointer; }
tr.row-new td { background: color-mix(in srgb, var(--lagoon-tint) 60%, transparent); font-weight: 700; }
.row-editing td { background: var(--lagoon-tint); }
.actions-cell { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kw-tag { display: inline-block; margin: 0 4px 4px 0; padding: 1px 7px; border-radius: var(--r-sm); background: var(--paper-2); font-size: 0.8rem; }

/* ---------- Conversation ---------- */

.conv-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}
.back {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--ink);
    text-decoration: none;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.back:hover { background: var(--paper-2); color: var(--ink); }
.conv-id { min-width: 0; }
.conv-name { font-size: 1.35rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.conv-phone { color: var(--muted); text-decoration: none; font-size: 0.88rem; margin-right: 4px; }
.conv-phone:hover { color: var(--lagoon); text-decoration: underline; }

.conv-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 20px;
    align-items: start;
}

.conv-chat {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
    height: calc(100vh - 170px);
    min-height: 420px;
}

.thread {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--paper);
    background-image: radial-gradient(color-mix(in srgb, var(--line) 70%, transparent) 1px, transparent 1px);
    background-size: 18px 18px;
}

.chat-line { display: flex; margin-bottom: 10px; }
.chat-in { justify-content: flex-start; }
.chat-out { justify-content: flex-end; }

.chat-bubble {
    max-width: min(78%, 560px);
    padding: 9px 13px 7px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    background: var(--bubble-in);
    box-shadow: 0 1px 0 var(--line);
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.chat-out .chat-bubble { border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
.chat-bubble.chat-human { background: var(--bubble-agent); }
.chat-bubble.chat-bot { background: var(--bubble-bot); box-shadow: inset 0 0 0 1px var(--line); }
.chat-sender { font-size: 0.78rem; font-weight: 700; color: var(--lagoon-ink); margin-bottom: 2px; }
.chat-bot .chat-sender { color: var(--muted); }
.chat-text { line-height: 1.45; }
.chat-time { margin-top: 3px; font-size: 0.74rem; color: var(--muted); text-align: right; }

.chat-bubble-new { box-shadow: 0 0 0 2px var(--lagoon); }

.chat-new-separator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0 14px;
    color: var(--lagoon);
    font-size: 0.8rem;
    font-weight: 700;
}
.chat-new-separator::before, .chat-new-separator::after { content: ""; flex: 1; height: 2px; border-radius: 2px; background: var(--lagoon); opacity: 0.45; }

.chat-event {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    width: fit-content;
    max-width: 85%;
    margin: 14px auto;
    padding: 6px 12px;
    border-radius: var(--r-md);
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--line);
    color: var(--muted);
    font-size: 0.82rem;
    text-align: center;
}
.chat-event-note { color: var(--ink); font-style: italic; }
.chat-event-time { font-size: 0.72rem; opacity: 0.85; }

.composer {
    padding: 12px 14px 10px;
    border-top: 1px solid var(--line);
    background: var(--surface);
}
.composer-form { display: flex; align-items: flex-end; gap: 10px; }
.composer-form textarea { min-height: 46px; max-height: 200px; resize: none; border-radius: 22px; padding: 11px 16px; }
.composer-form .btn { min-height: 46px; border-radius: 23px; padding: 0 20px; }
.composer-hint { margin-top: 6px; font-size: 0.78rem; color: var(--muted); padding-left: 16px; }
.composer-locked { padding: 6px 4px; color: var(--muted); }

.conv-side {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
}
.conv-side-toggle { display: none; }
.side-block { padding: 16px 18px; border-top: 1px solid var(--line); }
.side-block:first-of-type { border-top: 0; }
.side-block-due { background: var(--saffron-tint); }
.side-title { font-size: 0.95rem; font-weight: 700; margin-bottom: 8px; }
.side-text { font-size: 0.9rem; color: var(--muted); margin-bottom: 10px; }
.side-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.reminder-item { padding: 10px 0; border-top: 1px dashed var(--line-strong); }
.reminder-item:first-of-type { border-top: 0; padding-top: 0; }
.reminder-item .side-actions { margin-top: 8px; }
.reminder-when { font-weight: 700; }
.reminder-item.is-due .reminder-when { color: var(--saffron-ink); }

.reminder-add { margin-top: 10px; }
.reminder-add > summary { list-style: none; }
.reminder-add > summary::-webkit-details-marker { display: none; }
.reminder-add[open] > summary { display: none; }
.quick { display: flex; flex-wrap: wrap; gap: 4px; }
.quick .btn { box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--ink); }

/* ---------- Statistiques ---------- */

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; }
.stat-card .value { font-size: 2rem; font-weight: 700; line-height: 1.1; color: var(--lagoon-ink); font-variant-numeric: tabular-nums; }
.stat-card .label { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }

/* ---------- Nouveau message / modèles Meta ---------- */

.send-mode-options { display: flex; flex-direction: column; gap: 8px; }
.send-mode-option { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; font-size: 0.92rem; }
.send-mode-option:has(input:checked) { border-color: var(--lagoon); background: var(--lagoon-tint); }
.send-mode-option input { margin-top: 4px; }
.send-mode-panel { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.guide-preview-box { margin-bottom: 16px; padding: 16px; border-radius: var(--r-md); background: var(--lagoon-tint); }
.guide-preview-label { font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; }
.guide-preview-message { white-space: pre-wrap; word-wrap: break-word; line-height: 1.55; }
.tpl-preview-image { margin-bottom: 10px; }
.tpl-preview-image img { max-width: 100%; border-radius: var(--r-md); }
.tpl-header-image-advanced summary { cursor: pointer; color: var(--lagoon); font-size: 0.9rem; }
.template-preview-live { font-style: italic; }
.template-json-preview, .template-meta-guide { margin-top: 14px; }
.template-json-preview summary, .template-meta-guide summary { cursor: pointer; color: var(--lagoon); font-size: 0.9rem; }
.template-json-pre { margin-top: 10px; padding: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); font-size: 0.8rem; white-space: pre-wrap; word-break: break-word; overflow-x: auto; }
.guide-simple-card { border-color: color-mix(in srgb, var(--leaf) 45%, transparent); }
.guide-step { display: flex; gap: 14px; margin-bottom: 16px; }
.guide-step-num { flex-shrink: 0; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--lagoon); color: #fff; font-weight: 700; }
.meta-template-list { padding-left: 20px; font-size: 0.9rem; color: var(--muted); line-height: 1.7; }
.guide-copy-box { margin-top: 10px; padding: 14px; background: var(--saffron-tint); border-radius: var(--r-md); white-space: pre-wrap; }

.test-result { margin-top: 16px; padding: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); }
.test-result-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 0.88rem; }
.test-result-body { white-space: pre-wrap; }

/* ---------- Agents ---------- */

.agent-create-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 14px; align-items: end; }
.agent-create-form .btn { margin-bottom: 16px; }

/* ---------- Connexion ---------- */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 400px; padding: 30px; }
.login-title { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; margin-bottom: 18px; }

/* =====================================================================
   Tablette : panneau de gestion sous le fil
   ===================================================================== */

@media (max-width: 960px) {
    .conv-grid { grid-template-columns: 1fr; }
    .conv-side { order: -1; }
    .conv-side-toggle {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 12px 16px;
        font-weight: 700;
        cursor: pointer;
        list-style: none;
    }
    .conv-side-toggle::-webkit-details-marker { display: none; }
    .conv-side-toggle::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform 0.15s; }
    .conv-side[open] .conv-side-toggle::after { transform: rotate(180deg); }
    .conv-side[open] .side-block:first-of-type { border-top: 1px solid var(--line); }
}

/* =====================================================================
   Téléphone
   ===================================================================== */

@media (max-width: 760px) {
    body { font-size: 1rem; }
    .layout { display: block; }
    .main { padding: 16px 14px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); }

    /* La barre latérale devient une barre d'onglets en bas */
    .sidebar {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 50;
        height: auto;
        flex-direction: row;
        gap: 0;
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
        border-right: 0;
        border-top: 1px solid var(--line);
        overflow: visible;
        box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.06);
    }
    .brand { display: none; }
    .nav-primary { flex-direction: row; flex: 4; gap: 0; }
    .nav-more { flex: 1; margin: 0; padding: 0; border: 0; position: static; }
    .nav-link {
        flex: 1;
        flex-direction: column;
        gap: 2px;
        padding: 6px 2px;
        font-size: 0.7rem;
        text-align: center;
        border-radius: var(--r-md);
    }
    .nav-link.active { background: transparent; color: var(--lagoon); }
    .nav-icon { font-size: 1.25rem; width: auto; }
    .nav-label { flex: none; line-height: 1.1; white-space: nowrap; }
    .label-long { display: none; }
    .label-short { display: inline; }
    .nav-count {
        position: absolute;
        top: 1px;
        left: calc(50% + 6px);
        min-width: 18px;
        padding: 0 5px;
        font-size: 0.68rem;
        line-height: 18px;
    }
    .nav-more-toggle { display: flex; cursor: pointer; }
    .nav-more-panel {
        position: absolute;
        right: 8px;
        bottom: calc(100% + 8px);
        width: min(300px, calc(100vw - 16px));
        padding: 10px;
        background: var(--surface);
        border: 1px solid var(--line);
        border-radius: var(--r-lg);
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
        /* Jamais plus haut que l'écran : sinon le haut (Pointage, Rappels, Clients…) sortait de l'écran sans défilement */
        max-height: calc(100vh - 96px - env(safe-area-inset-top, 0px));
        max-height: calc(100dvh - 96px - env(safe-area-inset-top, 0px));
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
    }
    .nav-more-panel .nav-link { flex-direction: row; font-size: 0.95rem; padding: 10px 12px; gap: 12px; text-align: left; }
    .nav-more-panel .nav-label { flex: 1; }

    .page-title { font-size: 1.4rem; }
    .page-head .btn { padding: 8px 12px; }
    .card { padding: 16px; border-radius: var(--r-md); }

    .inbox-panel { margin: 0 -14px; border-radius: 0; border-left: 0; border-right: 0; }
    .inbox-toolbar { padding: 10px 12px; }
    .search { max-width: none; min-width: 0; width: 100%; }
    .search .btn-outline { display: none; }
    .inbox-item { padding: 12px 14px; gap: 12px; }
    .reminders-strip.has-due { margin: 0 -14px 16px; border-radius: 0; border-left: 0; border-right: 0; }
    .reminder-row { flex-wrap: wrap; }

    /* Conversation plein écran, comme une messagerie */
    body.is-conv .sidebar { display: none; }
    body.is-conv .main { padding: 0; }
    .conv-head {
        position: sticky;
        top: 0;
        z-index: 20;
        margin: 0;
        padding: 8px 10px;
        padding-top: calc(8px + env(safe-area-inset-top));
        gap: 10px;
        background: var(--surface);
        border-bottom: 1px solid var(--line);
    }
    .conv-head .avatar { width: 40px; height: 40px; font-size: 0.85rem; }
    .conv-name { font-size: 1.05rem; }
    .conv .alert { margin: 8px 10px 0; }
    .conv-grid { gap: 0; }
    .conv-side { border-radius: 0; border-left: 0; border-right: 0; border-top: 0; }
    .conv-chat { height: auto; min-height: 0; border: 0; border-radius: 0; overflow: visible; }
    .thread { overflow: visible; padding: 14px 10px; min-height: 50vh; }
    .chat-bubble { max-width: 86%; }
    .composer {
        position: sticky;
        bottom: 0;
        z-index: 20;
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    }
    .composer-hint { display: none; }

    th, td { padding: 9px 10px; }
    .input-sm { width: 140px; }
}

/* ---------- Mouvement réduit ---------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
    .late-dot { animation: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ember) 35%, transparent); }
}

/* ---------- Alerte sonore ---------- */

.sound-toggle { grid-column: 1 / -1; width: 100%; }
.sound-toast {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    max-width: calc(100vw - 24px);
    padding: 12px 18px;
    border-radius: 999px;
    background: var(--ink);
    color: var(--surface);
    font-weight: 700;
    font-size: 0.92rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    text-align: center;
}

/* ---------- Notifications push ---------- */

.push-promo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border-radius: var(--r-lg);
    background: var(--lagoon-tint);
    color: var(--lagoon-ink);
}
.push-promo-icon { font-size: 1.6rem; }
.push-promo-text { display: flex; flex-direction: column; flex: 1; min-width: 200px; line-height: 1.35; }
.push-promo-text span { font-size: 0.88rem; }

.push-dialog {
    width: min(460px, calc(100vw - 24px));
    margin: auto;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}
.push-dialog::backdrop { background: rgba(10, 16, 22, 0.45); }
.push-dialog h2 { font-size: 1.2rem; margin-bottom: 8px; padding-right: 36px; }
.push-dialog p { margin-bottom: 10px; }
.push-close-form { position: absolute; top: 12px; right: 12px; }
.push-intro { color: var(--muted); }
.push-steps { margin: 0 0 12px 20px; display: flex; flex-direction: column; gap: 6px; }
.push-big { width: 100%; min-height: 48px; font-size: 1rem; margin-bottom: 8px; }
.push-ok { font-weight: 700; color: var(--leaf); }
.push-status { margin-top: 12px; font-size: 0.9rem; color: var(--lagoon-ink); min-height: 1.2em; }

/* ---------- Choix du thème ---------- */

.theme-switch {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    padding: 3px;
    border-radius: var(--r-md);
    background: var(--paper-2);
}
.theme-switch button {
    min-height: 32px;
    padding: 4px 2px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 0.76rem;
    white-space: nowrap;
    font-weight: 700;
    cursor: pointer;
}
.theme-switch button:hover { color: var(--ink); }
.theme-switch button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
.theme-label { grid-column: 1 / -1; font-size: 0.75rem; color: var(--muted); margin-top: 4px; }

/* ---------- Demandes « parler à un agent » (couleur dédiée : iris) ---------- */

:root { --iris: #5B3FD0; --iris-tint: #ECE7FD; --iris-ink: #3A2593; }
:root[data-theme="dark"] { --iris: #A794FF; --iris-tint: #2A2350; --iris-ink: #D4CBFF; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { --iris: #A794FF; --iris-tint: #2A2350; --iris-ink: #D4CBFF; }
}

.requests-strip {
    padding: 16px 18px;
    margin-bottom: 16px;
    border-radius: var(--r-lg);
    background: var(--iris-tint);
    border: 1px solid color-mix(in srgb, var(--iris) 45%, transparent);
}
.requests-strip .section-title { color: var(--iris-ink); margin-bottom: 8px; }
.requests-strip .reminder-row { border-top-color: color-mix(in srgb, var(--iris) 25%, transparent); }
.requests-strip .reminder-row:first-child { border-top: 0; }
.count-request { background: var(--iris); color: var(--surface); }
.btn-request { background: var(--iris); color: var(--surface); }
.btn-request:hover { background: var(--iris-ink); color: var(--surface); }
.chip-request { background: var(--iris); color: var(--surface); }
.inbox-item.is-request::before { background: var(--iris); }
.alert-request { background: var(--iris-tint); color: var(--iris-ink); border-color: color-mix(in srgb, var(--iris) 40%, transparent); }
@media (max-width: 760px) {
    .requests-strip { margin: 0 -14px 16px; border-radius: 0; border-left: 0; border-right: 0; }
}

/* ---------- Photos, vocaux, vidéos, documents ---------- */

.chat-bubble-media { padding: 5px 5px 7px; }
.chat-bubble-media .chat-text, .chat-bubble-media .chat-time { padding: 0 8px; }
.chat-bubble-media .chat-text { margin-top: 6px; }
.chat-media + .chat-media { margin-top: 5px; }
.chat-media-link { display: block; line-height: 0; }
.chat-media-img {
    display: block;
    max-width: min(300px, 100%);
    max-height: 360px;
    width: auto;
    height: auto;
    border-radius: 10px;
    background: var(--paper-2);
    cursor: zoom-in;
}
.chat-media-audio { display: block; width: min(280px, 72vw); height: 40px; }
.chat-media-video { display: block; max-width: min(320px, 100%); max-height: 360px; border-radius: 10px; background: #000; }
.media-dl { display: inline-block; margin: 4px 8px 0; font-size: 0.78rem; }
.chat-doc {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--paper);
    color: var(--ink);
    text-decoration: none;
}
.chat-doc:hover { background: var(--paper-2); color: var(--ink); }
.chat-doc-icon { font-size: 1.6rem; }
.chat-doc-text { display: flex; flex-direction: column; min-width: 0; }
.chat-doc-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.chat-doc-meta { font-size: 0.78rem; color: var(--lagoon); }
.media-state { padding: 6px 8px; font-size: 0.85rem; color: var(--muted); font-style: italic; }
.media-error { color: var(--ember-ink); font-style: normal; }
.media-err-detail { font-size: 0.75rem; opacity: 0.8; }
.media-retry { margin-top: 6px; }

.lightbox {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(8, 12, 16, 0.94);
    display: none;
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: rgba(8, 12, 16, 0.94); }
.lightbox img { max-width: 96vw; max-height: 86vh; object-fit: contain; border-radius: 6px; }
.lightbox-close {
    position: fixed;
    top: calc(12px + env(safe-area-inset-top));
    right: 14px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
}
.lightbox-dl { position: fixed; bottom: calc(18px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); }

/* ---------- Appels WhatsApp (PBX) ---------- */

.calls-status { display: flex; flex-direction: column; gap: 8px; }
.calls-status > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.calls-host-form { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: flex-end; }
.calls-host-form .form-group:first-of-type { flex: 1; min-width: 240px; }
.calls-host-form .btn { margin-bottom: 16px; }
.code-box { position: relative; margin: 10px 0 14px; }
.code-box pre {
    padding: 14px;
    padding-top: 40px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre;
}
.code-copy { position: absolute; top: 8px; right: 8px; }
.calls-guide summary { cursor: pointer; font-weight: 700; color: var(--lagoon); }
.calls-guide ol { margin: 12px 0 0 20px; display: flex; flex-direction: column; gap: 10px; font-size: 0.92rem; }
.card code { word-break: break-all; }

.dial-hint { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.05rem; color: var(--ink); letter-spacing: 0.02em; }

/* ---------- Blocage / suppression ---------- */
.side-block-danger { background: color-mix(in srgb, var(--ember-tint) 45%, transparent); }
.btn-danger-outline { color: var(--ember-ink); border-color: color-mix(in srgb, var(--ember) 50%, transparent); }
.btn-danger-outline:hover { background: var(--ember-tint); color: var(--ember-ink); border-color: var(--ember); }
.toggle-inline { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; cursor: pointer; }
.chip-blocked { background: var(--ember-tint); color: var(--ember-ink); }

/* ---------- Rapports agents ---------- */
.report-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 14px; }
.report-filters .form-group { min-width: 160px; }
.report-filters > .btn { margin-bottom: 16px; }
.report-presets { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1.15; color: var(--lagoon-ink); font-variant-numeric: tabular-nums; }
.kpi-label { font-size: 0.85rem; color: var(--muted); line-height: 1.35; }
.kpi-warn { border-color: color-mix(in srgb, var(--ember) 50%, transparent); }
.kpi-warn .kpi-value { color: var(--ember-ink); }
.th-sub { font-size: 0.75rem; font-weight: 400; color: var(--muted); }
.report-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-agent-name { font-size: 1.25rem; margin: 0 0 12px; }
.report-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 0 20px; }
.report-chart { width: 100%; height: auto; display: block; }
.report-chart rect { fill: var(--lagoon); }
.report-chart rect:hover { fill: var(--lagoon-hover); }
.report-chart .grid { stroke: var(--line); stroke-width: 1; }
.report-chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.report-defs summary { cursor: pointer; font-weight: 700; color: var(--lagoon); }
.report-defs ul { margin: 12px 0 0 20px; display: flex; flex-direction: column; gap: 8px; font-size: 0.9rem; }

/* ---------- Plateforme multi-entreprises ---------- */
.pf-shell { min-height: 100vh; }
.pf-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.pf-main { max-width: 1200px; margin: 0 auto; padding: 24px; }
.pf-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pf-actions form { margin: 0; }
.pf-test { background: var(--sand-tint, var(--surface-2)); font-size: 0.9rem; line-height: 1.6; }
.pf-section { margin: 18px 0 8px; font-size: 1rem; color: var(--lagoon-ink); }
.pf-summary { cursor: pointer; font-weight: 700; font-size: 1.05rem; }
.pf-advanced { margin: 14px 0; }
.pf-advanced summary { cursor: pointer; color: var(--lagoon); font-weight: 700; }
.pf-webhook { padding: 14px; margin-bottom: 16px; border-radius: var(--r-md); background: var(--lagoon-tint); display: flex; flex-direction: column; gap: 8px; }
.pf-copy { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.pf-copy span { font-size: 0.85rem; color: var(--muted); min-width: 150px; }
.pf-copy code { font-size: 0.85rem; word-break: break-all; user-select: all; }
.pf-admins { margin: 10px 0 16px 20px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; align-items: start; }
.tenant-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; margin-bottom: 16px;
    border-radius: var(--r-md); background: var(--sand-tint, var(--lagoon-tint)); border: 1px solid var(--line); font-size: 0.92rem; }
.tenant-banner form { margin: 0; }

/* ---------- Graphiques des rapports ---------- */
:root {
    --c-bar-top: #1f8a9e; --c-bar-bot: #0f5f70;
    --c-line: #e0952b; --c-area-top: rgba(224, 149, 43, .32); --c-area-bot: rgba(224, 149, 43, 0);
    --c-warm: #d4572a; --c-warm-top: rgba(212, 87, 42, .22); --c-warm-bot: rgba(212, 87, 42, 0);
    --seg0: #1f9e7a; --seg1: #4fb59a; --seg2: #9fcf6a; --seg3: #e8b839; --seg4: #e8872b; --seg5: #d24c3a;
    --hm0: #eef1ec; --hm1: #cfe8e6; --hm2: #9dd2cf; --hm3: #5fb2b3; --hm4: #2c8a96; --hm5: #0f5f70;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { --hm0: #232a2c; --hm1: #1f3d42; --hm2: #22585f; --hm3: #2a7480; --hm4: #3c95a1; --hm5: #6cc3cc;
        --c-bar-top: #3fb3c6; --c-bar-bot: #1d7d8f; }
}
:root[data-theme="dark"] { --hm0: #232a2c; --hm1: #1f3d42; --hm2: #22585f; --hm3: #2a7480; --hm4: #3c95a1; --hm5: #6cc3cc;
    --c-bar-top: #3fb3c6; --c-bar-bot: #1d7d8f; }

.rc-card { overflow: hidden; }
.rc-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 10px; }
.rc-head h3 { margin: 0; }
.rc { width: 100%; height: auto; display: block; overflow: visible; }
.rc-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.rc-axis { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.rc-axis-line { fill: var(--c-line); }
.g-bar-top { stop-color: var(--c-bar-top); } .g-bar-bot { stop-color: var(--c-bar-bot); }
.g-area-top { stop-color: var(--c-area-top); } .g-area-bot { stop-color: var(--c-area-bot); }
.g-warm-top { stop-color: var(--c-warm-top); } .g-warm-bot { stop-color: var(--c-warm-bot); }
.rc-bar { transition: opacity .15s; cursor: pointer; }
.rc-bar:hover { opacity: .78; }
.rc-line { fill: none; stroke: var(--c-line); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.rc-line-warm { stroke: var(--lagoon); }
.rc-dot { fill: var(--surface); stroke: var(--c-line); stroke-width: 2; cursor: pointer; transition: r .15s; }
.rc-dot:hover { r: 6; }
.rc-dot-warm { stroke: var(--lagoon); }
.rc-dot-late { stroke: var(--c-warm); fill: var(--c-warm); }
.rc-threshold { stroke: var(--c-warm); stroke-width: 1.5; stroke-dasharray: 6 5; }
.rc-threshold-label { fill: var(--c-warm); font-size: 11px; font-weight: 700; font-family: var(--font); }
.rc-empty { fill: var(--muted); font-size: 13px; font-family: var(--font); }
.rc-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 0.85rem; color: var(--muted); }
.rc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rc-legend i { display: inline-block; width: 14px; height: 10px; border-radius: 3px; }
.rc-legend .lg-bar { background: linear-gradient(var(--c-bar-top), var(--c-bar-bot)); }
.rc-legend .lg-line { height: 3px; background: var(--c-line); }
.donut-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.donut-wrap .donut { width: 200px; flex: 0 0 auto; }
.donut .seg { cursor: pointer; transition: transform .15s; transform-origin: 110px 110px; }
.donut .seg:hover { transform: scale(1.04); }
.donut-empty { stroke: var(--line); }
.donut-total { font-size: 34px; font-weight: 700; fill: var(--ink); font-family: var(--font); }
.donut-sub { font-size: 12px; fill: var(--muted); font-family: var(--font); }
.donut-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; flex: 1 1 180px; font-size: 0.9rem; }
.donut-legend li { display: flex; align-items: center; gap: 8px; }
.donut-legend li span { flex: 1; }
.donut-legend i { width: 12px; height: 12px; border-radius: 4px; flex: 0 0 auto; }
.seg0 { fill: var(--seg0); background: var(--seg0); } .seg1 { fill: var(--seg1); background: var(--seg1); }
.seg2 { fill: var(--seg2); background: var(--seg2); } .seg3 { fill: var(--seg3); background: var(--seg3); }
.seg4 { fill: var(--seg4); background: var(--seg4); } .seg5 { fill: var(--seg5); background: var(--seg5); }
.heat .hm { cursor: pointer; transition: opacity .15s; } .heat .hm:hover { opacity: .7; }
.hm0 { fill: var(--hm0); background: var(--hm0); } .hm1 { fill: var(--hm1); background: var(--hm1); }
.hm2 { fill: var(--hm2); background: var(--hm2); } .hm3 { fill: var(--hm3); background: var(--hm3); }
.hm4 { fill: var(--hm4); background: var(--hm4); } .hm5 { fill: var(--hm5); background: var(--hm5); }
.heat-scale { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-top: 6px; font-size: 0.8rem; color: var(--muted); }
.heat-scale i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.heat-scale span { margin: 0 4px; }
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar-row { display: grid; grid-template-columns: minmax(70px, 120px) 1fr auto; align-items: center; gap: 10px; font-size: 0.9rem; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.hbar-track { height: 14px; border-radius: 99px; background: var(--hm0); overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--c-bar-bot), var(--c-bar-top)); min-width: 3px; }
.hbars-warm .hbar-fill { background: linear-gradient(90deg, var(--seg3), var(--seg4)); }
.hbars-sea .hbar-fill { background: linear-gradient(90deg, var(--seg0), var(--seg2)); }
.hbar-val { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.rc-tip { position: fixed; z-index: 60; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: var(--ink); color: var(--surface);
    font-size: 0.82rem; box-shadow: 0 6px 18px rgba(0,0,0,.18); max-width: 260px; }
.rc-row { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(380px, 1.7fr); gap: 0 20px; }
@media (max-width: 1000px) { .rc-row { grid-template-columns: 1fr; } }
.rc-row .donut-wrap { flex-direction: column; align-items: stretch; }
.rc-row .donut-wrap .donut { align-self: center; width: 190px; }

/* ---------- Alertes « crédit non reçu » ---------- */
:root { --credit: #d42e2e; --credit-ink: #a3191c; --credit-tint: #fdeaea; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --credit: #ff5a52; --credit-ink: #ff8a83; --credit-tint: #3a1a1a; } }
:root[data-theme="dark"] { --credit: #ff5a52; --credit-ink: #ff8a83; --credit-tint: #3a1a1a; }
.credit-strip { margin-bottom: 16px; padding: 14px 16px; border-radius: var(--r-lg); background: var(--credit-tint);
    border: 2px solid var(--credit); box-shadow: 0 0 0 4px color-mix(in srgb, var(--credit) 12%, transparent); }
.credit-strip .section-title { color: var(--credit-ink); display: flex; align-items: center; gap: 8px; }
.credit-strip-all { margin-left: auto; font-size: 0.85rem; font-weight: 700; color: var(--credit-ink); }
.credit-row .reminder-who { color: var(--credit-ink); }
.credit-new { animation: credit-pulse 1.6s ease-in-out infinite; border-radius: var(--r-md); }
@keyframes credit-pulse { 0%, 100% { background: transparent; } 50% { background: color-mix(in srgb, var(--credit) 14%, transparent); } }
@media (prefers-reduced-motion: reduce) { .credit-new { animation: none; } }
.count-credit { background: var(--credit); color: #fff; }
.nav-count-credit { background: var(--credit); color: #fff; animation: credit-pulse-badge 1.6s ease-in-out infinite; }
@keyframes credit-pulse-badge { 50% { transform: scale(1.12); } }
.btn-credit { background: var(--credit); color: #fff; border-color: var(--credit); }
.btn-credit:hover { background: var(--credit-ink); color: #fff; }
.ca-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ca-item { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; padding: 14px 16px;
    background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: var(--r-lg); }
.ca-new { border-left-color: var(--credit); background: color-mix(in srgb, var(--credit-tint) 70%, var(--surface)); }
.ca-in_progress { border-left-color: var(--sand, #e0a32b); }
.ca-credited { border-left-color: var(--lagoon); opacity: .92; }
.ca-rejected { border-left-color: var(--muted); opacity: .8; }
.ca-focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--credit) 35%, transparent); }
.ca-main { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ca-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.ca-merchant { font-size: 1.05rem; }
.ca-amount { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--credit-ink); }
.ca-credited .ca-amount, .ca-rejected .ca-amount { color: var(--ink); }
.ca-meta { font-size: 0.85rem; color: var(--muted); }
.ca-note { font-size: 0.9rem; }
.ca-method { background: var(--surface-2, #eef1ec); }
.ca-m-moncash { background: #fde7e7; color: #b3261e; } .ca-m-natcash { background: #e6f0fb; color: #1d5fa8; } .ca-m-kashpaw { background: #eaf6e8; color: #2b7a2b; }
.ca-s-new { background: var(--credit); color: #fff; } .ca-s-in_progress { background: #fbecc9; color: #8a5a00; }
.ca-s-credited { background: var(--lagoon-tint); color: var(--lagoon-ink); } .ca-s-rejected { background: var(--line); color: var(--muted); }
.ca-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ca-actions form { margin: 0; }
.ca-close { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ca-close input[type=text] { min-width: 200px; padding: 7px 10px; }
.ca-api-body { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.ca-key { font-size: 0.85rem; }
.ca-fields td, .ca-fields th { font-size: 0.88rem; }
.ca-code { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.ca-code-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 10px; background: var(--surface-2, var(--line)); font-size: 0.85rem; font-weight: 700; }
.ca-code pre { margin: 0; padding: 12px; overflow-x: auto; font-size: 0.82rem; line-height: 1.5; }
.ca-api-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.ca-api-actions form { margin: 0; }
.ca-api { margin-top: 20px; }
.ca-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.9rem; }
.ca-ref { font-size: 0.85rem; padding: 1px 6px; border-radius: 6px; background: var(--surface-2, var(--line)); user-select: all; }
.ca-search { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ca-search input[type=search] { flex: 1 1 280px; }

/* ---------- Messagerie interne (Équipe) ---------- */
.team-app { display: grid; grid-template-columns: 280px 1fr; gap: 0; height: calc(100vh - 48px); min-height: 480px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.team-list { border-right: 1px solid var(--line); overflow-y: auto; padding: 14px 8px; display: flex; flex-direction: column; gap: 2px; }
.team-list-title { padding: 0 8px 10px; font-size: 1.3rem; }
.team-sep { margin: 14px 10px 6px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.team-ch { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-md); color: var(--ink); text-decoration: none; }
.team-ch:hover { background: var(--surface-2, var(--lagoon-tint)); }
.team-ch.active { background: var(--lagoon-tint); }
.team-ch-name { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 700; font-size: 0.93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-ch-name small { font-weight: 400; font-size: 0.78rem; color: var(--muted); }
.team-av { position: relative; flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
    background: var(--lagoon-tint); color: var(--lagoon-ink); font-weight: 700; font-size: 0.85rem; }
.team-av-group { font-size: 1.1rem; }
.team-dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: var(--line); border: 2px solid var(--surface); }
.team-dot.on { background: #2fb36b; }
.team-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--lagoon); color: #fff; font-size: 0.75rem; font-weight: 700; display: grid; place-items: center; }
.team-thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.team-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.team-head div { display: flex; flex-direction: column; min-width: 0; }
.team-head-sub { font-size: 0.8rem; color: var(--muted); }
.team-back { display: none; font-size: 1.3rem; text-decoration: none; color: var(--ink); padding: 0 6px; }
.team-msgs { flex: 1; overflow-y: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 3px; background: var(--canvas, var(--bg)); }
.team-empty { margin: auto; color: var(--muted); text-align: center; }
.team-day { align-self: center; margin: 12px 0 6px; padding: 3px 12px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line);
    font-size: 0.78rem; color: var(--muted); text-transform: capitalize; }
.team-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: min(78%, 620px); margin-top: 8px; }
.team-msg.cont { margin-top: 0; }
.team-msg.mine { align-self: flex-end; align-items: flex-end; }
.team-who { font-size: 0.78rem; font-weight: 700; color: var(--lagoon-ink); margin: 0 0 2px 10px; }
.team-bubble { position: relative; padding: 8px 12px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line);
    word-wrap: break-word; overflow-wrap: anywhere; min-width: 70px; }
.team-msg.mine .team-bubble { background: var(--lagoon); color: #fff; border-color: var(--lagoon); }
.team-msg.mine .team-bubble a { color: #fff; }
.team-msg.mention-me .team-bubble { border: 2px solid var(--sand, #e0a32b); background: color-mix(in srgb, #e0a32b 12%, var(--surface)); }
.team-text { white-space: pre-wrap; line-height: 1.45; }
.team-mention { font-weight: 700; color: var(--lagoon-ink); }
.team-msg.mine .team-mention { color: #fff; text-decoration: underline; }
.team-time { position: absolute; right: 10px; bottom: 3px; font-size: 0.7rem; opacity: .65; }
.team-bubble.deleted { font-style: italic; color: var(--muted); background: transparent; border-style: dashed; }
.team-msg.mine .team-bubble.deleted { color: var(--muted); background: transparent; border-color: var(--line); }
.team-del { position: absolute; top: -10px; right: -8px; border: 1px solid var(--line); background: var(--surface); border-radius: 50%;
    width: 26px; height: 26px; font-size: 0.75rem; cursor: pointer; opacity: 0; transition: opacity .15s; }
.team-bubble:hover .team-del, .team-del:focus { opacity: 1; }
.team-ref { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; padding: 8px 10px; border-radius: 10px; text-decoration: none;
    background: color-mix(in srgb, var(--lagoon) 10%, var(--surface)); color: var(--ink); border: 1px solid var(--line); }
.team-ref span { font-size: 0.78rem; color: var(--muted); }
.team-msg.mine .team-ref { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.3); }
.team-msg.mine .team-ref span { color: rgba(255,255,255,.85); }
.team-composer { position: relative; display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.team-composer textarea { flex: 1; resize: none; min-height: 42px; max-height: 160px; }
.team-mention-pop { position: absolute; left: 12px; bottom: calc(100% + 4px); min-width: 260px; display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 8px 24px rgba(0,0,0,.14); overflow: hidden; z-index: 5; }
.team-mention-pop button { text-align: left; padding: 9px 12px; border: 0; background: transparent; cursor: pointer; font: inherit; color: var(--ink); }
.team-mention-pop button:hover, .team-mention-pop button:first-child { background: var(--lagoon-tint); }
.nav-count-team { background: var(--lagoon); color: #fff; }
@media (max-width: 760px) {
    .team-app { grid-template-columns: 1fr; height: calc(100dvh - 46px - env(safe-area-inset-bottom, 0px)); border-radius: 0; border-left: 0; border-right: 0; margin: -16px -16px 0; }
    .team-app.team-has-channel .team-list { display: none; }
    .team-app:not(.team-has-channel) .team-thread { display: none; }
    .team-back { display: block; }
    .team-msg { max-width: 88%; }
}

/* ---------- Statut des agents ---------- */
:root { --st-available: #2fb36b; --st-busy: #e8872b; --st-break: #b98a3c; --st-dnd: #d24c3a; --st-offline: #9aa3a0; }
.status-picker { width: 100%; margin: 6px 0 4px; }
.status-picker > summary { list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px;
    padding: 8px 10px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 0.88rem; }
.status-picker > summary::-webkit-details-marker { display: none; }
.status-picker > summary small { flex-basis: 100%; font-weight: 400; font-size: 0.78rem; color: var(--muted); }
.status-change { margin-left: auto; font-size: 0.75rem; font-weight: 400; color: var(--lagoon); }
.status-current.status-available { border-color: color-mix(in srgb, var(--st-available) 45%, var(--line)); }
.status-current.status-busy { border-color: color-mix(in srgb, var(--st-busy) 55%, var(--line)); }
.status-current.status-break { border-color: color-mix(in srgb, var(--st-break) 55%, var(--line)); }
.status-current.status-dnd { border-color: var(--st-dnd); background: color-mix(in srgb, var(--st-dnd) 10%, var(--surface)); }
.status-form { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.status-options { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.status-opt { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border: 1px solid var(--line); border-radius: var(--r-md);
    cursor: pointer; font-size: 0.85rem; background: var(--surface); }
.status-opt:has(input:checked) { border-color: var(--lagoon); background: var(--lagoon-tint); font-weight: 700; }
.status-opt input { margin: 0; accent-color: var(--lagoon); }
.status-form input[type=text], .status-form select { font-size: 0.88rem; padding: 7px 9px; }
.status-hint { font-size: 0.75rem; margin: 0; }
.status-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px;
    margin-bottom: 16px; border-radius: var(--r-md); font-size: 0.92rem; border: 1px solid var(--line); }
.status-banner form { margin: 0; }
.status-banner-dnd { background: color-mix(in srgb, var(--st-dnd) 12%, var(--surface)); border-color: color-mix(in srgb, var(--st-dnd) 45%, var(--line)); }
.status-banner-break { background: color-mix(in srgb, var(--st-break) 14%, var(--surface)); border-color: color-mix(in srgb, var(--st-break) 45%, var(--line)); }
/* Points de statut (page Équipe) */
.team-dot.s-available { background: var(--st-available); }
.team-dot.s-busy { background: var(--st-busy); }
.team-dot.s-break { background: var(--st-break); }
.team-dot.s-dnd { background: var(--st-dnd); }
.team-dot.s-offline { background: var(--st-offline); }
.team-peer-away { position: absolute; left: 12px; right: 12px; bottom: calc(100% + 2px); margin: 0; padding: 6px 10px; font-size: 0.8rem;
    border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.agent-status-chip { font-size: 0.8rem; white-space: nowrap; }
.me .status-picker { grid-column: 1 / -1; }
.status-options { grid-template-columns: 1fr; gap: 4px; }
.status-opt { padding: 6px 9px; }
.ca-cb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 0.83rem; }
.ca-cb form { margin: 0; }
.ca-cb-ok { color: var(--lagoon-ink); }
.ca-cb-wait { color: #8a5a00; }
.ca-cb-fail { color: var(--credit-ink); font-weight: 700; }
.ca-cb-none { color: var(--muted); }
.ca-cb-form { display: flex; flex-wrap: wrap; gap: 8px; }
.ca-cb-form input[type=url] { flex: 1 1 320px; }

/* ---------- Suivi de livraison des messages envoyés ---------- */
.chat-time-row { display: flex; justify-content: flex-end; align-items: center; gap: 4px; }
.chat-time-row .chat-time { margin: 0; }
.wa-tick { font-size: 0.75rem; letter-spacing: -2px; opacity: .7; }
.wa-tick.wa-read { color: #34b7f1; opacity: 1; font-weight: 700; }
.wa-tick.wa-failed { letter-spacing: 0; opacity: 1; }
.wa-fail-reason { margin-top: 6px; padding: 6px 8px; border-radius: 8px; font-size: 0.82rem; line-height: 1.35;
    background: color-mix(in srgb, var(--credit, #d42e2e) 12%, var(--surface)); color: var(--credit-ink, #a3191c); }

/* ---------- Appels entre agents ---------- */
.team-call-btns { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.team-head { flex-wrap: wrap; }
.team-call-mini { border: 0; background: transparent; font-size: 0.95rem; padding: 4px 6px; border-radius: 50%; cursor: pointer; opacity: 0; transition: opacity .15s; }
.team-ch:hover .team-call-mini, .team-call-mini:focus { opacity: .85; }
@media (hover: none) { .team-call-mini { opacity: .7; } }
.call-ui { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; width: min(420px, calc(100vw - 24px)); }
@media (max-width: 760px) { .call-ui { bottom: calc(70px + env(safe-area-inset-bottom)); } }
.call-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; background: #12262b; color: #fff;
    box-shadow: 0 14px 40px rgba(0,0,0,.35); }
.call-incoming .call-card { animation: call-pop .9s ease-in-out infinite alternate; }
@keyframes call-pop { to { box-shadow: 0 14px 40px rgba(0,0,0,.35), 0 0 0 6px rgba(47,179,107,.35); } }
@media (prefers-reduced-motion: reduce) { .call-incoming .call-card { animation: none; } }
.call-av { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: #2c8a96; font-weight: 700; }
.call-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.call-info strong { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-info span { font-size: 0.85rem; opacity: .8; font-variant-numeric: tabular-nums; }
.call-actions { display: flex; gap: 8px; }
.call-btn { width: 46px; height: 46px; border-radius: 50%; border: 0; font-size: 1.15rem; cursor: pointer; color: #fff; display: grid; place-items: center; }
.call-accept { background: #2fb36b; }
.call-hang { background: #d24c3a; font-weight: 700; }
.call-mute { background: rgba(255,255,255,.14); }
.call-mute.muted { background: #e8872b; }
.call-ended .call-card { background: #33393b; }
@media (min-width: 761px) { .call-ui { left: auto; right: 20px; top: 16px; bottom: auto; transform: none; } }


/* ---------- Taille du texte (réglage par appareil) ---------- */
html[data-text="l"] { font-size: 18px; }
html[data-text="xl"] { font-size: 20px; }
.text-switch button { font-weight: 700; line-height: 1; }

/* ---------- Ordinateur / téléphone ---------- */
.nav-mobile-only { display: none !important; }
@media (max-width: 760px) {
    /* Caractères plus gros sur téléphone */
    html { font-size: 18.5px; }
    html[data-text="l"] { font-size: 20px; }
    html[data-text="xl"] { font-size: 22px; }
    .nav-desktop-only { display: none !important; }
    .nav-mobile-only { display: flex !important; }
    /* Barre du bas : 5 grands onglets */
    .nav-link { font-size: 0.78rem; gap: 3px; padding: 7px 2px; }
    .nav-icon { font-size: 1.5rem; }
    .nav-count { font-size: 0.72rem; min-width: 20px; line-height: 20px; }
    .nav-link.mobile-active { color: var(--lagoon); font-weight: 700; }
    .nav-link.has-late .nav-icon { position: relative; }
    .nav-link.has-late .nav-icon::after { content: ""; position: absolute; top: -1px; left: -4px; width: 10px; height: 10px; border-radius: 50%;
        background: #d24c3a; border: 2px solid var(--surface); }
    /* Page Messages : gros onglets Toutes / En attente / À moi */
    .inbox-toolbar .tabs { flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .inbox-toolbar .tabs::-webkit-scrollbar { display: none; }
    .inbox-toolbar .tab { flex: 0 0 auto; font-size: 0.95rem; padding: 10px 14px; min-height: 42px; border-radius: 99px; display: inline-flex; align-items: center; gap: 6px; }
    .inbox-toolbar .tab-count { font-size: 0.78rem; }
    /* Éléments tactiles plus confortables */
    .btn { min-height: 40px; }
    .btn-sm { min-height: 34px; }
    input[type=text], input[type=search], input[type=password], input[type=url], select, textarea { font-size: 1rem; }
}
.mobile-filters { display: none; }
@media (max-width: 760px) {
    .mobile-filters { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 6px; margin: -4px 0 14px; padding-bottom: 4px; scrollbar-width: none; }
    .mobile-filters::-webkit-scrollbar { display: none; }
    .mobile-filters .tab { flex: 0 0 auto; font-size: 0.95rem; padding: 10px 14px; min-height: 42px; border-radius: 99px; display: inline-flex; align-items: center; gap: 6px; }
    .inbox-toolbar .tabs { display: none; }
    .strip-extra { display: none !important; }
    .strip-open .strip-extra { display: flex !important; }
    .strip-more { margin-top: 6px; width: 100%; }
    .page-head .btn-primary { font-size: 0.9rem; padding: 8px 12px; }
}

@media (max-width: 760px) {
    /* Barre du bas : libellés lisibles mais toujours sur une ligne, même sur petit écran */
    .nav-link { font-size: 0.74rem; }
    .nav-icon { font-size: 1.45rem; }
    .page-title { font-size: 1.45rem; }
}
@media (max-width: 380px) {
    .nav-link { font-size: 0.68rem; }
    .page-head .btn-primary { font-size: 0.85rem; padding: 7px 10px; }
}
.call-ico { width: 26px; height: 26px; display: block; }
.call-hang .call-ico { width: 28px; height: 28px; }
.call-btn { width: 52px; height: 52px; }

/* ---------- Modifier un agent ---------- */
.agent-edit-row td { background: var(--lagoon-tint); }
.agent-edit-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 14px; align-items: end; padding: 6px 2px; }
.agent-edit-form .form-group { margin-bottom: 10px; }
.agent-edit-actions { display: flex; gap: 8px; margin-bottom: 10px; }
.call-spk { background: rgba(255,255,255,.14); }
.call-spk.on { background: #2c8a96; }
.call-info small { font-size: 0.75rem; opacity: .75; line-height: 1.3; margin-top: 2px; }
@media (max-width: 760px) { .call-actions { gap: 6px; } .call-btn { width: 48px; height: 48px; } }

/* ---------- Téléphone intégré (mode téléphone) ---------- */
.sp-body { margin: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: var(--paper); }
.sp-bar { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 8px 12px; padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
    background: #12262b; color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.2); z-index: 5; }
.sp-status { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; color: #fff; font: inherit; font-size: 0.88rem; cursor: pointer; min-width: 0; }
.sp-status span { overflow: hidden; text-overflow: ellipsis; white-space: normal; max-width: 70vw; line-height: 1.25; font-size: 0.82rem; text-align: left; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.sp-dot { width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto; background: #9aa3a0; }
.sp-dot.sp-on { background: #2fb36b; box-shadow: 0 0 0 3px rgba(47,179,107,.25); }
.sp-dot.sp-wait { background: #e8b839; }
.sp-dot.sp-off { background: #d24c3a; }
.sp-call { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.2; }
.sp-call strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-call span { font-size: 0.82rem; opacity: .8; font-variant-numeric: tabular-nums; }
.sp-in-call .sp-status span { display: none; }
.sp-actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.sp-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 1.05rem; cursor: pointer; }
.sp-btn.on { background: #e8872b; }
.sp-bar .call-btn { width: 44px; height: 44px; }
.sp-ringing .sp-bar { animation: sp-ring 1s ease-in-out infinite alternate; }
@keyframes sp-ring { to { background: #1e5b3a; } }
@media (prefers-reduced-motion: reduce) { .sp-ringing .sp-bar { animation: none; background: #1e5b3a; } }
.sp-pad { position: absolute; right: 12px; top: calc(60px + env(safe-area-inset-top)); z-index: 6; width: min(300px, calc(100vw - 24px));
    background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.25); }
.sp-pad input[type=tel] { width: 100%; font-size: 1.3rem; text-align: center; letter-spacing: .04em; margin-bottom: 10px; }
.sp-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sp-keys button { height: 50px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-size: 1.3rem; font-weight: 700; cursor: pointer; }
.sp-keys button:active { background: var(--lagoon-tint); }
.sp-pad-actions { display: flex; gap: 8px; margin-top: 10px; }
.sp-pad-actions .btn-primary { flex: 1; }
.sp-pad .hint { margin: 8px 0 0; font-size: 0.75rem; }
.sp-frame { flex: 1; width: 100%; border: 0; display: block; }
/* Dans le cadre : pas de lien « Téléphone », bouton « Appeler » visible */
/* Mode téléphone : l'onglet 📞 reste en bas, avec un point vert quand le poste est connecté */
.in-phone [data-phone-link] .nav-icon { position: relative; }
.in-phone [data-phone-link].sp-reg .nav-icon::after { content: ""; position: absolute; right: -3px; bottom: 0; width: 10px; height: 10px;
    border-radius: 50%; background: #2fb36b; border: 2px solid var(--surface); }
.in-phone [data-phone-link].sp-pad-open { color: var(--lagoon); font-weight: 700; }
.sp-call-client { margin-left: 6px; }
/* Bouton invisible : la touche Entrée d'un formulaire enregistre */
.default-submit { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Mode téléphone : la page reste dans la zone visible (entre la barre d'état et les boutons Android/iPhone) */
html.sp-html { padding: 0 !important; height: 100%; overflow: hidden; }
html.sp-html .sp-body { position: fixed; top: 0; right: 0; bottom: 0; left: 0; height: auto; padding: 0 0 env(safe-area-inset-bottom, 0px); }
html.sp-html .sp-bar { padding-top: max(8px, env(safe-area-inset-top, 0px)); }
/* Fond sous la zone des boutons Android / de la barre de l'iPhone */
html.sp-html .sp-body { background: var(--surface); }
html.sp-html .sp-frame { min-height: 0; }

/* Clavier du téléphone : en bas de l'écran sur téléphone, au-dessus de la barre d'onglets */
.sp-pad-close { position: absolute; top: 8px; right: 10px; border: 0; background: transparent; font-size: 1.2rem; color: var(--muted); cursor: pointer; }
@media (max-width: 760px) {
    #sp-keypad-btn { display: none; }
    .sp-pad { top: auto; left: 0; right: 0; width: auto; bottom: calc(68px + env(safe-area-inset-bottom, 0px));
        border-radius: 18px 18px 0 0; padding: 18px 16px 12px; box-shadow: 0 -10px 30px rgba(0,0,0,.25);
        animation: sp-up .18s ease-out; }
    .sp-keys button { height: 56px; font-size: 1.45rem; }
}
@keyframes sp-up { from { transform: translateY(30px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sp-pad { animation: none; } }
.sp-pad { padding-top: 38px; }
.sp-pad-close { top: 6px; right: 8px; width: 32px; height: 32px; }

/* Mode téléphone : hauteur = zone réellement visible (mesurée en JavaScript) */
html.sp-html .sp-body { top: 0; bottom: auto; height: var(--sp-h, 100dvh); }

/* ---------- Mode téléphone : barre d'onglets dessinée par la page du téléphone ---------- */
.sp-tabs { display: none; }
@media (max-width: 760px) {
    .sp-tabs { flex: 0 0 auto; display: flex; background: var(--surface); border-top: 1px solid var(--line);
        box-shadow: 0 -4px 18px rgba(0,0,0,.06); padding: 4px 2px; z-index: 5; }
    .sp-tab { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px;
        border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.74rem; cursor: pointer; border-radius: 10px; }
    .sp-tab.on { color: var(--lagoon); font-weight: 700; }
    .sp-tab-ico { position: relative; font-size: 1.45rem; line-height: 1; }
    .sp-badge { position: absolute; top: 0; left: calc(50% + 6px); min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px;
        background: var(--lagoon); color: #fff; font-size: 0.7rem; line-height: 20px; font-weight: 700; }
    .sp-badge-red { background: #d42e2e; }
    .sp-late { position: absolute; top: 2px; left: calc(50% - 22px); width: 10px; height: 10px; border-radius: 50%; background: #d24c3a; border: 2px solid var(--surface); }
    .sp-tab-dot { position: absolute; right: -4px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--surface); background: #9aa3a0; }
    .sp-tab-dot.sp-on { background: #2fb36b; }
    .sp-tab-dot.sp-wait { background: #e8b839; }
    .sp-tab-dot.sp-off { background: #d24c3a; }
    /* Le dashboard dans le cadre n'affiche plus sa propre barre du bas */
    .in-phone .sidebar { background: transparent; border: 0; box-shadow: none; padding: 0; pointer-events: none; }
    .in-phone .sidebar .nav-primary, .in-phone .sidebar .nav-more-toggle { display: none !important; }
    .in-phone .sidebar .nav-more-panel { pointer-events: auto; max-height: calc(100vh - 20px); max-height: calc(100dvh - 20px); }
    .in-phone .main { padding-bottom: 24px; }
    /* Clavier juste au-dessus de la barre d'onglets */
    .sp-pad { bottom: calc(var(--sp-tabs-h, 64px) + env(safe-area-inset-bottom, 0px)); }
}

/* Mode téléphone (téléphone) : barre d'onglets fixée en bas, avec la marge des boutons
   Android / de l'iPhone — même méthode que la barre du bas du dashboard normal. */
@media (max-width: 760px) {
    html.sp-html .sp-body { top: 0; bottom: 0; height: auto; padding-bottom: var(--sp-tabs-h, 64px); }
    .sp-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
        padding: 4px 2px calc(4px + env(safe-area-inset-bottom, 0px)); }
    .sp-pad { bottom: calc(var(--sp-tabs-h, 64px) + 4px); }
}

/* Mode téléphone, clavier de l'iPhone ouvert : la page se limite à la zone au-dessus du clavier */
html.sp-html.sp-kb .sp-body { top: var(--sp-vtop, 0px); bottom: auto; height: var(--sp-vh, 100%); min-height: 0; padding-bottom: 0; }
html.sp-html.sp-kb .sp-tabs { display: none; }

/* Appuis rapides (ex. « 5000 ») : pas de zoom au double-tap sur iPhone. Le zoom à deux doigts reste possible. */
button, a, input[type=submit], [role=button], .sp-keys, .sp-tabs, .sp-bar, .call-ui { touch-action: manipulation; }
.sp-keys button { -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }

/* ---------- Conversations réglées ---------- */
.chip-closed { background: var(--lagoon-tint); color: var(--lagoon-ink); }
.closed-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.closed-banner form { margin: 0; }
.side-close { background: color-mix(in srgb, #2fb36b 8%, var(--surface)); border-radius: var(--r-md); }

/* ---------- Chat web ---------- */
.chip-web { background: #eaf1fb; color: #1d4f8a; }
.ws-card { border-top: 4px solid var(--ws, var(--lagoon)); }
.ws-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 6px; }
.ws-head h3 { margin: 0; }
.ws-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--ws, var(--lagoon)); }
.ws-preview { margin-left: auto; }
.ws-edit { margin-top: 10px; }
.ws-edit > summary { list-style: none; display: inline-flex; }
.ws-edit > summary::-webkit-details-marker { display: none; }
.ws-form { margin-top: 12px; }
.ws-form input[type=color] { height: 42px; padding: 2px; width: 80px; }
.ws-danger { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.ws-danger form { margin: 0; }

.wc-table td, .wc-table th { font-size: 0.88rem; }
.nowrap { white-space: nowrap; }

/* ---------- Réponses enregistrées ---------- */
.composer-form { position: relative; }
.cn-btn { flex: 0 0 auto; font-size: 1.1rem; }
.cn-pop { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 30; max-height: 320px; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: 4px; }
.cn-opt { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; width: 100%; text-align: left; border: 0; background: transparent;
    padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--ink); font: inherit; }
.cn-opt span { grid-column: 1 / -1; font-size: 0.82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cn-opt code { justify-self: end; font-size: 0.78rem; color: var(--lagoon-ink); }
.cn-opt.on, .cn-opt:hover { background: var(--lagoon-tint); }
.cn-empty { margin: 8px 10px; font-size: 0.88rem; color: var(--muted); }
.cn-card .cn-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cn-body { margin: 8px 0; white-space: pre-line; }
.cn-form { margin-top: 10px; }

.kpi-csat .kpi-value { color: #c98a0b; letter-spacing: .02em; }

.bh-table td, .bh-table th { padding: 6px 10px; }
.bh-table input[type=time] { padding: 6px 8px; }

/* ---------- Notes internes et étiquettes ---------- */
.chat-note { align-self: center; width: min(92%, 560px); margin: 8px 0; padding: 10px 12px; border-radius: 12px;
    background: #fff6d6; border: 1px dashed #e0b84a; color: #4a3b10; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chat-note { background: #3a3215; color: #f3e3b0; border-color: #8a7330; } }
:root[data-theme="dark"] .chat-note { background: #3a3215; color: #f3e3b0; border-color: #8a7330; }
.chat-note-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 0.82rem; }
.chat-note-head .hint { font-size: 0.75rem; }
.chat-note-del { margin: 0 0 0 auto; }
.chat-note-body { margin-top: 4px; white-space: pre-wrap; line-height: 1.45; }
.chat-note .chat-time { text-align: right; font-size: 0.72rem; opacity: .7; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag-chip { display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 3px 4px 3px 10px; border-radius: 99px;
    background: color-mix(in srgb, var(--tag) 16%, var(--surface)); color: color-mix(in srgb, var(--tag) 75%, var(--ink));
    border: 1px solid color-mix(in srgb, var(--tag) 40%, transparent); font-size: 0.82rem; font-weight: 700; }
.tag-chip button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 0.75rem; padding: 0 4px; opacity: .7; }
.tag-add { display: flex; gap: 6px; }
.tag-add input { flex: 1; min-width: 0; }
.tag-mini { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 0.72rem; font-weight: 700;
    background: color-mix(in srgb, var(--tag) 16%, var(--surface)); color: color-mix(in srgb, var(--tag) 75%, var(--ink)); }
.tag-filter { max-width: 220px; }

.tag-edit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.tag-edit input[type=text] { width: 180px; }
.tag-edit input[type=color] { width: 44px; height: 34px; padding: 2px; }

/* Heures mises en forme par le navigateur : invisibles tant qu'elles ne sont pas prêtes (pas de format brut) */
.js-time:not([data-ok]) { visibility: hidden; }
/* Action en cours d'envoi */
html.is-busy, html.is-busy * { cursor: progress; }

/* ---------- Fiche client ---------- */
.cu-grid { display: grid; grid-template-columns: minmax(280px, 1fr) 2fr; gap: 14px; align-items: start; margin-bottom: 10px; }
@media (max-width: 900px) { .cu-grid { grid-template-columns: 1fr; } }
.cu-id-head { display: flex; gap: 14px; align-items: flex-start; line-height: 1.7; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.4rem; flex: 0 0 auto; }
.cu-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.cu-kpis { margin: 0; }
.cu-results { padding: 4px; }
.cu-result { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; color: inherit; text-decoration: none; }
.cu-result:hover { background: var(--lagoon-tint); }
.cu-timeline h3 { margin-top: 0; }
.cu-item { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); align-items: start; }
.cu-item:first-of-type { border-top: 0; }
.cu-chan { font-size: 1.05rem; text-align: center; }
.cu-body { line-height: 1.45; overflow-wrap: anywhere; }
.cu-out .cu-body strong { color: var(--lagoon-ink); }
.cu-bot { margin-top: 4px; font-size: 0.88rem; color: var(--muted); }
.cu-note .cu-body { background: #fff6d6; color: #4a3b10; border-radius: 8px; padding: 6px 8px; }
.cu-time { font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.page-head.cu-head { justify-content: flex-start; gap: 8px; }

/* ---------- Assistant IA ---------- */
.ai-out { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--lagoon-tint); white-space: pre-wrap; line-height: 1.5; font-size: 0.92rem; }
.ai-out.ai-err { background: #fde8e8; color: #8a1c1c; }
#ai-sum-save { margin-top: 6px; }
textarea.ai-filled { box-shadow: 0 0 0 3px color-mix(in srgb, #8a5cd0 45%, transparent); transition: box-shadow .3s; }

.gap-list { display: flex; flex-direction: column; }
.gap-row { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.gap-row:first-child { border-top: 0; }
.gap-count { font-weight: 800; font-size: 1.1rem; color: var(--lagoon-ink); text-align: center; }
.gap-actions { display: flex; gap: 6px; align-items: center; }
.gap-actions form { margin: 0; }
@media (max-width: 760px) { .gap-row { grid-template-columns: 40px 1fr; } .gap-actions { grid-column: 2; } }

/* ---------- Supervision ---------- */
.sv-live { font-size: 0.8rem; color: #2fb36b; font-weight: 700; vertical-align: middle; margin-left: 6px; animation: sv-blink 2s infinite; }
@keyframes sv-blink { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .sv-live { animation: none; } }
.sv-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 10px; }
.sv-kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.sv-kpi .v { font-size: 2rem; font-weight: 800; line-height: 1.1; color: var(--ink); }
.sv-kpi .v small { font-size: 1rem; color: var(--muted); }
.sv-kpi .l { font-size: 0.85rem; color: var(--muted); }
.sv-kpi.warn { border-color: #e8b839; background: color-mix(in srgb, #e8b839 10%, var(--surface)); }
.sv-kpi.bad { border-color: #d24c3a; background: color-mix(in srgb, #d24c3a 10%, var(--surface)); }
.sv-kpi.bad .v { color: #b3261e; }
.sv-mini { font-size: 0.8rem; }
.sv-today { margin: 4px 2px 14px; color: var(--muted); font-size: 0.92rem; }
.sv-today strong { color: var(--ink); }
.sv-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 1000px) { .sv-grid { grid-template-columns: 1fr; } }
.sv-queue h3, .sv-agents h3 { margin-top: 0; }
.sv-row { display: grid; grid-template-columns: 28px 1fr auto auto; gap: 10px; align-items: center; padding: 10px 6px; border-top: 1px solid var(--line); border-radius: 8px; }
.sv-row:first-of-type { border-top: 0; }
.sv-row.late { background: color-mix(in srgb, #d24c3a 9%, transparent); }
.sv-row.late .sv-wait { color: #b3261e; }
.sv-wait { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sv-unassigned { color: #b3261e; font-weight: 700; }
.sv-assign { margin: 0; }
.sv-assign select { max-width: 170px; }
.sv-empty { font-size: 1.05rem; color: #2fb36b; font-weight: 700; }
.sv-off td { opacity: .55; }
@media (max-width: 760px) { .sv-row { grid-template-columns: 24px 1fr auto; } .sv-assign { grid-column: 2 / -1; } }
/* Mode télévision (plein écran) */
body.sv-tv .sidebar, body.sv-tv .topbar { display: none !important; }
body.sv-tv .main { max-width: none; padding: 24px 32px; }
body.sv-tv .sv-kpi .v { font-size: 2.8rem; }

/* ---------- État du système ---------- */
.sys-table td { vertical-align: top; }
.sys-fail td { background: color-mix(in srgb, #d24c3a 8%, transparent); }
.sys-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.sys-actions form { margin: 0; }
.sys-restore { margin-top: 10px; }
.sys-restore summary { cursor: pointer; font-weight: 700; }
.sys-banner { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }

/* ---------- Double authentification ---------- */
.tfa-code { font-size: 1.6rem; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; max-width: 260px; }
.tfa-form .tfa-code { max-width: none; width: 100%; }
.tfa-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.tfa-steps { padding-left: 20px; line-height: 1.6; }
.tfa-steps li { margin-bottom: 14px; }
.tfa-qr { width: 220px; height: 220px; margin: 10px 0; background: #fff; border-radius: 10px; padding: 4px; }
.tfa-qr svg { width: 100%; height: 100%; }
.tfa-secret { font-size: 0.95rem; letter-spacing: .05em; user-select: all; }
.tfa-codes { border: 2px dashed #e0b84a; }
.tfa-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 10px 0; }
.tfa-grid code { font-size: 1.05rem; padding: 6px 8px; text-align: center; background: var(--paper); border-radius: 6px; }
@media print { body * { visibility: hidden; } .tfa-codes, .tfa-codes * { visibility: visible; } .tfa-codes { position: absolute; top: 0; left: 0; } }

/* Environnement de test */
.env-test-banner { background: repeating-linear-gradient(-45deg, #f39c12, #f39c12 14px, #e67e22 14px, #e67e22 28px); color: #1d1300;
    padding: 8px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 0.92rem; text-shadow: 0 1px 0 rgba(255,255,255,.35); }

/* Réglages du son (carte de l'agent) */
.sound-prefs { display: flex; flex-direction: column; gap: 4px; margin: 6px 0 4px; font-size: 0.85rem; }
.sound-prefs label { font-weight: 700; color: var(--muted); font-size: 0.8rem; }
.sound-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.sound-row select { flex: 1 1 130px; width: auto; min-width: 130px; padding: 6px 8px; }
.sound-row .btn { flex: 0 0 auto; }
.sound-prefs input[type=range] { width: 100%; accent-color: var(--lagoon); }
.sound-prefs .hint { margin: 2px 0 0; font-size: 0.75rem; }

/* ---------- Départements et tickets ---------- */
.chip-ticket { background: #f3ecdf; color: #6b4a12; font-variant-numeric: tabular-nums; }
.chip-dept { background: color-mix(in srgb, var(--dept, #2c8a96) 15%, var(--surface)); color: color-mix(in srgb, var(--dept, #2c8a96) 75%, var(--ink)); }

.dp-card { border-left: 5px solid var(--dept, #2c8a96); }
.dp-head { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-bottom: 4px; }
.dp-form { margin-top: 10px; }
.dp-form input[type=color] { width: 60px; height: 40px; padding: 2px; }
.dp-members { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px 12px; margin: 4px 0; }
.dp-member { display: flex; align-items: center; gap: 6px; font-weight: 400; }

.sp-auto-pref { font-size: 0.85rem; margin: 4px 0; }

/* Carte de l'agent : les réglages du son et la case du téléphone prennent toute la largeur (sous l'avatar et le nom),
   et aucun élément ne peut faire déborder la carte. */
.me .sound-prefs, .me .sp-auto-pref { grid-column: 1 / -1; }
.me > * { min-width: 0; }
.me .sp-auto-pref { display: flex; align-items: center; gap: 8px; margin: 6px 0 2px; }
.me .sound-row select { min-width: 0; }

/* ---------- Marchands ---------- */
.chip-merchant { background: #e6f2ea; color: #1f5f3a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip-merchant { background: #1f3a2a; color: #b9e6c9; } }
:root[data-theme="dark"] .chip-merchant { background: #1f3a2a; color: #b9e6c9; }
.merchant-form { display: flex; flex-direction: column; gap: 6px; }
.mc-inline { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.mc-inline input { min-width: 0; flex: 1 1 140px; }
.mc-edit summary { list-style: none; }
.mc-edit[open] { min-width: 260px; }

.alert-warning { background: #fff4dc; color: #6b4a12; border: 1px solid #f0c96a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .alert-warning { background: #3a2f12; color: #f3dfa8; border-color: #7a6020; } }
:root[data-theme="dark"] .alert-warning { background: #3a2f12; color: #f3dfa8; border-color: #7a6020; }

/* ---------- Confirmation Pay'm ---------- */
.ca-paym { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.ca-paym-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.ca-paym-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.ca-paym-grid input { font-weight: 400; }
.ca-paym-already { font-size: 0.85rem; }
.ca-paym-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.ca-paym-method { display: flex; flex-direction: column; gap: 3px; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.ca-paym-method code { align-self: flex-start; font-size: 0.95rem; padding: 6px 10px; }

/* ---------- API & webhooks ---------- */
.ig-copy { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ig-copy input { flex: 1; min-width: 220px; font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; }
.ig-code { background: var(--paper); padding: 10px 12px; border-radius: 8px; white-space: pre-wrap; font-size: 0.82rem; margin-top: 8px; }
.ig-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.ig-inline input[type=text] { flex: 1; min-width: 200px; }
.ig-hook { border: 1px solid var(--line, #d4dcde); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.ig-hook summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.ig-events { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px 12px; }
.ig-revoked td { opacity: .55; }
.ig-newkey { border: 2px solid #2fb36b; }

.reply-file-chip { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; background: var(--paper); border-radius: 8px; padding: 4px 8px; width: 100%; }

/* ---------- Apprentissage du bot ---------- */
.ln-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 12px; }
.ln-kpi { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.ln-kpi strong { font-size: 1.6rem; color: var(--lagoon); }
.ln-kpi span { font-size: 0.82rem; color: var(--muted); }
.ln-item .ln-q { font-weight: 700; margin-bottom: 6px; }
.ln-item .ln-a { background: var(--paper); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; }
.ln-meta { margin: 4px 0 6px; }
.ln-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; margin-top: 6px; }
.ln-actions form { margin: 0; }
.tabs-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.tabs-row .tab { padding: 6px 12px; border-radius: 999px; text-decoration: none; color: inherit; background: var(--paper); }
.tabs-row .tab.is-active { background: var(--lagoon); color: #fff; }

.ln-row { border-top: 1px solid var(--line, #d4dcde); padding-top: 10px; margin-top: 10px; }
.ln-off { opacity: .6; }
.ln-add { margin: 8px 0; }
.ln-edit[open] { width: 100%; }
.ln-edit label, .ln-add label { display: flex; flex-direction: column; gap: 3px; }

/* ---------- Groupes de discussion (Équipe) ---------- */
.team-sep-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.team-new-grp { border: 0; background: none; color: var(--lagoon); font-weight: 700; font-size: 0.8rem; cursor: pointer; padding: 2px 4px; }
.team-grp-form { display: flex; flex-direction: column; gap: 8px; padding: 8px 10px 12px; border-bottom: 1px solid var(--line, #d4dcde); }
.team-pick { display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow-y: auto; padding: 4px 2px; }
.team-pick label { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; cursor: pointer; }
.team-av-grp { background: #6b4fb8; color: #fff; font-weight: 800; }
.team-av-grp.is-off { background: #9aa6a8; }
.team-archived summary { cursor: pointer; padding: 6px 12px; font-size: 0.8rem; color: var(--muted); }
.team-head-main { min-width: 0; }
.team-head-main .team-head-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 52vw; }
.team-grp-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 20px; padding: 12px 16px; border-bottom: 1px solid var(--line, #d4dcde); background: var(--paper); }
.team-grp-panel h4 { margin: 0 0 6px; font-size: 0.85rem; color: var(--muted); }
.team-grp-member { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.team-grp-member > span:nth-child(2) { flex: 1; }
.team-grp-member form { margin: 0; }
.team-av-sm { width: 28px; height: 28px; font-size: 0.7rem; }
.team-grp-inline { display: flex; gap: 6px; }
.team-grp-inline input { flex: 1; min-width: 0; }
.team-grp-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; }
.team-grp-actions form { margin: 0; }

/* Modifier un message (équipe) */
.team-edit { right: 34px !important; }
.team-edit-box { display: flex; flex-direction: column; gap: 6px; min-width: 240px; }
.team-edit-box textarea { width: 100%; min-height: 54px; font: inherit; border-radius: 10px; border: 1px solid var(--line, #cfd8da); padding: 6px 8px; color: var(--ink, #1d2427); background: #fff; }
.team-edit-acts { display: flex; gap: 6px; justify-content: flex-end; }

/* Modifier / supprimer un message envoyé */
.msg-edit-actions { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: flex-start; margin-top: 4px; }
.msg-edit-actions form { margin: 0; }
.msg-edit summary, .msg-edit-btn { list-style: none; cursor: pointer; font-size: 0.78rem; color: inherit; opacity: .75; background: none; border: 0; padding: 0; font-weight: 600; }
.msg-edit summary::-webkit-details-marker { display: none; }
.msg-edit summary:hover, .msg-edit-btn:hover { opacity: 1; text-decoration: underline; }
.msg-edit[open] { width: 100%; }
.msg-edit-form { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.msg-edit-form textarea { width: 100%; min-width: 220px; font: inherit; border-radius: 8px; border: 1px solid rgba(0,0,0,.15); padding: 6px 8px; color: #1d2427; background: #fff; }
.chat-deleted { opacity: .55; }
.chat-del-label { font-size: 0.75rem; font-weight: 700; opacity: .8; margin-top: 2px; }
.chat-edited { font-size: 0.72rem; opacity: .7; margin-right: 6px; font-style: italic; }

/* ---------- Groupes clients ---------- */
.cg-app { display: grid; grid-template-columns: 320px 1fr; gap: 14px; align-items: start; }
@media (max-width: 900px) { .cg-app { grid-template-columns: 1fr; } }
.cg-list { display: flex; flex-direction: column; gap: 6px; padding: 12px; margin: 0; }
.cg-new { display: flex; flex-direction: column; gap: 8px; padding: 6px 0 10px; border-bottom: 1px solid var(--line, #d4dcde); }
.cg-rows { display: flex; flex-direction: column; gap: 6px; }
.cg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cg-row input { min-width: 0; }
.cg-item { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; text-decoration: none; color: inherit; }
.cg-item:hover, .cg-item.active { background: var(--paper); }
.cg-av { width: 40px; height: 40px; border-radius: 50%; background: #6b4fb8; display: grid; place-items: center; flex: none; }
.cg-av.is-off { filter: grayscale(1); opacity: .6; }
.cg-item-t { display: flex; flex-direction: column; min-width: 0; }
.cg-item-t small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cg-archived summary { cursor: pointer; color: var(--muted); font-size: .85rem; padding: 6px 4px; }
.cg-check { margin-top: 8px; }
.cg-thread { display: flex; flex-direction: column; padding: 0; margin: 0; min-height: 60vh; overflow: hidden; }
.cg-empty { padding: 30px; max-width: 640px; }
.cg-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line, #d4dcde); }
.cg-head small { display: block; color: var(--muted); }
.cg-members { display: flex; flex-direction: column; gap: 8px; padding: 12px 16px; background: var(--paper); border-bottom: 1px solid var(--line, #d4dcde); }
.cg-member { display: flex; align-items: center; gap: 8px; }
.cg-member > span { flex: 1; }
.cg-member form, .cg-members form { margin: 0; }
.cg-inline { display: flex; gap: 6px; flex-wrap: wrap; }
.cg-inline input { flex: 1; min-width: 120px; }
.cg-msgs { flex: 1; overflow-y: auto; max-height: 62vh; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.cg-msg { max-width: 75%; padding: 8px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line, #d4dcde); }
.cg-out { align-self: flex-end; background: #dff0f2; border-color: transparent; }
.cg-in { align-self: flex-start; }
.cg-who { font-size: .78rem; font-weight: 800; color: #6b4fb8; margin-bottom: 2px; }
.cg-out .cg-who { color: var(--lagoon); }
.cg-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.cg-img { max-width: 260px; max-height: 260px; border-radius: 10px; display: block; margin: 4px 0; }
.cg-meta { font-size: .72rem; color: var(--muted); margin-top: 4px; text-align: right; }
.cg-fail { color: #b3402a; font-size: .75rem; }
.cg-note { align-self: center; font-size: .78rem; color: var(--muted); background: var(--paper); padding: 4px 10px; border-radius: 999px; text-align: center; }
.cg-newmsg { align-self: center; }
.cg-composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line, #d4dcde); }
.cg-composer textarea { flex: 1; min-height: 44px; }
.cg-attach { cursor: pointer; }
.chip-cg { background: #ece6fb; color: #4b3592; text-decoration: none; }

/* Zone de réponse : le champ de texte prend toujours la place disponible ;
   sur téléphone, il occupe toute la largeur et les boutons passent sur une ligne en dessous. */
.composer-form textarea { flex: 1 1 auto; min-width: 0; }
@media (max-width: 760px) {
    .composer-form { flex-wrap: wrap; gap: 8px; }
    .composer-form textarea { flex: 1 1 100%; width: 100%; order: 0; }
    .composer-form .cn-btn { order: 1; min-height: 42px; padding: 0 12px; }
    .composer-form .btn-send-wa { order: 2; margin-left: auto; min-height: 42px; padding: 0 22px; }
    .composer-form .reply-file-chip { order: -1; }
}
.reply-file-chip[hidden], .cn-pop[hidden] { display: none !important; }
/* Mode téléphone : petite marge sous les boutons de la zone de réponse */
@media (max-width: 760px) {
    .in-phone .composer { padding-bottom: calc(12px + var(--sp-overlap, 0px)); }
    .in-phone .main { padding-bottom: calc(24px + var(--sp-overlap, 0px)); }
}

/* Téléphone : rien ne peut élargir la page au-delà de l'écran (constaté sur Android dans certaines conversations).
   overflow-x: clip (et non hidden) pour ne pas casser la zone de réponse collée en bas (position: sticky). */
@media (max-width: 760px) {
    html, body { overflow-x: clip; max-width: 100%; }
    .main, .conv, .conv-grid, .conv-chat, .conv-side, .thread, .composer, .composer-form { min-width: 0; max-width: 100%; }
    .conv-grid > *, .chat-line, .chat-bubble { min-width: 0; }
    .chat-bubble, .chat-text, .chat-sender, .chat-media, .msg-edit-actions, .conv-head, .conv-head * { overflow-wrap: anywhere; word-break: break-word; }
    .chat-bubble img, .chat-bubble video, .chat-media img, .chat-media video, .chat-media iframe { max-width: 100%; height: auto; }
    .chat-bubble audio, .chat-media audio { width: 100%; max-width: 100%; min-width: 0; }
    .chat-media a, .chat-media .media-doc { max-width: 100%; overflow-wrap: anywhere; }
    .composer-form .cn-btn { flex: 0 1 auto; min-width: 0; padding: 0 8px; }
    .composer-form .btn-send-wa { flex: 0 1 auto; min-width: 0; }
    .conv-side select, .conv-side input, .conv-side textarea { max-width: 100%; min-width: 0; }
}

/* ---------- Logiciels connectés ---------- */
.iv-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0; }
.iv-inline input[type=text] { flex: 1; min-width: 220px; }
.iv-conn { border: 1px solid var(--line, #d4dcde); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.iv-conn > summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.iv-type { margin: 6px 0 6px 8px; } .iv-type > summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.iv-warn { background: #fff1e0; color: #8a4b08; }
.iv-err { color: #b3402a; font-size: .85rem; }

.ca-paym-hint { margin: 0; font-size: .82rem; }

/* Application mobile : les notifications sont natives → boutons et invitations des notifications web masqués */
.native-app #push-menu-btn, .native-app #push-promo, .native-app .push-promo { display: none !important; }

/* Application mobile : verrouillage Face ID / empreinte */
.app-only { display: none; } .native-app .app-only:not([hidden]) { display: flex; }
#bio-cover { position: fixed; inset: 0; z-index: 2147483000; background: #0B3B44; color: #fff; display: flex; align-items: center; justify-content: center;
    padding: env(safe-area-inset-top, 0) 24px env(safe-area-inset-bottom, 0); }
#bio-cover[hidden] { display: none; }
#bio-cover.bio-privacy .bio-box > :not(.bio-logo) { display: none; }
.bio-box { text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; max-width: 320px; }
.bio-logo { font-size: 56px; } .bio-box h2 { margin: 0; font-size: 1.3rem; } .bio-box p { margin: 0; color: #cfe3e5; }
.bio-box .btn-ghost { color: #cfe3e5; }

/* Marque VAYO Support */
.brand-logo { width: 34px; height: 34px; border-radius: 9px; object-fit: contain; background: #fff; flex: none; }
.login-brand { text-align: center; margin-bottom: 4px; }
.login-logo { width: 100%; max-width: 300px; height: auto; display: inline-block; }
.login-tagline { text-align: center; color: var(--muted); font-weight: 600; margin: 0 0 18px; font-style: italic; }

/* ---------- Pointage ---------- */
.pc-me h3 { margin-top: 0; }
.pc-big { font-size: 1.05rem; padding: 14px 22px; }
.pc-timer { font-size: 1.05rem; margin: 4px 0 12px; }
.pc-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.pc-row { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 8px 0; background: var(--surface); }
.pc-open { border-color: var(--leaf); background: var(--leaf-tint); }
.pc-meta { color: var(--muted); font-size: .88rem; margin-top: 3px; }
.pc-notes { margin-top: 6px; white-space: normal; }
.pc-far { color: var(--ember); font-weight: 700; }
.pc-photos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pc-photos img { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.pc-totals { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.pc-late { margin-top: -2px; }
.pc-inline select, .pc-inline input[type="date"] { width: auto; min-width: 0; flex: 0 1 auto; }
.pc-inline input[type="file"] { max-width: 100%; }

/* Mode téléphone intégré à l'application mobile : barre d'état du poste + clavier, rien d'autre */
.sp-embed .sp-tabs, .sp-embed .sp-frame, .sp-embed .sp-pad-close, .sp-embed #sp-keypad-btn { display: none !important; }
.sp-embed .sp-pad { position: static !important; display: block; width: auto !important; max-width: 420px; margin: 18px auto 0 !important;
    box-shadow: none !important; border: 0 !important; background: transparent !important; padding: 0 16px !important; inset: auto !important; }
.sp-embed .sp-keys button { min-height: 62px; font-size: 1.5rem; }
.sp-embed .sp-pad-actions .btn { min-height: 52px; font-size: 1.05rem; }
/* Lien indisponible (ex. téléphone non activé) et numéro de version */
.nav-off { opacity: .55; }
.nav-off small { font-size: .72em; font-weight: 600; }
.app-version { display: block; font-size: .7rem; color: var(--muted); margin-top: 2px; }

/* ---------- 🧩 Parcours du chatbot ---------- */
.bf-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.bf-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding: 12px 0; }
.bf-builtin { background: var(--paper-2); border-radius: 10px; padding: 12px; border-top: 0; }
.bf-main { flex: 1 1 320px; min-width: 0; }
.bf-meta { color: var(--muted); font-size: .86rem; margin-top: 3px; overflow-wrap: anywhere; }
.bf-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.bf-actions form { margin: 0; }
.bf-q { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: var(--surface); }
.bf-q-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.bf-q-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) { .bf-q-grid { grid-template-columns: 1fr; } }
.bf-alert-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.bf-save { margin-top: 8px; }
.bf-sim { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--paper-2); max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.bf-sim-in, .bf-sim-out, .bf-sim-sys { max-width: 85%; padding: 8px 12px; border-radius: 14px; overflow-wrap: anywhere; }
.bf-sim-in { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.bf-sim-out { align-self: flex-end; background: var(--bubble-agent); }
.bf-sim-sys { align-self: center; font-size: .82rem; color: var(--muted); background: transparent; text-align: center; }
.bf-sim-form { display: flex; gap: 8px; margin-bottom: 6px; }
.bf-sim-form input { flex: 1; min-width: 0; }
.bf-resp { border-top: 1px solid var(--line); padding: 10px 0; }
.bf-ans { display: inline-block; margin: 4px 12px 0 0; overflow-wrap: anywhere; }

/* 🔎 Recherche de produits */
.ps-tabs { margin: 4px 0 16px; }
.ps-lead { margin: 0 0 12px; max-width: 72ch; }
.ps-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ps-actions { display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ps-actions form { margin: 0; }
.ps-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ps-filters input, .ps-filters select { width: auto; min-width: 0; max-width: 220px; }
.ps-check { display: inline-flex; align-items: flex-start; gap: 8px; font-weight: 400; cursor: pointer; margin: 0 16px 6px 0; }
.ps-check input { width: auto; margin-top: 3px; }
.ps-cats { border: 0; padding: 0; margin: 0 0 16px; }
.ps-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 12px 0 0; }
.ps-dl dt { color: var(--muted); font-size: 0.85rem; }
.ps-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ps-inline-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ps-inline-form input { width: auto; flex: 1 1 140px; min-width: 0; }
.ps-photo { display: block; max-width: 160px; max-height: 120px; border-radius: var(--r-sm); margin-top: 8px; border: 1px solid var(--line); }
.ps-sample { white-space: pre-wrap; font: inherit; font-size: 0.86rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; margin: 8px 0 0; max-width: 60ch; }
.ps-log { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; max-height: 480px; overflow-y: auto; }
.ps-log-row { max-width: 85%; padding: 8px 10px; border-radius: var(--r-sm); background: var(--paper-2); overflow-wrap: anywhere; }
.ps-log-row.out { align-self: flex-end; background: var(--lagoon-tint); }
@media (max-width: 560px) { .ps-dl { grid-template-columns: 1fr; } .ps-dl dd { margin-bottom: 6px; } }

.ps-hours { border: 0; padding: 0; margin: 0 0 16px; }
.ps-hours-grid { display: grid; grid-template-columns: 110px 120px 16px 120px; gap: 8px 10px; align-items: center; margin-top: 8px; max-width: 520px; }
.ps-hours-grid input[type="time"] { width: 100%; min-width: 0; }
.ps-day { margin: 0; }
.ps-hours-grid[hidden] { display: none; }
@media (max-width: 420px) { .ps-hours-grid { grid-template-columns: 1fr 1fr; } .ps-hours-grid .ps-day { grid-column: 1 / -1; } .ps-hours-grid > .hint:not(p) { display: none; } }
.ps-hours-grid input[type="time"] { padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--paper); color: inherit; font: inherit; }
.ps-pay { display: inline-block; vertical-align: top; } .ps-pay > summary { list-style: none; display: inline-flex; } .ps-pay > summary::-webkit-details-marker { display: none; } .ps-pay[open] form { margin-top: 6px; }
.ps-bill-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 150px; } .ps-bill-actions form { margin: 0; } .ps-pay[open] { position: relative; } .ps-pay[open] form { flex-direction: column; align-items: stretch; min-width: 220px; }
.ps-pay[open] form input, .ps-pay[open] form select { flex: none; width: 100%; max-width: none !important; }
.ps-bill-actions { min-width: 0; }
.ps-grid input { width: 100%; min-width: 90px; }

/* Onglets de canal VAYO Support / VAYO Connect (Messages) */
.ch-tabs { margin: 2px 0 14px; gap: 8px; }
.ch-tabs .ch-tab { padding: 10px 18px; border-radius: 12px; font-weight: 700; font-size: 0.95rem; border: 1px solid var(--border, #dfe3ea); background: var(--surface, #fff); }
.ch-tabs .ch-tab.active { background: #0E2E66; color: #fff; border-color: #0E2E66; }
.ch-tabs .ch-tab.ch-connect.active { background: #2f9e1f; border-color: #2f9e1f; }
.ch-tabs .ch-tab.active .tab-count { background: #fff; color: #0E2E66; }
