:root {
    --theme-bg: #f5f9ff;
    --theme-surface: #ffffff;
    --theme-surface-2: #f8fbff;
    --theme-border: #dfe8f5;
    --theme-text: #101b35;
    --theme-muted: #71809a;
}

:root[data-theme="dark"] {
    --ink: #f4f7fb;
    --muted: #a4adbb;
    --line: #242936;
    --soft: #10141d;
    --canvas: #050608;
    --blue: #7aa8ff;
    --blue-2: #2878ff;
    --green: #34d399;
    --danger: #fb7185;
    --theme-bg: #050608;
    --theme-surface: #0a0d12;
    --theme-surface-2: #10141d;
    --theme-border: #252b36;
    --theme-text: #f4f7fb;
    --theme-muted: #a4adbb;
}

:root[data-theme="dark"] body {
    color: var(--theme-text) !important;
    background: #050608 !important;
}

:root[data-theme="dark"] :where(
    .product-rail,
    .icon-rail,
    .conversation-sidebar,
    .minutes-sidebar,
    .sidebar,
    .chat-card,
    .panel-card,
    .preview-panel,
    .knowledge-content,
    .settings-card,
    .provider-form-card,
    .account-popover,
    .laiya-profile-modal,
    .citation-dialog article,
    .modal,
    .dialog,
    .provider-modal-card,
    .workflow-header,
    .inspector-panel,
    .result-panel,
    .canvas-toolbar,
    .node-library,
    .transcript-panel,
    .summary-panel
) {
    color: var(--theme-text) !important;
    border-color: var(--theme-border) !important;
    background: color-mix(in srgb, var(--theme-surface) 94%, transparent) !important;
}

:root[data-theme="dark"] .chat-topbar,
:root[data-theme="dark"] .privacy-dialog article,
:root[data-theme="dark"] .privacy-dialog footer,
:root[data-theme="dark"] .privacy-dialog footer button {
    color: var(--theme-text) !important;
    border-color: var(--theme-border) !important;
    background: var(--theme-surface) !important;
}

:root[data-theme="dark"] .privacy-dialog p {
    color: var(--theme-muted) !important;
}

:root[data-theme="dark"] :where(
    .chat-stage,
    .saoya-content,
    .knowledge-content,
    .settings-main,
    .app-shell,
    .workflow-shell,
    .minutes-space-shell,
    .assistant-shell,
    .knowledge-shell
) {
    background: transparent !important;
}

:root[data-theme="dark"] :where(
    input,
    textarea,
    select,
    .conversation-search,
    .search-field,
    .field input,
    .field textarea,
    .field select,
    .composer,
    .composer-box,
    .demo-answer-card,
    .message.assistant .bubble,
    .message.user .bubble,
    .knowledge-card,
    .doc-card,
    .result-card,
    .source-card,
    .form-card,
    .laiya-profile-card
) {
    color: var(--theme-text) !important;
    border-color: var(--theme-border) !important;
    background: var(--theme-surface-2) !important;
}

:root[data-theme="dark"] :where(
    .rail-link,
    .rail-btn,
    .mode-pill,
    .lamp,
    .icon-action,
    .quiet-button,
    .secondary-button,
    .sidebar-toggle-button,
    .quick-menu-button,
    .citation-chip,
    .segmented button,
    .popover-action,
    .laiya-profile-secondary,
    .view-all-button
) {
    color: var(--theme-muted);
    border-color: var(--theme-border) !important;
    background: transparent;
}

:root[data-theme="dark"] :where(.rail-link:hover, .rail-link.active, .rail-btn:hover, .rail-btn.active, .mode-pill.active, .segmented button.active) {
    color: #8db7ff !important;
    background: rgba(45, 112, 255, .16) !important;
}

:root[data-theme="dark"] :where(
    h1,
    h2,
    h3,
    h4,
    strong,
    .title-row h1,
    .panel-heading h3,
    .message-label strong,
    .assistant-meta strong,
    .conversation-main strong
) {
    color: var(--theme-text) !important;
}

:root[data-theme="dark"] :where(
    p,
    small,
    time,
    label,
    .muted,
    .conversation-main small,
    .conversation-main time,
    .account-summary span,
    .laiya-profile-header p,
    .laiya-profile-card-title span,
    .laiya-profile-field span
) {
    color: var(--theme-muted) !important;
}

