/*
 * XSSM light appearance
 */

[data-theme="light"] {
    color-scheme: light;

    --accent: #735fd3;
    --accent-light: #9a89eb;
    --accent-dark: #5f4cbd;
    --accent-soft: rgba(115, 95, 211, 0.1);
    --accent-glow: rgba(115, 95, 211, 0.18);

    --glass-sm: rgba(238, 240, 246, 0.7);
    --glass-md: rgba(242, 243, 248, 0.82);
    --glass-lg: rgba(244, 245, 249, 0.91);
    --glass-xl: rgba(247, 248, 251, 0.97);

    --bg-deep: #dde1ea;
    --bg-base: #e6e9f0;
    --bg-surface: #f3f5f8;
    --bg-elevated: #eaedf3;
    --bg-hover: rgba(70, 60, 106, 0.09);
    --bg-input: rgba(228, 231, 239, 0.92);
    --bg-glass: var(--glass-md);
    --bg-glass-strong: var(--glass-lg);
    --bg-island: rgba(251, 251, 254, 0.8);

    --text-primary: #20222e;
    --text-secondary: #555968;
    --text-muted: #777c8c;

    --border-faint: rgba(48, 40, 72, 0.065);
    --border-subtle: rgba(48, 40, 72, 0.11);
    --border-light: rgba(48, 40, 72, 0.15);
    --border-medium: rgba(48, 40, 72, 0.19);
    --border-strong: rgba(48, 40, 72, 0.26);

    --shadow-xs: 0 1px 2px rgba(42, 35, 66, 0.04);
    --shadow-sm: 0 3px 10px rgba(42, 35, 66, 0.06);
    --shadow-md: 0 8px 24px rgba(42, 35, 66, 0.08);
    --shadow-lg: 0 16px 44px rgba(42, 35, 66, 0.11);
    --shadow-xl: 0 30px 80px rgba(42, 35, 66, 0.17);
    --shadow-island: 0 7px 24px rgba(42, 35, 66, 0.08), 0 0 0 1px var(--border-subtle);
    --shadow-glow: 0 0 28px var(--accent-glow);

    accent-color: var(--accent);
}

/* 2026 light-surface consistency: retain contrast without white-on-white glare. */
[data-theme="light"] :is(.emoji-panel,.sticker-flow-card,.folder-picker,.up-modal) {
    color:#282532!important;
    border-color:rgba(65,54,91,.11)!important;
    background:linear-gradient(150deg,rgba(248,248,251,.97),rgba(232,234,241,.95))!important;
    box-shadow:0 30px 80px rgba(50,43,72,.18),inset 0 1px 0 rgba(255,255,255,.9)!important;
}
[data-theme="light"] :is(.sticker-library-head,.sticker-library-footer,.sticker-packs-bar,.emoji-panel-head,.up-explorer,.up-tabs-wrap) {
    border-color:rgba(65,54,91,.08)!important;
    background:rgba(232,234,241,.54)!important;
}
[data-theme="light"] :is(.sticker-item,.pack-pick-btn,.up-card,.up-detail-row,.up-tab) {
    color:#34303f!important;
}
[data-theme="light"] :is(.sticker-item:hover,.pack-pick-btn:hover,.up-detail-row:hover,.up-tab:hover) {
    border-color:rgba(104,83,187,.13)!important;
    background:rgba(108,88,190,.075)!important;
}
[data-theme="light"] :is(.sticker-search,.settings-input-wrap,.media-thumb-unavailable) {
    color:#55515f!important;
    border-color:rgba(65,54,91,.1)!important;
    background:rgba(223,225,233,.7)!important;
}
[data-theme="light"] :is(.reply-bar,.message-reply-preview) {
    border-color:rgba(103,82,185,.15)!important;
    background:linear-gradient(110deg,rgba(111,89,199,.09),rgba(224,226,234,.74))!important;
}
[data-theme="light"] .up-status-text.private { color:#757181!important; }
[data-theme="light"] .folder-tabs-wrap,
[data-theme="light"] .ftabs-scroll { background:transparent!important;box-shadow:none!important; }
[data-theme="light"] .sticker-delete-action {
    color:#fff!important;background:#cf4058!important;border-color:rgba(255,255,255,.75)!important;
}

/* Foundation and native controls */
[data-theme="light"] body,
[data-theme="light"] .messenger-body {
    color: var(--text-primary);
    background:
        radial-gradient(circle at 15% -10%, rgba(151, 131, 225, 0.18), transparent 34%),
        radial-gradient(circle at 100% 100%, rgba(92, 178, 220, 0.11), transparent 32%),
        #e2e6ee;
}

[data-theme="light"] .app-layout {
    background: transparent;
}

[data-theme="light"] ::selection {
    color: #241c4d;
    background: rgba(129, 107, 221, 0.25);
}

[data-theme="light"] * {
    scrollbar-color: rgba(71, 61, 105, 0.22) transparent;
}

[data-theme="light"] *::-webkit-scrollbar-thumb {
    background: rgba(71, 61, 105, 0.2);
}

[data-theme="light"] :is(input, textarea, select) {
    color: var(--text-primary);
    caret-color: var(--accent);
}

[data-theme="light"] :is(input, textarea)::placeholder {
    color: var(--text-muted);
    opacity: 0.82;
}

[data-theme="light"] :is(button, input, textarea, select, [tabindex]):focus-visible {
    outline-color: rgba(115, 95, 211, 0.72);
}

[data-theme="light"] .btn-secondary,
[data-theme="light"] .btn-icon,
[data-theme="light"] .modal-close-btn {
    border-color: var(--border-subtle);
    color: var(--text-secondary);
    background: rgba(231, 234, 241, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

[data-theme="light"] :is(.btn-secondary, .btn-icon, .modal-close-btn):hover {
    border-color: rgba(115, 95, 211, 0.2);
    color: var(--accent-dark);
    background: rgba(115, 95, 211, 0.08);
}

[data-theme="light"] .btn-danger,
[data-theme="light"] .danger-btn {
    color: #c13e4d;
    background: rgba(225, 65, 82, 0.08);
    border-color: rgba(209, 50, 68, 0.13);
}

/* Shared glass overlays, dialogs and floating surfaces */
[data-theme="light"] .modal-overlay {
    background:
        radial-gradient(circle at 50% 8%, rgba(126, 105, 211, 0.12), transparent 38%),
        rgba(222, 226, 237, 0.66);
    -webkit-backdrop-filter: blur(18px) saturate(120%);
    backdrop-filter: blur(18px) saturate(120%);
}

[data-theme="light"] .modal-card {
    color: var(--text-primary);
    border-color: rgba(55, 47, 80, 0.12);
    background:
        linear-gradient(145deg, rgba(247, 248, 251, 0.985), rgba(228, 231, 239, 0.975));
    box-shadow:
        0 35px 95px rgba(43, 48, 70, 0.2),
        0 0 0 1px rgba(58, 50, 85, 0.06),
        inset 0 1px 0 #fff;
}

[data-theme="light"] .modal-header {
    color: var(--text-primary);
    border-bottom-color: var(--border-subtle);
    background: rgba(236, 238, 244, 0.82);
}

[data-theme="light"] .modal-header h3,
[data-theme="light"] .modal-body h3,
[data-theme="light"] .modal-body h4 {
    color: var(--text-primary);
}

[data-theme="light"] .modal-body,
[data-theme="light"] .modal-footer {
    color: var(--text-secondary);
}

[data-theme="light"] .modal-footer {
    border-top-color: var(--border-subtle);
    background: rgba(225, 228, 236, 0.72);
}

[data-theme="light"] :is(
    .context-menu,
    .chat-dropdown,
    .mention-dropdown,
    .send-options-menu,
    .ephemeral-picker,
    .emoji-panel,
    .settings-dropdown-menu,
    .reaction-detail-popup
) {
    color: var(--text-primary);
    border-color: rgba(55, 48, 80, 0.1) !important;
    background:
        linear-gradient(155deg, rgba(255, 255, 255, 0.985), rgba(241, 244, 250, 0.96)) !important;
    box-shadow: 0 22px 58px rgba(43, 48, 70, 0.18), inset 0 1px 0 #fff !important;
}

[data-theme="light"] :is(.context-menu, .chat-dropdown, .send-options-menu, .ephemeral-picker)::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent 46%);
}

[data-theme="light"] :is(
    .context-menu-item,
    .chat-dropdown-item,
    .send-option-item,
    .ephemeral-option,
    .settings-dropdown-item,
    .mention-item
) {
    color: var(--text-secondary);
}

[data-theme="light"] :is(
    .context-menu-item,
    .chat-dropdown-item,
    .send-option-item,
    .ephemeral-option,
    .settings-dropdown-item,
    .mention-item
):hover {
    color: var(--text-primary);
    background: rgba(115, 95, 211, 0.075) !important;
}

[data-theme="light"] :is(.context-menu-divider, .chat-dropdown-divider, .send-options-divider) {
    background: var(--border-subtle);
}

[data-theme="light"] .emoji-tabs {
    border-bottom-color: var(--border-subtle);
    background: rgba(239, 241, 247, 0.66);
}

[data-theme="light"] .emoji-tab {
    color: var(--text-muted);
}

[data-theme="light"] .emoji-tab:hover,
[data-theme="light"] .emoji-tab.active {
    color: var(--accent-dark);
    background: rgba(115, 95, 211, 0.08);
}

[data-theme="light"] .emoji-grid span:hover {
    background: rgba(115, 95, 211, 0.1);
}

[data-theme="light"] .toast-notification {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.9);
    background: rgba(252, 252, 255, 0.94);
    box-shadow: 0 18px 48px rgba(45, 49, 69, 0.16), inset 0 1px 0 #fff;
}

