/* Light is the default. Dark colors are shared by every workspace module. */
html[data-theme=dark] .activity-panel{--activity-surface:var(--inset);--activity-ink:var(--fg);--activity-grid:var(--line);--activity-blue:#94b6ff;--activity-teal:#76d4bd;--activity-selected:#203451;--activity-selected-line:#44689c}
html[data-theme=dark] .activity-period.active{background:var(--raised);color:var(--activity-blue);box-shadow:none}
:root{color-scheme:light;--theme-button-bg:#fff;--theme-button-fg:#465063;--theme-button-line:#dfe3ea;--theme-button-hover:#f1f4f9}
html[data-theme=dark]{
  color-scheme:dark;
  --page:#10151f;--surface:#161e2b;--inset:#121a26;--raised:#202b3b;
  --fg:#e6edf7;--muted:#b0bdd0;--subtle:#98a9c0;--line:#334155;
  --accent-text:#94b6ff;--accent-bg:#1c3150;--action:#3665db;--action-hover:#3c6de0;--focus:#89aaff;
  --success:#8bdbac;--success-bg:#17372b;--success-line:#315f47;
  --warning:#e9c387;--warning-bg:#382d20;--warning-line:#725335;
  --danger:#ffabb8;--danger-bg:#39242e;--danger-line:#6b3c4d;
  --chart-secondary:#657c9e;
  --border:var(--line);--green:var(--accent-text);--green-light:var(--accent-bg);--sidebar:var(--inset);--accent:var(--accent-text);
  --theme-button-bg:var(--surface);--theme-button-fg:var(--fg);--theme-button-line:var(--line);--theme-button-hover:var(--raised)
}
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:34px;padding:7px 9px;border:1px solid var(--theme-button-line);border-radius:6px;background:var(--theme-button-bg);color:var(--theme-button-fg);font-size:11px;font-weight:550;line-height:1.3;white-space:nowrap;flex:none}
.theme-toggle:hover{background:var(--theme-button-hover)}
.theme-toggle svg{width:16px;height:16px;flex:none}
.theme-sun{display:none}
html[data-theme=dark] .theme-sun{display:block}
html[data-theme=dark] .theme-moon{display:none}
.login-header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:35px}
.login-card .login-header .brand{margin-bottom:0}
.topbar .theme-toggle{margin-right:8px;min-width:115px}
@media(max-width:760px){.topbar .theme-toggle{min-width:34px;min-height:34px;margin-right:2px;padding:8px}.topbar [data-theme-label]{display:none}}
@media(max-width:380px){.login-header{gap:8px}.login-header .theme-toggle{padding:7px;font-size:10px}}

/* admin-info.css */
html[data-theme=dark] .admin-info{color:var(--fg)}
html[data-theme=dark] .ai-metric{background:var(--surface);border:1px solid var(--line)}
html[data-theme=dark] .ai-metric span{color:var(--muted)}
html[data-theme=dark] .ai-search{border:1px solid var(--line);color:var(--fg);background:var(--surface)}
html[data-theme=dark] .ai-search:focus{outline:2px solid var(--focus);border-color:var(--focus)}
html[data-theme=dark] .ai-notice{color:var(--muted)}
html[data-theme=dark] .ai-results{border:1px solid var(--line);background:var(--surface)}
html[data-theme=dark] .ai-table-head{color:var(--muted);background:var(--surface);border-bottom:1px solid var(--line)}
html[data-theme=dark] .ai-admin{border-bottom:1px solid var(--line)}
html[data-theme=dark] .ai-avatar{background:var(--inset);border:1px solid var(--line);color:var(--muted)}
html[data-theme=dark] .ai-username{color:var(--accent-text)}
html[data-theme=dark] .ai-id{color:var(--muted)}
html[data-theme=dark] .ai-id:hover{color:var(--accent-text)}
html[data-theme=dark] .ai-id.copied:after{color:var(--success)}
html[data-theme=dark] .ai-activity span{color:var(--muted)}
html[data-theme=dark] .ai-route-label{color:var(--fg)}
html[data-theme=dark] .ai-bot{border:1px solid var(--line);color:var(--accent-text);background:var(--inset)}
html[data-theme=dark] .ai-channel{color:var(--muted)}
html[data-theme=dark] .ai-more summary{color:var(--accent-text)}
html[data-theme=dark] .ai-dates>span{color:var(--fg)}
html[data-theme=dark] .ai-dates small{color:var(--muted)}
html[data-theme=dark] .ai-pagination{border-top:1px solid var(--line);color:var(--muted)}
html[data-theme=dark] .ai-empty{color:var(--muted)}
html[data-theme=dark] .ai-empty strong{color:var(--fg)}
@media(max-width:520px){
html[data-theme=dark] .ai-dates{border-top:1px solid var(--line)}
}

