:root { --vert: #075e54; --vert-clair: #128c7e; --fond: #efeae2; --bulle: #ffffff; --bulle-out: #d9fdd3; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
.chat-ui { margin: 0; height: 100vh; overflow: hidden; font: 14.5px/1.45 "Segoe UI", system-ui, sans-serif; background: #d1d7db; color: #111b21; display: flex; flex-direction: column; }
.chat-ui header.top { background: var(--vert); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: .5rem .9rem; flex: 0 0 auto; }
.chat-ui header.top .me { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.chat-ui header.top a { color: #fff; text-decoration: none; opacity: .9; font-size: .9rem; }
.dot { width: .6rem; height: .6rem; border-radius: 50%; display: inline-block; }
.s-ready { background: #25d366; } .s-code_issued { background: #ffc043; }
.s-idle, .s-new { background: #9aa0a6; }
.s-syncing, .s-settling, .s-connecting, .s-restarting { background: #53bdeb; }
.s-logged_out, .s-replaced, .s-device_limit, .s-revoked, .s-closed { background: #f15c6d; }
.layout { flex: 1 1 auto; display: grid; grid-template-columns: 24rem 1fr; min-height: 0; }
aside { background: #fff; border-right: 1px solid #d1d7db; display: flex; flex-direction: column; min-height: 0; }
.num { font-size: .78rem; color: #667781; }
.search { padding: .5rem; background: #f0f2f5; }
.search input { width: 100%; border: 0; border-radius: .5rem; padding: .45rem .7rem; font: inherit; }
.tabs { display: flex; gap: .3rem; padding: .4rem .5rem; border-bottom: 1px solid #f0f2f5; flex-wrap: wrap; }
.tab { border: 0; background: #f0f2f5; color: #54656f; border-radius: 1rem; padding: .2rem .8rem; font: inherit; cursor: pointer; }
.tab.on { background: #d9fdd3; color: #075e54; font-weight: 600; }
#list { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.chat { display: grid; grid-template-columns: 2.5rem 1fr auto; gap: .6rem; align-items: center; width: 100%; text-align: left; border: 0; border-bottom: 1px solid #f0f2f5; background: #fff; padding: .5rem .6rem; cursor: pointer; font: inherit; }
.chat.on { background: #f0f2f5; }
.av { width: 2.5rem; height: 2.5rem; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: .95rem; position: relative; }
.av.online::after { content: ''; position: absolute; right: 0; bottom: 0; width: .55rem; height: .55rem; background: #25d366; border: 2px solid #fff; border-radius: 50%; }
.meta { min-width: 0; }
.nom { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview { color: #667781; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview.en-ligne { color: #25d366; font-weight: 500; }
.right { display: flex; flex-direction: column; align-items: flex-end; gap: .25rem; }
.heure { color: #667781; font-size: .72rem; }
.badge { background: #25d366; color: #fff; font-size: .7rem; font-weight: 700; border-radius: 1rem; padding: .05rem .35rem; }
.pince { border: 0; background: transparent; cursor: pointer; color: #8696a0; font-size: .8rem; padding: 0; }
.pince:hover { color: #075e54; }
section#pane { display: flex; flex-direction: column; min-height: 0; background: var(--fond); }
#empty { margin: auto; color: #667781; text-align: center; }
#conv { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.chead { display: flex; align-items: center; gap: .6rem; background: #f0f2f5; border-bottom: 1px solid #d1d7db; padding: .45rem .8rem; }
.chead .qui { min-width: 0; }
.chead .nom { font-weight: 600; }
.chead .sub { color: #667781; font-size: .78rem; }
.chead .sub.en-ligne { color: #25d366; }
.cacts { margin-left: auto; display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.cacts button, .cacts select { font: inherit; font-size: .8rem; border: 1px solid #d1d7db; background: #fff; border-radius: .4rem; padding: .25rem .5rem; cursor: pointer; }
.bubble { position: relative; }
#msgmenu { display: none; position: fixed; z-index: 30; background: #fff; border: 1px solid #d1d7db; border-radius: .45rem; box-shadow: 0 8px 24px rgba(0,0,0,.12); min-width: 12rem; padding: .25rem 0; }
#msgmenu.open { display: block; }
#msgmenu button { display: block; width: 100%; text-align: left; border: 0; background: #fff; font: inherit; padding: .45rem .8rem; cursor: pointer; }
#msgmenu button:hover { background: #f0f2f5; }
#msgmenu button.danger { color: #a12622; }
#thread { flex: 1 1 auto; overflow-y: auto; min-height: 0; padding: 1rem 6%; display: flex; flex-direction: column; gap: .3rem; }
.jour { align-self: center; background: #fff; color: #667781; font-size: .72rem; padding: .15rem .6rem; border-radius: .4rem; margin: .5rem 0; }
.bubble { max-width: 65%; padding: .35rem .55rem; background: var(--bulle); border-radius: .5rem; box-shadow: 0 1px 1px rgba(0,0,0,.08); white-space: pre-wrap; word-wrap: break-word; }
.bubble.out { align-self: flex-end; background: var(--bulle-out); }
.bubble.call { align-self: center; background: #fff; color: #667781; font-size: .82rem; max-width: 80%; text-align: center; }
.bubble img.media { display: block; max-width: 100%; max-height: 22rem; border-radius: .35rem; margin: .15rem 0; }
.bubble video.media { display: block; max-width: 100%; max-height: 18rem; border-radius: .35rem; margin: .15rem 0; background: #000; }
.bubble audio { width: 100%; margin: .2rem 0; }
.dl { display: inline-block; margin-top: .2rem; background: #f0f2f5; color: #075e54; border-radius: .4rem; padding: .15rem .5rem; font-size: .78rem; text-decoration: none; }
.bubble .h { display: block; text-align: right; color: #667781; font-size: .66rem; margin-top: .15rem; }
.ticks { color: #8696a0; letter-spacing: -.12em; margin-left: .25rem; font-size: .78rem; }
.ticks.lu { color: #53bdeb; }
#err { color: #a12622; margin: 0; padding: 0 .8rem; min-height: 1.1rem; font-size: .8rem; }
form#send { display: flex; gap: .35rem; padding: .5rem .8rem; background: #f0f2f5; position: relative; align-items: flex-end; }
form#send input#text { flex: 1 1 auto; border: 0; border-radius: 1.5rem; padding: .55rem .9rem; font: inherit; }
#attach { border: 0; background: transparent; width: 2.4rem; height: 2.4rem; font-size: 1.25rem; cursor: pointer; flex: 0 0 auto; color: #54656f; }
form#send button[type="submit"] { border: 0; border-radius: 50%; width: 2.4rem; height: 2.4rem; background: var(--vert-clair); color: #fff; cursor: pointer; font-size: 1rem; flex: 0 0 auto; }
#emoji { border: 0; background: transparent; width: 2.4rem; height: 2.4rem; font-size: 1.35rem; cursor: pointer; flex: 0 0 auto; }
#emojis { display: none; position: absolute; left: .5rem; bottom: 3.3rem; width: min(22rem, calc(100% - 1rem)); max-height: 12.5rem; overflow-y: auto; background: #fff; border: 1px solid #d1d7db; border-radius: .6rem; padding: .35rem; grid-template-columns: repeat(8, 1fr); gap: .1rem; z-index: 6; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
#emojis.open { display: grid; }
#emojis button { border: 0; background: transparent; font-size: 1.35rem; line-height: 1.6; cursor: pointer; border-radius: .3rem; padding: 0; }
#emojis button:hover { background: #f0f2f5; }
.plus { align-self: center; border: 0; background: #fff; color: #075e54; font: inherit; font-size: .78rem; border-radius: .4rem; padding: .2rem .7rem; cursor: pointer; margin: .2rem 0; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
@media (max-width: 820px) { .layout { grid-template-columns: 1fr; } section#pane { display: none; } section#pane.actif { display: flex; } }