:root[data-theme="dark"] input::placeholder,
:root[data-theme="dark"] textarea::placeholder {
    color: #7588a7 !important;
}

:root[data-theme="dark"] :where(.brand-mark img, .header-logo, .ai-avatar img, .message-avatar.ai-avatar img) {
    filter: drop-shadow(0 4px 12px rgba(99, 160, 255, .18));
}

/* The rail switches to the supplied dark-mode artwork without replacing it with a CSS background. */
:root[data-theme="dark"] :where(.laiya-product-rail .brand-mark, .header-brand) {
    background: transparent !important;
}

:root[data-theme="dark"] :where(.laiya-product-rail .brand-mark img, .header-brand img) {
    opacity: 1 !important;
    filter: drop-shadow(0 4px 12px rgba(99, 160, 255, .18));
}

:root[data-theme="dark"] :where(.account-button.has-avatar, .avatar-button.has-avatar) {
    background: var(--theme-surface) !important;
}

:root[data-theme="dark"] :where(table, th, td) {
    border-color: var(--theme-border) !important;
}

:root[data-theme="dark"] :where(th) {
    background: #121821 !important;
}

:root[data-theme="dark"] :where(.toast) {
    color: var(--theme-text);
    border-color: var(--theme-border);
    background: var(--theme-surface);
}

:root[data-theme="dark"] :where(
    .conversation-sidebar,
    .minutes-sidebar,
    .sidebar,
    .settings-nav,
    .provider-list-card,
    .provider-form-card,
    .provider-config-item,
    .settings-health,
    .health-card,
    .panel-card,
    .preview-card,
    .control-group,
    .payload-preview,
    .preview-panel,
    .source-import-row,
    .document-panel,
    .file-table,
    .file-card,
    .file-row,
    .empty-card,
    .modal-card,
    .dialog-card,
    .dialog-panel,
    .audio-deck,
    .review-card,
    .summary-document,
    .workflow-node,
    .node-card,
    .node-library,
    .canvas-settings-panel,
    .settings-modal,
    .canvas-settings-dialog,
    .laiya-profile-header,
    .laiya-profile-footer,
    .laiya-profile-avatar-card,
    .laiya-profile-card
) {
    color: var(--theme-text) !important;
    border-color: var(--theme-border) !important;
    background: var(--theme-surface) !important;
    box-shadow: 0 18px 42px rgba(0, 0, 0, .24) !important;
}

:root[data-theme="dark"] :where(
    .product-main,
    .workspace-main,
    .content-area,
    .files-area,
    .file-area,
    .app-main,
    .workflows-main,
    .workflow-editor,
    .workflow-canvas,
    .canvas-viewport,
    .canvas-layer,
    .knowledge-content,
    .saoya-content,
    .jiya-workbench,
    .chat-stage,
    .settings-main
) {
    background: var(--theme-bg) !important;
    color: var(--theme-text) !important;
}

:root[data-theme="dark"] :where(
    .topbar,
    .workspace-topbar,
    .file-toolbar,
    .toolbar,
    .workflow-header,
    .jiya-header,
    .panel-heading,
    .preview-heading,
    .section-header,
    .provider-form-heading,
    .models-heading,
    .provider-form-actions,
    .laiya-profile-header,
    .laiya-profile-footer,
    .citation-dialog header,
    .account-summary
) {
    border-color: var(--theme-border) !important;
    background: var(--theme-surface) !important;
}

:root[data-theme="dark"] :where(
    input,
    textarea,
    select,
    .search-control,
    .search-field,
    .compact-search,
    .conversation-search,
    .conversation-menu,
    .model-picker-menu,
    .model-picker-option,
    .inline-confirm,
    .empty-guide-logo,
    .segmented,
    .type-tabs,
    .choice-grid button,
    .color-input input,
    .number-grid input,
    .mini-check,
    .theme-row button,
    .logo-actions button,
    .quiet-action,
    .secondary-button,
    .quiet-button,
    .danger-quiet-button,
    .header-button,
    .icon-button,
    .icon-action,
    .expand-button,
    .sidebar-toggle-button,
    .quick-menu-button,
    .folder-main,
    .folder-action,
    .conversation-main,
    .conversation-menu-trigger,
    .conversation-actions button,
    .model-picker-button,
    .model-switch,
    .mode-pill,
    .lamp,
    .theme-options button,
    .sound-toggle,
    .memory-toggle,
    .capability-checks,
    .provider-model-row input,
    .provider-model-row > button,
    .form-grid input,
    .form-grid select,
    .status-pill,
    .resolution-select,
    .export-actions button,
    .action-grid button,
    .view-tabs button,
    .format-grid button,
    .copy-button,
    .mini-action,
    .back-button,
    .title-row span
) {
    color: var(--theme-text) !important;
    border-color: #303744 !important;
    background: var(--theme-surface-2) !important;
}

