/* Shared theme tokens override the original palette without changing layout. */
:root,[data-theme="orange"]{
  --bg:#f8f7f5;--white:#fff;--ink:#253247;--muted:#667085;--border:#e6e7eb;
  --primary:#b94b16;--primary-dark:#993c0d;--green:#187c61;--shadow:0 3px 18px #35281707;
  --theme-surface:#fff;--theme-muted-surface:#f8f9fb;--theme-hover:#f4f5f7;
  --theme-soft:#fff0e5;--theme-soft-end:#fff7ed;--theme-accent-border:#efcbb5;--theme-accent-ink:#a94210;
  --theme-on-primary:#fff;--theme-login-start:#5b2d1b;--theme-login-end:#a94d22;
  --theme-success-bg:#e9f5ef;--theme-success-ink:#23734f;--theme-success-border:#cce6d7;
  --theme-warning-bg:#fff3de;--theme-warning-ink:#8f5b17;--theme-warning-border:#efd8af;
  --theme-danger-bg:#fff0ed;--theme-danger-ink:#ad4937;--theme-danger-border:#efd0c8;
}
[data-theme="blue"]{
  --bg:#f4f7fb;--primary:#1e66bb;--primary-dark:#164f96;--theme-soft:#eaf3ff;--theme-soft-end:#f1f8ff;
  --theme-accent-border:#bbd3f1;--theme-accent-ink:#175aab;--theme-login-start:#173458;--theme-login-end:#2869ad;
}
[data-theme="indigo"]{
  --bg:#f5f6fb;--primary:#5363dc;--primary-dark:#4052c8;--theme-soft:#eef0ff;--theme-soft-end:#f2f4ff;
  --theme-accent-border:#c5cbf5;--theme-accent-ink:#4656c4;--theme-login-start:#293964;--theme-login-end:#53639d;
}
[data-theme="jade"]{
  --bg:#f3f8f6;--primary:#167b69;--primary-dark:#0e6254;--theme-soft:#e6f5ef;--theme-soft-end:#eefaf5;
  --theme-accent-border:#b4dccc;--theme-accent-ink:#116955;--theme-login-start:#153d36;--theme-login-end:#247965;
}
[data-theme="rose"]{
  --bg:#faf5f9;--primary:#9c427f;--primary-dark:#7f3067;--theme-soft:#f9eaf4;--theme-soft-end:#fff1f7;
  --theme-accent-border:#e7bfd8;--theme-accent-ink:#89326e;--theme-login-start:#47253f;--theme-login-end:#92517e;
}
[data-theme="midnight"]{
  --bg:#111a29;--white:#1a2637;--ink:#e7edf7;--muted:#a4b3c8;--border:#324157;
  --primary:#ffb078;--primary-dark:#ffc397;--green:#71d4ad;--shadow:0 3px 18px #0000001c;
  --theme-surface:#1a2637;--theme-muted-surface:#202e42;--theme-hover:#26364c;
  --theme-soft:#382f2c;--theme-soft-end:#302d35;--theme-accent-border:#78523b;--theme-accent-ink:#ffbc8f;
  --theme-on-primary:#222d3c;--theme-login-start:#142234;--theme-login-end:#30465e;
  --theme-success-bg:#1c3e36;--theme-success-ink:#9de0be;--theme-success-border:#326254;
  --theme-warning-bg:#423923;--theme-warning-ink:#f1ce8b;--theme-warning-border:#665639;
  --theme-danger-bg:#442e31;--theme-danger-ink:#ffb7ad;--theme-danger-border:#71434a;
}

