:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  --page-bg: #f4f5f7;
  --surface: #fff;
  --surface-soft: #f7f8fa;
  --surface-muted: #f0f2f5;
  --chat-bg: #f6f7f9;
  --text: #252a31;
  --text-muted: #737b86;
  --text-faint: #9aa1aa;
  --border: #e1e5ea;
  --border-strong: #d5dae1;
  --input-bg: #fff;
  --backdrop: #0007;
  --shadow: #0003;
  --brand: #e1251b;
  --brand-soft: #fff0ef;
  --primary: #2878e5;
  --agent-bubble: #4a89f3;
  --success: #23a967;
  --warning: #d79a23;
  --danger: #d8322b;
  --scroll-track: #e8ebef;
  --scroll-thumb: #929ba7;
  color: var(--text);
  background: var(--page-bg);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page-bg: #0d1117;
  --surface: #171c24;
  --surface-soft: #1b222c;
  --surface-muted: #222a35;
  --chat-bg: #10161e;
  --text: #e8edf3;
  --text-muted: #b2bbc7;
  --text-faint: #8994a2;
  --border: #303947;
  --border-strong: #404b5b;
  --input-bg: #111720;
  --backdrop: #000b;
  --shadow: #0008;
  --brand-soft: #3a1c1c;
  --primary: #5d9df4;
  --agent-bubble: #2869bd;
  --success: #55c98b;
  --warning: #e4b651;
  --danger: #ff716b;
  --scroll-track: #151b24;
  --scroll-thumb: #596575;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 980px; min-height: 100vh; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.login-view { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #16191f, #313744); }
