.chat-header-link b{background:#c73548;color:#fff;border-radius:14px;padding:1px 7px}.chat-peer-setting{padding:18px 0;border-bottom:1px solid #e0e9ef;display:flex;gap:16px;align-items:center;justify-content:space-between}.chat-recipient-company{margin:20px 0;padding:16px;border:1px solid #d8e4ee;border-radius:12px}.chat-recipient-company .table-wrap{max-height:340px;overflow:auto}.staff-chat-thread{min-height:160px}.staff-chat-message{max-width:88%;padding:16px 20px;margin:14px 0 14px auto;border:1px solid #dbe5ee;border-radius:14px;background:#fff;overflow-wrap:anywhere}.staff-chat-message.is-mine{margin-right:auto;margin-left:0;background:var(--ui-hover,#eaf8f5);border-color:var(--ui-accent,#bfdfd8)}.staff-chat-message small{display:block;color:#758998;margin-top:5px}.staff-chat-message p{white-space:pre-wrap;line-height:1.9;margin:12px 0}.staff-chat-message .button{margin:8px 0;max-width:100%;overflow-wrap:anywhere}.staff-chat-thread [data-chat-messages]:empty:before{content:'هنوز پیامی ثبت نشده است.';color:#8295a6}@media(max-width:700px){.staff-chat-message{max-width:100%}.chat-peer-setting{display:block}}

/* Functional hidden states must override the theme button display rules. */
[data-chat-push] [hidden],.chat-header-link [hidden],[data-notification-count][hidden]{display:none!important}

.chat-message-actions{display:flex;flex-wrap:wrap;align-items:start;gap:8px;margin-top:12px}.chat-message-actions form{margin:0}.chat-message-actions .button{margin:0;padding:6px 12px;font-size:.85rem}.chat-edit{max-width:100%}.chat-edit summary{cursor:pointer;padding:6px 12px;border:1px solid var(--border,#b3c7da);border-radius:9px}.chat-edit[open]{flex-basis:100%}.chat-edit textarea{min-width:min(100%,320px);width:100%}.chat-reply-quote,.chat-reply-preview{margin:12px 0;padding:10px 14px;border-inline-start:3px solid var(--ui-accent,#008c83);background:var(--surface-alt,#edf5f8);border-radius:8px;color:var(--text,#17384c)}.chat-reply-quote p{margin:4px 0;font-size:.9rem}.staff-chat-message.is-deleted [data-chat-body]{font-style:italic;opacity:.8}.staff-chat-message:target{outline:2px solid var(--ui-accent,#008c83)}.chat-reply-preview[hidden]{display:none!important}
html[data-theme="dark"] .chat-reply-quote,html[data-theme="dark"] .chat-reply-preview{background:#213947;color:#e5f2f8}
.staff-chat-message{padding:9px 12px;margin-block:7px;border-radius:10px}.chat-message-heading{display:flex;align-items:baseline;justify-content:space-between;gap:8px 16px;flex-wrap:wrap}.staff-chat-message small{display:inline;margin:0;font-size:.72rem}.staff-chat-message p{line-height:1.65;margin:6px 0}.chat-message-actions{gap:6px;margin-top:5px}.chat-message-actions .button,.chat-edit summary{padding:3px 9px;font-size:.76rem;min-height:28px;line-height:1.5;border-radius:7px}.chat-message-actions form{display:inline-flex}.chat-edit[open] form{display:block}.chat-reply-quote,.chat-reply-preview{margin:6px 0;padding:6px 9px}.chat-reply-quote p{margin:2px 0;font-size:.82rem}.staff-chat-message>a.button{padding:4px 9px;margin:3px 4px 3px 0;min-height:28px;font-size:.8rem}.staff-chat-thread{padding:12px 16px}.staff-chat-thread [data-chat-connection]{margin:6px 0 0;font-size:.76rem}.staff-chat-message .chat-edit textarea{margin:6px 0;min-height:75px}#chat-composer textarea[name="chat_body"]{min-height:76px;max-height:280px;resize:vertical}#chat-composer .muted{margin:6px 0;font-size:.78rem}.staff-chat-message.is-deleted{padding-block:7px}.staff-chat-message.is-deleted p{margin:3px 0}@media(max-width:700px){.staff-chat-thread{padding:9px}.staff-chat-message{padding:8px 10px}.chat-message-heading{gap:3px 8px}}

.chat-device-control{position:relative;display:inline-flex;flex:0 0 40px}.topbar .chat-device-toggle{display:inline-flex;align-items:center;justify-content:center;flex:0 0 40px;width:40px;height:40px;min-height:40px;padding:0;margin:0;border-radius:50%;border:1px solid var(--ui-border,#b3c7da);background:var(--ui-hover,#e2f1ef);color:var(--ui-text,#17384c)}.chat-device-toggle svg{display:block;width:20px;height:20px}.chat-device-toggle[aria-pressed="true"]{box-shadow:inset 0 0 0 2px var(--ui-accent,#008c83)}.chat-device-toggle:hover{filter:brightness(.95)}.chat-device-control [hidden]{display:none!important}.chat-device-status{position:absolute;inset-block-start:calc(100% + 10px);inset-inline-end:0;z-index:1200;width:min(290px,80vw);padding:10px 12px;font-size:.82rem;line-height:1.7;background:var(--ui-panel,#fff);color:var(--ui-text,#17384c);border:1px solid var(--ui-border,#b3c7da);border-radius:10px;box-shadow:0 6px 20px #0002}@media print{.chat-device-control{display:none}}
[data-chat-archive]{margin-block:0 14px}.chat-archive-icon{display:inline-flex;align-items:center;justify-content:center;width:38px;height:38px;min-height:38px;padding:0;border-radius:10px}.chat-archive-icon svg{display:block;width:19px;height:19px}

.chat-message-actions .message-icon{display:inline-flex;align-items:center;justify-content:center;width:34px;height:34px;min-height:34px;padding:0;margin:0;border:1px solid var(--ui-border,#b3c7da);border-radius:8px;line-height:1;list-style:none;cursor:pointer}.chat-message-actions .message-icon svg{display:block;width:17px;height:17px}.chat-message-actions summary.message-icon::-webkit-details-marker{display:none}.chat-message-actions summary.message-icon::marker{content:""}

.chat-unread-divider{display:flex;align-items:center;gap:12px;color:var(--ui-accent);font-weight:700;margin:16px 0;scroll-margin-top:100px}.chat-unread-divider:before,.chat-unread-divider:after{content:"";height:1px;flex:1;background:currentColor;opacity:.4}.chat-jump-latest{position:fixed;left:24px;bottom:24px;z-index:50;box-shadow:0 3px 16px #0003;background:var(--ui-panel);color:var(--ui-text)}.chat-jump-latest[hidden]{display:none!important}[data-chat-message]{scroll-margin-top:100px}@media(max-width:600px){.chat-jump-latest{left:12px;bottom:16px;max-width:calc(100vw - 24px)}}

/* Compact display only; original message and edit history remain untouched. */
.staff-chat-thread .staff-chat-message{padding:7px 10px;margin-block:5px;min-height:0}.staff-chat-thread .staff-chat-message [data-chat-body]{white-space:pre-wrap;line-height:1.5;margin:4px 0}.staff-chat-thread .chat-reply-quote{padding:5px 8px;margin:4px 0}.staff-chat-thread .chat-reply-quote p{white-space:pre-wrap;line-height:1.4;margin:2px 0}.staff-chat-thread .chat-message-heading{line-height:1.4}.staff-chat-thread .chat-message-actions{margin-top:3px;gap:5px}.staff-chat-thread .chat-message-actions .message-icon{width:30px;height:30px;min-height:30px}.staff-chat-thread .chat-message-actions:empty{display:none}.staff-chat-thread{padding:10px 12px}.staff-chat-thread [data-chat-connection]{margin:4px 0 0}#chat-composer{padding-block:14px}#chat-composer textarea[name="chat_body"]{min-height:68px;margin-top:4px}#chat-composer label{margin-bottom:8px}
