/* Tableau de bord ChatIn : même identité que le site (vert bouteille, mangue, fond vert pâle). */
:root {
  --ink: #14231C; --muted: #3E4F47; --soft: #56655D;
  --green: #0E5A43; --green-dark: #093D2D; --green-tint: #DCEBE2;
  --mango: #F0A320; --mango-tint: #FCE7BF; --mango-ink: #6B4200;
  --ground: #EEF1EC; --line: #DCE3DD; --white: #FFFFFF; --danger: #A1291B; --danger-tint: #F8E1DD;
  --radius: 12px;
  --font: 'Public Sans', 'Segoe UI', system-ui, sans-serif;
  --display: 'Anybody', 'Public Sans', sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--ground); color: var(--ink); font-size: 16px; line-height: 1.55; overflow-x: clip; }
a { color: var(--green); } a:hover { color: var(--green-dark); }
:focus-visible { outline: 3px solid var(--mango); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-family: var(--display); font-variation-settings: 'wdth' 110; font-weight: 800; font-size: 30px; letter-spacing: -0.01em; }
h2 { font-size: 19px; font-weight: 700; }
p { margin: 0; }

.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--ink); color: #E2EEE8; padding: 24px 16px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--white); text-decoration: none; font-family: var(--display); font-variation-settings: 'wdth' 115; font-weight: 800; font-size: 21px; padding: 0 8px 20px; }
.brand-in { color: var(--mango); }
.sidebar a.nav { display: flex; align-items: center; justify-content: space-between; color: #C9D6CF; text-decoration: none; padding: 10px 12px; border-radius: 10px; font-weight: 500; min-height: 44px; }
.sidebar a.nav:hover { background: rgba(255,255,255,.06); color: var(--white); }
.sidebar a.nav.active { background: var(--green); color: var(--white); }
.nav-label { display: flex; align-items: center; gap: 10px; }
.sidebar .count { background: var(--mango); color: var(--ink); border-radius: 999px; font-size: 12px; font-weight: 700; padding: 1px 8px; }
.sidebar .footer { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid rgba(255,255,255,.1); font-size: 14px; }
.sidebar .footer button { background: none; border: 0; color: #C9D6CF; padding: 8px 0; cursor: pointer; font: inherit; text-decoration: underline; }
.sidebar .menu { gap: 4px; }
.nav-toggle { display: none; align-items: center; gap: 8px; min-height: 44px; margin-left: auto; padding: 0 12px; border: 1px solid rgba(255,255,255,.28); border-radius: 10px; background: transparent; color: var(--white); font: inherit; font-weight: 600; cursor: pointer; }
.nav-toggle:hover { background: rgba(255,255,255,.08); }
.main { padding: 32px 40px 64px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 6px; }

.panel { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.grid-2 > .full { grid-column: 1 / -1; }
table.list .chip { white-space: nowrap; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.muted { color: var(--muted); } .small { font-size: 13px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 10px; border: 2px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--green); color: var(--white); }
.btn:hover { background: var(--green-dark); color: var(--white); }
.btn:disabled, .btn:disabled:hover { background: var(--line); color: var(--soft); border-color: transparent; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn.secondary:hover { background: var(--ink); color: var(--white); }
.btn.mango { background: var(--mango); color: var(--ink); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 14px; }

form.stack, .stack { display: flex; flex-direction: column; gap: 14px; }
label { font-weight: 600; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=url], input[type=number], input[type=datetime-local], input[type=file], select, textarea {
  font: inherit; color: var(--ink); background: var(--white); border: 1px solid #C9D3CC; border-radius: 10px; padding: 11px 12px; width: 100%; font-weight: 400; }
textarea { min-height: 110px; resize: vertical; }
.hint { font-weight: 400; color: var(--soft); font-size: 13px; }
.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }

.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checklist li { display: flex; align-items: center; gap: 12px; }
.checklist .tick { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--mango-tint); color: var(--mango-ink); }
.checklist li.done .tick { background: var(--green-tint); color: #0B4A37; }
.checklist li.done .label { color: var(--soft); text-decoration: line-through; }
.checklist .label { flex: 1; font-weight: 600; }
.big-link { text-decoration: none; color: var(--ink); gap: 6px; }
.big-link:hover { border-color: var(--green); color: var(--ink); }
.big-number { font-family: var(--display); font-weight: 800; font-size: 44px; line-height: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.flash { padding: 14px 16px; border-radius: 12px; background: var(--green-tint); color: #0B4A37; font-weight: 500; }
.flash.error { background: var(--danger-tint); color: var(--danger); }
.flash.warn { background: var(--mango-tint); color: var(--mango-ink); }
.secret { font-family: 'JetBrains Mono', ui-monospace, monospace; background: var(--ink); color: #E2EEE8; padding: 12px 14px; border-radius: 10px; word-break: break-all; }
.secret-copy { display: flex; align-items: center; gap: 12px; }
.secret-copy [data-secret] { flex: 1; min-width: 0; }
.copy-btn { flex: none; display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .1); color: #E2EEE8; cursor: pointer; }
.copy-btn:hover { background: rgba(255, 255, 255, .2); }
.copy-btn:focus-visible { outline: 2px solid var(--mango); outline-offset: 2px; }
.copy-btn .i-done, .copy-btn.done .i-copy { display: none; }
.copy-btn.done .i-done { display: block; color: #7BE0A9; }

.meter { display: flex; flex-direction: column; gap: 6px; }
.meter .row { display: flex; justify-content: space-between; font-size: 14px; }
.bar { height: 10px; background: #E3EAE5; border-radius: 6px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--green); border-radius: 6px; }
.bar.warn > span { background: var(--mango); }
/* Accueil : trois chiffres clés, compteurs du forfait côte à côte. */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.kpi { gap: 8px; text-decoration: none; color: var(--ink); padding: 18px 20px; }
a.kpi:hover { border-color: var(--green); }
.kpi-label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-family: var(--display); font-variation-settings: "wdth" 110; font-weight: 800; font-size: 32px; line-height: 1.1; }
.kpi-value small { font-family: var(--font); font-size: 14px; font-weight: 600; color: var(--muted); }
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px 28px; }
@media (max-width: 860px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpis { grid-template-columns: 1fr; } }

table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 13px; color: var(--soft); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.list td { padding: 12px; border-bottom: 1px solid #EDF1EE; vertical-align: middle; }
.table-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
.table-wrap form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.table-wrap form input[type=text] { width: auto; flex: 1 1 140px; min-width: 0; }
.split { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.split > .small { min-width: 0; flex: 1 1 180px; overflow-wrap: anywhere; }
.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #E8ECEA; color: var(--muted); }
.chip.ok { background: var(--green-tint); color: #0B4A37; }
.chip.wait { background: var(--mango-tint); color: var(--mango-ink); }
.chip.bad { background: var(--danger-tint); color: var(--danger); }

/* Boîte partagée */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: calc(100dvh - 96px); background: var(--white); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.inbox-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.inbox-tools { padding: 14px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { font: inherit; font-size: 13px; font-weight: 600; border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: 6px 12px; cursor: pointer; min-height: 32px; }
.tabs button[aria-pressed=true] { background: var(--ink); color: var(--white); border-color: var(--ink); }
.conv-items { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 12px; padding: 14px; border-bottom: 1px solid #EDF1EE; cursor: pointer; width: 100%; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; font: inherit; color: inherit; }
.conv:hover, .conv[aria-current=true] { background: #F4F8F5; }
.avatar { flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; background: var(--green-tint); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; }
.conv .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.conv .top { display: flex; justify-content: space-between; gap: 8px; }
.conv .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .preview { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread { background: var(--mango); color: var(--ink); border-radius: 999px; font-size: 12px; font-weight: 700; padding: 0 7px; }
.thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.inbox > .thread { overflow: hidden; }
#thread { flex: 1; height: 100%; }
.thread-head { padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.thread-title { flex: 1 1 140px; min-width: 0; }
.thread-title h2 { overflow-wrap: anywhere; }
.thread-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.assign { flex-direction: row; align-items: center; gap: 8px; min-width: 0; }
.thread-head select { width: auto; max-width: 100%; padding: 8px 10px; }
.messages { flex: 1; overflow-y: auto; padding: 16px 6%; display: flex; flex-direction: column; gap: 2px; background: #EFEAE2; }
/* Bulles façon WhatsApp : entrant blanc à gauche, sortant vert pâle à droite, heure et coches en bas à droite. */
.bubble { position: relative; max-width: min(65%, 560px); padding: 6px 8px 8px 9px; border-radius: 8px; font-size: 14.5px; line-height: 1.4; word-wrap: break-word; overflow-wrap: anywhere; box-shadow: 0 1px 0.5px rgba(11, 20, 26, .13); }
.bubble.first { margin-top: 10px; }
.bubble.in { align-self: flex-start; background: var(--white); }
.bubble.out { align-self: flex-end; background: #D9FDD3; }
.bubble.in.first { border-top-left-radius: 0; }
.bubble.out.first { border-top-right-radius: 0; }
.bubble.first::before { content: ''; position: absolute; top: 0; width: 8px; height: 13px; }
.bubble.in.first::before { left: -8px; background: var(--white); clip-path: polygon(100% 0, 0 0, 100% 100%); }
.bubble.out.first::before { right: -8px; background: #D9FDD3; clip-path: polygon(0 0, 100% 0, 0 100%); }
.bubble .who { display: block; font-size: 12.5px; font-weight: 700; color: var(--green); margin-bottom: 2px; }
.bubble .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .text a { color: #027EB5; text-decoration: underline; }
.bubble .text code { padding: 0 3px; border-radius: 3px; background: rgba(11, 20, 26, .07); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.bubble .text code.mono { display: block; padding: 4px 6px; white-space: pre-wrap; }
/* Aperçu de lien, comme dans WhatsApp : image, titre, description, site. */
.bubble .link-card { display: block; margin: -2px -4px 6px; overflow: hidden; border-radius: 6px; background: rgba(11, 20, 26, .05); color: inherit; text-decoration: none; }
.bubble.out .link-card { background: rgba(14, 90, 67, .08); }
.bubble .link-card:hover { background: rgba(11, 20, 26, .09); }
.bubble .link-card .lc-image { display: block; width: 100%; max-height: 180px; object-fit: cover; background: #DCE3DD; }
.bubble .link-card .lc-body { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; }
.bubble .link-card .lc-title { font-weight: 700; font-size: 13.5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bubble .link-card .lc-desc { font-size: 12.5px; color: #54656F; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bubble .link-card .lc-site { font-size: 12px; color: #667781; }
.bubble .quote { display: flex; flex-direction: column; gap: 1px; width: 100%; margin: 0 0 4px; padding: 5px 8px; border: 0; border-left: 4px solid var(--green); border-radius: 6px; background: rgba(11, 20, 26, .06); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.bubble.out .quote { background: rgba(14, 90, 67, .09); }
.bubble .quote:hover { background: rgba(11, 20, 26, .1); }
.bubble .quote:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.bubble .quote.missing { cursor: default; border-left-color: #8696A0; }
.bubble.pending .quote { cursor: default; }
.bubble .react-bar .reply-btn { display: grid; place-items: center; color: var(--muted); }
/* Encadré « en réponse à » au-dessus de la zone de réponse. */
.reply-banner { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 12px; background: #F7F9F7; }
.reply-banner[hidden] { display: none; }
.reply-banner .quote { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; padding: 5px 8px; border-left: 4px solid var(--green); border-radius: 6px; background: rgba(14, 90, 67, .07); }
.reply-banner .q-who { font-size: 12.5px; font-weight: 700; color: var(--green); }
.reply-banner .q-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: #54656F; }
.bubble .quote .q-who { font-size: 12.5px; font-weight: 700; color: var(--green); }
.bubble .quote .q-text { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 13px; color: #54656F; }
.bubble.flash { animation: bubble-flash 1.4s ease-out; }
@keyframes bubble-flash { 0%, 40% { box-shadow: 0 0 0 3px rgba(14, 90, 67, .45); } 100% { box-shadow: 0 0 0 3px rgba(14, 90, 67, 0); } }
@media (prefers-reduced-motion: reduce) { .bubble.flash { animation: none; outline: 3px solid rgba(14, 90, 67, .45); } }
.bubble.revoked .text { font-style: italic; color: #667781; }
.bubble .edited { font-size: 11px; color: #8696A0; margin-right: 4px; }
.bubble .meta { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 6px 0 -4px 12px; font-size: 11px; color: #667781; white-space: nowrap; }
.bubble .ticks { display: block; }
.bubble .failed { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: var(--danger); color: var(--white); font-size: 10px; font-weight: 700; }
.bubble .error { clear: both; display: block; padding-top: 4px; font-size: 12px; color: var(--danger); }
.bubble .media { display: block; margin: -2px -4px 4px; }
.bubble img, .bubble video { display: block; max-width: 100%; width: 330px; max-height: 360px; object-fit: cover; border-radius: 6px; }
.bubble audio { width: 260px; max-width: 100%; }
.bubble .file { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 4px; border-radius: 6px; background: rgba(11, 20, 26, .05); color: var(--ink); text-decoration: none; font-weight: 600; }
.bubble .file .file-body { display: flex; flex-direction: column; min-width: 0; }
.bubble .file .file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.bubble .file .file-size { font-size: 12px; font-weight: 400; color: #667781; }
/* Réactions : badge à cheval sur le bas de la bulle, barre au-dessus au survol (ou au toucher). */
.bubble.has-react { margin-bottom: 16px; }
.bubble .reactions { position: absolute; bottom: -15px; display: inline-flex; align-items: center; gap: 1px; padding: 1px 5px; border-radius: 999px; background: var(--white); box-shadow: 0 1px 2px rgba(11, 20, 26, .2); font-size: 14px; line-height: 20px; cursor: default; }
.bubble.in .reactions { left: 8px; }
.bubble.out .reactions { right: 8px; }
.bubble .reactions .count { margin-left: 3px; font-size: 12px; color: #667781; }
.bubble .react-bar { position: absolute; bottom: calc(100% - 6px); z-index: 2; display: none; gap: 2px; padding: 3px 5px; border-radius: 999px; background: var(--white); box-shadow: 0 2px 8px rgba(11, 20, 26, .2); }
.bubble.top .react-bar { bottom: auto; top: calc(100% - 6px); }
.bubble.in .react-bar { left: 0; }
.bubble.out .react-bar { right: 0; }
.bubble:hover .react-bar, .bubble:focus-within .react-bar, .bubble.show-react .react-bar { display: inline-flex; }
.bubble .react-bar button { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: none; font-size: 20px; line-height: 1; cursor: pointer; }
.bubble .react-bar button:hover, .bubble .react-bar button:focus-visible { background: rgba(11, 20, 26, .08); }
.bubble .react-bar button[aria-pressed="true"] { background: rgba(0, 168, 132, .18); }
.day { align-self: center; margin: 12px 0 4px; }
.day span { display: inline-block; padding: 5px 12px; border-radius: 8px; background: var(--white); color: #54656F; font-size: 12.5px; box-shadow: 0 1px 0.5px rgba(11, 20, 26, .13); }
.composer { position: relative; border-top: 1px solid var(--line); padding: 14px 20px; display: flex; flex-direction: column; gap: 8px; }
.composer .row { display: flex; gap: 10px; align-items: flex-end; }
.composer .row > label { min-width: 0; }
/* Emojis et pièces jointes, à gauche du champ comme dans WhatsApp Web. */
.composer-tools { display: flex; gap: 2px; padding-bottom: 2px; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; }
.icon-btn.thread-back { display: none; }
.icon-btn svg { color: var(--muted); }
.icon-btn:hover:not(:disabled), .icon-btn[aria-expanded=true] { background: var(--green-tint); }
.icon-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.emoji-panel { position: absolute; left: 20px; bottom: calc(100% - 8px); z-index: 20; border-radius: 12px; box-shadow: 0 6px 24px rgba(11, 20, 26, .18); overflow: hidden; background: var(--white); }
.emoji-panel emoji-picker { --border-color: var(--line); --indicator-color: var(--green); --outline-color: var(--green); width: min(352px, calc(100vw - 48px)); height: 360px; }
.emoji-panel .loading { padding: 16px 18px; font-size: 14px; color: var(--muted); }
/* Fichier joint avant envoi : ligne compacte (audio, document) ou grand aperçu (photo, vidéo), croix pour le retirer. */
.attach-preview { position: relative; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #F7F9F7; }
.attach-media { flex: 1; min-width: 0; }
.attach-preview:not(.visual):has(.doc) .attach-media { flex: none; }
.attach-media .audio-player { display: flex; align-items: center; gap: 10px; width: 100%; }
.attach-media .doc { display: grid; place-items: center; width: 44px; height: 52px; border-radius: 6px; background: var(--white); border: 1px solid var(--line); font-size: 24px; }
.attach-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.attach-preview:has(.audio-player) { flex-wrap: wrap; row-gap: 2px; }
.attach-preview:has(.audio-player) .attach-info { order: 3; flex-basis: 100%; padding-left: 50px; }
.attach-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.attach-close { flex: none; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: #E3E9E4; color: var(--ink); cursor: pointer; }
.attach-close:hover { background: #D3DCD5; }
.attach-close:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.attach-preview.visual { flex-direction: column; align-items: stretch; gap: 8px; padding: 8px; }
.attach-preview.visual .attach-media { flex: none; overflow: hidden; border-radius: 8px; background: #0B141A; }
.attach-preview.visual img, .attach-preview.visual video { display: block; width: 100%; max-height: 260px; object-fit: contain; }
.attach-preview.visual .attach-info { padding: 0 4px 2px; }
.attach-preview.visual .attach-close { position: absolute; top: 16px; right: 16px; z-index: 1; background: rgba(11, 20, 26, .62); color: var(--white); }
.attach-preview.visual .attach-close:hover { background: rgba(11, 20, 26, .8); }
.attach-preview.many { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 8px; }
.attach-preview.many .attach-media { grid-column: 1 / -1; }
.attach-preview.many .attach-info { padding-left: 4px; }
.attach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.attach-tile { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: #0B141A; }
.attach-tile img, .attach-tile video { display: block; width: 100%; height: 100%; object-fit: cover; }
.attach-tile.video::after { content: '▶'; position: absolute; left: 6px; bottom: 4px; color: var(--white); font-size: 12px; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.attach-tile.file { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px; background: var(--white); border: 1px solid var(--line); }
.attach-tile .tile-icon { font-size: 24px; }
.attach-tile .tile-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--soft); }
.attach-tile .tile-remove { position: absolute; top: 4px; right: 4px; display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: rgba(11, 20, 26, .62); color: var(--white); cursor: pointer; }
.attach-tile .tile-remove:hover { background: rgba(11, 20, 26, .85); }
.attach-tile .tile-remove:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.attach-off { display: flex; align-items: center; gap: 8px; }
/* Note vocale : la barre d'enregistrement remplace le champ de réponse. */
.composer.recording #free-reply { display: none; }
.voice-rec { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; min-height: 48px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 10px; background: #F7F9F7; }
.voice-rec .rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); animation: rec-blink 1.2s ease-in-out infinite; }
.voice-rec.paused .rec-dot { animation: none; opacity: .4; }
.voice-rec .rec-time { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 3.5em; }
.voice-rec .actions { display: flex; gap: 8px; margin-left: auto; }
@keyframes rec-blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .voice-rec .rec-dot { animation: none; } }
.bubble .audio-player { display: flex; align-items: center; gap: 10px; width: 260px; max-width: 100%; margin: 0 0 2px; padding: 2px 0; }
.audio-player .ap-play { flex: none; display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: var(--green); color: var(--white); cursor: pointer; }
.audio-player .ap-play:hover { background: var(--green-dark); }
.audio-player .ap-play:focus-visible, .audio-player .ap-seek:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.audio-player .ap-play svg { margin-left: 2px; }
.audio-player.playing .ap-play svg { margin-left: 0; }
.audio-player .ap-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.audio-player .ap-seek { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; margin: 8px 0 0; border-radius: 2px; background: linear-gradient(to right, var(--green) var(--p), #B7C9BF var(--p)); cursor: pointer; }
.audio-player .ap-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--green); border: 0; }
.audio-player .ap-seek::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--green); border: 0; }
.audio-player .ap-time { font-size: 11.5px; color: #667781; font-variant-numeric: tabular-nums; }
.audio-player audio { display: none; }
.thread { position: relative; }
.drop-zone { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(14, 90, 67, .12); border: 3px dashed var(--green); border-radius: 12px; pointer-events: none; }
.drop-zone span { padding: 12px 18px; border-radius: 10px; background: var(--white); color: var(--green); font-weight: 700; box-shadow: 0 2px 10px rgba(11, 20, 26, .12); }
.composer textarea { min-height: 48px; max-height: 160px; }
.presence { font-size: 13px; font-weight: 600; color: var(--green); padding: 6px 20px; background: var(--green-tint); border-bottom: 1px solid var(--line); }
.presence.typing { color: var(--mango-ink); background: var(--mango-tint); }
.collision { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--mango-tint); color: var(--mango-ink); font-size: 14px; }
.collision .actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* Vérification avant envoi : numéro, lien, montant, remarques du correcteur. */
.precheck { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--mango); border-radius: 10px; background: #FFF8EA; color: var(--mango-ink); font-size: 14px; }
.precheck ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; color: var(--ink); overflow-wrap: anywhere; }
.precheck .actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* Réponse dans son délai d'annulation : bulle grisée, pas encore envoyée. */
.pending-out { display: flex; flex-direction: column; gap: 2px; }
.bubble.out.pending, .bubble.out.pending.first::before { background: #EDF3EA; }
.bubble.pending .text, .bubble.pending .media, .bubble.pending .file { opacity: .6; }
.bubble.pending .meta { color: #3B4A54; font-weight: 600; }
.bubble.pending .undo { font: inherit; font-weight: 700; color: var(--green); background: none; border: 0; padding: 2px 4px; margin: -2px -4px; cursor: pointer; text-decoration: underline; min-height: 24px; }
.bubble.pending .undo:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; border-radius: 4px; }
/* Positions : carte stylisée en CSS (aucune tuile chargée chez un tiers), épingle au centre. */
.bubble .loc-card { display: flex; flex-direction: column; width: 280px; max-width: 100%; margin: -2px -4px 4px; border-radius: 6px; overflow: hidden; background: var(--white); color: var(--ink); text-decoration: none; border: 1px solid rgba(11, 20, 26, .08); }
a.loc-card:hover .loc-link, a.loc-card:focus-visible .loc-link { text-decoration: underline; }
.loc-map { position: relative; display: block; height: 104px; background-color: #E6EEE1;
  background-image:
    linear-gradient(115deg, transparent 46%, #B9D7EA 46%, #B9D7EA 54%, transparent 54%),
    linear-gradient(0deg, transparent 47%, #FFFFFF 47%, #FFFFFF 53%, transparent 53%),
    linear-gradient(90deg, transparent 31%, #FFFFFF 31%, #FFFFFF 35%, transparent 35%, transparent 72%, #FFFFFF 72%, #FFFFFF 75%, transparent 75%),
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(255, 255, 255, .55) 22px 24px),
    repeating-linear-gradient(90deg, transparent 0 26px, rgba(255, 255, 255, .55) 26px 28px); }
.loc-pin { position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; margin: -26px 0 0 -12px; border-radius: 50% 50% 50% 0; background: #D93A2F; transform: rotate(-45deg); box-shadow: -1px 1px 3px rgba(11, 20, 26, .35); }
.loc-pin::after { content: ''; position: absolute; left: 7px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--white); }
.loc-map::after { content: ''; position: absolute; left: 50%; top: 50%; width: 14px; height: 5px; margin: 1px 0 0 -7px; border-radius: 50%; background: rgba(11, 20, 26, .25); }
.loc-body { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px 8px; min-width: 0; }
.loc-name { font-weight: 700; }
.loc-address { font-size: 13px; color: #3B4A54; }
.loc-link { margin-top: 2px; font-size: 13px; font-weight: 600; color: #027EB5; }
.bubble .loc-ask { clear: both; display: block; margin: 6px -4px 0; padding: 7px 0 3px; border-top: 1px solid rgba(11, 20, 26, .1); text-align: center; font-size: 14px; font-weight: 600; color: #027EB5; }
.bubble.pending .loc-card, .bubble.pending .loc-ask { opacity: .6; }
.location-panel { position: absolute; left: 20px; bottom: calc(100% - 8px); z-index: 20; display: flex; flex-direction: column; gap: 14px; width: min(360px, calc(100vw - 48px)); overflow-y: auto; padding: 14px 16px; border-radius: 12px; box-shadow: 0 6px 24px rgba(11, 20, 26, .18); background: var(--white); }
.location-panel .loc-part { display: flex; flex-direction: column; gap: 6px; }
.location-panel .loc-part + .loc-part { padding-top: 12px; border-top: 1px solid var(--line); }
.location-panel textarea { min-height: 60px; }
/* Sondages : question et choix dans la bulle, l'aperçu du panneau 📊 et la bulle en attente. */
.poll-tag { display: block; font-size: 12px; font-weight: 700; color: #027EB5; }
.poll-opts { clear: both; display: flex; flex-direction: column; gap: 4px; margin: 6px 0 2px; }
.poll-opts.buttons .poll-opt { display: block; padding: 6px 8px; border-radius: 6px; border: 1px solid rgba(11, 20, 26, .1); background: rgba(255, 255, 255, .75); color: #027EB5; font-size: 14px; font-weight: 600; text-align: center; }
.poll-opts.list .poll-opt { position: relative; display: block; padding-left: 20px; font-size: 14px; }
.poll-opts.list .poll-opt::before { content: ''; position: absolute; left: 2px; top: 4px; width: 10px; height: 10px; border: 2px solid #8696A0; border-radius: 50%; }
.bubble .poll-link { display: block; margin-top: 4px; font-size: 13px; font-weight: 600; color: #027EB5; }
.bubble.pending .poll-opts, .bubble.pending .poll-tag { opacity: .6; }
/* Annonce Facebook / Instagram (Click-to-WhatsApp). */
.bubble .ref-card { display: flex; flex-direction: column; width: 280px; max-width: 100%; margin: -2px -4px 4px; border-radius: 6px; overflow: hidden; background: #F0F2F5; color: var(--ink); text-decoration: none; border: 1px solid rgba(11, 20, 26, .08); }
a.ref-card:hover .ref-link, a.ref-card:focus-visible .ref-link { text-decoration: underline; }
.ref-tag { display: block; padding: 6px 10px 0; font-size: 11px; font-weight: 700; color: #667781; text-transform: uppercase; letter-spacing: .02em; }
.ref-media { position: relative; display: block; margin-top: 6px; background: #D1D7DB; }
.ref-media img { display: block; width: 100%; max-height: 160px; object-fit: cover; border-radius: 0; }
.ref-media.video::after { content: ''; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: rgba(11, 20, 26, .55); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .85); }
.ref-media.video::before { content: ''; position: absolute; left: 50%; top: 50%; z-index: 1; width: 0; height: 0; margin: -8px 0 0 -5px; border-style: solid; border-width: 9px 0 9px 14px; border-color: transparent transparent transparent #fff; }
.ref-copy { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; min-width: 0; }
.ref-title { font-weight: 700; font-size: 14px; }
.ref-body { font-size: 13px; color: #667781; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ref-link { margin-top: 4px; font-size: 13px; font-weight: 600; color: #027EB5; }
.bubble.pending .ref-card { opacity: .6; }
.poll-panel .poll-preview { display: flex; flex-direction: column; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #F4F7F5; font-size: 14px; }
.poll-panel .poll-preview:empty { display: none; }
.poll-preview .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.poll-preview .loc-ask { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(11, 20, 26, .1); text-align: center; font-weight: 600; color: #027EB5; }
.poll-question { white-space: pre-wrap; overflow-wrap: anywhere; }
/* Page Numéros WhatsApp : adresse de chaque boutique. */
.loc-form { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.loc-form h3 { font-size: 16px; }
.loc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 14px; }
.loc-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.loc-steps { margin: 8px 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.spell { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #FBFCFB; max-height: 170px; overflow-y: auto; }
.spell-item { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.spell-item .word { font-weight: 700; text-decoration: underline wavy var(--danger); text-underline-offset: 3px; }
.spell-item .word.grammar { text-decoration-color: #2F7FD1; }
.spell-item .msg { color: var(--muted); }
.spell-item button { font: inherit; font-size: 13px; border: 1px solid var(--line); background: var(--white); border-radius: 999px; padding: 3px 10px; cursor: pointer; min-height: 30px; }
.spell-item button.fix { background: var(--green-tint); border-color: var(--green-tint); color: #0B4A37; font-weight: 600; }
.window-note { font-size: 13px; color: var(--mango-ink); background: var(--mango-tint); padding: 8px 12px; border-radius: 8px; }
.empty { margin: auto; text-align: center; color: var(--muted); padding: 40px; }

.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth .panel { width: 100%; max-width: 440px; }


/* Pages de connexion et d'inscription */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.auth__aside { background: var(--green-tint); padding: 48px clamp(32px, 5vw, 72px); display: flex; flex-direction: column; gap: 48px; }
.auth__brand { display: inline-block; align-self: flex-start; }
.auth__brand img { display: block; height: 40px; width: auto; }
.auth__pitch { margin-block: auto; display: flex; flex-direction: column; gap: 28px; max-width: 440px; }
.auth__pitch h2 { font-family: var(--display); font-variation-settings: 'wdth' 112; font-weight: 800; font-size: clamp(28px, 3vw, 38px); line-height: 1.1; letter-spacing: -0.01em; }
.auth__perks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; font-size: 16px; color: var(--muted); }
.auth__perks li { position: relative; padding-left: 34px; }
.auth__perks li::before { content: ''; position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 50%; background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 14px no-repeat; }
.auth__perks strong { color: var(--ink); }
.auth__legal { font-size: 13px; color: var(--soft); }
.auth__main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 48px 24px; background: var(--white); }
.auth__card { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 24px; }
.auth__head { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.auth__switch { text-align: center; color: var(--muted); }
.auth__switch a { font-weight: 600; }
.auth__back { font-size: 14px; color: var(--soft); text-decoration: none; }
.auth__back:hover { color: var(--green); text-decoration: underline; }
.badge { display: inline-block; background: var(--mango-tint); color: var(--mango-ink); font-weight: 700; font-size: 13px; padding: 4px 12px; border-radius: 999px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field__error { color: var(--danger); font-size: 13px; font-weight: 500; }
input[aria-invalid=true] { border-color: var(--danger); background: #FFF8F7; }
input:focus-visible { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(14, 90, 67, .18); }
.password { position: relative; }
.password input { padding-right: 92px; }
.password__toggle { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); min-height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--green); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.password__toggle:hover { background: var(--green-tint); }
.check a { font-weight: 600; }
.check input { width: 18px; height: 18px; flex: none; accent-color: var(--green); }
.btn--block { width: 100%; min-height: 50px; font-size: 16px; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth__aside { padding: 20px 24px; gap: 0; }
  .auth__pitch, .auth__legal { display: none; }
  .auth__brand img { height: 34px; }
  .auth__main { justify-content: flex-start; padding: 28px 20px 40px; }
}
@media (max-width: 520px) {
  .field-row { grid-template-columns: 1fr; }
  h1 { font-size: 26px; }
}

@media (max-width: 1200px) {
  .inbox { grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); height: calc(100dvh - 72px); }
  .main { padding: 24px 20px 48px; }
}
@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; min-height: 100dvh; }
  .sidebar { position: sticky; top: 0; z-index: 40; height: auto; max-height: 100dvh; overflow-y: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; }
  .brand { padding: 0 4px; flex: 1; min-width: 0; }
  .sidebar nav { display: flex; flex-direction: row; flex-wrap: nowrap; gap: 4px; width: 100%; overflow-x: auto; }
  .sidebar a.nav { flex: 0 0 auto; }
  .sidebar .footer { flex: 1 0 100%; margin: 0; padding: 8px 8px 0; border-top: 1px solid rgba(255,255,255,.1); }
  .main { padding: 12px 12px calc(16px + env(safe-area-inset-bottom)); }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 16px; }
  .tabs button, .tabs a.tab { min-height: 40px; }
  .inbox { height: calc(100dvh - 148px); min-height: 420px; }
  .messages { min-height: 0; padding: 12px; }
  .composer { padding: 10px 12px; }
  .composer .row, .composer-tools { flex-wrap: wrap; }
  .bubble { max-width: 88%; }
  .emoji-panel, .location-panel { left: 8px; right: 8px; width: auto; }
  .emoji-panel emoji-picker { width: 100%; height: min(360px, 46dvh); }
}
@media (max-width: 720px) {
  /* minmax(0, …) : une ligne longue (nom, aperçu) ne doit pas élargir la colonne au-delà de l'écran. */
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .inbox-list { max-height: none; height: 100%; border-right: 0; min-width: 0; }
  .inbox:not(.show-thread) > .thread { display: none; }
  .inbox.show-thread .inbox-list { display: none; }
  .inbox.show-thread > .thread { display: flex; height: 100%; min-height: 0; }
  .icon-btn.thread-back { display: inline-grid; flex: none; }
  .composer-tools { width: 100%; }
}
@media (max-width: 640px) {
  h1 { font-size: 26px; }
  .big-number { font-size: 36px; }
  .kpi-value { font-size: 26px; }
  .thread-actions, .assign { width: 100%; }
  .assign select { flex: 1; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* Paiement Mobile Money : choix de l'opérateur (logos) et page d'attente. */
.pay-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.pay-option { position: relative; display: block; cursor: pointer; }
.pay-option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pay-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 110px; padding: 14px; border: 2px solid var(--line); border-radius: var(--radius); background: var(--white); font-weight: 600; font-size: 14px; text-align: center; transition: border-color .15s, box-shadow .15s; }
.pay-option:hover .pay-card { border-color: var(--green); }
.pay-option input:checked + .pay-card { border-color: var(--green); background: var(--green-tint); box-shadow: 0 0 0 3px rgba(14, 90, 67, .15); }
.pay-option input:focus-visible + .pay-card { outline: 3px solid var(--mango); outline-offset: 2px; }
.pay-icon { width: 56px; height: 56px; object-fit: contain; border-radius: 10px; }
.pay-wait { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
/* Aperçu d'une campagne : le message comme dans WhatsApp, puis le récapitulatif. */
.wa-preview { display: flex; flex-direction: column; gap: 4px; padding: 16px 16px 16px 24px; border-radius: 12px; background: #EFEAE2; }
.wa-preview .bubble { max-width: 100%; }
.wa-preview .wa-footer { display: block; margin-top: 4px; font-size: 12.5px; color: #667781; }
.wa-buttons { display: flex; flex-direction: column; gap: 2px; max-width: 100%; }
.wa-buttons span { display: block; padding: 8px; border-radius: 8px; background: var(--white); color: #027EB5; font-size: 14px; font-weight: 600; text-align: center; box-shadow: 0 1px 0.5px rgba(11, 20, 26, .13); }
.recap { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.recap > div { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px; }
.recap dt { font-weight: 700; color: var(--muted); }
.recap dd { margin: 0; display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 560px) { .recap > div { grid-template-columns: 1fr; gap: 2px; } }
/* Agenda : rendez-vous par jour, réglages des services, horaires et fermetures. */
.agenda-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tabs a.tab { font-size: 13px; font-weight: 600; border: 1px solid var(--line); background: var(--white); color: var(--ink); border-radius: 999px; padding: 6px 12px; min-height: 32px; text-decoration: none; }
.tabs a.tab[aria-current=page] { background: var(--ink); color: var(--white); border-color: var(--ink); }
.agenda-week-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.agenda-day { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.agenda-day h2 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.agenda-list tr.is-cancelled td { color: var(--soft); }
.agenda-list tr.is-cancelled td strong { text-decoration: line-through; }
.agenda-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
.agenda-cancel summary { list-style: none; }
.agenda-cancel summary::-webkit-details-marker { display: none; }
.agenda-cancel[open] summary { margin-bottom: 8px; }
.agenda-cancel form { width: min(320px, 80vw); padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #F9FBFA; }
.agenda-form { padding-top: 16px; border-top: 1px solid var(--line); }
.agenda-form h3 { font-size: 16px; }
.agenda-hours { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.agenda-hours li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.agenda-hours li > strong { width: 90px; }
.agenda-range { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--green-tint); color: #0B4A37; font-size: 14px; font-weight: 600; }
.link-btn { border: 0; padding: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--danger); text-decoration: underline; cursor: pointer; }
.agenda-days { display: flex; flex-wrap: wrap; gap: 8px 16px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
/* Modèles : exemple de message proposé pour la catégorie choisie. */
.tpl-example { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 14px; border: 1px dashed var(--line); border-radius: 12px; background: #F7F9F7; }
.tpl-example-text { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--white); white-space: pre-wrap; overflow-wrap: anywhere; align-self: stretch; }
/* Abonnement : détail concret de chaque forfait. */
.plan-details { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.plan-details strong { color: var(--ink); font-weight: 600; }
.agent-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }

/* Outils de WhatsApp Business : étiquettes, menu « Plus », recherche, réponses rapides, panneau « + ». */
.label-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.label-chip.c-green { background: #DCEBE2; color: #0B4A37; }
.label-chip.c-blue { background: #DDEBF7; color: #0B4F7A; }
.label-chip.c-orange { background: #FDEBD3; color: #8A4B00; }
.label-chip.c-red { background: #F8E1DD; color: #8E2316; }
.label-chip.c-purple { background: #ECE3F6; color: #5A2D82; }
.label-chip.c-gray { background: #E8ECEA; color: var(--muted); }
.conv-labels, .thread-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.thread-labels:empty { display: none; }
.more { position: relative; }
.more > summary { list-style: none; cursor: pointer; }
.more > summary::-webkit-details-marker { display: none; }
.more-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 25; display: flex; flex-direction: column; width: max-content; min-width: 220px; padding: 6px; border-radius: 12px; background: var(--white); box-shadow: 0 6px 24px rgba(11, 20, 26, .18); }
.more-menu button { white-space: nowrap; padding: 10px 12px; border: 0; border-radius: 8px; background: none; font: inherit; text-align: left; cursor: pointer; }
.more-menu button:hover, .more-menu button:focus-visible { background: rgba(11, 20, 26, .06); }
.labels-panel { display: flex; flex-direction: column; gap: 8px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: #F7F9F7; }
.labels-panel[hidden], .thread-search[hidden], .blocked-note[hidden], .qr-panel[hidden], .extra-panel[hidden] { display: none; }
.thread-search { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 8px 20px; border-bottom: 1px solid var(--line); background: #F7F9F7; }
.search-results { grid-column: 1 / -1; max-height: 220px; overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.search-results:empty { display: none; }
.search-results button { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.search-results button:hover, .search-results button:focus-visible { background: rgba(11, 20, 26, .06); }
.bubble.found { box-shadow: 0 0 0 3px rgba(239, 160, 32, .7); }
.blocked-note { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 20px 0; }
.qr-panel { position: absolute; left: 20px; right: 20px; bottom: calc(100% - 8px); z-index: 20; display: flex; flex-direction: column; max-height: 280px; overflow-y: auto; padding: 6px; border-radius: 12px; background: var(--white); box-shadow: 0 6px 24px rgba(11, 20, 26, .18); }
.qr-panel button { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 0; border-radius: 8px; background: none; font: inherit; text-align: left; cursor: pointer; }
.qr-panel button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--muted); }
.qr-panel button[aria-selected="true"], .qr-panel button:hover { background: var(--green-tint); }
.qr-panel p { margin: 6px 8px; }
.extra-panel { position: absolute; left: 20px; bottom: calc(100% - 8px); z-index: 20; display: flex; flex-direction: column; gap: 14px; width: min(380px, calc(100vw - 48px)); max-height: 70vh; overflow-y: auto; padding: 14px 16px; border-radius: 12px; background: var(--white); box-shadow: 0 6px 24px rgba(11, 20, 26, .18); }
.extra-part { display: flex; flex-direction: column; gap: 6px; }
.extra-part + .extra-part { padding-top: 12px; border-top: 1px solid var(--line); }
.btn-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; }

/* Bulles : transféré, carte de contact, commande, boutons envoyés, produit. */
.bubble .forwarded { display: block; margin-bottom: 2px; font-size: 12px; font-style: italic; color: #667781; }
.bubble .contact-card { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 4px; padding: 8px; border-radius: 8px; background: rgba(11, 20, 26, .05); }
.bubble .cc-avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #DFE5E7; color: var(--muted); font-weight: 700; }
.bubble .cc-body { display: flex; flex-direction: column; min-width: 0; }
.bubble .cc-name { font-weight: 700; }
.bubble .cc-phone { font-size: 13px; color: #54656F; }
.bubble .cc-actions { display: flex; gap: 12px; width: 100%; padding-top: 6px; border-top: 1px solid rgba(11, 20, 26, .08); font-size: 13.5px; font-weight: 600; }
.bubble .cc-actions a { color: #027EB5; text-decoration: none; }
.bubble .order-card { display: flex; flex-direction: column; gap: 4px; margin: 0 0 4px; padding: 8px 10px; border-radius: 8px; background: rgba(11, 20, 26, .05); }
.bubble .oc-head { font-weight: 700; }
.bubble .oc-items { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.bubble .oc-total { font-weight: 700; color: var(--green); }
.bubble .sent-buttons { display: flex; flex-direction: column; gap: 4px; margin: 6px -4px 4px; }
.bubble .sent-buttons span { padding: 7px; border-radius: 6px; background: rgba(255, 255, 255, .7); color: #027EB5; font-weight: 600; text-align: center; }
.bubble .product-card { display: block; margin: 0 0 4px; padding: 8px 10px; border-radius: 8px; background: rgba(11, 20, 26, .05); }

/* Téléphone : en-tête de conversation sur une ligne, zone de réponse compacte, panneaux dans l'écran. */
@media (max-width: 720px) {
  .inbox-tools { gap: 8px; }
  .inbox-tools .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; padding: 0 4px; }
  .inbox-tools .tabs::-webkit-scrollbar { display: none; }
  .inbox-tools .tabs button { flex: 0 0 auto; }
  #notify-btn { min-height: 36px; }

  .thread-head { flex-wrap: wrap; gap: 6px 8px; padding: 8px 10px; }
  .thread-title { flex: 1; min-width: 0; }
  .thread-title h2 { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .thread-actions { width: 100%; flex-wrap: nowrap; gap: 6px; }
  /* « Attribuée à » reste lu par les lecteurs d'écran, mais ne prend pas de place. */
  .thread-actions .assign { flex: 1; min-width: 0; width: auto; font-size: 0; gap: 0; }
  .thread-actions .assign select { width: 100%; font-size: 14px; padding: 6px 8px; }
  .thread-actions .btn.small, .more > summary.btn { min-height: 36px; padding: 0 10px; }
  .more-menu { right: 0; max-width: calc(100vw - 24px); }

  .labels-panel { flex-direction: row; flex-wrap: wrap; gap: 6px 14px; padding: 8px 12px; max-height: 30dvh; overflow-y: auto; }
  .thread-search { padding: 6px 10px; }
  .search-results { max-height: 35dvh; }
  .blocked-note { margin: 6px 10px 0; padding: 10px 12px; }

  .composer { gap: 6px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .window-note { padding: 6px 10px; font-size: 13px; }
  .composer-tools { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .composer-tools::-webkit-scrollbar { display: none; }
  .composer-tools .icon-btn { flex: none; width: 40px; height: 40px; }
  .composer #free-reply { align-items: flex-end; gap: 8px; }
  /* 16 px évite le zoom automatique de Safari. */
  .composer textarea { font-size: 16px; min-height: 44px; max-height: 30dvh; }
  .composer #send-btn { flex: none; min-height: 44px; padding: 0 14px; }

  .qr-panel { left: 8px; right: 8px; max-height: 45dvh; }
  .extra-panel { left: 8px; right: 8px; width: auto; max-height: 62dvh; }
  .attach-preview.visual img, .attach-preview.visual video { max-height: 32dvh; }
  .bubble .contact-card, .bubble .order-card { min-width: 0; }
}

/* Barre de mise en forme au-dessus de la zone de réponse, et aperçu du rendu chez le client. */
.reply-box { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.format-bar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.format-bar button { display: grid; place-items: center; min-width: 32px; height: 30px; padding: 0 6px; border: 0; border-radius: 6px; background: none; color: var(--muted); font: inherit; font-size: 15px; cursor: pointer; }
.format-bar button:hover, .format-bar button:focus-visible { background: rgba(11, 20, 26, .07); color: var(--ink); }
.format-bar button:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.format-bar .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.fmt-sep { flex: none; width: 1px; height: 22px; margin: 0 6px; background: var(--line); align-self: center; }
/* Outils et mise en forme sur une ligne ; le champ de réponse prend toute la largeur dessous. */
.composer #free-reply { flex-wrap: wrap; }
.composer #free-reply > .composer-tools { width: 100%; align-items: center; }
.format-preview { padding: 6px 10px; border-radius: 8px; background: #D9FDD3; font-size: 14px; }
.format-preview[hidden] { display: none; }
.format-preview .fp-label { display: block; font-size: 11px; font-weight: 700; color: var(--green); text-transform: uppercase; letter-spacing: .03em; }
.format-preview .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .text .q-line, .format-preview .q-line { display: inline-block; padding-left: 8px; border-left: 3px solid rgba(11, 20, 26, .25); color: #54656F; }
/* Rendu WhatsApp explicite (italique, barré) même si une feuille ou une police l'écrase. */
.bubble .text em, .format-preview .text em { font-style: italic; }
.bubble .text s, .format-preview .text s { text-decoration: line-through; }
@media (max-width: 720px) {
  .composer #free-reply > .reply-box { flex: 1 1 0; min-width: 0; }
  .reply-box > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  /* Téléphone : les outils passent à la ligne au lieu de défiler, la mise en forme a sa propre ligne. */
  .composer #free-reply > .composer-tools { flex-wrap: wrap; overflow: visible; row-gap: 4px; }
  .composer-tools > .fmt-sep { display: none; }
  /* Fil ouvert : le pied du menu (compte, déconnexion) laisse sa place aux messages ; il revient sur la liste. */
  .shell:has(.inbox.show-thread) .sidebar .footer { display: none; }
  .format-preview { max-height: 22dvh; overflow-y: auto; }
  .composer-tools > .format-bar { flex: 1 1 100%; min-width: 0; flex-wrap: wrap; gap: 2px; padding-top: 4px; border-top: 1px solid var(--line); }
  .format-bar button { flex: 1 0 36px; min-width: 36px; max-width: 56px; height: 36px; font-size: 16px; }
}

/* Packs de messages (page Facturation) */
.pack-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.pack-type h3, #packs h3 { font-size: 16px; margin-bottom: 8px; }
.pack-sizes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pack-sizes form { display: contents; }
.pack-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; height: auto; padding: 10px 12px; text-align: left; white-space: normal; }
.pack-units { font-family: var(--display); font-weight: 800; font-size: 20px; line-height: 1.1; }
.pack-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.pack-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (max-width: 900px) { .pack-grid { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .pack-btn { padding: 8px; font-size: 13px; } .pack-units { font-size: 18px; } }

/* Numéro avec sélecteur de pays (partials/phone-field) */
.phone-field { position: relative; }
.phone-field__row { display: flex; gap: 8px; align-items: stretch; }
.phone-field__country { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; min-width: 44px; padding: 0 8px; flex: none; border: 1px solid #C9D3CC; border-radius: 10px; background: var(--green-tint); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.phone-field__country:focus-visible { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(14, 90, 67, .18); }
.phone-field__row input[type=tel] { flex: 1; min-width: 0; min-height: 44px; padding-left: 10px; padding-right: 10px; }
.phone-field__panel { position: absolute; z-index: 20; top: calc(100% - 4px); left: 0; right: 0; max-width: 360px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(20, 35, 28, .16); padding: 8px; }
.phone-field__panel[hidden] { display: none; }
.phone-field__search { width: 100%; min-height: 44px; font: inherit; border: 1px solid #C9D3CC; border-radius: 10px; padding: 0 12px; }
.phone-field__list { list-style: none; margin: 8px 0 0; padding: 0; max-height: 260px; overflow-y: auto; }
.phone-field__list li { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px; border-radius: 8px; cursor: pointer; font-weight: 500; }
.phone-field__list li[hidden] { display: none; }
.phone-field__list li:hover, .phone-field__list li[aria-selected=true] { background: var(--green-tint); }
.phone-field__dial { margin-left: auto; color: var(--soft); font-weight: 400; }
