/* Appearance controls share the same alignment and hit area in both themes. */
.theme-toggle{position:relative;display:inline-flex;align-items:center;justify-content:space-between;flex-shrink:0;gap:10px;width:56px;height:32px;margin:0;padding:7px 8px;border:1px solid #dde2eb;border-radius:18px;background:#f3f5fa;color:#939bad;cursor:pointer;isolation:isolate;line-height:0;transition:background .15s,border-color .15s}
.theme-toggle:hover{border-color:#aab3d9}.theme-toggle:focus-visible{outline:2px solid #8795ff;outline-offset:4px}
.theme-toggle .theme-icon{display:inline-flex;align-items:center;justify-content:center;position:relative;z-index:1;line-height:0}
.theme-toggle .theme-icon svg{display:block;width:12px;height:12px;fill:currentColor;stroke:none}
.theme-thumb{position:absolute;inset:3px auto auto 3px;width:24px;height:24px;border-radius:50%;background:#fff;box-shadow:0 1px 4px #26335415;transition:transform .15s,background .15s}
.theme-toggle[aria-checked=true] .theme-thumb{transform:translateX(24px)}
.theme-toggle[aria-checked=false] .theme-sun{color:#7c82bc}.theme-toggle[aria-checked=true] .theme-moon{color:#e1e5ff}

:root[data-theme=dark]{color-scheme:dark;--ink:#dce4f2;--muted:#97a5bb;--bg:#111722;--panel:#19212e;--line:#2b3547;--nav:#171f2b;--accent:#7e8cfa;--accent-ink:#fff;--purple:#9b9bff;--shadow:0 2px 12px #0000000c;--dark-input:#141c29;--dark-hover:#222d3e;--dark-secondary:#afbdd2;--dark-quiet:#8292ac;background:var(--bg);color:var(--ink)}
:root[data-theme=dark] body,:root[data-theme=dark] .app,:root[data-theme=dark] .workspace{background:var(--bg);color:var(--ink)}
:root[data-theme=dark] h1,:root[data-theme=dark] h2,:root[data-theme=dark] h3,:root[data-theme=dark] h4{color:var(--ink)}
:root[data-theme=dark] .app>.sidebar{background:#171f2b;color:var(--ink);border-color:var(--line)}
:root[data-theme=dark] .brand,:root[data-theme=dark] .auth-story .brand{color:#e2e8f5}
:root[data-theme=dark] .brand-mark{color:#a6afff;background:#2a3352}
:root[data-theme=dark] .brand-mark span{background:#a6afff}
:root[data-theme=dark] .brand-light{color:#b0bcd0}
:root[data-theme=dark] .sidebar nav>a{color:#a1afc5}
:root[data-theme=dark] .sidebar nav>a:hover{color:#d0d6ff;background:#252f49}
:root[data-theme=dark] .sidebar nav>a.active{color:#fff;background:#5b68d6}
:root[data-theme=dark] .client-picker select{background-color:var(--dark-input);border-color:#303b50;color:#c5cfe1}
:root[data-theme=dark] .client-add{background:#1d2738;border-color:#303c52;color:#a6b5ce}
:root[data-theme=dark] .client-add:hover{background:#2b3654;color:#d0d7ff}
:root[data-theme=dark] .sidebar .settings-link,:root[data-theme=dark] .sidebar .user-row b{color:#adbbd0}
:root[data-theme=dark] .sidebar .settings-link:hover{background:#26324a;color:#c4ccff}
:root[data-theme=dark] .user-row .avatar{color:#b8c2ff;background:#2c3552}
:root[data-theme=dark] .more-nav,:root[data-theme=dark] .more-nav summary{color:#94a3bc}
:root[data-theme=dark] .more-nav[open] summary{background:#263147;color:#c5d0e4}
:root[data-theme=dark] .nav-menu{background:#1b2534;border-color:#354158;box-shadow:0 12px 32px #00000045}
:root[data-theme=dark] .sidebar nav .nav-menu a,:root[data-theme=dark] .nav-menu button{background:transparent;color:#b3c1d7}
:root[data-theme=dark] .sidebar nav .nav-menu a:hover,:root[data-theme=dark] .nav-menu button:hover{background:#29364d;color:#e2e6ff}
:root[data-theme=dark] .sidebar nav .nav-menu a.active{color:#c5ccff;background:#2c3658}
:root[data-theme=dark] .nav-menu svg{color:#94a4c1}
:root[data-theme=dark] .app-footer{background:#151d29;border-color:var(--line);color:#7e8da6}
:root[data-theme=dark] .app-footer a{color:#a4aed2}
:root[data-theme=dark] .page-head p,:root[data-theme=dark] .dialog-intro,:root[data-theme=dark] .connect-provider p,:root[data-theme=dark] .empty p,:root[data-theme=dark] .settings-panel p,:root[data-theme=dark] .auth-form p{color:#99a8c0}
:root[data-theme=dark] .panel,:root[data-theme=dark] .connector-workspace .panel{background:var(--panel);border-color:var(--line);box-shadow:var(--shadow)}
:root[data-theme=dark] .panel-head,:root[data-theme=dark] .panel-foot{background:var(--panel);border-color:var(--line)}
:root[data-theme=dark] .panel-head p,:root[data-theme=dark] .panel-foot,:root[data-theme=dark] .muted{color:#8e9eb8}
:root[data-theme=dark] .button{background:var(--panel);color:#bcc8dc}
:root[data-theme=dark] .button.primary,:root[data-theme=dark] .assistant-panel .composer-box .button{background:#5b68d6;border-color:#5b68d6;color:#fff}
:root[data-theme=dark] .button.primary:hover{background:#626fd7;border-color:#626fd7}
:root[data-theme=dark] .button.outline{border-color:#3a475e;background:#1c2636;color:#b6c5de}
:root[data-theme=dark] .button.outline:hover{border-color:#65739d;background:#26324a;color:#d2dafa}
:root[data-theme=dark] .button.quiet{background:transparent;color:#a7b6d1}
:root[data-theme=dark] .button.quiet:hover{background:#26334d;color:#c6d0ff}
:root[data-theme=dark] .button.dark{background:#bdc8e0;color:#19212e}
:root[data-theme=dark] .button.danger{background:#3a2630;border-color:#62404d;color:#e7acb9}
:root[data-theme=dark] .icon-button{color:#91a2be}
:root[data-theme=dark] .icon-button:hover{color:#c2ccff;background:#2a3650}
:root[data-theme=dark] .text-link,:root[data-theme=dark] .support-link{color:#a5b1ff}
:root[data-theme=dark] .text-link:hover{color:#c6cfff}
:root[data-theme=dark] .control,:root[data-theme=dark] .form-field input,:root[data-theme=dark] .form-field select,:root[data-theme=dark] .form-field textarea,:root[data-theme=dark] .query-filter input,:root[data-theme=dark] .query-filter select{background-color:var(--dark-input);border-color:#344158;color:#c7d1e2}
:root[data-theme=dark] input::placeholder,:root[data-theme=dark] textarea::placeholder{color:#74849f;opacity:1}
:root[data-theme=dark] .control:hover,:root[data-theme=dark] .form-field input:hover,:root[data-theme=dark] .form-field select:hover{border-color:#4d5d7a}
:root[data-theme=dark] .control:focus,:root[data-theme=dark] .form-field input:focus,:root[data-theme=dark] .form-field select:focus,:root[data-theme=dark] .form-field textarea:focus{border-color:#8d9aff;box-shadow:0 0 0 3px #8d9aff16}
:root[data-theme=dark] select.control,:root[data-theme=dark] .form-field select,:root[data-theme=dark] .client-picker select,:root[data-theme=dark] .filter-panel select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4.5 6 3.5 3.5L11.5 6' fill='none' stroke='%23a5b2c8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")}
:root[data-theme=dark] .form-field label{color:#aab9d0}
:root[data-theme=dark] .form-field small,:root[data-theme=dark] .form-check{color:#91a1ba}
:root[data-theme=dark] .search-control{border-color:#344158;background:#151e2c;color:#7c8dab}
:root[data-theme=dark] .search-control input.control{background:transparent;border:0;box-shadow:none}
:root[data-theme=dark] .search-control:focus-within{background:#1b2535;border-color:#7f8ce7;box-shadow:0 0 0 3px #7f8ce711}
:root[data-theme=dark] .app th{background:#1d2737;border-color:#334056;color:#9bacc6}
:root[data-theme=dark] .app td{border-color:#2a3547;color:#b5c2d7}
:root[data-theme=dark] .app td strong{color:#d2dcec}
:root[data-theme=dark] .app tbody tr:hover td{background:#202c40}
:root[data-theme=dark] .table-source small,:root[data-theme=dark] .status-detail,:root[data-theme=dark] .query-toolbar small{color:#8395b2}
:root[data-theme=dark] .inline-error{color:#e8a8b7}
:root[data-theme=dark] .badge{color:#9aa9c2}
:root[data-theme=dark] .badge.connected,:root[data-theme=dark] .badge.success,:root[data-theme=dark] .badge.imported{color:#78c8ac}
:root[data-theme=dark] .badge.select_account,:root[data-theme=dark] .badge.verify_access,:root[data-theme=dark] .badge.authorizing,:root[data-theme=dark] .badge.running,:root[data-theme=dark] .badge.setup{color:#d5bd84}
:root[data-theme=dark] .badge.error{color:#e6a0ae}
:root[data-theme=dark] .badge.demo{color:#b5a1e2}
:root[data-theme=dark] .connector-sidebar{background:#171f2b;border-color:var(--line)}
:root[data-theme=dark] .connector-tools{border-color:var(--line)}
:root[data-theme=dark] .connector-row{color:#b3c2d9}
:root[data-theme=dark] .connector-row:hover{background:#222d40}
:root[data-theme=dark] .connector-row.selected{background:#2b3557;color:#c7ceff}
:root[data-theme=dark] .connector-row small{color:#8193af}
:root[data-theme=dark] .connector-bottom{color:#7d90ac;border-color:var(--line)}
:root[data-theme=dark] .connector-workspace{background:var(--bg)}
:root[data-theme=dark] .connector-heading p{color:#8698b5}
:root[data-theme=dark] .platform-icon,:root[data-theme=dark] .connector-row .platform-icon,:root[data-theme=dark] .connector-row>svg{background:#253044;color:#9ba8d2}
:root[data-theme=dark] .connector-row.selected .platform-icon,:root[data-theme=dark] .connector-row.selected>svg{background:#354165}
:root[data-theme=dark] .platform-icon.woocommerce{background:#342b47}
:root[data-theme=dark] .platform-icon.csv{background:#1c352e}
:root[data-theme=dark] .preview-layout,:root[data-theme=dark] .preview-center,:root[data-theme=dark] .history-workspace{background:#151d29}
:root[data-theme=dark] .preview-tabs{border-color:#2f3a4f}
:root[data-theme=dark] .preview-tabs button{color:#879bb9}
:root[data-theme=dark] .preview-tabs button.active{color:#b0baff;border-color:#929fff}
:root[data-theme=dark] .preview-tabs button[data-action=ai-query-open]{background:#252e4b;color:#b1bdff}
:root[data-theme=dark] .preview-tabs button:hover{color:#c5ceff}
:root[data-theme=dark] .query-toolbar,:root[data-theme=dark] .query-data,:root[data-theme=dark] .query-data .panel-foot{background:#192230;border-color:#303d53}
:root[data-theme=dark] .app .query-data th{border-right-color:#2c394f}
:root[data-theme=dark] .app .query-data td{border-right-color:#243145}
:root[data-theme=dark] .preview-destinations,:root[data-theme=dark] .preview-destinations .panel-head{background:transparent;box-shadow:none}
:root[data-theme=dark] .destination-choice,:root[data-theme=dark] .dest-card{background:#1b2535;border-color:#334158;color:#bdc9de}
:root[data-theme=dark] .destination-choice:hover,:root[data-theme=dark] .dest-card:hover{background:#25324b;border-color:#6274ab;color:#d2d9ff}
:root[data-theme=dark] .destination-choice svg,:root[data-theme=dark] .dest-card>svg{color:#9faeea}
:root[data-theme=dark] .dest-card small{color:#8599b8}
:root[data-theme=dark] .filter-panel{background:#192230;border-color:#303d53}
:root[data-theme=dark] .field-selector,:root[data-theme=dark] .query-advanced{border-color:#303d53}
:root[data-theme=dark] .field-checks label,:root[data-theme=dark] .query-advanced summary{color:#9bacC7}
:root[data-theme=dark] .field-checks label:hover{color:#c1cbff}
:root[data-theme=dark] .query-advanced small{color:#8296b4}
:root[data-theme=dark] .filter-panel .button[type=submit]{box-shadow:0 -8px 20px 8px #192230ed}
:root[data-theme=dark] .metric-explanation,:root[data-theme=dark] .note{color:#8296b4}
:root[data-theme=dark] .coverage-notice,:root[data-theme=dark] .demo-banner,:root[data-theme=dark] .callout.warning,:root[data-theme=dark] .ai-disabled{background:#302c22;border-color:#514836;color:#d4bd86}
:root[data-theme=dark] .coverage-notice b{color:#e2cea3}
:root[data-theme=dark] .mobile-filter-close{color:#a8b8d1}
:root[data-theme=dark] .filter-panel.mobile-open{box-shadow:-12px 0 42px #00000050}
:root[data-theme=dark] .floating-ai{color:#fff;background:#7785f5;box-shadow:0 5px 20px #00000038;border-color:#9ba6ff44}
:root[data-theme=dark] .floating-ai:hover{background:#8d99ff}
:root[data-theme=dark] .saved-icon{color:#b2bcff;background:#2b3656}
:root[data-theme=dark] .saved-card p,:root[data-theme=dark] .tagline,:root[data-theme=dark] .tagline span{color:#8196b7}
:root[data-theme=dark] .tabs{border-color:#303c52}
:root[data-theme=dark] .tabs button{color:#859abc}
:root[data-theme=dark] .tabs button.active{color:#b5bfff;border-color:#929fff}
:root[data-theme=dark] .settings-panel code,:root[data-theme=dark] .code-box{color:#aebed9;background:#121b2a;border-color:#303d54}
:root[data-theme=dark] .settings-panel .eyebrow,:root[data-theme=dark] .settings-description{color:#8298b8}
:root[data-theme=dark] .settings-description summary{color:#a8b8d5}
:root[data-theme=dark] .ready-dot{color:#80cdb3}
:root[data-theme=dark] .ready-dot.off{color:#ceb787}
:root[data-theme=dark] .callout{background:#1e293c;border-color:#35445f;color:#a6b6d0}
:root[data-theme=dark] .callout.error{background:#382831;border-color:#60404d;color:#e3aebb}
:root[data-theme=dark] .empty{background:var(--panel)}
:root[data-theme=dark] .empty-icon{background:#2a3550;color:#a4b4e9}
:root[data-theme=dark] .loading-inline,:root[data-theme=dark] .initial-loading{color:#8b9fc0}
:root[data-theme=dark] .kpi-top,:root[data-theme=dark] .kpi small{color:#89a0bf}
:root[data-theme=dark] .kpi strong{color:#d9e4f8}
:root[data-theme=dark] .metric-icon{background:#293650;color:#a9bae9}
:root[data-theme=dark] .chart-label{fill:#8fa5c6}
:root[data-theme=dark] .chart-grid{stroke:#2c3a51}
:root[data-theme=dark] .chart-legend{color:#94a8c6}
:root[data-theme=dark] dialog{background:#1b2535;color:var(--ink);border-color:#3b4962;box-shadow:0 20px 80px #00000066}
:root[data-theme=dark] dialog::backdrop{background:#050a1477;backdrop-filter:none}
:root[data-theme=dark] .dialog-head{background:#1b2535;border-color:#354259}
:root[data-theme=dark] #dialog-body{background:#1b2535}
:root[data-theme=dark] .dialog-head .eyebrow{color:#8197ba}
:root[data-theme=dark] .dialog-footer{border-color:#354259}
:root[data-theme=dark] .wizard-label{color:#738db2}
:root[data-theme=dark] .wizard-label b{color:#b1bdff}
:root[data-theme=dark] .wizard-label .done{color:#81b49f}
:root[data-theme=dark] .provider-option,:root[data-theme=dark] .account-option{background:#1e293b;border-color:#364661;color:#a6b8d6}
:root[data-theme=dark] .provider-option:hover,:root[data-theme=dark] .account-option:hover{background:#293750;border-color:#6275a2}
:root[data-theme=dark] .provider-option b,:root[data-theme=dark] .account-option b{color:#cedbf0}
:root[data-theme=dark] .provider-option small,:root[data-theme=dark] .account-option small{color:#8fa5c7}
:root[data-theme=dark] .provider-option>svg,:root[data-theme=dark] .account-option>svg,:root[data-theme=dark] .search-input{color:#8fa4c4}
:root[data-theme=dark] .toast{background:#223047;color:#c1cfe6;border-color:#40516e;box-shadow:0 8px 30px #00000045}
:root[data-theme=dark] .toast.error{color:#e9b7c2}
:root[data-theme=dark] .assistant-panel{background:#192331;color:#dce4f2;border-color:#3a4862;box-shadow:-5px 0 28px #0000004a}
:root[data-theme=dark] .assistant-heading,:root[data-theme=dark] .assistant-actions{background:#192331;border-color:#314058}
:root[data-theme=dark] .assistant-heading p,:root[data-theme=dark] .assistant-context{color:#8da3c5}
:root[data-theme=dark] .assistant-actions .text-link,:root[data-theme=dark] .assistant-history summary{color:#a5b4f2}
:root[data-theme=dark] .assistant-panel .chat-welcome p,:root[data-theme=dark] .assistant-panel .message-body{color:#a8bad6}
:root[data-theme=dark] .assistant-panel .message-body strong{color:#d4e0f5}
:root[data-theme=dark] .assistant-panel .message-body code{background:#293752;color:#bdcbec}
:root[data-theme=dark] .assistant-panel .chat-message.user{background:#28364d}
:root[data-theme=dark] .assistant-panel .message-body th,:root[data-theme=dark] .assistant-panel .message-body td{color:#adbfdd;border-color:#34435c}
:root[data-theme=dark] .assistant-panel .ai-evidence{color:#8fa4c8;border-color:#314159}
:root[data-theme=dark] .assistant-panel .ai-evidence summary{color:#91a6ca}
:root[data-theme=dark] .assistant-history #thread-list{background:#253248;border-color:#465a7e;box-shadow:0 8px 26px #00000045}
:root[data-theme=dark] .assistant-history .thread-button{background:transparent;color:#b4c5e5}
:root[data-theme=dark] .assistant-history .thread-button:hover{background:#334465}
:root[data-theme=dark] .assistant-panel .chat-composer{background:#192331;border-color:#314159}
:root[data-theme=dark] .assistant-panel .composer-box{background:#131d2c;border-color:#3b4b68}
:root[data-theme=dark] .assistant-panel .composer-box:focus-within{border-color:#8296e9;box-shadow:0 0 0 3px #8d9aff12}
:root[data-theme=dark] .assistant-panel .composer-box textarea{background:transparent;color:#c0cee8}
:root[data-theme=dark] .assistant-panel .composer-note,:root[data-theme=dark] .assistant-panel .chat-busy{color:#8197bb}
:root[data-theme=dark] .auth-screen{background:#121a28}
:root[data-theme=dark] .auth-story{background:linear-gradient(145deg,#202d47,#192339);color:#b9c9e5}
:root[data-theme=dark] .auth-story h1{color:#e0e9fa}
:root[data-theme=dark] .auth-story p{color:#a1b3d2}
:root[data-theme=dark] .auth-story>small{color:#788fb5}
:root[data-theme=dark] .auth-form-wrap{background:#171f2e}
:root[data-theme=dark] .auth-form h2{color:#dfe8f8}
:root[data-theme=dark] .skip{background:#263752;color:#e4ecfa}
:root[data-theme=dark] .table-scroll,:root[data-theme=dark] .filter-panel,:root[data-theme=dark] .field-checks,:root[data-theme=dark] .chat-scroll,:root[data-theme=dark] #connector-list{scrollbar-color:#43516b transparent}
:root[data-theme=dark] .table-scroll::-webkit-scrollbar-thumb,:root[data-theme=dark] .filter-panel::-webkit-scrollbar-thumb,:root[data-theme=dark] .field-checks::-webkit-scrollbar-thumb,:root[data-theme=dark] .chat-scroll::-webkit-scrollbar-thumb{background:#43516b;border-color:#192230}
:root[data-theme=dark] .theme-toggle{background:#101824;border-color:#3a4964;color:#7084ab}
:root[data-theme=dark] .theme-thumb{background:#465580;box-shadow:0 1px 5px #00000025}
:root[data-theme=dark] .theme-toggle:hover{border-color:#7e8bc2}
@media(max-width:800px){.sidebar-bottom{gap:5px}.theme-toggle{width:32px;height:32px;padding:8px;border-radius:8px;justify-content:center;background:transparent}.theme-toggle .theme-thumb{display:none}.theme-toggle[aria-checked=true] .theme-sun,.theme-toggle[aria-checked=false] .theme-moon{display:none}.theme-toggle .theme-icon svg{width:14px;height:14px}.theme-toggle[aria-checked=true] .theme-moon{color:#b5c4f3}:root[data-theme=dark] .theme-toggle{background:#222d42;border-color:#3c4d6a}.sidebar .settings-link{width:28px}}
@media(max-width:480px){.brand-light{display:none}.sidebar .client-picker select{width:120px}.sidebar-bottom{gap:4px}.app>.sidebar{column-gap:8px}}
@media(max-width:380px){.sidebar .client-picker select{width:106px}.app>.sidebar{column-gap:5px}}
@media(prefers-reduced-motion:reduce){.theme-toggle,.theme-thumb{transition:none}}
