/*!
 * Bootstrap Icons v1.11.1 (https://icons.getbootstrap.com/)
 * Copyright 2019-2023 The Bootstrap Authors
 * Licensed under MIT (https://github.com/twbs/icons/blob/main/LICENSE)
 * Local font and selected mappings from the existing reference package.
 */
@font-face {
  font-family: "bootstrap-icons";
  src: url("/assets/bootstrap-icons.woff2") format("woff2");
  font-display: block;
  font-style: normal;
  font-weight: normal;
}
.bi { display: inline-flex; flex-shrink: 0; }
.bi::before {
  display: inline-block;
  font-family: "bootstrap-icons" !important;
  font-style: normal;
  font-weight: normal !important;
  font-variant: normal;
  text-transform: none;
  line-height: 1;
  vertical-align: -.125em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.bi-archive::before { content: "\f10d"; }
.bi-arrow-left::before { content: "\f12f"; }
.bi-arrow-repeat::before { content: "\f130"; }
.bi-bar-chart::before { content: "\f17e"; }
.bi-bell::before { content: "\f18a"; }
.bi-box-arrow-right::before { content: "\f1c3"; }
.bi-building::before { content: "\f1dd"; }
.bi-chat-dots::before { content: "\f24a"; }
.bi-chat-square-text::before { content: "\f264"; }
.bi-check2-all::before { content: "\f26f"; }
.bi-chevron-down::before { content: "\f282"; }
.bi-chevron-left::before { content: "\f284"; }
.bi-chevron-right::before { content: "\f285"; }
.bi-diagram-3::before { content: "\f2ee"; }
.bi-envelope::before { content: "\f32f"; }
.bi-file-earmark::before { content: "\f392"; }
.bi-folder2-open::before { content: "\f3d8"; }
.bi-gear::before { content: "\f3e5"; }
.bi-info-circle::before { content: "\f431"; }
.bi-kanban::before { content: "\f44d"; }
.bi-lock::before { content: "\f47b"; }
.bi-clock-history::before { content: "\f292"; }
.bi-mic::before { content: "\f490"; }
.bi-patch-check::before { content: "\f4b6"; }
.bi-pencil-square::before { content: "\f4ca"; }
.bi-people::before { content: "\f4d0"; }
.bi-person-circle::before { content: "\f4d7"; }
.bi-person-plus::before { content: "\f4dd"; }
.bi-person-vcard::before { content: "\f8c9"; }
.bi-geo-alt::before { content: "\f3e8"; }
.bi-plug::before { content: "\f4f7"; }
.bi-save::before { content: "\f525"; }
.bi-search::before { content: "\f52a"; }
.bi-shield-check::before { content: "\f52f"; }
.bi-tag::before { content: "\f5b0"; }
.bi-three-dots-vertical::before { content: "\f5d3"; }
.bi-tools::before { content: "\f5db"; }
.bi-whatsapp::before { content: "\f618"; }
.bi-plus-lg::before { content: "\f64d"; }
.bi-qr-code::before { content: "\f6ae"; }
.bi-x-lg::before { content: "\f659"; }

:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: #283145;
  background: #f8f9fc;
  --accent: #625bff;
  --accent-hover: #5048da;
  --accent-soft: #f1efff;
  --line: #e8edf5;
  --muted: #6d7c96;
  --surface: #fff;
  --shadow: none;
  --text: #283145;
  --page-bg: #f8f9fc;
  --surface-subtle: #f5f6fb;
  --action: #625bff;
  --action-hover: #5048da;
  /* Existing ChatPanel palette: assets/scss/_variables.scss --orange-rgb. */
  --brand-orange: #fe7c58;
  --count-text: #241b17;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
button:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:disabled { opacity: .55; cursor: not-allowed; }
input, select, textarea {
  width: 100%;
  margin: 6px 0 10px;
  padding: 8px 11px;
  border: 1px solid #dbe0eb;
  border-radius: 5px;
  background: var(--surface);
  color: inherit;
  box-shadow: none;
}
input:focus, select:focus, textarea:focus { border-color: #a09ae8; }
input:disabled, select:disabled, textarea:disabled { background: #f2f5f7; color: #6f7d8b; }
input[type=checkbox], input[type=radio] { width: auto; margin: 0 6px 0 0; accent-color: var(--accent); }
textarea { min-height: 100px; resize: vertical; }
label { display: block; font-size: 13px; font-weight: 600; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 23px; line-height: 1.3; letter-spacing: -.45px; overflow-wrap: anywhere; }
h2 { font-size: 17px; line-height: 1.4; letter-spacing: -.2px; }
h3 { font-size: 14px; }
p { color: var(--muted); }
main { max-width: 1800px; margin: auto; padding: 18px 22px 28px; }
main:focus { outline: none; }
main > h1 { max-width: 760px; margin: 12px auto 18px; }
main > form, main > .panel { max-width: 760px; margin: 0 auto 18px; padding: 20px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); box-shadow: var(--shadow); }
main > form > a { margin-left: 12px; }
main > .panel p { font-size: 13px; }
:focus-visible { outline: 3px solid #625bff; outline-offset: 3px; }
[aria-busy=true] { opacity: .72; }
[hidden] { display: none !important; }
.visually-hidden, .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; top: -80px; left: 12px; z-index: 10; padding: 12px; background: var(--surface); border-radius: 6px; }
.skip-link:focus { top: 12px; }

/* Shared application shell */
.app-header { min-height: 58px; padding: 0 22px; display: flex; align-items: center; gap: 24px; background: #f8f9fc; border: 0; }
.brand { display: flex; align-items: center; color: #202a36; text-decoration: none; }
.maker-brand { flex-shrink: 0; padding: 0; background: transparent; }
.maker-brand img { display: block; width: 124px; max-width: 100%; height: auto; }
.maker-brand .brand-logo-dark { display: none; }
.app-nav { display: flex; align-items: center; gap: 4px; min-width: 0; overflow-x: auto; white-space: nowrap; }
.app-nav a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 8px 10px; border-radius: 5px; color: #617185; font-size: 12px; font-weight: 600; transition: background .15s, color .15s; }
.app-nav a:hover { color: #263c4f; background: #f4f6f8; text-decoration: none; }
.app-nav a[aria-current=page] { color: #5148d8; background: #eeecff; }
.app-nav .bi { font-size: 17px; }
.app-header-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.environment { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid #e5e9ee; border-radius: 6px; background: #fafbfc; color: #707e8e; font-size: 10px; font-weight: 650; letter-spacing: .25px; white-space: nowrap; }
.environment > span { width: 5px; height: 5px; border-radius: 50%; background: #8f9eac; }
.app-header form { margin: 0; }
.app-header .logout-button { min-height: 36px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; background: transparent; color: #637387; font-size: 12px; }
.app-header .logout-button:hover { background: #f4f6f8; color: #27394d; }
.logout-button .bi { font-size: 17px; }
.page-heading, .channels-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.page-heading h1, .channels-heading h1 { margin: 4px 0 0; font-size: 23px; }
.page-heading p, .channels-heading p { margin: 6px 0 0; font-size: 12px; }
.eyebrow { color: #7c8997; font-size: 10px; font-weight: 750; letter-spacing: 1.45px; text-transform: uppercase; }
.request-status, .page-feedback { padding: 13px 18px; background: #ecf8f2; color: #286b51; border: 1px solid #cce7d9; font-size: 13px; }
.request-status { position: fixed; top: 68px; right: 24px; z-index: 20; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; max-width: min(420px,calc(100vw - 32px)); max-height: calc(100dvh - 92px); overflow: auto; border-radius: 5px; box-shadow: 0 5px 20px #20304716; overflow-wrap: anywhere; }
/* Transient reads never enter the page flow or cover it with a blocking layer.
   Delay only the visual indicator; the live-region text remains meaningful. */
.request-status[data-loading=true] { flex-wrap: nowrap; padding: 10px 14px; border-color: var(--line); background: #fff; color: #526b73; font-size: 12px; pointer-events: none; animation: request-indicator-reveal 0s 150ms backwards; }
.request-status[data-loading=true]::before { content: ""; flex: 0 0 16px; width: 16px; height: 16px; border: 2px solid #d7e7e2; border-top-color: var(--accent); border-radius: 50%; animation: request-spinner 700ms linear infinite; }
@keyframes request-spinner { to { transform: rotate(360deg); } }
@keyframes request-indicator-reveal { from { visibility: hidden; } to { visibility: visible; } }
.page-feedback { max-width: 1200px; margin: 0 auto 24px; border-radius: 8px; }
.page-feedback > .bi { margin-right: 8px; }
.page-feedback p { margin-bottom: 8px; color: inherit; font-weight: 600; }
.page-feedback ul { padding-left: 20px; margin: 0; }
.request-status[data-error=true], .page-feedback.is-error { background: #fff2ee; border-color: #f0d5cb; color: #943d29; }
.request-status button, .request-status a { margin-left: 0; }
.request-status button { min-height: 34px; padding: 6px 10px; font-size: 12px; }
@media (max-width: 720px) { .request-status { top: 12px; right: 16px; max-height: calc(100dvh - 24px); } }
.muted, .empty-list { color: #758397; font-size: 12px; }

/* Conversations keep their working three-panel structure. */
.workspace { display: grid; grid-template-columns: 290px minmax(0,1fr) 290px; min-height: calc(100vh - 138px); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.inbox-panel { background: #fcfdfe; border-right: 1px solid var(--line); }
.panel-heading, .inbox-filter { padding: 22px 20px 0; }
.panel-heading h2 { margin: 6px 0; }
.panel-heading p { font-size: 12px; }
.inbox-tabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.inbox-tabs form { flex: 1; min-width: 0; margin: 0; }
.inbox-tab { flex-direction: column; gap: 5px; width: 100%; min-height: 64px; padding: 10px 3px; border: 0; border-bottom: 3px solid transparent; border-radius: 6px 6px 0 0; background: transparent; color: var(--muted); font-size: 11px; }
.inbox-tab .bi { font-size: 18px; }
.inbox-tab:hover { border-color: transparent; background: #f3f7f7; color: var(--accent); }
.inbox-tab.is-active, .inbox-tab[aria-current=page] { border-bottom-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.inbox-tab:focus-visible { outline-offset: -3px; }
.inbox-tabs-help { margin: 0; padding: 12px 20px; font-size: 11px; }
.inbox-filter { padding-top: 0; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.conversation-card { display: flex; flex-direction: column; gap: 5px; padding: 18px 20px; border-bottom: 1px solid #edf0f3; color: #243244; overflow-wrap: anywhere; }
.conversation-card:hover { background: #f3f7f7; text-decoration: none; }
.conversation-card.selected { background: #edf7f3; box-shadow: inset 3px 0 var(--accent); }
.ajax-navigation { margin: 0; }
button.ajax-link { display: inline-flex; align-items: center; gap: 8px; min-height: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--accent); text-align: left; font-weight: inherit; }
button.ajax-link:hover { background: transparent; color: var(--accent-hover); text-decoration: underline; }
button.conversation-card { width: 100%; min-height: 0; border: 0; border-bottom: 1px solid #edf0f3; border-radius: 0; background: transparent; text-align: left; font-weight: normal; }
button.conversation-card:hover { background: #f3f7f7; }
button.conversation-card.selected { background: #edf7f3; }
.conversation-subject { font-size: 13px; }
.conversation-contact { display: flex; align-items: center; gap: 10px; min-width: 0; }
.contact-avatar { position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: var(--accent-soft); color: var(--accent); }
.contact-avatar > .bi { font-size: 24px; }
.contact-initials { font-size: 13px; font-weight: 750; line-height: 1; letter-spacing: .03em; }
.contact-avatar > img[data-contact-photo] { opacity: 0; }
.contact-avatar > img[data-contact-photo].is-photo-ready { opacity: 1; }
.details-profile .contact-initials { font-size: 30px; }
.origin-badge { display: inline-flex; align-items: center; gap: 4px; width: fit-content; padding: 2px 6px; border-radius: 5px; font-size: 10px; font-weight: 700; line-height: 1.4; white-space: nowrap; background: var(--accent-soft); color: var(--accent); }
.origin-official { background: #e7f6ee; color: #176642; }
.origin-qr_code { background: #eef0f6; color: #4a5369; }
.origin-webchat { background: #ece8ff; color: #6241a7; }
:root[data-theme=dark] .origin-official { background: #163d30; color: #97ddbb; }
:root[data-theme=dark] .origin-qr_code { background: #2b3040; color: #c1c8da; }
:root[data-theme=dark] .origin-webchat { background: #33284b; color: #d1b8fc; }
.chat-origin-change { align-self: center; max-width: 90%; margin: 12px auto 6px; padding: 7px 12px; border-radius: 8px; background: var(--surface); color: var(--muted); font-size: 11px; text-align: center; }
.webchat-native-card { margin: 16px 0; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.webchat-native-card h2 { font-size: 16px; margin: 0 0 6px; }
.webchat-native-card p { font-size: 12px; color: var(--muted); }
.webchat-native-card .channels-field { margin: 12px 0; }
.webchat-native-links { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-webchat-rich { margin: 8px 0; font-size: 12px; }
.chat-webchat-rich p { margin: 4px 0; overflow-wrap: anywhere; }
.chat-webchat-rich details { margin: 7px 0; }
.chat-webchat-rich h4 { margin: 9px 0 5px; }
.chat-webchat-rich ul { padding-left: 18px; }
.chat-webchat-options { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.chat-webchat-options span { padding: 6px 9px; border: 1px solid var(--border); border-radius: 7px; }
.contact-avatar > img { position: absolute; inset: 0; width: 36px; height: 36px; object-fit: cover; }
.conversation-meta { color: #748194; font-size: 11px; }
.badge { width: fit-content; padding: 3px 8px; border-radius: 20px; background: #edf0f5; color: #506078; font-size: 10px; font-weight: 650; }
.badge-assigned { background: #e2f4ec; color: #22674c; }
.badge-waiting { background: #fff3dc; color: #876219; }
.badge-closed { background: #f0ecf8; color: #6d5e8c; }
.pagination { display: flex; justify-content: space-between; gap: 10px; padding: 18px; }
.conversation-panel { min-width: 0; padding: 28px; }
.conversation-heading { padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
.conversation-heading > a { display: block; margin-bottom: 20px; font-size: 12px; }
.conversation-heading p { margin-bottom: 0; }
.details-panel { padding: 24px; background: #fcfdfe; border-left: 1px solid var(--line); }
.details-panel h2 { margin-top: 12px; }
.details-panel form { padding-top: 18px; border-top: 1px solid var(--line); margin-top: 18px; }
.details-panel button { width: 100%; }
dl { margin: 20px 0; }
dt { margin-top: 12px; color: #758397; font-size: 11px; }
dd { margin: 2px 0; font-size: 13px; overflow-wrap: anywhere; }
.notice { padding: 16px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 24px; background: #f5f8fa; color: #637086; font-size: 12px; }
.empty-state { display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; }
.empty-state h1 { margin: 14px 0; }
.empty-symbol { padding: 12px 25px; border-radius: 18px; margin-bottom: 26px; background: var(--accent-soft); color: var(--accent); font-size: 35px; }
.empty-list { padding: 20px; }
.timeline { padding: 0; list-style: none; }
.timeline li { padding: 0 0 22px 20px; border-left: 2px solid #deebe8; margin-left: 5px; font-size: 13px; overflow-wrap: anywhere; }
.timeline time { display: block; margin-bottom: 6px; color: #778599; font-size: 11px; }
.timeline p { margin: 6px 0; white-space: pre-wrap; }
.workspace.opening-workspace { display: block; max-width: 900px; min-height: 0; margin: 0 auto; }
.opening-workspace select { max-width: 100%; }
.message-text { margin: 0 0 1rem; font-family: inherit; font-size: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.conversation-panel article.panel { padding: 18px; border: 1px solid var(--line); border-radius: 10px; margin: 12px 0; overflow-wrap: anywhere; }
.conversation-panel nav[aria-label="Paginação de mensagens"] { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }

/* Channels */
.channels-page { max-width: 1120px; margin: 12px auto 40px; }
.channels-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 16px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; transition: background .15s, border-color .15s; }
.channels-button:hover { border-color: var(--accent-hover); background: var(--accent-hover); text-decoration: none; }
.channels-button .bi { font-size: 15px; }
.channels-button-secondary { border-color: #d6dfe5; background: var(--surface); color: #526577; }
.channels-button-secondary:hover { border-color: #bdccc8; background: #f4f8f6; color: var(--accent); }
.channels-list { display: grid; gap: 12px; }
.channel-card { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.channel-card summary { display: flex; align-items: center; gap: 16px; min-height: 88px; padding: 20px 24px; cursor: pointer; list-style: none; }
.channel-card summary::-webkit-details-marker { display: none; }
.channel-card summary:hover { background: #fcfdfd; }
.channel-symbol { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; flex-shrink: 0; border: 1px solid #dceee5; border-radius: 11px; background: #eef8f2; color: #23955a; font-size: 24px; }
.channel-identity { display: grid; flex: 1; gap: 3px; min-width: 0; }
.channel-identity strong { font-size: 15px; font-weight: 650; overflow-wrap: anywhere; }
.channel-identity > span { color: var(--muted); font-size: 12px; }
.channel-status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.channel-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.channel-status.is-active { background: #eaf7ef; color: #28734e; }
.channel-status.is-disabled { background: #f0f2f6; color: #627085; }
.channel-chevron { color: #8593a3; font-size: 14px; transition: transform .15s; }
.channel-card[open] .channel-chevron { transform: rotate(180deg); }
.channel-card-body { display: grid; grid-template-columns: minmax(0,1fr); gap: 22px; padding: 22px 24px; border-top: 1px solid var(--line); background: #fcfdfe; }
.channel-metadata { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 24px; min-width: 0; margin: 0; }
.channel-metadata > div { min-width: 0; }
.channel-metadata dt { margin: 0 0 4px; color: var(--muted); font-size: 12px; }
.channel-metadata dd { margin: 0; font-size: 13px; }
.channel-card-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; }
.channel-card-actions > form { margin: 0; }
.channels-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 22px; }
.channels-footer a, .channels-back { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; }
.channels-caption { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.channels-pagination { display: flex; justify-content: flex-end; gap: 24px; margin-top: 20px; }
.channels-empty { padding: 52px 24px; border: 1px dashed #cdd9e0; border-radius: 12px; background: var(--surface); text-align: center; }
.channels-empty h2 { margin: 20px 0 8px; }
.channels-empty p { margin-bottom: 12px; }
.channels-diagnostic { padding: 14px 18px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 20px; background: var(--surface); }
.channels-diagnostic summary, .channels-help summary { font-size: 13px; font-weight: 600; cursor: pointer; }
.channels-diagnostic pre { max-height: 300px; padding: 14px; border-radius: 8px; overflow: auto; background: #f4f6f9; white-space: pre-wrap; overflow-wrap: anywhere; }
.channels-form-page { max-width: 740px; }
.webchat-settings-form .webchat-settings-branding { min-width: 0; margin: 24px 0 0; padding: 20px 0 0; border: 0; border-top: 1px solid var(--line); }
.webchat-settings-form .webchat-settings-branding legend { padding: 0 10px 0 0; font-weight: 650; }
.webchat-settings-form .channels-field textarea { display: block; width: 100%; min-height: 120px; margin-top: 6px; resize: vertical; }
.webchat-settings-logo-preview { margin: 12px 0; }
.webchat-settings-logo { display: block; width: 160px; max-width: 100%; height: 80px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; object-fit: contain; }
.webchat-settings-favicon { width: 64px; height: 64px; }
.webchat-settings-logo-preview figcaption { margin-top: 5px; font-size: 11px; color: var(--muted); }
.webchat-settings-form .webchat-settings-remove-logo { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.webchat-settings-form .webchat-settings-remove-logo input { flex: 0 0 18px; width: 18px; height: 18px; margin: 0; }
.webchat-settings-form .channels-field-error:empty { display: none; }
.webchat-settings-form .bi-clipboard::before { content: "\f290"; }
.webchat-settings-form .webchat-logo-dropzone { display: grid; gap: 12px; min-width: 0; margin-top: 8px; padding: 16px; border: 1px dashed var(--line); border-radius: 8px; background: var(--surface-subtle); }
.webchat-settings-form .webchat-logo-dropzone:focus, .webchat-settings-form .webchat-logo-dropzone:focus-within, .webchat-settings-form .webchat-logo-dropzone.is-dragging { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.webchat-settings-form .webchat-logo-dropzone strong { color: var(--text); font-size: 12px; }
.webchat-settings-form .webchat-logo-dropzone p, .webchat-settings-form .webchat-logo-draft p { margin: 4px 0 0; font-size: 11px; line-height: 1.6; }
.webchat-settings-form .webchat-logo-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.webchat-settings-form .webchat-logo-actions input[type=file] { flex: 1 1 260px; min-width: 0; width: auto; max-width: 100%; margin: 0; padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 11px; }
.webchat-settings-form .webchat-logo-actions input::file-selector-button { margin-right: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.webchat-settings-form .webchat-logo-actions button { flex: 0 0 auto; min-height: 36px; font-size: 11px; }
.webchat-settings-form .webchat-logo-draft { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; min-width: 0; margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.webchat-settings-form .webchat-logo-draft canvas { flex: 0 0 auto; width: 160px; max-width: 100%; height: 80px; border: 1px solid var(--line); border-radius: 6px; background: #fff; object-fit: contain; }
.webchat-settings-form .webchat-logo-draft > div { flex: 1 1 190px; min-width: 0; }
.webchat-settings-form .webchat-logo-draft strong { display: block; color: var(--text); font-size: 12px; overflow-wrap: anywhere; }
.webchat-settings-form .webchat-logo-draft > button { margin-left: auto; min-height: 34px; font-size: 11px; }
.webchat-settings-form [data-webchat-logo-status] { margin-top: 10px; overflow-wrap: anywhere; }
.webchat-settings-form [data-webchat-logo-status][data-error=true] { color: #b42318; }
:root[data-theme=dark] .webchat-settings-form [data-webchat-logo-status][data-error=true] { color: #ffb4ab; }
.webchat-settings-form :is(.webchat-logo-draft, .webchat-logo-draft canvas, [data-webchat-logo-status])[hidden] { display: none !important; }
.webchat-settings-form :is(.webchat-logo-actions, .webchat-logo-draft) :is(button, input):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 600px) { .webchat-settings-form .webchat-logo-dropzone { padding: 12px; } .webchat-settings-form .webchat-logo-actions input[type=file] { flex-basis: 100%; } .webchat-settings-form .webchat-logo-actions button { width: 100%; } .webchat-settings-form .webchat-logo-draft canvas { width: 120px; height: 60px; } }
@media (pointer: coarse) { .webchat-settings-form :is(.webchat-logo-actions, .webchat-logo-draft) button, .webchat-settings-form .webchat-logo-actions input::file-selector-button { min-height: 40px; } }
.channels-back { margin-bottom: 24px; color: #68798b; }
.channels-form { padding: 28px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.channels-field { margin-bottom: 22px; }
.channels-field input, .channels-field select { margin: 6px 0 0; }
.channels-field input[readonly] { border-color: #e3e8ed; background: #f5f7fa; color: #6b7c90; }
.channels-form-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 12px; padding-top: 22px; border-top: 1px solid var(--line); margin-top: 26px; }
.channels-notice { padding: 12px 14px; border: 1px solid #f0e4c9; border-radius: 8px; background: #fffaee; color: #7b612c; font-size: 12px; }
.channels-help { color: var(--muted); font-size: 12px; }
.channels-help p { margin: 12px 0 0; }
.channels-edit-help { padding: 20px 4px; }
.channels-edit-help a { display: inline-flex; align-items: center; gap: 7px; margin-top: 12px; }
.channel-settings { padding: 28px; border: 1px solid var(--line); border-radius: 12px; margin-top: 20px; background: var(--surface); box-shadow: var(--shadow); }
.channel-settings header { margin-bottom: 20px; }
.channel-settings h2 { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; font-size: 16px; }
.channel-settings h2 .bi { color: var(--accent); }
.channel-settings header p { margin-bottom: 0; font-size: 12px; }
.provider-options { min-width: 0; padding: 0; border: 0; margin: 0; }
.channel-switch { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 0; border-top: 1px solid #edf0f3; cursor: pointer; }
.channel-switch:first-of-type { border-top: 0; padding-top: 5px; }
.channel-switch-copy { display: grid; gap: 5px; }
.channel-switch-copy strong { display: inline-flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; }
.channel-switch-copy .bi { color: #637e83; font-size: 17px; }
.channel-switch-copy small { color: var(--muted); font-size: 12px; font-weight: 400; }
.channel-switch input[type=checkbox] { appearance: none; -webkit-appearance: none; flex: 0 0 40px; width: 40px; height: 24px; padding: 2px; border: 1px solid #acb8c5; border-radius: 20px; margin: 0; background: #bcc6d1; cursor: pointer; box-shadow: none; transition: background .15s, border-color .15s; }
.channel-switch input[type=checkbox]::before { content: ""; display: block; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #25394c26; transition: transform .15s; }
.channel-switch input[type=checkbox]:checked { border-color: var(--accent); background: var(--accent); }
.channel-switch input[type=checkbox]:checked::before { transform: translateX(16px); }
.channel-switch input[type=checkbox]:disabled { opacity: .45; cursor: not-allowed; }
.provider-options:disabled .channel-switch { cursor: default; }
.channel-save-status { margin: 16px 0 0; color: #426d62; font-size: 12px; overflow-wrap: anywhere; }
.channel-save-status[data-error=true], .channels-field-error { color: #a04332; }
.channel-save-status:empty { display: none; }

/* Contacts */
.contacts-page { max-width: 1200px; margin: 12px auto 40px; }
.contacts-card { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.contacts-search { display: flex; align-items: center; gap: 10px; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.search-field { display: flex; position: relative; width: min(100%,380px); }
.search-field > .bi { position: absolute; top: 15px; left: 13px; color: #8390a1; font-size: 15px; pointer-events: none; }
.search-field input { min-width: 0; margin: 0; padding-left: 38px; }
.table-scroll { overflow: auto; }
.contacts-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.contacts-table th { padding: 12px 24px; background: #fafbfd; color: #7c8998; font-size: 11px; font-weight: 600; white-space: nowrap; }
.contacts-table td { padding: 19px 24px; border-top: 1px solid #edf0f3; color: #68778b; overflow-wrap: anywhere; }
.contacts-table tbody tr:hover { background: #fcfdfd; }
.contact-name { color: #304153; font-size: 13px; font-weight: 600; }
.table-actions { text-align: right; }
.table-action { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; white-space: nowrap; }
.contacts-table .contacts-empty { padding: 52px 24px; text-align: center; }
.contacts-empty > .bi { display: block; margin-bottom: 14px; color: #b0becb; font-size: 30px; }
.contacts-empty strong { display: block; margin-bottom: 4px; color: #526477; font-size: 14px; font-weight: 600; }
.contacts-empty span { font-size: 12px; }
.contacts-pagination { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--line); }
.contacts-pagination a, .contacts-pagination button.ajax-link { display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; }
.contacts-pagination a:hover, .contacts-pagination button.ajax-link:hover { background: #f4f8f6; text-decoration: none; }

/* Authentication */
.auth-page { display: flex; align-items: flex-start; justify-content: center; padding: 38px 0 56px; }
.auth-card { width: 100%; max-width: 430px; padding: 34px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 8px 30px #20304706; }
.auth-symbol { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border: 1px solid #dceee5; border-radius: 11px; margin-bottom: 22px; background: var(--accent-soft); color: var(--accent); font-size: 22px; }
.auth-card h1 { margin-bottom: 8px; font-size: 25px; }
.auth-intro { margin-bottom: 28px; font-size: 13px; }
.auth-field { margin-bottom: 17px; }
.auth-field input { margin: 7px 0 0; }
.auth-form > button { width: 100%; min-height: 44px; margin-top: 8px; }
.auth-session-note { display: flex; align-items: flex-start; gap: 8px; margin: 20px 0; color: #748295; font-size: 11px; }
.auth-session-note .bi { margin-top: 2px; color: #72978b; font-size: 14px; }
.auth-help { padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.auth-help summary { cursor: pointer; font-size: 12px; }
.auth-help p { margin: 14px 0 0; font-size: 12px; }
.auth-password-help { font-size: 12px; }
.auth-form + .auth-password-help { margin-top: 18px; }
.auth-back { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; }

@media (max-width: 1200px) {
  .workspace { grid-template-columns: 260px minmax(0,1fr); }
  .details-panel { grid-column: 2; border-top: 1px solid var(--line); }
  .inbox-panel { grid-row: span 2; }
  .app-header { gap: 22px; }
  .app-header-tools { gap: 10px; }
}
@media (max-width: 900px) {
  .app-header { padding: 0 22px; gap: 20px; }
  .maker-brand img { width: 132px; }
  .app-nav a { padding: 9px 11px; }
  .app-header-tools .environment { display: none; }
  main { padding: 24px; }
  .contacts-table { min-width: 680px; }
}
@media (max-width: 720px) {
  .app-header { min-height: 0; flex-wrap: wrap; gap: 0; padding: 12px 16px 0; }
  .maker-brand img { width: 130px; }
  .app-header-tools { min-height: 48px; margin-left: auto; }
  .app-header-tools .environment { display: inline-flex; font-size: 9px; }
  .app-header-tools .logout-button { padding: 8px; }
  .logout-button span { display: none; }
  .app-nav { order: 3; justify-content: flex-start; gap: 6px; width: 100%; padding: 10px 0 12px; margin-top: 3px; border-top: 1px solid #f0f2f5; }
  .app-nav a { justify-content: center; flex: 0 0 auto; padding: 9px 8px; font-size: 12px; gap: 7px; }
  .app-nav .bi { font-size: 16px; }
  main { padding: 20px 16px; }
  .workspace { display: flex; flex-direction: column; }
  .inbox-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .conversation-list { max-height: 280px; overflow: auto; }
  .conversation-panel, .details-panel { padding: 20px; }
  .details-panel { border-left: 0; }
  .empty-state { min-height: 320px; }
  .auth-page { padding: 18px 0 36px; }
  .auth-card { padding: 28px 24px; }
}
@media (max-width: 600px) {
  .channels-page, .contacts-page { margin-top: 8px; }
  .page-heading, .channels-heading { gap: 12px; margin-bottom: 22px; }
  .page-heading h1, .channels-heading h1 { font-size: 24px; }
  .channels-button { padding: 9px 12px; font-size: 12px; }
  .channel-card summary { padding: 16px; gap: 10px; }
  .channel-symbol { width: 38px; height: 38px; font-size: 22px; }
  .channel-status { font-size: 10px; padding: 4px 8px; }
  .channel-chevron { font-size: 12px; }
  .channel-card-body { gap: 18px; padding: 16px; }
  .channel-metadata { grid-template-columns: 1fr; gap: 16px; }
  .channel-card-actions { justify-content: flex-start; }
  .channels-footer { flex-direction: column; align-items: flex-start; gap: 12px; }
  .channels-form, .channel-settings { padding: 20px; }
  .channels-form-actions > * { flex: 1; }
  .channels-diagnostic { padding: 12px; }
  .contacts-search { padding: 16px; }
  .contacts-table th, .contacts-table td { padding-left: 18px; padding-right: 18px; }
  .channel-switch { gap: 16px; }
  main > form, main > .panel { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  button, .app-nav a, .channels-button, .channel-chevron, .channel-switch input[type=checkbox], .channel-switch input[type=checkbox]::before { transition: none; }
  .request-status[data-loading=true]::before { animation: none; }
}
.channels-heading-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.payload-filters { display: grid; grid-template-columns: repeat(2,minmax(130px,1fr)) repeat(2,minmax(160px,1.3fr)) auto auto; align-items: end; gap: 12px; padding: 18px; margin-bottom: 20px; background: #fff; border: 1px solid #e4e8ed; border-radius: 12px; }
.payload-filters label { display: grid; gap: 7px; color: #526172; font-size: 13px; font-weight: 600; }
.payload-filters input, .payload-filters select { width: 100%; min-width: 0; margin: 0; }
.payload-filters button, .payload-filters .channels-button { margin: 0; min-height: 42px; }
.payload-table-wrap { overflow-x: auto; border: 1px solid #e4e8ed; border-radius: 12px; background: #fff; }
.payload-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.payload-table th { padding: 14px 18px; background: #f8fafb; color: #687585; font-size: 12px; font-weight: 600; white-space: nowrap; }
.payload-table td { padding: 16px 18px; border-top: 1px solid #edf0f3; vertical-align: middle; }
.payload-table td:first-child, .payload-table td:last-child { white-space: nowrap; }
.payload-type { display: block; color: #7b8695; font-size: 12px; margin-top: 5px; }
.payload-outcome { display: inline-flex; border-radius: 6px; padding: 4px 8px; font-size: 12px; background: #f0f3f6; color: #586577; }
.payload-outcome.is-accepted { background: #eaf7f0; color: #24704b; }
.payload-outcome.is-rejected, .payload-outcome.is-failed { background: #fff0ed; color: #aa4835; }
.payload-empty { text-align: center; color: #7b8695; height: 140px; }
.payload-detail { border: 1px solid #e4e8ed; border-radius: 12px; padding: 22px; background: #fff; }
.payload-metadata { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px; margin: 0 0 24px; }
.payload-metadata dt { color: #7b8695; font-size: 12px; margin-bottom: 7px; }
.payload-metadata dd { margin: 0; color: #334155; overflow-wrap: anywhere; font-size: 14px; }
.payload-json { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 65vh; overflow: auto; padding: 20px; border: 1px solid #e4e8ed; border-radius: 8px; background: #f8fafb; color: #334155; font-size: 13px; line-height: 1.6; tab-size: 2; }
@media (max-width: 1100px) { .payload-filters { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 600px) {
  .payload-filters, .payload-metadata { grid-template-columns: minmax(0,1fr); }
  .channels-heading-actions { width: 100%; }
  .payload-detail { padding: 14px; }
  .payload-json { padding: 12px; }
}

/* Shared Runtime pages use the same compact surfaces as the attendance workspace.
   These selectors do not replace chat scrolling, composer or permission gates. */
.runtime-page, .channels-page, .contacts-page { max-width: 1200px; margin: 4px auto 28px; }
.runtime-form-page, .channels-page.channels-form-page { max-width: 760px; }
.runtime-card, .contacts-card, .channel-card, .channels-form, .channel-settings,
.payload-filters, .payload-table-wrap, .payload-detail, .channels-diagnostic {
  border: 1px solid var(--line); border-radius: 4px; background: var(--surface); box-shadow: none;
}
.runtime-card-body { padding: 18px 20px; }
.runtime-card-body > :last-child { margin-bottom: 0; }
.runtime-card-intro { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.runtime-card-intro p { margin: 0 0 8px; font-size: 12px; }
.runtime-card-intro p:last-child { margin-bottom: 0; }
.runtime-card-footer { padding: 12px 20px; margin: 0; border-top: 1px solid var(--line); font-size: 12px; }
.runtime-section-lead { margin: 0 0 16px; font-size: 12px; line-height: 1.6; }
.runtime-form { min-width: 0; margin: 0; }
.runtime-form > p { margin: 0 0 16px; font-size: 12px; }
.runtime-form :is(input, select, textarea) { max-width: 100%; }
.runtime-form small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.runtime-form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 16px; margin-top: 18px; border-top: 1px solid var(--line); }
.runtime-search-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; padding: 14px 20px; margin: 0; border-bottom: 1px solid var(--line); }
.runtime-search-field { display: grid; flex: 1 1 240px; gap: 6px; max-width: 480px; }
.runtime-search-field input { margin: 0; }
.runtime-panel-list { display: grid; gap: 10px; margin: 16px 0; }
.runtime-panel-list .runtime-card { padding: 16px 18px; }
.runtime-panel-list h3 { margin: 0 0 6px; font-size: 13px; }
.runtime-panel-list p { margin: 4px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.runtime-pagination { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 16px; margin: 14px 0; font-size: 12px; }
.runtime-pagination:empty { display: none; }
.channels-button { min-height: 38px; padding: 8px 13px; border-radius: 5px; font-size: 12px; }
.channels-button-secondary { border-color: var(--line); color: #626b88; }
.channels-button-secondary:hover { border-color: #d7d2fb; background: var(--accent-soft); color: var(--accent-hover); }
.channels-list { gap: 8px; }
.channel-card summary { min-height: 70px; padding: 14px 18px; gap: 12px; }
.channel-symbol { width: 40px; height: 40px; border-radius: 6px; }
.channel-identity strong { font-size: 13px; }
.channel-status { padding: 3px 7px; border-radius: 4px; font-size: 10px; }
.channel-card-body { padding: 16px 18px; gap: 16px; background: #fff; }
.channel-metadata { gap: 16px; }
.channel-metadata dt { font-size: 11px; }
.channel-metadata dd { font-size: 12px; }
.channel-card-actions { gap: 8px; }
.channel-connection { display: grid; gap: 3px; min-width: 0; max-width: 240px; }
.channel-connection-status { color: #566278; font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.channel-connection-phone { color: #283145; font-size: 12px; font-variant-numeric: tabular-nums; line-height: 1.45; overflow-wrap: anywhere; }
.channel-connection-phone:empty { display: none; }
.channel-check-summary { display: block; margin: 0 0 14px; color: #566278; font-size: 12px; line-height: 1.5; }
.channel-check-summary:empty { margin: 0; }
.channel-connection-check { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 4px; background: #f8f7fe; }
.channel-connection-check > form { margin: 0; }
.channels-back { margin-bottom: 16px; }
.channels-form, .channel-settings { padding: 18px 20px; }
.channels-field { margin-bottom: 16px; }
.channels-form-actions { padding-top: 16px; margin-top: 20px; gap: 10px; }
.channel-settings { margin-top: 16px; }
.channel-settings header { margin-bottom: 14px; }
.channel-settings .channels-form { padding: 0; border: 0; margin-bottom: 16px; }
.channel-switch { padding: 14px 0; }
.channels-notice, .notice { border-radius: 4px; }
.channels-empty { padding: 36px 20px; border-color: var(--line); border-style: solid; border-radius: 4px; }
.channels-diagnostic { padding: 14px 18px; }
.channels-diagnostic h2 { margin-bottom: 12px; font-size: 15px; }
.channels-diagnostic form label { margin-bottom: 12px; }
.contacts-search { padding: 14px 18px; }
.search-field > .bi { top: 12px; }
.contacts-table th { padding: 10px 18px; background: #f8f9fd; }
.contacts-table td { padding: 13px 18px; }
.contacts-table .contacts-empty { padding: 36px 18px; }
.contacts-pagination { padding: 12px 18px; }
.contacts-pagination a, .contacts-pagination button.ajax-link { border-radius: 4px; }
.contacts-pagination a:hover, .contacts-pagination button.ajax-link:hover { background: var(--accent-soft); }
.payload-filters { gap: 10px; padding: 14px 16px; margin-bottom: 16px; }
.payload-filters label { font-size: 12px; }
.payload-filters button, .payload-filters .channels-button { min-height: 38px; }
.payload-table { font-size: 12px; }
.payload-table th { padding: 11px 16px; background: #f8f9fd; font-size: 11px; }
.payload-table td { padding: 13px 16px; }
.payload-type, .payload-outcome { font-size: 11px; }
.payload-outcome { border-radius: 4px; }
.payload-detail { padding: 18px 20px; }
.payload-metadata { gap: 16px; margin-bottom: 18px; }
.payload-metadata dt { font-size: 11px; }
.payload-metadata dd { font-size: 13px; }
.payload-json { padding: 16px; border-color: var(--line); border-radius: 4px; font-size: 12px; background: #f8f9fd; }
.auth-page { padding: 28px 0 40px; }
.auth-card { padding: 26px; border-radius: 4px; border-color: var(--line); box-shadow: none; }
.auth-symbol { width: 40px; height: 40px; margin-bottom: 18px; border-color: #e3defa; border-radius: 6px; }
.auth-card h1 { font-size: 23px; }
.auth-intro { margin-bottom: 22px; }
.auth-field { margin-bottom: 14px; }
.auth-session-note .bi { color: var(--accent); }
.app-header .notification-permission { min-height: 36px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; font-size: 12px; }
@media (max-width: 900px) {
  .app-header { gap: 14px; }
  .maker-brand img { width: 124px; }
  .app-nav a { padding: 8px 9px; }
  main { padding: 16px 18px 24px; }
}
@media (max-width: 720px) {
  .app-header { gap: 0; padding: 4px 12px 0; }
  .maker-brand img { width: 110px; }
  .app-header-tools { min-height: 42px; }
  .app-header-tools .environment { display: none; }
  .app-nav { min-height: 42px; gap: 4px; padding: 0; margin-top: 0; border: 0; }
  .app-nav a { min-height: 38px; padding: 8px; font-size: 11px; }
  main { padding: 14px 12px 22px; }
  .page-heading, .channels-heading { gap: 12px; margin-bottom: 16px; align-items: flex-start; flex-wrap: wrap; }
  .page-heading h1, .channels-heading h1 { font-size: 21px; }
  .runtime-card-body, .channels-form, .channel-settings, .payload-detail { padding: 16px; }
  .runtime-card-intro, .runtime-card-footer { padding: 12px 16px; }
  .runtime-search-form { padding: 12px 16px; }
  .runtime-form-actions > *, .channels-form-actions > * { flex: 0 1 auto; }
  .runtime-form :is(input:not([type=checkbox]), select, textarea), .channels-field :is(input, select), .auth-field input { font-size: 16px; }
  .auth-page { padding: 12px 0 28px; }
  .auth-card { padding: 22px; }
}

/* Chat workspace: one window, independent inbox/thread scroll, fixed composer.
   Chronological DOM order is retained; JS anchors the reader instead of reversing it. */
body:has(.chat-workspace) { --accent: #625bff; --accent-hover: #5048da; --accent-soft: #f1efff; --line: #e8edf5; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: #f8f9fc; }
body:has(.chat-workspace) .app-header { flex: 0 0 auto; min-height: 58px; padding: 0 22px; gap: 24px; border: 0; background: #f8f9fc; }
body:has(.chat-workspace) .maker-brand img { width: 124px; }
body:has(.chat-workspace) .app-nav { gap: 4px; }
body:has(.chat-workspace) .app-nav a { min-height: 36px; padding: 8px 10px; gap: 6px; font-size: 12px; }
body:has(.chat-workspace) .app-nav a[aria-current=page] { color: #5148d8; background: #eeecff; }
body:has(.chat-workspace) .app-header-tools { gap: 8px; }
body:has(.chat-workspace) :is(.notification-permission,.logout-button) { min-height: 36px; border: 1px solid var(--line); border-radius: 5px; padding: 7px 9px; font-size: 12px; }
body:has(.chat-workspace) .request-status, body:has(.chat-workspace) .chat-notifications { top: 68px; }
body:has(.chat-workspace) :focus-visible { outline-color: #625bff; }
main:has(.chat-workspace) { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; width: 100%; max-width: none; padding: 6px 22px 22px; }
main:has(.chat-workspace) > .page-feedback { flex: 0 0 auto; width: 100%; max-height: 20dvh; overflow: auto; margin-bottom: 10px; }
.workspace.chat-workspace { --accent: #625bff; --accent-hover: #5048da; --accent-soft: #f1efff; --line: #e8edf5; position: relative; flex: 1 1 0; min-height: 0; height: 100%; grid-template-columns: clamp(300px,23vw,390px) minmax(0,1fr); grid-template-rows: minmax(0,1fr); gap: 8px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.chat-workspace .inbox-panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; grid-row: auto; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.chat-workspace .panel-heading { display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; gap: 12px; padding: 12px 16px 10px; }
.chat-workspace .panel-heading h2 { margin: 0; font-size: 15px; letter-spacing: -.2px; }
.chat-workspace .panel-heading .eyebrow { font-size: 9px; letter-spacing: .65px; }
.chat-new { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid #e8e4fa; border-radius: 5px; background: var(--accent-soft); }
.chat-new:hover { background: #e6e1ff; text-decoration: none; }
.chat-workspace .inbox-tabs { flex: 0 0 auto; gap: 6px; padding: 0 12px 14px; }
.chat-workspace .inbox-tab { flex-direction: row; flex-wrap: wrap; gap: 4px 6px; min-height: 54px; padding: 7px 5px; border: 0; border-radius: 6px; background: #f6f5ff; color: #554bd4; font-size: 12px; font-weight: 550; }
.chat-workspace .inbox-tab > span:not(.inbox-count) { flex-basis: 100%; order: 1; }
.chat-workspace .inbox-tab:is(.is-active,[aria-current=page]) { background: var(--accent); color: #fff; box-shadow: 0 3px 8px #625bff12; }
.chat-workspace .inbox-tab:not(.is-active):hover { background: #eeebff; color: #463bc0; }
.chat-workspace .inbox-tab .bi { font-size: 14px; }
.chat-workspace .inbox-tabs-help { padding: 0; }
.chat-workspace .inbox-filter { display: flex; flex-direction: column; align-items: stretch; flex: 0 0 auto; gap: 8px; padding: 12px; }
.chat-workspace .inbox-filter label { flex: 1; min-width: 0; }
.chat-workspace .inbox-filter select, .chat-workspace .inbox-filter input { width: 100%; padding: 7px 9px; margin: 0; font-size: 12px; min-height: 36px; background: #fff; }
.inbox-filter-selects { display: flex; gap: 8px; min-width: 0; }
.inbox-count, .conversation-pending-count { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 999px; background: var(--brand-orange); color: var(--count-text); font-size: 10px; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.chat-workspace .inbox-tab:is(.is-active,[aria-current=page]) .inbox-count { background: var(--brand-orange); color: var(--count-text); }
.conversation-preview-row { display: flex; align-items: center; justify-content: space-between; min-width: 0; gap: 8px; }
.conversation-preview-row .conversation-subject { flex: 1; min-width: 0; }
.chat-workspace .inbox-filter button { min-height: 36px; padding: 6px 10px; border-color: var(--line); background: #fff; color: #526577; font-size: 12px; }
.chat-workspace .conversation-list { flex: 1 1 0; min-height: 0; max-height: none; overflow: auto; overscroll-behavior: contain; }
.chat-workspace button.conversation-card { display: grid; grid-template-columns: 40px minmax(0,1fr); align-items: start; justify-content: stretch; gap: 12px; width: 100%; margin: 0; padding: 12px 16px; border: 0; border-radius: 0; color: #283145; }
.chat-workspace button.conversation-card:hover { background: #faf7fd; }
.chat-workspace button.conversation-card.selected { background: #fbf0fc; color: #283145; box-shadow: inset 3px 0 var(--accent); }
.chat-workspace .conversation-card .contact-avatar { position: relative; width: 40px; height: 40px; margin-top: 1px; border-radius: 6px; background: #f0eff7; color: #7c7799; }
.chat-workspace .conversation-card .contact-avatar img { width: 40px; height: 40px; }
.conversation-card-identity { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 40px; flex: 0 0 40px; }
.conversation-card-identity .origin-badge-icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 20px; padding: 2px 4px; }
.conversation-card-identity .origin-badge-icon .bi { font-size: 14px; line-height: 1; }
.conversation-card-body { display: grid; gap: 3px; min-width: 0; }
.conversation-card-top { display: flex; align-items: baseline; justify-content: space-between; min-width: 0; gap: 8px; }
.chat-workspace .conversation-card .conversation-contact { flex: 1; min-width: 0; }
.chat-workspace .conversation-contact strong { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; line-height: 1.45; font-weight: 650; }
.conversation-updated { flex: 0 0 auto; color: #707d96; font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chat-workspace .conversation-subject { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 1.45; color: #6d7c96; }
.conversation-preview-label { color: #8793a7; }
.conversation-assignee-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-tags { display: flex; flex-wrap: wrap; align-items: center; min-width: 0; gap: 4px; margin-top: 2px; }
.chat-workspace .conversation-meta { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; padding: 1px 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 3px; background: #edf5ff; color: #3478a5; font-size: 10px; }
.chat-workspace .conversation-assignee { background: #f2efff; color: #65529b; }
.chat-workspace .conversation-card .badge { max-width: 100%; padding: 1px 5px; border-radius: 3px; font-size: 10px; line-height: 1.6; font-weight: 500; }
.chat-workspace .badge-unassigned, .chat-workspace .badge-waiting { background: #fff0f5; color: #b23e77; }
.chat-workspace .badge-assigned { background: #eeedff; color: #6656bb; }
.chat-workspace .badge-closed { background: #f0f2f6; color: #66758b; }
.chat-workspace .pagination { flex: 0 0 auto; padding: 10px 16px; font-size: 11px; border-top: 1px solid var(--line); }
.chat-workspace .pagination:empty { display: none; }
.chat-workspace .empty-list { padding: 12px 16px; margin: 0; font-size: 11px; }
.inbox-guidance { flex: 0 0 auto; max-height: 30%; overflow: auto; padding: 10px 16px; border-top: 1px solid var(--line); color: #6d7c96; font-size: 11px; }
.inbox-guidance summary { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.inbox-guidance p { margin: 8px 0 0; font-size: inherit; }
.chat-workspace .conversation-panel { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 4px; background-color: #fdfcfe; background-image: radial-gradient(ellipse at center,#827ab704 0 45%,transparent 46%); background-size: 48px 40px; }
.chat-workspace .conversation-heading { display: flex; align-items: center; flex: 0 0 72px; min-height: 72px; gap: 12px; margin: 0; padding: 12px 18px; background: #fff; border-bottom: 1px solid var(--line); }
.chat-workspace .conversation-heading .contact-avatar, .chat-workspace .conversation-heading .contact-avatar img { width: 40px; height: 40px; border-radius: 6px; }
.chat-back { display: none; }
.chat-identity { flex: 1; min-width: 0; }
.chat-identity h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0 0 2px; font-size: 14px; line-height: 1.45; letter-spacing: -.1px; }
.chat-identity p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.chat-heading-status { flex-shrink: 0; }
.chat-mark-read { margin: 0; flex: 0 0 auto; }
.chat-mark-read button { min-height: 34px; padding: 6px 9px; border-color: var(--line); background: #fff; color: var(--accent); font-size: 11px; }
.chat-welcome .chat-welcome-guidance { max-width: 390px; font-size: 12px; line-height: 1.6; }
.chat-workspace .chat-contact-details { flex: 0 0 40px; min-height: 40px; padding: 0; border: 0; cursor: pointer; background: #f2efff; color: #7c7395; }
.chat-workspace .chat-contact-details:hover { box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-workspace .chat-contact-details:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.chat-connection { flex: 0 0 auto; min-height: 24px; padding: 3px 18px; background: #fff; color: #727c94; font-size: 10px; border-bottom: 1px solid var(--line); }
.chat-details summary, .chat-requests summary { display: flex; align-items: center; gap: 7px; cursor: pointer; list-style: none; user-select: none; }
.chat-details summary::-webkit-details-marker, .chat-requests summary::-webkit-details-marker { display: none; }
.chat-details > summary { min-height: 36px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: #596d7a; font-size: 12px; white-space: nowrap; }
.chat-details[open] > summary { color: var(--accent); background: var(--accent-soft); border-color: #cce2da; }
.chat-details[open] > summary .bi-chevron-down, .chat-requests[open] > summary .bi-chevron-down { transform: rotate(180deg); }
.chat-workspace .details-panel { position: absolute; z-index: 6; top: 72px; bottom: 0; right: 0; width: min(360px,100%); padding: 24px; overflow: auto; overscroll-behavior: contain; border: 0; border-left: 1px solid var(--line); background: #fff; box-shadow: -12px 0 28px #2030470d; font-size: 14px; }
.chat-workspace .details-panel h2 { margin: 5px 0 16px; font-size: 16px; }
.chat-workspace .details-panel dl { margin: 0 0 20px; }
.chat-workspace .details-panel dt { margin-top: 10px; }
.chat-workspace .details-panel dd { font-size: 12px; }
.chat-workspace .details-panel form { padding-top: 12px; margin-top: 12px; }
.chat-workspace .details-panel input, .chat-workspace .details-panel select { padding: 8px 10px; }
.chat-workspace .details-panel button { min-height: 36px; font-size: 12px; }
.chat-workspace .actions-panel { width: min(390px,100%); }
.chat-workspace .actions-panel h3, .conversation-contact-tags h3 { margin: 16px 0 8px; font-size: 13px; }
.chat-workspace .actions-panel p { font-size: 12px; color: var(--muted); }
.chat-workspace .actions-panel form { display: grid; gap: 10px; border-top: 1px solid var(--line); }
.chat-workspace .actions-panel form label { margin: 0; }
.chat-workspace .actions-panel :is(.conversation-action-close, [data-transfer-form] > button) { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.chat-workspace .actions-panel .transfer-destination-help { margin: 0; font-size: 11px; line-height: 1.5; }
.chat-workspace .conversation-action-close { background: #fff0f2; border-color: #f2ccd4; color: #a12f46; }
.conversation-transfers { margin-top: 20px; padding-top: 4px; border-top: 1px solid var(--line); }
.conversation-cycle { border-top: 1px solid var(--line); padding-top: 10px; }
.conversation-previous { display: inline-flex; margin-bottom: 8px; font-size: 12px; }
.conversation-contact-tags { padding: 8px 0 12px; }
.conversation-contact-tags .channels-button-secondary { margin-top: 12px; font-size: 12px; }
.contact-detail-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-badge { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 6px; border: 1px solid transparent; border-radius: 3px; font-size: 11px; line-height: 1.4; overflow-wrap: anywhere; }
.tag-color-purple { background: #f0eaff; color: #68439b; border-color: #e6dbfa; }
.tag-color-blue { background: #e9f3ff; color: #275e9a; border-color: #d3e6fb; }
.tag-color-green { background: #e9f7f0; color: #246a49; border-color: #d0ecde; }
.tag-color-amber { background: #fff6de; color: #826119; border-color: #f4e5b6; }
.tag-color-red { background: #ffedf0; color: #a0354b; border-color: #f4d4db; }
.tag-color-pink { background: #fff0fa; color: #9a377a; border-color: #f4d8ec; }
.tag-color-gray { background: #f0f2f6; color: #586476; border-color: #dfe4ec; }
.tag-inactive { border-style: dashed; }
.chat-workspace .conversation-channel { background: #e9f6fc; color: #287093; }
.chat-help { padding: 14px 0; margin-top: 12px; border-top: 1px solid var(--line); }
.chat-help summary { cursor: pointer; color: #445b6c; font-weight: 600; }
.chat-help p, .chat-help > div { margin-top: 12px; }
.chat-workspace .timeline { margin-bottom: 0; }
.chat-workspace .timeline li { font-size: 12px; padding-bottom: 14px; }
.chat-thread { position: relative; flex: 1 1 0; min-height: 0; min-width: 0; }
.chat-viewport { display: flex; flex-direction: column; gap: 20px; width: 100%; height: 100%; padding: 22px 30px; overflow: auto; overflow-anchor: none; overscroll-behavior: contain; scrollbar-gutter: stable; }
.chat-pagination { display: flex; flex: 0 0 auto; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px 12px; color: #85929b; font-size: 10px; }
.chat-history-button { min-height: 30px; padding: 5px 12px; border-color: #dbe4e5; border-radius: 20px; background: #fff; color: #607581; font-size: 11px; font-weight: 500; }
.chat-history-button:hover { background: var(--accent-soft); border-color: #c5dcd5; color: var(--accent); }
.chat-messages { display: flex; flex: 0 0 auto; flex-direction: column; gap: 20px; margin-top: auto; }
.chat-message { align-self: flex-start; min-width: 140px; max-width: min(82%,900px); padding: 0; border: 0; background: transparent; box-shadow: none; overflow-wrap: anywhere; }
.chat-message.is-outbound { align-self: flex-end; color: #283145; }
.chat-bubble { padding: 14px 17px; border-radius: 20px 20px 20px 0; background: #f9effb; color: #283145; }
.chat-message.is-outbound .chat-bubble { border-radius: 20px 20px 0 20px; background: var(--accent); color: #fff; }
.chat-message-author { margin-bottom: 3px; color: #61577f; font-size: 11px; }
.chat-message.is-outbound .chat-bubble .chat-message-author { color: #edeaff; }
.chat-message .message-text { margin: 0; color: #283145; font-size: 14px; line-height: 1.6; }
.chat-message.is-outbound :is(.message-text,.chat-media-title,.chat-media-link,.chat-transcription,.chat-media small) { color: #fff; }
.chat-message.is-outbound :is(.chat-reply,.chat-message-unavailable) { color: #eeeaff; }
.chat-message.is-outbound .chat-reply { border-color: #c9c0ff; background: #ffffff12; }
.chat-message.is-outbound .chat-send-status { color: #657591; }
.chat-optimistic-kind { margin: 0 0 4px; font-size: 12px; line-height: 1.5; }
.chat-message-optimistic .chat-optimistic-status { display: inline; font-size: 11px; }
.chat-message-optimistic[data-optimistic-state="unknown"] .chat-optimistic-status,
.chat-message-optimistic[data-optimistic-state="dispatching"] .chat-optimistic-status { color: #8a5b18; }
.chat-message-optimistic[data-optimistic-state="failed"] .chat-optimistic-status,
.chat-message-optimistic[data-optimistic-state="interrupted"] .chat-optimistic-status { color: #a43142; }
.chat-message .chat-participant { margin: 0 0 5px; color: #72808c; font-size: 10px; }
.chat-reply { margin: 4px 0 8px; padding: 7px 9px; border-left: 3px solid #8fb7ac; border-radius: 4px; background: #20304706; color: #6c7f88; font-size: 10px; }
.chat-reply span { display: block; }
.chat-message-meta { display: flex; align-items: baseline; justify-content: flex-start; flex-wrap: wrap; gap: 4px 8px; padding: 0 1px; margin-top: 6px; color: #6f7e96; font-size: 11px; line-height: 1.5; }
.chat-message.is-outbound .chat-message-meta { justify-content: flex-end; }
.chat-message-meta .chat-message-author { margin: 0; color: #283145; font-size: inherit; }
.chat-message-unavailable { margin: 0; color: #849098; font-size: 12px; font-style: italic; }
.chat-media { display: grid; gap: 8px; min-width: 0; margin: 6px 0; }
.chat-media-title { display: flex; align-items: center; gap: 7px; font-size: 12px; color: #4d6774; }
.chat-media-load { justify-self: start; min-height: 36px; padding: 7px 12px; background: #f5f9f8; border-color: #d2e2dd; color: var(--accent); font-size: 12px; }
.chat-media-content:empty { display: none; }
.chat-media-content img, .chat-media-content video { display: block; max-width: 100%; width: min(320px,100%); max-height: 320px; object-fit: contain; border-radius: 8px; background: #eaf0ef; }
.chat-media-content audio { display: block; max-width: 100%; width: 280px; height: 42px; }
.chat-media-link { max-width: 100%; font-size: 11px; overflow-wrap: anywhere; }
.chat-media small { max-width: 320px; color: #75878f; font-size: 10px; line-height: 1.5; }
.chat-transcription { font-size: 11px; color: #55717a; }
.chat-transcription summary { cursor: pointer; }
.chat-send-status[data-send-status="unknown"], .chat-send-status[data-send-status="dispatching"] { color: #95611d; }
.chat-message.is-outbound .chat-send-status[data-send-status="unknown"], .chat-message.is-outbound .chat-send-status[data-send-status="dispatching"] { color: #8a5b18; }
#runtime-timezone { width: 100%; max-width: 100%; }
.chat-no-messages { padding: 30px 12px; text-align: center; color: #93a7ad; }
.chat-no-messages > .bi { font-size: 28px; }
.chat-no-messages p { margin: 10px 0 0; font-size: 12px; }
.chat-latest { position: absolute; z-index: 2; right: 20px; bottom: 12px; min-height: 34px; padding: 7px 12px; border-color: #d5e2df; border-radius: 20px; background: #fff; color: var(--accent); box-shadow: 0 3px 12px #20304715; font-size: 11px; }
.chat-latest:hover { background: #eaf6f2; color: var(--accent); }
.chat-composer { position: relative; flex: 0 0 auto; min-width: 0; padding: 10px 16px 8px; border-top: 1px solid var(--line); background: #fff; }
.chat-compose-form { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; border-radius: 0; background: #fff; box-shadow: none; }
.chat-compose-field { flex: 1; min-width: 0; }
.chat-compose-field textarea { display: block; min-height: 44px; max-height: 112px; margin: 0; padding: 11px 12px; resize: none; border-color: #dbe0eb; border-radius: 5px; background: #fff; box-shadow: none; font-size: 14px; line-height: 20px; font-weight: 400; }
.chat-compose-field textarea:focus { border-color: #d7d1f8; }
.chat-send { flex: 0 0 auto; min-height: 42px; padding: 10px 12px; font-size: 12px; border-radius: 5px; box-shadow: none; }
.chat-icon { width: 21px; height: 21px; flex: 0 0 21px; }
.chat-compose-toolbar, .chat-compose-tools { display: flex; align-items: center; gap: 5px; }
.chat-compose-toolbar { gap: 8px; padding: 0; align-items: flex-end; }
.chat-compose-tools { flex: 0 0 auto; align-self: center; }
.chat-compose-toolbar .chat-send { margin-left: auto; }
.chat-tool { min-height: 36px; min-width: 36px; padding: 7px; border: 1px solid transparent; border-radius: 5px; color: #a6429e; background: #fbf0fa; }
.chat-tool:hover, .chat-tool[aria-expanded=true] { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.chat-tool:disabled { cursor: not-allowed; }
.chat-compose-hint { display: none; }
.chat-compose-status { margin: 0; padding: 5px 12px; color: #7a5435; font-size: 13px; }
.chat-drop-hint { margin: 0; padding: 3px 0; color: #737b8d; font-size: 10px; line-height: 1.5; }
.chat-compose-form.is-dragging { outline: 2px dashed var(--accent); outline-offset: 5px; background: var(--accent-soft); }
.chat-compose-form.is-dragging .chat-drop-hint { color: var(--accent-hover); font-weight: 600; }
.chat-upload-queue { display: grid; gap: 7px; max-height: min(28dvh,240px); overflow: auto; overscroll-behavior: contain; list-style: none; padding: 0; margin: 0; scrollbar-width: thin; }
.chat-upload-item { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 4px 10px; padding: 9px 11px; border: 1px solid #e4dff7; border-radius: 5px; background: #f9f8fe; }
.chat-upload-name { grid-column: 1; min-width: 0; color: #38384d; font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.chat-upload-status { grid-column: 1; min-width: 0; color: #6c6980; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.chat-upload-progress { grid-column: 1; width: 100%; height: 7px; border: 0; border-radius: 5px; accent-color: var(--accent); overflow: hidden; background: #e8e5f5; }
.chat-upload-progress::-webkit-progress-bar { background: #e8e5f5; border-radius: 5px; }
.chat-upload-progress::-webkit-progress-value { background: var(--accent); border-radius: 5px; }
.chat-upload-progress::-moz-progress-bar { background: var(--accent); border-radius: 5px; }
.chat-upload-remove { grid-column: 2; grid-row: 1 / span 3; min-width: 36px; min-height: 36px; padding: 6px 9px; border: 1px solid #e3dcef; border-radius: 5px; background: #fff; color: #766080; font-size: 11px; }
.chat-upload-remove:hover { border-color: #c5b9de; background: #f4effb; color: #59456d; }
.chat-emoji-toggle-symbol { font-size: 20px; line-height: 1; }
.chat-emoji-panel { position: absolute; z-index: 7; bottom: calc(100% - 4px); left: 16px; width: min(320px,calc(100% - 32px)); max-height: min(60dvh,380px); overflow: auto; overscroll-behavior: contain; padding: 12px; border: 1px solid #e0ddef; border-radius: 8px; background: #fff; box-shadow: 0 10px 32px #26234420; }
.chat-emoji-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.chat-emoji-panel h3 { margin: 0; font-size: 14px; }
.chat-emoji-items { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 4px; }
.chat-emoji-item { min-width: 0; min-height: 40px; padding: 5px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: #283145; font-size: 22px; line-height: 1; }
.chat-emoji-item:hover, .chat-emoji-item:focus-visible { border-color: #ded8f8; background: var(--accent-soft); }
.chat-emoji-panel > p { margin: 10px 0 0; color: #737b8d; font-size: 10px; line-height: 1.5; }
.chat-attachment-preview { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border: 1px solid #e0dcf6; border-radius: 11px; background: #f8f7fe; }
.chat-attachment-symbol { display: inline-flex; padding: 10px; border-radius: 9px; color: var(--accent); background: #ece9fc; }
.chat-attachment-info { flex: 1; min-width: 0; }
.chat-attachment-info strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.chat-attachment-info > span { display: block; color: #737b8d; font-size: 12px; }
.chat-attachment-info audio { display: block; width: 100%; max-width: 360px; height: 38px; margin-top: 10px; }
.chat-recording { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 8px 12px; border-radius: 11px; color: #9d3451; background: #fff2f5; }
.chat-recording > span:not(.recording-dot) { margin-right: auto; font-size: 12px; }
.chat-recording time { font-variant-numeric: tabular-nums; }
.recording-dot { width: 8px; height: 8px; border-radius: 50%; background: #df4164; }
.chat-quick-panel { position: absolute; z-index: 7; bottom: calc(100% - 4px); left: 24px; width: min(440px,calc(100% - 48px)); max-height: min(60dvh,460px); display: flex; flex-direction: column; padding: 18px; border: 1px solid #e0ddef; border-radius: 17px; background: #fff; box-shadow: 0 14px 48px #26234420; }
.chat-quick-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chat-quick-panel h3 { margin: 3px 0 8px; font-size: 17px; }
.chat-quick-panel input { flex: 0 0 auto; margin: 8px 0; font-size: 14px; }
.chat-quick-panel > p { flex: 0 0 auto; margin: 5px 0; color: #737b8d; font-size: 13px; }
.chat-quick-items { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.chat-quick-item { display: block; width: 100%; padding: 12px; margin: 4px 0; border: 0; border-radius: 9px; background: #f8f8fc; color: #34394c; text-align: left; }
.chat-quick-item:hover { border-color: transparent; background: var(--accent-soft); color: #44349f; }
.chat-quick-item strong { display: block; font-size: 14px; }
.chat-quick-item span { display: block; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 400; }
.chat-quick-more { flex: 0 0 auto; min-height: 36px; margin-top: 8px; font-size: 13px; }
.chat-quick-panel footer { flex: 0 0 auto; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; padding-top: 12px; margin-top: 10px; border-top: 1px solid var(--line); color: #737b8d; font-size: 12px; }
.chat-composer-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 3px 10px; margin-top: 4px; }
.chat-composer-footer > p { flex: 1 1 230px; margin: 0; color: #737b8d; font-size: 10px; }
.chat-requests > summary { min-height: 30px; padding: 4px 7px; border-radius: 6px; color: #576f7b; font-size: 11px; }
.chat-requests > summary:hover, .chat-requests[open] > summary { background: #f0f6f4; color: var(--accent); }
.chat-count { padding: 0 5px; border-radius: 4px; background: #edf1f3; color: #697b85; font-size: 10px; }
.chat-pending-label { color: #966322; font-size: 10px; }
.chat-requests-content { position: absolute; z-index: 5; right: 12px; bottom: calc(100% + 8px); width: min(430px,calc(100% - 24px)); max-height: var(--chat-requests-height,min(60dvh,480px)); overflow: auto; overscroll-behavior: contain; padding: 18px; border: 1px solid #dbe5e3; border-radius: 12px; background: #fff; box-shadow: 0 8px 30px #20304718; font-size: 12px; }
.chat-requests-content h2 { margin-bottom: 8px; font-size: 15px; }
.chat-request { padding: 12px 0; border-top: 1px solid var(--line); }
.chat-request p { margin: 0 0 7px; }
.chat-request-reference { overflow-wrap: anywhere; font-size: 10px; }
.chat-request-links { display: grid; gap: 10px; margin: 12px 0; }
.chat-composer-notice { margin: 0 0 4px; font-size: 11px; }
.chat-workspace .empty-state { justify-content: center; align-items: center; padding: 28px; min-height: 0; background: #fff; }
.chat-welcome { display: flex; flex-direction: column; align-items: center; }
.chat-welcome-product { margin: 12px 0 4px; padding: 5px 12px; border-radius: 4px; color: #fff; background: var(--accent); font-size: 12px; font-weight: 600; }
.chat-workspace .empty-symbol { display: inline-flex; align-items: center; justify-content: center; width: 88px; height: 88px; padding: 16px; border-radius: 50%; margin-bottom: 20px; background: #f0edff; color: var(--accent); font-size: 42px; }
.chat-workspace .empty-state h1 { margin: 12px 0; color: #5c6276; font-size: clamp(24px,2.2vw,32px); font-weight: 550; }
.chat-workspace .empty-state p { max-width: 460px; font-size: 13px; }
.chat-empty-hint { display: inline-flex; align-items: center; gap: 6px; margin-top: 18px; color: #8a999f; font-size: 11px; }
.chat-workspace .chat-empty-connection { margin: 12px 0 0; color: #8a999f; font-size: 10px; }
.chat-viewport, .chat-workspace .conversation-list, .chat-workspace .details-panel, .chat-requests-content { scrollbar-width: thin; scrollbar-color: #c9d6d6 transparent; }
@media (max-width: 1080px) {
  .workspace.chat-workspace { grid-template-columns: 280px minmax(0,1fr); }
  .chat-compose-hint { display: none; }
  .chat-heading-status { display: none; }
  .chat-mark-read button span { display: none; }
  .chat-mark-read button { min-width: 34px; }
  .chat-viewport { padding: 16px 18px; }
}
@media (max-width: 720px) {
  body:has(.chat-workspace) .app-header { flex-wrap: wrap; min-height: 0; gap: 0; padding: 4px 12px 0; }
  body:has(.chat-workspace) .maker-brand img { width: 110px; }
  body:has(.chat-workspace) .app-header-tools { min-height: 42px; }
  body:has(.chat-workspace) .app-header-tools .environment { display: none; }
  body:has(.chat-workspace) .app-nav { order: 3; width: 100%; min-height: 42px; }
  body:has(.chat-workspace) .app-nav a { min-height: 38px; font-size: 11px; padding: 8px; }
  body:has(.chat-workspace) .request-status, body:has(.chat-workspace) .chat-notifications { top: 96px; }
  main:has(.chat-workspace) { padding: 0; }
  .workspace.chat-workspace { display: flex; min-height: 0; gap: 0; border: 0; border-radius: 0; }
  .chat-workspace .inbox-panel, .chat-workspace .conversation-panel { flex: 1 1 0; min-height: 0; border-radius: 0; }
  .chat-workspace:not(.has-conversation) > .conversation-panel, .chat-workspace.has-conversation > .inbox-panel { display: none; }
  .chat-workspace .conversation-heading { gap: 9px; padding: 10px 12px; }
  .chat-workspace .chat-back { display: block; }
  .chat-back button { min-height: 36px; }
  .chat-details > summary { padding: 7px 8px; }
  .chat-details > summary > .bi-person-circle { display: none; }
  .chat-workspace .details-panel { padding: 18px; width: min(360px,100%); }
  .chat-message { max-width: 90%; }
  .chat-viewport { padding: 14px 12px; }
  .chat-connection { padding-left: 12px; }
  .chat-composer { padding: 10px 10px max(8px,env(safe-area-inset-bottom)); }
  .chat-compose-form { gap: 7px; }
  .chat-send { padding: 10px 12px; }
  .chat-workspace .conversation-list { max-height: none; }
  .chat-quick-panel { left: 10px; width: calc(100% - 20px); }
  .chat-message .message-text { font-size: 14px; }
  .chat-compose-field textarea { font-size: 16px; }
}
@media (max-width: 520px) {
  .chat-compose-toolbar { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px; }
  .chat-compose-toolbar .chat-compose-field { grid-column: 1 / -1; grid-row: 1; }
  .chat-compose-toolbar .chat-compose-tools { grid-column: 1; grid-row: 2; }
  .chat-compose-toolbar .chat-send { grid-column: 2; grid-row: 2; min-height: 44px; }
  .chat-compose-tools .chat-tool { min-width: 44px; min-height: 44px; }
  .chat-emoji-items { grid-template-columns: repeat(5,minmax(0,1fr)); }
  .chat-emoji-item, .chat-upload-remove { min-height: 44px; }
  .chat-workspace .inbox-tab { min-height: 44px; }
}
@media (max-width: 400px) {
  body:has(.chat-workspace) .app-nav a { font-size: 10px; padding: 8px 4px; gap: 4px; }
  body:has(.chat-workspace) .app-nav { gap: 2px; }
  .chat-back button { font-size: 11px; gap: 4px; }
  .chat-identity h1 { font-size: 13px; }
}
.chat-notifications { position: fixed; top: 82px; right: 20px; z-index: 120; display: grid; gap: 10px; width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.chat-toast { display: grid; grid-template-columns: minmax(0, 1fr) 40px; align-items: center; padding: 8px; gap: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 8px 24px #20204414, 0 2px 6px #2020440a; pointer-events: auto; }
.chat-toast button { color: var(--text); background: transparent; border: 0; border-radius: 8px; text-align: left; padding: 8px; }
.chat-toast button:first-child { display: flex; justify-content: flex-start; width: 100%; min-width: 0; min-height: 56px; font-size: 13px; line-height: 1.4; }
.chat-toast button.chat-toast-open { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: start; justify-content: start; gap: 12px; }
.chat-toast-avatar, .chat-toast-avatar > img { width: 40px; height: 40px; }
.chat-toast-content { display: grid; align-content: center; gap: 3px; min-width: 0; min-height: 40px; }
.chat-toast-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; line-height: 18px; font-weight: 650; }
.chat-toast-preview { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; max-height: 36px; overflow: hidden; overflow-wrap: anywhere; color: var(--muted); font-size: 12px; line-height: 18px; font-weight: 400; }
.chat-toast button:last-child { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; min-height: 40px; padding: 0; color: var(--muted); font-size: 20px; line-height: 1; font-weight: 400; }
.chat-toast button:hover { background: var(--surface-subtle); }
.chat-toast button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.notification-permission { display: inline-flex; gap: 6px; align-items: center; border: 0; background: transparent; color: inherit; padding: 8px; }
.notification-permission[aria-pressed="true"] { color: #226748; }
.notification-permission:disabled { opacity: .6; }
.chat-operator-name { color: #283145; font-weight: 600; }
.chat-group-guidance { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; color: #737b8d; font-size: 10px; }
.session-notice { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 130; width: min(580px, calc(100vw - 32px)); padding: 12px 16px; border: 1px solid #dedbea; border-radius: 12px; color: #35334a; background: #fff8dd; box-shadow: 0 6px 25px #20204424; }
.session-notice p { margin: 0 0 8px; }
@media (max-width: 600px) { .notification-permission span { display: none; } .chat-notifications { top: 110px; right: 16px; } }

/* Attendance overlays keep the underlying thread and draft mounted. */
.inbox-heading-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.chat-workspace .inbox-panel > .panel-heading { flex-wrap: wrap; }
.chat-contacts, .chat-tags { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; min-width: 32px; min-height: 32px; padding: 0; border: 1px solid #e8e4fa; border-radius: 5px; background: var(--accent-soft); color: var(--accent); }
.chat-contacts:hover, .chat-tags:hover { border-color: #e8e4fa; background: #e6e1ff; color: var(--accent); text-decoration: none; }
dialog.attendance-dialog { padding: 0; border: 1px solid var(--line); border-radius: 6px; color: #283145; background: #fff; box-shadow: 0 16px 50px #27243d26; overflow: hidden; }
dialog.attendance-dialog[open] { display: flex; flex-direction: column; }
dialog.attendance-dialog::backdrop { background: #22233855; }
dialog.attendance-dialog.is-drawer { position: fixed; inset: 12px 12px 12px auto; width: min(460px,calc(100vw - 24px)); max-width: calc(100vw - 24px); height: calc(100dvh - 24px); max-height: calc(100dvh - 24px); margin: 0; }
dialog.attendance-dialog.is-modal { width: min(580px,calc(100vw - 24px)); max-width: calc(100vw - 24px); max-height: 90dvh; margin: auto; }
dialog.attendance-dialog.is-management { width: min(720px,95vw); max-width: calc(100vw - 24px); max-height: 90dvh; margin: auto; }
.attendance-dialog-header { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px 10px 18px; border-bottom: 1px solid var(--line); }
.attendance-dialog-header :is(h1, h2) { min-width: 0; margin: 0; font-size: 16px; line-height: 1.4; }
.attendance-dialog-header > button { flex: 0 0 44px; width: 44px; height: 44px; min-height: 44px; padding: 10px; border: 1px solid var(--line); border-radius: 5px; background: #f8f7fe; color: #675f91; }
.attendance-dialog-header > button:hover { border-color: #d7d2fb; background: var(--accent-soft); color: var(--accent-hover); }
.attendance-dialog-body { flex: 1 1 auto; min-width: 0; min-height: 0; padding: 18px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #c9c7db transparent; }
.attendance-dialog-status { margin: 0; padding: 10px 18px; border-bottom: 1px solid var(--line); background: #f8f7fe; color: #625c7a; font-size: 12px; overflow-wrap: anywhere; }
.attendance-dialog-refresh { align-self: flex-start; margin: 10px 18px; }
.attendance-dialog [data-attendance-surface] { width: 100%; max-width: none; min-height: 0; padding: 0; margin: 0; }
.attendance-dialog :is([data-attendance-heading], [data-attendance-back]) { display: none; }
.attendance-dialog [data-attendance-surface] .contacts-card { border: 0; border-radius: 0; box-shadow: none; }
.attendance-dialog [data-attendance-surface] .conversation-panel { padding: 0; }
.attendance-dialog.is-management [data-attendance-surface] > .channels-form { padding: 0; border: 0; box-shadow: none; }
.attendance-dialog.is-management [data-attendance-surface="quick-replies"] > .page-heading { justify-content: flex-end; margin-bottom: 12px; }
.attendance-dialog.is-management .runtime-card-intro { padding: 0 0 14px; }
.attendance-dialog.is-management .runtime-search-form { padding: 0 0 16px; }
.attendance-dialog.is-management .runtime-card-body { padding: 0; }
.attendance-dialog.is-management .channels-heading { margin-bottom: 12px; }
.attendance-dialog.is-management .channel-settings { padding: 16px; }
.contact-details-identity { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.contact-details-identity > div { min-width: 0; }
.contact-details-identity h2 { margin: 3px 0 0; font-size: 18px; overflow-wrap: anywhere; }
.contact-details-identity .contact-avatar, .contact-details-identity .contact-avatar img { width: 64px; height: 64px; border-radius: 8px; }
.contact-details-data { display: grid; grid-template-columns: minmax(80px,auto) minmax(0,1fr); gap: 10px 16px; margin: 0 0 20px; }
.contact-details-data dt { color: var(--muted); }
.contact-details-data dd { margin: 0; overflow-wrap: anywhere; }
.contact-details-note { margin: 18px 0 0; font-size: 12px; color: var(--muted); }
.tag-catalog-actions, .tag-link-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag-link-actions form { margin: 0; }
.contacts-guidance { margin: 0; padding: 12px 18px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.contact-directory-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,340px),1fr)); padding: 0; margin: 0; list-style: none; }
.contact-directory-card { display: grid; grid-template-columns: 40px minmax(0,1fr); align-content: start; gap: 12px; min-width: 0; padding: 16px 18px; border-top: 1px solid var(--line); }
.contact-directory-avatar { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 25px; }
.contact-directory-body { min-width: 0; }
.contact-directory-name { margin: 0 0 8px; color: #283145; font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.contact-directory-meta { display: grid; gap: 6px; margin: 0; }
.contact-directory-meta > div { display: grid; grid-template-columns: 52px minmax(0,1fr); align-items: baseline; gap: 6px; }
.contact-directory-meta dt { margin: 0; color: var(--muted); font-size: 10px; }
.contact-directory-meta dd { min-width: 0; margin: 0; color: #526179; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.contact-directory-verification { display: block; margin-top: 2px; color: #737d90; font-size: 10px; }
.contact-directory-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.contact-directory-actions .table-action { min-height: 28px; font-size: 11px; }
.contact-directory-list > .contacts-empty { grid-column: 1 / -1; padding: 30px 18px; border-top: 1px solid var(--line); text-align: center; }
.attendance-dialog .contacts-heading { justify-content: flex-end; margin-bottom: 12px; }
.attendance-dialog .contacts-search { padding: 0 0 14px; }
.attendance-dialog .contacts-search .search-field { flex: 1 1 auto; min-width: 0; width: auto; }
.attendance-dialog .contacts-guidance { padding: 12px 0; }
.attendance-dialog .contact-directory-list { grid-template-columns: minmax(0,1fr); }
.attendance-dialog .contact-directory-card { padding: 14px 0; }
.attendance-dialog .contacts-pagination { justify-content: space-between; padding: 12px 0 0; }
.workspace.opening-workspace { max-width: 760px; border-radius: 4px; box-shadow: none; }
.opening-content { padding: 20px; }
.opening-heading h1 { margin: 0 0 12px; font-size: 23px; }
.opening-back { margin: 0 0 16px; font-size: 12px; }
.opening-intro { margin: 0 0 16px; font-size: 12px; line-height: 1.6; }
.opening-search { display: flex; align-items: flex-end; gap: 10px; margin: 0 0 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.opening-search label { flex: 1 1 auto; min-width: 0; }
.opening-search input { margin: 6px 0 0; }
.opening-form { margin: 0; }
.opening-field { margin: 0 0 12px; }
.opening-field :is(input, select, textarea) { min-width: 0; margin-bottom: 0; }
.opening-field textarea { min-height: 76px; }
.opening-origin-notice { margin: 0 0 16px; padding: 10px 12px; border-left: 3px solid var(--accent); border-radius: 4px; background: var(--accent-soft); color: var(--text); font-size: 12px; line-height: 1.6; }
.opening-template { min-width: 0; margin: 18px 0 0; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-subtle); }
.opening-template legend { padding: 0 6px; color: var(--text); font-size: 14px; font-weight: 700; }
.opening-template > p { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.opening-template-search { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin: 0 0 12px; }
.opening-template-search > label { flex: 1 1 180px; min-width: 0; }
.opening-template-search input { margin: 6px 0 0; }
.opening-template-search button { flex: 0 0 auto; }
.opening-template :is(input:not([type=checkbox]), select) { min-width: 0; width: 100%; max-width: 100%; }
.opening-template-preview { padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.opening-template-preview p { margin: 0; white-space: pre-wrap; }
.opening-template-preview p + p { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.opening-template-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 12px; }
.opening-template-fields:empty { display: none; }
.opening-template-fields input { margin: 6px 0 0; }
.opening-template-confirm { display: flex; align-items: flex-start; gap: 8px; margin: 16px 0 10px; color: var(--text); font-size: 12px; line-height: 1.6; }
.opening-template-confirm input[type=checkbox] { flex: 0 0 auto; width: 17px; height: 17px; margin: 2px 0 0; }
.official-template-send-media { margin: 20px 0; padding: 16px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 8px; background: var(--surface-subtle); }
.official-template-send-media h3 { margin: 0 0 12px; color: var(--text); font-size: 14px; }
.official-template-send-media input[type=url] { min-width: 0; width: 100%; margin: 6px 0 8px; }
.official-template-send-media p { margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.official-template-send-media button { max-width: 100%; white-space: normal; }
.opening-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); margin-top: 16px; }
.opening-actions button { white-space: normal; text-align: center; }
.opening-pagination { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 12px; }
.opening-pagination:empty { display: none; }
.opening-empty { padding: 14px; margin: 0; border: 1px solid var(--line); border-radius: 4px; background: #f8f7fe; font-size: 12px; }
.attendance-dialog .workspace.opening-workspace { display: block; width: 100%; max-width: none; min-height: 0; padding: 0; border: 0; border-radius: 0; background: #fff; }
.attendance-dialog .opening-content { padding: 0; }
@media (max-width: 720px) {
  .channel-card > summary { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; column-gap: 10px; row-gap: 6px; }
  .channel-card > summary > .channel-symbol { grid-column: 1; grid-row: 1 / span 2; }
  .channel-card > summary > .channel-identity { grid-column: 2; grid-row: 1; }
  .channel-card > summary > .channel-status { grid-column: 3; grid-row: 1; justify-self: end; }
  .channel-card > summary > .channel-connection { grid-column: 2; grid-row: 2; max-width: none; }
  .channel-card > summary > .channel-chevron { grid-column: 3; grid-row: 2; justify-self: end; }
}
@media (max-width: 600px) {
  .attendance-dialog-body { padding: 14px; }
  .attendance-dialog-body :is(input:not([type=checkbox]), select, textarea) { font-size: 16px; }
  .inbox-heading-actions :is(.chat-new, .chat-contacts, .chat-tags) { width: 40px; height: 40px; min-height: 40px; }
  .contacts-search { flex-wrap: wrap; }
  .contacts-search .search-field { flex: 1 1 200px; width: auto; }
  .contacts-search button { flex: 0 0 auto; }
  .contact-directory-list { grid-template-columns: minmax(0,1fr); }
  .opening-content { padding: 16px; }
  .opening-search { flex-wrap: wrap; }
  .opening-search label { flex-basis: 200px; }
  .opening-actions button { width: 100%; }
}

/* Local appearance preference: does not change content, permissions or message state. */
:root { color-scheme: light; }
.app-header .theme-toggle { min-height: 36px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--text); font-size: 12px; white-space: nowrap; }
.app-header .theme-toggle:hover { background: var(--accent-soft); color: var(--accent); }
.theme-toggle-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; font-size: 18px; line-height: 1; }
.chat-history, .chat-history-back { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 36px; padding: 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--accent-soft); color: var(--accent); }
.chat-history:hover, .chat-history-back:hover { background: var(--accent-soft); color: var(--accent-hover); }
.inbox-heading-actions .chat-history { gap: 7px; min-height: 40px; padding: 8px 12px; border-color: var(--action); background: var(--action); color: #fff; font-size: 12px; font-weight: 650; white-space: nowrap; }
.inbox-heading-actions .chat-history:hover { border-color: var(--action-hover); background: var(--action-hover); color: #fff; }
.inbox-heading-actions .chat-history:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.chat-workspace .inbox-history-tabs { gap: 8px; }
.inbox-history-panel .inbox-filter { padding-top: 12px; }
.history-directory { padding: 0; margin: 0; list-style: none; }
.history-contact-card { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 8px; min-width: 0; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.history-contact-summary { flex: 1; min-width: 0; }
.history-contact-name { margin: 0; color: var(--text); font-size: 12px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-contact-meta { margin: 2px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-contact-menu { position: relative; align-self: start; margin: 0; }
.history-contact-menu > summary { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 32px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 4px; color: var(--accent); background: var(--surface); cursor: pointer; font-size: 11px; list-style: none; }
.history-contact-menu > summary::-webkit-details-marker { display: none; }
.history-contact-menu > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.history-contact-menu[open] > summary { background: var(--accent-soft); }
.history-contact-card:has(.history-contact-menu[open]) { padding-bottom: 54px; }
.history-contact-menu > form { position: absolute; z-index: 4; top: calc(100% + 4px); right: 0; min-width: 160px; margin: 0; padding: 4px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); box-shadow: var(--shadow); }
.history-contact-menu > form + form { top: calc(100% + 48px); }
.history-contact-card:has(.history-contact-menu[open] > form + form) { padding-bottom: 100px; }
.history-contact-menu button { display: flex; align-items: center; gap: 7px; width: 100%; min-height: 36px; padding: 7px; border: 0; background: var(--surface); color: var(--text); font-size: 11px; text-align: left; white-space: nowrap; }
.history-contact-menu button:hover { background: var(--accent-soft); color: var(--accent); }
.opening-selected-contact { display: grid; gap: 4px; margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-subtle); overflow-wrap: anywhere; }
.opening-selected-contact > span { color: var(--muted); font-size: 11px; }
.opening-selected-contact > strong { color: var(--text); font-size: 14px; }
.history-contact-meta dt { margin: 3px 0 0; font-size: 10px; }
.history-contact-meta dd { margin: 0; font-size: 11px; }
.history-contact-card > p { margin: 0; font-size: 10px; }
.history-contact-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inbox-history-panel > .history-contact-actions { flex: 0 0 auto; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.history-contact-actions form { margin: 0; }
.history-contact-actions :is(button, a) { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; font-size: 11px; }
.inbox-filter-selects { flex-wrap: wrap; }
.inbox-filter-selects > label { flex: 1 1 115px; }

:root[data-theme=dark],
:root[data-theme=dark] body:has(.chat-workspace),
:root[data-theme=dark] .workspace.chat-workspace {
  color-scheme: dark;
  --text: #e6e9f2;
  --page-bg: #11151e;
  --surface: #1b2130;
  --surface-subtle: #242c3d;
  --line: #384156;
  --muted: #b3bdd1;
  --accent: #b2acff;
  --accent-hover: #d1cdff;
  --accent-soft: #302b50;
}
:root[data-theme=dark], :root[data-theme=dark] body { color: var(--text); background: var(--page-bg); }
:root[data-theme=dark] body .app-header { background: var(--page-bg); }
/* Official variants follow the already-restored theme, including before first paint. */
:root[data-theme=dark] .maker-brand .brand-logo-light { display: none; }
:root[data-theme=dark] .maker-brand .brand-logo-dark { display: block; }
:root[data-theme=dark] body .app-nav a { color: var(--muted); }
:root[data-theme=dark] body .app-nav a:hover { color: var(--text); background: var(--surface-subtle); }
:root[data-theme=dark] body .app-nav a[aria-current=page] { color: var(--accent); background: var(--accent-soft); }
:root[data-theme=dark] :focus-visible, :root[data-theme=dark] body:has(.chat-workspace) :focus-visible { outline-color: var(--accent); }
:root[data-theme=dark] button { background: var(--action); border-color: var(--action); }
:root[data-theme=dark] button:hover { background: var(--action-hover); border-color: var(--action-hover); }
:root[data-theme=dark] :is(input, select, textarea) { background: var(--surface); border-color: var(--line); color: var(--text); }
:root[data-theme=dark] :is(input, textarea)::placeholder { color: var(--muted); opacity: 1; }
:root[data-theme=dark] :is(input, select, textarea):focus { border-color: var(--accent); }
:root[data-theme=dark] :is(input, select, textarea):disabled,
:root[data-theme=dark] .channels-field input[readonly] { background: var(--surface-subtle); color: var(--muted); border-color: var(--line); }
:root[data-theme=dark] .channel-switch input[type=checkbox] { background: #59657d; border-color: #697994; }
:root[data-theme=dark] .channel-switch input[type=checkbox]:checked { background: var(--action); border-color: var(--accent); }
:root[data-theme=dark] :is(.environment, .app-header .logout-button, .app-header .notification-permission, .app-header .theme-toggle) { background: var(--surface); color: var(--muted); border-color: var(--line); }
:root[data-theme=dark] :is(.app-header .logout-button, .app-header .notification-permission, .app-header .theme-toggle):hover { background: var(--accent-soft); color: var(--accent); }
:root[data-theme=dark] .notification-permission[aria-pressed=true] { color: #8ce1b3; }
:root[data-theme=dark] :is(.inbox-panel, .details-panel, .channel-card-body, .chat-composer, .chat-compose-form, .chat-quick-panel, .chat-emoji-panel, .chat-requests-content, .chat-toast, .chat-workspace .empty-state, .chat-workspace .inbox-panel, .chat-workspace .details-panel, .chat-workspace .conversation-heading, .chat-connection, .attendance-dialog .workspace.opening-workspace) { background: var(--surface); border-color: var(--line); }
:root[data-theme=dark] dialog.attendance-dialog { background: var(--surface); color: var(--text); }
:root[data-theme=dark] :is(.channel-card summary:hover, .contacts-table tbody tr:hover, .contacts-table th, .payload-table th, .payload-json, .channels-diagnostic pre, .notice, .channel-connection-check, .chat-upload-item, .chat-attachment-preview, .opening-empty, .attendance-dialog-status) { background: var(--surface-subtle); border-color: var(--line); color: var(--text); }
:root[data-theme=dark] :is(.contacts-table td, .payload-table td, .channel-switch, .timeline li) { border-color: var(--line); }
:root[data-theme=dark] :is(.contact-name, .contact-directory-name, .chat-operator-name, .channel-connection-phone, .payload-metadata dd, .chat-upload-name, .chat-quick-item strong) { color: var(--text); }
:root[data-theme=dark] :is(.muted, .empty-list, .eyebrow, dt, .contacts-table td, .contacts-empty strong, .payload-filters label, .payload-type, .payload-empty, .payload-metadata dt, .channels-back, .channel-connection-status, .channel-check-summary, .channel-switch-copy .bi, .contact-directory-meta dd, .contact-directory-verification, .auth-session-note, .timeline time, .inbox-guidance, .chat-identity p, .conversation-updated, .conversation-preview-label, .chat-workspace .conversation-subject, .chat-pagination, .chat-message-meta, .chat-message-unavailable, .chat-media small, .chat-transcription, .chat-drop-hint, .chat-upload-status, .chat-attachment-info > span, .chat-quick-panel > p, .chat-quick-panel footer, .chat-composer-footer > p, .chat-emoji-panel > p, .chat-toast-preview, .chat-group-guidance, .chat-empty-hint, .chat-workspace .chat-empty-connection, .chat-no-messages, .chat-connection) { color: var(--muted); }
:root[data-theme=dark] .chat-workspace .conversation-panel { background-color: var(--page-bg); }
:root[data-theme=dark] .chat-workspace button.conversation-card { background: transparent; color: var(--text); }
:root[data-theme=dark] .chat-workspace button.conversation-card:hover { background: var(--surface-subtle); }
:root[data-theme=dark] .chat-workspace button.conversation-card.selected { background: var(--accent-soft); color: var(--text); }
:root[data-theme=dark] :is(.contact-avatar, .chat-workspace .conversation-card .contact-avatar, .chat-workspace .chat-contact-details, .chat-workspace .empty-symbol, .chat-attachment-symbol) { background: var(--accent-soft); color: var(--accent); }
:root[data-theme=dark] .chat-workspace .inbox-tab { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
:root[data-theme=dark] .chat-workspace .inbox-tab:not(.is-active):hover { background: #3e365f; color: var(--accent-hover); }
:root[data-theme=dark] .chat-workspace .inbox-tab:is(.is-active,[aria-current=page]) { background: var(--action); color: #fff; }
:root[data-theme=dark] .chat-workspace .inbox-filter :is(input, select, button) { background: var(--surface); color: var(--text); border-color: var(--line); }
:root[data-theme=dark] .chat-workspace .inbox-filter :is(input, select):disabled { background: var(--surface-subtle); color: var(--muted); }
:root[data-theme=dark] :is(.badge, .badge-closed, .chat-workspace .badge-closed, .chat-count) { background: #343d50; color: #e2e7f2; }
:root[data-theme=dark] :is(.badge-assigned, .badge-waiting, .chat-workspace .badge-assigned, .chat-workspace .badge-unassigned, .chat-workspace .badge-waiting, .chat-workspace .conversation-assignee, .tag-color-purple) { background: #382f55; color: #e0ceff; border-color: #635183; }
:root[data-theme=dark] :is(.chat-workspace .conversation-meta, .tag-color-blue) { background: #243d56; color: #b8ddff; border-color: #426889; }
:root[data-theme=dark] .chat-workspace .conversation-assignee { background: #382f55; color: #e0ceff; }
:root[data-theme=dark] :is(.chat-workspace .conversation-channel, .channel-symbol) { background: #203c43; color: #a5e0e8; border-color: #45626a; }
:root[data-theme=dark] :is(.tag-color-green, .channel-status.is-active, .payload-outcome.is-accepted) { background: #1b4235; color: #9ce7bf; border-color: #437c64; }
:root[data-theme=dark] :is(.tag-color-amber, .channels-notice) { background: #44351f; color: #ffda95; border-color: #826b41; }
:root[data-theme=dark] :is(.tag-color-red, .chat-recording, .chat-workspace .conversation-action-close, .payload-outcome.is-rejected, .payload-outcome.is-failed) { background: #4a2933; color: #ffc3cc; border-color: #8a5360; }
:root[data-theme=dark] .tag-color-pink { background: #492c47; color: #f8c0e9; border-color: #805378; }
:root[data-theme=dark] :is(.tag-color-gray, .channel-status.is-disabled, .payload-outcome) { background: #343d50; color: #e2e7f2; border-color: #596781; }
:root[data-theme=dark] :is(.channels-button, .chat-welcome-product) { background: var(--action); border-color: var(--action); color: #fff; }
:root[data-theme=dark] .channels-button:hover { background: var(--action-hover); border-color: var(--action-hover); }
:root[data-theme=dark] :is(.channels-button-secondary, .chat-mark-read button, .chat-history-button, .chat-latest, .chat-media-load, .chat-upload-remove, .attendance-dialog-header > button) { background: var(--surface); border-color: var(--line); color: var(--accent); }
:root[data-theme=dark] :is(.channels-button-secondary, .chat-mark-read button, .chat-history-button, .chat-latest, .chat-media-load, .chat-upload-remove, .attendance-dialog-header > button):hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-hover); }
:root[data-theme=dark] :is(.chat-tool, .chat-new, .chat-contacts, .chat-tags, .chat-history, .chat-history-back) { background: var(--accent-soft); border-color: var(--line); color: var(--accent); }
:root[data-theme=dark] :is(.chat-tool, .chat-new, .chat-contacts, .chat-tags, .chat-history, .chat-history-back):hover { background: #3e365f; color: var(--accent-hover); }
:root[data-theme=dark] .inbox-heading-actions .chat-history { border-color: var(--action); background: var(--action); color: #fff; }
:root[data-theme=dark] .inbox-heading-actions .chat-history:hover { border-color: var(--action-hover); background: var(--action-hover); color: #fff; }
:root[data-theme=dark] :is(.chat-details > summary, .chat-help summary, .chat-requests > summary) { color: var(--muted); }
:root[data-theme=dark] :is(.chat-details[open] > summary, .chat-requests[open] > summary, .chat-requests > summary:hover) { background: var(--accent-soft); color: var(--accent); border-color: var(--line); }
:root[data-theme=dark] .chat-bubble { background: #302b42; color: var(--text); }
:root[data-theme=dark] :is(.chat-message .message-text, .chat-message-meta .chat-message-author, .chat-message.is-outbound, .chat-media-title, .chat-workspace .empty-state h1) { color: var(--text); }
:root[data-theme=dark] .chat-message-author { color: #d1c2ed; }
:root[data-theme=dark] .chat-message .chat-participant { color: var(--muted); }
:root[data-theme=dark] .chat-reply { background: #15182355; border-color: #a19bdb; color: #cad0e0; }
:root[data-theme=dark] .chat-message.is-outbound .chat-bubble { background: var(--action); color: #fff; }
:root[data-theme=dark] .chat-message.is-outbound :is(.message-text, .chat-media-title, .chat-media-link, .chat-transcription, .chat-media small) { color: #fff; }
:root[data-theme=dark] .chat-message.is-outbound .chat-send-status { color: var(--muted); }
:root[data-theme=dark] .chat-message-optimistic:is([data-optimistic-state="unknown"], [data-optimistic-state="dispatching"]) .chat-optimistic-status { color: #ffda95; }
:root[data-theme=dark] .chat-message-optimistic:is([data-optimistic-state="failed"], [data-optimistic-state="interrupted"]) .chat-optimistic-status { color: #ffb4be; }
:root[data-theme=dark] :is(.chat-send-status[data-send-status=unknown], .chat-send-status[data-send-status=dispatching], .chat-message.is-outbound .chat-send-status[data-send-status=unknown], .chat-message.is-outbound .chat-send-status[data-send-status=dispatching], .chat-compose-status, .chat-pending-label) { color: #ffda95; }
:root[data-theme=dark] :is(.chat-compose-form, .chat-compose-field textarea) { background: var(--surface); color: var(--text); border-color: var(--line); }
:root[data-theme=dark] .chat-compose-form.is-dragging { background: var(--accent-soft); }
:root[data-theme=dark] .chat-quick-item { background: var(--surface-subtle); color: var(--text); }
:root[data-theme=dark] .chat-quick-item:hover { background: var(--accent-soft); color: var(--accent); }
:root[data-theme=dark] .chat-emoji-item { background: transparent; color: var(--text); border-color: transparent; }
:root[data-theme=dark] .chat-emoji-item:hover { background: var(--accent-soft); border-color: var(--accent); }
:root[data-theme=dark] .chat-upload-progress, :root[data-theme=dark] .chat-upload-progress::-webkit-progress-bar { background: #42405c; }
:root[data-theme=dark] .chat-upload-progress::-webkit-progress-value { background: var(--accent); }
:root[data-theme=dark] .chat-upload-progress::-moz-progress-bar { background: var(--accent); }
:root[data-theme=dark] :is(.request-status, .page-feedback) { background: #1b4235; border-color: #437c64; color: #b0efcc; }
:root[data-theme=dark] .request-status[data-loading=true] { background: var(--surface); border-color: var(--line); color: var(--muted); }
:root[data-theme=dark] :is(.request-status[data-error=true], .page-feedback.is-error) { background: #4a2933; border-color: #8a5360; color: #ffc3cc; }
:root[data-theme=dark] :is(.channel-save-status[data-error=true], .channels-field-error) { color: #ffc3cc; }
:root[data-theme=dark] .channel-save-status { color: #9ce7bf; }
:root[data-theme=dark] .session-notice { background: #44351f; border-color: #826b41; color: #ffda95; }
:root[data-theme=dark] .session-notice p { color: inherit; }
:root[data-theme=dark] button.ajax-link { background: transparent; color: var(--accent); border-color: transparent; }
:root[data-theme=dark] button.ajax-link:hover { background: transparent; color: var(--accent-hover); }
@media (max-width: 600px) {
  .theme-toggle [data-theme-label] { display: none; }
  .app-header .theme-toggle { min-width: 36px; }
}

/* Settings remains a single workspace; the active subpage is explicit in both themes. */
.settings-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.settings-tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 8px; color: var(--muted); text-decoration: none; }
.settings-tabs a:hover { background: var(--accent-soft); color: var(--accent); }
.settings-tabs a[aria-current=page] { background: var(--action); color: #fff; }
.settings-tabs a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.user-departments { display: grid; gap: 10px; padding: 16px; margin: 0; border: 1px solid var(--line); border-radius: 10px; }
.user-departments label { display: flex; align-items: center; gap: 9px; font-weight: 400; }
.runtime-form .user-departments input[type=checkbox] { width: 18px; min-height: 18px; margin: 0; accent-color: var(--action); }
.history-contact-identity { display: flex; align-items: center; gap: 8px; min-width: 0; }
.history-contact-identity > :is(div,h3) { min-width: 0; overflow-wrap: anywhere; }
.history-contact-identity .contact-avatar { flex: 0 0 32px; width: 32px; height: 32px; }
.history-contact-identity .contact-avatar > img { width: 32px; height: 32px; }
form[data-assignment-form] { display: grid; gap: 10px; margin-top: 12px; }
form[data-assignment-form] label { display: grid; gap: 5px; }
form[data-assignment-form] :is(input,select,textarea) { width: 100%; min-width: 0; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px; }
.chat-attach-menu { position: absolute; bottom: 72px; left: 16px; z-index: 6; min-width: 170px; max-width: calc(100% - 32px); padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 8px 24px #0002; }
.chat-attach-menu[hidden], .chat-contact-panel[hidden] { display: none; }
/* Fixed icon column and explicit start alignment override centered global buttons in both themes. */
.chat-composer .chat-attach-menu > button { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 6px; background: transparent; color: var(--text); text-align: left; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.chat-composer .chat-attach-menu > button > .bi { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 20px; width: 20px; font-size: 18px; line-height: 1; }
.chat-composer .chat-attach-menu > button:is(:hover, :focus-visible):not(:disabled) { background: var(--accent-soft); color: var(--text); }
.chat-composer .chat-attach-menu > button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.chat-contact-panel { width: min(460px, calc(100vw - 32px)); max-height: min(640px, calc(100dvh - 48px)); padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 16px 48px #0004; }
.chat-contact-panel::backdrop { background: #071d2c88; }
.chat-contact-panel header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.chat-contact-panel h3 { margin: 3px 0; }
.chat-contact-panel input { width: 100%; }
.chat-contact-panel > p, .chat-contact-panel footer { color: var(--muted); font-size: 12px; line-height: 1.5; }
.chat-contact-panel footer { margin-top: 14px; }
.chat-contact-items { display: grid; gap: 7px; max-height: 340px; overflow-y: auto; }
.chat-contact-items .chat-quick-item { width: 100%; }
form[data-assignment-form] small { color: var(--muted); }
@media (max-width: 600px) { .settings-tabs { gap: 4px; } .settings-tabs a { padding: 8px 10px; font-size: 13px; } }

/* Contact/group identity, compact details and the current-page media gallery. */
.chat-identity-meta { display: flex; align-items: center; gap: 6px; min-width: 0; }
.chat-identity-meta .tag-badge { flex: 0 1 auto; max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.chat-identity-meta p { min-width: 0; margin: 0; color: var(--muted); }
.chat-workspace .contact-details-panel { width: min(390px,100%); }
.chat-workspace .details-panel .details-close { position: absolute; right: 10px; top: 10px; width: 32px; min-height: 32px; padding: 5px; }
.details-profile { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; margin: 8px 0 20px; padding-top: 10px; }
.chat-workspace .conversation-heading .details-profile .contact-avatar, .chat-workspace .conversation-heading .details-profile .contact-avatar img { width: 88px; height: 88px; border-radius: 50%; }
.details-profile .contact-avatar { margin-bottom: 10px; box-shadow: 0 0 0 4px var(--accent-soft); }
.details-profile .contact-avatar > .bi { font-size: 46px; }
.chat-workspace .details-profile h2 { margin: 2px 0; font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.details-profile p { margin: 0; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.details-contact-tag { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 20px; font-size: 12px; }
.details-contact-tag .channels-button-secondary { padding: 6px 8px; min-height: 32px; font-size: 12px; }
.details-tabs { display: flex; gap: 6px; padding-bottom: 9px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.chat-workspace .details-tabs button { width: auto; display: inline-flex; align-items: center; gap: 7px; flex: 1; justify-content: center; background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 8px; border-radius: 7px; }
.chat-workspace .details-tabs button[aria-selected=true] { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-detail-panel][hidden] { display: none !important; }
[data-detail-panel] { min-height: 60px; }
.chat-help-panel p { margin: 0 0 16px; line-height: 1.6; font-size: 13px; color: var(--muted); }
.chat-media-preview { display: block; width: min(320px,100%); padding: 0; overflow: hidden; border: 0; border-radius: 8px; background: var(--accent-soft); cursor: zoom-in; }
:root:not([data-theme=dark]) .chat-media-preview { background: var(--accent-soft); color: var(--text); }
:root:not([data-theme=dark]) .chat-media-preview:hover { background: var(--surface-subtle); }
.chat-media-preview-image { display: block; width: 100%; height: auto; max-height: 320px; object-fit: contain; }
.chat-media-caption, .chat-file-caption { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-files-list { display: grid; gap: 10px; margin: 10px 0 24px; padding: 0; list-style: none; }
.chat-file-images { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.chat-workspace .details-panel .chat-file-thumbnail { position: relative; display: grid; place-items: center; width: 100%; min-width: 0; aspect-ratio: 1; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--accent-soft); color: var(--text); cursor: zoom-in; }
.chat-workspace .details-panel .chat-file-thumbnail:hover { background: var(--surface-subtle); border-color: var(--accent); }
.chat-workspace .details-panel .chat-file-thumbnail:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chat-file-thumbnail > .bi { font-size: 24px; }
.chat-file-thumbnail-image { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.chat-file-entry { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 0; border-bottom: 1px solid var(--line); }
.chat-file-entry > div { flex: 1; min-width: 0; }
.chat-file-entry a { overflow-wrap: anywhere; font-size: 12px; }
.chat-file-entry .chat-media-preview { width: 82px; flex-shrink: 0; }
.chat-file-entry .chat-media-preview-image { width: 82px; height: 66px; object-fit: cover; }
.chat-file-entry small { color: var(--muted); font-size: 11px; }
.chat-file-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 700; }
.chat-files-heading h3 { margin: 0; font-size: 14px; }
.chat-files-heading p, .chat-files-scan p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.chat-files-list [data-contact-files-items] { display: grid; gap: 18px; min-width: 0; }
.chat-files-status { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.chat-files-status:empty { display: none; }
.chat-files-status[data-error=true] { color: var(--danger,#b42318); }
.chat-files-group { display: grid; gap: 10px; min-width: 0; }
.chat-files-group-heading { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.chat-files-group h4, .chat-files-browser-heading h4 { margin: 0; font-size: 13px; }
.chat-files-count { color: var(--muted); font-size: 11px; }
.chat-files-empty { padding: 14px; margin: 0; border: 1px dashed var(--line); border-radius: 8px; color: var(--muted); background: var(--surface-subtle); font-size: 12px; line-height: 1.5; }
.chat-workspace .details-panel .chat-files-button { width: auto; min-height: 34px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); font-size: 12px; line-height: 1.4; }
.chat-workspace .details-panel .chat-files-button:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chat-files-list :is(button,input,a):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.chat-files-list .chat-files-group > .chat-files-button { color: var(--accent); font-weight: 600; }
.chat-files-list .chat-file-entry { align-items: flex-start; padding: 12px 0; }
.chat-file-badge { flex: 0 0 42px; max-width: 48px; padding: 0 4px; overflow: hidden; }
.chat-file-meta { display: flex; flex-wrap: wrap; gap: 5px 8px; align-items: center; margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.chat-file-direction { display: inline-block; padding: 2px 5px; border-radius: 4px; background: var(--surface-subtle); color: var(--muted); font-weight: 600; }
.chat-file-direction[data-direction=outbound] { background: var(--accent-soft); color: var(--accent); }
.chat-file-information { min-width: 0; }
.chat-file-information .chat-file-caption { font-size: 11px; color: var(--muted); line-height: 1.5; max-height: 4.5em; overflow: auto; }
.chat-file-name { display: block; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; text-decoration: none; font-weight: 600; }
.chat-file-name:hover { text-decoration: underline; }
.chat-files-browser-heading { display: grid; gap: 12px; justify-items: start; }
.chat-files-directions { display: flex; gap: 4px; padding: 4px; border-radius: 9px; background: var(--surface-subtle); }
.chat-workspace .details-panel .chat-files-directions .chat-files-button { flex: 1; border-color: transparent; background: transparent; padding: 7px 5px; }
.chat-workspace .details-panel .chat-files-directions [aria-selected=true] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 5px #0000000d; font-weight: 600; }
.chat-workspace .details-panel .chat-files-search { display: flex; align-items: flex-end; gap: 7px; padding: 0; margin: 0; border: 0; }
.chat-files-search label { display: grid; flex: 1; min-width: 0; gap: 6px; margin: 0; font-size: 11px; font-weight: 600; }
.chat-files-search input { width: 100%; min-width: 0; margin: 0; font-size: 12px; }
.chat-file-browser-images { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px 10px; }
.chat-file-browser-images .chat-file-image-card { min-width: 0; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.chat-file-browser-images .chat-file-information { padding: 9px 2px 3px; }
.chat-files-pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.chat-files-pagination > span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.chat-files-scan { display: grid; gap: 10px; padding: 12px; background: var(--surface-subtle); border-radius: 8px; }
:root[data-theme=dark] .chat-files-status[data-error=true] { color: #ffb4ab; }
@media (pointer: coarse) { .chat-workspace .details-panel .chat-files-button { min-height: 40px; } }
.chat-lightbox { width: min(1040px,96vw); max-width: 96vw; max-height: 94dvh; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface,#fff); color: var(--text); box-shadow: 0 20px 80px #0006; }
.chat-lightbox::backdrop { background: #071121d9; }
.chat-lightbox-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.chat-lightbox-header h2 { margin: 0; font-size: 15px; }
.chat-lightbox-header button, .chat-lightbox-nav button { width: auto; padding: 8px 12px; min-height: 40px; }
.chat-lightbox-stage { display: flex; align-items: center; justify-content: center; min-height: 180px; }
.chat-lightbox-stage img { max-width: 100%; max-height: 65dvh; object-fit: contain; }
.chat-lightbox-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 12px; }
.chat-lightbox [data-lightbox-caption] { margin: 12px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; text-align: center; }
.kanban-page { padding: 20px 24px; min-width: 0; }
.chat-read-notice { display: flex; align-items: center; justify-content: center; gap: 5px; flex: 0 0 auto; margin: 6px 16px; padding: 10px 14px; border: 1px solid #bceee4; border-radius: 5px; background: #e9faf5; color: #087a69; font-size: 12px; text-align: center; }
.chat-read-notice[hidden] { display: none; }
:root[data-theme="dark"] .chat-read-notice { background: #123a34; border-color: #245b50; color: #84dcc7; }
.kanban-page .page-heading { align-items: center; gap: 16px; margin-bottom: 18px; }
.kanban-page .page-heading h1 { margin-bottom: 4px; font-size: 24px; letter-spacing: -.025em; }
.kanban-page .page-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.kanban-page .kanban-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); margin: 0 0 14px; }
.kanban-page .kanban-help { flex: 0 0 auto; min-width: 0; margin: 0; color: var(--muted); font-size: 11px; }
.kanban-page .kanban-help summary { display: flex; align-items: center; gap: 6px; width: fit-content; min-height: 36px; padding: 4px 6px; border-radius: 5px; cursor: pointer; list-style: none; }
.kanban-page .kanban-help summary::-webkit-details-marker { display: none; }
.kanban-page .kanban-help summary::after { content: '+'; color: var(--accent); font-size: 15px; }
.kanban-page .kanban-help[open] { flex-basis: 100%; border-top: 1px solid var(--line); }
.kanban-page .kanban-help[open] summary::after { content: '−'; }
.kanban-page #kanban-help { margin: 0; padding: 0 6px 4px; max-width: 920px; font-size: 11px; line-height: 1.6; }
.kanban-page .kanban-filters > .contacts-pagination { flex-basis: 100%; margin: 0; padding-top: 6px; }
.kanban-page .kanban-filter-form { display: flex; flex: 1 1 480px; align-items: center; gap: 8px; min-width: 0; margin: 0; }
.kanban-page .runtime-search-form { flex: 1 1 auto; display: grid; grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); gap: 8px; min-width: 0; padding: 0; border: 0; margin: 0; }
.kanban-page .runtime-search-field { min-width: 0; max-width: none; gap: 0; margin: 0; color: var(--text); font-size: 11px; font-weight: 600; }
.kanban-page .kanban-search-input { position: relative; display: flex; align-items: center; min-width: 0; }
.kanban-page .kanban-search-input > .bi { position: absolute; left: 12px; color: var(--muted); font-size: 13px; pointer-events: none; }
.kanban-page .kanban-filter-form :is(input, button) { min-height: 36px; padding-top: 7px; padding-bottom: 7px; border-radius: 6px; font-size: 12px; }
.kanban-page .kanban-search-input input { width: 100%; min-width: 0; padding-left: 34px; background: var(--surface-subtle); font-weight: 400; }
.kanban-page .kanban-filter-form > button { flex: 0 0 auto; width: auto; min-width: 84px; margin: 0; }
.kanban-page .kanban-board { display: flex; align-items: stretch; gap: 16px; overflow-x: auto; padding: 2px 1px 18px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.kanban-page .kanban-column { flex: 0 0 296px; max-width: 85vw; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-subtle); transition: border-color .12s ease; }
.kanban-page .kanban-column.is-drop-target { border: 2px dashed var(--accent); padding: 11px; background: var(--accent-soft); }
.kanban-page .kanban-column-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 0 12px; min-height: 30px; }
.kanban-page .kanban-column-heading h2 { margin: 0; font-size: 12px; font-weight: 650; min-width: 0; overflow-wrap: anywhere; }
.kanban-page .kanban-column-heading .tag-badge { max-width: 220px; padding: 5px 9px; border-radius: 6px; font-size: 11px; }
.kanban-page .kanban-column-count { flex-shrink: 0; min-width: 25px; text-align: center; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted); font-size: 11px; font-weight: 600; }
.kanban-page :is(.kanban-column-note, .kanban-empty, .kanban-invitation) { font-size: 12px; color: var(--muted); line-height: 1.5; }
.kanban-page .kanban-card-list { display: grid; align-content: start; gap: 12px; padding: 0; margin: 0; list-style: none; min-height: 64px; }
.kanban-page .kanban-empty { padding: 22px 12px; border: 1px dashed var(--line); border-radius: 8px; text-align: center; }
.kanban-page .kanban-contact-card { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 2px 4px #00000004; transition: border-color .12s ease, box-shadow .12s ease; }
.kanban-page .kanban-contact-card[draggable=true] { cursor: grab; }
.kanban-page .kanban-contact-card[draggable=true]:active { cursor: grabbing; }
.kanban-page .kanban-contact-card:hover, .kanban-page .kanban-contact-card:focus-within { border-color: var(--accent); box-shadow: 0 3px 12px #00000008; }
.kanban-page .kanban-contact-header { display: flex; align-items: center; gap: 10px; min-width: 0; }
.kanban-page .kanban-contact-avatar { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.kanban-page .kanban-contact-avatar > img { width: 36px; height: 36px; border-radius: inherit; pointer-events: none; }
.kanban-page .kanban-contact-avatar .contact-initials { font-size: 12px; }
.kanban-page .kanban-contact-identity { display: grid; gap: 3px; min-width: 0; }
.kanban-page .kanban-contact-name { color: var(--text); font-weight: 650; font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.kanban-page .kanban-contact-phone { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kanban-page .kanban-contact-status { display: inline-flex; align-items: center; align-self: flex-start; gap: 6px; padding: 3px 7px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 500; }
.kanban-page .kanban-contact-status > span { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.kanban-page .kanban-contact-status[data-status=closed] { background: var(--surface-subtle); color: var(--muted); }
.kanban-page .kanban-card-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); margin: 0; }
.kanban-page .kanban-card-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.kanban-page .kanban-card-actions :is(button, a) { width: auto; min-height: 32px; display: inline-flex; align-items: center; gap: 5px; padding: 5px 7px; border-radius: 5px; font-size: 11px; font-weight: 500; text-decoration: none; }
.kanban-page .kanban-card-actions > a { margin-left: auto; padding-right: 0; }
.kanban-page .kanban-card-actions button { color: var(--muted); background: var(--surface); border: 1px solid var(--line); }
.kanban-page .kanban-card-actions button:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.kanban-page [data-kanban-move] { display: flex; gap: 6px; margin: 0; padding-top: 2px; }
.kanban-page [data-kanban-move] select { flex: 1; min-width: 0; width: auto; font-size: 11px; min-height: 32px; padding: 5px 7px; border-radius: 5px; background: var(--surface-subtle); }
.kanban-page [data-kanban-move] button { width: auto; font-size: 11px; min-height: 32px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--accent); }
.kanban-page .kanban-feedback { font-size: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; }
.kanban-page .kanban-feedback[data-error=true] { color: var(--danger,#b42318); }
.kanban-page :is(button, a, select, input, summary, .kanban-board):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.kanban-page .kanban-preview { width: min(650px,94vw); max-width: 94vw; max-height: 90dvh; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface,#fff); color: var(--text); box-shadow: 0 24px 80px #0004; }
.kanban-page .kanban-preview::backdrop { background: #09132bbb; }
.kanban-page .kanban-preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kanban-page .kanban-preview-heading h2 { font-size: 17px; margin: 4px 0; overflow-wrap: anywhere; }
.kanban-page .kanban-preview-heading button { width: auto; min-height: 36px; padding: 6px 10px; font-size: 12px; }
.kanban-page :is(#kanban-preview-note, [data-kanban-preview-status], .kanban-preview footer) { font-size: 12px; color: var(--muted); line-height: 1.5; }
.kanban-page .kanban-preview-messages { max-height: 54dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 12px; margin: 10px 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-subtle,var(--bg,#f8fafc)); list-style: none; }
.kanban-page .kanban-preview-message { width: 90%; align-self: flex-start; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.kanban-page .kanban-preview-message[data-direction=outbound] { align-self: flex-end; border-inline-end: 3px solid var(--accent); }
.kanban-page .kanban-preview-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; font-size: 10px; color: var(--muted); }
.kanban-page .kanban-preview-message p { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.5; margin: 6px 0 0; }
.kanban-page .kanban-preview footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.kanban-page .kanban-preview footer a { margin-inline-start: auto; color: var(--accent); font-weight: 600; }
.kanban-page [hidden] { display: none !important; }
@media (pointer: coarse) { .kanban-page :is(.kanban-card-actions button, .kanban-card-actions a, [data-kanban-move] select, [data-kanban-move] button, .kanban-filter-form input, .kanban-filter-form button, .kanban-help summary) { min-height: 40px; } }
@media (max-width: 600px) { .kanban-page { padding: 14px 12px; } .kanban-page .page-heading { align-items: flex-start; } .kanban-page .kanban-filters { padding: 10px; gap: 4px; } .kanban-page .kanban-filter-form { display: grid; flex-basis: 100%; grid-template-columns: minmax(0,1fr) auto; gap: 8px; } .kanban-page .runtime-search-form { display: contents; } .kanban-page .kanban-contact-filter { grid-column: 1 / -1; } .kanban-page .kanban-filter-form > button { min-height: 40px; } .kanban-page .kanban-search-input input { min-height: 40px; font-size: 16px; } .kanban-page .kanban-help { margin-left: auto; } .kanban-page .kanban-help[open] { margin-left: 0; } .kanban-page .kanban-column { flex-basis: 284px; max-width: 88vw; } .chat-identity-meta { flex-wrap: wrap; gap: 2px 5px; } .chat-identity-meta .tag-badge { max-width: 100%; } .chat-identity-meta p { width: 100%; font-size: 10px; } .chat-lightbox { padding: 10px; } }

/* One contact-note surface is shared by Kanban and the contact details panel. */
.contact-notes { display: grid; gap: 18px; min-width: 0; max-width: 100%; color: var(--text); }
.contact-notes-dialog { width: min(680px,calc(100% - 32px)); max-width: calc(100% - 32px); max-height: 90dvh; padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 20px 64px #0003; overscroll-behavior: contain; }
.contact-notes-dialog::backdrop { background: #09132ba6; }
.contact-notes-dialog > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding-bottom: 18px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.contact-notes-dialog h2 { margin: 3px 0 0; font-size: 18px; line-height: 1.4; overflow-wrap: anywhere; }
.contact-notes-dialog > header > button { flex: 0 0 auto; min-height: 34px; padding: 6px 10px; border-color: var(--line); background: var(--surface-subtle); color: var(--muted); font-size: 12px; }
.contact-notes-heading { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.contact-notes-eyebrow { color: var(--text); font-size: 13px; font-weight: 650; }
.contact-notes .contact-notes-help { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.contact-notes form.contact-notes-form { display: grid; gap: 10px; min-width: 0; padding: 16px; margin: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-subtle); }
.contact-notes-form:focus-within, .contact-notes-form[data-editing=true] { border-color: var(--accent); }
.contact-notes-editor-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.contact-notes-form label { color: var(--text); font-size: 13px; font-weight: 600; }
.contact-notes-editor-heading > span { padding: 3px 8px; border: 1px solid var(--line); border-radius: 20px; color: var(--accent); background: var(--surface); font-size: 11px; }
.contact-notes-form textarea { display: block; box-sizing: border-box; width: 100%; min-width: 0; min-height: 96px; max-height: 300px; margin: 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; line-height: 1.6; resize: vertical; }
.contact-notes-editor-hint { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.contact-notes-editor-hint small { font-size: inherit; }
.contact-notes-editor-hint > span { flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.contact-notes-toolbar, .contact-notes-editor-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.contact-notes.contact-notes :is(button, a) { width: auto; min-height: 36px; padding: 7px 12px; border-radius: 7px; font-size: 12px; }
.contact-notes [data-notes-save] { min-width: 122px; }
.contact-notes button:disabled { opacity: .55; cursor: not-allowed; }
.contact-notes-status { padding: 10px 12px; margin: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-subtle); color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.contact-notes-status:empty { display: none; }
.contact-notes-status[data-kind=success] { color: var(--text); border-left: 3px solid var(--accent); }
.contact-notes-status[data-error=true] { color: var(--danger,#b42318); }
:root[data-theme=dark] .contact-notes-status[data-error=true] { color: #ffb4ab; }
.contact-notes-list-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 12px; color: var(--muted); font-size: 11px; }
.contact-notes-list-heading strong { color: var(--text); font-size: 13px; font-weight: 600; }
.contact-notes-empty { display: grid; justify-items: center; gap: 9px; padding: 24px 18px; border: 1px dashed var(--line); border-radius: 12px; text-align: center; }
.contact-notes-empty-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--surface-subtle); color: var(--accent); font-size: 25px; }
.contact-notes-empty strong { font-size: 13px; font-weight: 600; }
.contact-notes-empty p { max-width: 340px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.contact-notes-list { display: grid; gap: 14px; min-width: 0; padding: 0 0 0 16px; margin: 0 0 0 3px; border-left: 1px solid var(--line); list-style: none; }
.contact-notes-list:empty { display: none; }
.contact-note { position: relative; min-width: 0; padding: 15px 16px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.contact-note::before { content: ''; position: absolute; top: 27px; left: -21px; width: 7px; height: 7px; border: 2px solid var(--surface); border-radius: 50%; background: var(--muted); }
.contact-note-header { display: flex; align-items: center; gap: 10px; min-width: 0; }
.contact-note-avatar { display: grid; flex: 0 0 auto; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-subtle); color: var(--accent); font-size: 11px; font-weight: 650; }
.contact-note-identity { display: grid; min-width: 0; gap: 2px; }
.contact-note-author { color: var(--text); font-size: 13px; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.contact-note-date, .contact-note-edited { color: var(--muted); font-size: 11px; line-height: 1.55; overflow-wrap: anywhere; }
.contact-note-body { margin: 13px 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); font-size: 13px; line-height: 1.7; }
.contact-note[data-collapsed=true] .contact-note-body { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6; max-height: 10.2em; overflow: hidden; }
.contact-notes .contact-note .contact-note-expand { min-height: 30px; padding: 3px 0; border: 0; background: transparent; color: var(--accent); font-size: 12px; font-weight: 600; }
.contact-note-edited { display: block; margin: 8px 0 0; }
.contact-note-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; margin-top: 8px; }
.contact-note-actions:empty { display: none; }
.contact-notes .contact-note-actions button { min-height: 32px; padding: 5px 9px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 11px; }
.contact-note-actions button:hover:not(:disabled) { background: var(--surface-subtle); color: var(--accent); border-color: var(--line); }
.contact-note-actions [data-note-action=delete]:hover:not(:disabled) { color: var(--danger,#b42318); }
.contact-notes .contact-notes-older { justify-self: center; min-width: 170px; }
.contact-notes-permissions { padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.65; }
.contact-notes-permissions summary { width: fit-content; cursor: pointer; }
.contact-notes-permissions p { margin: 8px 0 0; }
.contact-notes[hidden], .contact-notes [hidden] { display: none !important; }
.contact-notes :is(button, a, textarea, summary):focus-visible, .contact-notes-dialog > header > button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 600px) { .contact-notes-dialog { padding: 16px; } .contact-notes-heading { flex-direction: column; } .contact-notes-toolbar { width: 100%; justify-content: flex-start; } .contact-notes form.contact-notes-form { padding: 12px; } .contact-notes-form textarea { font-size: 16px; } .contact-notes-editor-hint { flex-wrap: wrap; gap: 5px; } .contact-notes-editor-actions { justify-content: space-between; } .contact-note { padding: 12px; } }
@media (pointer: coarse) { .contact-notes.contact-notes :is(button, a), .contact-notes .contact-note .contact-note-expand, .contact-notes-dialog > header > button { min-height: 40px; } }

/* Channel editor: independent forms in a compact, progressively enhanced tab layout. */
.channel-editor .channel-connection-check { gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--surface-subtle); }
.channel-editor-connection-summary { display: grid; min-width: 0; gap: 4px; }
.channel-editor-registration { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 11px; }
.channel-editor .channel-connection { max-width: none; }
.channel-editor .channel-editor-connection-note { margin: 7px 2px 14px; font-size: 11px; line-height: 1.5; }
.channel-editor .channel-editor-tabs { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; margin: 0 0 14px; background: var(--surface-subtle); }
.channel-editor .channel-editor-tabs [role=tab] { display: inline-flex; flex: 1 1 0; align-items: center; justify-content: center; min-width: 0; min-height: 38px; gap: 7px; padding: 8px 10px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--muted); font-size: 12px; }
.channel-editor .channel-editor-tabs [role=tab]:hover { background: var(--surface); color: var(--text); }
.channel-editor .channel-editor-tabs [role=tab][aria-selected=true] { border-color: var(--line); background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px #00000008; }
.channel-editor :is([role=tab], [role=tabpanel]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.channel-editor .channel-editor-panel { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 8px; margin: 0 0 14px; background: var(--surface); }
.channel-editor .channel-editor-panel:last-child { margin-bottom: 0; }
.channel-editor .channel-editor-tabs[hidden], .channel-editor .channel-editor-panel[hidden] { display: none; }
.channel-editor .channel-editor-panel-heading { margin: 0 0 16px; }
.channel-editor .channel-editor-panel-heading h2 { margin: 0 0 4px; color: var(--text); font-size: 14px; line-height: 1.4; }
.channel-editor .channel-editor-panel-heading p { margin: 0; }
.channel-editor .channels-form { padding: 0; border: 0; margin: 0; background: transparent; box-shadow: none; }
.channel-editor-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px 16px; }
.channel-editor-field-wide { grid-column: 1 / -1; }
.channel-editor .channels-field { min-width: 0; margin: 0; }
.channel-editor .channels-field label { display: block; color: var(--text); font-size: 12px; font-weight: 600; }
.channel-editor .channels-field :is(input, select) { width: 100%; min-width: 0; min-height: 38px; font-size: 13px; }
.channel-editor .channels-field .channels-caption { margin: 6px 0 0; font-size: 11px; line-height: 1.5; }
.channel-editor .channel-switch { padding: 12px 0; border-color: var(--line); gap: 16px; }
.channel-editor .channel-switch:first-of-type { padding-top: 0; }
.channel-editor .channel-switch-copy { gap: 3px; }
.channel-editor .channel-editor-note { padding: 11px 12px; border: 1px solid var(--line); border-radius: 6px; margin: 14px 0 0; background: var(--surface-subtle); color: var(--muted); font-size: 12px; line-height: 1.6; }
.channel-editor .channels-form > .channel-editor-note:first-of-type { margin-top: 0; }
.channel-editor .channel-save-status { margin: 10px 0 0; }
.channel-editor-confirm { display: flex; align-items: flex-start; gap: 9px; margin: 16px 0 0; color: var(--text); font-size: 12px; cursor: pointer; }
.channel-editor-confirm input[type=checkbox] { flex: 0 0 16px; width: 16px; height: 16px; padding: 0; margin: 2px 0 0; accent-color: var(--action); }
/* Scoped SweetAlert confirmation; follows the existing light/dark theme. */
.swal2-popup.conversation-close-dialog { width: min(420px,calc(100vw - 32px)); padding: 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.conversation-close-dialog .swal2-title { margin: 0 0 12px; color: var(--text); font-size: 20px; line-height: 1.3; }
.conversation-close-dialog .swal2-content { color: var(--muted); font-size: 14px; line-height: 1.6; }
.conversation-close-dialog .swal2-icon { margin: 0 auto 18px; }
.conversation-close-dialog .swal2-actions { justify-content: flex-end; gap: 8px; width: 100%; margin: 24px 0 0; }
.conversation-close-dialog .swal2-actions button { flex: 0 1 auto; min-height: 40px; margin: 0; padding: 9px 16px; border-radius: 6px; font-size: 13px; font-weight: 600; }
.conversation-close-dialog .conversation-close-confirm { border: 1px solid #b42332; background: #b42332; color: #fff; }
.conversation-close-dialog .conversation-close-confirm:hover { border-color: #911b28; background: #911b28; }
.conversation-close-dialog .conversation-close-cancel { border: 1px solid var(--line); background: var(--surface-subtle); color: var(--text); }
.conversation-close-dialog .swal2-actions button:focus-visible { outline: 3px solid var(--action); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { .conversation-close-dialog, .conversation-close-dialog .swal2-icon { animation: none !important; } }
.channel-editor .channels-form-actions { gap: 8px; padding-top: 14px; margin-top: 18px; }
.channel-editor .channels-form-actions > *, .channel-editor .channel-editor-secondary-actions > a { flex: 0 1 auto; min-height: 38px; margin: 0; font-size: 12px; }
.channel-editor-secondary-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); margin-top: 18px; }
.channel-editor-secondary-actions > span { flex: 1 1 auto; color: var(--muted); font-size: 11px; }
dialog.attendance-dialog.is-channel-edit { width: min(660px,calc(100vw - 24px)); max-width: calc(100vw - 24px); max-height: min(760px,calc(100dvh - 24px)); border-radius: 10px; }
.attendance-dialog.is-channel-edit .attendance-dialog-header { padding: 10px 12px 10px 18px; }
.attendance-dialog.is-channel-edit .attendance-dialog-header > button { width: 38px; height: 38px; min-height: 38px; flex-basis: 38px; padding: 8px; }
.attendance-dialog.is-channel-edit .attendance-dialog-body { padding: 14px 18px 18px; }
.attendance-dialog.is-channel-edit .channel-editor .channel-editor-panel { padding: 16px; }
@media (max-width: 600px) {
  .channel-editor-fields { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .channel-editor .channel-editor-panel { padding: 14px; }
  .channel-editor .channel-connection-check > form { margin-left: auto; }
  .channel-editor .channel-editor-tabs [role=tab] { gap: 5px; padding: 8px 6px; }
  .channel-editor .channel-editor-secondary-actions > span { flex-basis: 100%; }
  .attendance-dialog.is-channel-edit .attendance-dialog-body { padding: 12px; }
  .attendance-dialog.is-channel-edit .channel-editor .channels-field :is(input, select) { font-size: 16px; }
  .attendance-dialog.is-channel-edit .channel-editor .channel-editor-panel { padding: 14px; }
}

/* Webchat settings: one native form, shared save action and accessible tabs. */
.webchat-settings-editor .webchat-settings-intro { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.webchat-settings-tabs { display: flex; gap: 4px; padding: 4px; margin: 0 0 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-subtle); }
.webchat-settings-tabs [role=tab] { display: inline-flex; flex: 1 1 0; align-items: center; justify-content: center; gap: 7px; min-width: 0; min-height: 42px; padding: 8px 10px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--muted); font-size: 12px; }
.webchat-settings-tabs [role=tab]:hover { background: var(--surface); color: var(--text); }
.webchat-settings-tabs [role=tab][aria-selected=true] { border-color: var(--line); background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px #00000008; }
.webchat-settings-editor :is([role=tab], [role=tabpanel], summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.webchat-settings-panel { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px; background: var(--surface); }
.webchat-settings-tabs[hidden], .webchat-settings-panel[hidden] { display: none; }
.webchat-settings-panel-heading { margin: 0 0 16px; }
.webchat-settings-panel-heading h2 { margin: 0 0 4px; color: var(--text); font-size: 14px; }
.webchat-settings-panel-heading p { margin: 0; }
.webchat-settings-panel > .channel-switch { padding-top: 0; gap: 16px; }
.webchat-settings-panel > .channels-field:last-child { margin-bottom: 0; }
.webchat-settings-panel .webchat-settings-branding { padding: 0; border: 0; margin: 0; }
.webchat-settings-panel .webchat-settings-branding legend { padding: 0; margin-bottom: 16px; }
.webchat-settings-panel p { font-size: 12px; line-height: 1.6; }
.webchat-settings-editor .webchat-settings-save { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 14px 0 0; border-top: 1px solid var(--line); }
.webchat-settings-save > p { flex: 1 1 220px; margin: 0; }
.webchat-settings-editor .webchat-settings-save .channels-form-actions { gap: 8px; margin: 0; padding: 0; }
.webchat-settings-save-help { margin-top: 16px; color: var(--muted); font-size: 12px; }
.webchat-settings-save-help summary { cursor: pointer; }
dialog.attendance-dialog.is-webchat-settings { width: min(760px,calc(100vw - 24px)); max-width: calc(100vw - 24px); max-height: min(820px,calc(100dvh - 24px)); border-radius: 10px; }
.attendance-dialog.is-webchat-settings .attendance-dialog-body { padding: 16px 18px 18px; }
@media (max-width: 600px) {
  .webchat-settings-tabs [role=tab] { gap: 4px; padding: 8px 5px; font-size: 11px; }
  .webchat-settings-panel { padding: 14px; }
  .attendance-dialog.is-webchat-settings .attendance-dialog-body { padding: 12px; }
  .webchat-settings-save .channels-form-actions { width: 100%; }
  .webchat-settings-save .channels-form-actions > * { flex: 1; text-align: center; }
}

/* Compact repository: keep the catalog visible; expand upload/help on demand. */
.repository-page { font-size: 13px; }
.repository-page .bi-clipboard::before { content: "\f290"; }
.repository-page .page-heading { margin-bottom: 12px; }
.repository-page .page-heading h1 { margin: 0; font-size: 20px; }
.repository-page .page-heading p { margin-top: 3px; }
.repository-page :is(button, input, summary) { font-size: 12px; }
.repository-page button { min-height: 34px; gap: 6px; padding: 6px 10px; }
.repository-page input:not([type=checkbox]) { min-width: 0; margin: 0; }
.repository-page .repository-notice { margin-bottom: 12px; font-size: 12px; }
.repository-page .repository-notice > p { margin-bottom: 3px; }
.repository-page .repository-notice > p > .bi { margin-right: 3px; }
.repository-page .repository-help > summary { width: fit-content; min-height: 28px; padding: 3px 0; color: var(--accent); cursor: pointer; }
.repository-page .repository-help > div { max-width: 850px; padding: 8px 0 0; }
.repository-page .repository-help p { margin-bottom: 8px; }
.repository-page .repository-upload-panel { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.repository-page .repository-upload-panel > summary { display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 9px 14px; list-style: none; color: var(--accent); font-weight: 600; cursor: pointer; }
.repository-page .repository-upload-panel > summary::-webkit-details-marker { display: none; }
.repository-page .repository-upload-panel > summary > span:first-child { display: inline-flex; align-items: center; gap: 7px; }
.repository-page .repository-upload-limit { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 400; }
.repository-page .repository-upload-panel[open] > summary { border-bottom: 1px solid var(--line); }
.repository-page .repository-upload-panel[open] > summary > .bi { transform: rotate(180deg); }
.repository-page .repository-upload-form { display: grid; gap: 12px; padding: 14px; }
.repository-page .repository-dropzone { display: grid; gap: 10px; min-width: 0; padding: 12px; border: 1px dashed var(--line); border-radius: 5px; background: var(--surface-subtle); }
.repository-page .repository-dropzone:focus, .repository-page .repository-dropzone:focus-within, .repository-page .repository-dropzone.is-dragging { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.repository-page .repository-dropzone p, .repository-page .repository-preview p { margin: 2px 0 0; overflow-wrap: anywhere; }
.repository-page .repository-dropzone p, .repository-page .repository-preview small { font-size: 11px; color: var(--muted); }
.repository-page .repository-file-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.repository-page .repository-file-picker input { flex: 1 1 240px; width: auto; padding: 0; border: 0; background: transparent; }
.repository-page .repository-file-picker input::file-selector-button { margin-right: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.repository-page .repository-preview { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 5px; }
.repository-page .repository-preview > div { min-width: 0; }
.repository-page .repository-preview canvas { display: block; flex: 0 0 auto; max-width: 96px; max-height: 72px; width: auto; height: auto; object-fit: contain; border-radius: 4px; }
.repository-page .repository-preview[hidden], .repository-page .repository-preview canvas[hidden] { display: none; }
.repository-page .repository-upload-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.repository-page .repository-consent { display: flex; align-items: flex-start; flex: 1 1 320px; gap: 7px; font-size: 12px; font-weight: 400; }
.repository-page .repository-consent input { flex: 0 0 auto; margin: 3px 0 0; }
.repository-page .channels-form-actions { flex: 0 1 auto; gap: 8px; margin: 0; padding: 0; border: 0; }
.repository-page .repository-local-hint { color: var(--muted); font-size: 11px; }
.repository-page .repository-reconcile { margin: 10px 0; font-size: 12px; }
.repository-page .repository-catalog { border-radius: 6px; }
.repository-page .repository-catalog-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.repository-page .repository-catalog-toolbar h2 { margin: 0; font-size: 13px; }
.repository-page .runtime-search-form { flex: 0 1 390px; flex-wrap: nowrap; gap: 6px; padding: 0; border: 0; }
.repository-page .runtime-search-field { flex: 1 1 auto; min-width: 0; gap: 0; }
.repository-page .runtime-search-field input { height: 34px; font-size: 12px; }
.repository-page .repository-table { table-layout: fixed; min-width: 720px; font-size: 12px; }
.repository-page .repository-table th, .repository-page .repository-table td { padding: 9px 14px; }
.repository-page .repository-table th:nth-child(1) { width: 28%; }
.repository-page .repository-table th:nth-child(2) { width: 17%; }
.repository-page .repository-table th:nth-child(3) { width: 37%; }
.repository-page .repository-table th:nth-child(4) { width: 18%; }
.repository-page .repository-table .contact-name { font-size: 12px; font-weight: 600; color: var(--text); }
.repository-page .repository-file-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.repository-page .repository-created { font-size: 11px; font-variant-numeric: tabular-nums; }
.repository-page .repository-created > span { display: block; color: var(--muted); }
.repository-page .repository-url-field { display: flex; align-items: center; gap: 6px; }
.repository-page .repository-url-field input { flex: 1 1 auto; width: 100%; height: 32px; padding: 5px 8px; color: var(--muted); font-size: 11px; }
.repository-page .repository-url-field button { flex: 0 0 auto; }
.repository-page .repository-row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.repository-page .repository-row-actions form { margin: 0; }
.repository-page .repository-row-actions a, .repository-page .repository-remove { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 6px; border: 1px solid transparent; border-radius: 4px; background: transparent; font-size: 12px; font-weight: 400; }
.repository-page .repository-remove { color: var(--muted); }
.repository-page .repository-row-actions a:hover, .repository-page .repository-remove:hover { background: var(--surface-subtle); border-color: var(--line); text-decoration: none; }
.repository-page .repository-table .contacts-empty { padding: 28px 14px; }
.repository-page .contacts-pagination { gap: 8px; padding: 10px 14px; }
@media (max-width: 600px) {
  .repository-page .repository-catalog-toolbar { gap: 8px; }
  .repository-page .runtime-search-form { flex-basis: 100%; }
  .repository-page .repository-upload-form { padding: 12px; }
  .repository-page .repository-consent { flex-basis: 100%; }
  .repository-page .channels-form-actions { justify-content: flex-end; width: 100%; }
  .repository-page :is(button, input:not([type=checkbox])) { min-height: 40px; }
  .repository-page .runtime-search-field input { font-size: 16px; }
}
.chat-phone-verification{display:inline-flex;margin:0;vertical-align:middle}
.chat-phone-verification button{font:inherit;font-size:.75rem;padding:.18rem .45rem;min-height:0}
.chat-contact-cards{display:grid;gap:10px;min-width:min(290px,100%)}
.chat-contact-card{display:grid;grid-template-columns:36px minmax(0,1fr);gap:8px;padding:12px;border:1px solid var(--line);border-radius:12px;background:var(--surface);overflow-wrap:anywhere}
.chat-contact-card p{margin:4px 0;color:var(--muted)}
.chat-card-icon{font-size:24px;color:var(--accent)}
.chat-card-actions{grid-column:1/-1;display:flex;gap:8px;flex-wrap:wrap}
.chat-card-actions button,.chat-copy-value button{font:inherit;font-size:.8rem;padding:7px 10px;min-height:32px}
.chat-interactive-card,.chat-location-card{display:grid;gap:9px;min-width:min(280px,100%);max-width:100%;overflow-wrap:anywhere}
.chat-rich-label{display:block;font-size:.7rem;color:var(--muted);letter-spacing:.02em}
.chat-message.is-outbound .chat-interactive-card > .chat-rich-label{color:inherit}
.chat-rich-title{font-size:.95rem}
.chat-rich-option{display:grid;gap:5px;padding:9px 11px;border:1px solid var(--line);border-radius:9px;background:var(--surface);color:var(--text);white-space:pre-wrap;overflow-wrap:anywhere}
.chat-rich-option a{color:var(--accent);font-weight:600}
.chat-rich-option small,.chat-interactive-card>small{color:var(--muted)}
.chat-option-section{display:grid;gap:7px;margin-top:3px}
.chat-option-section>strong{font-size:.82rem}
.chat-copy-value{display:flex;gap:8px;align-items:center;justify-content:space-between}
.chat-copy-value code{white-space:pre-wrap;overflow-wrap:anywhere;min-width:0}
.chat-reactions{display:flex;flex-wrap:wrap;gap:4px;margin:4px 0}
.chat-reactions span{border:1px solid var(--line);border-radius:99px;padding:2px 8px;font-size:.78rem;background:var(--surface)}
.chat-message:has(>.chat-message-actions){position:relative}
.chat-message:has(>.chat-message-actions)>.chat-bubble{padding-right:48px;min-height:44px}
.chat-message-actions{position:absolute;top:6px;right:6px;z-index:1;width:32px;height:32px;color:var(--muted)}
.chat-message.is-outbound>.chat-message-actions{color:#fff}
.chat-message-actions>button[data-message-menu-toggle]{display:grid;place-items:center;width:32px;height:32px;min-height:32px;padding:0;border:0;border-radius:8px;background:transparent;color:inherit;box-shadow:none;font-size:18px;line-height:1}
.chat-message-actions>button[data-message-menu-toggle]:is(:hover,[aria-expanded=true]){border:0;background:var(--accent-soft);color:var(--accent)}
.chat-message-actions>button[data-message-menu-toggle]:focus-visible{outline:2px solid currentColor;outline-offset:2px}
[data-message-menu-template][hidden],.chat-message-menu[hidden]{display:none!important}
.chat-message-menu{--message-menu-danger:#b42318;position:fixed;z-index:140;display:grid;gap:2px;box-sizing:border-box;width:190px;max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);overflow:auto;overscroll-behavior:contain;padding:6px;border:1px solid var(--line);border-radius:12px;background:var(--surface);color:var(--text);box-shadow:0 12px 32px #0003}
.chat-message-menu button[data-message-action]{display:flex;align-items:center;justify-content:flex-start;gap:10px;width:100%;min-height:38px;margin:0;padding:9px 10px;border:0;border-radius:7px;background:transparent;color:var(--text);font:inherit;font-size:13px;font-weight:500;text-align:left;white-space:nowrap}
.chat-message-menu button[data-message-action] .chat-icon{width:18px;height:18px;flex:0 0 18px}
.chat-message-menu button[data-message-action]:is(:hover,:focus-visible){background:var(--accent-soft);color:var(--accent)}
.chat-message-menu button[data-message-action]:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.chat-message-menu button[data-message-action=delete]{color:var(--message-menu-danger)}
.chat-message-menu button[data-message-action=delete]:is(:hover,:focus-visible){color:var(--message-menu-danger)}
:root[data-theme=dark] .chat-message-menu{--message-menu-danger:#ffb4ab}
.chat-action-dialog{box-sizing:border-box;width:min(480px,calc(100vw - 24px));max-height:calc(100dvh - 32px);overflow:auto;border:1px solid var(--line);border-radius:16px;background:var(--surface);color:var(--text);padding:22px}
.chat-action-dialog::backdrop{background:rgba(15,23,42,.55)}
.chat-action-dialog form{display:grid;gap:18px}
.chat-action-dialog h2{margin:0;font-size:1.2rem;line-height:1.3}
.chat-action-description{margin:7px 0 0;font-size:.86rem;line-height:1.5;color:var(--muted)}
.chat-action-fields{display:grid;gap:12px}.chat-action-fields label{display:grid;gap:7px;font-size:.85rem}
.chat-action-fields :is(input,select,textarea){width:100%;box-sizing:border-box;font:inherit;color:var(--text);background:var(--surface);border:1px solid var(--line);border-radius:8px;padding:10px}
.chat-reaction-picker{min-width:0;margin:0;padding:0;border:0}
.chat-reaction-picker legend{margin-bottom:12px;padding:0;font-size:.88rem;font-weight:600}
.chat-reaction-grid{display:grid;grid-template-columns:repeat(6,56px);gap:10px;justify-content:space-between}
.chat-action-dialog .chat-reaction-choice{display:grid;place-items:center;box-sizing:border-box;width:56px;height:56px;padding:0;border:1px solid var(--line);border-radius:14px;background:var(--surface);color:var(--text);font-size:32px;line-height:1;cursor:pointer}
.chat-action-dialog .chat-reaction-choice[aria-pressed=true]{border-color:var(--accent);background:var(--accent-soft);color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}
.chat-action-dialog .chat-reaction-choice:hover:not(:disabled){border-color:var(--accent);background:var(--accent-soft)}
.chat-action-dialog button:focus-visible{outline:3px solid var(--accent);outline-offset:3px}
.chat-action-dialog button:disabled{opacity:.55;cursor:not-allowed}
.chat-action-dialog .chat-action-status{margin:0;min-height:1.5em;font-size:.82rem;line-height:1.5;color:var(--muted);overflow-wrap:anywhere}
.chat-action-footer{display:flex;justify-content:flex-end;gap:10px;border-top:1px solid var(--line);padding-top:16px}
.chat-action-footer button{min-height:42px;border:1px solid var(--line);border-radius:9px;background:var(--surface);color:var(--text);font:inherit;font-size:.88rem;font-weight:600;padding:9px 16px;cursor:pointer}
.chat-action-footer button[type=submit]{border-color:var(--accent);background:var(--accent);color:var(--surface)}
@media(max-width:520px){.chat-copy-value{align-items:flex-start;flex-direction:column}.chat-card-actions button{flex:1}.chat-action-fields :is(input,select,textarea){font-size:16px}}
@media(max-width:480px){.chat-action-dialog{padding:18px}.chat-reaction-grid{grid-template-columns:repeat(3,56px);justify-content:center;gap:12px}.chat-action-footer button{flex:1}}
