/* Hallmark · component: live-chat-workspace · genre: modern-minimal · theme: inherited locdev
 * Compact workbench, quiet surfaces, message-first hierarchy. Contact controls are untouched.
 * Pre-emit critique: P4 H4 E4 S4 R4 V3; component scope, inherited typography.
 */
@import url('./chat-tokens.css');
@import url('./chat-launchers.css');

.locdev-live-chat, .locdev-chat-admin, .locdev-chat-dialog {
    color: var(--locdev-chat-ink);
    font-family: var(--locdev-font-body);
    font-size: 14px;
    line-height: 1.5;
}
.locdev-live-chat, .locdev-chat-admin, .locdev-preview, .locdev-launcher-options {
    --locdev-chat-tint: color-mix(in srgb, var(--locdev-chat, #67d5d8) 12%, #fff);
}
:is(.locdev-live-chat, .locdev-chat-admin, .locdev-chat-dialog) [hidden] { display: none !important; }
:is(.locdev-live-chat, .locdev-chat-admin, .locdev-chat-dialog) button {
    min-height: 44px;
    margin: 0;
    font: inherit;
    letter-spacing: normal;
    text-transform: none;
    cursor: pointer;
}
:is(.locdev-live-chat, .locdev-chat-admin, .locdev-chat-dialog) :is(button, a, input, textarea, summary):focus-visible {
    outline: 2px solid var(--locdev-chat-focus);
    outline-offset: 3px;
}
:is(.locdev-live-chat, .locdev-chat-admin, .locdev-chat-dialog) button:disabled { opacity: .5; cursor: not-allowed; }
:is(.locdev-live-chat, .locdev-chat-admin, .locdev-chat-dialog) button:active:not(:disabled) { transform: translateY(1px); }
.locdev-live-chat .locdev-live-chat-launcher {
    background: var(--locdev-chat-ink);
    color: var(--locdev-chat-surface);
    border: 0;
    border-radius: var(--locdev-chat-radius);
    box-shadow: var(--locdev-chat-elevation);
    gap: 12px;
    padding: 10px 16px 10px 10px;
    min-width: 0;
}
.locdev-live-chat-launcher .locdev-live-chat-launcher-copy :is(strong, small) { color: inherit; }
.locdev-live-chat-launcher .locdev-live-chat-launcher-copy strong { font-size: 14px; }
.locdev-live-chat-launcher .locdev-live-chat-launcher-copy strong { text-transform: none; letter-spacing: normal; }
.locdev-live-chat-launcher .locdev-live-chat-launcher-copy small { opacity: .8; font-size: 12px; text-transform: none; }
.locdev-live-chat-launcher .locdev-live-chat-launcher-icon { background: var(--locdev-chat); color: var(--locdev-chat-ink); border-radius: 12px; }
.locdev-live-chat .locdev-live-chat-panel {
    width: min(408px, calc(100vw - 32px));
    height: min(660px, calc(100dvh - 110px));
    min-height: min(420px, calc(100dvh - 110px));
    grid-template-rows: auto minmax(0, 1fr) auto;
    border: 1px solid var(--locdev-chat-border);
    border-radius: var(--locdev-chat-radius);
    background: var(--locdev-chat-surface);
    box-shadow: var(--locdev-chat-elevation);
    overflow: hidden;
}
.locdev-live-chat .locdev-live-chat-head {
    background: var(--locdev-chat-surface);
    color: var(--locdev-chat-ink);
    border-bottom: 1px solid var(--locdev-chat-border);
    padding: 18px 16px;
    gap: 12px;
}
.locdev-live-chat-head > div:nth-child(2) { min-width: 0; }
.locdev-live-chat-head #locdev-live-chat-title { color: var(--locdev-chat-ink); font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }
.locdev-live-chat-head p { color: var(--locdev-chat-muted); font-size: 12px; margin-top: 4px; }
.locdev-live-chat .locdev-live-chat-avatar { background: color-mix(in srgb, var(--locdev-chat) 22%, var(--locdev-chat-surface)); color: var(--locdev-chat-ink); border: 0; border-radius: 14px; }
.locdev-live-chat-head [data-live-chat-close] { width: 44px; height: 44px; padding: 12px; background: var(--locdev-chat-canvas); border: 0; color: var(--locdev-chat-ink); border-radius: 50%; }
.locdev-live-chat .locdev-live-chat-body { padding: 20px 16px 12px; background: var(--locdev-chat-canvas); gap: 16px; }
.locdev-live-chat .locdev-live-chat-conversation { position: relative; gap: 12px; }
.locdev-live-chat .locdev-live-chat-messages { gap: 14px; padding: 0 2px 8px; scrollbar-width: thin; overscroll-behavior: contain; }
.locdev-live-chat .locdev-live-chat-message { max-width: 88%; }
.locdev-live-chat .locdev-live-chat-message p { font-size: 14px; line-height: 1.6; }
.locdev-live-chat .locdev-live-chat-message.is-support:not(.is-intro) > p {
    background: var(--locdev-chat-tint); color: var(--locdev-chat-ink); border: 1px solid var(--locdev-chat-border); border-radius: 14px 14px 14px 4px; box-shadow: none;
}
.locdev-live-chat .locdev-live-chat-message.is-visitor > p {
    background: var(--locdev-chat-tint); color: var(--locdev-chat-ink); border: 1px solid var(--locdev-chat-border); border-radius: 14px 14px 4px 14px; box-shadow: none;
}
.locdev-live-chat .locdev-live-chat-message.is-intro { max-width: 100%; background: none; border: 0; border-radius: 0; padding: 4px 0 16px; box-shadow: none; gap: 12px; }
.locdev-live-chat-message.is-intro .locdev-live-chat-intro-avatar { display: none; }
.locdev-live-chat .is-intro strong { font-size: 16px; color: var(--locdev-chat-ink); }
.locdev-live-chat .is-intro small { color: var(--locdev-chat-muted); font-size: 12px; }
.locdev-live-chat .locdev-live-chat-message.is-auto-reply { padding: 12px 14px; border: 1px solid var(--locdev-chat-border); background: var(--locdev-chat-tint); border-radius: 14px; gap: 8px; }
.locdev-live-chat .locdev-live-chat-message.is-support.is-auto-reply > p { background: none; border: 0; color: var(--locdev-chat-ink); padding: 0; font-size: 14px; }
.locdev-live-chat .locdev-live-chat-auto-label { color: var(--locdev-chat-muted); font-size: 11px; }
/* Shared support identity: real replies and clearly identified automation. */
:is(.locdev-live-chat, .locdev-chat-admin) .locdev-chat-sender { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; margin: 0 0 6px; text-align: left; }
:is(.locdev-live-chat, .locdev-chat-admin) .locdev-chat-sender-avatar { position: relative; display: grid; place-items: center; flex: 0 0 30px; width: 30px; height: 30px; overflow: hidden; border-radius: 9px; background: var(--locdev-chat-surface); border: 1px solid var(--locdev-chat-border); color: var(--locdev-chat-ink); font: 700 13px/1 var(--locdev-font-body, sans-serif); }
:is(.locdev-live-chat, .locdev-chat-admin) .locdev-chat-sender-avatar img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none; margin: 0; padding: 2px; object-fit: contain; background: var(--locdev-chat-surface); border: 0; border-radius: inherit; }
:is(.locdev-live-chat, .locdev-chat-admin) .locdev-chat-sender-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
:is(.locdev-live-chat, .locdev-chat-admin) .locdev-chat-sender-copy strong { color: var(--locdev-chat-ink); font-size: 12px; font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; text-transform: none; letter-spacing: normal; }
:is(.locdev-live-chat, .locdev-chat-admin) .locdev-chat-sender-role { display: block; color: var(--locdev-chat-muted); font-size: 12px; font-weight: 400; line-height: 1.4; text-transform: none; letter-spacing: normal; }
:is(.locdev-live-chat, .locdev-chat-admin) :is(.is-auto-reply, .is-system) > .locdev-chat-sender { margin-bottom: 0; }
.locdev-chat-admin .is-admin > .locdev-chat-sender { align-self: flex-end; }
.locdev-live-chat .is-auto-reply > time, .locdev-chat-admin .is-system > time { align-self: flex-start; color: var(--locdev-chat-muted); margin: 0; font-size: 12px; line-height: 1.5; }
.locdev-live-chat .locdev-live-chat-quick { justify-content: flex-start; flex-direction: column; gap: 8px; padding: 0; }
.locdev-live-chat .locdev-live-chat-quick button { width: 100%; text-align: left; padding: 10px 14px; background: var(--locdev-chat-surface); color: var(--locdev-chat-ink); border: 1px solid var(--locdev-chat-border); box-shadow: none; border-radius: 10px; font-size: 13px; overflow-wrap: anywhere; }
.locdev-live-chat .locdev-live-chat-quick button::after { content: '↗'; float: right; margin-left: 8px; }
.locdev-live-chat:not(.has-messages) .locdev-live-chat-messages { flex: 0 1 auto; }
.locdev-live-chat .locdev-live-chat-form { padding: 10px 14px 12px; border-top: 1px solid var(--locdev-chat-border); background: var(--locdev-chat-surface); gap: 4px; position: relative; }
.locdev-live-chat .locdev-live-chat-composer-row { gap: 4px 8px; }
.locdev-live-chat .locdev-live-chat-tools { gap: 8px; }
.locdev-live-chat .locdev-live-chat-tools button { color: var(--locdev-chat-muted); background: none; }
.locdev-live-chat .locdev-live-chat-form textarea { background: var(--locdev-chat-canvas); border: 1px solid var(--locdev-chat-border); border-radius: 12px; color: var(--locdev-chat-ink); box-shadow: none; font-size: 16px; min-height: 46px; padding: 11px 12px; }
.locdev-live-chat .locdev-live-chat-send { background: var(--locdev-chat-ink); color: var(--locdev-chat-surface); border-radius: 12px; width: 46px; height: 46px; }
.locdev-live-chat .locdev-live-chat-send, .locdev-chat-admin .locdev-chat-send { background: var(--locdev-chat-ink) !important; color: var(--locdev-chat-surface) !important; }
.locdev-chat-composer-hint { color: var(--locdev-chat-muted); font-size: 10px; padding-top: 6px; }
.locdev-live-chat .locdev-live-chat-status:empty { display: none; }
.locdev-live-chat .locdev-live-chat-status { position: static; margin: 4px 0 0; min-height: 0; font-size: 12px; }
.locdev-live-chat-status[data-state=error], .locdev-live-chat-lead-status[data-state=error] { color: var(--locdev-chat-error); }
.locdev-live-chat .locdev-live-chat-emoji-menu { position: absolute; bottom: 100%; left: 12px; right: 12px; z-index: 2; grid-template-columns: repeat(4,minmax(0,1fr)); background: var(--locdev-chat-surface); box-shadow: var(--locdev-chat-elevation); padding: 8px; gap: 8px; border: 1px solid var(--locdev-chat-border); }
.locdev-live-chat .locdev-live-chat-rating { position: absolute; inset: auto 0 0; max-height: 80%; overflow-y: auto; padding: 24px 20px; z-index: 3; background: var(--locdev-chat-surface); border-top: 1px solid var(--locdev-chat-border); box-shadow: var(--locdev-chat-elevation); }
.locdev-live-chat .locdev-live-chat-rating-foot button { background: var(--locdev-chat-ink); color: var(--locdev-chat-surface); white-space: nowrap; }
.locdev-live-chat .locdev-live-chat-lead { border: 0; padding: 0; background: none; box-shadow: none; gap: 20px; }
.locdev-live-chat .locdev-live-chat-lead-intro { display: block; padding: 0 0 4px; margin: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
.locdev-live-chat-lead-intro > span { display: none; }
.locdev-live-chat .locdev-live-chat-lead-intro h3 { font-size: 20px; font-weight: 700; line-height: 1.35; color: var(--locdev-chat-ink); margin: 0 0 8px; padding: 0; letter-spacing: normal; }
.locdev-live-chat .locdev-live-chat-lead-intro p { color: var(--locdev-chat-muted); font-size: 14px; line-height: 1.6; margin: 0; padding: 0; }
.locdev-live-chat .locdev-live-chat-lead-fields { gap: 16px; }
.locdev-live-chat .locdev-live-chat-lead-fields label { margin: 0; gap: 8px; font-size: 13px; font-weight: 600; }
.locdev-live-chat .locdev-live-chat-lead input { display: block; box-sizing: border-box; width: 100%; max-width: 100%; height: 48px; min-height: 48px; margin: 0; padding: 12px 14px; background: var(--locdev-chat-surface); border: 1px solid var(--locdev-chat-border); box-shadow: none; border-radius: 10px; font: 400 16px/1.4 var(--locdev-font-body, sans-serif); appearance: none; outline: none; }
.locdev-live-chat .locdev-live-chat-lead input::placeholder { color: var(--locdev-chat-muted); font-weight: 400; opacity: .8; }
.locdev-live-chat .locdev-live-chat-lead input:focus { border-color: var(--locdev-chat-focus); outline: none; box-shadow: 0 0 0 3px var(--locdev-chat-tint); }
.locdev-live-chat .locdev-live-chat-lead input:user-invalid { border-color: var(--locdev-chat-error); }
.locdev-live-chat .locdev-live-chat-lead-submit { min-height: 48px; margin: 0; padding: 12px 16px; background: var(--locdev-chat); color: var(--locdev-chat-on-brand, #000); border: 1px solid var(--locdev-chat-border); border-radius: 10px; box-shadow: none; font-weight: 600; }
.locdev-live-chat .locdev-live-chat-privacy { margin: 0; font-size: 12px; line-height: 1.6; }
.locdev-live-chat .locdev-live-chat-lead-status:empty { display: none; }
.locdev-live-chat .locdev-live-chat-privacy { background: none; padding: 0; color: var(--locdev-chat-muted); font-size: 11px; }
.locdev-chat-ended { margin-top: auto; padding: 16px 0; border-top: 1px solid var(--locdev-chat-border); }
.locdev-chat-ended p { font-size: 13px; color: var(--locdev-chat-muted); margin: 4px 0 12px; }
.locdev-chat-ended > div { display: flex; gap: 8px; }
.locdev-chat-ended button { padding: 8px 14px; border: 1px solid var(--locdev-chat-border); border-radius: 10px; background: var(--locdev-chat-surface); color: var(--locdev-chat-ink); white-space: nowrap; }
.locdev-chat-ended [data-chat-new] { background: var(--locdev-chat-ink); color: var(--locdev-chat-surface); }
.locdev-chat-typing { font-size: 12px; color: var(--locdev-chat-muted); margin: 0; padding: 4px; }
.locdev-chat-day { align-self: center; text-align: center; font-size: 11px; color: var(--locdev-chat-muted); padding: 8px 0; font-variant-numeric: tabular-nums; }
.locdev-chat-message-meta { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 28px; }
.locdev-chat-message-meta .locdev-chat-receipt { color: var(--locdev-chat-muted); font-size: 11px; }
.locdev-chat-message-meta button { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; height: 44px; padding: 0 6px; border: 0; border-radius: 8px; background: none; color: var(--locdev-chat-muted); font-size: 16px; }
.locdev-chat-message-meta time { font-size: 11px; color: var(--locdev-chat-muted); white-space: nowrap; }
.locdev-chat-reaction-summary { display: flex; gap: 4px; }
.locdev-chat-reaction-summary > span { border: 1px solid var(--locdev-chat-border); border-radius: 20px; background: var(--locdev-chat-surface); padding: 2px 7px; font-size: 13px; }
.is-visitor > .locdev-chat-message-meta, .is-admin > .locdev-chat-message-meta { justify-content: flex-end; }
.locdev-chat-jump { border: 1px solid var(--locdev-chat-border); background: var(--locdev-chat-surface); color: var(--locdev-chat-ink); padding: 8px 16px; border-radius: 24px; align-self: center; font-size: 12px !important; }
.locdev-chat-file-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
:is(.locdev-live-chat-attachment-preview, .locdev-chat-attachment-preview):has(.locdev-chat-file-thumb) > span:first-of-type { display: none; }
.locdev-live-chat-attachment-preview > span, .locdev-chat-attachment-preview > span { min-width: 0; }
.is-file-dragging::after { content: 'Thả ảnh hoặc tài liệu tại đây · tối đa 8 MB'; position: absolute; inset: 8px; display: grid; place-items: center; text-align: center; padding: 24px; background: var(--locdev-chat-surface); color: var(--locdev-chat-ink); border: 2px dashed var(--locdev-chat-focus); border-radius: 14px; z-index: 10; pointer-events: none; }
.locdev-chat-dialog { position: fixed; inset: 0; margin: auto; width: min(340px, calc(100% - 32px)); height: fit-content; max-height: 85dvh; padding: 20px; border: 1px solid var(--locdev-chat-border); border-radius: 16px; background: var(--locdev-chat-surface); box-sizing: border-box; }
.locdev-chat-dialog::backdrop { background: var(--locdev-chat-scrim); }
.locdev-chat-dialog header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.locdev-chat-dialog h2 { font: inherit; font-weight: 700; color: var(--locdev-chat-ink); margin: 0; min-width: 0; overflow-wrap: anywhere; }
.locdev-chat-dialog button { background: var(--locdev-chat-canvas); color: var(--locdev-chat-ink); border: 1px solid var(--locdev-chat-border); border-radius: 8px; padding: 8px 12px; }
.locdev-chat-dialog header button { white-space: nowrap; }
.locdev-chat-reaction-picker { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 4px; }
.locdev-chat-reaction-picker button { padding: 0; font-size: 24px; }
.locdev-chat-reaction-picker button[aria-pressed=true] { outline: 2px solid var(--locdev-chat-focus); }
.locdev-chat-reaction-picker .locdev-chat-reaction-remove { grid-column: 1/-1; font-size: 14px; margin-top: 12px; }
.locdev-chat-dialog-status { font-size: 13px; color: var(--locdev-chat-error); }
.locdev-chat-dialog.is-image-viewer { width: min(960px, calc(100% - 32px)); }
.locdev-chat-dialog.is-image-viewer > img { display: block; max-width: 100%; max-height: 60dvh; object-fit: contain; margin: auto; }
.locdev-chat-dialog.is-image-viewer > a { display: inline-flex; min-height: 44px; align-items: center; margin-top: 12px; color: var(--locdev-chat-focus); }

/* Inbox: compact application header, independent list and transcript scroll. */
.locdev-chat-admin.locdev-admin { max-width: none; width: auto; margin: 20px 20px 0 0; }
.locdev-chat-admin .locdev-chat-admin-header { padding: 0 0 20px; margin: 0; border: 0; background: none; box-shadow: none; gap: 12px; border-radius: 0; }
.locdev-chat-admin .locdev-chat-admin-header { display: flex; align-items: center; justify-content: space-between; }
.locdev-chat-admin .locdev-chat-settings-link { width: auto; flex: 0 0 auto; margin-left: auto; padding: 10px 16px; white-space: nowrap; }
.locdev-chat-admin-header .locdev-eyebrow, .locdev-chat-admin-header .locdev-brand-mark { display: none; }
.locdev-chat-admin .locdev-chat-admin-header h1 { font-size: 26px; color: var(--locdev-chat-ink); line-height: 1.3; }
.locdev-chat-admin-header .locdev-admin-intro { font-size: 13px; margin: 4px 0 0; }
.locdev-chat-admin .locdev-chat-inbox { grid-template-columns: 300px minmax(0, 1fr); height: calc(100dvh - 170px); min-height: 480px; margin: 0; border: 1px solid var(--locdev-chat-border); border-radius: 14px; background: var(--locdev-chat-surface); box-shadow: none; overflow: hidden; }
.locdev-chat-admin .locdev-chat-list-panel { display: grid; grid-template-rows: auto auto auto auto minmax(0,1fr); background: var(--locdev-chat-surface); border-right: 1px solid var(--locdev-chat-border); }
.locdev-chat-admin .locdev-chat-list-head { padding: 20px 16px 8px; }
.locdev-chat-list-head .locdev-chat-kicker { display: none; }
.locdev-chat-admin .locdev-chat-list-head h2 { font-size: 16px; font-weight: 700; }
.locdev-chat-admin .locdev-chat-filters { gap: 4px; padding: 4px 12px 8px; flex-wrap: wrap; border: 0; }
.locdev-chat-admin .locdev-chat-filters button { padding: 8px; border: 0; border-radius: 8px; font-size: 12px; box-shadow: none; color: var(--locdev-chat-muted); background: none; }
.locdev-chat-admin .locdev-chat-filters button.is-active { background: var(--locdev-chat-tint); color: var(--locdev-chat-ink); }
.locdev-chat-search { display: block; padding: 0 16px; }
.locdev-chat-search input { width: 100%; min-height: 44px; border: 1px solid var(--locdev-chat-border); border-radius: 8px; background: var(--locdev-chat-canvas); color: var(--locdev-chat-ink); font: inherit; padding: 10px 12px; }
.locdev-chat-list-summary { padding: 8px 16px; margin: 0; font-size: 11px; color: var(--locdev-chat-muted); }
.locdev-chat-admin .locdev-chat-conversations { padding: 0 8px 12px; scrollbar-width: thin; }
.locdev-chat-admin .locdev-chat-conversation { border: 0; border-radius: 10px; padding: 12px; margin: 2px 0; box-shadow: none; background: none; }
.locdev-chat-admin .locdev-chat-conversation.is-active { background: var(--locdev-chat-tint); box-shadow: none; border: 0; }
.locdev-chat-admin .locdev-chat-conversation-row { align-items: center; }
.locdev-chat-admin .locdev-chat-conversation-row strong { font-size: 14px; font-weight: 600; }
.locdev-chat-admin .has-unread .locdev-chat-conversation-row strong { font-weight: 800; }
.locdev-chat-admin .locdev-chat-conversation-row time { font-size: 10px; }
.locdev-chat-admin .locdev-chat-conversation-preview { font-size: 13px; color: var(--locdev-chat-muted); }
.locdev-chat-admin .locdev-chat-conversation-contact { display: none; }
.locdev-chat-admin .locdev-chat-conversation-meta { margin-top: 6px; }
.locdev-chat-admin .locdev-chat-thread { position: relative; height: 100%; grid-template-rows: auto auto minmax(0,1fr) auto; }
.locdev-chat-admin .locdev-chat-thread-head { padding: 14px 24px; background: var(--locdev-chat-surface); border-bottom: 1px solid var(--locdev-chat-border); min-height: 76px; }
.locdev-chat-thread-head h2 { font-weight: 700; }
.locdev-chat-admin .locdev-chat-status-button { color: var(--locdev-chat-error); }
.locdev-chat-admin .locdev-chat-status-button.is-closed { color: var(--locdev-chat-focus); }
.locdev-chat-admin .locdev-chat-customer { padding: 10px 24px; gap: 12px; border-bottom: 1px solid var(--locdev-chat-border); background: var(--locdev-chat-surface); font-size: 12px; }
.locdev-chat-customer-avatar, .locdev-chat-customer-main { display: none; }
.locdev-chat-admin .locdev-chat-customer-rating { font-size: 11px; padding: 0; border: 0; background: none; }
.locdev-chat-admin .locdev-chat-messages { background: var(--locdev-chat-canvas); padding: 20px 24px; gap: 14px; scrollbar-width: thin; overscroll-behavior: contain; }
.locdev-chat-admin .locdev-chat-admin-message { max-width: min(78%, 620px); }
.locdev-chat-admin .locdev-chat-admin-message.is-visitor { align-self: flex-start; width: fit-content; }
.locdev-chat-admin .locdev-chat-admin-message.is-visitor .locdev-chat-message-meta { justify-content: flex-start; }
.locdev-chat-admin .locdev-chat-admin-message > p { padding: 10px 14px; font-size: 14px; border-radius: 14px 14px 14px 4px; border: 1px solid var(--locdev-chat-border); background: var(--locdev-chat-tint); color: var(--locdev-chat-ink); box-shadow: none; }
.locdev-chat-admin .locdev-chat-admin-message.is-admin > p { background: var(--locdev-chat-tint); color: var(--locdev-chat-ink); border: 1px solid var(--locdev-chat-border); border-radius: 14px 14px 4px 14px; }
.locdev-chat-admin .locdev-chat-admin-message.is-system { background: var(--locdev-chat-tint); padding: 12px 14px; border: 1px solid var(--locdev-chat-border); border-radius: 14px; align-self: flex-end; align-items: flex-start; gap: 8px; }
.locdev-chat-admin .locdev-chat-admin-message.is-system > p { background: none; border: 0; padding: 0; color: var(--locdev-chat-ink); font-size: 14px; text-align: left; }
.locdev-chat-admin .locdev-chat-reply { padding: 12px 24px; gap: 8px; border-top: 1px solid var(--locdev-chat-border); background: var(--locdev-chat-surface); }
.locdev-chat-admin .locdev-chat-reply-row { gap: 8px; }
.locdev-chat-admin .locdev-chat-reply textarea { background: var(--locdev-chat-canvas); border: 1px solid var(--locdev-chat-border); color: var(--locdev-chat-ink); box-shadow: none; font-size: 14px; border-radius: 10px; min-height: 46px; }
.locdev-chat-admin .locdev-chat-send { background: var(--locdev-chat-ink); color: var(--locdev-chat-surface); border-radius: 10px; }
.locdev-chat-admin .locdev-chat-form-status:empty { display: none; }
.locdev-chat-admin .locdev-chat-form-status { position: static; margin: 0; min-height: 0; }
.locdev-chat-saved-replies { position: relative; }
.locdev-chat-saved-replies summary { font-size: 12px; color: var(--locdev-chat-muted); cursor: pointer; min-height: 30px; padding: 4px 0; }
.locdev-chat-saved-replies > div { position: absolute; bottom: 100%; left: 0; z-index: 3; background: var(--locdev-chat-surface); border: 1px solid var(--locdev-chat-border); border-radius: 12px; box-shadow: var(--locdev-chat-elevation); padding: 8px; width: min(440px, 100%); }
.locdev-chat-saved-replies button { display: block; width: 100%; text-align: left; padding: 10px; border: 0; background: none; color: var(--locdev-chat-ink); }
.locdev-chat-admin .locdev-chat-privacy-note { margin: 10px 0 0; font-size: 11px; }
.locdev-chat-admin :is(h1,h2) { overflow-wrap: anywhere; min-width: 0; }
.locdev-chat-admin .locdev-chat-back { display: none; width: 44px; padding: 0; border: 0; background: none; color: var(--locdev-chat-ink); }
@media (hover: hover) {
    :is(.locdev-chat-message-meta, .locdev-chat-dialog, .locdev-chat-ended, .locdev-chat-saved-replies) button:hover:not(:disabled) { background: var(--locdev-chat-tint); color: var(--locdev-chat-ink); }
    .locdev-live-chat .locdev-live-chat-quick button:hover { border-color: var(--locdev-chat-focus); background: var(--locdev-chat-tint); }
}
@media (pointer: coarse) {
    .locdev-chat-message-meta button, .locdev-chat-saved-replies summary { min-height: 44px; }
}
@media (max-width: 850px) {
    .locdev-live-chat.is-open .locdev-live-chat-panel { position: fixed; left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom)); top: auto; width: auto; height: min(660px, calc(100dvh - 16px - env(safe-area-inset-bottom))); min-height: 0; }
}
@media (max-width: 720px) {
    .locdev-chat-admin.locdev-admin { margin: 12px 10px 0 0; }
    .locdev-chat-admin .locdev-chat-admin-header { flex-wrap: wrap; gap: 12px; }
    .locdev-chat-admin-header .locdev-admin-intro { display: none; }
    .locdev-chat-admin .locdev-chat-inbox { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr); height: calc(100dvh - 170px); min-height: 480px; }
    .locdev-chat-admin .locdev-chat-thread-panel { display: none; }
    .locdev-chat-admin.is-thread-open .locdev-chat-list-panel { display: none; }
    .locdev-chat-admin.is-thread-open .locdev-chat-thread-panel { display: block; min-height: 0; }
    .locdev-chat-admin .locdev-chat-thread-head { padding: 12px; gap: 8px; flex-wrap: wrap; }
    .locdev-chat-admin .locdev-chat-back { display: block; }
    .locdev-chat-thread-head > div { flex: 1; min-width: 0; }
    .locdev-chat-admin .locdev-chat-status-button { font-size: 12px; padding: 8px; white-space: nowrap; }
    .locdev-chat-admin .locdev-chat-customer, .locdev-chat-admin .locdev-chat-messages, .locdev-chat-admin .locdev-chat-reply { padding: 12px; }
    .locdev-chat-admin .locdev-chat-admin-message { max-width: 90%; }
    .locdev-chat-admin .locdev-chat-reply textarea { font-size: 16px; }
    .locdev-chat-admin .locdev-chat-settings-link { margin-left: 0; }
    .locdev-chat-admin .locdev-chat-emoji-menu { grid-template-columns: repeat(4, minmax(0,1fr)); }
}
@media (prefers-reduced-motion: reduce) {
    :is(.locdev-live-chat, .locdev-chat-admin, .locdev-chat-dialog) *, :is(.locdev-live-chat, .locdev-chat-admin, .locdev-chat-dialog) *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Settings preview follows the same restrained header and launcher. */
.locdev-preview .locdev-preview-chat-launcher { background: var(--locdev-chat-ink); color: var(--locdev-chat-surface); background-image: none; box-shadow: none; }
.locdev-preview .locdev-preview-chat-panel > header { background: var(--locdev-chat-surface); color: var(--locdev-chat-ink); border-bottom: 1px solid var(--locdev-chat-border); }
.locdev-preview .locdev-preview-chat-body { background: var(--locdev-chat-canvas); }

/* 4.1: one brand header and one composer surface, isolated from theme controls. */
.locdev-live-chat button, .locdev-chat-admin button, .locdev-chat-dialog button { box-shadow: none; }
.locdev-live-chat .locdev-live-chat-head,
.locdev-preview .locdev-preview-chat-panel > header {
    background: var(--locdev-chat);
    color: var(--locdev-chat-on-brand, #102a32);
    padding: 20px 18px;
    border-bottom: 0;
}
.locdev-live-chat-head #locdev-live-chat-title,
.locdev-live-chat .locdev-live-chat-head p,
.locdev-preview .locdev-preview-chat-panel > header :is(strong, small) { color: inherit; opacity: 1; }
.locdev-live-chat .locdev-live-chat-head p { margin: 5px 0 0; font-size: 12px; }
.locdev-live-chat .locdev-live-chat-avatar,
.locdev-preview .locdev-preview-chat-avatar { background: var(--locdev-chat-surface); color: var(--locdev-chat-ink); border-radius: 14px; width: 46px; height: 46px; }
.locdev-live-chat .locdev-live-chat-avatar img { width: 100%; height: 100%; padding: 4px; object-fit: contain; border-radius: inherit; }
.locdev-live-chat-head [data-live-chat-close],
.locdev-preview .locdev-preview-chat-panel > header button { background: var(--locdev-chat-surface); color: var(--locdev-chat-ink); border-radius: 50%; border: 0; box-shadow: none; }
.locdev-live-chat .locdev-live-chat-message.is-intro { padding: 2px 0 4px; }
.locdev-live-chat .locdev-live-chat-message.is-intro strong { display: none; }
.locdev-live-chat.has-messages .locdev-live-chat-message.is-intro small { display: none; }
.locdev-live-chat .locdev-live-chat-message.is-intro p { margin: 0; }
.locdev-live-chat .locdev-live-chat-form,
.locdev-chat-admin .locdev-chat-reply { padding: 12px; gap: 8px; }
.locdev-live-chat .locdev-live-chat-composer-row,
.locdev-chat-admin .locdev-chat-reply-row {
    display: grid;
    grid-template-areas: "field field" "tools send";
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--locdev-chat-canvas);
    border: 1px solid var(--locdev-chat-border);
    border-radius: 16px;
    min-width: 0;
}
.locdev-live-chat .locdev-live-chat-composer-row textarea,
.locdev-chat-admin .locdev-chat-reply-row textarea {
    display: block;
    grid-area: field;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    max-height: 112px;
    margin: 0 !important;
    padding: 8px 4px;
    border: 0 !important;
    border-radius: 0;
    background: transparent !important;
    color: var(--locdev-chat-ink);
    font: inherit;
    font-size: 16px;
    line-height: 1.5;
    box-shadow: none !important;
    resize: none;
}
.locdev-live-chat .locdev-live-chat-composer-row textarea:focus,
.locdev-chat-admin .locdev-chat-reply-row textarea:focus { outline: none; }
.locdev-live-chat-composer-row:has(textarea:focus),
.locdev-chat-reply-row:has(textarea:focus) { outline: 2px solid var(--locdev-chat-focus); outline-offset: 2px; }
.locdev-live-chat .locdev-live-chat-tools,
.locdev-chat-admin .locdev-chat-composer-tools { display: flex; align-items: center; gap: 8px; min-width: 0; }
.locdev-live-chat .locdev-live-chat-tools button,
.locdev-chat-admin .locdev-chat-composer-tools button {
    display: grid; place-items: center;
    width: 44px; min-width: 44px; height: 44px; min-height: 44px;
    margin: 0 !important; padding: 0 !important;
    border: 0 !important; border-radius: 10px;
    background: transparent; color: var(--locdev-chat-muted);
    box-shadow: none !important;
}
.locdev-live-chat .locdev-live-chat-composer-row .locdev-live-chat-send,
.locdev-chat-admin .locdev-chat-reply-row .locdev-chat-send {
    display: grid; place-items: center; align-self: center; justify-self: end;
    width: 44px; min-width: 44px; height: 44px; min-height: 44px;
    margin: 0 !important; padding: 0 !important;
    border: 0 !important; border-radius: 12px;
    background: var(--locdev-chat) !important;
    color: var(--locdev-chat-on-brand, #102a32) !important;
    box-shadow: none !important;
}
.locdev-live-chat .locdev-live-chat-composer-row button svg,
.locdev-chat-admin .locdev-chat-reply-row button svg { display: block; width: 20px; height: 20px; margin: 0; flex: none; }
.locdev-live-chat-composer-row button svg :is(path, circle),
.locdev-chat-reply-row button svg :is(path, circle) { stroke-width: 1.8; }
.locdev-live-chat .locdev-live-chat-tools button.has-rating { background: var(--locdev-chat-tint); color: var(--locdev-chat-focus); }
.locdev-chat-composer-hint { font-size: 11px; line-height: 1.5; padding: 0 2px; color: var(--locdev-chat-muted); }
.locdev-live-chat .locdev-live-chat-attachment-preview,
.locdev-chat-admin .locdev-chat-attachment-preview { border-color: var(--locdev-chat-border); background: var(--locdev-chat-canvas); box-shadow: none; border-radius: 12px; }
.locdev-live-chat-attachment-preview strong,
.locdev-chat-attachment-preview strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.locdev-live-chat .locdev-live-chat-attachment-preview button,
.locdev-chat-admin .locdev-chat-attachment-preview button { background: none; color: var(--locdev-chat-muted); border: 0; box-shadow: none; }
@media (hover: hover) {
    .locdev-live-chat .locdev-live-chat-tools button:hover:not(:disabled),
    .locdev-chat-admin .locdev-chat-composer-tools button:hover:not(:disabled) { background: var(--locdev-chat-tint); color: var(--locdev-chat-ink); }
}

/* Settings: three intentional groups, not six uneven independent fields. */
.locdev-chat-config-section--content { padding: 0 !important; overflow: hidden; background: var(--locdev-chat-surface); }
.locdev-admin .locdev-chat-config-footer { margin-top: 20px; }
.locdev-chat-config-section--content > .locdev-chat-config-title { padding: 20px 24px; margin: 0; border-bottom: 1px solid var(--locdev-chat-border); background: var(--locdev-chat-canvas); }
.locdev-chat-config-section--content > .locdev-chat-config-title > span { display: none; }
.locdev-chat-config-section--content .locdev-chat-settings-group { padding: 24px; border-bottom: 1px solid var(--locdev-chat-border); }
.locdev-chat-config-section--content .locdev-chat-settings-group:last-child { border-bottom: 0; }
.locdev-chat-settings-caption { margin-bottom: 18px; }
.locdev-chat-settings-caption h4 { margin: 0 0 4px; font-size: 14px; color: var(--locdev-chat-ink); }
.locdev-chat-settings-caption p { margin: 0; color: var(--locdev-chat-muted); font-size: 12px; }
.locdev-chat-config-section--content .locdev-fields { gap: 20px; align-items: start; }
.locdev-chat-config-section--content .locdev-field > p { color: var(--locdev-chat-muted); font-size: 12px; line-height: 1.5; margin-top: 8px; }
.locdev-chat-config-section--content .locdev-field :is(input,textarea,select) { border-radius: 10px; border: 1px solid var(--locdev-chat-border); background: var(--locdev-chat-surface); box-shadow: none; }
.locdev-chat-config-section--content textarea { min-height: 100px; resize: vertical; font-family: inherit; font-size: 13px; line-height: 1.6; }
.locdev-chat-config-section--content .locdev-chat-auto-fields { grid-template-columns: minmax(180px,.65fr) minmax(0,1.35fr); }
.locdev-chat-config-section--content .locdev-media-control { padding: 0; border: 0; border-radius: 0; background: none; grid-template-columns: 64px minmax(0,1fr); align-items: start; gap: 12px; }
.locdev-chat-config-section--content .locdev-media-preview { width: 64px; height: 64px; border: 1px solid var(--locdev-chat-border); border-radius: 12px; background: var(--locdev-chat-canvas); }
.locdev-chat-config-section--content .locdev-media-actions { display: flex; flex-direction: column; gap: 10px; }
.locdev-chat-config-section--content .locdev-media-actions > div { order: -1; display: flex; flex-wrap: wrap; gap: 8px; }
.locdev-chat-config-section--content .locdev-media-actions > input { font-size: 12px; min-height: 38px; height: 38px; }
.locdev-chat-config-section--content .locdev-media-actions button { min-height: 44px; padding: 8px 14px; border-radius: 8px; white-space: nowrap; }
@media (max-width: 700px) {
    .locdev-chat-config-section--content .locdev-fields { grid-template-columns: minmax(0,1fr); }
    .locdev-chat-config-section--content > .locdev-chat-config-title { padding: 16px; }
    .locdev-chat-config-section--content .locdev-chat-settings-group { padding: 20px 16px; }
}
