/* A shared, restrained palette for the workspace. Brand colors remain intact. */
:root{color-scheme:light;--surface:#fff;--surface-soft:#f6f8fc;--surface-raised:#fff;--ink:#222b40;--secondary:#66758c}
:root[data-theme=dark]{color-scheme:dark;--surface:#171f2e;--surface-soft:#111827;--surface-raised:#202b3c;--ink:#e7edf7;--secondary:#a9b7cc;--line:#303e53;--border:var(--line);--muted:#a3b1c6;--accent:#aaa2ff;background:var(--surface-soft);color:var(--ink)}
.appearance-switch{display:flex;gap:4px;padding:4px;border:1px solid #35415a;border-radius:10px;flex-shrink:0;margin:8px 4px;background:#0f1729}
.appearance-switch button{display:flex;align-items:center;justify-content:center;gap:7px;flex:1;min-height:33px;padding:6px 9px;border-radius:7px;font-size:12px;color:#aebbd1;font-weight:550;white-space:nowrap}
.appearance-switch button[aria-pressed=true]{background:#33435d;color:#fff;box-shadow:0 1px 4px #0002}
.appearance-switch svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.auth-form-wrap{position:relative}.auth-appearance{position:absolute;right:24px;top:16px;width:190px}
.auth-remember{display:grid;gap:2px;margin:-4px 0;color:var(--ink)}
.auth-remember label{display:flex;align-items:center;gap:10px;min-height:36px;width:fit-content;max-width:100%;font-size:13px;font-weight:600;cursor:pointer;touch-action:manipulation}
.auth-remember input[type=checkbox]{width:18px;height:18px;flex:0 0 18px;margin:0;padding:0;accent-color:var(--accent);cursor:pointer}
.auth-remember input[type=checkbox]:focus-visible{outline:2px solid var(--accent);outline-offset:3px}
.auth-remember p{margin:0;padding-left:28px;color:#5d6b82;font-size:12px;line-height:1.5}
:root[data-theme=dark] .auth-remember p{color:var(--secondary)}
.sidebar-note{display:none}
.workflow-page .wf-filters select{width:auto;min-width:160px;max-width:260px}
:root[data-theme=dark] :is(.topbar,.inbox,.thread-header,.composer-wrap,.customer-panel,.details,.card,.page-card,.stat-card,.table-wrap,.control-panel,.control-metric,.md-toolbar,.md-controls,.md-tabs,.md-item,dialog,.modal-content,.modal-head,.history-transcript-heading,.history-entry,.thread-loading,.inbox-readonly){background:var(--surface);border-color:var(--line);color:var(--ink)}
:root[data-theme=dark] :is(.main,.messages,.history-transcript-messages,.md-editor,.md-preview,.auth-form-wrap){background:var(--surface-soft);color:var(--ink)}
:root[data-theme=dark] :is(input,select,textarea,.search input,.md-field input,.md-field textarea,.md-field select,.md-website select){background:var(--surface-soft);color:var(--ink);border-color:var(--line)}
:root[data-theme=dark] :is(input,textarea,select):focus{border-color:#9b92ff;box-shadow:0 0 0 3px #7769ee25}
:root[data-theme=dark] ::placeholder{color:#8799b3}
:root[data-theme=dark] :is(.btn,.media-actions button,.message-media button,.media-draft button,.md-row-actions button,.md-preview-options button,.md-preview-options select,.load-more){background:var(--surface-raised);color:var(--ink);border-color:#3a4960}
:root[data-theme=dark] :is(.btn,.message-media button,.media-actions button):hover{background:#2b3a50;border-color:#596c8a}
:root[data-theme=dark] .btn.primary{background:#6554d9;color:white;border-color:#8174ff}
:root[data-theme=dark] .btn.quiet{background:transparent;color:#bab3ff}
:root[data-theme=dark] .btn.danger{background:#3e242d;color:#ffadba;border-color:#78404e}
:root[data-theme=dark] .btn.resolve-btn{background:#1a3a32;color:#a4e8c9;border-color:#326653}
:root[data-theme=dark] .conversation{border-bottom-color:#273247;color:#e7edf7}
:root[data-theme=dark] .conversation:hover{background:#202c41}
:root[data-theme=dark] .conversation.selected{background:#2d2d51;border-left-color:#a69bff}
:root[data-theme=dark] .conversation.is-unread{background:#1f3150}
:root[data-theme=dark] .conversation.is-unread.selected{background:#30345b}
:root[data-theme=dark] :is(.conversation .subject,.conversation .preview,.message-meta strong,.thread-subject,.history-subject,.control-detail b,.control-site-numbers b){color:#b8c7dd}
:root[data-theme=dark] :is(.site-tag,.conversation .time,.message-meta,.day-label,.list-caption,.thread-subtitle,.control-origin,.control-detail,.control-site-numbers,.control-metric-label,.control-section-heading p,.performance-metric>span,.performance-metric small,.performance-details dt,.md-field,.md-field small,.md-caption,.md-toggle small,.md-website,.md-save-state,.md-section-heading p){color:var(--secondary)}
:root[data-theme=dark] .bubble{background:#202c3f;color:#e1eaf7;border-color:#35445d;box-shadow:none}
:root[data-theme=dark] :is(.reply .bubble,.message.bot .bubble){background:#302b50;border-color:#514776;color:#e8e1ff}
:root[data-theme=dark] .note .bubble{background:#3b321e;border-color:#68562a;color:#f6deaa}
:root[data-theme=dark] :is(.composer,.composer textarea){background:var(--surface);color:var(--ink);border-color:var(--line)}
:root[data-theme=dark] .composer.note-mode{background:#332e21;border-color:#6c5a31}
:root[data-theme=dark] :is(.composer-top select,.composer-footer,.details h3,.details label,.md-section-heading h2,.md-toggle strong,.md-details summary,.md-item-head strong){color:var(--ink)}
:root[data-theme=dark] :is(.info-box,.control-workflows,.md-tip,.media-draft,.delete-history-person,.history-summary,.installation-key){background:#242b46;border-color:#414b70;color:#c4cceb}
:root[data-theme=dark] .workflow-transcript-options span{background:#27354b;color:#edf3ff;border-color:#687a98}
:root[data-theme=dark] :is(.installation-modes button[aria-selected=true],.tab.active){color:#c3bbff;border-color:#7466c4}
:root[data-theme=dark] :is(.pill,.tab .num){background:#2b374b;color:#c5d1e5}
:root[data-theme=dark] .pill.open{background:#203c5f;color:#9dccff}
:root[data-theme=dark] :is(.pill.resolved,.performance-live){background:#1c3c33;color:#92ddbc}
:root[data-theme=dark] :is(.pill.pending,.needs-reply){background:#48391b;color:#f9d793}
:root[data-theme=dark] .pill.urgent{background:#4c2930;color:#ffb4bc}
:root[data-theme=dark] .performance-ok{color:#76d9ad}
:root[data-theme=dark] .performance-warning{color:#f0c374}
:root[data-theme=dark] .error{color:#ffa3ae}
:root[data-theme=dark] :is(table,th,td,.details-section,.list-tools,.composer-footer,.history-transcript-heading){border-color:var(--line)}
:root[data-theme=dark] th{background:#202b3c;color:#c4d1e4}
:root[data-theme=dark] tr:hover{background:#202b3c}
:root[data-theme=dark] .md-add{background:#202b3c!important;color:#b8b0ff!important;border-color:#514a7e}
/* The workflow canvas can also use a bright paper-like palette. */
:root[data-theme=light] .workflow-page{--wf-canvas:#edf1f6;--wf-panel:#fff;--wf-line:#d2dae6;--wf-text:#25344a;--wf-muted:#64758d;--wf-blue:#3568ad;background:#f2f5f9;color-scheme:light}
:root[data-theme=light] .workflow-page :is(input,select,textarea){background:#f8faff;color:#243751;border-color:#bfcbdd}
:root[data-theme=light] .workflow-page :is(.wf-button,.wf-library,.wf-drawer,.wf-panel,.wf-step-picker,.wf-node,.wf-start,.wf-trigger,.wf-preview-panel,.wf-connection-menu,.wf-reusable-picker,.wf-question){background:#fff;color:#243751;border-color:#ced8e5;box-shadow:0 4px 16px #233c5d0c}
:root[data-theme=light] .workflow-page :is(.wf-button.primary,.wf-choice-input,.wf-path-done,.wf-reusable-current,.wf-step-insert,.wf-create-next,.wf-connection-create>button){background:#e7effb!important;color:#28568e!important;border-color:#a7bfdf!important}
:root[data-theme=light] .workflow-page :is(.wf-inline-field,.wf-inline-label,.wf-inline-check,.wf-inline-help,.wf-step-settings,.wf-inline-link,.wf-reusable-results>button,.wf-question legend,.wf-lookup-options summary,.wf-node-title,.wf-node-header,.wf-node-footer){color:#526b8c}
:root[data-theme=light] .workflow-page :is(.wf-step-settings[open],.wf-current-connection,.wf-preview-header,.wf-question-tools button,.wf-variable-list code){background:#eaf0f8;color:#365a85;border-color:#b8c9dd}
:root[data-theme=light] .workflow-page :is(.wf-reusable-results small,.wf-reusable-results p,.wf-list-hint,.wf-choice-number,.wf-create-next small,.wf-connection-head small,.wf-current-connection>span,.wf-current-connection>small,.wf-preview-footnote,.wf-preview-route,.wf-compact-end){color:#627b9b}
:root[data-theme=light] .workflow-page #wf-connection-search{background:#f7f9fe;color:#243751;border-color:#bdcce0}
:root[data-theme=light] .workflow-page #wf-connection-results :is(h4,button,p,small){color:#365a85}
:root[data-theme=light] .workflow-page #wf-connection-results button:hover{background:#e8eff9}
@media(max-width:900px){.sidebar .appearance-switch{flex-direction:column;padding:3px;margin:8px 0}.sidebar .appearance-switch button{padding:7px}.sidebar .appearance-switch span{display:none}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;animation-duration:.01ms!important;transition-duration:.01ms!important}}

:root[data-theme=dark] .conversation.needs-attention:not(.is-unread):not(.selected){background:#28271f}
:root[data-theme=dark] .conversation.selected{box-shadow:inset 0 0 0 1px #5b5386}
:root[data-theme=dark] .conversation.selected .player-alias,:root[data-theme=dark] .conversation.is-unread .player-alias{color:#e5e4ff}
:root[data-theme=dark] .conversation .unread-label{background:#274b76;color:#c2e0ff}

:root[data-theme=light] .workflow-page{--wf-light-surface:#fff;--wf-light-toned:#edf3fc;--wf-light-foreground:#283c56;--wf-light-secondary:#526b8b;--wf-light-border:#bdcce0}
:root[data-theme=dark] .details :is(p,dd,.detail-value){color:#abbad0}

/* Shared surfaces also cover drawers, history and settings opened after page load. */
:root[data-theme=dark] body{background:var(--surface-soft);color:var(--ink)}
:root[data-theme=dark] :is(.history-person,.security-note,.secret,.messenger-setting-row){background:var(--surface-raised);border-color:var(--line);color:var(--ink)}
:root[data-theme=dark] .inbox.show-details .customer-panel{background:var(--surface);box-shadow:-15px 0 45px #0005}
:root[data-theme=dark] :is(.detail-section,.team-permissions,.installation-modes,.installation-advanced,.messenger-setting-row){border-color:var(--line)}
:root[data-theme=dark] :is(td strong,.empty h2,.messenger-setting-row strong,.info-box strong,.history-person dd,.department-card dd){color:var(--ink)}
:root[data-theme=dark] :is(td,.tab,.live,.nav-title,.customer-profile p,.detail-section h4,.detail-field label,.detail-field span,.page-intro p,.card p.description,.stat .label,.site-card .domains,.reply-card .reply-body,.bar-row,.legend,.api-step p,.close,.media-status,.site-settings-section .hint,.department-card dt,.department-options>p,.department-member small,.department-guide p,.department-assignment-hint,.history-person dt,.history-list-heading>span,.history-readonly-note,.history-entry-preview,.history-entry-meta,.history-loading,.history-empty,.history-transcript-heading p,.conversation .guest-suffix,.conversation .conversation-reference,.thread-navigation>span,.loading-label,.permission-option small,.composer-hint,.empty,.installation-modes button:not([aria-selected=true])){color:var(--secondary)}
:root[data-theme=dark] :is(.workflow-status,.message.bot .message-meta strong,.history-entry-meta b,.history-entry-meta>span){color:#c0b7f4}
:root[data-theme=dark] .conversation.is-unread .preview{color:#c2d7f2}
:root[data-theme=dark] .conversation .draft-label{color:#efca8e}
:root[data-theme=dark] :is(.thread-navigation button,.history-entry:hover){background:var(--surface-raised);border-color:#485a75;color:var(--ink)}
:root[data-theme=dark] .thread-navigation button:hover:not(:disabled){background:#343759;border-color:#8f84d6;color:#e2dcff}
:root[data-theme=dark] :is(.stat .icon-box,.site-card .site-logo,.step-num,.history-readonly-label){background:#302c4e;color:#c7bfff}
:root[data-theme=dark] :is(.pill.archived,.department-tag){background:#2b374b;color:#c5d1e5}
:root[data-theme=dark] :is(.token-note,.response-deadline){background:#283a53;color:#c0d9f7}
:root[data-theme=dark] .token-note{background:#40361f;color:#f2d79f}
:root[data-theme=dark] :is(.response-deadline.is-overdue,.response-deadline.is-late){background:#472c32;color:#ffb9b4}
:root[data-theme=dark] .response-deadline.is-fulfilled{background:#1c3c33;color:#92ddbc}
:root[data-theme=dark] .history-danger-copy{color:#ffadba}
:root[data-theme=dark] .btn.danger:hover:not(:disabled){background:#512d38;border-color:#a85c6d;color:#ffd0d9}
:root[data-theme=dark] .btn.primary:hover:not(:disabled){background:#7563e9;border-color:#a397ff}
:root[data-theme=dark] .btn.resolve-btn:hover:not(:disabled){background:#244f42;border-color:#518b73;color:#c3f5df}
:root[data-theme=dark] .inactivity-summary{background:#283a53;color:#c0d9f7}
:root[data-theme=dark] :is(.btn.priority-toggle,.department-filter-row .priority-filter)[aria-pressed=true]{background:#4c2930;border-color:#9d5364;color:#ffbec7}
:root[data-theme=dark] :is(.btn.priority-toggle,.department-filter-row .priority-filter)[aria-pressed=true]:hover:not(:disabled){background:#61313c;border-color:#c87d8d;color:#ffe1e6}
:root[data-theme=dark] .bar{background:#2c3850}
:root[data-theme=dark] .skeleton-message{background:linear-gradient(100deg,#202c3e 30%,#2e3b51 50%,#202c3e 70%);background-size:220% 100%}
:root[data-theme=dark] .skeleton-profile{background:var(--surface-raised)}
:root[data-theme=dark] .thread.is-refreshing:after{background:#2b2945;border-color:#554c7c;color:#d2caf4}
:root[data-theme=dark] .avatar{background:#2b3658;color:#c1cdff}
:root[data-theme=dark] .avatar.warm{background:#493928;color:#f5cea2}
:root[data-theme=dark] .avatar.pink{background:#472f43;color:#f5bddc}
:root[data-theme=dark] .avatar.teal{background:#244442;color:#b2e9dc}
:root[data-theme=dark] select :is(option,optgroup){background:var(--surface);color:var(--ink)}
:root[data-theme=dark] input:-webkit-autofill{-webkit-text-fill-color:var(--ink);-webkit-box-shadow:0 0 0 1000px var(--surface-soft) inset;caret-color:var(--ink)}
:root[data-theme=dark] input:autofill{background:var(--surface-soft);color:var(--ink)}
:root[data-theme=dark] ::selection{background:#6657a9;color:#fff}
:root[data-theme=dark] :is(html,body,textarea,select,.main,.list-items,.messages,.customer-panel,dialog,.modal-content,.history-transcript-messages,.installation-code){scrollbar-color:#536179 var(--surface-soft)}
:root[data-theme=dark] dialog::backdrop{background:#060c18b3}
:root[data-theme=dark] .workflow-guide-page .guide-section{background:var(--surface);border-color:var(--line)}
:root[data-theme=dark] .workflow-guide-page .brand{color:var(--ink)}
:root[data-theme=dark] .workflow-guide-page :is(.lead,.step p,.footer){color:var(--secondary)}
:root[data-theme=dark] .workflow-guide-page :is(a,.eyebrow){color:#c2baff}
:root[data-theme=dark] .workflow-guide-page :is(.number,.hint){background:#302c4e;color:#ddd6ff}
:root[data-theme=dark] .workflow-guide-page code{background:var(--surface-raised);color:#d3e1f7}
