/* Rompoda Chat appearance system
   The light interface remains the product default. Dark mode only overrides
   semantic surfaces, hierarchy and interaction states; business colours keep
   their meaning in both themes. */

:root {
    --cw-focus-ring: rgba(25, 149, 254, .28);
    --cw-overlay: rgba(15, 18, 24, .7);
}

[data-theme="dark"] {
    --cw-canvas-top: #17191e;
    --cw-canvas-bottom: #111318;
    --cw-shell: #17191e;
    --cw-surface: #20232a;
    --cw-surface-soft: #252830;
    --cw-surface-blue: #202b39;
    --cw-line: #343740;
    --cw-line-strong: #454954;
    --cw-ink: #f0f1f3;
    --cw-muted: #c3c6cd;
    --cw-faint: #979ca7;
    --cw-blue: #78b7ff;
    --cw-blue-bright: #4da7ff;
    --cw-note-surface: #182c22;
    --cw-note-surface-strong: #1d3829;
    --cw-note-border: #347d50;
    --cw-note-ink: #91e2a6;
    --cw-green: #38d98a;
    --cw-online: #46dc62;
    --cw-away: #ffad33;
    --cw-red: #ff666b;
    --cw-yellow: #ffad33;
    --cw-violet: #a78bfa;
    --cw-chip-blue-bg: #223954;
    --cw-chip-blue-fg: #a8d2ff;
    --cw-chip-green-bg: #1c4132;
    --cw-chip-green-fg: #91e0bd;
    --cw-chip-red-bg: #4b292d;
    --cw-chip-red-fg: #ffadb3;
    --cw-chip-orange-bg: #4a3821;
    --cw-chip-orange-fg: #ffd18b;
    --cw-chip-neutral-bg: #30343c;
    --cw-chip-neutral-fg: #d9dbe0;
    --cw-chip-violet-bg: #372f50;
    --cw-chip-violet-fg: #cbbcff;
    --cw-focus-ring: rgba(77, 167, 255, .34);
    --cw-overlay: rgba(5, 7, 11, .78);
    color-scheme: dark;
}

[data-theme="dark"] body,
[data-theme="dark"] .cw-stage,
[data-theme="dark"] .chat-workspace {
    color: var(--cw-ink);
    background: var(--cw-shell);
}

[data-theme="dark"] button:focus-visible,
[data-theme="dark"] a:focus-visible {
    box-shadow: 0 0 0 3px var(--cw-focus-ring);
}

/* App chrome and navigation */
[data-theme="dark"] .cw-topbar,
[data-theme="dark"] .cw-primary-sidebar,
[data-theme="dark"] .cw-ticket-column,
[data-theme="dark"] .cw-conversation-column,
[data-theme="dark"] .cw-details-column,
[data-theme="dark"] .cw-page-column,
[data-theme="dark"] .cw-wide-ticket-filters {
    background: var(--cw-shell);
}

[data-theme="dark"] .cw-collapse-glyph,
[data-theme="dark"] .cw-global-search,
[data-theme="dark"] .cw-square-button,
[data-theme="dark"] .cw-sidebar-panel-toggle,
[data-theme="dark"] .cw-secondary-button,
[data-theme="dark"] .cw-filter-toggle,
[data-theme="dark"] .cw-wide-filter-chip,
[data-theme="dark"] .cw-date-pill,
[data-theme="dark"] .cw-page-button,
[data-theme="dark"] .cw-icon-button {
    border-color: var(--cw-line);
    color: var(--cw-muted);
    background: var(--cw-surface);
}

[data-theme="dark"] .cw-global-search:focus-within,
[data-theme="dark"] .cw-square-button:hover,
[data-theme="dark"] .cw-sidebar-panel-toggle:hover,
[data-theme="dark"] .cw-secondary-button:hover,
[data-theme="dark"] .cw-filter-toggle:hover,
[data-theme="dark"] .cw-filter-toggle.is-active,
[data-theme="dark"] .cw-page-button:hover,
[data-theme="dark"] .cw-icon-button:hover {
    border-color: #526274;
    color: #e5edf8;
    background: #2a3039;
}

[data-theme="dark"] .cw-global-search input,
[data-theme="dark"] .cw-list-search input,
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    color: var(--cw-ink);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: #858b96; }
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--cw-ink);
    box-shadow: 0 0 0 1000px #252830 inset;
    caret-color: var(--cw-ink);
}