[data-theme="light"] :is(.connection-status, .upload-progress, .call-notification) {
    color: var(--text-primary);
    border-color: var(--border-subtle);
    background: rgba(252, 252, 255, 0.9);
    box-shadow: var(--shadow-lg);
}

/* Sidebar, inbox and navigation */
[data-theme="light"] .modern-sidebar {
    border-right-color: rgba(58, 50, 85, 0.15) !important;
    background:
        linear-gradient(165deg, rgba(241, 243, 248, 0.9), rgba(226, 230, 238, 0.82)) !important;
    box-shadow: 14px 0 42px rgba(45, 42, 65, 0.055), inset -1px 0 rgba(255, 255, 255, 0.62);
}

[data-theme="light"] :is(.sidebar-header, .sidebar-dsearch, .sidebar-tabs, .sidebar-dock) {
    border-color: var(--border-subtle);
}

[data-theme="light"] .sidebar-header,
[data-theme="light"] .sidebar-dock {
    background: rgba(232, 235, 242, 0.62);
}

[data-theme="light"] .sidebar-brand {
    color: #29233f;
}

[data-theme="light"] .sidebar-brand-icon {
    color: #fff;
    box-shadow: 0 8px 18px rgba(89, 69, 183, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.36);
}

[data-theme="light"] :is(.sidebar-action-btn, .dock-action, .dsearch-clear, .ftab-manage) {
    border-color: var(--border-subtle);
    color: var(--text-secondary);
    background: rgba(224, 227, 235, 0.88);
}

[data-theme="light"] :is(.sidebar-action-btn, .dock-action, .dsearch-clear, .ftab-manage):hover {
    color: var(--accent-dark);
    border-color: rgba(115, 95, 211, 0.2);
    background: rgba(115, 95, 211, 0.09);
}

