/* Messagerie. Bulles et liste reprennent la charte du bureau : variables seulement, voiles légers, aucun aplat vif. */
.chat { flex: 1; min-height: 0; display: flex; --chat-mine: color-mix(in srgb, var(--accent) 16%, var(--bg-solid)); --chat-theirs: var(--field); }
.chat-list { width: 320px; flex: none; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 60%, transparent); }
.chat-list-head { display: flex; gap: 8px; padding: 12px; align-items: center; }
.chat-new { padding: 7px 9px; display: grid; place-items: center; flex: none; }
.chat-new .icon { width: 18px; height: 18px; }
.chat-rows { flex: 1; overflow-y: auto; min-height: 0; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 2px; }
.chat-list-foot { padding: 0 12px; font-size: 12px; color: var(--muted); }
.chat-list-foot .chat-link:not(:empty) { display: block; padding: 6px 0 8px; }
.chat-row { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; border: 1px solid transparent; background: none; padding: 8px 9px; border-radius: 12px; box-shadow: none; font-weight: 400; }
.chat-row:hover { transform: none; background: var(--hover); border-color: transparent; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent); }
.chat-row.on { background: color-mix(in srgb, var(--accent) 13%, transparent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.chat-row.hit { padding-left: 14px; }
.chat-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.chat-row-top, .chat-row-bottom { display: flex; align-items: center; gap: 6px; min-width: 0; }
.chat-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.chat-row.unread .chat-row-name { font-weight: 720; }
.chat-row-when { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chat-row-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--muted); }
.chat-row.unread .chat-row-preview { color: var(--text); }
.chat-mini { width: 13px; height: 13px; flex: none; color: var(--muted); font-size: 11px; }
.chat-count { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; }
.chat-count.quiet { background: var(--track); color: var(--muted); }
.chat-sep { padding: 12px 9px 4px; font-size: 12px; font-weight: 640; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.chat-none { padding: 18px 12px; text-align: center; }
.chat-arch { padding: 8px 9px; text-align: left; }
.chat-av { position: relative; flex: none; display: grid; place-items: center; width: 38px; height: 38px; }
.chat-av .avatar { width: 38px; height: 38px; font-size: 16px; }
.chat-av.ghost { height: 0; }
.avatar.group { display: grid; place-items: center; background: linear-gradient(150deg, #2dd4bf, #0c7c74); color: #fff; border-radius: 50%; }
.avatar.group .icon { width: 19px; height: 19px; }
.chat-dot { position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border-radius: 50%; background: var(--ok); border: 2px solid var(--bg-solid); }
.chat-dot.inline { position: static; border: 0; width: 8px; height: 8px; margin-left: auto; }
.chat-typing { color: var(--accent) !important; font-style: italic; }

.chat-pane { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.chat-pane > .empty { margin: auto; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.chat-head-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.chat-head-name { font-weight: 680; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-head-meta { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-back { display: none; padding: 6px; flex: none; }
.chat-more { padding: 5px 7px; display: grid; place-items: center; }
.chat-more .icon, .chat-back .icon { width: 17px; height: 17px; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px 6px; display: flex; flex-direction: column; gap: 2px; }
.chat-day, .chat-newmark { display: flex; justify-content: center; margin: 12px 0 8px; }
.chat-day span { font-size: 12px; color: var(--muted); background: var(--track); padding: 2px 11px; border-radius: 10px; }
.chat-newmark { position: relative; }
.chat-newmark::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.chat-newmark span { position: relative; font-size: 12px; font-weight: 640; color: var(--accent); background: var(--bg-solid); padding: 1px 11px; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.chat-sys { align-self: center; font-size: 12.5px; color: var(--muted); margin: 6px 0; text-align: center; }
.chat-msg { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; max-width: 100%; border-radius: 12px; }
.chat-msg.follow { margin-top: 0; }
.chat-msg.mine { justify-content: flex-end; }
.chat-msg.flash { animation: chat-flash 1.6s ease; }
@keyframes chat-flash { 0%, 60% { background: color-mix(in srgb, var(--accent) 16%, transparent); } 100% { background: transparent; } }
.chat-msg .chat-av, .chat-msg .chat-av .avatar { width: 30px; height: 30px; font-size: 13px; }
.chat-col { display: flex; flex-direction: column; min-width: 0; max-width: min(78%, 620px); }
.chat-msg.mine .chat-col { align-items: flex-end; }
.chat-author { font-size: 12px; font-weight: 640; color: var(--muted); margin: 0 0 2px 12px; }
.chat-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.chat-msg.mine .chat-line { flex-direction: row-reverse; }
.chat-bubble { min-width: 0; padding: 7px 12px 6px; border-radius: 18px 18px 18px 5px; background: var(--chat-theirs); border: 1px solid var(--line); box-shadow: var(--shadow); overflow-wrap: anywhere; }
.chat-msg.mine .chat-bubble { border-radius: 18px 18px 5px 18px; background: var(--chat-mine); border-color: color-mix(in srgb, var(--accent) 26%, transparent); }
.chat-bubble.gone { font-style: italic; color: var(--muted); box-shadow: none; }
.chat-text { white-space: pre-wrap; }
.chat-meta { float: right; margin: 5px 0 0 12px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chat-ticks { margin-left: 4px; letter-spacing: -2px; }
.chat-ticks.read { color: var(--accent); }
.chat-quote { display: flex; flex-direction: column; width: 100%; text-align: left; margin: 0 0 5px; padding: 4px 9px; border: 0; border-left: 3px solid var(--accent); border-radius: 6px; background: color-mix(in srgb, var(--accent) 9%, transparent); font-size: 13px; font-weight: 400; box-shadow: none; }
.chat-quote:hover { transform: none; box-shadow: none; background: color-mix(in srgb, var(--accent) 15%, transparent); }
.chat-quote b { font-size: 12px; color: var(--accent); }
.chat-quote span { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chat-tools { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; flex: none; }
.chat-msg:hover .chat-tools, .chat-tools:focus-within { opacity: 1; }
@media (hover: none) { .chat-tools { opacity: .7; } }
.chat-tools button { padding: 3px 5px; border: 0; background: none; box-shadow: none; border-radius: 8px; display: grid; place-items: center; font-size: 14px; line-height: 1; color: var(--muted); }
.chat-tools button:hover { background: var(--hover); transform: none; box-shadow: none; color: var(--text); }
.chat-tools .icon { width: 15px; height: 15px; }
.chat-reacts { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 4px 0; }
.chat-react { padding: 1px 8px; border-radius: 12px; font-size: 13px; display: inline-flex; gap: 5px; align-items: center; background: var(--field); box-shadow: none; }
.chat-react span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chat-react.mine { background: color-mix(in srgb, var(--accent) 13%, transparent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.chat-typing-line { min-height: 0; }
.chat-reply { display: flex; align-items: center; gap: 8px; margin: 0 14px; padding: 6px 10px; border-left: 3px solid var(--accent); border-radius: 8px; background: color-mix(in srgb, var(--accent) 9%, transparent); font-size: 13px; }
.chat-reply-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.chat-reply-text b { color: var(--accent); }
.chat-reply button { padding: 3px 5px; display: grid; place-items: center; }
.chat-reply .icon { width: 14px; height: 14px; }
.chat-composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 14px 14px; }
.chat-composer textarea { resize: none; max-height: 160px; border-radius: 18px; padding: 9px 14px; line-height: 1.4; }
.chat-composer button { flex: none; width: 40px; height: 40px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
.chat-composer .icon { width: 19px; height: 19px; }

.chat-pop { position: fixed; z-index: 100002; display: flex; flex-direction: column; min-width: 190px; padding: 5px; background: var(--glass); border: 1px solid var(--glass-line); border-radius: 12px; box-shadow: var(--win-shadow); backdrop-filter: blur(30px) saturate(1.6); -webkit-backdrop-filter: blur(30px) saturate(1.6); }
.chat-pop button { text-align: left; border: 0; background: none; box-shadow: none; padding: 7px 11px; border-radius: 8px; font-weight: 500; }
.chat-pop button:hover { background: var(--hover); transform: none; box-shadow: none; }
.chat-pop.emojis { flex-direction: row; min-width: 0; }
.chat-pop.emojis button { font-size: 20px; padding: 4px 6px; line-height: 1; }
.chat-pick { max-height: 240px; overflow-y: auto; margin: 8px 0 12px; display: flex; flex-direction: column; gap: 2px; }
.chat-pick-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; cursor: default; }
label.chat-pick-row { cursor: pointer; }
.chat-pick-row:hover { background: var(--hover); }
.chat-pick-row input[type="checkbox"] { width: auto; flex: none; }
.chat-pick-row .avatar { width: 28px; height: 28px; font-size: 13px; flex: none; }
.chat-pick-row button { margin-left: auto; }
.dock-badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--glass); animation: pop .35s var(--spring); pointer-events: none; }

/* Fenêtre étroite ou téléphone : un panneau à la fois. */
.chat.narrow .chat-list { width: 100%; border-right: 0; }
.chat.narrow .chat-pane { display: none; }
.chat.narrow.opened .chat-list { display: none; }
.chat.narrow.opened .chat-pane { display: flex; }
.chat.narrow .chat-back { display: grid; place-items: center; }
.chat.narrow .chat-col { max-width: 88%; }
@media (prefers-reduced-motion: reduce) { .chat-msg.flash, .dock-badge { animation: none; } }

/* Pièces jointes */
.chat-pane { position: relative; }
.chat-pane.drop { outline: 2px dashed var(--accent); outline-offset: -8px; }
.chat-files { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 5px; }
.chat-files.album { flex-direction: row; flex-wrap: wrap; }
.chat-files.album .chat-pic { width: 150px; height: 150px; object-fit: cover; }
.chat-file-pic { padding: 0; border: 0; background: none; box-shadow: none; border-radius: 12px; overflow: hidden; display: block; line-height: 0; }
.chat-file-pic:hover { transform: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.chat-pic { max-width: min(320px, 100%); max-height: 320px; border-radius: 12px; display: block; background: var(--track); }
.chat-video { max-width: min(360px, 100%); max-height: 320px; border-radius: 12px; background: #000; display: block; }
.chat-audio { display: flex; flex-direction: column; gap: 3px; }
.chat-audio audio { width: min(300px, 100%); height: 38px; }
.chat-file-card { display: flex; align-items: center; gap: 9px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: inherit; text-decoration: none; max-width: 320px; }
.chat-file-card:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.chat-file-card .icon { color: var(--accent); flex: none; }
.chat-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 560; }
.chat-pending { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 14px 0; }
.chat-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 3px 4px 3px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); font-size: 13px; }
.chat-chip.busy { padding: 5px 10px; color: var(--muted); font-style: italic; }
.chat-chip img { width: 26px; height: 26px; border-radius: 6px; object-fit: cover; }
.chat-chip .icon { width: 16px; height: 16px; color: var(--muted); }
.chat-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-chip button { padding: 2px; border: 0; background: none; box-shadow: none; display: grid; place-items: center; border-radius: 6px; color: var(--muted); }
.chat-chip button:hover { background: var(--hover); transform: none; box-shadow: none; }
.chat-chip button .icon { width: 13px; height: 13px; }
/* Zone de saisie : outils à gauche */
.chat-tools-bar { display: flex; gap: 2px; align-items: center; flex: none; padding-bottom: 3px; }
.chat-composer .chat-tool { width: 34px; height: 34px; padding: 0; border: 0; background: none; box-shadow: none; border-radius: 50%; display: grid; place-items: center; font-size: 18px; line-height: 1; color: var(--muted); }
.chat-composer .chat-tool:hover { background: var(--hover); transform: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); color: var(--text); }
.chat-composer .chat-tool .icon { width: 18px; height: 18px; }
.chat-pop.picker { width: 322px; max-height: 320px; overflow-y: auto; padding: 6px 8px 10px; }
.chat-pop.picker .chat-sep { padding: 8px 2px 4px; }
.chat-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 1px; }
.chat-emoji-grid button { padding: 4px 0; font-size: 21px; line-height: 1.15; text-align: center; border-radius: 8px; }
.chat-emoji-grid.winks { grid-template-columns: repeat(7, 1fr); }
.chat-emoji-grid.winks button { font-size: 25px; padding: 6px 0; }
.chat-emoji-grid.winks button:hover { transform: scale(1.2); background: none; }
/* Wizz et clins d'œil */
.chat-fx { display: flex; align-items: center; gap: 8px; color: var(--text); }
.chat-fx-when { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chat-fx-play { display: inline-flex; align-items: center; gap: 7px; padding: 3px 12px 3px 6px; border-radius: 16px; font-weight: 500; font-size: 13px; background: color-mix(in srgb, var(--accent) 9%, transparent); border-color: color-mix(in srgb, var(--accent) 28%, transparent); box-shadow: none; }
.chat-fx-emoji { font-size: 22px; line-height: 1; }
@keyframes chat-wizz { 0%, 100% { transform: translate(0, 0) rotate(0); } 10% { transform: translate(-12px, -4px) rotate(-2deg); } 20% { transform: translate(12px, 4px) rotate(2deg); } 30% { transform: translate(-10px, 6px) rotate(-1.5deg); } 40% { transform: translate(10px, -6px) rotate(1.5deg); } 50% { transform: translate(-8px, 0) rotate(-1deg); } 60% { transform: translate(8px, 0) rotate(1deg); } 70% { transform: translate(-6px, 4px) rotate(-.5deg); } 80% { transform: translate(6px, -4px) rotate(.5deg); } 90% { transform: translate(-3px, 0); } }
.chat-wizzing { animation: chat-wizz .9s linear both !important; }
.chat-wink { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 5; }
.chat-wink-center { position: absolute; left: 50%; top: 45%; font-size: 120px; line-height: 1; transform: translate(-50%, -50%) scale(0); animation: chat-wink-pop 2.6s cubic-bezier(.2, .9, .3, 1.3) both; filter: drop-shadow(0 12px 30px rgba(10, 16, 34, .35)); }
@keyframes chat-wink-pop { 0% { transform: translate(-50%, -50%) scale(0) rotate(-20deg); opacity: 0; } 18% { transform: translate(-50%, -50%) scale(1.25) rotate(6deg); opacity: 1; } 30% { transform: translate(-50%, -50%) scale(1) rotate(0); } 80% { transform: translate(-50%, -50%) scale(1.05); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1.7); opacity: 0; } }
.chat-wink-p { position: absolute; left: var(--x); bottom: -40px; font-size: calc(22px * var(--s)); line-height: 1; opacity: 0; animation: chat-wink-rise 2.4s ease-out var(--d) both; }
@keyframes chat-wink-rise { 0% { transform: translateY(0) rotate(0); opacity: 0; } 12% { opacity: 1; } 100% { transform: translateY(-900px) rotate(var(--a)); opacity: 0; } }
.chat-wink.rain .chat-wink-p { bottom: auto; top: -40px; animation-name: chat-wink-rain; animation-timing-function: ease-in; }
@keyframes chat-wink-rain { 0% { transform: translateY(0) rotate(0); opacity: 0; } 12% { opacity: 1; } 100% { transform: translateY(900px) rotate(var(--a)); opacity: 0; } }
.chat-wink.burst .chat-wink-p, .chat-wink.quake .chat-wink-p { left: 50%; top: 45%; bottom: auto; animation-name: chat-wink-burst; animation-duration: 1.8s; }
@keyframes chat-wink-burst { 0% { transform: translate(-50%, -50%) rotate(var(--a)) translateY(0) scale(.3); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(-50%, -50%) rotate(var(--a)) translateY(calc(-6 * var(--r))) scale(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .chat-wizzing { animation: none !important; } .chat-wink { display: none; } }

/* Transfert, épingles, message vocal */
.chat-fwd { display: flex; align-items: center; gap: 5px; font-size: 12px; font-style: italic; color: var(--muted); margin-bottom: 3px; }
.chat-fwd .icon { width: 13px; height: 13px; }
.chat-pins { display: flex; align-items: center; gap: 8px; padding: 6px 14px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--accent) 7%, transparent); font-size: 13px; }
.chat-pin-main { flex: 1; min-width: 0; text-align: left; border: 0; background: none; box-shadow: none; padding: 2px 0; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.chat-pin-main:hover { transform: none; box-shadow: none; color: var(--text); }
.chat-pin-main b { color: var(--accent); font-weight: 640; }
button.chat-pick-row { width: 100%; text-align: left; border: 1px solid transparent; background: none; box-shadow: none; font-weight: 400; }
button.chat-pick-row:hover { transform: none; box-shadow: none; }
button.chat-pick-row.on { background: color-mix(in srgb, var(--accent) 13%, transparent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.chat-rec { display: flex; align-items: center; gap: 8px; margin: 6px 14px 0; padding: 6px 10px; border-radius: 10px; background: color-mix(in srgb, var(--bad) 9%, transparent); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); font-size: 13px; }
.chat-rec-time { font-variant-numeric: tabular-nums; font-weight: 640; margin-right: auto; }
.chat-rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: chat-rec 1s ease-in-out infinite; }
@keyframes chat-rec { 50% { opacity: .25; } }
.chat-composer .chat-tool.recording { background: color-mix(in srgb, var(--bad) 16%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }
/* Fenêtre Aperçu */
.view-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.view-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.view-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
.view-center { flex: 1; min-height: 0; display: grid; place-items: center; padding: 14px; overflow: auto; }
.view-center.dark { background: #05070d; }
.view-center img, .view-center video { max-width: 100%; max-height: 100%; border-radius: 8px; }
.view-text { flex: 1; min-height: 0; margin: 0; padding: 14px 18px; overflow: auto; font: 13px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