:root[data-theme="dark"] :where(
    .control-group > strong,
    .color-row label,
    .number-grid label,
    .logo-file,
    .payload-preview span,
    .preview-heading span,
    .field span,
    .field-message,
    .title-row span
) {
    color: var(--theme-muted) !important;
}

:root[data-theme="dark"] :where(
    .payload-preview code,
    .preview-heading strong
) {
    color: var(--theme-text) !important;
}

:root[data-theme="dark"] :where(.preview-stage) {
    border-color: var(--theme-border) !important;
    background-color: #090d13 !important;
    background-image:
        radial-gradient(circle, rgba(122, 168, 255, .24) 1px, transparent 1px),
        linear-gradient(180deg, rgba(13, 17, 24, .86), rgba(5, 6, 8, .98)) !important;
}

:root[data-theme="dark"] :where(
    .conversation-item:hover .conversation-main,
    .folder-main:hover,
    .model-picker-option.active,
    .model-picker-option:hover,
    .provider-config-item.active,
    .provider-config-item:hover,
    .choice-grid button.active,
    .logo-actions button.active,
    .theme-row button.active,
    .theme-options button.active,
    .settings-nav button.active,
    .settings-nav button:hover,
    .source-filter.active,
    .sidebar-item.active,
    .category-card.active
) {
    color: #9ec5ff !important;
    border-color: #6da1ff !important;
    background: rgba(45, 112, 255, .18) !important;
    box-shadow: inset 0 0 0 1px rgba(109, 161, 255, .18) !important;
}

:root[data-theme="dark"] .conversation-item.active .conversation-main,
:root[data-theme="dark"] .folder-item.active .folder-main {
    color: var(--theme-text) !important;
    border-color: transparent !important;
    background: transparent !important;
    box-shadow: none !important;
}

:root[data-theme="dark"] .folder-item.active .folder-main b {
    color: var(--theme-muted) !important;
}

:root[data-theme="dark"] :where(.model-usage-card) {
    color: var(--theme-text) !important;
    border-color: #242936 !important;
    background: #080a0f !important;
}

:root[data-theme="dark"] :where(.usage-range-tabs, .usage-panel, .usage-summary-grid div) {
    color: var(--theme-text) !important;
    border-color: #272d39 !important;
    background: #0d1016 !important;
}