.login-card { width: 380px; padding: 38px; border-radius: 12px; background: #fff; box-shadow: 0 24px 70px #0006; }
.brand-badge { display: inline-block; padding: 5px 9px; color: #fff; background: #e1251b; font-size: 11px; letter-spacing: 2px; }
.login-card h1 { margin: 16px 0 4px; font-size: 28px; }
.login-card p { margin: 0 0 26px; color: #8a8f99; }
.login-card label { display: block; margin: 14px 0; color: #60656f; font-size: 13px; }
.login-card input { display: block; width: 100%; height: 42px; margin-top: 7px; padding: 0 12px; border: 1px solid #d9dce2; border-radius: 4px; outline: 0; }
.login-card input:focus { border-color: #e1251b; box-shadow: 0 0 0 3px #e1251b16; }
.login-card button { width: 100%; height: 44px; margin-top: 14px; border: 0; border-radius: 4px; color: #fff; background: #1d1f23; }
.error { min-height: 20px; padding-top: 10px; color: #d82929; font-size: 13px; }
.workspace { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 58px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; color: #fff; background: #20242b; }
.topbar strong { font-size: 18px; }.topbar div:first-child span { margin-left: 20px; color: #b8bec8; font-size: 13px; }
.agent-state { display: flex; align-items: center; gap: 8px; font-size: 13px; }.agent-state i { width: 8px; height: 8px; border-radius: 50%; background: #e8a329; }.agent-state i.online { background: #23b26d; }.agent-state button { margin-left: 10px; padding: 6px 10px; border: 1px solid #ffffff24; border-radius: 4px; color: #ddd; background: transparent; }
.sound-setting { position: relative; }.agent-state .sound-setting button { margin-left: 0; }.sound-menu { position: absolute; top: 39px; right: 0; width: 156px; padding: 6px; display: grid; gap: 3px; border: 1px solid #dfe2e7; border-radius: 6px; color: #333; background: #fff; box-shadow: 0 10px 28px #0003; z-index: 30; }.agent-state .sound-menu button { width: 100%; margin: 0; padding: 7px 9px; border: 0; color: #59606a; text-align: left; background: transparent; }.agent-state .sound-menu button:hover, .agent-state .sound-menu button.active { color: #e1251b; background: #fff0ef; }.agent-state .sound-menu .unread-voice-preview { margin-top: 4px; border-top: 1px solid #eceef1; color: #d92920; font-weight: 600; }
.metrics { height: 92px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: #e7e9ed; border-bottom: 1px solid #e1e3e7; }
.metrics div { display: flex; flex-direction: column; align-items: center; justify-content: center; background: #fff; }.metrics b { color: #e1251b; font-size: 24px; }.metrics span { margin-top: 4px; color: #888e97; font-size: 12px; }
.workbench { height: calc(100vh - 150px); min-height: 560px; display: grid; grid-template-columns: 320px minmax(430px, 1fr) 310px; background: #fff; }
.conversation-pane, .visitor-pane { min-width: 0; border-right: 1px solid #e5e7eb; }.visitor-pane { border-right: 0; border-left: 1px solid #e5e7eb; }
.pane-tabs { height: 48px; display: flex; border-bottom: 1px solid #e5e7eb; }.pane-tabs button { flex: 1; border: 0; color: #737984; background: #fff; }.pane-tabs button.active { color: #e1251b; border-bottom: 2px solid #e1251b; }.queue-tabs button { padding: 0 5px; font-size: 12px; }.queue-tabs span { display: inline-grid; min-width: 18px; height: 18px; padding: 0 4px; place-items: center; border-radius: 9px; background: #f0f1f3; font-size: 10px; }.queue-tabs button.active span { color: #fff; background: #e1251b; }
.search { padding: 10px; border-bottom: 1px solid #eee; }.search input { width: 100%; height: 34px; padding: 0 10px; border: 1px solid #e2e4e8; border-radius: 4px; outline: 0; }
.conversation-list { height: calc(100% - 103px); overflow: auto; }.conversation { position: relative; width: 100%; padding: 13px 12px; display: flex; gap: 10px; border: 0; border-bottom: 1px solid #f0f1f3; text-align: left; background: #fff; }.conversation:hover, .conversation.active { background: #f5f7fa; }.conversation.urgent { box-shadow: inset 3px 0 #e1251b; }.conversation.high { box-shadow: inset 3px 0 #e9a11b; }.avatar { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #596579; font-weight: 600; }.conversation-main { min-width: 0; flex: 1; }.conversation-line { display: flex; justify-content: space-between; gap: 8px; }.conversation-line strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.conversation-line time { color: #a4a8af; font-size: 11px; }.preview { margin-top: 5px; overflow: hidden; color: #92969e; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }.conversation-meta { margin-top: 5px; display: flex; gap: 5px; color: #9a9fa7; font-size: 10px; }.conversation-meta span { padding: 2px 5px; border-radius: 3px; background: #f0f1f3; }.badge { position: absolute; top: 8px; left: 40px; min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: #f23b36; font-size: 11px; }
.chat-pane { min-width: 0; display: flex; flex-direction: column; }.chat-title { height: 49px; padding: 0 14px 0 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e5e7eb; }.chat-title span { margin-left: 10px; color: #27a968; font-size: 12px; }.chat-title em { margin-left: 8px; }
.priority { padding: 2px 6px; border-radius: 3px; color: #6f7580; background: #edf0f3; font-size: 10px; font-style: normal; }.priority.high { color: #9b6500; background: #fff2d4; }.priority.urgent { color: #b51d16; background: #ffe2df; }.chat-actions { display: flex; gap: 7px; }.chat-actions button { padding: 6px 10px; border: 1px solid #d9dde3; border-radius: 4px; color: #606670; background: #fff; font-size: 12px; }.chat-actions button.primary { color: #fff; border-color: #2878e5; background: #2878e5; }.chat-actions button.danger { color: #d8322b; border-color: #f0b7b4; }
.message-list { flex: 1; padding: 18px 22px; overflow: auto; background: #f6f7f9; }.empty { height: 100%; display: grid; place-items: center; color: #a3a8b0; }.message { margin: 12px 0; display: flex; gap: 8px; }.message.mine { justify-content: flex-end; }.message-body { max-width: 72%; display: flex; flex-direction: column; align-items: flex-start; }.message.mine .message-body { align-items: flex-end; }.bubble { max-width: 100%; padding: 10px 12px; border-radius: 4px 12px 12px 12px; background: #fff; box-shadow: 0 1px 2px #0000000d; word-break: break-word; }.message.mine .bubble { color: #fff; background: #4a89f3; border-radius: 12px 4px 12px 12px; }.message.system { justify-content: center; }.message.system .message-body { align-items: center; }.message.system .bubble, .bubble.recalled { color: #8b9098; background: transparent; box-shadow: none; font-size: 12px; }.bubble img { display: block; max-width: 240px; max-height: 280px; border-radius: 5px; }.message-meta-line { margin-top: 3px; display: flex; align-items: center; gap: 7px; color: #adb1b8; font-size: 10px; }.message time { color: #adb1b8; font-size: 10px; }.read-state.read { color: #3c8ee8; }.recall-message { padding: 0; border: 0; color: #8e949d; background: transparent; font-size: 10px; cursor: pointer; }.recall-message:hover { color: #e1251b; }
.composer { border-top: 1px solid #e0e3e7; background: #fff; }.composer-tools button { border: 0; color: #59606c; background: transparent; }.composer textarea { width: 100%; resize: none; border: 0; outline: 0; }
.file-bubble { min-width: 230px; padding: 0; overflow: hidden; }.file-bubble a { padding: 11px; display: flex; align-items: center; gap: 10px; color: #2f3338; text-decoration: none; }.message.mine .file-bubble a { color: #fff; }.file-icon { width: 38px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 5px; color: #fff; background: #5576a8; }.file-info { min-width: 0; display: flex; flex-direction: column; }.file-info strong { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }.file-info small { margin-top: 4px; color: #a4a9b0; font-size: 10px; }.message.mine .file-info small { color: #dbe8ff; }
.composer { position: relative; }.composer-tools button { cursor: pointer; }.composer-tools button:disabled { opacity: .45; cursor: default; }.emoji-panel { position: absolute; left: 10px; width: 286px; padding: 8px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; border: 1px solid #e0e3e7; border-radius: 7px; background: #fff; box-shadow: 0 8px 24px #0002; z-index: 3; }.emoji-panel.hidden { display: none; }.emoji-panel button { height: 30px; padding: 0; border: 0; background: #f7f8fa; font-size: 18px; cursor: pointer; }
.visitor-pane { overflow: auto; }.visitor-card, .assistant-card, .smart-card, .quick-card { padding: 14px 16px; border-bottom: 1px solid #eceef1; }.visitor-card h3, .assistant-card h3, .smart-card h3, .quick-card h3 { margin: 0 0 12px; font-size: 14px; }.smart-card h3 span { color: #9ca1a9; font-size: 10px; font-weight: 400; }.visitor-card dl { margin: 0; display: grid; grid-template-columns: 70px 1fr; row-gap: 10px; font-size: 12px; }.visitor-card dt { color: #9398a0; }.visitor-card dd { margin: 0; overflow-wrap: anywhere; }.assistant-card label { display: block; margin: 10px 0; color: #7d838d; font-size: 12px; }.assistant-card select, .assistant-card textarea { display: block; width: 100%; margin-top: 5px; padding: 7px 8px; border: 1px solid #dfe2e7; border-radius: 4px; background: #fff; outline: 0; }.assistant-card textarea { height: 66px; resize: vertical; }.save-button { width: 100%; height: 32px; border: 0; border-radius: 4px; color: #fff; background: #363c46; }.helper-hint { display: block; min-height: 17px; padding-top: 5px; color: #3d9563; font-size: 11px; }.suggestion-list p { margin: 0; color: #9ca1a9; font-size: 12px; }.suggestion-list button, .quick-card button { width: 100%; padding: 8px; border: 0; border-bottom: 1px solid #eee; color: #616772; text-align: left; background: #fff; font-size: 12px; }.suggestion-list button { margin-bottom: 5px; border: 1px solid #e5e8ed; border-radius: 4px; background: #f8fafc; }.suggestion-list button:hover, .quick-card button:hover { color: #e1251b; border-color: #f2c0bd; }.quick-category { margin: 9px 0 3px; color: #9da2aa; font-size: 10px; }
@media (max-width: 1100px) { .workbench { grid-template-columns: 250px minmax(420px, 1fr); }.visitor-pane { display: none; } }
.modal { position: fixed; inset: 0; display: grid; place-items: center; background: #0007; z-index: 20; }.modal-card { width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 44px); padding: 18px; overflow: auto; border-radius: 8px; background: #fff; box-shadow: 0 20px 60px #0004; }.modal-card > header { display: flex; align-items: flex-start; justify-content: space-between; }.modal-card > header div { display: flex; flex-direction: column; }.modal-card > header span { margin-top: 5px; color: #8c929b; font-size: 12px; }.modal-card > header button { padding: 5px 12px; border: 1px solid #dfe2e7; border-radius: 4px; background: #fff; }.agent-create-form { margin: 18px 0 8px; padding: 12px; display: grid; grid-template-columns: 1fr 1fr 1fr auto; align-items: end; gap: 9px; border-radius: 6px; background: #f5f7fa; }.agent-create-form label { color: #707680; font-size: 11px; }.agent-create-form input { width: 100%; height: 34px; margin-top: 4px; padding: 0 8px; border: 1px solid #d8dce2; border-radius: 4px; }.agent-create-form button { height: 34px; padding: 0 15px; border: 0; border-radius: 4px; color: #fff; background: #e1251b; }.agent-manage-hint { min-height: 22px; color: #26925a; font-size: 12px; }.agent-manage-hint.error { color: #d54040; }.agent-account { padding: 11px 5px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #edf0f3; }.agent-account.disabled { opacity: .55; }.agent-account-info { display: flex; flex-direction: column; gap: 3px; }.agent-account-info span { color: #646a74; font-size: 12px; }.agent-account-info small { color: #9aa0a8; font-size: 10px; }.agent-account-actions { display: flex; gap: 7px; }.agent-account-actions button { padding: 5px 9px; border: 1px solid #d9dde3; border-radius: 4px; background: #fff; }.agent-account-actions button:disabled { opacity: .4; }
@media (max-width: 760px) { .agent-create-form { grid-template-columns: 1fr; }.agent-account { align-items: flex-start; gap: 8px; }.agent-account-actions { flex-direction: column; } }

/* Keep the workbench fixed to the viewport; only its panes may scroll. */
html, body { height: 100%; overflow: hidden; }
body { min-height: 0; }
.workspace { height: 100vh; min-height: 0; overflow: hidden; }
.topbar, .metrics { flex: none; }
.workbench { height: auto; min-height: 0; flex: 1; overflow: hidden; }
.conversation-pane { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.conversation-list { height: auto; min-height: 0; flex: 1; overflow-y: auto; }
.chat-pane { height: 100%; min-height: 0; overflow: hidden; }
.chat-title { flex: none; }
.message-list { min-height: 0; padding-top: 10px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.history-loader { height: 30px; display: grid; place-items: center; color: #a1a6ae; font-size: 11px; }
.visitor-pane { min-height: 0; overflow-y: auto; }
.quick-card h3 { display: flex; align-items: center; justify-content: space-between; }.quick-card .inline-manage { padding: 3px 7px; border: 1px solid #e1e4e8; border-radius: 3px; color: #e1251b; background: #fff; font-size: 10px; font-weight: 400; }
.quick-modal-card { width: min(980px, calc(100vw - 32px)); }.quick-manage-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid #eceef1; }.quick-manage-section h3 { margin: 0 0 10px; font-size: 14px; }.quick-category-create, .quick-category-row { display: grid; grid-template-columns: minmax(180px, 1fr) 110px 100px; gap: 8px; margin-bottom: 8px; }.quick-category-create input, .quick-category-row input, .quick-reply-create input, .quick-reply-create select, .quick-reply-create textarea, .quick-reply-row input, .quick-reply-row select, .quick-reply-row textarea { padding: 7px 8px; border: 1px solid #d9dde3; border-radius: 4px; background: #fff; }.quick-category-create button, .quick-category-row button, .quick-reply-create button, .quick-reply-actions button { border: 0; border-radius: 4px; color: #fff; background: #363c46; }.quick-reply-create { display: grid; grid-template-columns: 130px 160px minmax(260px, 1fr) 90px 100px; gap: 8px; align-items: stretch; }.quick-reply-create textarea { min-height: 64px; resize: vertical; }.quick-reply-row { padding: 10px 0; display: grid; grid-template-columns: 120px 150px minmax(250px, 1fr) 80px 70px 112px; gap: 8px; align-items: center; border-top: 1px solid #edf0f3; }.quick-reply-row textarea { min-height: 58px; resize: vertical; }.quick-enabled { color: #646a74; font-size: 12px; white-space: nowrap; }.quick-enabled input { width: auto; }.quick-reply-actions { display: flex; gap: 5px; }.quick-reply-actions button { min-height: 32px; padding: 0 10px; }.quick-reply-actions button.danger { color: #d8322b; border: 1px solid #efc1be; background: #fff; }
@media (max-width: 900px) { .quick-reply-create, .quick-reply-row { grid-template-columns: 1fr; }.quick-category-create, .quick-category-row { grid-template-columns: 1fr; }.quick-reply-actions button { min-height: 36px; } }
.customers-modal-card { width: min(1420px, 97vw); height: min(850px, 94vh); overflow: hidden; }.customer-browser { min-height: 0; flex: 1; display: grid; grid-template-columns: 300px minmax(420px, 1fr) 320px; }.customer-list-pane,.customer-profile-pane { min-width: 0; padding: 14px; overflow: auto; background: #fafbfc; }.customer-list-pane { border-right: 1px solid #e5e7eb; }.customer-profile-pane { border-left: 1px solid #e5e7eb; }.customer-list-pane form { display: flex; gap: 7px; }.customer-list-pane form input { min-width: 0; flex: 1; }.customer-list { margin-top: 12px; display: grid; gap: 6px; }.customer-list-item { padding: 11px; display: grid; gap: 4px; border: 1px solid #e2e5e9; border-radius: 6px; text-align: left; background: #fff; }.customer-list-item.active { border-color: #e1251b; background: #fff4f3; }.customer-list-item span,.customer-list-item small { color: #747b85; overflow-wrap: anywhere; }.customer-history-pane { min-width: 0; display: flex; flex-direction: column; }.history-filter { padding: 12px; display: flex; gap: 8px; border-bottom: 1px solid #e5e7eb; }.customer-history-title { padding: 11px 16px; font-weight: 700; background: #f7f8fa; }.customer-history { min-height: 0; flex: 1; padding: 18px; overflow-y: auto; background: #f4f6f8; }.history-message { margin: 10px 0; display: grid; justify-items: start; }.history-message.agent { justify-items: end; }.history-message.system { justify-items: center; }.history-message-head { margin-bottom: 4px; color: #9aa0a8; font-size: 12px; }.history-message-bubble { max-width: 72%; padding: 9px 12px; border-radius: 8px; background: #fff; overflow-wrap: anywhere; }.history-message.agent .history-message-bubble { color: #fff; background: #3d8bfd; }.history-message.system .history-message-bubble { color: #737981; background: transparent; }.customer-profile-pane dl { display: grid; grid-template-columns: 76px 1fr; gap: 10px 6px; font-size: 13px; }.customer-profile-pane dt { color: #9298a1; }.customer-profile-pane dd { margin: 0; overflow-wrap: anywhere; }.customer-profile-pane form { margin-top: 18px; display: grid; gap: 10px; }.customer-profile-pane label { display: grid; gap: 5px; }.customer-profile-pane textarea { min-height: 110px; resize: vertical; }
@media (max-width: 1000px) { .customer-browser { grid-template-columns: 250px 1fr; }.customer-profile-pane { grid-column: 1 / -1; max-height: 260px; border-top: 1px solid #e5e7eb; border-left: 0; } }

/* The archive has independent, always-visible scroll areas for the customer
   list and newest-first message history. The modal itself stays fixed. */
.customers-modal-card { display: flex; flex-direction: column; }
.customer-browser { height: 0; overflow: hidden; }
.customer-list-pane { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.customer-list { min-height: 0; flex: 1; overflow-y: scroll; overscroll-behavior: contain; scrollbar-gutter: stable; padding-right: 4px; }
.customer-history-pane { min-height: 0; overflow: hidden; }
.customer-history { overflow-y: scroll; overscroll-behavior: contain; scrollbar-gutter: stable; }
.customer-profile-pane { min-height: 0; overflow-y: scroll; overscroll-behavior: contain; scrollbar-gutter: stable; }
#customer-more, #history-more { flex: none; margin-top: 8px; }
.customer-list, .customer-history, .customer-profile-pane { scrollbar-width: auto; scrollbar-color: #9aa2ad #e8ebef; }
.customer-list::-webkit-scrollbar, .customer-history::-webkit-scrollbar, .customer-profile-pane::-webkit-scrollbar { width: 11px; }
.customer-list::-webkit-scrollbar-track, .customer-history::-webkit-scrollbar-track, .customer-profile-pane::-webkit-scrollbar-track { background: #e8ebef; }
.customer-list::-webkit-scrollbar-thumb, .customer-history::-webkit-scrollbar-thumb, .customer-profile-pane::-webkit-scrollbar-thumb { border: 2px solid #e8ebef; border-radius: 8px; background: #9aa2ad; }

.chat-actions button:disabled { opacity: .55; cursor: default; }
.rating-bubble { min-width: 230px; display: grid; gap: 6px; color: #555d67 !important; text-align: center; background: #fff8e8 !important; border: 1px solid #f2d58e; box-shadow: none; }
.rating-bubble strong { color: #9a6800; }.rating-result-bubble strong { color: #e39a00; letter-spacing: 1px; }
.profile-modal-card, .greeting-modal-card, .rating-settings-modal-card { width: min(560px, calc(100vw - 32px)); }
.profile-editor { margin-top: 22px; display: grid; grid-template-columns: 150px 1fr; gap: 24px; align-items: center; }
.profile-avatar-editor { display: grid; justify-items: center; gap: 10px; }
.profile-avatar-editor img, .profile-avatar-editor > span { width: 92px; height: 92px; display: grid; place-items: center; object-fit: cover; border-radius: 50%; color: #fff; background: #596579; font-size: 34px; }
.profile-avatar-editor button, .profile-editor form button, .greeting-modal-card form button { min-height: 36px; padding: 0 16px; border: 0; border-radius: 4px; color: #fff; background: #363c46; }
.profile-editor form, .greeting-modal-card form { display: grid; gap: 12px; }
.profile-editor label { display: grid; gap: 6px; color: #656b74; font-size: 13px; }
.profile-editor input, .greeting-modal-card textarea { padding: 9px; border: 1px solid #d9dde3; border-radius: 4px; font: inherit; }
#profile-hint, #greeting-hint { min-height: 18px; color: #29975e; font-size: 12px; }
.greeting-modal-card form { margin-top: 20px; }.greeting-enabled { color: #555d67; font-size: 13px; }.greeting-modal-card textarea { min-height: 130px; resize: vertical; }
.rating-settings-modal-card form { margin-top: 20px; display: grid; gap: 12px; }
.rating-settings-modal-card label { display: grid; gap: 6px; color: #656b74; font-size: 13px; }
.rating-settings-modal-card input, .rating-settings-modal-card textarea { padding: 9px; border: 1px solid #d9dde3; border-radius: 4px; font: inherit; }
.rating-settings-modal-card textarea { min-height: 72px; resize: vertical; }
.rating-settings-modal-card form button { min-height: 38px; border: 0; border-radius: 4px; color: #fff; background: #363c46; }
#rating-settings-hint { min-height: 18px; color: #29975e; font-size: 12px; }

/* Delivery polish: readable density, clear ownership and resilient responsive panes. */
body { min-width: 0; color: #252a31; }
button, input, textarea, select { font: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #2878e544; outline-offset: 2px; }
button:disabled { cursor: not-allowed; }
.workspace { height: 100vh; height: 100dvh; }
.topbar { height: auto; min-height: 58px; gap: 16px; padding: 8px 18px; }
.topbar > div:first-child { flex: none; white-space: nowrap; }
.agent-state { min-width: 0; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.agent-state button { margin-left: 2px; padding: 7px 9px; white-space: nowrap; }
.agent-identity { max-width: 180px; overflow: hidden; color: #f4f6f8; text-overflow: ellipsis; white-space: nowrap; }
.metrics { height: 76px; }
.metrics b { font-size: 22px; }.metrics span { font-size: 13px; }
.workbench { grid-template-columns: minmax(260px, 300px) minmax(420px, 1fr) minmax(280px, 300px); }
.conversation { padding: 12px; }.conversation-line strong { font-size: 14px; }.conversation-line time { flex: none; font-size: 11px; }
.conversation-meta { flex-wrap: wrap; font-size: 11px; }.conversation-meta span { line-height: 17px; }.conversation-owner { color: #356da8 !important; background: #eaf3ff !important; }
.app-badge { color: #6d4ea0 !important; background: #f1eafd !important; border-radius: 10px; padding: 1px 7px; font-style: normal; }
.chat-title { min-height: 52px; height: auto; gap: 10px; padding-top: 7px; padding-bottom: 7px; }
.chat-heading { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }.chat-heading strong { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-owner { color: #596273 !important; background: #eef1f5; border-radius: 10px; padding: 2px 7px; }
.chat-actions { flex-wrap: wrap; justify-content: flex-end; }.details-button { display: none; }
.message-list { font-size: 14px; }.bubble { line-height: 1.55; }.message.colleague .bubble { border: 1px solid #dce7f4; background: #f8fbff; }.message-sender { color: #60758f; font-weight: 600; }
.chat-image-link { display: block; }.chat-image-link img { cursor: zoom-in; }
.readonly-banner { flex: none; padding: 8px 14px; color: #805e17; text-align: center; background: #fff8dd; border-top: 1px solid #f0df9a; font-size: 12px; }
.visitor-card dl { font-size: 13px; }.assistant-card label { font-size: 13px; }
.presence-text.online { color: #15965a; font-weight: 600; }.presence-text.offline { color: #8b929b; }
.assignment-summary { margin: 0 0 10px; padding: 9px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-radius: 5px; background: #f3f6fa; font-size: 12px; }.assignment-summary span { color: #7d8590; }.assignment-summary strong { color: #315f92; text-align: right; }
.transfer-controls { margin-bottom: 8px; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 7px; }.transfer-controls label { margin: 0; }.transfer-controls button { height: 33px; padding: 0 10px; border: 0; border-radius: 4px; color: #fff; background: #1f6ac7; }
.release-button { width: 100%; min-height: 34px; margin: 0 0 8px; border: 1px solid #d5a13c; border-radius: 4px; color: #7b5712; background: #fff9e9; }
.panel-state { min-height: 22px; padding: 5px 2px 0; color: #7b828c; font-size: 12px; }.panel-state.error { color: #d54040; }.panel-empty { min-height: 150px; display: grid; place-items: center; color: #969ca5; font-size: 13px; }

.modal-card { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); }
.customers-modal-card { width: min(1420px, calc(100vw - 24px)); height: min(880px, calc(100vh - 24px)); height: min(880px, calc(100dvh - 24px)); padding: 14px; }
.customer-browser { grid-template-columns: 290px minmax(380px, 1fr) 320px; }
.customer-list-pane, .customer-profile-pane { padding: 12px; }.customer-list-pane form input, .history-filter input, .history-filter select, .history-filter button { min-height: 34px; padding: 5px 8px; border: 1px solid #d8dde4; border-radius: 4px; background: #fff; }
.customer-list-item { min-height: 96px; }.customer-list-item strong { font-size: 15px; }.customer-list-item span { font-size: 12px; }.customer-list-item small { font-size: 12px; }.customer-app-id { color: #7054a0 !important; }
.history-filter { flex-wrap: wrap; align-items: center; }.history-state { min-height: 26px; padding: 5px 16px; border-bottom: 1px solid #e8eaee; }
.customer-history-title { font-size: 15px; }
.history-conversation-divider { margin: 10px 0 8px; padding: 7px 10px; color: #536170; text-align: center; background: #e8edf3; border-radius: 4px; font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.history-date-divider { margin: 12px 0 8px; color: #8a929c; text-align: center; font-size: 12px; }
.history-message { margin: 12px 0; }.history-message-head { font-size: 12px; }.history-message-bubble { max-width: min(78%, 620px); font-size: 14px; line-height: 1.55; }
.history-image-bubble { padding: 4px; overflow: hidden; }.history-image-bubble a { display: grid; gap: 4px; color: #64707d; text-align: center; text-decoration: none; font-size: 11px; }.history-image-bubble img { max-width: 260px; max-height: 300px; display: block; border-radius: 6px; object-fit: contain; cursor: zoom-in; }
.history-file-bubble { padding: 0; overflow: hidden; }.history-file-bubble a { min-width: 230px; padding: 10px; display: flex; align-items: center; gap: 9px; color: #2f3741; text-decoration: none; }.history-file-bubble .file-info { flex: 1; }.history-rating-bubble { display: grid; gap: 5px; color: #765817 !important; text-align: center; background: #fff9e9 !important; border: 1px solid #f0d994; }
.customer-profile-pane h3 { margin-top: 0; }.customer-profile-pane form input, .customer-profile-pane form textarea { width: 100%; padding: 8px; border: 1px solid #d8dde4; border-radius: 4px; }.customer-profile-pane form button, #customer-more, #history-more { min-height: 34px; border: 1px solid #d7dce3; border-radius: 4px; background: #fff; }.customer-profile-pane form .profile-refresh { color: #765817; border-color: #e2c36f; background: #fff9e7; }
#customer-profile-hint { min-height: 18px; color: #29975e; font-size: 12px; }

.agent-account { min-height: 76px; }.agent-account-info strong { display: flex; align-items: center; gap: 7px; }.agent-presence { width: 9px; height: 9px; display: inline-block; border-radius: 50%; background: #a6abb2; }.agent-presence.online { background: #22ad68; box-shadow: 0 0 0 3px #22ad6818; }.agent-presence.offline { background: #a6abb2; }
.password-modal-card { width: min(460px, calc(100vw - 32px)); }.password-modal-card form { margin-top: 18px; display: grid; gap: 12px; }.password-modal-card label { display: grid; gap: 6px; color: #656b74; font-size: 13px; }.password-modal-card input { height: 38px; padding: 0 9px; border: 1px solid #d9dde3; border-radius: 4px; }.password-modal-card form button { min-height: 38px; border: 0; border-radius: 4px; color: #fff; background: #363c46; }.password-modal-card #password-hint { min-height: 18px; color: #29975e; font-size: 12px; }

@media (max-width: 1320px) {
  .topbar div:first-child span { display: none; }
  .agent-state { gap: 4px; font-size: 12px; }.agent-state button { padding: 6px 7px; }
  .agent-identity { max-width: 135px; }
}
@media (max-width: 1180px) {
  .workbench { grid-template-columns: 270px minmax(0, 1fr); }
  .visitor-pane { width: min(360px, 94vw); position: fixed; top: 0; right: 0; bottom: 0; display: none; z-index: 45; color: #252a31; background: #fff; box-shadow: -14px 0 38px #0003; }
  .visitor-pane.open { display: block; }
  .details-button { display: inline-block; }
  .customer-browser { grid-template-columns: 260px minmax(0, 1fr); grid-template-rows: minmax(300px, 1fr) minmax(220px, 270px); }
  .customer-profile-pane { grid-column: 1 / -1; max-height: none; border-top: 1px solid #e5e7eb; border-left: 0; }
}
@media (max-width: 900px) {
  .topbar { align-items: flex-start; flex-direction: column; }.agent-state { width: 100%; justify-content: flex-start; }
  .metrics { height: 68px; }.workbench { grid-template-columns: 240px minmax(0, 1fr); }
  .chat-heading strong { max-width: 170px; }
}
@media (max-width: 700px) {
  .metrics { grid-template-columns: repeat(5, minmax(72px, 1fr)); overflow-x: auto; }
  .workbench { grid-template-columns: minmax(190px, 42vw) minmax(320px, 1fr); overflow-x: auto; }
  .customers-modal-card { width: calc(100vw - 10px); height: calc(100dvh - 10px); padding: 10px; }
  .customer-browser { height: auto; display: flex; flex-direction: column; overflow-y: auto; }
  .customer-list-pane { min-height: 210px; max-height: 240px; flex: none; }.customer-history-pane { min-height: 430px; flex: none; }.customer-profile-pane { min-height: 300px; flex: none; }
  .customer-history { min-height: 300px; }.history-filter { padding: 8px; }.history-message-bubble { max-width: 88%; }
  .profile-editor { grid-template-columns: 1fr; }
}

/* Theme switcher and night-mode palette. The customer APP is intentionally
   unaffected: these rules are scoped to the agent workbench bundle. */
body { color: var(--text); background: var(--page-bg); }
input, textarea, select { color: var(--text); background-color: var(--input-bg); }
input::placeholder, textarea::placeholder { color: var(--text-faint); opacity: 1; }
.login-view { min-height: 100%; padding: 20px; overflow-y: auto; scrollbar-gutter: stable; }
.login-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.login-card .login-theme-toggle { width: auto; height: 34px; margin: 0; padding: 0 11px; border: 1px solid #d9dce2; color: #525966; background: #f7f8fa; font-size: 12px; }
.agent-state .theme-toggle { border-color: #ffffff3d; color: #fff; background: #ffffff0d; }
.agent-state .theme-toggle:hover, .agent-state .theme-toggle:focus-visible { background: #ffffff1c; }
.modal { background: var(--backdrop); }
.modal-card { color: var(--text); box-shadow: 0 20px 60px var(--shadow); }
.conversation-list, .message-list, .visitor-pane, .modal-card, .customer-list, .customer-history, .customer-profile-pane,
.agent-account-list, .quick-category-list, .quick-reply-manage-list, .emoji-panel, .sound-menu, .login-view, .customer-browser, .workbench {
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
  scrollbar-width: auto;
}
.conversation-list, .message-list, .visitor-pane, .modal-card:not(.customers-modal-card) { overflow-y: scroll; overscroll-behavior: contain; scrollbar-gutter: stable; }
.customers-modal-card { overflow: hidden; }
.agent-account-list { max-height: min(52vh, 520px); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.quick-category-list { max-height: 240px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.quick-reply-manage-list { max-height: min(44vh, 480px); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.emoji-panel { max-height: 190px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.sound-menu { max-height: min(390px, calc(100vh - 80px)); overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.conversation-list::-webkit-scrollbar, .message-list::-webkit-scrollbar, .visitor-pane::-webkit-scrollbar, .modal-card::-webkit-scrollbar,
.customer-list::-webkit-scrollbar, .customer-history::-webkit-scrollbar, .customer-profile-pane::-webkit-scrollbar, .agent-account-list::-webkit-scrollbar,
.quick-category-list::-webkit-scrollbar, .quick-reply-manage-list::-webkit-scrollbar, .emoji-panel::-webkit-scrollbar, .sound-menu::-webkit-scrollbar, .login-view::-webkit-scrollbar, .customer-browser::-webkit-scrollbar, .workbench::-webkit-scrollbar { width: 11px; height: 11px; }
.conversation-list::-webkit-scrollbar-track, .message-list::-webkit-scrollbar-track, .visitor-pane::-webkit-scrollbar-track, .modal-card::-webkit-scrollbar-track,
.customer-list::-webkit-scrollbar-track, .customer-history::-webkit-scrollbar-track, .customer-profile-pane::-webkit-scrollbar-track, .agent-account-list::-webkit-scrollbar-track,
.quick-category-list::-webkit-scrollbar-track, .quick-reply-manage-list::-webkit-scrollbar-track, .emoji-panel::-webkit-scrollbar-track, .sound-menu::-webkit-scrollbar-track, .login-view::-webkit-scrollbar-track, .customer-browser::-webkit-scrollbar-track, .workbench::-webkit-scrollbar-track { background: var(--scroll-track); }
.conversation-list::-webkit-scrollbar-thumb, .message-list::-webkit-scrollbar-thumb, .visitor-pane::-webkit-scrollbar-thumb, .modal-card::-webkit-scrollbar-thumb,
.customer-list::-webkit-scrollbar-thumb, .customer-history::-webkit-scrollbar-thumb, .customer-profile-pane::-webkit-scrollbar-thumb, .agent-account-list::-webkit-scrollbar-thumb,
.quick-category-list::-webkit-scrollbar-thumb, .quick-reply-manage-list::-webkit-scrollbar-thumb, .emoji-panel::-webkit-scrollbar-thumb, .sound-menu::-webkit-scrollbar-thumb, .login-view::-webkit-scrollbar-thumb, .customer-browser::-webkit-scrollbar-thumb, .workbench::-webkit-scrollbar-thumb { border: 2px solid var(--scroll-track); border-radius: 8px; background: var(--scroll-thumb); }

@media (max-width: 1024px) {
  .topbar { align-items: flex-start; }
  .agent-state { min-width: 0; flex: 1; flex-wrap: wrap; overflow: visible; }
  .workbench { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-gutter: stable; }
  .conversation-pane { min-width: 230px; }
  .chat-pane { min-width: 420px; }
}

@media (max-width: 700px) {
  .customer-browser { overflow-y: scroll; overscroll-behavior: contain; scrollbar-gutter: stable; }
  .customer-list, .customer-history, .customer-profile-pane { overscroll-behavior-y: auto; }
}

/* The composer uses the entire area below its compact action bar. Keep file
   actions on the left and the primary send action fixed to the top-right. */
.composer { height: 160px; flex: 0 0 160px; display: flex; flex-direction: column; position: relative; }
.composer-tools { height: 42px; min-height: 42px; padding: 5px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid #edf0f3; }
.composer-tool-actions { min-width: 0; display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.composer-tool-actions::-webkit-scrollbar { display: none; }
.composer-tool-actions button { min-height: 32px; padding: 0 7px; white-space: nowrap; }
.composer-tools .composer-send-button { width: 86px; min-width: 72px; height: 32px; flex: none; border: 0; border-radius: 4px; color: #fff; background: #d92720; font-weight: 600; }
.composer-tools .composer-send-button:hover:not(:disabled) { background: #b91f19; }
.composer-input-area { min-height: 0; flex: 1; position: relative; }
.composer .composer-input-area textarea { width: 100%; height: 100%; min-height: 0; padding: 10px 14px 30px; display: block; resize: none; border: 0; outline: 0; font-size: 14px; line-height: 1.55; }
.composer-input-meta { position: absolute; right: 14px; bottom: 5px; left: 14px; min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; pointer-events: none; font-size: 11px; line-height: 18px; }
#send-hint { min-width: 0; flex: 1; overflow: hidden; color: #3d9563; text-overflow: ellipsis; white-space: nowrap; }
#send-hint:not(:empty) + .composer-shortcuts { display: none; }
.composer-shortcuts { flex: none; color: #8b929c; white-space: nowrap; }
.composer-shortcuts kbd { padding: 1px 4px; border: 1px solid #d5dae1; border-bottom-width: 2px; border-radius: 3px; color: #68717e; background: #f7f8fa; font-family: inherit; font-size: 10px; }
.emoji-panel { bottom: calc(100% - 42px); width: min(286px, calc(100% - 20px)); }

@media (max-width: 700px) {
  .composer-tools { gap: 5px; padding-right: 7px; padding-left: 7px; }
  .composer-tool-actions button { padding-right: 5px; padding-left: 5px; font-size: 12px; }
  .composer-tools .composer-send-button { width: 72px; }
  .composer-input-meta { right: 10px; left: 10px; gap: 6px; }
  .composer-shortcuts { font-size: 10px; }
  .composer-shortcuts kbd { padding-right: 2px; padding-left: 2px; font-size: 9px; }
}

:root[data-theme="dark"] .login-view { background: radial-gradient(circle at 20% 10%, #293343, #10151d 52%, #090c11); }
:root[data-theme="dark"] .login-card { color: var(--text); background: var(--surface); box-shadow: 0 24px 70px #000a; }
:root[data-theme="dark"] .login-card p, :root[data-theme="dark"] .login-card label { color: var(--text-muted); }
:root[data-theme="dark"] .login-card input { color: var(--text); border-color: var(--border-strong); background: var(--input-bg); }
:root[data-theme="dark"] .login-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px #e1251b38; }
:root[data-theme="dark"] .login-card > button[type="submit"] { color: #fff; background: #c82b25; }
:root[data-theme="dark"] .login-card .login-theme-toggle { color: var(--text); border-color: var(--border-strong); background: var(--surface-muted); }

:root[data-theme="dark"] .topbar { color: var(--text); background: #11161e; border-bottom: 1px solid var(--border); }
:root[data-theme="dark"] .topbar div:first-child span { color: var(--text-muted); }
:root[data-theme="dark"] .agent-state button { color: #e2e8f0; border-color: #566171; }
:root[data-theme="dark"] .agent-state .theme-toggle { color: #fff4c7; border-color: #796d47; background: #332f21; }
:root[data-theme="dark"] .sound-menu { color: var(--text); border-color: var(--border); background: var(--surface); box-shadow: 0 10px 28px #0009; }
:root[data-theme="dark"] .agent-state .sound-menu button { color: var(--text-muted); }
:root[data-theme="dark"] .agent-state .sound-menu button:hover, :root[data-theme="dark"] .agent-state .sound-menu button.active { color: #ff8580; background: var(--brand-soft); }
:root[data-theme="dark"] .agent-state .sound-menu .unread-voice-preview { color: #ff7973; border-top-color: var(--border); }

:root[data-theme="dark"] .metrics { background: var(--border); border-bottom-color: var(--border); }
:root[data-theme="dark"] .metrics div, :root[data-theme="dark"] .workbench { background: var(--surface); }
:root[data-theme="dark"] .metrics b { color: #ff6d67; }
:root[data-theme="dark"] .metrics span { color: var(--text-muted); }
:root[data-theme="dark"] .conversation-pane, :root[data-theme="dark"] .visitor-pane { color: var(--text); border-color: var(--border); background: var(--surface); }
:root[data-theme="dark"] .pane-tabs, :root[data-theme="dark"] .search, :root[data-theme="dark"] .chat-title { border-color: var(--border); }
:root[data-theme="dark"] .pane-tabs button { color: var(--text-muted); background: var(--surface); }
:root[data-theme="dark"] .pane-tabs button.active { color: #ff716b; border-bottom-color: var(--brand); }
:root[data-theme="dark"] .queue-tabs span, :root[data-theme="dark"] .conversation-meta span { color: var(--text-muted); background: var(--surface-muted); }
:root[data-theme="dark"] .queue-tabs button.active span { color: #fff; background: #cf332c; }
:root[data-theme="dark"] .search input { color: var(--text); border-color: var(--border-strong); background: var(--input-bg); }
:root[data-theme="dark"] .conversation { color: var(--text); border-bottom-color: var(--border); background: var(--surface); }
:root[data-theme="dark"] .conversation:hover, :root[data-theme="dark"] .conversation.active { background: var(--surface-muted); }
:root[data-theme="dark"] .conversation-line time, :root[data-theme="dark"] .preview, :root[data-theme="dark"] .conversation-meta { color: var(--text-faint); }
:root[data-theme="dark"] .avatar { color: #fff; background: #4b5d75; }
:root[data-theme="dark"] .conversation-owner { color: #8ec3ff !important; background: #17304d !important; }
:root[data-theme="dark"] .app-badge, :root[data-theme="dark"] .customer-app-id { color: #d3b4ff !important; background: #302342 !important; }

:root[data-theme="dark"] .chat-pane { color: var(--text); background: var(--surface); }
:root[data-theme="dark"] .chat-title span { color: var(--success); }
:root[data-theme="dark"] .chat-owner { color: #c4ccd7 !important; background: var(--surface-muted); }
:root[data-theme="dark"] .priority { color: var(--text-muted); background: var(--surface-muted); }
:root[data-theme="dark"] .priority.high { color: #f1c66e; background: #392e17; }
:root[data-theme="dark"] .priority.urgent { color: #ff817b; background: #3b2021; }
:root[data-theme="dark"] .chat-actions button { color: var(--text-muted); border-color: var(--border-strong); background: var(--surface); }
:root[data-theme="dark"] .chat-actions button.primary { color: #fff; border-color: #3e86e8; background: #2766b8; }
:root[data-theme="dark"] .chat-actions button.danger { color: #ff827c; border-color: #714040; }
:root[data-theme="dark"] .message-list { color: var(--text); background: var(--chat-bg); }
:root[data-theme="dark"] .bubble { color: var(--text); background: #202833; box-shadow: 0 1px 2px #0008; }
:root[data-theme="dark"] .message.mine .bubble { color: #fff; background: var(--agent-bubble); }
:root[data-theme="dark"] .message.colleague .bubble { color: var(--text); border-color: #344b63; background: #172536; }
:root[data-theme="dark"] .message.system .bubble, :root[data-theme="dark"] .bubble.recalled { color: var(--text-faint); background: transparent; }
:root[data-theme="dark"] .message-meta-line, :root[data-theme="dark"] .message time { color: var(--text-faint); }
:root[data-theme="dark"] .read-state.read { color: #75b4ff; }
:root[data-theme="dark"] .recall-message { color: var(--text-faint); }
:root[data-theme="dark"] .file-bubble a, :root[data-theme="dark"] .history-file-bubble a { color: var(--text); }
:root[data-theme="dark"] .file-info small { color: var(--text-faint); }
:root[data-theme="dark"] .empty, :root[data-theme="dark"] .history-loader, :root[data-theme="dark"] .panel-empty { color: var(--text-faint); }

:root[data-theme="dark"] .composer { border-color: var(--border); background: var(--surface); }
:root[data-theme="dark"] .composer-tools { border-bottom-color: var(--border); }
:root[data-theme="dark"] .composer-tools button { color: var(--text-muted); }
:root[data-theme="dark"] .composer-tools .composer-send-button { color: #fff; background: #c82b25; }
:root[data-theme="dark"] .composer-tools .composer-send-button:hover:not(:disabled) { background: #e03b34; }
:root[data-theme="dark"] .composer textarea { color: var(--text); background: var(--surface); }
:root[data-theme="dark"] #send-hint { color: #6bd39b; }
:root[data-theme="dark"] .composer-shortcuts { color: var(--text-faint); }
:root[data-theme="dark"] .composer-shortcuts kbd { color: var(--text-muted); border-color: var(--border-strong); background: var(--surface-muted); }
:root[data-theme="dark"] .emoji-panel { border-color: var(--border); background: var(--surface); box-shadow: 0 8px 24px #0009; }
:root[data-theme="dark"] .emoji-panel button { background: var(--surface-muted); }
:root[data-theme="dark"] .readonly-banner { color: #f0ce7c; border-top-color: #66572d; background: #302917; }

:root[data-theme="dark"] .visitor-card, :root[data-theme="dark"] .assistant-card, :root[data-theme="dark"] .smart-card, :root[data-theme="dark"] .quick-card { border-bottom-color: var(--border); }
:root[data-theme="dark"] .visitor-card dt, :root[data-theme="dark"] .assistant-card label, :root[data-theme="dark"] .smart-card h3 span, :root[data-theme="dark"] .quick-category { color: var(--text-faint); }
:root[data-theme="dark"] .assistant-card select, :root[data-theme="dark"] .assistant-card textarea { color: var(--text); border-color: var(--border-strong); background: var(--input-bg); }
:root[data-theme="dark"] .assignment-summary { background: var(--surface-muted); }
:root[data-theme="dark"] .assignment-summary span { color: var(--text-muted); }
:root[data-theme="dark"] .assignment-summary strong { color: #86baf2; }
:root[data-theme="dark"] .release-button { color: #f1c86d; border-color: #80672f; background: #302917; }
:root[data-theme="dark"] .suggestion-list button, :root[data-theme="dark"] .quick-card button { color: var(--text-muted); border-color: var(--border); background: var(--surface); }
:root[data-theme="dark"] .suggestion-list button { background: var(--surface-soft); }
:root[data-theme="dark"] .suggestion-list button:hover, :root[data-theme="dark"] .quick-card button:hover { color: #ff7973; border-color: #74413f; }

:root[data-theme="dark"] .modal-card { color: var(--text); background: var(--surface); }
:root[data-theme="dark"] .modal-card > header span, :root[data-theme="dark"] .agent-create-form label, :root[data-theme="dark"] .profile-editor label,
:root[data-theme="dark"] .rating-settings-modal-card label, :root[data-theme="dark"] .password-modal-card label { color: var(--text-muted); }
:root[data-theme="dark"] .greeting-enabled { color: var(--text-muted); }
:root[data-theme="dark"] .modal-card > header button, :root[data-theme="dark"] .agent-account-actions button { color: var(--text); border-color: var(--border-strong); background: var(--surface-muted); }
:root[data-theme="dark"] .agent-create-form { background: var(--surface-soft); }
:root[data-theme="dark"] .agent-create-form input, :root[data-theme="dark"] .profile-editor input, :root[data-theme="dark"] .greeting-modal-card textarea,
:root[data-theme="dark"] .rating-settings-modal-card input, :root[data-theme="dark"] .rating-settings-modal-card textarea, :root[data-theme="dark"] .password-modal-card input { color: var(--text); border-color: var(--border-strong); background: var(--input-bg); }
:root[data-theme="dark"] .agent-account, :root[data-theme="dark"] .quick-manage-section, :root[data-theme="dark"] .quick-reply-row { border-color: var(--border); }
:root[data-theme="dark"] .agent-account-info span, :root[data-theme="dark"] .quick-enabled { color: var(--text-muted); }
:root[data-theme="dark"] .agent-account-info small { color: var(--text-faint); }
:root[data-theme="dark"] .quick-category-create input, :root[data-theme="dark"] .quick-category-row input,
:root[data-theme="dark"] .quick-reply-create input, :root[data-theme="dark"] .quick-reply-create select, :root[data-theme="dark"] .quick-reply-create textarea,
:root[data-theme="dark"] .quick-reply-row input, :root[data-theme="dark"] .quick-reply-row select, :root[data-theme="dark"] .quick-reply-row textarea { color: var(--text); border-color: var(--border-strong); background: var(--input-bg); }
:root[data-theme="dark"] .quick-reply-actions button.danger { color: #ff817b; border-color: #714040; background: var(--surface); }

:root[data-theme="dark"] .customer-list-pane, :root[data-theme="dark"] .customer-profile-pane { color: var(--text); background: var(--surface-soft); }
:root[data-theme="dark"] .customer-list-pane, :root[data-theme="dark"] .customer-profile-pane, :root[data-theme="dark"] .history-filter, :root[data-theme="dark"] .history-state { border-color: var(--border); }
:root[data-theme="dark"] .customer-list-pane form input, :root[data-theme="dark"] .history-filter input, :root[data-theme="dark"] .history-filter select,
:root[data-theme="dark"] .history-filter button, :root[data-theme="dark"] .customer-profile-pane form input, :root[data-theme="dark"] .customer-profile-pane form textarea { color: var(--text); border-color: var(--border-strong); background: var(--input-bg); }
:root[data-theme="dark"] .customer-list-item { color: var(--text); border-color: var(--border); background: var(--surface); }
:root[data-theme="dark"] .customer-list-item.active { border-color: #ff6760; background: #352020; }
:root[data-theme="dark"] .customer-list-item span, :root[data-theme="dark"] .customer-list-item small, :root[data-theme="dark"] .panel-state { color: var(--text-muted); }
:root[data-theme="dark"] .customer-history-title { background: var(--surface-muted); }
:root[data-theme="dark"] .customer-history { background: var(--chat-bg); }
:root[data-theme="dark"] .history-conversation-divider { color: #c9d2dd; background: #293442; }
:root[data-theme="dark"] .history-date-divider, :root[data-theme="dark"] .history-message-head { color: var(--text-faint); }
:root[data-theme="dark"] .history-message-bubble { color: var(--text); background: #202833; }
:root[data-theme="dark"] .history-message.agent .history-message-bubble { color: #fff; background: #2869bd; }
:root[data-theme="dark"] .history-message.system .history-message-bubble { color: var(--text-muted); background: transparent; }
:root[data-theme="dark"] .customer-profile-pane dt { color: var(--text-faint); }
:root[data-theme="dark"] .customer-profile-pane form button, :root[data-theme="dark"] #customer-more, :root[data-theme="dark"] #history-more { color: var(--text); border-color: var(--border-strong); background: var(--surface-muted); }
:root[data-theme="dark"] .customer-profile-pane form .profile-refresh { color: #efca78; border-color: #745f2f; background: #302917; }

:root[data-theme="dark"] .rating-bubble, :root[data-theme="dark"] .history-rating-bubble { color: #f0d589 !important; border-color: #75622c; background: #312a18 !important; }
:root[data-theme="dark"] .rating-bubble strong { color: #ffd26e; }
:root[data-theme="dark"] table { color: var(--text); border-color: var(--border); background: var(--surface); }
:root[data-theme="dark"] th { color: var(--text-muted); background: var(--surface-muted); }
:root[data-theme="dark"] td, :root[data-theme="dark"] th { border-color: var(--border); }
:root[data-theme="dark"] option { color: var(--text); background: var(--input-bg); }


.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 15, 20, .9);
}
.image-preview-modal.hidden { display: none; }
.image-preview-modal img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 20px 80px rgba(0, 0, 0, .42);
}
.image-preview-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 50%;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}
.chat-image-link { cursor: zoom-in; }
