.portal-chat { position: fixed; z-index: 70; right: max(24px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom)); }
.portal-chat [hidden], .support-admin-workspace [hidden] { display: none !important; }
.chat-launcher { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 10px 19px 10px 11px; border: 1px solid #a376d5; border-radius: 30px; background: #623298; color: #fff; font-size: .82rem; font-weight: 600; box-shadow: 0 8px 28px rgb(42 14 69 / 22%); }
.chat-launcher:hover { background: #7542ac; }
.chat-launcher img, .chat-team-avatar { border-radius: 50%; flex-shrink: 0; }
.chat-panel { position: absolute; right: 0; bottom: 66px; display: flex; flex-direction: column; width: 420px; max-width: calc(100vw - 32px); height: min(760px, calc(100vh - 112px)); height: min(760px, calc(100dvh - 112px)); overflow: hidden; border: 1px solid var(--line-strong); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.chat-panel-header { display: flex; align-items: center; gap: 12px; padding: 17px; background: #3d1e5e; color: #fff; }
.chat-panel-header > div { flex: 1; min-width: 0; }
.chat-panel-header h2 { color: #fff; font-size: 1.08rem; letter-spacing: -.025em; }
.chat-panel-header p { margin-top: 5px; color: #e1d2ee; font-size: .73rem; line-height: 1.5; }
.chat-close, .chat-icon-button { display: inline-grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface); color: var(--text); font-size: 1.4rem; }
.chat-close { border-color: #785499; background: transparent; color: #fff; }
.chat-close:hover { background: #563077; }
.chat-close svg, .chat-icon-button svg { width: 20px; height: 20px; }
.chat-panel-content { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 10px; padding: 15px; overflow-y: auto; overscroll-behavior: contain; }
.chat-panel .field > label { font-size: .76rem; }
.chat-panel .field > label .muted { font-size: .68rem; font-weight: 400; }
.chat-panel .field input, .chat-panel .field select, .chat-panel .field textarea { font-size: .85rem; }
.chat-panel .field textarea { min-height: 82px; }
.chat-account-gate, .chat-legacy-notice { padding: 13px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface-soft); font-size: .78rem; line-height: 1.6; }
.chat-account-gate > strong, .chat-legacy-notice > strong { color: var(--text); }
.chat-account-gate p, .chat-legacy-notice p { margin: 7px 0 10px; color: var(--muted); }
.chat-account-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.chat-account-actions .button { min-height: 44px; }
.chat-account-summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.chat-account-summary > div { min-width: 0; }
.chat-account-summary > div > span { display: block; color: var(--muted); font-size: .62rem; }
.chat-account-summary strong { display: block; overflow-wrap: anywhere; margin-top: 3px; font-size: .83rem; }
.chat-account-summary .text-link, .chat-text-button { display: inline-flex; align-items: center; min-height: 44px; max-width: 100%; padding: 5px 0; border: 0; background: transparent; color: var(--accent-bright); font-size: .72rem; line-height: 1.5; text-align: left; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.chat-text-button:disabled { color: var(--muted); opacity: .65; cursor: not-allowed; }
.chat-history-picker { display: grid; gap: 5px; }
.chat-history-picker label { color: var(--muted); font-size: .68rem; }
.chat-history-picker select { width: 100%; min-width: 0; min-height: 44px; padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text); font-size: 16px; }
.chat-history-picker .chat-text-button { justify-self: start; }
.chat-claim-confirmation { display: flex; align-items: flex-start; gap: 9px; margin: 10px 0; min-height: 44px; font-size: .76rem; }
.chat-claim-confirmation input { flex-shrink: 0; width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); }
.chat-legacy-notice .button { min-height: 44px; white-space: normal; line-height: 1.5; }
.chat-start-form { display: flex; flex-direction: column; gap: 13px; }
.chat-welcome strong { display: block; font-size: 1rem; }
.chat-welcome p { margin-top: 5px; color: var(--muted); font-size: .77rem; line-height: 1.6; }
.chat-feedback { color: var(--muted); font-size: .77rem; line-height: 1.65; overflow-wrap: anywhere; }
.chat-feedback:empty { display: none; }
.chat-feedback.is-error { padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--danger); background: var(--surface-soft); }
.chat-conversation { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 10px; }
.chat-conversation-meta { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding-bottom: 11px; border-bottom: 1px solid var(--line); }
.chat-conversation-meta > div { min-width: 0; overflow-wrap: anywhere; }
.chat-conversation-meta strong { display: block; font-size: .85rem; }
.chat-conversation-meta div > span { display: block; margin-top: 4px; font-size: .76rem; }
.chat-conversation-meta [data-chat-category] { color: var(--muted); font-size: .67rem; }
.chat-conversation-meta .badge { flex-shrink: 0; max-width: 130px; white-space: normal; text-align: center; font-size: .61rem; }
.chat-message-list { display: flex; flex-direction: column; align-items: stretch; gap: 12px; flex: 1; min-height: 130px; overflow-y: auto; overscroll-behavior: contain; padding: 7px 5px 10px 0; scrollbar-width: thin; }
.chat-message { max-width: 92%; min-width: 0; padding: 12px 13px; border-radius: 13px; border: 1px solid var(--line); }
.chat-message-own { align-self: flex-end; background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; border-bottom-right-radius: 3px; }
.chat-message-other { align-self: flex-start; background: var(--surface-raised); color: var(--text); border-bottom-left-radius: 3px; }
.chat-message-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 13px; margin-bottom: 6px; line-height: 1.5; }
.chat-message-meta strong { font-size: .68rem; overflow-wrap: anywhere; }
.chat-message-meta time { font-size: .63rem; opacity: .85; }
.chat-message > p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .86rem; line-height: 1.7; }
.chat-reply-form { padding-top: 10px; border-top: 1px solid var(--line); }
.chat-panel .chat-reply-form textarea { min-height: 66px; max-height: 150px; }
.chat-composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.chat-composer-actions .button { min-height: 44px; }
.chat-attach-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 44px; min-height: 44px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font-size: .76rem; }
.chat-attach-button svg { width: 20px; height: 20px; }
.chat-attach-button:hover { background: var(--surface-soft); border-color: var(--accent); }
.chat-attach-button:disabled, .chat-preview-remove:disabled { opacity: .5; cursor: not-allowed; }
.chat-composer-help { margin-top: 6px; color: var(--muted); font-size: .64rem; line-height: 1.6; }
.chat-pending-note { padding: 9px 11px; margin-bottom: 9px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--text); background: var(--surface-soft); font-size: .73rem; line-height: 1.6; }
.chat-upload-progress { margin-top: 9px; display: grid; gap: 5px; color: var(--muted); font-size: .72rem; }
.chat-upload-progress progress { width: 100%; height: 7px; accent-color: var(--accent); }
.chat-file-previews { display: flex; flex-direction: column; gap: 8px; max-height: 210px; overflow-y: auto; margin-bottom: 9px; }
.chat-file-preview { display: grid; grid-template-columns: 54px minmax(0, 1fr) 44px; gap: 9px; align-items: center; padding: 7px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.chat-file-preview img, .chat-file-preview video { display: block; width: 54px; height: 54px; border-radius: 6px; object-fit: cover; background: var(--surface); }
.chat-file-preview > div { min-width: 0; }
.chat-file-preview strong { display: block; font-size: .74rem; overflow-wrap: anywhere; }
.chat-file-preview small { display: block; margin-top: 3px; color: var(--muted); font-size: .65rem; }
.chat-preview-remove { width: 44px; min-height: 44px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-size: 1.3rem; }
.chat-preview-remove:hover { background: var(--surface); }
.chat-attachments { display: flex; flex-direction: column; gap: 10px; margin-top: 9px; }
.chat-attachment { max-width: 330px; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text); }
.chat-attachment-visual { display: block; }
.chat-attachment img { display: block; width: 100%; max-height: 240px; object-fit: contain; background: var(--surface-soft); }
.chat-attachment video { display: block; width: 100%; max-height: 240px; background: #151019; }
.chat-attachment-caption { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 10px; font-size: .71rem; }
.chat-attachment-caption > strong { flex-basis: 100%; overflow-wrap: anywhere; }
.chat-attachment-caption > span { color: var(--muted); }
.chat-attachment-caption > a { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent-bright); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.chat-attachment-storage { flex-basis: 100%; color: var(--muted); font-size: .62rem; line-height: 1.55; }
.chat-document-icon { display: grid; place-items: center; width: 54px; height: 54px; margin: 10px 10px 0; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--accent-bright); background: var(--surface-soft); font-size: .75rem; font-weight: 700; }
.chat-file-preview .chat-document-icon { margin: 0; }
.chat-session-note { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: .62rem; line-height: 1.6; }
.chat-session-details { color: var(--muted); font-size: .67rem; line-height: 1.6; }
.chat-session-details summary { display: flex; align-items: center; min-height: 44px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.chat-session-details p { margin-top: 6px; }
.chat-closed-note { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.chat-closed-note p { font-size: .76rem; line-height: 1.7; color: var(--muted); }
.support-protocol { overflow-wrap: anywhere; font-variant-numeric: tabular-nums; font-size: .7rem; }
.support-timezone-note { margin-top: 14px; font-size: .7rem; color: var(--muted); }
.support-admin-workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr); align-items: start; gap: 18px; }
.support-conversation-pane { min-width: 0; }
.support-inbox-sidebar.card, .support-inbox-overview.card { padding: 0; overflow: hidden; }
.support-inbox-sidebar { position: sticky; top: 22px; }
.support-inbox-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 19px 17px; border-bottom: 1px solid var(--line); }
.support-inbox-heading h2 { font-size: .93rem; }
.support-inbox-heading p, .support-inbox-heading > span { margin-top: 4px; color: var(--muted); font-size: .69rem; }
.support-inbox { display: flex; flex-direction: column; }
.support-inbox-sidebar .support-inbox { max-height: min(680px, 76vh); overflow-y: auto; scrollbar-width: thin; }
.support-inbox-person { display: flex; gap: 10px; padding: 16px 13px; color: var(--text); border-bottom: 1px solid var(--line); border-left: 3px solid transparent; text-decoration: none; }
.support-inbox-person:hover { background: var(--surface-soft); }
.support-inbox-person.is-selected { border-left-color: var(--accent); background: var(--surface-soft); }
.support-person-avatar { display: inline-grid; place-items: center; flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%; color: var(--accent-bright); background: var(--surface-soft); border: 1px solid var(--line-strong); font-size: .94rem; font-weight: 700; }
.support-inbox-person-copy { flex: 1; min-width: 0; }
.support-inbox-person-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; }
.support-inbox-person-heading strong { font-size: .79rem; overflow-wrap: anywhere; }
.support-inbox-person-heading time { color: var(--muted); font-size: .59rem; }
.support-inbox-subject, .support-inbox-preview { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .72rem; margin-top: 5px; }
.support-inbox-preview { color: var(--muted); font-size: .69rem; }
.support-inbox-person-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; margin-top: 10px; font-size: .59rem; }
.support-inbox-sector { color: var(--muted); }
.support-inbox-status { padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; }
.support-inbox-status-waiting { color: var(--accent-bright); }
.support-inbox-status-closed { color: var(--muted); }
.support-inbox-all { display: flex; justify-content: center; align-items: center; min-height: 50px; padding: 10px; color: var(--accent-bright); font-size: .73rem; text-decoration: underline; text-underline-offset: 3px; }
.support-inbox-empty { padding: 28px 20px; font-size: .83rem; line-height: 1.8; }
.support-inbox-empty p { margin-top: 8px; color: var(--muted); }
.support-inbox-overview { display: grid; grid-template-columns: minmax(320px, .9fr) minmax(0, 1fr); }
.support-inbox-overview-list { min-width: 0; border-right: 1px solid var(--line); }
.support-inbox-overview-list .pagination { padding: 16px; }
.support-inbox-intro { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 50px 40px; min-height: 440px; background: var(--surface-soft); }
.support-intro-symbol { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 24px; background: var(--surface); color: var(--accent-bright); border: 1px solid var(--line); margin-bottom: 24px; }
.support-intro-symbol svg { width: 34px; height: 34px; }
.support-inbox-intro h2 { font-size: 1.35rem; line-height: 1.4; max-width: 350px; }
.support-inbox-intro p { margin-top: 15px; max-width: 350px; color: var(--muted); font-size: .84rem; line-height: 1.85; }
.support-intro-note { margin-top: 26px; color: var(--muted); font-size: .67rem; }
.support-thread-card.card { padding: 0; overflow: hidden; }
.support-thread-header { display: flex; align-items: center; gap: 12px; padding: 20px; border-bottom: 1px solid var(--line); }
.support-thread-person { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.support-thread-person h2 { font-size: .99rem; }
.support-thread-person p { margin-top: 5px; color: var(--muted); font-size: .72rem; }
.support-thread-person .support-thread-subject { color: var(--text); font-size: .8rem; }
.support-thread-header .badge { max-width: 130px; white-space: normal; text-align: center; font-size: .62rem; }
.support-message-list { height: clamp(340px, 53vh, 580px); min-height: 260px; padding: 22px 18px; background: var(--surface-soft); }
.support-message-list .chat-message { max-width: 88%; }
.support-thread-card > .chat-feedback { margin: 0; padding: 10px 18px 0; }
.support-thread-card > .chat-feedback:empty { padding: 0; }
.support-thread-card > .pagination, .support-thread-card > .alert { margin: 12px 18px; }
.support-reply-form { padding: 15px 18px 17px; border-top: 1px solid var(--line); }
.support-reply-form textarea { min-height: 74px; max-height: 190px; }
.support-reply-form > .field-help { margin-top: 6px; font-size: .66rem; }
.support-inspector.card { padding: 0; margin-top: 16px; }
.support-inspector > summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px; padding: 18px; min-height: 60px; cursor: pointer; font-size: .82rem; font-weight: 600; }
.support-inspector > summary::after { content: '+'; font-size: 1.3rem; color: var(--accent-bright); }
.support-inspector[open] > summary::after { content: '−'; }
.support-inspector-hint { color: var(--muted); font-size: .66rem; font-weight: 400; }
.support-inspector-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 25px; padding: 22px 18px; border-top: 1px solid var(--line); }
.support-inspector-grid > section { min-width: 0; }
.support-inspector-grid h2 { font-size: .91rem; }
.support-inspector-grid .button { min-height: 44px; max-width: 100%; }
.support-details { display: flex; flex-direction: column; gap: 15px; margin: 0; }
.support-details dt { margin-bottom: 4px; color: var(--muted); font-size: .68rem; }
.support-details dd { margin: 0; font-size: .81rem; overflow-wrap: anywhere; }
.support-details dd.support-protocol { font-size: .68rem; }
.support-history { grid-column: 1/-1; }
.support-event-list { display: flex; flex-direction: column; gap: 17px; max-height: 420px; overflow-y: auto; padding: 0; margin: 0; list-style: none; scrollbar-width: thin; }
.support-event-list > li { display: flex; flex-direction: column; gap: 5px; padding: 0 0 16px 14px; border-left: 2px solid var(--line-strong); font-size: .77rem; }
.support-event-list > li:last-child { padding-bottom: 0; }
.support-event-list strong { line-height: 1.5; }
.support-event-list span, .support-event-list time { color: var(--muted); font-size: .68rem; }
.support-mobile-only { display: none; }
.portal-chat :focus-visible, .support-admin-workspace :focus-visible, .support-inbox-overview :focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@media (max-width: 1250px) {
    .support-admin-workspace { grid-template-columns: 245px minmax(0, 1fr); gap: 14px; }
    .support-thread-header { flex-wrap: wrap; padding: 17px; }
    .support-thread-header .badge { margin-left: 54px; }
    .support-inbox-person { gap: 8px; padding-inline: 10px; }
    .support-inbox-person .support-person-avatar { width: 34px; height: 34px; }
}
@media (max-width: 780px) {
    .support-admin-workspace { display: block; }
    .support-inbox-sidebar.card { display: none; position: static; }
    .support-admin-workspace[data-inbox-open="true"] .support-inbox-sidebar { display: block; }
    .support-admin-workspace[data-inbox-open="true"] .support-conversation-pane { display: none; }
    .support-mobile-only { display: inline-grid; }
    .support-inbox-sidebar .support-inbox { max-height: 65vh; }
    .support-thread-header { flex-wrap: wrap; gap: 9px; }
    .support-thread-header .badge { margin-left: 0; }
    .support-thread-header .support-thread-person { min-width: 150px; }
    .support-inbox-overview { grid-template-columns: minmax(0, 1fr); }
    .support-inbox-overview-list { border-right: 0; }
    .support-inbox-intro { display: none; }
    .support-page-heading { gap: 15px; }
}
@media (max-width: 600px) {
    .portal-chat { right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); }
    .chat-launcher { min-height: 48px; padding: 8px 15px 8px 9px; font-size: .76rem; }
    .chat-launcher img { width: 28px; height: 28px; }
    .chat-panel { right: 0; bottom: 60px; width: calc(100vw - 28px); max-width: 420px; height: min(760px, calc(100vh - 92px)); height: min(760px, calc(100dvh - 92px)); border-radius: 16px; }
    .chat-panel-header { padding: 13px; gap: 9px; }
    .chat-panel-header h2 { font-size: 1rem; }
    .chat-panel-header p { font-size: .67rem; }
    .chat-team-avatar { width: 38px; height: 38px; }
    .chat-panel-content { padding: 12px; }
    .chat-panel .field input, .chat-panel .field select, .chat-panel .field textarea, .support-reply-form textarea { font-size: 16px; }
    .chat-message-list { min-height: 110px; }
    .chat-message { padding: 10px; max-width: 95%; }
    .chat-message > p { font-size: .84rem; }
    .chat-attachment img, .chat-attachment video { max-height: 190px; }
    .chat-session-note { font-size: .61rem; }
    .support-thread-header { padding: 12px; }
    .support-thread-header > .support-person-avatar { width: 34px; height: 34px; }
    .support-thread-header .badge { margin-left: 52px; }
    .support-message-list { padding: 16px 11px; height: 48vh; min-height: 300px; max-height: 520px; }
    .support-message-list .chat-message { max-width: 96%; }
    .support-reply-form { padding: 12px; }
    .support-inspector-grid { grid-template-columns: minmax(0, 1fr); }
    .support-inspector-hint { display: none; }
}
@media print {
    .portal-chat, .support-inbox-sidebar, .support-reply-form { display: none; }
    .support-admin-workspace { display: block; }
    .support-message-list { height: auto; max-height: none; overflow: visible; }
}
.chat-forwarded-label { display: block; margin: 5px 0; color: var(--muted); font-size: .67rem; font-style: italic; }