[data-theme="light"] .dsearch-pill {
    border-color: rgba(60, 51, 87, 0.095);
    background: rgba(226, 229, 237, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 5px 16px rgba(44, 39, 66, 0.055);
}

[data-theme="light"] .dsearch-pill:focus-within {
    border-color: rgba(115, 95, 211, 0.3);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 0 0 4px rgba(115, 95, 211, 0.085), 0 8px 22px rgba(44, 39, 66, 0.075);
}

[data-theme="light"] .dsearch-field input {
    color: var(--text-primary);
}

[data-theme="light"] .dsearch-icon,
[data-theme="light"] .dsearch-field input::placeholder {
    color: var(--text-muted);
}

[data-theme="light"] .dsearch-new {
    border-color: rgba(103, 83, 198, 0.16);
    background: linear-gradient(145deg, #8875df, #6854c7);
    box-shadow: 0 9px 22px rgba(91, 70, 188, 0.23), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

[data-theme="light"] :is(.sidebar-tab, .folder-tab, .ftab) {
    color: var(--text-secondary);
}

[data-theme="light"] :is(.sidebar-tab, .folder-tab, .ftab):hover {
    color: var(--accent-dark);
    background: rgba(115, 95, 211, 0.065);
}

[data-theme="light"] :is(.sidebar-tab.active, .folder-tab.active, .ftab-active) {
    color: var(--accent-dark);
    border-color: rgba(115, 95, 211, 0.15);
    background: rgba(115, 95, 211, 0.1);
}

[data-theme="light"] .chat-item {
    color: var(--text-primary);
    border-color: rgba(58, 50, 85, 0.045);
    background: rgba(233, 236, 242, 0.42);
}

[data-theme="light"] .chat-item:hover {
    border-color: rgba(62, 52, 93, 0.1);
    background: rgba(244, 245, 249, 0.82);
    box-shadow: 0 7px 20px rgba(44, 40, 65, 0.055);
}

[data-theme="light"] .chat-item.active {
    border-color: rgba(115, 95, 211, 0.12);
    background:
        linear-gradient(105deg, rgba(115, 95, 211, 0.18), rgba(238, 238, 247, 0.86));
    box-shadow: 0 9px 24px rgba(64, 49, 117, 0.075), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

[data-theme="light"] .chat-item.active::after {
    background: linear-gradient(180deg, #8c78e2, #6652c5);
    box-shadow: 0 0 12px rgba(105, 84, 202, 0.3);
}

[data-theme="light"] :is(.chat-name, .sys-name, .dock-name, .chat-item.active .chat-name) {
    color: var(--text-primary);
}

[data-theme="light"] :is(.chat-preview, .chat-time, .sys-sub, .dock-status, .chat-pin-icon) {
    color: var(--text-muted);
}

[data-theme="light"] .unread-badge,
[data-theme="light"] .sys-badge,
[data-theme="light"] .ftab-badge {
    color: #fff;
    background: linear-gradient(145deg, #8974df, #6752c5);
    box-shadow: 0 5px 13px rgba(91, 70, 188, 0.22);
}

[data-theme="light"] .sys-item {
    border-color: rgba(58, 50, 85, 0.065);
    background: rgba(231, 234, 241, 0.72);
}

[data-theme="light"] .sys-item:hover {
    border-color: rgba(115, 95, 211, 0.13);
    background: rgba(243, 244, 248, 0.9);
}

[data-theme="light"] .sys-icon {
    border-color: rgba(55, 47, 81, 0.075);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

[data-theme="light"] .dock-profile:hover {
    background: rgba(115, 95, 211, 0.065);
}

[data-theme="light"] .mobile-tabbar {
    border-top-color: rgba(57, 49, 84, 0.1);
    background: rgba(249, 250, 253, 0.86);
    box-shadow: 0 -12px 35px rgba(43, 40, 62, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

[data-theme="light"] .mobile-tab-btn {
    color: var(--text-muted);
}

[data-theme="light"] .mobile-tab-btn.active {
    color: var(--accent-dark);
}

@media (max-width: 768px) {
    [data-theme="light"] .mobile-tabbar .mbt-btn {
        color: #686c7a !important;
    }

    [data-theme="light"] .mobile-tabbar .mbt-btn.mbt-active {
        border-color: rgba(103, 80, 190, 0.2) !important;
        color: #4d3c92 !important;
        background: linear-gradient(145deg, rgba(138, 112, 224, 0.2), rgba(106, 83, 193, 0.1)) !important;
    }

    [data-theme="light"] .mobile-tabbar .mbt-btn.mbt-active :is(i, span) {
        color: #4d3c92 !important;
    }

    [data-theme="light"] .mobile-folder-shortcut {
        border-color: rgba(68, 58, 98, 0.12) !important;
        color: #626675 !important;
        background: rgba(226, 229, 237, 0.84) !important;
    }
}

/* Chat header, messages and composer */
[data-theme="light"] .main-area,
[data-theme="light"] #chat-view {
    background: transparent !important;
}

[data-theme="light"] #chat-view::before {
    background:
        radial-gradient(circle at 78% -15%, rgba(123, 101, 212, 0.085), transparent 30%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 26%);
}

[data-theme="light"] #chat-view .chat-topbar {
    border-bottom-color: rgba(58, 50, 85, 0.1) !important;
    background:
        linear-gradient(180deg, rgba(242, 244, 248, 0.93), rgba(226, 230, 238, 0.82)) !important;
    box-shadow: 0 9px 30px rgba(43, 40, 62, 0.065), inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

[data-theme="light"] #chat-view .chat-topbar::after {
    background: linear-gradient(90deg, transparent, rgba(115, 95, 211, 0.2), transparent);
}

[data-theme="light"] #chat-view :is(.chat-back-btn, .topbar-action-btn, .topbar-chip) {
    border-color: rgba(56, 48, 82, 0.085);
    color: var(--text-secondary);
    background: rgba(224, 227, 235, 0.9);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

[data-theme="light"] #chat-view :is(.chat-back-btn, .topbar-action-btn, .topbar-chip):hover,
[data-theme="light"] #chat-view .topbar-action-btn.active {
    border-color: rgba(115, 95, 211, 0.18);
    color: var(--accent-dark);
    background: rgba(115, 95, 211, 0.085);
}

[data-theme="light"] #chat-view .partner-info h3 {
    color: #252332;
}

[data-theme="light"] #chat-view .partner-status {
    color: #727687;
}

[data-theme="light"] #chat-view .chat-e2e-pill {
    border-color: rgba(21, 128, 93, 0.12);
    color: #38876d;
    background: rgba(16, 185, 129, 0.065);
}

[data-theme="light"] #chat-view .chat-dropdown {
    border-color: rgba(53, 46, 77, 0.1);
    background: rgba(253, 253, 255, 0.97);
}

[data-theme="light"] .messages-date-divider span {
    color: #666879;
    border-color: rgba(55, 47, 80, 0.075);
    background: rgba(252, 252, 255, 0.72);
    box-shadow: 0 5px 16px rgba(46, 42, 65, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .message-wrapper.received .message-bubble {
    color: #252631;
    border-color: rgba(55, 47, 80, 0.075) !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.97), rgba(248, 248, 252, 0.94)) !important;
    box-shadow: 0 5px 17px rgba(41, 38, 58, 0.075), inset 0 1px 0 #fff !important;
}

[data-theme="light"] .message-wrapper.sent .message-bubble {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.14);
    background: linear-gradient(145deg, #8673db, #6652c5) !important;
    box-shadow: 0 7px 20px rgba(81, 61, 169, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

[data-theme="light"] .message-wrapper.received :is(.message-meta, .message-edited-label, .message-status) {
    color: #9899a5;
}

[data-theme="light"] .message-wrapper.sent :is(.message-meta, .message-edited-label, .message-status) {
    color: rgba(255, 255, 255, 0.66);
}

[data-theme="light"] .message-reply-preview,
[data-theme="light"] .reply-bar {
    color: var(--text-secondary);
    background: rgba(103, 83, 194, 0.07);
}

[data-theme="light"] .message-wrapper.received .message-reply-preview::before,
[data-theme="light"] .reply-bar::before {
    background: var(--accent);
}

[data-theme="light"] .message-reaction-pill {
    border-color: rgba(56, 47, 84, 0.09);
    color: #5f6170;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 4px 12px rgba(43, 39, 62, 0.07);
}

[data-theme="light"] .message-reaction-pill.reacted {
    border-color: rgba(115, 95, 211, 0.22);
    color: var(--accent-dark);
    background: rgba(115, 95, 211, 0.11);
}

[data-theme="light"] .message-search-highlight,
[data-theme="light"] .message-wrapper.search-highlighted .message-bubble {
    box-shadow: 0 0 0 3px rgba(235, 175, 52, 0.34), 0 8px 22px rgba(89, 70, 22, 0.11) !important;
}

[data-theme="light"] :is(.pinned-banner, .reply-bar, .edit-bar, .selection-toolbar, .chat-search-bar, .typing-indicator) {
    border-color: rgba(57, 49, 84, 0.09);
    color: var(--text-secondary);
    background: rgba(250, 250, 253, 0.79);
    box-shadow: 0 7px 22px rgba(44, 40, 64, 0.065), inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

[data-theme="light"] .chat-search-bar input {
    color: var(--text-primary);
}

[data-theme="light"] #chat-view .composer {
    border-color: rgba(58, 50, 85, 0.11) !important;
    background:
        linear-gradient(180deg, rgba(239, 241, 246, 0.94), rgba(224, 228, 236, 0.87)) !important;
    box-shadow: 0 -9px 30px rgba(43, 40, 62, 0.055), inset 0 1px 0 rgba(255, 255, 255, 0.86) !important;
}

[data-theme="light"] #chat-view .input-wrapper {
    border-color: rgba(56, 48, 82, 0.1) !important;
    background: rgba(230, 233, 240, 0.94) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.94), 0 5px 15px rgba(42, 38, 61, 0.045);
}

[data-theme="light"] #chat-view .input-wrapper:focus-within {
    border-color: rgba(115, 95, 211, 0.3) !important;
    background: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 0 0 4px rgba(115, 95, 211, 0.075), 0 7px 20px rgba(42, 38, 61, 0.06);
}