:root[data-theme="dark"] :where(.usage-range-tabs button.active) {
    color: #eaf1ff !important;
    background: linear-gradient(180deg, #1f5ed7 0%, #123b92 100%) !important;
    box-shadow: none !important;
}

:root[data-theme="dark"] :where(.usage-card-heading p, .heatmap-legend, #usageThroughDate, .usage-summary-grid span, .usage-model-row span, .usage-empty) {
    color: #a4a0bb !important;
}

:root[data-theme="dark"] .usage-donut::after {
    background: #0d1016 !important;
}

:root[data-theme="dark"] .usage-day { background: #12161f !important; }
:root[data-theme="dark"] .usage-day.level-1 { background: #1b2942 !important; }
:root[data-theme="dark"] .usage-day.level-2 { background: #244b83 !important; }
:root[data-theme="dark"] .usage-day.level-3 { background: #1e67d8 !important; }
:root[data-theme="dark"] .usage-day.level-4 { background: #3b82f6 !important; }

:root[data-theme="dark"] .usage-tooltip {
    color: var(--theme-text) !important;
    border-color: #2b3340 !important;
    background: rgba(10, 12, 17, .98) !important;
    box-shadow: 0 18px 42px rgba(0, 0, 0, .42) !important;
}

:root[data-theme="dark"] .usage-tooltip span {
    color: #aab4c7 !important;
}

:root[data-theme="dark"] :where(
    .demo-user-bubble,
    .message.user .bubble
) {
    color: #eaf1ff !important;
    background: #10233f !important;
}

:root[data-theme="dark"] :where(
    .demo-answer-card,
    .message.assistant .bubble,
    .citation-dialog article,
    .citation-dialog pre,
    .account-popover,
    .composer,
    .composer-box,
    .attachment-status,
    .source-select,
    .document-card,
    .result-card,
    .detail-dialog article,
    .detail-dialog pre
) {
    color: var(--theme-text) !important;
    border-color: var(--theme-border) !important;
    background: #0f141d !important;
}

:root[data-theme="dark"] :where(
    .poster-card,
    .qr-holder,
    .preview-poster
) {
    color: #101b35 !important;
    background: #ffffff !important;
}

:root[data-theme="dark"] :where(
    .poster-card p,
    .poster-card strong,
    .qr-content,
    .qr-preview-text
) {
    color: #17243a !important;
}

:root[data-theme="dark"] :where(
    .search-control input,
    .search-field input,
    .compact-search input,
    .conversation-search input,
    .model-switch select,
    .composer textarea
) {
    background: transparent !important;
}

:root[data-theme="dark"] :where(
    .provider-config-icon,
    .panel-icon,
    .laiya-profile-icon,
    .ai-avatar,
    .message-avatar.ai-avatar,
    .demo-avatar,
    .empty-guide-logo,
    .message-avatar.user-avatar
) {
    border-color: #303744 !important;
    background: #141a24 !important;
}

:root[data-theme="dark"] :where(.provider-config-icon img, .ai-avatar img, .message-avatar.ai-avatar img) {
    width: 78% !important;
    height: 78% !important;
    object-fit: contain !important;
    filter: drop-shadow(0 5px 14px rgba(122, 168, 255, .2)) !important;
}

:root[data-theme="dark"] .provider-config-icon,
:root[data-theme="dark"] .dropzone-icon,
:root[data-theme="dark"] .upload-dropzone,
:root[data-theme="dark"] .refresh-button,
:root[data-theme="dark"] .view-toggle {
    color: #8fbaff !important;
    border-color: #303744 !important;
    background: #141a24 !important;
}

:root[data-theme="dark"] .upload-dropzone {
    background: #0f141d !important;
}

:root[data-theme="dark"] .model-tabs,
:root[data-theme="dark"] .model-tabs button.active,
:root[data-theme="dark"] .default-model-chip,
:root[data-theme="dark"] .view-toggle button.active {
    color: var(--theme-text) !important;
    border-color: #303744 !important;
    background: #10141d !important;
    box-shadow: none !important;
}

:root[data-theme="dark"] :where(
    .provider-config-copy span,
    .usage-strip,
    .empty-guide p,
    .inline-confirm p,
    .folder-main b,
    .section-kicker,
    .save-status,
    .time-readout,
    .task-empty p
) {
    color: var(--theme-muted) !important;
}

:root[data-theme="dark"] :where(
    .primary-button,
    .new-chat-button,
    .primary-action,
    .action-grid .primary-action,
    .record-button,
    #sendButton
) {
    color: #ffffff !important;
    border-color: transparent !important;
    background: linear-gradient(180deg, #2f83ff 0%, #1163ff 100%) !important;
}

:root[data-theme="dark"] :where(
    .workspace-grid,
    .file-list,
    .session-table,
    .table-shell,
    .transcript-stream,
    .content-nodes,
    .task-list,
    .inspector-empty,
    .node-empty,
    .document-list,
    .result-list
) {
    color: var(--theme-text) !important;
    border-color: var(--theme-border) !important;
    background: #080b10 !important;
}

:root[data-theme="dark"] :where(
    .workspace-card,
    .session-row,
    .transcript-item,
    .task-item,
    .content-node,
    .document-item,
    .search-result,
    .knowledge-card
) {
    color: var(--theme-text) !important;
    border-color: var(--theme-border) !important;
    background: #101722 !important;
}

:root[data-theme="dark"] :where(
    .canvas,
    .flow-canvas,
    .react-flow,
    .workflow-canvas-surface,
    .canvas-surface,
    .canvas-board
) {
    background-color: #050608 !important;
    background-image: radial-gradient(circle, rgba(148, 163, 184, .26) 1px, transparent 1px) !important;
    background-size: 24px 24px !important;
}

:root[data-theme="dark"] :where(
    .laiya-profile-overlay
) {
    background: rgba(3, 7, 18, .72) !important;
}

:root[data-theme="dark"] :where(.laiya-profile-body) {
    background: #090d13 !important;
}

:root[data-theme="dark"] :where(.status-pill:not(.ready)) {
    color: #ffd166 !important;
    background: rgba(245, 158, 11, .16) !important;
}

:root[data-theme="dark"] :where(.status-pill.ready, .attachment-status.ready) {
    color: #78f0bd !important;
    background: rgba(16, 185, 129, .15) !important;
}

:root[data-theme="dark"] :where(.toast.error) {
    color: #fecdd3 !important;
    border-color: rgba(251, 113, 133, .5) !important;
    background: #2b1620 !important;
}

:root[data-theme="dark"] :where(
    .workspace,
    .workspace-header,
    .content-area,
    .file-collection,
    .space-nav,
    .space-nav-item,
    .folder-row,
    .folder-row-wrap,
    .select-control,
    .loading-state,
    .empty-state,
    .empty-visual,
    .modal-overlay .modal-card,
    .modal-header,
    .modal-body,
    .modal-footer,
    .workflow-stage,
    .inspector,
    .inspector-form,
    .inspector-scroll,
    .inspector-header,
    .attachment-field,
    .attachment-list,
    .attachment-item,
    .sender-fields,
    .sender-source-panel,
    .sender-source-option,
    .contact-import-panel,
    .contact-preview,
    .node-result,
    .node-result > #nodeResultContent,
    .result-download-menu,
    .schedule-center,
    .schedule-center-body,
    .schedule-form,
    .schedule-overview,
    .schedule-card,
    .schedule-empty,
    .server-run-item,
    .provider-center,
    .provider-center-body,
    .provider-list-panel,
    .provider-form,
    .endpoint-section,
    .model-section,
    .provider-model-row,
    .provider-form-grid input,
    .provider-form-grid select,
    .provider-form-grid textarea,
    .run-drawer,
    .run-summary,
    .run-log-item,
    .workflow-dock,
    .zoom-controls,
    .stage-tip,
    .view-switcher,
    .audio-meta,
    .player-row,
    .waveform-shell,
    .transcript-entry,
    .interim-line,
    .intelligence-header,
    .insight-section,
    .task-empty,
    .export-dialog form,
    .format-grid button,
    .upload-dropzone,
    .upload-panel,
    .studio-panel,
    .library-search,
    .record-panel,
    .transfer-panel,
    .session-table,
    .sessions-toolbar,
    .session-item,
    .context-menu,
    .action-dialog,
    .audio-export-row
) {
    color: var(--theme-text) !important;
    border-color: var(--theme-border) !important;
    background: var(--theme-surface) !important;
}

:root[data-theme="dark"] :where(
    .file-card-preview,
    .file-preview,
    .file-icon,
    .session-icon,
    .label-icon,
    .dropzone-icon,
    .upload-file-icon,
    .empty-icon,
    .run-log-icon,
    .inspector-empty-icon,
    .library-icon,
    .node-icon,
    .modal-icon,
    .empty-visual,
    .upload-icon
    ,.node-kind-icon
    ,.inspector-icon
    ,.library-node-icon
    ,.session-source-icon
    ,.message-attachment-icon
    ,.reference-document-icon
) {
    color: #8fbaff !important;
    border-color: #303744 !important;
    background: #141a24 !important;
}

:root[data-theme="dark"] :where(
    .workflow-stage,
    .canvas-viewport
) {
    background-color: #050608 !important;
    background-image: radial-gradient(circle, rgba(148, 163, 184, .24) 1px, transparent 1px) !important;
    background-size: 24px 24px !important;
}

:root[data-theme="dark"] :where(
    .workflow-node,
    .workflow-node .node-head,
    .workflow-node .node-body,
    .inspector,
    .inspector-form,
    .inspector-header,
    .inspector-scroll,
    .attachment-field,
    .attachment-empty,
    .attachment-item,
    .message-attachment-card,
    .reference-dialog article,
    .reference-group,
    .reference-dialog header,
    .reference-dialog footer
) {
    color: var(--theme-text) !important;
    border-color: #252b36 !important;
    background: #0a0d12 !important;
}

:root[data-theme="dark"] :where(
    .node-inline-editor,
    .node-mode-select,
    .field input,
    .field textarea,
    .field select,
    .attachment-empty,
    .attachment-item,
    .reference-search,
    .reference-group-heading,
    .reference-document:hover,
    .reference-dialog button,
    .node-attach-button,
    .attachment-field-heading button
) {
    color: var(--theme-text) !important;
    border-color: #303744 !important;
    background: #10141d !important;
}

:root[data-theme="dark"] .reference-document {
    border-color: #252b36 !important;
}

:root[data-theme="dark"] :where(
    .file-card.workflow-card .file-preview,
    .workflow-space .file-card.workflow-card .file-preview,
    .file-preview
) {
    background-color: #0a0d12 !important;
    background-image: radial-gradient(circle, rgba(148, 163, 184, .22) 1px, transparent 1.2px) !important;
}

:root[data-theme="dark"] :where(
    .workflow-preview,
    .file-kind-label,
    .list-view .file-list-kind,
    .dropzone-icon,
    .upload-file-icon,
    .view-toggle button,
    .refresh-button,
    .session-source-icon
) {
    color: #8fbaff !important;
    border-color: #303744 !important;
    background: #141a24 !important;
    box-shadow: none !important;
}

:root[data-theme="dark"] .message.user .bubble {
    color: #eef2f8 !important;
    background: #151922 !important;
}

:root[data-theme="dark"] :where(.reference-button, .reference-dialog, .message-attachment-card) {
    color: var(--theme-text) !important;
    border-color: #303744 !important;
    background: #10141d !important;
}

:root[data-theme="dark"] :where(
    .file-preview::after,
    .file-card-preview::after
) {
    border-color: rgba(255, 255, 255, .08) !important;
    background: rgba(16, 20, 29, .74) !important;
    box-shadow: 0 14px 30px rgba(0, 0, 0, .24) !important;
}

:root[data-theme="dark"] .file-preview::after,
:root[data-theme="dark"] .file-card.workflow-card .file-preview::after,
:root[data-theme="dark"] .workflow-space .file-card.workflow-card .file-preview::after {
    border-color: #303744 !important;
    background: #10141d !important;
    box-shadow: 0 14px 30px rgba(0, 0, 0, .28) !important;
    backdrop-filter: none !important;
}

:root[data-theme="dark"] .node-attach-button,
:root[data-theme="dark"] .attachment-field-heading button {
    color: #8fbaff !important;
    border-color: #303744 !important;
    background: #141a24 !important;
}

:root[data-theme="dark"] :where(
    .list-view .file-list-kind,
    .node-model,
    .run-status-chip,
    .inspector-collapse-control,
    .node-attachment-action,
    .search-toggle-field,
    .upload-dropzone button,
    .sessions-toolbar button,
    .view-toggle button
) {
    color: var(--theme-text) !important;
    border-color: #303744 !important;
    background: #10141d !important;
}

:root[data-theme="dark"] :where(
    .inspector-resize-handle::after
) {
    background: #303744 !important;
}

:root[data-theme="dark"] :where(
    .file-card:hover,
    .file-row:hover,
    .session-item:hover,
    .folder-row:hover,
    .folder-row-wrap.active,
    .space-nav-item.active,
    .space-nav-item:hover,
    .view-switcher button.active,
    .workflow-dock button.active,
    .settings-option.active,
    .settings-option:hover
) {
    color: #9ec5ff !important;
    border-color: #6da1ff !important;
    background: rgba(45, 112, 255, .18) !important;
}

:root[data-theme="dark"] :where(
    .settings-option,
    .segmented-grid button,
    .node-mode-select,
    .node-inline-editor,
    .node-attachment-action,
    .result-download-primary,
    .result-download-more,
    .schedule-weekdays span,
    .schedule-card-actions button,
    .provider-list-title button,
    .provider-status-pill,
    .capability-checks label,
    .sender-source-heading button,
    .contact-import-actions button,
    .contact-variables code,
    .audio-tools select,
    .jump-button,
    .choose-file-button,
    .view-toggle,
    .source-filter,
    .folder-add,
    kbd
) {
    color: var(--theme-text) !important;
    border-color: #303744 !important;
    background: var(--theme-surface-2) !important;
}

:root[data-theme="dark"] :where(
    .provider-security-note,
    .sender-source-intro,
    .sender-source-empty,
    .sender-deliverability-hint,
    .attachment-status,
    .schedule-form-message,
    .provider-form-message,
    .file-meta,
    .session-meta,
    .empty-state p,
    .loading-state p
) {
    color: var(--theme-muted) !important;
}

:root[data-theme="dark"] :where(
    .provider-status-pill.ready,
    .status-pill.completed,
    .status-pill.processing,
    .status-pill.ready
) {
    color: #78f0bd !important;
    background: rgba(16, 185, 129, .15) !important;
}

/* Laiya shared interaction layer (Plan 2). Components keep their geometry,
   while this layer gives buttons, controls and elevated surfaces one visual
   contract across 问鸭、知鸭 and 设置. */
:root {
    --la-control-bg: #ffffff;
    --la-control-bg-hover: #f1f6ff;
    --la-control-border: #d7e2f0;
    --la-control-text: #233552;
    --la-primary: #1268f8;
    --la-primary-hover: #0b58db;
    --la-focus: rgba(18, 104, 248, .28);
}

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

:where(button, input, textarea, select):focus-visible {
    outline: 3px solid var(--la-focus);
    outline-offset: 2px;
}

:where(.quiet-action, .primary-action, .result-card button, .source-option button,
    .view-toggle button, .theme-options button, .settings-nav button,
    .default-model-chip, .default-model-option, .model-tabs button,
    .usage-range-tabs button, .empty-import-button, .file-type,
    .card-menu button, .folder-action, .conversation-actions button) {
    min-width: 0;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    white-space: nowrap;
    word-break: keep-all;
}

:where(.quiet-action, .result-card button, .source-option button,
    .empty-import-button, .file-type, .default-model-chip) {
    border-color: var(--la-control-border);
    background: var(--la-control-bg);
    color: var(--la-control-text);
    transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

:where(.quiet-action, .result-card button, .source-option button,
    .empty-import-button, .file-type, .default-model-chip):hover {
    border-color: #9dbcf1;
    background: var(--la-control-bg-hover);
    color: var(--la-primary);
}

:where(.primary-action, .new-chat-button, #sendButton, .import-fab) {
    border-color: transparent;
    background: linear-gradient(180deg, #2e83ff 0%, #1268f8 100%);
    color: #fff;
}

:where(.primary-action, .new-chat-button, #sendButton, .import-fab):hover {
    background: linear-gradient(180deg, #4a95ff 0%, var(--la-primary-hover) 100%);
    transform: translateY(-1px);
}

:root[data-theme="dark"] {
    --la-control-bg: #121923;
    --la-control-bg-hover: #19283d;
    --la-control-border: #354254;
    --la-control-text: #eaf1ff;
    --la-primary: #8fbaff;
    --la-primary-hover: #6da1ff;
    --la-focus: rgba(122, 168, 255, .42);
}

:root[data-theme="dark"] :where(
    .quiet-action, .result-card button, .source-option button, .empty-import-button,
    .file-type, .default-model-chip, .view-toggle, .view-toggle button,
    .source-kind-tabs, .source-kind-tabs button, .card-menu,
    .card-menu button, .import-drawer, .import-drawer header button,
    .settings-nav, .settings-nav button, .settings-card, .model-tabs,
    .model-tabs button, .usage-range-tabs, .usage-range-tabs button,
    .theme-options button, .provider-form-card, .provider-config-item,
    .form-grid input, .form-grid select, .form-grid textarea,
    .settings-main input, .settings-main select, .settings-main textarea,
    .conversation-search, .conversation-menu, .conversation-menu button,
    .model-picker-button, .model-picker-menu, .model-picker-option,
    .composer, .composer-box, .composer textarea, .folder-main,
    .conversation-main, .conversation-actions button, .folder-action,
    .header-button, .icon-button, .icon-action, .quick-menu-button,
    .popover-action, .theme-row button, .sound-toggle, .memory-toggle
) {
    color: var(--la-control-text) !important;
    border-color: var(--la-control-border) !important;
    background: var(--la-control-bg) !important;
}

:root[data-theme="dark"] :where(
    .quiet-action:hover, .result-card button:hover, .source-option button:hover,
    .empty-import-button:hover, .file-type:hover, .default-model-chip:hover,
    .card-menu button:hover, .settings-nav button:hover, .model-tabs button:hover,
    .theme-options button:hover, .conversation-actions button:hover,
    .folder-action:hover, .icon-button:hover, .icon-action:hover
) {
    color: var(--la-primary) !important;
    border-color: #6d9fe8 !important;
    background: var(--la-control-bg-hover) !important;
}

:root[data-theme="dark"] :where(
    .source-kind-tabs button.active, .view-toggle button.active,
    .primary-action, .new-chat-button, #sendButton, .import-fab,
    .theme-options button.active, .usage-range-tabs button.active
) {
    color: #fff !important;
    border-color: transparent !important;
    background: linear-gradient(180deg, #3e8fff 0%, #1268f8 100%) !important;
}

:root[data-theme="dark"] :where(.result-card pre, .detail-content, .preview-panel pre,
    .attachment-preview-body pre, .source-option small, .kb-search input,
    .conversation-search input, .composer textarea) {
    color: var(--theme-text) !important;
}

@media (max-width: 760px) {
    :where(.result-side) { gap: 6px; }
    :where(.result-card button, .source-option button) { min-width: 54px; width: 54px; padding-inline: 4px; }
}

/* 2026-08 visual audit: shared account surface and Wenya dark controls. */
:where(.account-button, .avatar-button) {
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    border: 2px solid var(--line, #dce7f6) !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    isolation: isolate;
}

:where(.account-button > span, .avatar-button > span, .account-avatar-large) {
    border-radius: 50% !important;
    overflow: hidden !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: cover !important;
    image-rendering: auto;
    transform: translateZ(0);
}

:where(.account-avatar-large) {
    width: 48px !important;
    height: 48px !important;
    border: 2px solid var(--line, #dce7f6) !important;
    background-color: var(--soft, #f4f7fb) !important;
}

:where(.account-button::after, .avatar-button::after) {
    content: none !important;
    display: none !important;
}

button.account-button::after,
button.avatar-button::after {
    content: none !important;
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Remove the decorative rotated square from old account popovers. */
:where(.account-popover)::before {
    content: none !important;
    display: none !important;
}

:root[data-theme="dark"] :where(.account-button, .avatar-button, .account-avatar-large) {
    border-color: #3a4659 !important;
}

:root[data-theme="dark"] .thinking-summary {
    border-color: #2c3a4e !important;
    background: #121a26 !important;
    color: #aebed4 !important;
}

:root[data-theme="dark"] :where(.thinking-title, .thinking-summary-text, .thinking-leading, .thinking-chevron) {
    color: #aebed4 !important;
}

:root[data-theme="dark"] .thinking-separator { background: #607089 !important; }

:root[data-theme="dark"] .thinking-body {
    border-color: #2a384d !important;
    background: #101722 !important;
    color: #aebed4 !important;
}

:root[data-theme="dark"] .thinking-panel.active .thinking-summary::after {
    background: linear-gradient(90deg, transparent 0%, rgba(91,147,247,.16) 55%, transparent 100%) !important;
}

:root[data-theme="dark"] :where(
    .message-actions button, .message-version-bar button,
    .reference-button, .capability-toggle, .model-switch, .expand-button,
    .file-card, .file-card-actions .file-card-download, .file-card-actions a,
    .folder-count, .conversation-count, .count-badge
) {
    color: var(--la-control-text) !important;
    border-color: var(--la-control-border) !important;
    background: var(--la-control-bg) !important;
}

:root[data-theme="dark"] :where(
    .message-actions button:hover, .message-version-bar button:hover,
    .reference-button:hover, .capability-toggle:hover, .model-switch:hover,
    .expand-button:hover, .file-card-actions .file-card-download:hover
) {
    color: var(--la-primary) !important;
    border-color: #6d9fe8 !important;
    background: var(--la-control-bg-hover) !important;
}

:root[data-theme="dark"] :where(.reference-button.active, .capability-toggle.active) {
    color: #b8d1ff !important;
    border-color: #5277b3 !important;
    background: #192b46 !important;
}

:root[data-theme="dark"] :where(.file-card-icon) {
    background: transparent !important;
    color: inherit !important;
}

:root[data-theme="dark"] :where(.file-card-info strong) { color: #f4f7fb !important; }
:root[data-theme="dark"] :where(.file-card-info span, .capability-toggle:not(.active) span) { color: #9aabc2 !important; }