[data-theme="dark"] .cw-global-search kbd,
[data-theme="dark"] .cw-search-panel kbd {
    border-color: #434751;
    color: #b8bcc4;
    background: linear-gradient(#2c2f37, #252830);
}

[data-theme="dark"] .cw-main-nav-item,
[data-theme="dark"] .cw-filter-row,
[data-theme="dark"] .cw-team-row { color: #c9ccd2; }

[data-theme="dark"] .cw-main-nav-item:hover,
[data-theme="dark"] .cw-filter-row:hover,
[data-theme="dark"] .cw-team-row:hover { background: #252830; }

[data-theme="dark"] .cw-main-nav-item.is-active,
[data-theme="dark"] .cw-filter-row.is-active,
[data-theme="dark"] .cw-team-row.is-active {
    border-color: #40516a;
    color: #f5f7fa;
    background: #263142;
}

[data-theme="dark"] .cw-main-nav-item em { color: #c5c9cf; background: #30343c; }
[data-theme="dark"] .cw-main-nav-item em.is-red { color: #fff; background: #e84b52; }
[data-theme="dark"] .cw-account-card { border-color: var(--cw-line); background: #1c1f25; }
[data-theme="dark"] .cw-account-card > #cw-account-more:hover,
[data-theme="dark"] .cw-account-card > #cw-account-more[aria-expanded="true"] { color: var(--cw-ink); background: #2b2e37; }
[data-theme="dark"] .cw-account-popover > button { color: #d8dbe1; }
[data-theme="dark"] .cw-account-popover > button .cw-icon { color: #aeb4bf; }
[data-theme="dark"] .cw-workspace-grid,
[data-theme="dark"] .cw-page-scroll,
[data-theme="dark"] .cw-message-timeline,
[data-theme="dark"] .cw-details-scroll { background: var(--cw-shell); }
[data-theme="dark"] .cw-page-header {
    border-color: var(--cw-line);
    background: rgba(23, 25, 30, .94);
}
[data-theme="dark"] .cw-main-nav-section h2,
[data-theme="dark"] .cw-sidebar-heading-row h2,
[data-theme="dark"] .cw-ticket-list-title p,
[data-theme="dark"] .cw-page-header > div > span,
[data-theme="dark"] .cw-breadcrumbs { color: var(--cw-faint); }
[data-theme="dark"] .cw-list-search,
[data-theme="dark"] .cw-read-filter button,
[data-theme="dark"] .cw-filter-options button,
[data-theme="dark"] .cw-filter-sort,
[data-theme="dark"] .cw-filter-sort button {
    border-color: var(--cw-line);
    color: var(--cw-muted);
    background: var(--cw-surface);
}
[data-theme="dark"] .cw-read-filter button.is-active,
[data-theme="dark"] .cw-filter-options button.is-active,
[data-theme="dark"] .cw-filter-sort button.is-active {
    border-color: #486789;
    color: #b8daff;
    background: #263b55;
    box-shadow: none;
}

/* Floating panels, menus and notifications */
[data-theme="dark"] .cw-search-panel,
[data-theme="dark"] .cw-notification-panel,
[data-theme="dark"] .cw-account-popover,
[data-theme="dark"] .cw-filter-panel,
[data-theme="dark"] .cw-customer-preview,
[data-theme="dark"] .cw-assignee-menu,
[data-theme="dark"] .cw-overflow-menu,
[data-theme="dark"] .cw-quick-menu,
[data-theme="dark"] .cw-suggestion-menu,
[data-theme="dark"] .cw-notification-actions-menu,
[data-theme="dark"] .cw-select-dialog {
    border-color: var(--cw-line-strong);
    color: var(--cw-ink);
    background: var(--cw-surface);
    box-shadow: 0 20px 52px rgba(0, 0, 0, .38), 0 3px 12px rgba(0, 0, 0, .25);
}

[data-theme="dark"] .cw-search-panel > header,
[data-theme="dark"] .cw-search-panel > footer,
[data-theme="dark"] .cw-notification-panel > header,
[data-theme="dark"] .cw-notification-panel > footer,
[data-theme="dark"] .cw-filter-panel > header,
[data-theme="dark"] .cw-account-popover > header,
[data-theme="dark"] .cw-account-popover > footer,
[data-theme="dark"] .cw-notification-toolbar {
    border-color: var(--cw-line);
    background: #1c1f25;
}

[data-theme="dark"] .cw-search-result:hover,
[data-theme="dark"] .cw-search-result.is-keyboard-active,
[data-theme="dark"] .cw-notification-item:hover > button:first-child,
[data-theme="dark"] .cw-assignee-menu > button:hover,
[data-theme="dark"] .cw-overflow-menu button:hover,
[data-theme="dark"] .cw-quick-menu button:hover,
[data-theme="dark"] .cw-account-popover > button:hover,
[data-theme="dark"] .cw-account-popover > button:focus-visible,
[data-theme="dark"] .cw-notification-actions-menu button:hover,
[data-theme="dark"] .cw-select-option:hover,
[data-theme="dark"] .cw-mention-results button:hover {
    color: var(--cw-ink);
    background: #2a2e36;
}

[data-theme="dark"] .cw-notification-tabs { background: #2b2e35; }
[data-theme="dark"] .cw-notification-tabs button { color: #aeb2ba; }
[data-theme="dark"] .cw-notification-tabs button.is-active { color: #f1f2f4; background: #3a3e47; box-shadow: none; }
[data-theme="dark"] .cw-notification-item.is-unread > button:first-child { background: #202f43; }
[data-theme="dark"] .cw-notification-item.is-unread:hover > button:first-child { background: #263852; }
[data-theme="dark"] .cw-notification-item-icon,
[data-theme="dark"] .cw-notification-heading-icon { color: #8bc4ff !important; background: #243c58 !important; }
[data-theme="dark"] .cw-notification-date-separator::after { background: var(--cw-line); }
[data-theme="dark"] .cw-notification-empty-icon { border-color: #3c4655; color: #90bff0; background: #253347; }
[data-theme="dark"] .cw-notification-empty {
    border-color: #343e4d;
    color: var(--cw-muted);
    background: #1c222d;
}
[data-theme="dark"] .cw-notification-empty-copy strong { color: #f0f2f5; }
[data-theme="dark"] .cw-notification-empty-copy > span { color: #aeb4bf; }
[data-theme="dark"] .cw-notification-actions-toggle {
    border-color: #3d5f81 !important;
    color: #9dceff !important;
    background: #263b55 !important;
}
[data-theme="dark"] .cw-notification-actions-toggle:hover,
[data-theme="dark"] .cw-notification-actions-toggle[aria-expanded="true"] {
    border-color: #5c93c8 !important;
    color: #fff !important;
    background: #315274 !important;
}
[data-theme="dark"] .cw-notification-scrim,
[data-theme="dark"] .cw-drawer-scrim,
[data-theme="dark"] .cw-modal-backdrop { background: rgba(5, 7, 11, .7); }
[data-theme="dark"] .cw-notification-item,
[data-theme="dark"] .cw-notification-archive { color: var(--cw-muted); }
[data-theme="dark"] .cw-notification-archive:hover { color: #a8d2ff; background: #30343c; box-shadow: none; }
[data-theme="dark"] .cw-notification-copy strong { color: var(--cw-ink); }
[data-theme="dark"] .cw-notification-copy small,
[data-theme="dark"] .cw-notification-item time,
[data-theme="dark"] .cw-notification-date-separator { color: var(--cw-faint); }
[data-theme="dark"] .cw-search-empty,
[data-theme="dark"] .cw-notification-empty { color: var(--cw-muted); }

/* Ticket lists and wide table */
[data-theme="dark"] .cw-ticket-card:hover { background: #252830; }
[data-theme="dark"] .cw-ticket-card.is-active { border-color: #40516a; background: #263142; }
[data-theme="dark"] .cw-ticket-group-title em,
[data-theme="dark"] .cw-ticket-channel-badge { color: #d4d7dc; background: #30343c; }
[data-theme="dark"] .cw-wide-filter-chip em { color: #bdc1c8; background: #30343c; }
[data-theme="dark"] .cw-wide-filter-chip.is-active {
    border-color: #4da7ff;
    color: #f7fbff;
    background: linear-gradient(180deg, #286ea9, #225a8a);
    box-shadow: 0 0 0 1px rgba(77, 167, 255, .16), 0 8px 22px rgba(8, 89, 156, .24);
}
[data-theme="dark"] .cw-wide-filter-chip.is-active i { background: #dff1ff; box-shadow: 0 0 0 3px rgba(223, 241, 255, .1); }
[data-theme="dark"] .cw-wide-filter-chip.is-active em { color: #d9edff; background: rgba(8, 32, 55, .46); }
[data-theme="dark"] .cw-wide-ticket-table { border-color: var(--cw-line); background: var(--cw-surface); }
[data-theme="dark"] .cw-wide-ticket-head {
    border-color: #454954;
    color: #aeb3bc;
    background: #292c33;
    box-shadow: inset 0 1px 0 #454954, inset 1px 0 0 #454954, inset -1px 0 0 #454954, 0 1px 0 #454954;
}
[data-theme="dark"] .cw-wide-ticket-row { border-color: #343840; color: #e3e5e8; background: #20232a; }
[data-theme="dark"] .cw-wide-ticket-row:nth-child(odd) { background: #1e2127; }
[data-theme="dark"] .cw-wide-ticket-row:hover { background: #263448; box-shadow: inset 3px 0 #4da7ff; }
[data-theme="dark"] .cw-wide-ticket-row.is-selected { background: color-mix(in srgb, var(--cw-green) 15%, #20232a); }
[data-theme="dark"] .cw-wide-ticket-row.is-selected:hover { background: color-mix(in srgb, var(--cw-green) 21%, #20232a); }
[data-theme="dark"] .cw-wide-reference strong { color: #c9e1ff; }
[data-theme="dark"] .cw-wide-ticket-row small { color: #999fa9; }
[data-theme="dark"] .cw-sort-header:not(.is-active) .cw-icon { color: transparent; }
[data-theme="dark"] .cw-sort-header.is-active,
[data-theme="dark"] .cw-sort-header.is-active .cw-icon { color: #78b7ff; }
[data-theme="dark"] .cw-wide-foundation {
    color: color-mix(in srgb, var(--foundation-color, #8b95a3) 56%, #fff);
    background: color-mix(in srgb, var(--foundation-color, #64748b) 25%, #20232a);
}
[data-theme="dark"] .cw-bulk-bar { border-color: #433b64; color: #d3c8ff; background: #27233b; }
[data-theme="dark"] .cw-bulk-bar button,
[data-theme="dark"] .cw-saved-views button,
[data-theme="dark"] .cw-saved-view { border-color: #4c4567; color: #e0d9ff; background: #333047; }
[data-theme="dark"] .cw-channel-badge { color: #a8d2ff; background: #253b55; }
[data-theme="dark"] .cw-channel-badge.is-whatsapp { color: #91e0bd; background: #1c4132; }
[data-theme="dark"] .cw-ticket-viewers > span { border-color: var(--cw-surface); }
[data-theme="dark"] .cw-ticket-viewers > small,
[data-theme="dark"] .cw-ticket-snoozed { color: #b9bdc5; }

/* Conversation, composer and details */
[data-theme="dark"] .cw-ticket-list-header,
[data-theme="dark"] .cw-conversation-header,
[data-theme="dark"] .cw-details-header {
    border-color: var(--cw-line);
    background: #1c1f25;
}
[data-theme="dark"] .cw-message-bubble { border-color: #3d4149; color: #eceef1; background: #272a31; }
[data-theme="dark"] .cw-message-group.is-agent .cw-message-bubble { color: #fff; background: linear-gradient(180deg, #238eea, #1477cf); }
[data-theme="dark"] .cw-message-group.is-agent .cw-rich-text a { color: #fff; text-decoration-color: rgba(255, 255, 255, .78); }
[data-theme="dark"] .cw-message-group.is-agent .cw-message-meta { color: #aeb8c7; }
[data-theme="dark"] .cw-message-group.is-bot .cw-message-bubble { border-color: #88572b; color: #ffd09e; background: linear-gradient(145deg, #4b3221, #3d291c); }
[data-theme="dark"] .cw-message-meta,
[data-theme="dark"] .cw-message-system,
[data-theme="dark"] .cw-message-system time { color: #969ba4; }
[data-theme="dark"] .cw-message-system { background: #22252b; }
[data-theme="dark"] .cw-rich-text code { background: rgba(255, 255, 255, .09); }
[data-theme="dark"] .cw-composer { border-color: #424650; background: #20232a; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
[data-theme="dark"] .cw-composer:focus-within { border-color: #59718f; box-shadow: 0 0 0 3px rgba(77, 167, 255, .1); }
[data-theme="dark"] .cw-compose-tabs { border-color: var(--cw-line); }
[data-theme="dark"] .cw-compose-tabs button.is-active { color: #a8d2ff; background: #263b55; }
[data-theme="dark"] .cw-composer-tools > button,
[data-theme="dark"] .cw-composer-tools .cw-quick-wrap > button,
[data-theme="dark"] .cw-composer-tools .cw-suggestion-wrap > button { border-color: #3e424a; color: #c7cad0; background: #292c33; }
[data-theme="dark"] .cw-composer-tools button:hover { color: #fff; border-color: #566274; background: #323741; }
[data-theme="dark"] .cw-composer textarea { color: var(--cw-ink); background: transparent; }
[data-theme="dark"] .cw-composer textarea::placeholder { color: #9299a5; }
[data-theme="dark"] .cw-composer.is-note-mode {
    border-color: var(--cw-note-border);
    background: var(--cw-note-surface);
    box-shadow: 0 0 0 3px rgba(56, 217, 138, .09), 0 12px 30px rgba(0, 0, 0, .2);
}
[data-theme="dark"] .cw-composer.is-note-mode:focus-within {
    border-color: #4ca669;
    box-shadow: 0 0 0 3px rgba(56, 217, 138, .13), 0 12px 30px rgba(0, 0, 0, .2);
}
[data-theme="dark"] .cw-composer.is-note-mode textarea { color: #dff8e6; }
[data-theme="dark"] .cw-composer.is-note-mode textarea::placeholder { color: #86a991; }
[data-theme="dark"] .cw-composer.is-note-mode .cw-composer-tools > button,
[data-theme="dark"] .cw-composer.is-note-mode .cw-composer-tools .cw-quick-wrap > button,
[data-theme="dark"] .cw-composer.is-note-mode .cw-composer-tools .cw-suggestion-wrap > button {
    border-color: #365b44;
    color: #bde8c9;
    background: #20392a;
}
[data-theme="dark"] .cw-composer.is-note-mode .cw-compose-status { color: var(--cw-note-ink); }
[data-theme="dark"] .cw-composer.is-note-mode .cw-send-button {
    border-color: #2fcf60;
    color: #fff;
    background: linear-gradient(180deg, #35dc69, #20b94e);
    box-shadow: 0 8px 22px rgba(32, 185, 78, .22);
}
[data-theme="dark"] .cw-jump-to-latest { border-color: #3d5f81; color: #b8daff; background: rgba(34, 43, 55, .96); box-shadow: 0 10px 28px rgba(0, 0, 0, .28); }
[data-theme="dark"] .cw-jump-to-latest:hover { border-color: #5c93c8; background: #293b52; }
[data-theme="dark"] .cw-details-tabs { background: #2b2e35; }
[data-theme="dark"] .cw-details-tabs button.is-active { color: #f1f2f4; background: #3a3e47; box-shadow: none; }
[data-theme="dark"] .cw-detail-heading { color: #aaa2c0; }
[data-theme="dark"] .cw-detail-heading small { color: #8f949d; }
[data-theme="dark"] .cw-detail-button { border-color: #3b5474; color: #a8d2ff; background: #24344a; }
[data-theme="dark"] .cw-order-card { border-color: #3b3f47; background: #252830; }
[data-theme="dark"] .cw-order-card strong { color: #8bc4ff; }
[data-theme="dark"] .cw-order-card time { color: #c0c3c9; }
[data-theme="dark"] .cw-detail-input,
[data-theme="dark"] .cw-detail-textarea,
[data-theme="dark"] .cw-detail-select { border-color: #454954; color: var(--cw-ink); background: #252830; }
[data-theme="dark"] .cw-toast { border-color: #3b5474; color: #b9d8fb; background: #223148; box-shadow: 0 12px 34px rgba(0, 0, 0, .3); }
[data-theme="dark"] .cw-activity-list::before { background: #3a3d45; }
[data-theme="dark"] .cw-activity-icon { border-color: #3d5270; color: #8bc4ff; background: #26364c; }
[data-theme="dark"] .cw-local-additions { border-color: #344d6a; background: #1e2a39; }
[data-theme="dark"] .cw-local-additions article { border-color: #34465d; background: #252830; }
[data-theme="dark"] .cw-local-additions article > span:first-child,
[data-theme="dark"] .cw-suggestion-menu > header > span,
[data-theme="dark"] .cw-suggestion-menu > button > span:first-child,
[data-theme="dark"] .cw-mention-thumb.is-icon { color: #a8d2ff; background: #253b55; }
[data-theme="dark"] .cw-mention-search,
[data-theme="dark"] .cw-mention-thumb { border-color: #454954; color: #b9bdc5; background: #252830; }
[data-theme="dark"] .cw-suggestion-menu > header { border-color: var(--cw-line); }
[data-theme="dark"] .cw-suggestion-menu strong,
[data-theme="dark"] .cw-mention-copy strong { color: var(--cw-ink); }
[data-theme="dark"] .cw-suggestion-menu small,
[data-theme="dark"] .cw-mention-copy small,
[data-theme="dark"] .cw-composer-empty { color: #aeb3bc; }
[data-theme="dark"] .cw-mention-copy b { color: #9cc9fa; }

/* Secondary pages, cards, tables and forms */
[data-theme="dark"] .cw-page-kpi,
[data-theme="dark"] .cw-page-panel,
[data-theme="dark"] .cw-profile-card,
[data-theme="dark"] .cw-agent-tile,
[data-theme="dark"] .cw-queue-card {
    border-color: var(--cw-line);
    color: var(--cw-ink);
    background: var(--cw-surface);
}
[data-theme="dark"] .cw-page-panel > header,
[data-theme="dark"] .cw-agent-tile > header,
[data-theme="dark"] .cw-agent-tile > footer,
[data-theme="dark"] .cw-profile-card dl div,
[data-theme="dark"] .cw-setting-list article,
[data-theme="dark"] .cw-status-list article,
[data-theme="dark"] .cw-activity-row,
[data-theme="dark"] .cw-sla-rules article,
[data-theme="dark"] .cw-mini-metrics,
[data-theme="dark"] .cw-capacity-rule { border-color: var(--cw-line); }
[data-theme="dark"] .cw-agent-tile > footer { background: #1c1f25; }
[data-theme="dark"] .cw-page-kpi-icon,
[data-theme="dark"] .cw-inline-agent > i,
[data-theme="dark"] .cw-activity-event-icon,
[data-theme="dark"] .cw-channel-card > span:first-child { color: #8bc4ff; background: #243c58; }
[data-theme="dark"] .cw-page-kpi.is-green .cw-page-kpi-icon { color: #91e0bd; background: #1d4233; }
[data-theme="dark"] .cw-page-kpi.is-orange .cw-page-kpi-icon { color: #ffd18b; background: #493720; }
[data-theme="dark"] .cw-page-kpi.is-violet .cw-page-kpi-icon { color: #cbbcff; background: #372f50; }
[data-theme="dark"] .cw-metric-stack article,
[data-theme="dark"] .cw-channel-summary article { border-color: #3b3e46; background: #252830; }
[data-theme="dark"] .cw-status-list b { background: #343840; }
[data-theme="dark"] .cw-queue-column { border-color: var(--cw-line); background: #1c1f25; }
[data-theme="dark"] .cw-queue-column > header em { background: #30343c; }
[data-theme="dark"] .cw-queue-card:hover,
[data-theme="dark"] .cw-agent-tile:hover { border-color: #4b6788; box-shadow: 0 8px 24px rgba(0, 0, 0, .22); }
[data-theme="dark"] .cw-page-table-toolbar { border-color: var(--cw-line); }
[data-theme="dark"] .cw-page-table-toolbar label,
[data-theme="dark"] .cw-page-table-toolbar select,
[data-theme="dark"] .cw-page-table-toolbar .cw-table-filters .cw-table-filter,
[data-theme="dark"] .cw-form-grid input,
[data-theme="dark"] .cw-form-grid select,
[data-theme="dark"] .cw-form-grid textarea,
[data-theme="dark"] .cw-wide-field textarea,
[data-theme="dark"] .cw-page-panel .cw-wide-field input,
[data-theme="dark"] .cw-bot-test textarea,
[data-theme="dark"] .cw-schedule input,
[data-theme="dark"] .cw-availability-options button {
    border-color: #454954;
    color: var(--cw-ink);
    background: #252830;
}
[data-theme="dark"] .cw-page-table { color: #d4d7dc; }
[data-theme="dark"] .cw-page-table th { color: #aeb3bc; background: #292c33; box-shadow: 0 1px 0 #454954; }
[data-theme="dark"] .cw-page-table td { border-color: #343840; }
[data-theme="dark"] .cw-page-table tbody tr:hover { background: #252f3c; }
[data-theme="dark"] .cw-page-table code { color: #a8d2ff; background: #253b55; }
[data-theme="dark"] .cw-table-preview,
[data-theme="dark"] .cw-page-panel > header p,
[data-theme="dark"] .cw-page-kpi small,
[data-theme="dark"] .cw-page-kpi span:not(.cw-page-kpi-icon),
[data-theme="dark"] .cw-setting-list article span { color: #aeb3bc; }
[data-theme="dark"] .cw-page-header h1,
[data-theme="dark"] .cw-page-panel strong,
[data-theme="dark"] .cw-page-panel h2,
[data-theme="dark"] .cw-page-panel h3,
[data-theme="dark"] .cw-agent-tile strong,
[data-theme="dark"] .cw-profile-card h2 { color: var(--cw-ink); }
[data-theme="dark"] .cw-chart-toolbar button { color: #aeb3bc; }
[data-theme="dark"] .cw-chart-toolbar button.is-active { color: #b8daff; background: #263b55; }
[data-theme="dark"] .cw-chart-summary { border-color: var(--cw-line); color: #aeb3bc; }
[data-theme="dark"] .cw-table-filterbar { border-color: var(--cw-line); background: #1c1f25; }
[data-theme="dark"] .cw-table-filterbar .cw-table-filter { color: #aeb3bc; }
[data-theme="dark"] .cw-table-filterbar .cw-select-trigger { border-color: #454954; background: #252830; }
[data-theme="dark"] .cw-setting-list label,
[data-theme="dark"] .cw-wide-field,
[data-theme="dark"] .cw-profile-presence,
[data-theme="dark"] .cw-profile-card dt,
[data-theme="dark"] .cw-profile-card p { color: #aeb3bc; }
[data-theme="dark"] .cw-channel-summary article { border-color: #3b3e46; background: #252830; }
[data-theme="dark"] .cw-channel-summary article > span { color: #a8d2ff; background: #253b55; }
[data-theme="dark"] .cw-channel-summary article.is-whatsapp > span { color: #91e0bd; background: #1c4132; }
[data-theme="dark"] .cw-language-stats article { border-color: #3b3e46; background: #252830; }
[data-theme="dark"] .cw-language-stats article > span { color: #9dceff; background: #253b55; }
[data-theme="dark"] .cw-language-stats article small { color: #aeb3bc; }
[data-theme="dark"] .cw-foundation-stat:hover { color: #a4eab5; background: #26352d; }
[data-theme="dark"] .cw-foundation-stat i {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--foundation-color) 26%, #20232a), 0 0 10px color-mix(in srgb, var(--foundation-color) 35%, transparent);
}
[data-theme="dark"] .cw-ai-coverage,
[data-theme="dark"] .cw-metric-stack.is-ai-usage article small,
[data-theme="dark"] .cw-channel-summary article small { color: #aeb3bc; }
[data-theme="dark"] .cw-capacity-rule { color: #b9bdc5; }
[data-theme="dark"] .cw-bot-answer { border-color: #3b5474; color: #b9d8fb; background: #223148; }
[data-theme="dark"] .cw-bot-answer > span { background: #2b4261; }
[data-theme="dark"] .cw-availability-options button.is-active { border-color: #486789; color: #b8daff; background: #263b55; }
[data-theme="dark"] .cw-table-pagination { border-color: var(--cw-line); color: #aeb3bc; background: #1c1f25; }
[data-theme="dark"] .cw-table-pagination > div button { border-color: #454954; color: #c4c8ce; background: #292c33; }
[data-theme="dark"] .cw-table-pagination > div strong { color: #dde0e4; }
[data-theme="dark"] .cw-page-tabs { background: #2b2e35; }
[data-theme="dark"] .cw-page-tabs button { color: #aeb2ba; }
[data-theme="dark"] .cw-page-tabs button.is-active { color: #f1f2f4; background: #3a3e47; box-shadow: none; }
[data-theme="dark"] .cw-page-info { border-color: #3b5474; color: #b9d8fb; background: #223148; }
[data-theme="dark"] .cw-page-info > .cw-icon { background: #2b4261; }
[data-theme="dark"] .cw-page-info > code { color: #b9d8fb; background: #2b4261; }
[data-theme="dark"] .cw-page-info > small { color: #b9d8fb; background: #2b4261; }
[data-theme="dark"] .cw-tag[style*="--tag-color"] { color: #eef0f3; background: color-mix(in srgb, var(--tag-color) 26%, #20232a); }
[data-theme="dark"] .cw-tag[data-add-tag] { border-color: #347d50; color: #91e2a6; background: #1d3829; }
[data-theme="dark"] .cw-tag[data-add-tag]:hover { border-color: #49a766; background: #244b34; }
[data-theme="dark"] .cw-page-error strong,
[data-theme="dark"] .cw-page-empty strong { color: var(--cw-ink); }

/* Custom dialogs, selectors and date picker */
[data-theme="dark"] .cw-page-modal,
[data-theme="dark"] .cw-date-picker-modal,
[data-theme="dark"] .rp-dialog-layer { background: var(--cw-overlay); }
[data-theme="dark"] .cw-page-modal > form,
[data-theme="dark"] .cw-date-picker,
[data-theme="dark"] .cw-new-ticket-dialog,
[data-theme="dark"] .cw-role-manager,
[data-theme="dark"] .rp-dialog {
    border-color: var(--cw-line-strong);
    color: var(--cw-ink);
    background: var(--cw-surface);
    box-shadow: 0 30px 90px rgba(0, 0, 0, .5);
}
[data-theme="dark"] .cw-page-modal > form > header,
[data-theme="dark"] .cw-page-modal > form > footer,
[data-theme="dark"] .cw-new-ticket-dialog > header,
[data-theme="dark"] .cw-new-ticket-dialog > footer,
[data-theme="dark"] .cw-role-manager form > footer,
[data-theme="dark"] .cw-date-picker > footer,
[data-theme="dark"] .rp-dialog__foot { border-color: var(--cw-line); background: #1c1f25; }
[data-theme="dark"] .cw-page-modal > form > header button,
[data-theme="dark"] .rp-dialog__close { color: #c5c8ce; background: #30343c; }
[data-theme="dark"] .cw-page-modal-body input,
[data-theme="dark"] .cw-page-modal-body select,
[data-theme="dark"] .cw-page-modal-body textarea,
[data-theme="dark"] .cw-new-ticket-body input,
[data-theme="dark"] .cw-new-ticket-body select,
[data-theme="dark"] .cw-new-ticket-body textarea,
[data-theme="dark"] .cw-role-fields input,
[data-theme="dark"] .rp-dialog__field input,
[data-theme="dark"] .rp-dialog__field textarea,
[data-theme="dark"] .rp-dialog__field select,
[data-theme="dark"] .cw-date-fields input {
    border-color: #454954;
    color: var(--cw-ink);
    background: #252830;
}
[data-theme="dark"] .cw-page-modal-body label,
[data-theme="dark"] .cw-new-ticket-body label,
[data-theme="dark"] .cw-role-fields label,
[data-theme="dark"] .rp-dialog__field,
[data-theme="dark"] .rp-dialog__body > p,
[data-theme="dark"] .rp-dialog__head span { color: #bdc1c8; }
[data-theme="dark"] .cw-page-modal > form > footer button,
[data-theme="dark"] .cw-new-ticket-dialog > footer button,
[data-theme="dark"] .cw-role-manager form > footer button,
[data-theme="dark"] .rp-dialog__foot button,
[data-theme="dark"] .cw-date-picker > footer button { border-color: #454954; color: #d8dbe0; background: #292c33; }
[data-theme="dark"] .rp-dialog__choice { border-color: #454954; color: #d8dbe0; background: #252830; }
[data-theme="dark"] .rp-dialog__choice:has(input:checked) { color: #a4eab5; border-color: #347d50; background: #1d3829; }
[data-theme="dark"] .cw-select-trigger { border-color: #454954; color: #e6e8eb; background: #252830; }
[data-theme="dark"] .cw-select-trigger:hover { border-color: #5a6f89; background: #2a3039; }
[data-theme="dark"] .cw-select-option { color: #d8dbe0; }
[data-theme="dark"] .cw-select-option.is-selected { color: #b8daff; background: #263b55; }
[data-theme="dark"] .cw-date-picker-body > aside { border-color: var(--cw-line); background: #1c1f25; }
[data-theme="dark"] .cw-date-picker-body > aside button { color: #c5c8ce; }
[data-theme="dark"] .cw-date-picker-body > aside button:hover { background: #2a2e36; }
[data-theme="dark"] .cw-date-picker-body > aside button.is-active { color: #b8daff; background: #263b55; }
[data-theme="dark"] .cw-date-month h3 { color: #eceef1; }
[data-theme="dark"] .cw-date-day { color: #c7cad0; }
[data-theme="dark"] .cw-date-day:hover { color: #b8daff; background: #263b55; }
[data-theme="dark"] .cw-date-day.is-in-range { color: #b8daff; background: #253a53; }
[data-theme="dark"] .cw-date-picker > header,
[data-theme="dark"] .cw-role-manager > header { border-color: var(--cw-line); }
[data-theme="dark"] .cw-date-picker > header span,
[data-theme="dark"] .cw-role-manager > header span,
[data-theme="dark"] .cw-role-manager-body > aside > strong,
[data-theme="dark"] .cw-role-manager-body > aside button small { color: #aeb3bc; }
[data-theme="dark"] .cw-date-picker > header button,
[data-theme="dark"] .cw-date-nav,
[data-theme="dark"] .cw-new-ticket-dialog > header > button,
[data-theme="dark"] .cw-role-manager > header button { border-color: #454954; color: #d8dbe0; background: #30343c; }
[data-theme="dark"] .cw-role-manager-body > aside { border-color: var(--cw-line); background: #1c1f25; }
[data-theme="dark"] .cw-role-manager-body > form { background: var(--cw-surface); }
[data-theme="dark"] .cw-role-manager-body > aside button.is-active { border-color: #486789; color: #b8daff; background: #263b55; }
[data-theme="dark"] .cw-role-manager-body > aside button.is-new {
    border-color: #347d50;
    color: #9ae8ad;
    background: #1d3829;
    box-shadow: 0 6px 18px rgba(20, 127, 66, .14);
}
[data-theme="dark"] .cw-role-manager-body > aside button.is-new:hover { border-color: #49a766; color: #c3f5cf; background: #244b34; }
[data-theme="dark"] .cw-role-fields,
[data-theme="dark"] .cw-role-permissions > div,
[data-theme="dark"] .cw-role-permissions > label { border-color: var(--cw-line); }

/* Per-agent appearance picker */
.cw-theme-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.cw-theme-option { position: relative; display: grid; min-width: 0; grid-template-columns: 58px minmax(0, 1fr) 22px; align-items: center; gap: 11px; padding: 11px; border: 1px solid #dedfd9; border-radius: 11px; color: #4f5651; background: #fbfcfa; text-align: left; transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.cw-theme-option:hover { border-color: #b9d7f3; background: #f5f9ff; transform: translateY(-1px); }
.cw-theme-option.is-active { border-color: #7db8f2; background: #edf6ff; box-shadow: 0 0 0 2px rgba(63, 149, 247, .1); }
.cw-theme-option:disabled { cursor: wait; opacity: .72; }
.cw-theme-option-preview { position: relative; display: block; width: 58px; height: 44px; overflow: hidden; border: 1px solid #d9ddd7; border-radius: 8px; background: #f7f8f6; }
.cw-theme-option-preview > i { position: absolute; z-index: 2; top: 6px; left: 6px; display: grid; width: 18px; height: 18px; place-items: center; border-radius: 5px; color: #2377d5; background: #eaf4ff; font-style: normal; font-size: 10px; }
.cw-theme-option-preview > b { position: absolute; right: 5px; bottom: 5px; left: 5px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.cw-theme-option-preview em { height: 7px; border-radius: 2px; background: #dfe4df; }
.cw-theme-option-preview.is-dark { border-color: #454954; background: #20232a; }
.cw-theme-option-preview.is-dark > i { color: #b8daff; background: #263b55; }
.cw-theme-option-preview.is-dark em { background: #454954; }
.cw-theme-option-preview.is-system { background: linear-gradient(90deg, #f7f8f6 0 50%, #20232a 50% 100%); }
.cw-theme-option-preview.is-system em:nth-child(2),
.cw-theme-option-preview.is-system em:nth-child(3) { background: #454954; }
.cw-theme-option-copy { display: flex; min-width: 0; flex-direction: column; }
.cw-theme-option-copy strong { color: #303632; font-size: 11px; }
.cw-theme-option-copy small { margin-top: 4px; color: #777e78; font-size: 9px; line-height: 1.35; }
.cw-theme-option-check { display: grid; width: 20px; height: 20px; place-items: center; border: 1px solid #d7dbd5; border-radius: 50%; color: transparent; background: #fff; font-size: 12px; }
.cw-theme-option.is-active .cw-theme-option-check { border-color: #2377d5; color: #fff; background: #2377d5; }
.cw-theme-footnote { margin: 12px 0 0; color: #777e78; font-size: 9px; line-height: 1.45; }
.cw-account-appearance { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 5px -1px 0; padding: 9px 9px 4px; border-top: 1px solid #eceeea; }
.cw-account-appearance > span { color: #777e78; font-size: 9px; font-weight: 700; letter-spacing: .035em; }
.cw-account-theme-picker.cw-theme-picker { display: inline-flex; gap: 4px; }
.cw-account-theme-choice { display: grid; width: 31px; height: 31px; place-items: center; border: 1px solid #dfe3dd; border-radius: 8px; color: #6f7771; background: #f8faf7; }
.cw-account-theme-choice:hover { border-color: #b9d7f3; color: #2377d5; background: #eef6ff; }
.cw-account-theme-choice.is-active { border-color: #7db8f2; color: #1765b5; background: #e4f2ff; box-shadow: 0 0 0 2px rgba(63, 149, 247, .08); }
.cw-account-theme-choice .cw-icon { width: 15px; height: 15px; }
[data-theme="dark"] .cw-theme-option { border-color: #454954; color: #d8dbe0; background: #252830; }
[data-theme="dark"] .cw-theme-option:hover { border-color: #5a6f89; background: #2a3039; }
[data-theme="dark"] .cw-theme-option.is-active { border-color: #5c93c8; background: #263b55; box-shadow: 0 0 0 2px rgba(77, 167, 255, .1); }
[data-theme="dark"] .cw-theme-option-copy strong { color: #eef0f3; }
[data-theme="dark"] .cw-theme-option-copy small,
[data-theme="dark"] .cw-theme-footnote { color: #aeb3bc; }
[data-theme="dark"] .cw-theme-option-check { border-color: #565b66; background: #30343c; }
[data-theme="dark"] .cw-theme-option.is-active .cw-theme-option-check { border-color: #4da7ff; color: #fff; background: #287fd2; }
[data-theme="dark"] .cw-account-appearance { border-color: var(--cw-line); }
[data-theme="dark"] .cw-account-appearance > span { color: #aeb3bc; }
[data-theme="dark"] .cw-account-theme-choice { border-color: #454954; color: #aeb4bf; background: #292c33; }
[data-theme="dark"] .cw-account-theme-choice:hover { border-color: #5a6f89; color: #d9edff; background: #2d3d51; }
[data-theme="dark"] .cw-account-theme-choice.is-active { border-color: #5c93c8; color: #fff; background: #286ea9; box-shadow: 0 0 0 2px rgba(77, 167, 255, .11); }
[data-theme="dark"] .cw-account-popover .cw-account-logout { color: #ff5d69; }
[data-theme="dark"] .cw-account-popover .cw-account-logout:hover,
[data-theme="dark"] .cw-account-popover .cw-account-logout:focus-visible { color: #ff8991; background: rgba(255, 93, 105, .13); }

/* Login follows the operating system because no agent is authenticated yet. */
[data-theme="dark"] body.rp-login-body { color: #f0f1f3; background: #17191e; }
[data-theme="dark"] .rp-login-form-side { background: #17191e; }
[data-theme="dark"] .rp-login-gradient-side { background: #111318; }
[data-theme="dark"] .rp-login-logo-text,
[data-theme="dark"] .rp-login-title { color: #f0f1f3; }
[data-theme="dark"] .rp-login-subtitle,
[data-theme="dark"] .rp-login-label { color: #aeb3bc; }
[data-theme="dark"] .rp-login-input { border-color: #454954; color: #f0f1f3; background: #20232a; }
[data-theme="dark"] .rp-login-input:focus { border-color: #469e5b; background: #1d2c22; box-shadow: 0 0 0 3px rgba(70, 220, 98, .1); }
[data-theme="dark"] .rp-login-toggle-pwd { color: #aeb3bc; }
[data-theme="dark"] .rp-login-alert { border-color: #743d43; color: #ffadb3; background: #3e2529; }
[data-theme="dark"] .rp-login-footer span { color: #979ca7; }

/* Scrollbars and native controls */
[data-theme="dark"] * { scrollbar-color: #555a64 transparent; }
[data-theme="dark"] *::-webkit-scrollbar-thumb { background: #555a64; }
[data-theme="dark"] *::-webkit-scrollbar-thumb:hover { background: #686e79; }
[data-theme="dark"] input[type="checkbox"],
[data-theme="dark"] input[type="radio"] { accent-color: #4da7ff; }

@media (max-width: 1100px) {
    .cw-profile-main .cw-theme-picker { grid-template-columns: 1fr; }
    .cw-account-theme-picker.cw-theme-picker { display: inline-flex; }
}

@media (max-width: 760px) {
    .cw-theme-picker { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
    .cw-profile-layout,
    .cw-page-grid.is-two.cw-account-charts {
        grid-template-columns: minmax(0, 1fr);
    }

    .cw-profile-card,
    .cw-profile-main,
    .cw-account-charts > .cw-page-panel {
        width: 100%;
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cw-theme-option { transition: none; }
    .cw-theme-option:hover { transform: none; }
}