[data-theme="light"] #chat-view :is(#message-input, .message-input) {
    color: #292934;
}

[data-theme="light"] #chat-view :is(.composer-inner-btn, .mic-inline, .attach-btn) {
    color: #767887;
}

[data-theme="light"] #chat-view :is(.composer-inner-btn, .mic-inline, .attach-btn):hover {
    color: var(--accent-dark);
    background: rgba(115, 95, 211, 0.08);
}

/* New chat / group / channel */
[data-theme="light"] #new-chat-modal.create-overlay {
    background:
        radial-gradient(circle at 13% 8%, rgba(129, 106, 217, 0.16), transparent 36%),
        radial-gradient(circle at 90% 92%, rgba(71, 165, 210, 0.1), transparent 33%),
        rgba(222, 226, 237, 0.68) !important;
}

[data-theme="light"] #new-chat-modal .create-chat-card {
    color: #252633;
    border-color: rgba(255, 255, 255, 0.96) !important;
    background:
        linear-gradient(145deg, rgba(255, 255, 255, 0.985), rgba(241, 244, 250, 0.965)) !important;
    box-shadow: 0 42px 115px rgba(43, 48, 70, 0.2), 0 0 0 1px rgba(56, 48, 82, 0.06), inset 0 1.5px 0 #fff !important;
}

[data-theme="light"] #new-chat-modal .create-chat-card::before {
    background:
        radial-gradient(circle at 26% -12%, rgba(132, 108, 221, 0.12), transparent 38%),
        linear-gradient(120deg, rgba(255, 255, 255, 0.7), transparent 28%);
}

[data-theme="light"] #new-chat-modal :is(.cch-glow-primary, .cch-glow-secondary) {
    opacity: 0.24;
}

[data-theme="light"] #new-chat-modal .cch-header {
    border-bottom-color: rgba(55, 47, 80, 0.08) !important;
    background: rgba(255, 255, 255, 0.34) !important;
}

[data-theme="light"] #new-chat-modal .cch-header-icon,
[data-theme="light"] #new-chat-modal .cch-empty-icon,
[data-theme="light"] #new-chat-modal .cch-avatar {
    border-color: rgba(105, 84, 199, 0.16);
    color: #725fc7;
    background: linear-gradient(145deg, rgba(134, 111, 220, 0.13), rgba(255, 255, 255, 0.7));
    box-shadow: 0 12px 28px rgba(70, 57, 116, 0.09), inset 0 1px 0 #fff;
}

[data-theme="light"] #new-chat-modal .cch-eyebrow,
[data-theme="light"] #new-chat-modal .cch-panel-badge {
    color: #745fc9;
}

[data-theme="light"] #new-chat-modal :is(.cch-title, .cch-panel-heading h3, .cch-selected-copy strong, .cch-empty-hint strong) {
    color: #232431 !important;
}

[data-theme="light"] #new-chat-modal :is(
    .cch-header-copy p,
    .cch-panel-heading p,
    .cch-empty-hint p,
    .cch-field-help,
    .cch-inline-hint,
    .cch-footer-status,
    .cch-label-line > span,
    .cch-section-label small,
    .search-result-status,
    .cch-selected-copy span
) {
    color: #8a8d9c;
}

[data-theme="light"] #new-chat-modal :is(.cch-label-line label, .cch-section-label > span) {
    color: #656777;
}

[data-theme="light"] #new-chat-modal .cch-close {
    border-color: rgba(55, 47, 80, 0.08);
    color: #727484;
    background: rgba(68, 57, 99, 0.045);
}

[data-theme="light"] #new-chat-modal .cch-close:hover {
    border-color: rgba(115, 95, 211, 0.17);
    color: var(--accent-dark);
    background: rgba(115, 95, 211, 0.08);
}

[data-theme="light"] #new-chat-modal .cch-sidebar {
    border-color: rgba(55, 47, 80, 0.075);
    background: rgba(235, 238, 245, 0.57);
}

[data-theme="light"] #new-chat-modal .cch-segmented {
    border-color: rgba(55, 47, 80, 0.075);
    background: rgba(80, 69, 112, 0.035);
}

[data-theme="light"] #new-chat-modal .cch-seg {
    color: #737686;
}

[data-theme="light"] #new-chat-modal .cch-seg:hover {
    color: #373348;
    background: rgba(255, 255, 255, 0.54);
}

[data-theme="light"] #new-chat-modal .cch-seg.active {
    color: #3f346e;
    border-color: rgba(115, 95, 211, 0.14);
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 6px 17px rgba(55, 44, 95, 0.075), inset 0 1px 0 #fff;
}

[data-theme="light"] #new-chat-modal .cch-seg-icon {
    border-color: rgba(55, 47, 80, 0.07);
    color: #848696;
    background: rgba(61, 51, 90, 0.04);
}

[data-theme="light"] #new-chat-modal .cch-seg.active .cch-seg-icon {
    color: #735fc9;
    background: rgba(115, 95, 211, 0.1);
}

[data-theme="light"] #new-chat-modal .cch-privacy-note {
    border-color: rgba(21, 128, 93, 0.1);
    color: #578171;
    background: rgba(16, 185, 129, 0.045);
}

[data-theme="light"] #new-chat-modal .cch-workspace,
[data-theme="light"] #new-chat-modal .cch-body {
    background: transparent;
}

[data-theme="light"] #new-chat-modal :is(.cch-input-shell, .cch-field textarea) {
    border-color: rgba(55, 47, 80, 0.09);
    color: #252633;
    background: rgba(255, 255, 255, 0.64);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.94), 0 4px 13px rgba(42, 38, 61, 0.035);
}

[data-theme="light"] #new-chat-modal :is(.cch-input-shell, .cch-field textarea):focus-within,
[data-theme="light"] #new-chat-modal .cch-field textarea:focus {
    border-color: rgba(115, 95, 211, 0.3);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 4px rgba(115, 95, 211, 0.075);
}

