/* Shared presentation tokens. No filters/inversion: scientific figures stay intact. */
html[data-site-theme="light"]{--site-bg:#f5f5f7;--site-panel:#fff;--site-panel-alt:#eff1f5;--site-text:#1d1d1f;--site-muted:#59616e;--site-border:#d3d8e1;--site-accent:#0066cc;--site-focus:#0071e3;--site-success:#087443;--site-danger:#b42318;--site-warning:#895200;--site-shadow:0 8px 30px #1823310c;color-scheme:light}
html[data-site-theme="dark"]{--site-bg:#0d1117;--site-panel:#171d27;--site-panel-alt:#202937;--site-text:#eef2f8;--site-muted:#bac4d4;--site-border:#3d4a5d;--site-accent:#87bcff;--site-focus:#91c2ff;--site-success:#85e0af;--site-danger:#ffb4aa;--site-warning:#f5d083;--site-shadow:0 8px 30px #0005;color-scheme:dark}
html[data-site-theme],html[data-site-theme] body{background:var(--site-bg)!important;color:var(--site-text)!important;min-height:100%;color-scheme:inherit}
html[data-site-theme] body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif}
html[data-site-theme] :where(h1,h2,h3,h4,h5,h6,label,legend,th,strong,.stat-text){color:var(--site-text)!important}
html[data-site-theme] :where(p,.subtitle,.hint,.muted,.login-sub,.developer-note,.intro-copy,.stat-name,.stat-label,.account-menu summary,.reason-row,.text-muted){color:var(--site-muted)!important}
html[data-site-theme] :where(a,.link-button,.eyebrow,.extractor-eyebrow){color:var(--site-accent)}
html[data-site-theme] :where(.bg-poster,.bg-video,.overlay){display:none!important}
html[data-site-theme] :where(.navbar,.site-header){background:var(--site-panel)!important;border-color:var(--site-border)!important;color:var(--site-text)!important}
html[data-site-theme] :where(.navbar .brand,.navbar .brand span,.navbar .nav-links a,.site-header .brand,.site-header nav a){color:var(--site-text)!important}
html[data-site-theme] :where(.glass-panel,.section-box,.primary-card,.module-card,.workspace,.workspace-head,.modal-card,.modal-content,.account-menu-items,.stat-card,.overview-card,.summary-card,.metric-card,.extractor-controls,.extractor-output,.calendar-card,.meeting-controls,.meeting-calendar-column,.chart-card,.card,.panel,.sidebar,.content-card){background:var(--site-panel)!important;color:var(--site-text)!important;border-color:var(--site-border)!important;box-shadow:var(--site-shadow)}
html[data-site-theme] :where(.toolbox,.history-item,.meeting-account-settings>summary,.extractor-usage-details,.extractor-status,.bulk-check-item,.bulk-preview,.empty-state,.table-pagination,.pagination,.chatgpt-reminder,.status-banner,.setting-card,.selection-summary){background:var(--site-panel-alt)!important;color:var(--site-text)!important;border-color:var(--site-border)!important}
html[data-site-theme] :where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]),select,textarea,.form-control,.copy-textbox){background:var(--site-panel)!important;color:var(--site-text)!important;border:1px solid var(--site-border)!important;caret-color:var(--site-text)}
html[data-site-theme] :where(input,textarea)::placeholder{color:var(--site-muted)!important;opacity:.9}
html[data-site-theme] :where(input,select,textarea):disabled{background:var(--site-panel-alt)!important;color:var(--site-muted)!important}
html[data-site-theme] :where(input[type=checkbox],input[type=radio]){accent-color:var(--site-focus)}
html[data-site-theme] :where(button,.btn,.card-action){color:var(--site-text);border-color:var(--site-border)}
html[data-site-theme] :where(.btn,.btn-primary,.card-action,button[type=submit]){background:#086ad4!important;color:#fff!important;border-color:#086ad4!important}
html[data-site-theme] :where(.btn-outline,.btn-muted,.btn-secondary,.btn-ghost,.password-toggle,.calendar-days button,.calendar-slots button,.tab-btn,.pagination button,.modal-close,.toast-close){background:var(--site-panel-alt)!important;color:var(--site-text)!important;border-color:var(--site-border)!important}
html[data-site-theme] .calendar-days button.today{background:#fff7ed!important;color:#9a3412!important;border-color:#d97706!important;outline:none!important;font-weight:700}
html[data-site-theme="dark"] .calendar-days button.today{background:rgba(245,158,11,.18)!important;color:#fde68a!important;border-color:#f59e0b!important}
html[data-site-theme] :where(.tab-btn.active,.calendar-days button.selected,.primary-nav-link.is-current){background:var(--site-panel-alt)!important;color:var(--site-accent)!important;border-color:var(--site-focus)!important;box-shadow:inset 0 0 0 1px var(--site-focus)}
html[data-site-theme] .calendar-slots button.selected,html[data-site-theme] .calendar-slots button.drag-preview{background:#e8f2fc!important;color:#005bb5!important;border:2px solid #0071e3!important;box-shadow:inset 0 0 0 1px #0071e3!important;font-weight:700}
html[data-site-theme="dark"] .calendar-slots button.selected,html[data-site-theme="dark"] .calendar-slots button.drag-preview{background:rgba(59,130,246,.24)!important;color:#bfdbfe!important;border:2px solid #60a5fa!important;box-shadow:inset 0 0 0 1px #60a5fa!important;font-weight:700}
html[data-site-theme] .calendar-days button.today.selected{background:#e8f2fc!important;color:#0066cc!important;border-color:#0071e3!important;box-shadow:inset 0 0 0 1px #0071e3,0 0 0 2px #f59e0b!important}
html[data-site-theme="dark"] .calendar-days button.today.selected{background:#1b2c44!important;color:#91c2ff!important;border-color:#91c2ff!important;box-shadow:inset 0 0 0 1px #91c2ff,0 0 0 2px #f59e0b!important}
html[data-site-theme] :where(button,a,input,select,textarea,summary):focus-visible{outline:3px solid var(--site-focus)!important;outline-offset:3px}
html[data-site-theme] :where(button,.btn):disabled{opacity:.55;cursor:not-allowed}
html[data-site-theme] :where(table,.admin-table,.data-table){background:var(--site-panel)!important;color:var(--site-text)!important;border-color:var(--site-border)!important}
html[data-site-theme] :where(th,td,.admin-table th,.admin-table td){color:var(--site-text)!important;border-color:var(--site-border)!important}
html[data-site-theme] :where(thead,th,.admin-table thead,.admin-table th){background:var(--site-panel-alt)!important}
html[data-site-theme] :where(tbody tr:hover,.admin-table tbody tr:hover){background:var(--site-panel-alt)!important}
html[data-site-theme] :where(pre,code,.extractor-code,.code-output){background:var(--site-panel-alt)!important;color:var(--site-text)!important;border-color:var(--site-border)!important}
html[data-site-theme] :where(.toast,.alert,.message,.notification){background:var(--site-panel)!important;color:var(--site-text)!important;border:1px solid var(--site-border)!important;box-shadow:var(--site-shadow)}
html[data-site-theme] :where(.toast-danger,.toast-error,.alert-danger,.error,.text-danger,.badge-danger,.badge-failed,.calendar-slots button.busy){color:var(--site-danger)!important;border-color:var(--site-danger)!important}
html[data-site-theme] :where(.toast-success,.alert-success,.success,.text-success,.badge-success){color:var(--site-success)!important;border-color:var(--site-success)!important}
html[data-site-theme] :where(.toast-warning,.alert-warning,.warning,.badge-warn,.warn){color:var(--site-warning)!important;border-color:var(--site-warning)!important}
html[data-site-theme] :where(.badge,.tag,.chip){background:var(--site-panel-alt)!important;color:var(--site-text);border-color:var(--site-border)!important}
html[data-site-theme] :where(.modal-backdrop,#modal-backdrop,.backdrop){background:#0009!important}
html[data-site-theme] :where(iframe){background:var(--site-bg);border-color:var(--site-border)!important}
html[data-site-theme] :where(.toolbox,.module-card,.primary-card,.account-menu-items,.meeting-account-settings){border-color:var(--site-border)!important}
html[data-site-theme] .site-theme-toggle{font:inherit;font-size:12px;font-weight:600;white-space:nowrap;min-height:44px;padding:8px 12px;border:1px solid var(--site-border)!important;border-radius:999px;background:var(--site-panel-alt)!important;color:var(--site-text)!important;cursor:pointer;touch-action:manipulation}
html[data-site-theme] .site-theme-floating{position:fixed;bottom:max(16px,env(safe-area-inset-bottom));right:max(16px,env(safe-area-inset-right));z-index:1000;box-shadow:var(--site-shadow)}
html[data-site-theme] .portal-quick-bar{position:sticky;top:0;z-index:40;display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:8px 16px;background:var(--site-panel)!important;border-bottom:1px solid var(--site-border)!important;font-size:13px;line-height:1.4}
html[data-site-theme] .portal-quick-bar a{display:inline-flex;align-items:center;padding:5px 11px;border-radius:999px;border:1px solid var(--site-border);background:var(--site-panel-alt);color:var(--site-text)!important;text-decoration:none;white-space:nowrap}
html[data-site-theme] .portal-quick-bar a.portal-quick-brand{border:0;background:transparent!important;font-weight:700;padding-left:2px;margin-right:4px}
html[data-site-theme] .portal-quick-bar a[aria-current="page"]{background:#086ad4!important;border-color:#086ad4!important;color:#fff!important;font-weight:600}
html[data-site-theme] .calendar-legend{display:flex;flex-wrap:wrap;gap:12px;align-items:center;font-size:12px;color:var(--site-muted);margin:8px 0 0}
html[data-site-theme] .calendar-legend i{display:inline-block;width:10px;height:10px;border-radius:3px;vertical-align:middle;margin-right:4px}
html[data-site-theme] .btn-link{background:none!important;border:0!important;padding:2px 4px!important;color:var(--site-accent)!important;font:inherit;cursor:pointer;text-decoration:underline dotted;min-height:auto!important}
@media(max-width:760px){html[data-site-theme] .navbar .nav-links{display:flex;flex-wrap:wrap;align-items:center}html[data-site-theme] .site-theme-toggle{margin-left:auto}html[data-site-theme] .site-header nav{flex-wrap:wrap;gap:6px}}
@media(prefers-reduced-motion:reduce){html[data-site-theme] *{scroll-behavior:auto!important}}

html[data-site-theme] :where(.bg-white,.bg-slate-50,.bg-gray-50,.bg-neutral-50,.bg-background,.bg-card){background:var(--site-panel)!important}
html[data-site-theme] :where(.text-gray-900,.text-slate-900,.text-zinc-900,.text-foreground){color:var(--site-text)!important}
html[data-site-theme] :where(.text-gray-500,.text-slate-500,.text-muted-foreground,.hero-emphasis){color:var(--site-muted)!important}

html[data-site-theme] :where(.admin-heading-badge,.badge-admin,.badge-user,.extractor-header-badge){background:var(--site-panel-alt)!important;color:var(--site-accent)!important;border-color:var(--site-border)!important}

/* Retained scientific-app palettes use these aliases and Tailwind utilities. */
html[data-site-theme]{--color-base:var(--site-bg)!important;--color-surface:var(--site-panel)!important;--color-card:var(--site-panel)!important;--color-card-hover:var(--site-panel-alt)!important;--color-card-glass:var(--site-panel)!important;--bg:var(--site-bg)!important;--surface:var(--site-panel)!important;--muted:var(--site-muted)!important;--accent:var(--site-accent)!important;--text-primary:var(--site-text)!important;--text-secondary:var(--site-muted)!important}
html[data-site-theme] :where(.bg-base){background:var(--site-bg)!important}
html[data-site-theme] :where(.bg-surface,.bg-surface\/90,.bg-slate-800,.bg-slate-800\/80,.bg-slate-900,.bg-slate-950){background:var(--site-panel)!important;color:var(--site-text)!important}
html[data-site-theme] :where(.text-white,.text-slate-100,.text-slate-200,.text-slate-300,.text-gray-100,.text-gray-200,.text-zinc-100){color:var(--site-text)!important}
html[data-site-theme] :where(.text-slate-400,.text-gray-400,.text-zinc-400){color:var(--site-muted)!important}
html[data-site-theme] :where(.border-slate-700,.border-slate-800,.border-gray-700){border-color:var(--site-border)!important}
html[data-site-theme] :where(.bg-indigo-600,.bg-blue-600,.bg-blue-500,.bg-emerald-600,.bg-red-600){color:#fff!important}
html[data-site-theme="light"] :where(.text-indigo-300,.text-indigo-400,.text-blue-300){color:var(--site-accent)!important}
html[data-site-theme="light"] :where(.text-amber-300,.text-yellow-300){color:var(--site-warning)!important}
html[data-site-theme="light"] :where(.text-cyan-300,.text-emerald-300){color:var(--site-success)!important}
html[data-site-theme] button[data-site-theme-native]{min-width:44px;min-height:44px;color:var(--site-text)!important}
html[data-site-theme] :where(.app-shell){background:var(--site-bg)!important;color:var(--site-text)!important}
html[data-site-theme] :where(.topbar,.quota-strip,.settings-panel,.dropzone,.document-editor,.export-box,.mode-help,.source-choice){background:var(--site-panel)!important;color:var(--site-text)!important;border-color:var(--site-border)!important}
html[data-site-theme] :where(.preview-empty,.free-note,.file-name,.notice,.top-note,.settings-heading,.mode-control,.status.info){color:var(--site-muted)!important}
html[data-site-theme] :where(.settings-toggle,.action,.result-actions button,.export-actions button){background:var(--site-panel-alt)!important;color:var(--site-text)!important;border-color:var(--site-border)!important}
html[data-site-theme] :where(.file-button,.primary-button){background:#086ad4!important;color:#fff!important;border-color:#086ad4!important}

/* Legacy scientific controls: theme the UI, keeping canvas/SVG/export data intact. */
html[data-site-theme] :where(.param-item,.metrics-strip,.metric,.status-box,.quality-box,.result-box,.control-panel,.main-panel,.panel-section,.pool-summary,.status-strip,.app-header,.app-footer){background:var(--site-panel)!important;color:var(--site-text)!important;border-color:var(--site-border)!important}
html[data-site-theme] :where(.section-title,.param-live-value,.checkbox-label,.field>span,.number-field>span,.metric>span,.quick-label,.pool-summary strong){color:var(--site-text)!important}
html[data-site-theme] :where(.pool-hint,.parameter-status,.app-subtitle,.help-list,.metric-label){color:var(--site-muted)!important}
html[data-site-theme] :where(.app-shell button,.button-like,.file-action,.ghost-link,.settings-btn){background:var(--site-panel-alt)!important;color:var(--site-text)!important;border-color:var(--site-border)!important}
html[data-site-theme] :where(.primary-btn,.btn-upload,.app-shell button.primary,.app-shell button.primary-button,.app-shell .file-button){background:#086ad4!important;color:#fff!important;border-color:#086ad4!important}
html[data-site-theme] .heading-xl{background:none!important;background-clip:initial!important;-webkit-text-fill-color:var(--site-text)!important;color:var(--site-text)!important}
html[data-site-theme] :where(.layer-row,.param-live-value,.parameter-status){background:var(--site-panel-alt)!important;color:var(--site-text)!important;border-color:var(--site-border)!important}
html[data-site-theme] :where(.param-name,.param-input>span,.pool-summary span,.file-action span,.button-like span){color:var(--site-text)!important}
html[data-site-theme] :where(.app-shell button small){color:var(--site-muted)!important}
html[data-site-theme] :where(.icon-btn,.square-btn){background:var(--site-panel-alt)!important;color:var(--site-text)!important;border-color:var(--site-border)!important}
@media(max-width:760px){
  /* NK's retained desktop sidebar must not squeeze its main content on phones. */
  html[data-site-theme] #root:has(aside.w-72)>div>header{position:relative!important;height:auto!important;min-height:64px;flex-wrap:wrap;gap:10px;padding:12px!important}
  html[data-site-theme] #root:has(aside.w-72)>div>.pt-16{padding-top:0!important;flex-direction:column;overflow:visible!important}
  html[data-site-theme] #root aside.w-72{width:100%!important;height:auto!important;max-height:340px;border-right:0!important;flex-shrink:0}
  html[data-site-theme] #root:has(aside.w-72) main{width:100%;min-width:0;overflow:visible!important}
  html[data-site-theme] #root:has(aside.w-72) main :where(.grid-cols-2,.grid-cols-3){grid-template-columns:minmax(0,1fr)!important}
  html[data-site-theme] :where(.layer-row){min-width:0;grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important}
  html[data-site-theme] :where(.layer-row input,.layer-row select){min-width:0;width:100%;box-sizing:border-box}
  html[data-site-theme] :where(.tabs,.tab-list){max-width:100%;overflow-x:auto}
}

.cmd-trigger-btn{display:inline-flex;align-items:center;gap:4px;min-height:32px;padding:0 10px;border-radius:999px;border:1px solid var(--site-border,#d3d8e1);background:var(--site-panel-alt,#f5f7fa);color:var(--site-text,#1d232f);font:inherit;font-size:12px;font-weight:600;cursor:pointer;white-space:nowrap}
.cmd-trigger-btn:hover{border-color:#086ad4;color:#086ad4}
.cmd-palette-backdrop{position:fixed;inset:0;z-index:9999;background:rgba(15,23,42,.42);backdrop-filter:blur(4px);display:flex;align-items:flex-start;justify-content:center;padding:12vh 16px 24px}
.cmd-palette-backdrop[hidden]{display:none!important}
.cmd-palette-dialog{width:min(560px,100%);background:var(--site-panel,#fff);color:var(--site-text,#111827);border:1px solid var(--site-border,#d3d8e1);border-radius:16px;box-shadow:0 24px 60px rgba(0,0,0,.22);overflow:hidden}
.cmd-palette-input{width:100%;box-sizing:border-box;padding:14px 16px;border:0;border-bottom:1px solid var(--site-border,#e5e7eb);background:transparent;color:inherit;font-size:15px;outline:none}
.cmd-palette-list{max-height:340px;overflow-y:auto;padding:8px}
.cmd-palette-item{width:100%;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 12px;border:0;border-radius:10px;background:transparent;color:inherit;text-align:left;cursor:pointer}
.cmd-palette-item.is-active,.cmd-palette-item:hover{background:rgba(8,106,212,.11)}
.cmd-palette-item-main{display:flex;flex-direction:column;gap:2px;min-width:0}
.cmd-palette-item-main strong{font-size:14px;font-weight:600}
.cmd-palette-item-main small{font-size:12px;color:var(--site-muted,#64748b);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cmd-palette-tag{flex-shrink:0;font-size:11px;padding:2px 8px;border-radius:999px;background:var(--site-panel-alt,#f1f5f9);color:var(--site-muted,#475569)}
.cmd-palette-empty{padding:24px 16px;text-align:center;color:var(--site-muted,#64748b);font-size:13px}
.cmd-palette-hint{padding:8px 14px;border-top:1px solid var(--site-border,#e5e7eb);font-size:12px;color:var(--site-muted,#64748b);background:var(--site-panel-alt,#f8fafc)}
