:root{--surface:#fff;--surface-raised:#f4f7fa;--input-bg:#fff;--theme-accent:#e19f41;--theme-accent-text:#714b13;--theme-success:#275c46;--theme-danger:#a33c2e;--theme-info:#eaf1f7}
html[data-theme=dark] .connection-result{background:#2b251c;border-color:#75603d;color:var(--ink)}
html[data-theme=dark] .connection-result.verified{background:#12322b;border-color:#34634f}
html[data-theme=dark] .connection-result.error,html[data-theme=dark] .connection-result.unavailable{background:#3c2225;border-color:#81474b}
html[data-theme=dark] .bulk-preview article{background:var(--surface-raised);border-color:var(--line)}
html[data-theme=dark] .bulk-preview article.batch-skipped{background:#2b251c;border-color:#75603d}
.appearance-control{display:inline-flex;align-items:center;gap:7px;font-size:11px;color:var(--muted);white-space:nowrap;margin:0}.appearance-control select{width:auto;min-width:105px;padding:8px 10px;margin:0;font-size:11px}.favorite-button{display:inline-flex;gap:5px;align-items:center;background:transparent;color:var(--muted);border:1px solid var(--line);border-radius:7px;padding:5px 8px;font-size:11px;line-height:1.4}.favorite-button[aria-pressed=true]{color:#785017;background:#fff1d9;border-color:#e7c58f}.favorite-button:hover{border-color:#e19f41}.company-favorite{margin:8px 0 2px}.favorite-filter{display:inline-flex;align-items:center;gap:7px;font-size:12px;color:var(--ink);white-space:nowrap}.favorite-filter input{width:16px;height:16px;accent-color:#b67b26;margin:0}.dialog-heading .favorite-button{margin-top:10px}
html[data-theme=dark]{--ink:#e5edf5;--muted:#a5b5c5;--green:#efba6e;--line:#2c4054;--bg:#03101c;--surface:#0c1d2d;--surface-raised:#11283d;--input-bg:#071727;--theme-accent:#e19f41;--theme-accent-text:#f1c586;--theme-success:#9fd3b4;--theme-danger:#ffad9d;--theme-info:#102b43;color-scheme:dark}
html[data-theme=dark] body{background:var(--bg);color:var(--ink)}
html[data-theme=dark] :is(.sidebar,header,.panel,.stats article,dialog,.login-card,.channel-card,.admin-panel,.client-card,.admin-metric,.setup-card,.guide-card,.activity){background:var(--surface);border-color:var(--line);color:var(--ink)}
html[data-theme=dark] :is(h1,h2,h3,h4,strong,b,label,.brand,.breadcrumb b,.company-title,.search-title,.company-conversation,.admin-hero h2,.funnel-heading,.relationship-evidence b){color:var(--ink)}
html[data-theme=dark] :is(p,small,.muted,.eyebrow,.workspace-label,.section-label,.sidebar-bottom,.breadcrumb,.stats article>span,.row-field,.preset-note,.preset-opportunity,.contact-reading,#lead-origins small,.setup-help,.funnel-heading small,.relationship-evidence small,.channel-card>p,.channel-card>small){color:var(--muted)}
html[data-theme=dark] :is(input,select,textarea,.search-box,.row-field select){color:var(--ink);background:var(--input-bg);border-color:var(--line)}
html[data-theme=dark] input::placeholder,html[data-theme=dark] textarea::placeholder{color:#8d9fb1;opacity:1}
html[data-theme=dark] :is(button,a,input,select,textarea):focus-visible{outline-color:var(--theme-accent)}
html[data-theme=dark] :is(.nav,.campaign,.text-button,.close){color:var(--ink);background:transparent}
html[data-theme=dark] :is(.nav.active,.campaign.selected,.admin-tabs button.active,.admin-tabs button[aria-selected=true]){background:#17354f;color:#f4c583;border-color:#41617e}
html[data-theme=dark] .primary{color:#03101c;background:#e19f41;border-color:#e19f41}
html[data-theme=dark] .primary:hover{background:#efb65e}
html[data-theme=dark] :is(.secondary,.contact-copy,.contact-link,.suggestions button){background:var(--surface-raised);color:var(--ink);border-color:var(--line)}
html[data-theme=dark] :is(th,.panel-footer){background:#0a1928;color:var(--muted);border-color:var(--line)}
html[data-theme=dark] :is(td,.search-results article,.timeline-event,#lead-origins p,.crm-layout>div:first-child,.access-row,.batch-row){border-color:var(--line)}
html[data-theme=dark] :is(.stage,.avatar,.local-pill,.panel-heading h2 span){background:#19364c;color:#cfe3ed}
html[data-theme=dark] :is(.relationship-funnel,.relationship-card,.preset-panel,.message-preview,.browser-compose-guide,.search-summary,.info,.setup-help,.admin-guide,.setup-step,.setup-steps>div,.admin-hero,.support-banner,.engine-banner){background:var(--surface-raised);border-color:var(--line);color:var(--ink)}
html[data-theme=dark] :is(.funnel-stage,.relationship-card .next-step,.message,.message.inbound){background:var(--surface);border-color:var(--line);color:var(--ink)}
html[data-theme=dark] .funnel-stage.selected{background:#03223f;border-color:#e19f41;box-shadow:inset 0 -3px #e19f41;color:#fff}
html[data-theme=dark] .funnel-stage:hover{border-color:#e19f41}
html[data-theme=dark] :is(.next-step,.relationship-summary .next-step,.message-preview p,.follow-up,.preset-opportunity,.setup-summary){color:var(--ink)}
html[data-theme=dark] .relationship-tag{background:#23384b;color:#ccdae7}
html[data-theme=dark] .relationship-tag.outside{background:var(--surface);border-color:#617283}
html[data-theme=dark] :is(.relationship-tag.is-crm,.relationship-tag.replied){background:#173d32;color:#b3dfc8}
html[data-theme=dark] :is(.relationship-tag.customer,.favorite-button[aria-pressed=true]){background:#3d2d17;border-color:#825c2d;color:#f3c880}
html[data-theme=dark] .relationship-tag.former{background:#492b2d;color:#edb0aa}
html[data-theme=dark] :is(.form-error,.follow-up.overdue,.next-step.overdue,.batch-skipped){color:var(--theme-danger)}
html[data-theme=dark] :is(.channel-alert,.channel-error){background:#38252c;border-color:#885349;color:#ffd0b8}
html[data-theme=dark] :is(.channel-alert p,.channel-alert b,.engine-banner p,.engine-banner b){color:inherit}
html[data-theme=dark] .website-opportunity{color:#e7be79}
html[data-theme=dark] .favorite-button{color:var(--muted);border-color:var(--line)}
html[data-theme=dark] .brand-icon{background:#e19f41;color:#03101c}
html[data-theme=dark] #toast{background:#e19f41;color:#03101c;box-shadow:0 8px 35px #0008}
html[data-theme=dark] dialog::backdrop{background:#000a}
html[data-theme=dark] .login-page{background:radial-gradient(ellipse at top right,#03223f,transparent 65%),var(--bg)}
html[data-theme=dark] .empty-art{background:#17334a;color:#b7cddd}
html[data-theme=dark] .empty-art :is(i,em){background:var(--surface);color:#f0bd75}
@media(max-width:720px){.appearance-control{font-size:10px}.appearance-control select{min-width:95px}}
html[data-theme=dark] :is(.admin-tabs button,.admin-empty,.setup-progress,.setup-next,.setup-return,.channel-onboarding,.admin-dialog .info,.admin-grid .info){background:var(--surface-raised);color:var(--ink);border-color:var(--line)}
html[data-theme=dark] .admin-tabs button.selected{background:#17354f;color:#f4c583;border-color:#41617e}
html[data-theme=dark] :is(.admin-details summary,.admin-guide summary,.setup-help summary){color:var(--ink)}
html[data-theme=dark] :is(.admin-guide a,.setup-help a){color:#efba6e}
html[data-theme=dark] :is(.setup-item,.admin-guide details){border-color:var(--line)}
html[data-theme=dark] :is(.setup-mark,.setup-state){background:#3d2d17;color:#f3c880}
html[data-theme=dark] :is(.setup-mark.ready,.setup-state.verified){background:#173d32;color:#b3dfc8}
html[data-theme=dark] :is(.setup-state.error,.setup-state.unavailable){background:#492b2d;color:#ffad9d}
html[data-theme=dark] :is(.setup-next p,.channel-onboarding p){color:var(--muted)}
html[data-theme=dark] :is(.admin-metrics>div,.client-facts span){background:var(--surface-raised);border-color:var(--line);color:var(--muted)}
html[data-theme=dark] .client-avatar{background:#3d2d17;color:#f3c880}
html[data-theme=dark] .client-state{background:#17354f;color:#c4ddf4}
html[data-theme=dark] .client-state.suspended{background:#492b2d;color:#ffad9d}
html[data-theme=dark] .client-actions{border-color:var(--line)}
html[data-theme=dark] .meta-connect-card{background:var(--surface);border-color:var(--line);color:var(--ink)}

html[data-theme=dark] .bridge-connection{background:var(--surface-raised);border-color:var(--line);border-left-color:#e19f41}

/* Conversation export import and private archive */
.history-dialog{width:min(860px,calc(100vw - 32px));max-height:90vh;background:var(--surface,#fff);color:var(--ink);border-color:var(--line)}.history-dialog .dialog-heading{gap:20px}.history-dialog .dialog-heading h2{font-size:25px}.history-dialog .dialog-heading p{overflow-wrap:anywhere}.history-intro{display:flex;align-items:flex-start;gap:14px;margin:22px 0}.history-intro p,.history-dialog p{font-size:13px;line-height:1.6}.history-step{flex:none;width:32px;height:32px;border-radius:50%;display:grid;place-items:center;background:#03223f;color:#e19f41;font-weight:700}.history-intro a,.history-attachment a{color:var(--theme-accent-text,#714b13);font-size:12px}.history-drop{border:1px dashed var(--theme-accent,#e19f41);border-radius:12px;padding:18px;background:var(--surface-raised,#f4f7fa)}.history-drop input{margin:12px 0;background:var(--input-bg,#fff);max-width:100%}.history-server-limits{display:block;color:var(--muted);margin:10px 0 20px}.history-review{border-top:1px solid var(--line);margin-top:24px;padding-top:8px}.history-metrics{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:18px 0}.history-metrics>div{padding:15px;border-radius:10px;background:var(--surface-raised,#f4f7fa)}.history-metrics b{display:block;font-size:24px}.history-metrics small{font-size:11px;color:var(--muted)}.history-authors{border:1px solid var(--line);border-radius:10px;padding:16px;margin:20px 0}.history-authors legend{font-weight:600;padding:0 6px}.history-sample{margin:18px 0}.history-sample article{padding:12px;border-bottom:1px solid var(--line)}.history-sample p{white-space:pre-wrap;overflow-wrap:anywhere}.history-success{text-align:center;padding:32px 10px}.history-success .history-step{margin:auto}.history-actions{display:flex;gap:10px;flex-wrap:wrap}.history-search{display:flex;gap:12px;align-items:end}.history-search label{flex:1}.history-search button{margin-bottom:18px}.history-pagination{display:flex;align-items:center;justify-content:space-between;gap:10px;margin:18px 0}.history-pagination span{font-size:12px;color:var(--muted)}.history-archive{max-height:55vh;overflow-y:auto}.history-archive .message p{white-space:pre-wrap;overflow-wrap:anywhere}.history-attachment{padding:12px;border:1px solid var(--line);border-radius:8px;margin-top:10px;display:flex;flex-direction:column;gap:8px}.history-attachment img{display:block;max-height:220px;max-width:100%;border-radius:6px}.history-missing{font-size:11px!important;color:var(--muted);padding:10px;border-left:2px solid #e19f41}.history-dialog .info{background:var(--surface-raised,#f4f7fa);color:var(--ink)}@media(max-width:600px){.history-dialog{padding:20px}.history-metrics{gap:6px}.history-metrics>div{padding:10px}.history-pagination{flex-wrap:wrap}.history-search{align-items:stretch;flex-direction:column;gap:0}}

.local-login-help{margin:24px 0;padding:18px;border:1px solid var(--line,#d8e1e9);border-left:3px solid #e19f41;border-radius:12px}.local-login-help h2{font-size:18px;margin:0 0 10px}.local-login-help strong{overflow-wrap:anywhere}.local-login-help .secondary{display:inline-flex;max-width:100%;white-space:normal}.login-help a{color:inherit;text-decoration:underline;text-underline-offset:3px}