[data-theme="light"] #new-chat-modal :is(.cch-input-shell input, .cch-field textarea) {
    color: #252633;
}

[data-theme="light"] #new-chat-modal .search-results,
[data-theme="light"] #new-chat-modal .cch-members {
    border-color: rgba(55, 47, 80, 0.075);
    background: rgba(70, 59, 102, 0.035);
}

[data-theme="light"] #new-chat-modal .search-result-item {
    color: #2d2e3a;
    border-color: transparent;
    background: rgba(255, 255, 255, 0.36);
}

[data-theme="light"] #new-chat-modal .search-result-item:hover {
    border-color: rgba(115, 95, 211, 0.12);
    background: rgba(255, 255, 255, 0.76);
    box-shadow: 0 7px 18px rgba(47, 41, 69, 0.06);
}

[data-theme="light"] #new-chat-modal .search-result-name {
    color: #2a2b37;
}

[data-theme="light"] #new-chat-modal .search-result-action {
    color: #6e5bc5;
    background: rgba(115, 95, 211, 0.09);
}

[data-theme="light"] #new-chat-modal .cch-selected-user,
[data-theme="light"] #new-chat-modal .cch-member {
    border-color: rgba(115, 95, 211, 0.16);
    color: #3e3566;
    background: rgba(115, 95, 211, 0.09);
}

[data-theme="light"] #new-chat-modal .cch-type-btn {
    color: #666978;
    border-color: rgba(55, 47, 80, 0.075);
    background: rgba(255, 255, 255, 0.4);
}

[data-theme="light"] #new-chat-modal .cch-type-btn:hover {
    color: #33313f;
    border-color: rgba(115, 95, 211, 0.13);
    background: rgba(255, 255, 255, 0.72);
}

[data-theme="light"] #new-chat-modal .cch-type-btn.active {
    color: #352d5c;
    border-color: rgba(115, 95, 211, 0.2);
    background: rgba(115, 95, 211, 0.09);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

[data-theme="light"] #new-chat-modal .cch-type-icon {
    color: #747687;
    background: rgba(62, 52, 90, 0.045);
}

[data-theme="light"] #new-chat-modal .cch-type-btn.active .cch-type-icon {
    color: #6f5cc5;
    background: rgba(115, 95, 211, 0.11);
}

[data-theme="light"] #new-chat-modal .cch-type-btn small {
    color: #8b8e9d;
}

[data-theme="light"] #new-chat-modal .cch-footer {
    border-top-color: rgba(55, 47, 80, 0.075);
    background: rgba(235, 238, 245, 0.58);
}

[data-theme="light"] #new-chat-modal .cch-cancel {
    color: #696b7a;
}

[data-theme="light"] #new-chat-modal .cch-cancel:hover {
    color: #34313f;
    border-color: rgba(55, 47, 80, 0.08);
    background: rgba(255, 255, 255, 0.56);
}

/* Archive */
[data-theme="light"] #archive-modal.archive-overlay {
    background:
        radial-gradient(circle at 14% 12%, rgba(118, 96, 208, 0.16), transparent 34%),
        radial-gradient(circle at 88% 90%, rgba(48, 160, 209, 0.1), transparent 32%),
        rgba(222, 226, 237, 0.68) !important;
}

[data-theme="light"] #archive-modal .modal-card-archive {
    color: #252633;
    border-color: rgba(255, 255, 255, 0.96) !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.985), rgba(241, 244, 250, 0.965)) !important;
    box-shadow: 0 42px 115px rgba(43, 48, 70, 0.2), 0 0 0 1px rgba(56, 48, 82, 0.06), inset 0 1.5px 0 #fff !important;
}

[data-theme="light"] #archive-modal .modal-card-archive::before {
    background: radial-gradient(circle at 28% -10%, rgba(125, 102, 213, 0.11), transparent 38%), linear-gradient(120deg, rgba(255, 255, 255, 0.7), transparent 25%);
}

[data-theme="light"] #archive-modal .archive-hero {
    border-bottom-color: rgba(55, 47, 80, 0.08) !important;
    background: rgba(255, 255, 255, 0.34) !important;
}

[data-theme="light"] #archive-modal .archive-hero-icon {
    color: #725fc7;
    border-color: rgba(115, 95, 211, 0.15);
    background: linear-gradient(145deg, rgba(134, 111, 220, 0.13), rgba(255, 255, 255, 0.7));
    box-shadow: 0 12px 28px rgba(70, 57, 116, 0.09), inset 0 1px 0 #fff;
}

[data-theme="light"] #archive-modal .archive-eyebrow {
    color: #7765c8;
}

[data-theme="light"] #archive-modal .archive-heading h2 {
    color: #232431;
}

[data-theme="light"] #archive-modal :is(.archive-heading p, .archive-result-status, .archive-note p) {
    color: #838695;
}

[data-theme="light"] #archive-modal :is(.archive-counter, .archive-close) {
    color: #6e7180;
    border-color: rgba(55, 47, 80, 0.085);
    background: rgba(63, 53, 91, 0.045);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

[data-theme="light"] #archive-modal .archive-close:hover {
    color: var(--accent-dark);
    border-color: rgba(115, 95, 211, 0.18);
    background: rgba(115, 95, 211, 0.08);
}

[data-theme="light"] #archive-modal .archive-search {
    border-color: rgba(55, 47, 80, 0.09);
    background: rgba(255, 255, 255, 0.62);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 4px 13px rgba(42, 38, 61, 0.035);
}

[data-theme="light"] #archive-modal .archive-search:focus-within {
    border-color: rgba(115, 95, 211, 0.3);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 4px rgba(115, 95, 211, 0.075);
}

[data-theme="light"] #archive-modal .archive-search input {
    color: #252633;
}

[data-theme="light"] #archive-modal .archive-search > i,
[data-theme="light"] #archive-modal .archive-search input::placeholder,
[data-theme="light"] #archive-modal .archive-search-clear {
    color: #9497a5;
}

[data-theme="light"] #archive-modal .archive-list-shell {
    border-color: rgba(55, 47, 80, 0.075);
    background: rgba(66, 56, 96, 0.035);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68), inset 0 -24px 60px rgba(67, 60, 92, 0.025);
}

[data-theme="light"] #archive-modal .archive-item {
    background: rgba(255, 255, 255, 0.42);
}

[data-theme="light"] #archive-modal .archive-item:hover,
[data-theme="light"] #archive-modal .archive-item:focus-within {
    border-color: rgba(115, 95, 211, 0.11);
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 10px 26px rgba(43, 39, 63, 0.07);
}

[data-theme="light"] #archive-modal :is(.archive-item-title, .archive-empty h3, .archive-note strong) {
    color: #2a2b37;
}

[data-theme="light"] #archive-modal :is(.archive-item-preview, .archive-item-time, .archive-empty p) {
    color: #898c9b;
}

