/* 顶栏右侧：工厂 | 告警 主题 | 用户菜单 */
.brand-text{font-size:15px;letter-spacing:.04em}
.tn-right{gap:6px}
.tn-proj{display:flex;align-items:center;gap:6px;height:32px;padding:0 4px 0 10px;border-radius:8px;background:#ffffff10;border:1px solid #ffffff1c;cursor:pointer}
.tn-proj:hover{background:#ffffff1a}
.tn-ic{font-size:12px;color:#8fb0cd}
.tn-proj .proj-sel{background:transparent;border:0;height:30px;max-width:190px;padding:0 4px;color:#e6f1f9}
.tn-sep{width:1px;height:20px;background:#ffffff22;margin:0 8px}
.tn-icon{width:34px;height:34px;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:16px;color:#cfe0ee;position:relative}
.tn-icon:hover{background:#ffffff16;color:#fff}
.tn-bell{padding:0}
.tn-bell b{top:2px;right:0;transform:translateX(30%)}
.user-chip{position:relative;cursor:pointer;padding:4px 8px 4px 4px;border-radius:20px;outline:none}
.user-chip:hover,.user-chip.open{background:#ffffff14}
.user-chip .uc-t{max-width:120px;overflow:hidden}
.user-chip .uc-t b,.user-chip .uc-t i{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.uc-car{font-size:10px;color:#8fb0cd}
.uc-menu{display:none;position:absolute;right:0;top:calc(100% + 8px);min-width:200px;background:var(--surface);border:1px solid var(--border);
  border-radius:10px;box-shadow:var(--elev-2);padding:6px;z-index:60}
.user-chip.open .uc-menu{display:block}
.uc-hd{padding:8px 10px 10px;border-bottom:1px solid var(--border);margin-bottom:4px}
.uc-hd b{display:block;color:var(--text);font-size:13px}.uc-hd i{font-style:normal;font-size:11.5px;color:var(--text-3)}
.uc-menu a{display:block;padding:8px 10px;border-radius:6px;color:var(--text-2);font-size:12.5px}
.uc-menu a:hover{background:var(--surface-2);color:var(--text)}
.uc-menu a.uc-out{border-top:1px solid var(--border);margin-top:4px;border-radius:0 0 6px 6px;color:var(--err)}
@media (max-width:1280px){ .user-chip .uc-t{display:none} .tn-proj .proj-sel{max-width:130px} }

/* ---------- 深色主题 ---------- */
html[data-theme=dark]{color-scheme:dark;
  --bg:#0b1522;--surface:#111e2e;--surface-2:#16263a;--surface-3:#1b2d44;--border:#24384f;--border-strong:#33506d;
  --text:#e3edf6;--text-2:#a9bccd;--text-3:#7690a8;
  --brand-50:#12233a;--brand-100:#163050;--brand-200:#1f426a;
  --ok-bg:#0f3324;--warn-bg:#3a2a0d;--err-bg:#3d1714;--info-bg:#10304d;
  --brand-700:#8cc8f0;--brand-600:#6cb8ea;--info:#5aa7d6;--err:#ec7063;--ok:#3cc47c;--warn:#f0a93b;
  --ink:#e3edf6;--sub:#7f97ad;--line:#24384f;--card:#111e2e;
  --elev-1:0 1px 2px #0006;--elev-2:0 4px 18px -4px #000a;
  --chrome-top:linear-gradient(120deg,#060f1c 0%,#0a1a2e 60%,#071425 100%);--chrome-side:linear-gradient(180deg,#081526 0%,#060f1c 100%)}
html[data-theme=dark] body{background:radial-gradient(1200px 680px at 12% -8%,#2e86c122,transparent 60%),var(--bg)}
html[data-theme=dark] .card,html[data-theme=dark] .kpi,html[data-theme=dark] .login-card,html[data-theme=dark] .modal,
html[data-theme=dark] .td-card,html[data-theme=dark] .btn-back,html[data-theme=dark] .td-c-act button:not(.ok){background:var(--surface);color:var(--text)}
html[data-theme=dark] input,html[data-theme=dark] select,html[data-theme=dark] textarea,html[data-theme=dark] .inp{background:var(--surface-2);color:var(--text);border-color:var(--border)}
html[data-theme=dark] .tbl th{background:var(--surface-2);color:var(--text-2)}
html[data-theme=dark] .tbl td{border-color:var(--border)}
html[data-theme=dark] .tbl tr:hover td,html[data-theme=dark] .tbl tr.on td{background:var(--surface-3)}
html[data-theme=dark] .td-seg a.on,html[data-theme=dark] .seg button.on{background:var(--brand-200);color:#fff}
html[data-theme=dark] .seg button,html[data-theme=dark] .btn{background:var(--surface-2);color:var(--text-2);border-color:var(--border)}
html[data-theme=dark] .btn.primary{background:#2e86c1;color:#fff}
html[data-theme=dark] td.pv{color:#6cb8ea!important}html[data-theme=dark] td.sv{color:#3cc47c!important}
html[data-theme=dark] .ag-dual .s,html[data-theme=dark] .ag-ab blockquote{background:#221a45;color:#c9bcff}
html[data-theme=dark] .ag-evo{background:linear-gradient(90deg,#1e1840,#10243a);color:#c9bcff}
html[data-theme=dark] .ag-evo.promote{background:linear-gradient(90deg,#0f3324,#10243a);color:#8fe0b5}
html[data-theme=dark] .proj-sel option{background:#111e2e;color:#e3edf6}
html[data-theme=dark] b,html[data-theme=dark] h1,html[data-theme=dark] h2,html[data-theme=dark] h3{color:inherit}
html[data-theme=dark] .topbar2{background:#0b1522d9}
html[data-theme=dark] .mbox,html[data-theme=dark] .dcard,html[data-theme=dark] .af,html[data-theme=dark] .alg,html[data-theme=dark] .formula.big,
html[data-theme=dark] .mfstep,html[data-theme=dark] .subnode,html[data-theme=dark] .dir-hero>div,html[data-theme=dark] .xcard,html[data-theme=dark] .tvh button{background:var(--surface);color:var(--text);border-color:var(--border)}
html[data-theme=dark] .step,html[data-theme=dark] .sysnode,html[data-theme=dark] .answer,html[data-theme=dark] .fcard,html[data-theme=dark] .advtbl th,
html[data-theme=dark] .advtbl tbody tr:hover,html[data-theme=dark] .savecmp .sbox,html[data-theme=dark] .formula,html[data-theme=dark] .archlinks .al,
html[data-theme=dark] .wsl,html[data-theme=dark] .drv,html[data-theme=dark] .tv th,html[data-theme=dark] .srctbl tbody tr:hover,html[data-theme=dark] .chg,
html[data-theme=dark] .hbar .ht,html[data-theme=dark] .xty,html[data-theme=dark] .vsb.hi{background:var(--surface-2);color:var(--text);border-color:var(--border)}
html[data-theme=dark] .dc-top,html[data-theme=dark] .arch-main,html[data-theme=dark] .dh-main{background:linear-gradient(120deg,#12233a,#111e2e)!important}
html[data-theme=dark] .chip.p,html[data-theme=dark] .t-next .xty,html[data-theme=dark] .srctbl tbody tr.on,html[data-theme=dark] .advtbl td.chg2{background:#10304d;color:#8cc8f0}
html[data-theme=dark] .chip.o,html[data-theme=dark] .pill.wait,html[data-theme=dark] .t-give .xty,html[data-theme=dark] .advtbl tr.ev{background:#3a2a0d;color:#f3c27a}
html[data-theme=dark] .chip.g,html[data-theme=dark] .pill.on,html[data-theme=dark] .savecmp .sbox.win,html[data-theme=dark] .rl.ok,html[data-theme=dark] .vsb.ok,html[data-theme=dark] .t-do .xty{background:#0f3324;color:#8fe0b5}
html[data-theme=dark] .chip.r,html[data-theme=dark] .rl.bad,html[data-theme=dark] .vsb.bad{background:#3d1714;color:#f5a39b}
html[data-theme=dark] .chip.t{background:#0e3230;color:#86dccf}
html[data-theme=dark] .chip.gy,html[data-theme=dark] .pill.off{background:#1b2d44;color:#a9bccd}
html[data-theme=dark] .td-seg a.on{background:var(--brand-200);color:#fff}
html[data-theme=dark] [style*="background:#fff"],html[data-theme=dark] [style*="background:#f7f9fb"],html[data-theme=dark] [style*="background:#f3f8fc"]{background:var(--surface-2)!important;color:var(--text)}
html[data-theme=dark] .phd .meta{background:var(--surface);border-color:var(--border)}
.btn:disabled,.btn[disabled]{opacity:.45;cursor:not-allowed}
/* 写死深色文字 / 浅底的补充覆盖 */
html[data-theme=dark] .trio .l,html[data-theme=dark] .alg .aprin,html[data-theme=dark] .mcard .mrole{color:var(--text-2)}
html[data-theme=dark] .ag-evo b{color:#c9bcff}html[data-theme=dark] .ag-evo.promote b{color:#8fe0b5}
html[data-theme=dark] .om-hero{background:linear-gradient(90deg,#16243f,#111e2e)}
.om-hero{background:linear-gradient(90deg,#f1f1fe,#fff)}
html[data-theme=dark] a.lnk,html[data-theme=dark] .td-link,html[data-theme=dark] .td-edge a:nth-last-child(-n+2),html[data-theme=dark] .ed-cn span,html[data-theme=dark] .ed-ic,
html[data-theme=dark] .in-nav button.on,html[data-theme=dark] .dl.fl{color:#6cb8ea}
html[data-theme=dark] .badge.info,html[data-theme=dark] .chip.p{color:#8cc8f0}
html[data-theme=dark] .badge.err,html[data-theme=dark] .ab-t,html[data-theme=dark] .td-c-v.neg,html[data-theme=dark] .td-a em.over,html[data-theme=dark] .ev-gate b.bad{color:#f1948a}
html[data-theme=dark] .ck-n,html[data-theme=dark] .loop-ar,html[data-theme=dark] .pipe-ar{color:#5f7b97}
html[data-theme=dark] .td-tags span{color:#8cc8f0;background:#10304d}
html[data-theme=dark] .tbl td[style*="#c0392b"],html[data-theme=dark] [style*="color:#c0392b"],html[data-theme=dark] [style*="color: rgb(192, 57, 43)"]{color:#f1948a!important}
html[data-theme=dark] [style*="color:#12212f"],html[data-theme=dark] [style*="color: rgb(18, 33, 47)"]{color:var(--text)!important}
html[data-theme=dark] [style*="color:#2166a3"],html[data-theme=dark] [style*="color: rgb(33, 102, 163)"]{color:#6cb8ea!important}
html[data-theme=dark] [style*="color:#46586a"],html[data-theme=dark] [style*="color: rgb(70, 88, 106)"]{color:var(--text-2)!important}
html[data-theme=dark] [style*="background:#EDF0F8"],html[data-theme=dark] [style*="background:#edf0f8"],html[data-theme=dark] [style*="background:#F6F7FC"],html[data-theme=dark] [style*="background:#eef2f6"]{background:var(--surface-2)!important}
html[data-theme=dark] #view:not(.dark) .tk-title{background:linear-gradient(180deg,#fff,#7fe9ff);-webkit-background-clip:text;background-clip:text}

html[data-theme=dark] .ag-auto .s,html[data-theme=dark] .ag-lp-row .s,html[data-theme=dark] .ag-steps span.slow{background:#221a45;color:#c9bcff}
html[data-theme=dark] .ag-lp-row .c{background:#3a2a10;color:#f0c27a}
