/* Module B : messagerie, demandes de contact, notifications (et éléments partagés du module) */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* onglets sous forme de liens */
.mb-tabs { display: flex; gap: var(--space-6); border-bottom: 1px solid var(--line-strong); overflow-x: auto; margin-bottom: var(--space-5); }
.mb-tabs a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--ink-muted); text-decoration: none; font: 500 15px/1 var(--font-sans); white-space: nowrap; }
.mb-tabs a:hover { color: var(--ink); }
.mb-tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--copper); }

/* demandes */
.req-who { display: flex; align-items: center; gap: var(--space-4); margin: var(--space-4) 0; }
.req-intro { margin-bottom: var(--space-4); }
.req-card { display: grid; gap: var(--space-3); }
.req-card__head { display: flex; align-items: flex-start; gap: var(--space-3); }
.req-card__name a { color: var(--ink); text-decoration: none; }
.req-card__badges { gap: var(--space-2); margin: 4px 0; }
.req-card__msg { margin: 0; padding-left: var(--space-3); border-left: 2px solid var(--copper); }
.req-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.req-actions form { margin: 0; }

/* liste des conversations */
.chat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.chat-pending { margin-bottom: var(--space-4); text-decoration: none; }
.chat-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--surface-1); border: 1px solid var(--line); border-radius: var(--radius-lg); color: var(--ink); text-decoration: none; min-height: 64px; }
.chat-row:hover { background: var(--surface-2); color: var(--ink); }
.chat-row.is-unread { border-color: var(--copper); }
.chat-row__team { display: inline-grid; place-items: center; color: var(--copper-text); }
.chat-row__body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.chat-row__top { display: flex; align-items: center; gap: var(--space-2); }
.chat-row__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row__time { margin-left: auto; font-size: 12px; color: var(--ink-faint); white-space: nowrap; }
.chat-row__preview { color: var(--ink-muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row.is-unread .chat-row__preview { color: var(--ink); }

/* conversation */
.chat { display: grid; gap: var(--space-3); }
.chat__head { display: flex; align-items: center; gap: var(--space-3); padding-bottom: var(--space-3); border-bottom: 1px solid var(--line); }
.chat__thread { min-height: 40vh; padding: var(--space-3) 0; }
.chat__thread .bc-bubble { overflow-wrap: anywhere; }
.chat-removed { color: var(--ink-faint); font-style: italic; display: inline-flex; align-items: center; gap: 6px; background: var(--surface-1); }
.chat-staff { background: var(--info-wash); }
.chat-staff__tag { display: block; font: 600 11px/16px var(--font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--info-text); }
.chat-report { color: var(--ink-faint); }
.chat-composer { display: flex; align-items: flex-end; gap: var(--space-2); padding: var(--space-2); border: 1px solid var(--line-control); border-radius: var(--radius-lg); background: var(--bg-deep); position: sticky; bottom: calc(var(--space-2) + env(safe-area-inset-bottom, 0px)); }
.chat-composer textarea { flex: 1; min-width: 0; max-height: 160px; border: 0; background: none; color: var(--ink); font: 400 15px/22px var(--font-sans); padding: 8px var(--space-3); resize: none; outline: none; }
.chat-composer:focus-within { border-color: var(--focus); }
.chat-composer .bc-btn { width: 44px; padding: 0; flex: none; }
.chat__hint { margin: 0; }
body.has-tabbar .chat-composer { bottom: calc(72px + var(--space-2) + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 768px) { body.has-tabbar .chat-composer { bottom: var(--space-2); } }

.chat-menu { position: relative; }
.chat-menu > summary { list-style: none; cursor: pointer; background: var(--surface-2); }
.chat-menu > summary::-webkit-details-marker { display: none; }
.chat-menu__panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px; display: grid; padding: var(--space-2); background: var(--surface-3); border-radius: var(--radius-md); box-shadow: var(--shadow-pop); }
.chat-menu__panel a, .chat-menu__panel button { display: block; width: 100%; text-align: left; padding: 10px var(--space-3); min-height: 44px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink); font: 400 15px/22px var(--font-sans); text-decoration: none; cursor: pointer; }
.chat-menu__panel a:hover, .chat-menu__panel button:hover { background: var(--surface-2); }
.chat-menu__panel .is-danger { color: var(--danger-text); }
.chat-menu__panel form { margin: 0; }

/* notifications */
.ntf-group { margin-top: var(--space-6); }
.ntf-group__title { margin-bottom: var(--space-2); }
.ntf-list { list-style: none; margin: 0; padding: 0; }
.ntf-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-3); border-bottom: 1px solid var(--line); border-radius: var(--radius-md); }
.ntf-item.is-unread { background: var(--copper-wash); }
.ntf-item__text { color: var(--ink); text-decoration: none; font-weight: 500; }
a.ntf-item__text:hover { text-decoration: underline; }

/* images dans les conversations */
.chat-img { display: block; margin: 0 0 6px; line-height: 0; }
.chat-img img { display: block; width: min(320px, 100%); max-height: 320px; object-fit: cover; border-radius: 12px; background: var(--surface-2); }
.chat-text { display: block; }
.chat-msgmenu { position: relative; display: inline-block; vertical-align: middle; margin-left: 4px; }
.chat-msgmenu > summary { list-style: none; cursor: pointer; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--ink-faint); }
.chat-msgmenu > summary::-webkit-details-marker { display: none; }
.chat-msgmenu > summary:hover { background: var(--surface-2); color: var(--ink); }
.chat-msgmenu .chat-menu__panel { right: 0; left: auto; top: calc(100% + 4px); min-width: 240px; text-align: left; }
.chat-edit { display: grid; gap: var(--space-2); padding: var(--space-2); }
.chat-edit textarea { width: 100%; min-height: 72px; padding: 8px 10px; border: 1px solid var(--line-control); border-radius: var(--radius-md); background: var(--bg-deep); color: var(--ink); font: 400 15px/22px var(--font-sans); resize: vertical; }
.chat-attach { flex: none; background: var(--surface-2); cursor: pointer; width: 44px; height: 44px; }
.chat-attach:focus-within, #chat-image:focus + .chat-composer__main { outline: none; }
.chat-composer__main { flex: 1; min-width: 0; display: grid; gap: var(--space-2); }
.chat-preview { position: relative; width: 96px; }
.chat-preview img { display: block; width: 96px; height: 96px; object-fit: cover; border-radius: 10px; }
.chat-preview .bc-icon-btn { position: absolute; top: -8px; right: -8px; width: 28px; height: 28px; background: var(--surface-3); }
.chat-lightbox { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: var(--space-4); background: var(--scrim); cursor: zoom-out; }
.chat-lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: var(--shadow-modal); }
.chat-lightbox button { position: absolute; top: var(--space-4); right: var(--space-4); }