[data-theme="light"] #archive-modal .archive-item-action {
    color: #777a89;
    border-color: rgba(55, 47, 80, 0.075);
    background: rgba(69, 58, 99, 0.04);
}

[data-theme="light"] #archive-modal .archive-item-action:hover {
    color: var(--accent-dark);
    border-color: rgba(115, 95, 211, 0.17);
    background: rgba(115, 95, 211, 0.08);
}

[data-theme="light"] #archive-modal .archive-note {
    border-color: rgba(115, 95, 211, 0.1);
    background: rgba(115, 95, 211, 0.055);
}

/* Profile, channel, information and administrative dialogs */
[data-theme="light"] :is(#user-profile-modal, #channel-info-modal) {
    background: rgba(222, 226, 237, 0.68);
}

[data-theme="light"] #user-profile-modal .up-modal,
[data-theme="light"] #channel-info-modal .ch-modal {
    color: #252633;
    border-color: rgba(255, 255, 255, 0.96) !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.985), rgba(241, 244, 250, 0.965)) !important;
    box-shadow: 0 42px 115px rgba(43, 48, 70, 0.2), 0 0 0 1px rgba(56, 48, 82, 0.06), inset 0 1.5px 0 #fff !important;
}

[data-theme="light"] #user-profile-modal :is(.up-identity-panel, .up-explorer, .up-card, .up-tabs, .up-action),
[data-theme="light"] #channel-info-modal :is(.ch-hero, .ch-tabs, .ch-info-card, .ch-stat-card, .ch-action-button, .ch-edit-form) {
    border-color: rgba(55, 47, 80, 0.08) !important;
    background-color: rgba(255, 255, 255, 0.47) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

[data-theme="light"] #user-profile-modal :is(.up-title, .up-name, .up-card-title, .up-row strong, .up-member-name),
[data-theme="light"] #channel-info-modal :is(.ch-title, .ch-info-card h3, .ch-stat-value, .ch-member-name, .ch-edit-form h3) {
    color: #262734 !important;
}

[data-theme="light"] #user-profile-modal :is(.up-subtitle, .up-handle, .up-row small, .up-card-subtitle, .up-member-role),
[data-theme="light"] #channel-info-modal :is(.ch-subtitle, .ch-handle, .ch-info-card p, .ch-stat-label, .ch-member-role) {
    color: #858897 !important;
}

[data-theme="light"] #user-profile-modal :is(.up-tab, .up-action, .up-close),
[data-theme="light"] #channel-info-modal :is(.ch-tab, .ch-action-button, .ch-close) {
    color: #686b7a;
}

[data-theme="light"] #user-profile-modal :is(.up-tab.active, .up-tab:hover, .up-action:hover),
[data-theme="light"] #channel-info-modal :is(.ch-tab.active, .ch-tab:hover, .ch-action-button:hover) {
    color: var(--accent-dark) !important;
    border-color: rgba(115, 95, 211, 0.16) !important;
    background: rgba(115, 95, 211, 0.085) !important;
}

[data-theme="light"] :is(#chat-info-modal, #admin-modal, #pinned-msg-modal, #folders-modal, #shortcuts-modal, #qr-modal, #qr-approve-modal, #qr-scanner-modal, #safety-modal) .modal-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.985), rgba(242, 245, 250, 0.97)) !important;
}

[data-theme="light"] :is(.chat-info-avatar-section, .chat-info-row, .chat-info-actions, .admin-section, .folder-item, .pinned-message-item, .shortcut-row, .safety-section) {
    border-color: var(--border-subtle);
    background: rgba(255, 255, 255, 0.48);
}

[data-theme="light"] :is(.chat-info-label, .shortcut-label, .admin-label) {
    color: var(--text-muted);
}

[data-theme="light"] :is(.chat-info-value, .shortcut-row kbd, .admin-value) {
    color: var(--text-primary);
}

[data-theme="light"] .shortcut-row kbd {
    border-color: rgba(55, 47, 80, 0.1);
    background: rgba(63, 53, 91, 0.06);
    box-shadow: 0 2px 0 rgba(55, 47, 80, 0.1);
}

[data-theme="light"] #qr-code,
[data-theme="light"] #qr-approve-code {
    padding: 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    background: #fff;
    box-shadow: var(--shadow-sm);
}

/* Settings, suggestions and background picker reinforcement */
[data-theme="light"] #settings-modal .modal-card-settings {
    border-color: rgba(255, 255, 255, 0.96) !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.985), rgba(241, 244, 250, 0.965)) !important;
    box-shadow: 0 42px 115px rgba(43, 48, 70, 0.2), 0 0 0 1px rgba(56, 48, 82, 0.06), inset 0 1.5px 0 #fff !important;
}

[data-theme="light"] #settings-modal :is(.settings-card, .pacc-card, .sacc-card, .settings-profile-hero) {
    border-color: rgba(55, 47, 80, 0.075) !important;
    background: rgba(255, 255, 255, 0.5) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 7px 22px rgba(44, 40, 64, 0.04);
}

[data-theme="light"] #settings-modal :is(.settings-sidebar, .settings-header, .settings-mobile-nav) {
    border-color: rgba(55, 47, 80, 0.075) !important;
}

[data-theme="light"] #settings-modal .settings-sidebar {
    background: rgba(235, 238, 245, 0.54) !important;
}

[data-theme="light"] #settings-modal :is(.settings-row, .privacy-item, .pacc-row, .sacc-row) {
    border-color: rgba(55, 47, 80, 0.065);
}

[data-theme="light"] #settings-modal :is(.settings-row, .privacy-item, .pacc-row, .sacc-row):hover {
    background: rgba(115, 95, 211, 0.055);
}

[data-theme="light"] #settings-modal :is(.settings-input-wrap, .settings-textarea, input, textarea, select) {
    border-color: rgba(55, 47, 80, 0.09) !important;
    color: #252633 !important;
    background-color: rgba(255, 255, 255, 0.66) !important;
}

[data-theme="light"] #settings-modal .toggle-slider {
    border-color: rgba(55, 47, 80, 0.09);
    background: rgba(70, 59, 102, 0.13);
}

[data-theme="light"] #settings-modal input:checked + .toggle-slider {
    background: linear-gradient(135deg, #8875df, #6854c7);
}

[data-theme="light"] #suggest-modal.suggest-overlay {
    background: rgba(222, 226, 237, 0.68);
}

[data-theme="light"] #suggest-modal .suggest-card {
    border-color: rgba(255, 255, 255, 0.96) !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.985), rgba(241, 244, 250, 0.965)) !important;
    box-shadow: 0 42px 115px rgba(43, 48, 70, 0.2), 0 0 0 1px rgba(56, 48, 82, 0.06), inset 0 1.5px 0 #fff !important;
}