body,.login-page{background:var(--bg);color:var(--ink)}
::selection{background:var(--theme-accent-border);color:var(--ink)}
:is(.kpi strong,.quick-stats strong,.todo-item strong,.approval-row strong,.user-link,.kanban-card strong,.app-card h3,.resource-card h2,.panel-heading h2,.page-heading h1){color:var(--ink)}
.user-link small{color:var(--muted)}
:is(.sidebar,.topbar,.panel,.kpi,.app-card,.resource-card,.flow-steps,.kanban-card,.date-chip){background:var(--theme-surface);border-color:var(--border)}
:is(.sidebar-bottom,.brand-sub,.nav-label,.subnav a,.breadcrumb,.notification,footer,.page-heading p,.date-chip,.kpi-label,.kpi-note,.app-card p,.app-card-foot,.panel-heading p,.todo-item small,.approval-row small,.quick-stats span,.quick-stats small,.empty,.empty p,.empty-cell,.back-link,.pagination,.resource-card p,.help-text,.detail-fields dt,.related-row span,.attachment-list small,.timeline-item p,.timeline-item small,.panel-note,.definitions,.settings-form .helptext,.department-list>div,.cell-sub,.kanban-card p,.kanban-card small,.kanban-empty){color:var(--muted)}
:is(.nav-item,.secondary,.form-field label,.settings-form label,.approval-form label,.detail-fields dd,.resource-card strong,.timeline-item strong,.definitions summary,.kanban-column h3,.login-form label){color:var(--ink)}
.sidebar-bottom small,.card-arrow,.app-card-foot>span,.breadcrumb span{color:var(--muted)}
.logout{color:var(--muted)!important}
.subnav,.version{border-color:var(--border)}
.nav-item:hover,.subnav a:hover{background:var(--theme-hover);color:var(--primary)}
.nav-item.active{background:var(--theme-soft);color:var(--theme-accent-ink)}
.subnav a.selected{color:var(--theme-accent-ink)}
.workspace-icon,.avatar,.count-badge,.resource-index,.todo-icon,.button-badge{background:var(--theme-soft);color:var(--theme-accent-ink)}
.demo-badge,.pill{background:var(--theme-muted-surface);color:var(--muted)}
.notification:hover,.icon-button{color:var(--primary)}
.notification b{background:var(--theme-danger-ink);color:var(--theme-surface)}
.top-divider{background:var(--border)}
.primary{background:var(--primary);color:var(--theme-on-primary)}
.primary:hover{background:var(--primary-dark)}
.secondary,.white{background:var(--theme-surface);border-color:var(--border);color:var(--ink)}
.white{color:var(--theme-accent-ink)}
.danger,.errorlist,.message.error{background:var(--theme-danger-bg);color:var(--theme-danger-ink);border-color:var(--theme-danger-border)}
.required{color:var(--theme-danger-ink)}
.welcome-strip{background:linear-gradient(110deg,var(--theme-soft),var(--theme-soft-end));border-color:var(--theme-accent-border)}
.welcome-strip strong,.welcome-strip p{color:var(--theme-accent-ink)}
.status-dot,.blue-bg{background:var(--primary)}
.strip-grid{background-image:linear-gradient(color-mix(in srgb,var(--primary) 12%,transparent) 1px,transparent 1px),linear-gradient(90deg,color-mix(in srgb,var(--primary) 12%,transparent) 1px,transparent 1px)}
.kpi-note em,.kpi-note em.orange-text{color:var(--theme-accent-ink)}
.kpi strong small{color:var(--muted)}
.app-card:hover,.resource-card:hover{border-color:var(--theme-accent-border);box-shadow:var(--shadow)}
.app-icon{background:color-mix(in srgb,var(--app-color) 12%,var(--theme-surface))}
.app-card-foot,.todo-item,.approval-row,.quick-stats>div,.related-row,.panel-note{border-color:var(--border)}
.subtle-link,.pagination a,.record-link,.attachment-list a,.funnel-row strong{color:var(--theme-accent-ink)}
.attachment-list a>span{color:var(--theme-accent-ink)}
.subtle-link:hover,.record-link:hover,.back-link:hover{color:var(--primary)}
.chart-grid span{border-color:var(--border)}
.chart-bar{background:linear-gradient(var(--theme-accent-border),var(--theme-soft))}
.chart-bar.current{background:linear-gradient(var(--primary),var(--theme-accent-border))}
.chart-label,.chart-value{color:var(--muted)}
.badge{background:var(--theme-muted-surface);color:var(--muted)}
.badge.amber,.badge[data-status='审批中'],.badge[data-status='试用'],.badge[data-status='待面试'],.badge[data-status='准备中']{background:var(--theme-warning-bg);color:var(--theme-warning-ink)}
.badge[data-status='已通过'],.badge[data-status='已交付'],.badge[data-status='已成交'],.badge[data-status='合作'],.badge[data-status='在职'],.badge[data-status='有效'],.badge[data-status='生效']{background:var(--theme-success-bg);color:var(--theme-success-ink)}
.badge[data-status='已驳回'],.badge[data-status='已作废'],.badge[data-status='紧急'],.badge[data-status='离职']{background:var(--theme-danger-bg);color:var(--theme-danger-ink)}
.badge[data-status='跟进中'],.badge[data-status='文案中'],.badge[data-status='拍摄中'],.badge[data-status='剪辑中'],.badge[data-status='交付中']{background:var(--theme-soft);color:var(--theme-accent-ink)}
th{background:var(--theme-muted-surface);color:var(--muted);border-color:var(--border)}
td{color:var(--ink);border-color:var(--border)}
tbody tr:hover{background:var(--theme-hover)}
.search-box{border-color:var(--border)}
.search-box>span,.empty>span,.empty h3,.flow-step,.kanban-column h3>span:last-child{color:var(--muted)}
.empty.compact>span{background:var(--theme-muted-surface)}
input,select,textarea{background:var(--theme-surface);border-color:var(--border);color:var(--ink)}
input:focus,select:focus,textarea:focus{border-color:var(--primary);outline-color:var(--theme-soft)}
input::placeholder,textarea::placeholder{color:var(--muted);opacity:.8}
input:disabled,select:disabled{background:var(--theme-muted-surface);color:var(--muted)}
input[type=file],.form-footer{background:var(--theme-muted-surface);border-color:var(--border)}
.message,.notice{background:var(--theme-soft);color:var(--theme-accent-ink);border-color:var(--theme-accent-border)}
.message.success{background:var(--theme-success-bg);color:var(--theme-success-ink);border-color:var(--theme-success-border)}
.action-strip{background:var(--theme-soft);border-color:var(--theme-accent-border)}
.action-strip strong,.action-strip span{color:var(--theme-accent-ink)}
.timeline-item{border-color:var(--border)}
.timeline-item:before{background:var(--primary);border-color:var(--theme-surface)}
.flow-step>span{border-color:var(--border)}
.flow-step.current{color:var(--theme-accent-ink)}
.flow-step.current>span{background:var(--theme-soft);border-color:var(--theme-accent-border)}
.flow-step.done{color:var(--theme-success-ink)}
.flow-step.done>span{background:var(--theme-success-bg);border-color:var(--theme-success-border)}
.funnel-row{color:var(--muted)}
.funnel-row>div,.kanban-column{background:var(--theme-muted-surface)}
.funnel-row i{background:linear-gradient(90deg,var(--primary),var(--theme-accent-border))}
.login-story{background:linear-gradient(145deg,var(--theme-login-start),var(--theme-login-end));color:#fff}
.brand.light .brand-sub,.login-copy .eyebrow,.login-copy p,.login-apps span,.login-foot{color:#e0e6ef}
.login-apps span{border-color:#ffffff3d;background:#ffffff08}
.login-form-wrap{background:var(--theme-surface)}
.login-form .login-help{color:var(--muted)}
.orbit{border-color:#ffffff26}
.orbit-one:after{background:#ffffff75}
.record-picker-icon,.record-picker-detail,.record-picker-option span,.record-picker-actions small{color:var(--muted)}
.record-picker-clear,.record-picker-status,.record-picker-actions{background:var(--theme-muted-surface);color:var(--muted);border-color:var(--border)}
.record-picker-clear:hover{background:var(--theme-soft);color:var(--theme-accent-ink)}
.record-picker.has-selection .record-picker-search{background:var(--theme-soft);color:var(--theme-accent-ink);border-color:var(--theme-accent-border)}
.record-picker.has-selection .record-picker-detail{color:var(--theme-accent-ink)}
.record-picker-popover{background:var(--theme-surface);border-color:var(--theme-accent-border);box-shadow:0 12px 34px #16233726}
.record-picker-option{background:var(--theme-surface);border-color:var(--border);color:var(--ink)}
.record-picker-option:hover,.record-picker-option.is-active{background:var(--theme-soft)}
.record-picker-option.is-active strong{color:var(--theme-accent-ink)}
.record-picker-more{background:var(--theme-surface);border-color:var(--border);color:var(--theme-accent-ink)}
.record-picker-more:hover{background:var(--theme-soft)}
[data-theme='midnight'] :is(.blue,.green,.purple,.orange){background:var(--theme-muted-surface)}
[data-theme='midnight'] .blue{color:#a7b5ff}
[data-theme='midnight'] .green{color:#8dd7ba}
[data-theme='midnight'] .purple{color:#d8adf5}
[data-theme='midnight'] .orange{color:#ffd09f}
[data-theme='midnight'] .app-icon{color:color-mix(in srgb,var(--app-color) 55%,white)}

/* Appearance picker: a compact disclosure with ordinary keyboard-accessible buttons. */
.theme-switcher{position:relative;flex-shrink:0;z-index:110}
.theme-switcher [hidden]{display:none!important}
.theme-trigger{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:34px;padding:6px 9px;border:1px solid var(--border);border-radius:7px;background:var(--theme-surface);color:var(--ink);font-size:11px;line-height:1.2;white-space:nowrap}
.theme-trigger:hover,.theme-trigger[aria-expanded='true']{border-color:var(--theme-accent-border);background:var(--theme-soft);color:var(--theme-accent-ink)}
.theme-trigger svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.theme-current-dot{width:7px;height:7px;border-radius:50%;background:var(--primary);box-shadow:0 0 0 2px var(--theme-soft)}
.theme-panel{position:absolute;top:calc(100% + 12px);right:0;width:310px;max-width:calc(100vw - 28px);border:1px solid var(--border);border-radius:12px;background:var(--theme-surface);color:var(--ink);box-shadow:0 14px 45px #182b4824;padding:17px}
.theme-panel-heading strong{display:block;font-size:13px;font-weight:600}
.theme-panel-heading>span{display:block;font-size:11px;color:var(--muted);margin-top:3px}
.theme-choices{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:15px 0}
.theme-choice{position:relative;display:flex;align-items:center;flex-wrap:wrap;gap:6px;width:100%;padding:7px 7px 8px;min-height:0;border:1px solid var(--border);border-radius:7px;background:var(--theme-surface);color:var(--ink);text-align:left;font-size:11px;line-height:1.4}
.theme-choice:hover,.theme-choice[aria-pressed='true']{border-color:var(--primary);background:var(--theme-soft)}
.theme-choice-check{color:var(--theme-accent-ink);font-size:12px;margin-left:auto;opacity:0}
.theme-choice[aria-pressed='true'] .theme-choice-check{opacity:1}
.theme-preview{--swatch:#bf4e16;--swatch-soft:#fff0e5;--swatch-bg:#f8f7f5;--swatch-surface:#fff;position:relative;display:block;flex-basis:100%;height:48px;border:1px solid #141f3514;border-radius:4px;overflow:hidden;background:var(--swatch-bg)}
.theme-preview:before{content:'';position:absolute;inset:0 auto 0 0;width:22%;background:var(--swatch-surface);border-right:1px solid #141f3512}
.theme-preview:after{content:'';position:absolute;left:3px;top:14px;width:16%;height:5px;background:var(--swatch);border-radius:2px;box-shadow:0 9px 0 var(--swatch-soft)}
.theme-preview i{position:absolute;left:29%;top:10px;width:62%;height:11px;border-radius:3px;background:var(--swatch-soft);border-left:3px solid var(--swatch)}
.theme-preview b{position:absolute;left:29%;top:27px;width:29%;height:13px;border-radius:3px;background:var(--swatch-surface);box-shadow:39px 0 0 var(--swatch-surface)}
.theme-swatch-blue{--swatch:#1e66bb;--swatch-soft:#eaf3ff;--swatch-bg:#f4f7fb}
.theme-swatch-indigo{--swatch:#5363dc;--swatch-soft:#eef0ff;--swatch-bg:#f5f6fb}
.theme-swatch-jade{--swatch:#167b69;--swatch-soft:#e6f5ef;--swatch-bg:#f3f8f6}
.theme-swatch-rose{--swatch:#9c427f;--swatch-soft:#f9eaf4;--swatch-bg:#faf5f9}
.theme-swatch-midnight{--swatch:#ffb078;--swatch-soft:#382f2c;--swatch-bg:#111a29;--swatch-surface:#26364c}
.theme-panel-footer{display:flex;align-items:center;flex-wrap:wrap;gap:3px;color:var(--muted);font-size:10px;border-top:1px solid var(--border);padding-top:11px}
.theme-panel-footer>span:last-child{margin-left:auto}
.theme-login-switcher{position:fixed;top:22px;right:24px;z-index:110}
@media(max-width:680px){
  .theme-trigger{width:33px;min-height:33px;padding:6px;gap:0}
  .theme-trigger-text,.theme-current-dot{display:none}
  .theme-panel{position:fixed;top:73px;right:12px;left:12px;width:auto;max-width:360px;margin-left:auto}
  .theme-login-switcher{top:18px;right:18px}
  .theme-login-switcher .theme-panel{top:60px}
  .topbar-right{gap:9px}
}
@media(prefers-reduced-motion:reduce){.theme-trigger,.theme-choice{transition:none}}
