.direct {--blush:#f8e9e4;--cherry:#a42436;--chat-border:#e1d7ce;--chat-muted:#6c5d59}
.direct:not(.staff-direct) {max-width:790px;margin:clamp(10px,4vh,42px) auto}
.direct-layout {display:grid;min-width:0;border:1px solid var(--chat-border);border-radius:22px;background:#fffcf8;overflow:hidden;box-shadow:0 12px 42px #4b23120a}
.staff-direct .direct-layout {grid-template-columns:minmax(175px,.7fr) minmax(0,1.65fr)}
.direct-room {min-width:0;display:flex;flex-direction:column;height:clamp(430px,67dvh,710px)}
.direct-head {display:flex;align-items:center;gap:12px;flex:none;min-height:78px;padding:13px 22px;border-bottom:1px solid var(--chat-border)}
.direct-head small {display:block;color:var(--chat-muted);font-size:10px;text-transform:uppercase;letter-spacing:.12em}
.direct-head h1,.direct-head h2 {font:400 31px/1.08 var(--serif);overflow-wrap:anywhere}
.direct-avatar {width:46px;height:46px;flex:none;border-radius:50%;background:var(--blush);color:var(--cherry);display:grid;place-items:center;font-weight:bold;object-fit:cover;object-position:50% 25%}
.direct-tools,.direct-back {border:none;background:transparent;color:var(--cherry)}
.direct-tools {display:inline-flex;gap:4px;align-items:center;margin-left:auto;padding:8px 0;font-weight:bold;font-size:12px;white-space:nowrap}
.direct-tools .icon {width:16px}
.direct-back {display:none}
.access-panel {flex:none;padding:12px 20px;background:var(--blush);font-size:13px}
.access-panel output {display:block;font:700 13px/1.7 monospace;letter-spacing:.06em;margin:5px 0;overflow-wrap:anywhere;user-select:all}
.access-panel>div {display:flex;gap:20px;flex-wrap:wrap}
.access-panel button,.direct-older {border:0;background:transparent;padding:5px 0;text-decoration:underline;color:var(--plum);font-weight:700;font-size:12px}
.direct-scroll {flex:1;overflow:auto;overscroll-behavior:contain;min-height:0;padding:18px clamp(12px,3vw,28px);scrollbar-width:thin}
.direct-empty {min-height:100%;display:grid;align-content:center;justify-items:center;gap:6px;text-align:center;padding:18px}
.direct-empty h2,.direct-empty h3 {font:400 clamp(26px,3vw,40px)/1.08 var(--serif)}
.direct-empty p {max-width:35ch;color:var(--chat-muted);font-size:14px}
.direct-emblem {display:grid;place-items:center;margin:0 0 5px;width:43px;height:43px;border-radius:50%;background:var(--blush);color:var(--cherry)}
.direct-older {display:block;margin:auto}
[data-log] {display:flex;flex-direction:column;gap:10px}
.dm {align-self:flex-start;max-width:min(85%,55ch)}
.dm.mine {align-self:flex-end}
.dm p {margin:0;width:fit-content;padding:9px 15px;border-radius:19px 19px 19px 5px;background:#eee8e2;color:#312623;line-height:1.42;overflow-wrap:anywhere;white-space:pre-wrap}
.dm.mine p {margin-left:auto;border-radius:19px 19px 5px 19px;background:var(--cherry);color:white}
.dm time,.direct-receipt {display:block;margin:3px 4px 0;font-size:10.5px;color:var(--chat-muted)}
.dm.mine time,.direct-receipt {text-align:right}
.direct-compose,.direct-restore {flex:none;padding:10px clamp(12px,3vw,22px)}
.direct-compose {border-top:1px solid var(--chat-border);background:#fffcf8}
.direct-compose label,.direct-restore label {display:block;font-size:12px;font-weight:700}
.direct-name input,.direct-restore input {display:block;width:100%;border:1px solid var(--chat-border);background:white;border-radius:12px;padding:8px 12px;margin:4px 0 10px;font-size:16px}
.direct-input {display:flex;align-items:flex-end;padding:4px;gap:8px;border:1px solid #cfc0bb;border-radius:24px;background:#fff}
.direct-input textarea {flex:1;min-width:0;border:0;border-radius:18px;padding:9px 10px;min-height:38px;line-height:1.3;resize:none;background:transparent;font-size:16px}
.direct-input button {display:grid;place-items:center;width:38px;height:38px;flex:none;border:0;border-radius:50%;background:var(--cherry);color:white}
.direct-input button:disabled {opacity:.55}
.direct-input .icon {transform:rotate(-90deg);width:20px}
.direct-restore {font-size:12px;color:var(--plum)}
.direct-restore summary {width:fit-content;cursor:pointer;padding:4px 0}
.direct-restore label {margin-top:5px}
.direct-status {font-size:12px;color:var(--plum);padding:0 16px 8px}
.direct-status:empty {display:none}
.direct-inbox {border-right:1px solid var(--chat-border);min-width:0}
.direct-inbox h2 {font:400 27px/1.15 var(--serif);padding:22px 16px 14px}
.direct-inbox nav {max-height:min(56dvh,600px);overflow:auto}
.direct-inbox nav>p {padding:12px 16px;color:var(--chat-muted);font-size:13px}
.dm-contact {display:grid;grid-template-columns:minmax(0,1fr) auto;gap:3px;padding:13px 16px;border-top:1px solid var(--chat-border);font-size:14px}
.dm-contact[aria-current] {background:var(--blush);box-shadow:inset 3px 0 var(--cherry)}
.dm-contact strong,.dm-contact small {overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dm-contact small {grid-column:1/-1;color:var(--chat-muted)}
.dm-contact i {align-self:center;border-radius:20px;min-width:18px;padding:1px 5px;background:var(--cherry);color:white;text-align:center;font:700 11px/16px var(--sans)}
@media(max-width:720px) {
    .direct:not(.staff-direct) {margin:0 auto}
    .direct-layout {border-radius:16px}
    .direct-room {height:clamp(340px,calc(100dvh - 161px - env(safe-area-inset-bottom)),760px)}
    .direct-head {min-height:62px;padding:8px 12px;gap:9px}
    .direct-head h1,.direct-head h2 {font-size:26px}
    .direct-avatar {width:39px;height:39px}
    .direct-empty {padding:10px}
    .staff-direct .direct-layout {grid-template-columns:1fr}
    .staff-direct .direct-inbox {border:0}
    .staff-direct:not(.has-selection) .direct-room,.staff-direct.has-selection .direct-inbox {display:none}
    .staff-direct .direct-room {height:clamp(340px,calc(100dvh - 275px),650px)}
    .direct-back {display:grid;place-items:center;width:30px;height:40px}
}

.chat-launcher {position:fixed;z-index:24;right:max(20px,env(safe-area-inset-right));bottom:max(20px,env(safe-area-inset-bottom));display:flex;align-items:center;justify-content:center;gap:8px;height:48px;padding:0 18px;border:1px solid #ffffff35;border-radius:99px;background:var(--brand-red);color:white;font-weight:700;box-shadow:0 5px 22px #230e1533}
.chat-launcher .chat-count {position:absolute;top:-5px;right:-4px;border:1px solid var(--paper);border-radius:20px;background:var(--card);color:var(--red);padding:2px 5px;font:700 11px var(--sans)}
.chat-popup {position:fixed;inset:auto max(18px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) auto;margin:0;padding:0;width:min(410px,calc(100% - 24px));max-width:100%;max-height:95dvh;border:1px solid var(--line);border-radius:20px;background:var(--card);color:var(--ink);box-shadow:0 16px 65px #23111740;overflow:hidden}
.chat-popup-bar {display:flex;align-items:center;justify-content:space-between;gap:8px;padding:7px 10px 7px 18px;background:var(--card);border-bottom:1px solid var(--line);font-size:14px}
.chat-popup-bar button {display:grid;place-items:center;border:0;border-radius:50%;width:36px;height:36px;background:var(--paper);color:var(--ink)}
.chat-popup .direct {margin:0;max-width:none}
.chat-popup .direct-layout {display:block;border:0;border-radius:0;box-shadow:none}
.chat-popup .direct-room,.chat-popup .direct-inbox {height:min(520px,calc(89dvh - 60px))}
.chat-popup .direct-inbox {display:flex;flex-direction:column;border:0}
.chat-popup .direct-inbox nav {flex:1;min-height:0;max-height:none}
.chat-popup .staff-direct:not(.has-selection) .direct-room,.chat-popup .staff-direct.has-selection .direct-inbox {display:none}
.chat-popup .direct-back {display:grid;place-items:center;width:36px;height:40px}
.chat-popup .direct-head {min-height:65px;padding:10px 14px;gap:9px}
.chat-popup .direct-head :is(h1,h2) {font-size:25px}
.chat-popup .direct-empty :is(h2,h3) {font-size:31px}
@media(max-width:900px) { .admin-dock~.chat-launcher {bottom:calc(79px + env(safe-area-inset-bottom))} }
@media(max-width:720px) {
    .chat-launcher {bottom:calc(76px + env(safe-area-inset-bottom));right:13px;width:46px;height:46px;padding:0}
    .chat-launcher>span {display:none}
    .chat-popup {right:8px;bottom:max(8px,env(safe-area-inset-bottom));width:calc(100% - 16px);max-width:410px}
}
.dm-contact {grid-template-columns:44px minmax(0,1fr) auto;align-items:center;column-gap:11px}
.dm-contact .direct-avatar {grid-row:1/3;width:42px;height:42px}
.dm-contact strong {grid-column:2;grid-row:1}
.dm-contact i {grid-column:3;grid-row:1/3}
.dm-contact small {grid-column:2;grid-row:2}
.direct-avatar {overflow:hidden;flex:none}
.direct-avatar img {width:100%;height:100%;object-fit:cover}
.dm-photo,.dm-document {display:block;border-radius:15px;overflow:hidden;background:var(--paper);color:var(--ink)}
.dm-photo img {display:block;max-width:100%;width:auto;max-height:300px}
.dm-document {padding:12px 16px;border:1px solid var(--chat-border);overflow-wrap:anywhere}
.direct-compose .attach-control,.chat-profile {position:relative;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}
.attach-control {flex:none;width:38px;height:38px;background:var(--paper);color:var(--ink);border-radius:50%}
.attach-control:focus-within,.chat-profile:focus-within {outline:2px solid var(--cherry)}
.attach-control input,.chat-profile input {position:absolute;inset:0;opacity:0;width:100%;height:100%;cursor:pointer}
.chat-profile {align-self:flex-start;gap:8px;margin:8px 16px 0;color:var(--chat-muted);font-size:12px}
.chat-profile .direct-avatar {width:28px;height:28px;font-size:13px}
.attachment-preview {display:flex;align-items:center;gap:8px;margin-bottom:8px;padding:6px;border:1px solid var(--chat-border);border-radius:12px;font-size:12px}
.attachment-preview img {width:46px;height:46px;object-fit:cover;border-radius:6px}
.attachment-preview span {min-width:0;overflow-wrap:anywhere}
.attachment-preview button {margin-left:auto;background:transparent;border:0;color:inherit;font-size:20px}
.dm:has(.dm-sender-avatar) {position:relative;margin-left:29px}
.dm.mine:has(.dm-sender-avatar) {margin-left:0;margin-right:29px}
.dm-sender-avatar {display:grid;place-items:center;position:absolute;left:-29px;bottom:17px;width:23px;height:23px;border-radius:50%;background:var(--blush);color:var(--plum);overflow:hidden;font:700 11px var(--sans)}
.dm.mine .dm-sender-avatar {left:auto;right:-29px}
.dm-sender-avatar img {width:100%;height:100%;object-fit:cover;object-position:50% 25%}
.chat-photo-view {padding:0;border:0;background:transparent;color:white;max-width:95vw;max-height:90dvh;margin:auto}
.chat-photo-view::backdrop {background:#130e11cd;backdrop-filter:blur(12px)}
.chat-photo-view img {display:block;max-width:95vw;max-height:90dvh;border-radius:12px;object-fit:contain}
.chat-photo-view button {position:absolute;right:9px;top:9px;width:38px;height:38px;display:grid;place-items:center;background:#23171bcf;color:white;border:0;border-radius:50%}