[data-theme="light"] .sys-suggest-banner {
    border-color: rgba(115, 95, 211, 0.15) !important;
    background:
        linear-gradient(120deg, rgba(135, 111, 222, 0.13), rgba(255, 255, 255, 0.57) 52%, rgba(56, 189, 248, 0.075)),
        rgba(249, 249, 253, 0.78) !important;
    box-shadow: 0 10px 26px rgba(62, 51, 105, 0.075), inset 0 1px 0 rgba(255, 255, 255, 0.88) !important;
}

[data-theme="light"] .sys-suggest-kicker {
    color: #6753b0 !important;
}

[data-theme="light"] .sys-suggest-title {
    color: #302b3e !important;
}

[data-theme="light"] :is(.sys-suggest-sub, .sys-suggest-time) {
    color: #666a79 !important;
}

/* Desktop sidebar owns stronger selectors, so keep this contrast contract explicit. */
@media (min-width: 769px) {
    [data-theme="light"] .modern-sidebar > .sidebar-tabs {
        border-color: rgba(58, 50, 85, 0.13) !important;
        background: rgba(220, 224, 233, 0.82) !important;
        box-shadow: inset 0 1px 2px rgba(42, 35, 66, 0.08) !important;
    }

    [data-theme="light"] .modern-sidebar .sidebar-tab {
        color: #666a79 !important;
    }

    [data-theme="light"] .modern-sidebar .sidebar-tab:hover {
        color: #4d426e !important;
        background: rgba(245, 245, 249, 0.66) !important;
    }

    [data-theme="light"] .modern-sidebar .sidebar-tab.active {
        border-color: rgba(115, 95, 211, 0.17) !important;
        color: #493b85 !important;
        background: linear-gradient(145deg, rgba(247, 247, 251, 0.94), rgba(207, 201, 235, 0.76)) !important;
        box-shadow: 0 5px 15px rgba(65, 50, 119, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.84) !important;
    }

    [data-theme="light"] .modern-sidebar .sidebar-action-btn {
        color: #666a79 !important;
        opacity: 1 !important;
    }
}

[data-theme="light"] #suggest-modal :is(.suggest-types, .suggest-textarea-wrap, .suggest-preview) {
    border-color: rgba(55, 47, 80, 0.085) !important;
    background: rgba(255, 255, 255, 0.54) !important;
}

[data-theme="light"] #chat-background-picker.bg-picker-overlay,
[data-theme="light"] .bg-picker-overlay {
    background: rgba(222, 226, 237, 0.67) !important;
}

[data-theme="light"] #chat-background-picker .bg-picker-modal,
[data-theme="light"] .bg-picker-modal {
    border-color: rgba(255, 255, 255, 0.96) !important;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.985), rgba(241, 244, 250, 0.965)) !important;
    box-shadow: 0 42px 115px rgba(43, 48, 70, 0.2), 0 0 0 1px rgba(56, 48, 82, 0.06), inset 0 1.5px 0 #fff !important;
}

[data-theme="light"] .bg-picker-scope {
    border-color: rgba(55, 47, 80, 0.08);
    background: rgba(63, 53, 91, 0.045);
}

[data-theme="light"] .bg-picker-scope-btn {
    color: #707281;
}

[data-theme="light"] .bg-picker-scope-btn.active {
    color: #3c3267;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 5px 15px rgba(47, 40, 72, 0.08), inset 0 1px 0 #fff;
}

/* Voice recording */
[data-theme="light"] #chat-view .recording-bar {
    border-color: rgba(84, 67, 139, 0.11) !important;
    background: linear-gradient(115deg, rgba(132, 104, 220, 0.08), transparent 44%), rgba(255, 255, 255, 0.73) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.94), 0 8px 24px rgba(56, 44, 91, 0.07) !important;
}

[data-theme="light"] #chat-view .composer.recording-active {
    border-color: rgba(84, 67, 139, 0.11) !important;
    background: rgba(250, 250, 253, 0.84) !important;
    box-shadow: 0 12px 34px rgba(47, 42, 69, 0.08), inset 0 1px 0 #fff !important;
}

[data-theme="light"] #chat-view :is(.rec-bar-state, .rec-bar-timer) {
    color: #4e4b5c;
}

[data-theme="light"] #chat-view .rec-bar-caption {
    color: #92909c;
}

[data-theme="light"] #chat-view :is(.rec-bar-cancel, .rec-bar-pause) {
    border-color: rgba(55, 47, 80, 0.085);
    color: #6d6c7a;
    background: rgba(66, 56, 96, 0.045);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

[data-theme="light"] #chat-view .rec-bar-wave span {
    background: linear-gradient(180deg, rgba(129, 107, 221, 0.86), rgba(104, 83, 190, 0.4));
}

/* Media, previews and empty states */
[data-theme="light"] :is(.media-viewer, .lightbox-overlay) {
    background: rgba(226, 229, 237, 0.88);
}

[data-theme="light"] :is(.lightbox-close, .lightbox-prev, .lightbox-next, .media-viewer-close) {
    color: #4d4c59;
    border-color: rgba(55, 47, 80, 0.09);
    background: rgba(255, 255, 255, 0.76);
    box-shadow: var(--shadow-md);
}

[data-theme="light"] :is(.empty-state, .no-chats, .search-empty, .archive-empty) {
    color: var(--text-secondary);
}

[data-theme="light"] :is(.empty-state, .no-chats, .search-empty, .archive-empty) i {
    color: rgba(115, 95, 211, 0.52);
}

@media (max-width: 768px) {
    [data-theme="light"] .modern-sidebar {
        border-right: 0 !important;
        background:
            linear-gradient(180deg, rgba(239, 241, 246, 0.94), rgba(224, 228, 236, 0.87)) !important;
    }

    [data-theme="light"] #chat-view .chat-topbar {
        background: rgba(235, 238, 244, 0.92) !important;
    }

    [data-theme="light"] #chat-view .composer {
        background: rgba(231, 234, 241, 0.94) !important;
    }

    [data-theme="light"] #new-chat-modal.create-overlay,
    [data-theme="light"] #archive-modal.archive-overlay,
    [data-theme="light"] #settings-modal,
    [data-theme="light"] #suggest-modal.suggest-overlay,
    [data-theme="light"] #user-profile-modal,
    [data-theme="light"] #channel-info-modal {
        background: rgba(218, 222, 233, 0.64) !important;
    }

    [data-theme="light"] #new-chat-modal .cch-handle,
    [data-theme="light"] #archive-modal .archive-handle,
    [data-theme="light"] #settings-modal .settings-modal-handle,
    [data-theme="light"] #suggest-modal .suggest-handle,
    [data-theme="light"] #user-profile-modal .up-handle,
    [data-theme="light"] #channel-info-modal .ch-handle {
        background: rgba(43, 38, 61, 0.2) !important;
    }

    [data-theme="light"] #new-chat-modal .cch-sidebar {
        border-bottom-color: rgba(55, 47, 80, 0.075);
        background: rgba(237, 239, 246, 0.74);
    }

    [data-theme="light"] #new-chat-modal .cch-footer {
        background: rgba(241, 243, 248, 0.9);
    }

    [data-theme="light"] #archive-modal .archive-toolbar {
        background: transparent;
    }
}

