/* Messagerie interne v2, charte DOUMKO (docs/CHARTE_GRAPHIQUE.md). Aucune ressource externe. */
.chx { --acc: #3F6B12; --acc-h: #2F5A0E; --acc-t: #F1F8E8; --acc-l: #8BC044;
  --bg: #fff; --panel: #fff; --soft: #F4F6F2; --line: #DDE3D6; --ink: #1A1A1A; --muted: #5C6358; --wall: #EEF2EA;
  --bin: #fff; --bout: var(--acc); --bout-ink: #fff; --red: #B42318; --green: #2E7D32; --shadow: 0 4px 16px rgba(20, 40, 10, .08); color-scheme: light; }
.chx.acc-foret { --acc: #1F5F3F; --acc-h: #174A31; --acc-t: #E8F3EC; --acc-l: #6FBF73; }
.chx.acc-olive { --acc: #5B6B10; --acc-h: #46530C; --acc-t: #F3F5E3; --acc-l: #A8B83A; }
.chx.acc-encre { --acc: #2B2B2B; --acc-h: #111; --acc-t: #EFF1EC; --acc-l: #8BC044; }
.chx.dark { --bg: #121812; --panel: #182018; --soft: #1E271D; --line: #2D392B; --ink: #E7ECE3; --muted: #A6B0A1; --wall: #0E140E;
  --bin: #222D21; --acc-t: rgba(139, 192, 68, .14); --shadow: 0 4px 16px rgba(0, 0, 0, .35); color-scheme: dark; }
.chx.dark.acc-encre { --acc: #5E6B57; --acc-h: #4C5747; }
.chx.dark.acc-doumko { --acc: #4E8418; --acc-h: #3F6B12; }

/* Neutralise les styles d'éléments de la page hôte (application agent / tableau de bord). */
:is(.ch, .ch-dlg, .chc, .ch-menu) :where(label, input, select, textarea, h2, h3, h4, p, dl, dd) { display: revert; margin: 0; padding: 0; width: auto; font-size: inherit; font-weight: inherit; border: 0; border-radius: 0; background: none; color: inherit; box-shadow: none; }
:is(.ch, .ch-dlg, .chc, .ch-menu) :where(h2, h3, h4) { font-weight: 700; }
:is(.ch, .ch-dlg, .chc, .ch-menu) [hidden] { display: none !important; }
.ch { display: grid; grid-template-columns: minmax(280px, 340px) 1fr; height: 100%; min-height: 520px; background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; position: relative; font-size: 14px; }
.ch.info-open { grid-template-columns: minmax(280px, 340px) 1fr minmax(280px, 340px); }
.ch *, .ch-dlg *, .chc *, .ch-menu * { box-sizing: border-box; }
.ch button, .ch-dlg button, .ch-menu button, .chc button { font: inherit; color: inherit; cursor: pointer; }
.ch-ic { display: inline-grid; place-items: center; width: 38px; height: 38px; border: 0; background: transparent; border-radius: 50%; color: var(--muted); flex: none; }
.ch-ic:hover { background: var(--soft); color: var(--ink); }
.ch-ic.sm { width: 32px; height: 32px; }
.ch-ic.acc { color: var(--acc); }
.ch-ic:focus-visible, .ch button:focus-visible, .ch-dlg button:focus-visible, .ch-item:focus-visible { outline: 3px solid var(--acc-l); outline-offset: 1px; }
.ch-muted { color: var(--muted); font-size: 13px; margin: 2px 0; }

/* Avatars */
.ch-av { --s: 40px; position: relative; flex: none; width: var(--s); height: var(--s); border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--acc-t) center / cover no-repeat; color: var(--acc); font-weight: 700; font-size: calc(var(--s) * .36); border: 1px solid var(--line); }
.ch-av.grp { background-color: var(--acc); color: #fff; border-color: transparent; }
.ch-dot { position: absolute; right: 0; bottom: 0; width: 28%; height: 28%; min-width: 10px; min-height: 10px; border-radius: 50%; background: #9AA394; border: 2px solid var(--panel); }
.ch-dot.on { background: #2EA043; }
.ch-avsp { width: 30px; flex: none; }

/* Barre latérale */
.ch-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--panel); position: relative; }
.ch-sh { border-bottom: 1px solid var(--line); padding: 10px 12px; min-height: 62px; display: flex; align-items: center; }
.ch-sh-n { display: flex; align-items: center; width: 100%; }
.ch-sh-r { margin-left: auto; display: flex; gap: 2px; }
.ch-me { border: 0; background: none; padding: 0; border-radius: 50%; }
.ch-sbar { display: flex; align-items: center; gap: 6px; width: 100%; }
.ch-sbar input { flex: 1; border: 1px solid var(--line); background: var(--soft); color: var(--ink); border-radius: 20px; padding: 9px 14px; font: inherit; min-width: 0; }
.ch-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.ch-tabs button { position: relative; border: 0; background: none; padding: 10px 4px 8px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform:none; letter-spacing: .03em; border-bottom: 3px solid transparent; }
.ch-tabs button.on { color: var(--acc); border-bottom-color: var(--acc); background: var(--acc-t); }
.ch-tb:not(:empty) { position: absolute; top: 5px; left: calc(50% + 8px); background: var(--acc); color: #fff; border-radius: 9px; font-size: 10.5px; padding: 1px 6px; }
.ch-tb.red:not(:empty) { background: var(--red); }
.ch-sbody { flex: 1; overflow-y: auto; min-height: 0; padding-bottom: 84px; }
.ch-seg { display: flex; margin: 12px auto; width: max-content; width: fit-content; background: var(--soft); border-radius: 8px; padding: 3px; gap: 2px; border: 1px solid var(--line); }
.ch-seg button { border: 0; background: none; padding: 7px 14px; border-radius: 6px; font-size: 12px; font-weight: 700; text-transform:none; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.ch-seg button.on { background: var(--acc); color: #fff; }
.ch-seg button b { background: rgba(255, 255, 255, .9); color: var(--acc); border-radius: 8px; padding: 0 6px; font-size: 11px; }
.ch-seg button:not(.on) b { background: var(--acc); color: #fff; }
.ch-items { display: flex; flex-direction: column; }
.ch-item { position: relative; display: flex; gap: 11px; align-items: center; padding: 11px 14px 11px 12px; border-bottom: 1px solid var(--line); cursor: pointer; border-left: 4px solid transparent; }
.ch-item:hover { background: var(--soft); }
.ch-item.on { background: var(--acc-t); border-left-color: var(--acc); }
.ch-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ch-meta b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ch-top time { font-size: 11.5px; color: var(--muted); flex: none; }
.ch-item.unread .ch-top time { color: var(--acc); font-weight: 700; }
.ch-bot { display: flex; align-items: center; gap: 6px; }
.ch-prev { flex: 1; min-width: 0; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.ch-prev > * { flex: none; }
.ch-prev em { font-style: normal; color: var(--acc); font-weight: 600; }
.ch-prev.red, .ch-prev.red svg { color: var(--red); }
.ch-item.unread .ch-prev { color: var(--ink); font-weight: 600; }
.ch-flags { display: flex; gap: 5px; align-items: center; color: var(--muted); flex: none; }
.ch-badge { background: var(--acc); color: #fff; border-radius: 10px; font-size: 11px; min-width: 20px; height: 20px; padding: 0 6px; display: inline-grid; place-items: center; }
.ch-badge.muted { background: #9AA394; }
.ch-fac { font-size: 11px; color: var(--muted); }
.ch-rowm { position: absolute; right: 6px; bottom: 6px; border: 0; background: var(--panel); border-radius: 50%; width: 26px; height: 26px; display: none; place-items: center; color: var(--muted); box-shadow: var(--shadow); }
.ch-item:hover .ch-rowm, .ch-rowm:focus-visible { display: grid; }
.ch-typ { color: var(--acc); font-style: italic; }
.ch-none { color: var(--muted); padding: 18px; text-align: center; font-size: 13px; }
.ch-tick { display: inline-flex; color: var(--muted); vertical-align: middle; }
.ch-tick.read { color: var(--acc-l); }
.ch-lh { margin: 0; padding: 8px 16px 4px 14px; font-size: 12px; color: var(--acc); font-weight: 700; display: flex; gap: 6px; align-items: center; background: var(--panel); position: sticky; top: 0; z-index: 1; border-bottom: 1px solid var(--line); }
.ch-cwrap { position: relative; }
.ch-cwrap .ch-items { margin-left: 24px; border-left: 1px solid var(--line); }
.ch-az { position: absolute; left: 0; top: 4px; width: 24px; align-items: center; display: flex; flex-direction: column; z-index: 2; }
.ch-az button { border: 0; background: none; font-size: 10.5px; line-height: 1.25; padding: 1px 4px; color: var(--acc); font-weight: 700; }
.ch-az button:disabled { color: var(--line); cursor: default; }
.ch-facp { display: flex; align-items: center; gap: 6px; padding: 10px 12px 4px; color: var(--muted); }
.ch-facp select { flex: 1; }
.ch-invite { margin: 14px auto; }
.ch-chip { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: var(--acc-t); color: var(--acc); }
.ch-chip.red { background: #FDECEA; color: var(--red); }

/* FAB */
.ch-fab { position: absolute; right: 16px; bottom: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; z-index: 5; }
.ch-fab-main { width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--acc); color: #fff !important; box-shadow: 0 6px 18px rgba(20, 50, 10, .3); display: grid; place-items: center; transition: transform .2s; }
.ch-fab-main:hover { background: var(--acc-h); }
.ch-fab-main.open { transform: rotate(45deg); }
.ch-fab-items { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.ch-fab-items button { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; }
.ch-fab-items span { background: var(--panel); color: var(--ink); border-radius: 6px; padding: 5px 10px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow); border: 1px solid var(--line); }
.ch-fab-items svg { box-sizing: content-box; padding: 10px; border-radius: 50%; background: var(--panel); color: var(--acc); box-shadow: var(--shadow); border: 1px solid var(--line); }

/* Zone centrale */
.ch-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--wall); }
.ch-empty { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); max-width: 340px; padding: 24px; }
.ch-empty b { color: var(--ink); font-size: 17px; }
.ch-empty-ic { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; background: var(--acc-t); color: var(--acc); }
.ch-th { display: flex; align-items: center; gap: 6px; padding: 8px 10px; min-height: 62px; background: var(--panel); border-bottom: 1px solid var(--line); }
.ch-back { display: none; }
.ch-hwho { display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; flex: 1; min-width: 0; padding: 2px 4px; border-radius: 8px; }
.ch-hmeta { display: flex; flex-direction: column; min-width: 0; }
.ch-hmeta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.ch-hmeta small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-mut { color: var(--muted); display: inline-flex; }
.ch-hacts { display: flex; gap: 2px; }
.ch-tsearch { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); color: var(--muted); }
.ch-tsearch input { flex: 1; border: 1px solid var(--line); border-radius: 18px; padding: 7px 12px; background: var(--soft); color: var(--ink); font: inherit; }
.ch-sres { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.ch-sres small { display: block; color: var(--muted); margin-bottom: 2px; }
.ch-sres mark { background: var(--acc-l); color: #000; border-radius: 3px; padding: 0 2px; }

.ch-msgs { flex: 1; overflow-y: auto; padding: 14px 18px 8px; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.ch-msgs.wp-feuilles { background-image: radial-gradient(ellipse 14px 7px at 20px 20px, rgba(139, 192, 68, .16) 98%, transparent), radial-gradient(ellipse 7px 14px at 60px 54px, rgba(63, 107, 18, .10) 98%, transparent); background-size: 80px 80px; }
.ch-msgs.wp-points { background-image: radial-gradient(rgba(63, 107, 18, .16) 1.4px, transparent 1.6px); background-size: 18px 18px; }
.ch-msgs.wp-sable { background: linear-gradient(160deg, #F6F1E4, #EDE6D3); }
.ch-msgs.wp-nuit { background: linear-gradient(160deg, #1D2A1C, #121912); }
.chx.dark .ch-msgs.wp-sable { background: linear-gradient(160deg, #2A2619, #1C1A12); }
.ch-day { text-align: center; margin: 12px 0 6px; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.ch-day::before, .ch-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.ch-day span { background: var(--panel); padding: 3px 12px; border-radius: 10px; border: 1px solid var(--line); text-transform:none; }
.ch-sys { align-self: center; text-align: center; font-size: 12px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px; margin: 6px 0; max-width: 90%; }
.ch-sys.err { color: var(--red); }
.ch-row { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.ch-row.first { margin-top: 8px; }
.ch-row.me { justify-content: flex-end; }
.ch-row.flash .ch-bub { box-shadow: 0 0 0 3px var(--acc-l); }
.ch-bcol { display: flex; flex-direction: column; max-width: min(74%, 560px); min-width: 0; }
.ch-row.me .ch-bcol { align-items: flex-end; }
.ch-bwrap { display: flex; align-items: center; gap: 4px; max-width: 100%; }
.ch-row.me .ch-bwrap { flex-direction: row-reverse; }
.ch-bub { position: relative; background: var(--bin); border-radius: 12px; padding: 8px 11px 6px; box-shadow: 0 2px 8px rgba(20, 40, 10, .08); min-width: 64px; max-width: 100%; overflow-wrap: anywhere; border: 1px solid var(--line); }
.ch-row.me .ch-bub { background: var(--bout); color: var(--bout-ink); border-color: transparent; }
.ch-row.me .ch-bub .ch-time, .ch-row.me .ch-bub .ch-tick, .ch-row.me .ch-fwd { color: rgba(255, 255, 255, .85); }
.ch-row.me .ch-tick.read { color: #CFEA9F; }
.ch-bub.media { padding: 4px 4px 4px; }
.ch-bub.media .ch-text { padding: 4px 6px 0; }
.ch-bub.media .ch-time { padding: 0 6px 2px; }
.ch-bub.pending { opacity: .8; }
.ch-bub.failed { outline: 2px solid var(--red); }
.ch-bub.deleted { background: transparent !important; color: var(--muted) !important; border: 1px dashed var(--line) !important; box-shadow: none; }
.ch-del { font-style: italic; display: flex; gap: 6px; align-items: center; }
.ch-who { display: block; font-size: 12px; font-weight: 700; color: var(--acc); margin-bottom: 2px; }
.chx.dark .ch-who { color: var(--acc-l); }
.ch-fwd { display: flex; gap: 4px; align-items: center; font-size: 11.5px; color: var(--muted); font-style: italic; margin-bottom: 2px; }
.ch-text { line-height: 1.42; white-space: normal; }
.ch-time { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); margin-top: 2px; }
.ch-star { display: inline-flex; color: #C99A00; }
.ch-mact { border: 0; background: transparent; color: var(--muted); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; opacity: 0; flex: none; }
.ch-row:hover .ch-mact, .ch-mact:focus-visible { opacity: 1; }
.ch-mact:hover { background: var(--panel); }
@media (pointer: coarse) { .ch-mact { opacity: .7; } }
.ch-quote { display: flex; flex-direction: column; text-align: left; width: 100%; border: 0; border-left: 3px solid var(--acc-l); background: rgba(0, 0, 0, .05); border-radius: 6px; padding: 5px 8px; margin-bottom: 4px; font-size: 12.5px; }
.ch-row.me .ch-quote { background: rgba(255, 255, 255, .16); color: #fff; }
.ch-quote b { font-size: 12px; } .ch-quote span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 320px; opacity: .9; }
.ch-reacts { display: flex; gap: 4px; flex-wrap: wrap; margin-top: -4px; padding: 0 8px; z-index: 1; }
.ch-reacts button { border: 1px solid var(--line); background: var(--panel); border-radius: 12px; padding: 1px 7px; font-size: 12.5px; }
.ch-reacts button.mine { border-color: var(--acc); background: var(--acc-t); }
.ch-grid { display: grid; gap: 4px; border-radius: 9px; overflow: hidden; }
.ch-grid.n1 { grid-template-columns: minmax(180px, 280px); }
.ch-grid.n2 { grid-template-columns: repeat(2, 140px); }
.ch-grid.n3 { grid-template-columns: repeat(3, 110px); }
.ch-grid.n4 { grid-template-columns: repeat(2, 140px); }
.ch-tile { position: relative; border: 0; padding: 0; background: var(--soft); aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; border-radius: 6px; }
.ch-grid.n1 .ch-tile { aspect-ratio: 4 / 3; }
.ch-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ch-tph { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.ch-more { position: absolute; inset: 0; background: rgba(0, 0, 0, .5); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.ch-tmore { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; background: rgba(0, 0, 0, .45); color: #fff; display: none; place-items: center; }
.ch-tile:hover .ch-tmore, .ch-tmore:focus-visible { display: grid; }
.ch-filec { display: flex; align-items: center; gap: 10px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 8px 6px 8px 8px; min-width: 220px; max-width: 320px; }
.ch-filec.flat { min-width: 0; max-width: none; margin-bottom: 6px; }
.ch-fi { width: 38px; height: 44px; border-radius: 6px; display: grid; place-items: center; font-size: 10.5px; font-weight: 800; color: #fff; flex: none; }
.ch-fi.pdf { background: #B42318; } .ch-fi.doc { background: #2B5797; } .ch-fi.xls { background: #1D6F42; } .ch-fi.aud { background: #6B4FA0; } .ch-fi.txt { background: #6B7280; }
.ch-fn { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ch-fn b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.ch-fn small { color: var(--muted); font-size: 11.5px; }
.ch-voice { display: flex; align-items: center; gap: 8px; min-width: 210px; }
.ch-play { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--acc); color: #fff !important; display: grid; place-items: center; flex: none; }
.ch-row.me .ch-play { background: #fff; color: var(--acc) !important; }
.ch-wave { flex: 1; height: 30px; fill: currentColor; opacity: .45; }
.ch-wave rect.on { opacity: 1; fill: var(--acc-l); }
.ch-dur { font-size: 12px; font-variant-numeric: tabular-nums; }
.ch-typing { display: flex; gap: 4px; padding: 12px 14px; min-width: 0; }
.ch-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: chdot 1.2s infinite; }
.ch-typing i:nth-child(2) { animation-delay: .2s; } .ch-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes chdot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ch-typing i { animation: none; } .ch-fab-main { transition: none; } }

/* Saisie */
.ch-compbox { position: relative; background: var(--panel); border-top: 1px solid var(--line); }
.ch-comp { display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px; }
.ch-inbox { flex: 1; display: flex; align-items: flex-end; gap: 0; border: 1px solid var(--line); border-radius: 22px; background: var(--soft); padding: 3px 4px 3px 14px; min-width: 0; }
.ch-inbox:focus-within { border-color: var(--acc); }
.ch-inbox textarea { flex: 1; resize: none; border: 0; background: transparent; color: var(--ink); font: inherit; padding: 8px 0; max-height: 140px; outline: none; min-width: 0; }
.ch-send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--acc); color: #fff !important; display: grid; place-items: center; flex: none; }
.ch-send:hover { background: var(--acc-h); }
.ch-comp:not(.has-text) .ch-send { display: none; }
.ch-comp.has-text .ch-mic { display: none; }
.ch-mic { width: 44px; height: 44px; background: var(--acc-t); color: var(--acc); }
.ch-replybar { display: flex; align-items: center; gap: 8px; padding: 8px 12px 0; }
.ch-replybar > div { flex: 1; min-width: 0; }
.ch-rec { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.ch-rec canvas { flex: 1; min-width: 0; height: 36px; }
.ch-recdot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: chpulse 1s infinite; }
@keyframes chpulse { 50% { opacity: .3; } }
.ch-blk { display: flex; align-items: center; gap: 8px; justify-content: center; padding: 14px; margin: 0; color: var(--muted); }
.ch-emo { position: absolute; bottom: 100%; left: 8px; width: min(340px, calc(100% - 16px)); max-height: 300px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 8px; z-index: 6; }
.ch-ecat small { display: block; color: var(--muted); font-size: 11px; font-weight: 700; text-transform:none; margin: 6px 4px 2px; }
.ch-ecat div { display: flex; flex-wrap: wrap; }
.ch-ecat button { border: 0; background: none; font-size: 22px; width: 38px; height: 38px; border-radius: 8px; }
.ch-ecat button:hover { background: var(--soft); }

/* Panneau d'informations */
.ch-info { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--panel); }
.ch-info[hidden] { display: none; }
.ch-ih { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 10px 18px; min-height: 62px; border-bottom: 1px solid var(--line); }
.ch-ih h3 { margin: 0; font-size: 16px; }
.ch-ibody { flex: 1; overflow-y: auto; padding: 16px; }
.ch-ihero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.ch-ihero h2 { margin: 8px 0 0; font-size: 19px; }
.ch-cap { text-transform:none; font-size: 11.5px; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin: 2px 0; }
.ch-pills { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.ch-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 20px; padding: 7px 14px; font-weight: 600; color: var(--acc) !important; }
.ch-pill:hover { background: var(--acc-t); }
.ch-pill:disabled { opacity: .45; cursor: not-allowed; }
.ch-dl { margin: 0 0 12px; display: grid; gap: 2px; }
.ch-dl > div { display: grid; grid-template-columns: 22px 110px 1fr; gap: 8px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); color: var(--muted); }
.ch-dl dt { font-size: 12.5px; } .ch-dl dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.ch-dl a, .ch-link { color: var(--acc); font-weight: 600; }
.chx.dark .ch-dl a, .chx.dark .ch-link { color: var(--acc-l); }
.ch-dl.two { grid-template-columns: 1fr 1fr; column-gap: 18px; }
.ch-acc { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; background: var(--panel); }
.ch-acc summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 11px 12px; cursor: pointer; font-weight: 600; background: var(--soft); border-radius: 8px; }
.ch-acc summary::-webkit-details-marker { display: none; }
.ch-acc summary span { flex: 1; }
.ch-acc summary > svg:last-child { transition: transform .2s; color: var(--muted); }
.ch-acc[open] summary > svg:last-child { transform: rotate(180deg); }
.ch-acc[open] summary { border-radius: 8px 8px 0 0; border-bottom: 1px solid var(--line); }
.ch-cnt { background: var(--acc); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; }
.ch-accb { padding: 10px 12px; }
.ch-mgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.ch-mlist { display: flex; flex-direction: column; margin-top: 6px; }
.ch-btn.wide { width: 100%; justify-content: center; margin-top: 6px; }
.ch-sw { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.ch-sw:last-child { border-bottom: 0; }
.ch-sw > span { flex: 1; display: flex; flex-direction: column; }
.ch-sw small { color: var(--muted); font-size: 12px; }
.ch-sw input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ch-sw i { width: 40px; height: 22px; border-radius: 11px; background: #B9C1B3; position: relative; flex: none; transition: background .15s; }
.ch-sw i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.ch-sw input:checked + i { background: var(--acc); }
.ch-sw input:checked + i::after { transform: translateX(18px); }
.ch-sw input:focus-visible + i { outline: 3px solid var(--acc-l); outline-offset: 2px; }

/* Pages (fiche contact, appels, favoris) */
.ch-page { flex: 1; overflow-y: auto; position: relative; }
.ch-pback { position: absolute; top: 10px; left: 10px; z-index: 2; background: rgba(255, 255, 255, .85); }
.ch-banner { height: 150px; background: linear-gradient(120deg, var(--acc) 0%, var(--acc-l) 120%); position: relative; }
.ch-banner::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .14) 1.5px, transparent 1.7px); background-size: 16px 16px; }
.ch-bact { position: absolute; top: 12px; right: 12px; display: flex; gap: 2px; background: rgba(255, 255, 255, .92); border-radius: 22px; padding: 2px 6px; z-index: 1; }
.ch-bact .ch-ic { color: var(--acc); }
.ch-chead { display: flex; align-items: flex-end; gap: 18px; padding: 0 28px; margin-top: -56px; flex-wrap: wrap; position: relative; }
.ch-chead .ch-av { border: 4px solid var(--panel); }
.ch-chead h2 { margin: 0; font-size: 22px; }
.ch-chead > div:nth-child(2) { flex: 1; min-width: 180px; padding-bottom: 6px; }
.ch-tagl { display: flex; align-items: center; gap: 6px; color: var(--muted); margin: 4px 0 0; }
.ch-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; margin: 20px 28px; padding: 16px 18px; }
.ch-label { display: inline-block; margin: 6px 0 10px; font-size: 11.5px; text-transform:none; letter-spacing: .05em; color: var(--acc); background: var(--acc-t); padding: 4px 10px; border-radius: 6px; }
.chx.dark .ch-label { color: var(--acc-l); }
.ch-calld { max-width: 720px; margin: 28px auto; }
.ch-cdh { display: flex; align-items: center; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 10px; flex-wrap: wrap; }
.ch-cdh h2 { margin: 0; font-size: 20px; }
.ch-cdh > div:nth-child(2) { flex: 1; }
.ch-rbtns { display: flex; gap: 10px; }
.ch-round { width: 44px; height: 44px; border-radius: 50%; border: 0; display: inline-grid; place-items: center; color: #fff !important; background: var(--acc); flex: none; cursor: pointer; }
.ch-round.sm { width: 34px; height: 34px; }
.ch-round.green { background: #2E7D32; } .ch-round.red { background: var(--red); } .ch-round.acc2 { background: var(--acc-h); }
.ch-round:hover { filter: brightness(1.1); }
.ch-hist { display: flex; flex-direction: column; gap: 8px; }
.ch-hcard { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.ch-hcard > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; }
.ch-hcard small { color: var(--muted); }
.ch-hic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; }
.ch-hic.in { background: #E3F2EC; color: #1E6B4E; } .ch-hic.out { background: #FFF4D6; color: #8A6100; } .ch-hic.red { background: #FDECEA; color: var(--red); }
.ch-stars { padding: 14px 18px; display: flex; flex-direction: column; gap: 8px; }
.ch-scard { display: flex; gap: 6px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px 6px 4px 0; }
.ch-sopen { flex: 1; text-align: left; border: 0; background: none; padding: 8px 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ch-sopen small { color: var(--muted); } .ch-sopen span { overflow: hidden; text-overflow: ellipsis; }

/* Menus, dialogues, toasts */
.ch-menu { position: fixed; z-index: 10000; min-width: 220px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); padding: 6px; font-size: 14px; }
.ch-menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 9px 10px; border-radius: 6px; text-align: left; color: var(--ink); }
.ch-menu button:hover, .ch-menu button:focus-visible { background: var(--soft); outline: none; }
.ch-menu button svg { color: var(--muted); }
.ch-menu button.danger, .ch-menu button.danger svg { color: var(--red); }
.ch-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.ch-qr { display: flex; gap: 2px; padding: 2px 2px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.ch-qr button { font-size: 21px; padding: 4px; justify-content: center; }
.ch-dlg { max-width: 96vw; border: 0; border-radius: 14px; padding: 0; width: min(480px, 94vw); max-height: 88vh; background: var(--panel); color: var(--ink); box-shadow: 0 20px 50px rgba(0, 0, 0, .3); font-size: 14px; }
.ch-dlg.sm { width: min(400px, 94vw); } .ch-dlg.wide { width: min(820px, 96vw); } .ch-dlg.img { width: min(900px, 96vw); }
.ch-dlg::backdrop { background: rgba(10, 20, 5, .5); }
.ch-dlg > .ch-dh { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 20px; border-bottom: 1px solid var(--line); }
.ch-dlg h2 { margin: 0; font-size: 17px; }
.ch-dbody { padding: 14px 20px; overflow-y: auto; max-height: calc(88vh - 130px); }
.ch-dlg > .ch-df { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.ch-derr { color: var(--red); margin: 0 20px; font-size: 13px; }
.ch-derr:empty { display: none; }
.ch-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 8px 14px; font-weight: 600; }
.ch-btn:hover { background: var(--soft); }
.ch-btn.sm { padding: 5px 10px; font-size: 13px; }
.ch-btn.primary { background: var(--acc); border-color: var(--acc); color: #fff; }
.ch-btn.primary:hover { background: var(--acc-h); }
.ch-btn.ghost { background: transparent; }
.ch-btn.danger { color: var(--red); border-color: #F1C4BF; }
.ch-btn.danger-solid { background: var(--red); border-color: var(--red); color: #fff; }
.ch-fl { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; font-weight: 600; font-size: 13px; }
.ch-in { border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font: inherit; font-weight: 400; background: var(--bg); color: var(--ink); width: 100%; }
.ch-in:focus { outline: 2px solid var(--acc); outline-offset: 0; }
.ch-note { color: var(--muted); font-size: 12.5px; margin: 6px 0 10px; line-height: 1.45; }
.ch-pick { display: flex; flex-direction: column; margin-top: 8px; max-height: 46vh; overflow-y: auto; }
.ch-person { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.ch-person > span:not(.ch-av):not(.ch-chip):not(.ch-acts) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ch-person small { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 4px; }
.ch-person input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--acc); }
.ch-acts { display: flex; gap: 6px; }
.ch-gcount { font-weight: 600; color: var(--acc); margin: 0 0 4px; }
.ch-full { max-width: 100%; max-height: 72vh; display: block; margin: 0 auto; border-radius: 8px; }
.ch-toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #1F2A1C; color: #fff; padding: 10px 18px; border-radius: 22px; z-index: 10001; font-size: 14px; box-shadow: var(--shadow); }
.ch-walls { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.ch-wall { height: 90px; border-radius: 10px; border: 2px solid var(--line); display: flex; align-items: flex-end; padding: 6px; background-color: var(--wall); }
.ch-wall span { background: var(--panel); border-radius: 6px; padding: 2px 6px; font-size: 12px; }
.ch-wall.on { border-color: var(--acc); box-shadow: 0 0 0 2px var(--acc-l); }
.ch-sws { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.ch-swc { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; font-size: 12px; }
.ch-swc i { width: 44px; height: 44px; border-radius: 50%; background: var(--c); border: 3px solid var(--panel); box-shadow: 0 0 0 1px var(--line); }
.ch-swc.on i { box-shadow: 0 0 0 3px var(--c); }
.ch-camv video, .ch-camv img { width: 100%; border-radius: 10px; background: #000; display: block; max-height: 60vh; object-fit: contain; }
.ch-set { display: grid; grid-template-columns: 220px 1fr; gap: 18px; min-height: 380px; }
.ch-setnav { display: flex; flex-direction: column; gap: 4px; border-right: 1px solid var(--line); padding-right: 12px; }
.ch-setnav button { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 10px 12px; border-radius: 8px; text-align: left; font-weight: 600; color: var(--muted); }
.ch-setnav button.on { background: var(--acc); color: #fff; }
.ch-setnav button:not(.on):hover { background: var(--soft); }
.ch-meter { height: 8px; background: var(--soft); border-radius: 4px; overflow: hidden; margin: -4px 0 8px; border: 1px solid var(--line); }
.ch-meter i { display: block; height: 100%; width: 0; background: var(--acc-l); transition: width .08s; }
.ch-avv { width: 100%; max-width: 360px; border-radius: 10px; background: #000; display: block; margin: 8px 0; }
.ch-help { padding-left: 18px; line-height: 1.5; } .ch-help li { margin-bottom: 8px; }
.ch-dlg.profile .ch-dbody { padding: 0; }
.ch-pcover { height: 110px; background: linear-gradient(120deg, var(--acc), var(--acc-l)); position: relative; }
.ch-px { position: absolute; top: 8px; right: 8px; background: rgba(255, 255, 255, .9); color: var(--acc); }
.ch-pav { position: relative; width: 128px; margin: -64px auto 0; }
.ch-pav .ch-av { border: 4px solid var(--panel); }
.ch-pcam { position: absolute; right: 2px; bottom: 6px; border: 3px solid var(--panel); }
.ch-pform { padding: 6px 22px 10px; text-align: center; }
.ch-pform h2 { margin: 6px 0 0; }
.ch-pform .ch-fl, .ch-pform .ch-note { text-align: left; }

/* Écran d'appel */
.chc { position: fixed; inset: 0; z-index: 10002; background: rgba(8, 16, 6, .78); display: grid; place-items: center; padding: 16px; color: var(--ink); }
.chc-card { position: relative; width: min(380px, 100%); background: var(--panel); border-radius: 18px; padding: 30px 22px 24px; text-align: center; box-shadow: 0 24px 60px rgba(0, 0, 0, .45); overflow: hidden; }
.chc.vid .chc-card { width: min(980px, 100%); height: min(680px, 92vh); padding: 0; background: #0B0F0A; color: #fff; display: flex; flex-direction: column; justify-content: flex-end; }
.chc-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #0B0F0A; }
.chc-local { position: absolute; top: 14px; right: 14px; width: 26%; max-width: 220px; aspect-ratio: 4 / 3; object-fit: cover; border: 3px solid #fff; border-radius: 10px; background: #222; z-index: 2; transform: scaleX(-1); }
.chc:not(.vid) .chc-local, .chc:not(.vid) .chc-remote { display: none; }
.chc-who { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; z-index: 1; }
.chc.vid .chc-who { position: absolute; top: 14px; left: 16px; flex-direction: row; text-align: left; gap: 10px; }
.chc-who h2 { margin: 10px 0 0; font-size: 21px; }
.chc.vid .chc-who h2 { margin: 0; font-size: 17px; text-shadow: 0 1px 3px #000; }
.chc-st { margin: 0; color: var(--muted); text-transform:none; font-size: 12px; letter-spacing: .06em; font-weight: 700; display: flex; gap: 8px; justify-content: center; }
.chc.vid .chc-st { color: #E6F2D8; text-shadow: 0 1px 3px #000; }
.chc-st span { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--acc); }
.chc.vid .chc-st span { color: #fff; }
.chc-note { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.chc-acts { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 26px; position: relative; z-index: 2; flex-wrap: wrap; }
.chc.vid .chc-acts { background: linear-gradient(transparent, rgba(0, 0, 0, .75)); padding: 30px 16px 20px; margin: 0; }
.chc-acts.in { gap: 60px; }
.chc-b { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; color: inherit; padding: 4px; min-width: 76px; }
.chc-b > span { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--ink); }
.chc.vid .chc-b > span { background: rgba(255, 255, 255, .16); color: #fff; }
.chc-b.on > span { background: var(--ink); color: var(--panel); }
.chc.vid .chc-b.on > span { background: #fff; color: #000; }
.chc-b small { font-size: 11.5px; }
.chc-round { width: 64px; height: 64px; border-radius: 50%; border: 0; display: grid; place-items: center; color: #fff !important; }
.chc-round.red { background: #D93025; } .chc-round.green { background: #2E9D47; animation: chring 1.4s infinite; }
@keyframes chring { 50% { box-shadow: 0 0 0 12px rgba(46, 157, 71, .2); } }
@media (prefers-reduced-motion: reduce) { .chc-round.green { animation: none; } }

/* Une seule colonne : tablette et téléphone */
.ch.ch-narrow { grid-template-columns: 1fr !important; }
.ch.ch-narrow > .ch-side, .ch.ch-narrow > .ch-main, .ch.ch-narrow > .ch-info { display: none; }
.ch.ch-narrow[data-pane="side"] > .ch-side { display: flex; }
.ch.ch-narrow[data-pane="main"] > .ch-main { display: flex; }
.ch.ch-narrow[data-pane="info"] > .ch-info:not([hidden]) { display: flex; }
.ch.ch-narrow .ch-back { display: inline-grid; }
.ch.ch-narrow .ch-bcol { max-width: 86%; }
.ch.ch-narrow .ch-grid.n2, .ch.ch-narrow .ch-grid.n4 { grid-template-columns: repeat(2, minmax(0, 120px)); }
.ch.ch-narrow .ch-grid.n3 { grid-template-columns: repeat(3, minmax(0, 90px)); }
.ch.ch-narrow .ch-dl.two { grid-template-columns: 1fr; }
.ch.ch-narrow .ch-card { margin: 14px; }
.ch.ch-narrow .ch-chead { padding: 0 14px; }
.ch-compact { border-radius: 10px; }
@media (max-width: 640px) {
  .ch-set { grid-template-columns: 1fr; }
  .ch-setnav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 8px; }
  .ch-setnav button span { white-space: nowrap; }
  .chc-local { width: 32%; }
}