/* style.css */
html[data-theme=dark]{color:var(--fg);background:var(--page)}
html[data-theme=dark] button:focus-visible,html[data-theme=dark] a:focus-visible{outline:3px solid var(--focus)}
html[data-theme=dark] input:focus,html[data-theme=dark] select:focus,html[data-theme=dark] textarea:focus{outline:2px solid var(--focus)}
html[data-theme=dark] .brand{color:var(--fg)}
html[data-theme=dark] .brand-mark{background:#283951;color:#ffffff}
html[data-theme=dark] .brand-tag{background:var(--raised);color:var(--muted)}
html[data-theme=dark] .nav-link{color:var(--muted)}
html[data-theme=dark] .nav-link:hover{background:var(--raised)}
html[data-theme=dark] .nav-link.active{background:var(--accent-bg);color:var(--accent-text)}
html[data-theme=dark] .nav-count{color:var(--muted)}
html[data-theme=dark] .more-nav summary{color:var(--muted)}
html[data-theme=dark] .avatar{background:var(--raised);color:var(--muted)}
html[data-theme=dark] .icon-button:hover{background:var(--raised)}
html[data-theme=dark] .topbar{color:var(--muted);background:var(--surface)}
html[data-theme=dark] .slash{color:var(--muted)}
html[data-theme=dark] #breadcrumb{color:var(--fg)}
html[data-theme=dark] .live-dot{background:var(--success)}
html[data-theme=dark] .sync.stale .live-dot{background:var(--warning)}
html[data-theme=dark] .button.primary{color:#ffffff;box-shadow:0 1px 2px #00000030}
html[data-theme=dark] .button.primary:hover{background:var(--action-hover)}
html[data-theme=dark] .button.secondary{background:var(--surface);color:var(--fg);border-color:var(--line);box-shadow:0 1px 2px #00000030}
html[data-theme=dark] .button.secondary:hover{background:var(--surface)}
html[data-theme=dark] .button.danger{background:var(--surface);color:var(--danger);border-color:var(--danger-line)}
html[data-theme=dark] .button.danger:hover{background:var(--danger-bg)}
html[data-theme=dark] .page-footer{color:var(--muted)}
html[data-theme=dark] .metric{background:var(--surface)}
html[data-theme=dark] .metric-label{color:var(--muted)}
html[data-theme=dark] .metric-label svg{color:var(--muted)}
html[data-theme=dark] .metric-note{color:var(--muted)}
html[data-theme=dark] .metric-note.good{color:var(--success)}
html[data-theme=dark] .panel{background:var(--surface)}
html[data-theme=dark] .count-pill{background:var(--inset);color:var(--muted)}
html[data-theme=dark] th{color:var(--muted);background:var(--surface)}
html[data-theme=dark] td{border-bottom:1px solid var(--line)}
html[data-theme=dark] .bot-icon{background:var(--inset);color:var(--muted);border:1px solid var(--line)}
html[data-theme=dark] .status{color:var(--warning);background:var(--warning-bg)}
html[data-theme=dark] .status.on{background:var(--success-bg);color:var(--success)}
html[data-theme=dark] .status.off{background:var(--warning-bg);color:var(--warning)}
html[data-theme=dark] .status.bad{background:var(--danger-bg);color:var(--danger)}
html[data-theme=dark] .status.test{background:var(--inset);color:var(--muted)}
html[data-theme=dark] .stats-line{border-bottom:1px solid var(--line)}
html[data-theme=dark] .stats-note{background:var(--surface);color:var(--muted)}
html[data-theme=dark] .channel-symbol{background:var(--inset);color:var(--muted)}
html[data-theme=dark] .channel-name small{color:var(--muted)}
html[data-theme=dark] .channel-count small{color:var(--muted)}
html[data-theme=dark] .positive{color:var(--success)!important}
html[data-theme=dark] .channel-row>svg{color:var(--muted)}
html[data-theme=dark] .history-fold{background:var(--surface)}
html[data-theme=dark] .history-fold>summary{color:var(--muted)}
html[data-theme=dark] .daily-chart text{fill:var(--muted)}
html[data-theme=dark] .requests-bar{fill:var(--accent-text)}
html[data-theme=dark] .sent-bar{fill:var(--chart-secondary)}
html[data-theme=dark] .chart-legend{color:var(--muted)}
html[data-theme=dark] .requests-key:before{background:var(--action-hover)}
html[data-theme=dark] .sent-key:before{background:var(--chart-secondary)}
html[data-theme=dark] .search-box svg{color:var(--muted)}
html[data-theme=dark] input,html[data-theme=dark] select,html[data-theme=dark] textarea{border:1px solid var(--line);color:var(--fg);background:var(--surface)}
html[data-theme=dark] input::placeholder,html[data-theme=dark] textarea::placeholder{color:var(--muted)}
html[data-theme=dark] .note{color:var(--muted)}
html[data-theme=dark] .empty{color:var(--muted)}
html[data-theme=dark] .empty strong{color:var(--muted)}
html[data-theme=dark] .notice{border:1px solid var(--danger-line);background:var(--danger-bg);color:var(--danger)}
html[data-theme=dark] .error-text{color:var(--danger)}
html[data-theme=dark] .activity-icon{background:var(--inset);color:var(--muted)}
html[data-theme=dark] .channel-kpis span{color:var(--muted)}
html[data-theme=dark] .channel-card-bottom small{color:var(--muted)}
html[data-theme=dark] .post-card{background:var(--surface)}
html[data-theme=dark] .message{background:var(--inset);border:1px solid var(--line)}
html[data-theme=dark] .message img,html[data-theme=dark] .message video{background:var(--raised)}
html[data-theme=dark] .message-text .spoiler{background:var(--raised)}
html[data-theme=dark] .message-buttons a{background:var(--accent-bg)}
html[data-theme=dark] .channel-post{background:var(--surface)}
html[data-theme=dark] .drawer-backdrop{background:#00000090}
html[data-theme=dark] .drawer{background:var(--inset);box-shadow:-8px 0 50px #00000030}
html[data-theme=dark] .drawer>header{background:var(--surface)}
html[data-theme=dark] .detail-block{background:var(--surface)}
html[data-theme=dark] .drawer .table-wrap{background:var(--surface)}
html[data-theme=dark] .initial-loading{color:var(--muted)}
html[data-theme=dark] .login-shell{background:var(--inset)}
html[data-theme=dark] .login-card{background:var(--surface);border:1px solid var(--line);box-shadow:0 12px 45px #00000030}
html[data-theme=dark] .login-lead{color:var(--muted)}
html[data-theme=dark] .login-foot{color:var(--muted)}
html[data-theme=dark] .login-caption{color:var(--muted)}
html[data-theme=dark] .privacy-page p{color:var(--muted)}
@media(max-width:760px){
html[data-theme=dark] .more-nav summary{color:var(--muted)}
}
html[data-theme=dark] .audience-summary>div{background:var(--surface)}
html[data-theme=dark] .audience-id{color:var(--accent-text)}
html[data-theme=dark] .audience-id.copied:after{color:var(--success)}
html[data-theme=dark] .audience-bot{background:var(--inset);color:var(--accent-text);border:1px solid var(--line)}
html[data-theme=dark] .audience-bot:hover{background:var(--raised)}

/* flow.css */
html[data-theme=dark] .flow-toolbar{background:var(--surface)}
html[data-theme=dark] .flow-meta span{color:var(--muted)}
html[data-theme=dark] .flow-picker select{background:var(--surface)}
html[data-theme=dark] .flow-actions>span{color:var(--muted)}
html[data-theme=dark] .flow-canvas{background:var(--inset);border:1px solid var(--line)}
html[data-theme=dark] .flow-canvas-head strong{color:var(--muted)}
html[data-theme=dark] .flow-canvas-head span{color:var(--muted)}
html[data-theme=dark] .flow-trigger{background:var(--surface);border:1px solid var(--line)}
html[data-theme=dark] .flow-trigger-icon{background:var(--inset);color:var(--accent-text)}
html[data-theme=dark] .flow-trigger small{color:var(--muted)}
html[data-theme=dark] .flow-connector{color:var(--muted)}
html[data-theme=dark] .flow-node{background:var(--raised);border:1px solid var(--line)}
html[data-theme=dark] .flow-node.selected{border-color:var(--focus);box-shadow:0 0 0 2px #89aaff30}
html[data-theme=dark] .flow-node-head strong{color:var(--muted)}
html[data-theme=dark] .flow-node-head>span{color:var(--muted)}
html[data-theme=dark] .flow-node-tools .icon-button{color:var(--muted)}
html[data-theme=dark] .flow-node-tools .icon-button:hover{background:var(--raised)}
html[data-theme=dark] .flow-message{background:var(--surface);box-shadow:0 1px 3px #00000030}
html[data-theme=dark] .flow-sender{color:var(--accent-text)}
html[data-theme=dark] .flow-message>img,html[data-theme=dark] .flow-message>video{background:var(--raised)}
html[data-theme=dark] .flow-message .message-text a{color:var(--accent-text)}
html[data-theme=dark] .flow-message-buttons a,html[data-theme=dark] .flow-message-buttons span{background:var(--accent-bg);color:var(--accent-text)}
html[data-theme=dark] .flow-placeholder{color:var(--muted)}
html[data-theme=dark] .flow-media-empty{background:var(--inset);color:var(--muted)}
html[data-theme=dark] .flow-edit-link{color:var(--muted)}
html[data-theme=dark] .flow-add{border:1px dashed var(--focus);background:var(--surface);color:var(--muted)}
html[data-theme=dark] .flow-add:hover{background:var(--surface);border-color:var(--focus)}
html[data-theme=dark] .flow-timing-note{color:var(--muted)}
html[data-theme=dark] .flow-editor{background:var(--surface)}
html[data-theme=dark] .field-label{color:var(--muted)}
html[data-theme=dark] .flow-field input,html[data-theme=dark] .flow-field textarea,html[data-theme=dark] .flow-field select,html[data-theme=dark] .flow-button-row input{border:1px solid var(--line);background:var(--surface);color:var(--fg)}
html[data-theme=dark] .flow-field small{color:var(--muted)}
html[data-theme=dark] .flow-field input[type=file]::file-selector-button{background:var(--inset);color:var(--muted)}
html[data-theme=dark] .format-button{background:var(--inset);color:var(--muted)}
html[data-theme=dark] .format-button:hover{background:var(--raised);color:var(--accent-text)}
html[data-theme=dark] .flow-char-count{color:var(--muted)}
html[data-theme=dark] .flow-first-note{color:var(--muted)}
html[data-theme=dark] .flow-button-heading strong{color:var(--muted)}
html[data-theme=dark] .flow-button-heading span{color:var(--muted)}
html[data-theme=dark] .flow-button-row{background:var(--inset);border:1px solid var(--line)}
html[data-theme=dark] .flow-button-row .icon-button{color:var(--muted)}
html[data-theme=dark] .flow-save-note{color:var(--muted)}
html[data-theme=dark] .flow-approvals{background:var(--surface)}
html[data-theme=dark] .flow-approval-details>summary{color:var(--muted)}
html[data-theme=dark] .flow-approval-details>summary strong{color:var(--muted)}
html[data-theme=dark] .flow-approval-details>summary span{color:var(--muted)}
html[data-theme=dark] .approval-row small{color:var(--muted)}
html[data-theme=dark] .approval-switch>span:last-child{color:var(--muted)}
html[data-theme=dark] .switch-track{background:var(--raised)}
html[data-theme=dark] .switch-track:after{background:#ffffff;box-shadow:0 1px 2px #00000030}
html[data-theme=dark] .approval-switch input:focus-visible+.switch-track{outline:2px solid var(--focus)}
@media(max-width:900px){
html[data-theme=dark] .flow-view-switch{background:var(--inset)}
html[data-theme=dark] .flow-pane-button{color:var(--muted)}
html[data-theme=dark] .flow-pane-button.active{background:var(--surface);color:var(--muted);box-shadow:0 1px 3px #00000030}
}

/* features.css */
html[data-theme=dark] .vf-head p{color:var(--muted)}
html[data-theme=dark] .vf-save-state{color:var(--muted)}
html[data-theme=dark] .vf-section{border:1px solid var(--line);background:var(--surface)}
html[data-theme=dark] .vf-section>summary{color:var(--muted)}
html[data-theme=dark] .vf-section>summary:after{color:var(--muted)}
html[data-theme=dark] .vf-section>summary>div>span{color:var(--muted)}
html[data-theme=dark] .vf-section>summary:focus-visible{outline:2px solid var(--focus)}
html[data-theme=dark] .vf-state{background:var(--inset);color:var(--muted)}
html[data-theme=dark] .vf-state.on{color:var(--success);background:var(--success-bg)}
html[data-theme=dark] .vf-section-body{border-top:1px solid var(--line)}
html[data-theme=dark] .vf-toggle{color:var(--muted)}
html[data-theme=dark] .vf-note{color:var(--muted)}
html[data-theme=dark] .vf-label{color:var(--muted)}
html[data-theme=dark] .vf-field input,html[data-theme=dark] .vf-field select,html[data-theme=dark] .vf-field textarea,html[data-theme=dark] .vf-button-row input{border:1px solid var(--line)}
html[data-theme=dark] .vf-field small{color:var(--muted)}
html[data-theme=dark] .vf-button-row{background:var(--inset)}
html[data-theme=dark] .vf-button-row .icon-button{color:var(--muted)}
html[data-theme=dark] .vf-remove{color:var(--danger)}
html[data-theme=dark] .vf-empty{color:var(--muted)}
html[data-theme=dark] .vf-preview{border:1px solid var(--line);background:var(--inset)}
html[data-theme=dark] .vf-preview-label{color:var(--muted)}
html[data-theme=dark] .vf-message{background:var(--surface);box-shadow:0 1px 3px #00000030}
html[data-theme=dark] .vf-sender{color:var(--accent-text)}
html[data-theme=dark] .vf-message>img,html[data-theme=dark] .vf-message>video{background:var(--raised)}
html[data-theme=dark] .vf-message-text a{color:var(--accent-text)}
html[data-theme=dark] .vf-placeholder{color:var(--muted)}
html[data-theme=dark] .vf-message-buttons a{color:var(--accent-text);background:var(--accent-bg)}
html[data-theme=dark] .vf-settings-body{border-top:1px solid var(--line)}

/* channel-registry.css */
html[data-theme=dark] .cr-sidebar{background:var(--surface)}
html[data-theme=dark] .cr-sidebar-head>span{color:var(--muted)}
html[data-theme=dark] .cr-channel{background:var(--surface);border:1px solid var(--line)}
html[data-theme=dark] .cr-channel:hover{border-color:var(--line);background:var(--inset)}
html[data-theme=dark] .cr-channel.active{border-color:var(--focus);background:var(--accent-bg)}
html[data-theme=dark] .cr-channel-name small{color:var(--muted)}
html[data-theme=dark] .cr-channel-count small{color:var(--muted)}
html[data-theme=dark] .cr-channel-footer{color:var(--muted)}
html[data-theme=dark] .cr-live{color:var(--success)}
html[data-theme=dark] .cr-paused{color:var(--warning)}
html[data-theme=dark] .cr-detail-head p,html[data-theme=dark] .cr-detail-head small{color:var(--muted)}
html[data-theme=dark] .cr-scope-note{color:var(--muted)}
html[data-theme=dark] .cr-metric{background:var(--surface)}
html[data-theme=dark] .cr-metric>span{color:var(--muted)}
html[data-theme=dark] .cr-metric>small{color:var(--muted)}
html[data-theme=dark] .cr-positive>strong{color:var(--success)}
html[data-theme=dark] .cr-known-counts{color:var(--muted)}
html[data-theme=dark] .cr-known-counts strong{color:var(--muted)}
html[data-theme=dark] .cr-known-counts .cr-warning{color:var(--warning)}
html[data-theme=dark] .cr-people{background:var(--surface)}
html[data-theme=dark] .cr-table-wrap th{color:var(--muted);background:var(--surface)}
html[data-theme=dark] .cr-table-wrap td{border-bottom:1px solid var(--line)}
html[data-theme=dark] .cr-person-id{color:var(--muted)}
html[data-theme=dark] .cr-person-status{background:var(--inset);color:var(--muted)}
html[data-theme=dark] .cr-person-status.member{color:var(--success);background:var(--success-bg)}
html[data-theme=dark] .cr-person-status.left{color:var(--warning);background:var(--warning-bg)}
html[data-theme=dark] .cr-person-status.pending{color:var(--accent-text);background:var(--inset)}
html[data-theme=dark] .cr-date{color:var(--muted)}
html[data-theme=dark] .cr-person-events>span{color:var(--muted)}
html[data-theme=dark] .cr-pagination{color:var(--muted)}
html[data-theme=dark] .cr-empty{color:var(--muted)}
html[data-theme=dark] .cr-empty>strong{color:var(--muted)}
html[data-theme=dark] .cr-history{background:var(--surface)}
html[data-theme=dark] .cr-history>summary{color:var(--muted)}
html[data-theme=dark] .cr-period-counts{color:var(--muted)}
html[data-theme=dark] .channel-registry{color:var(--fg)}
html[data-theme=dark] .cr-sidebar-head h2,html[data-theme=dark] .cr-channel-name strong{color:var(--fg)}
html[data-theme=dark] .cr-sidebar-head>span,html[data-theme=dark] .cr-channel-name small,html[data-theme=dark] .cr-channel-count small{color:var(--muted)}
html[data-theme=dark] .cr-channel-footer{color:var(--muted)}
html[data-theme=dark] .cr-live{color:var(--success)}
html[data-theme=dark] .cr-paused{color:var(--warning)}
html[data-theme=dark] .cr-detail-head p,html[data-theme=dark] .cr-detail-head small{color:var(--muted)}
html[data-theme=dark] .cr-scope-note{color:var(--muted)}
html[data-theme=dark] .cr-metric>span{color:var(--muted)}
html[data-theme=dark] .cr-metric>strong{color:var(--fg)}
html[data-theme=dark] .cr-positive>strong{color:var(--success)}
html[data-theme=dark] .cr-metric>small{color:var(--muted)}
html[data-theme=dark] .cr-known-counts{color:var(--muted)}
html[data-theme=dark] .cr-known-counts strong{color:var(--fg)}
html[data-theme=dark] .cr-known-counts .cr-warning{color:var(--warning)}
html[data-theme=dark] .cr-table-wrap th{color:var(--muted)}
html[data-theme=dark] .cr-person-id{color:var(--fg)}
html[data-theme=dark] .cr-person-status{color:var(--fg)}
html[data-theme=dark] .cr-person-status.member{color:var(--success)}
html[data-theme=dark] .cr-person-status.left{color:var(--warning)}
html[data-theme=dark] .cr-person-status.pending{color:var(--accent-text)}
html[data-theme=dark] .cr-date{color:var(--muted)}
html[data-theme=dark] .cr-person-events>span{color:var(--muted)}
html[data-theme=dark] .cr-pagination{color:var(--muted)}
html[data-theme=dark] .cr-empty{color:var(--muted)}
html[data-theme=dark] .cr-empty>strong{color:var(--fg)}
html[data-theme=dark] .cr-history>summary{color:var(--fg)}
html[data-theme=dark] .cr-period-counts{color:var(--muted)}
html[data-theme=dark] .cr-person-username{color:var(--accent-text)}
html[data-theme=dark] .cr-person-username+.cr-person-id{color:var(--muted)}

/* Action backgrounds are separate from link colors to retain white-label contrast. */
html[data-theme=dark] .button.primary{background:var(--action);color:#fff}
html[data-theme=dark] .button.primary:hover{background:var(--action-hover)}
html[data-theme=dark] .approval-switch input:checked+.switch-track{background:var(--action)}
html[data-theme=dark] .nav-link.active{color:var(--fg)}
html[data-theme=dark] input[type=checkbox]{accent-color:var(--action)}
html[data-theme=dark] .theme-toggle{background:var(--theme-button-bg);color:var(--theme-button-fg);border-color:var(--theme-button-line)}
html[data-theme=dark] .theme-toggle:hover{background:var(--theme-button-hover)}