@media (prefers-contrast: more) {
    [data-theme="light"] {
        --text-secondary: #444755;
        --text-muted: #666a78;
        --border-subtle: rgba(40, 34, 58, 0.16);
        --border-light: rgba(40, 34, 58, 0.22);
    }

    [data-theme="light"] :is(.modal-card, .chat-item, .message-bubble, .input-wrapper) {
        border-width: 1px;
    }
}

@media (prefers-reduced-transparency: reduce) {
    [data-theme="light"] :is(.modern-sidebar, .chat-topbar, .composer, .modal-card, .context-menu, .emoji-panel) {
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        background-color: #eef0f5 !important;
    }
}

/* Final contrast pass for small labels and feature-owned hardcoded colors. */
[data-theme="light"] #user-profile-modal.up-overlay,
[data-theme="light"] #channel-info-modal.modal-overlay {
    background:
        radial-gradient(circle at 14% 10%, rgba(126, 103, 214, 0.15), transparent 36%),
        radial-gradient(circle at 90% 90%, rgba(55, 168, 211, 0.09), transparent 34%),
        rgba(222, 226, 237, 0.7) !important;
}

[data-theme="light"] #new-chat-modal :is(.cch-seg-copy small, .cch-privacy-note, .cch-search-state, .cch-members:empty::before),
[data-theme="light"] #archive-modal :is(.archive-heading p, .archive-result-status, .archive-item-preview, .archive-item-time, .archive-empty p, .archive-note p),
[data-theme="light"] #settings-modal :is(.settings-header-context small, .settings-account-copy small, .settings-account-copy > span, .settings-page-header p, .settings-section-header small, .settings-toggle-info small, .privacy-item-info small, .settings-field label),
[data-theme="light"] #suggest-modal :is(.suggest-desc, .suggest-type small, .suggest-draft-state, .suggest-hint, .suggest-section-label, .suggest-counter, .suggest-shortcut) {
    color: #777b8b !important;
}

[data-theme="light"] #channel-info-modal :is(.ch-hero-eyebrow, .ch-pane-kicker, .ch-info-label, .ch-stat-label) {
    color: #7467ae !important;
}

[data-theme="light"] #channel-info-modal :is(.ch-sub-count, .ch-subline, .ch-hero-note, .ch-info-text, .ch-member-role, .ch-members-empty) {
    color: #737786 !important;
}

[data-theme="light"] #channel-info-modal :is(.ch-name, .ch-pane-heading h3, .ch-section-title, .ch-manage-heading, .ch-action-copy strong, .ch-field label) {
    color: #292a36 !important;
}

[data-theme="light"] #channel-info-modal :is(.ch-search-wrap, .ch-field input, .ch-field textarea, .ch-type-toggle) {
    border-color: rgba(55, 47, 80, 0.09) !important;
    color: #292a36 !important;
    background: rgba(255, 255, 255, 0.64) !important;
}

[data-theme="light"] #channel-info-modal :is(.ch-member-row, .ch-add-member) {
    border-color: rgba(55, 47, 80, 0.075) !important;
    background: rgba(255, 255, 255, 0.45) !important;
}

[data-theme="light"] #user-profile-modal :is(.up-profile-kicker, .up-section-eyebrow, .up-detail-label) {
    color: #7566b7 !important;
}

[data-theme="light"] #user-profile-modal :is(.up-status-text, .up-private-pill, .up-card-title, .up-media-empty, .up-member-role) {
    color: #747786 !important;
}

[data-theme="light"] #user-profile-modal :is(.up-detail-value, .up-member-name, .up-explorer-header h3) {
    color: #292a36 !important;
}

[data-theme="light"] #user-profile-modal :is(.up-detail-row, .up-member-row, .up-media-empty) {
    border-color: rgba(55, 47, 80, 0.075) !important;
    background: rgba(255, 255, 255, 0.44) !important;
}

[data-theme="light"] #suggest-modal :is(.suggest-kicker, .suggest-section-label) {
    color: #7564ba !important;
}

[data-theme="light"] #suggest-modal :is(.suggest-title, .suggest-compose-head strong, .suggest-type strong) {
    color: #2b2936 !important;
}

[data-theme="light"] #suggest-modal .suggest-type {
    color: #34323f;
    border-color: transparent;
}

[data-theme="light"] #suggest-modal .suggest-type:hover {
    background: rgba(115, 95, 211, 0.055);
}

[data-theme="light"] #suggest-modal .suggest-type.active {
    border-color: rgba(115, 95, 211, 0.17) !important;
    background: rgba(115, 95, 211, 0.085) !important;
}

[data-theme="light"] #suggest-modal .suggest-textarea-wrap textarea {
    color: #2d2d38 !important;
}

[data-theme="light"] #settings-modal :is(.settings-page-header h2, .settings-section-header strong, .settings-toggle-info strong, .privacy-item-info strong, .settings-account-copy strong) {
    color: #292a36 !important;
}

[data-theme="light"] #settings-modal .settings-sidebar-label {
    color: #868999 !important;
}

[data-theme="light"] #settings-modal .settings-sidebar .settings-tab {
    color: #676b7a !important;
}

[data-theme="light"] #settings-modal .settings-sidebar .settings-tab.active {
    color: #493b85 !important;
}

@media (max-width: 768px) {
    [data-theme="light"] .modern-sidebar {
        background:
            linear-gradient(180deg, rgba(239, 241, 246, 0.96), rgba(223, 227, 235, 0.91)) !important;
    }

    [data-theme="light"] .mobile-chats-heading-copy > span,
    [data-theme="light"] .chat-name {
        color: #292a36 !important;
    }

    [data-theme="light"] :is(.mobile-chats-heading-copy small, .chat-preview, .chat-time, .sidebar-brand-summary) {
        color: #777b8a !important;
    }

    [data-theme="light"] .chat-item {
        background: rgba(226, 229, 236, 0.62);
    }

    [data-theme="light"] .chat-item:hover,
    [data-theme="light"] .chat-item.active {
        background: rgba(242, 243, 248, 0.9);
    }
}

/* ===== Light theme: delivery ticks in sidebar chat previews ===== */

[data-theme="light"] .chat-preview-status [data-status="sent"] {
    color: rgba(84, 78, 103, 0.6);
}

[data-theme="light"] .chat-preview-status [data-status="delivered"] {
    color: rgb(30, 139, 101);
}

[data-theme="light"] .chat-preview-status [data-status="read"] {
    color: rgb(103, 75, 201);
    filter: drop-shadow(0 0 2px rgba(103, 75, 201, 0.25));
}

[data-theme="light"] .chat-preview-you {
    color: rgba(84, 78, 103, 0.75);
}
