/* 公共样式: 导航 / 服务状态条 / 变量多选 / 提示条 —— 三页共用 */
/* 统一设计令牌: 与 /portal /rules /refined 深色科技族同源(2026-10-08 收敛, 见 #840-B) */
:root {
  color-scheme: dark;
  --bg-deep: #04070f;
  --bg-panel: rgba(13,22,41,.72);
  --bg-panel-solid: #0b1424;
  --bg-panel-hover: rgba(20,34,60,.8);
  --bg-input: rgba(9,16,31,.85);
  --line: rgba(56,189,248,.16);
  --line-strong: rgba(56,189,248,.45);
  --line-bright: rgba(56,189,248,.38);
  --cyan: #22d3ee;
  --blue: #60a5fa;
  --green: #4ade80;
  --amber: #fbbf24;
  --red: #f87171;
  --txt: #dbe7f3;
  --txt-strong: #eaf4ff;
  --txt-dim: #8ba3bd;
  --txt-faint: #5a7186;
  --muted: #7d8ea8;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
.topnav {
  display: flex; align-items: center; gap: 6px;
  background: rgba(8,15,30,.92); border-bottom: 1px solid rgba(148,163,184,.18);
  padding: 0 16px; height: 46px;
  position: sticky; top: 0; z-index: 60;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.topnav a {
  padding: 6px 14px; border-radius: 7px; text-decoration: none;
  font-size: 13.5px; color: var(--muted); font-weight: 500;
}
.topnav a:hover { background: rgba(56,189,248,.10); color: var(--txt-strong); }
.topnav a.active { background: rgba(56,189,248,.16); color: var(--cyan); font-weight: 600; }
.topnav-note { margin-left: auto; font-size: 12px; color: var(--txt-faint); }

/* 服务状态条 */
.svc-banner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 16px; font-size: 12.5px; line-height: 1.6;
  background: rgba(8,15,30,.9); color: var(--txt); border-bottom: 1px solid rgba(148,163,184,.18);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.svc-banner.online { background: rgba(16,185,129,.12); color: var(--green); border-bottom-color: rgba(74,222,128,.35); }
.svc-banner.offline { background: rgba(239,68,68,.12); color: #fca5a5; border-bottom-color: rgba(248,113,113,.4); }
.svc-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.svc-banner.online .svc-dot { background: var(--green); }
.svc-banner.offline .svc-dot { background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239,68,68,.15); animation: svcpulse 1.6s infinite; }
@keyframes svcpulse { 50% { box-shadow: 0 0 0 7px rgba(239,68,68,.05); } }
.svc-cmd {
  font-family: var(--mono); background: rgba(15,23,42,.9);
  border: 1px solid rgba(248,113,113,.4); border-radius: 5px; padding: 2px 8px; color: #fca5a5;
}
.svc-btn {
  margin-left: auto; padding: 4px 12px; border: 1px solid rgba(148,163,184,.3);
  background: rgba(20,34,60,.8); border-radius: 6px; cursor: pointer; font-size: 12.5px;
  color: var(--txt);
}
.svc-btn:hover { background: rgba(56,189,248,.14); border-color: rgba(56,189,248,.4); }

/* 提示条 */
#toast-box {
  position: fixed; right: 18px; bottom: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; max-width: 460px;
}
.toast {
  padding: 11px 15px; border-radius: 8px; font-size: 13px; line-height: 1.6;
  background: rgba(239,68,68,.14); color: #fca5a5; border: 1px solid rgba(248,113,113,.4);
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
  transition: opacity .3s, transform .3s;
}
.toast.ok { background: rgba(16,185,129,.14); color: #6ee7b7; border-color: rgba(74,222,128,.4); }
.toast.warn { background: rgba(251,191,36,.14); color: #fde68a; border-color: rgba(251,191,36,.4); }
.toast.info { background: rgba(56,189,248,.14); color: #7dd3fc; border-color: rgba(56,189,248,.4); }
.toast.out { opacity: 0; transform: translateX(14px); }

/* 变量多选 */
.ms { position: relative; display: inline-block; }
.ms-btn {
  padding: 7px 12px; border: 1px solid rgba(148,163,184,.3); border-radius: 6px;
  background: rgba(20,34,60,.8); cursor: pointer; font-size: 13px; color: var(--txt);
}
.ms-btn b { color: var(--cyan); }
.ms-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 90;
  width: 560px; max-width: 92vw; max-height: 420px; overflow: auto;
  background: rgba(11,20,36,.98); border: 1px solid rgba(148,163,184,.22); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.5); padding: 12px; display: none;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.ms-panel.open { display: block; }
.ms-tools {
  display: flex; align-items: center; gap: 8px; padding-bottom: 9px;
  border-bottom: 1px solid rgba(148,163,184,.16); margin-bottom: 10px;
}
.ms-tools button {
  padding: 4px 11px; border: 1px solid rgba(148,163,184,.3); background: rgba(20,34,60,.8);
  border-radius: 6px; cursor: pointer; font-size: 12px; color: var(--txt);
}
.ms-tools button:hover { background: rgba(56,189,248,.14); }
.ms-hint { margin-left: auto; font-size: 11.5px; color: var(--txt-faint); }
.ms-group { margin-bottom: 9px; }
.ms-gtitle {
  font-size: 11.5px; font-weight: 700; color: var(--txt-dim);
  margin-bottom: 5px; letter-spacing: .5px;
}
.ms-items { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px 10px; }
.ms-item {
  display: flex; align-items: center; gap: 6px; font-size: 12.5px;
  color: var(--txt); padding: 3px 4px; border-radius: 5px; cursor: pointer;
}
.ms-item:hover { background: rgba(56,189,248,.10); }
.ms-chip {
  display: inline-flex; align-items: center; gap: 5px; margin: 5px 5px 0 0;
  padding: 3px 8px; background: rgba(56,189,248,.14); color: #7dd3fc;
  border: 1px solid rgba(56,189,248,.35); border-radius: 999px; font-size: 12px;
}
.ms-chip i { cursor: pointer; font-style: normal; opacity: .6; font-weight: 700; }
.ms-chip i:hover { opacity: 1; }

/* 通用小块 */
.hint { font-size: 11.5px; color: var(--txt-faint); line-height: 1.7; }
.divider { height: 1px; background: rgba(148,163,184,.16); margin: 12px 0; }
.tag-ok { color: #6ee7b7; font-weight: 600; }
.tag-warn { color: #fde68a; font-weight: 600; }
.tag-err { color: #fca5a5; font-weight: 600; }
.kv { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--txt-dim); }
.kv b { color: var(--txt-strong); }

/* ============ 通用状态: 骨架屏 / 空态 / 错误态 / 重试(#840-C, 2026-10-08) ============ */
/* 骨架屏: 数据加载占位(微光扫过), 尊重 prefers-reduced-motion */
.skeleton {
  position: relative; overflow: hidden; border-radius: 8px;
  background: rgba(148,163,184,.10);
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(148,163,184,.20), transparent);
  transform: translateX(-100%);
  animation: skel 1.4s ease-in-out infinite;
}
@keyframes skel { 100% { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } }

/* 加载态 */
.state-loading {
  display: none; text-align: center; color: var(--txt-dim);
  padding: 40px 20px; font-size: 14px; line-height: 1.7;
}

/* 空态 */
.state-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; padding: 44px 20px; color: var(--txt-dim);
  font-size: 13px; line-height: 1.7;
}
.state-empty .se-ico { font-size: 30px; opacity: .5; line-height: 1; }
.state-empty .se-title { color: var(--txt); font-size: 14px; font-weight: 600; }

/* 错误态 */
.state-error {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; text-align: center; padding: 36px 20px; color: #fca5a5;
  background: rgba(239,68,68,.10); border: 1px solid rgba(248,113,113,.35);
  border-radius: 10px; font-size: 13px; line-height: 1.7;
}
.state-error .se-title { color: #fecaca; font-size: 14px; font-weight: 600; }

/* 重试按钮(通用) */
.state-retry {
  margin-top: 6px; padding: 7px 18px; border: 1px solid rgba(56,189,248,.4);
  background: rgba(56,189,248,.14); color: #7dd3fc; border-radius: 7px;
  cursor: pointer; font-size: 13px;
}
.state-retry:hover { background: rgba(56,189,248,.22); }

/* ============ 会员认证组件(#619, 2026-09-29): 右上角 chip + 登录/注册弹窗 ============ */
#auth-chip {
  position: fixed; top: 10px; right: 10px; z-index: 800;
  display: flex; align-items: center; gap: 6px;
  background: rgba(15,23,42,0.85); color: #e2e8f0;
  border: 1px solid rgba(148,163,184,0.4); border-radius: 999px;
  padding: 5px 14px; font-size: 12px; cursor: pointer;
  backdrop-filter: blur(6px); box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  max-width: 200px; overflow: hidden; white-space: nowrap;
}
#auth-chip:hover { background: rgba(30,41,59,0.95); }
#auth-chip .auth-chip-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; flex: none;
}
#auth-chip.is-member .auth-chip-dot { background: var(--green); }
/* national 页右侧工具栏内嵌样式(覆盖 fixed 定位, 宽度自适应) */
#auth-chip.in-tool {
  position: static; transform: none; border-radius: 8px;
  width: auto; min-width: 0; max-width: none; white-space: nowrap;
  padding: 6px 8px; font-size: 11px; justify-content: center;
}
/* in-topbar 形态统一定义已移至文件后部「右上角操作区」区块(10-02) */
#auth-modal-bg {
  position: fixed; inset: 0; z-index: 900; background: rgba(2,6,23,0.6);
  display: none; align-items: center; justify-content: center;
  backdrop-filter: blur(3px);
}
#auth-modal-bg.open { display: flex; }

/* ===== 全局业务导航菜单(2026-10-02, 每个页面右上角可直达任意业务) ===== */
#global-menu-btn {
  position: fixed; top: 10px; right: 120px; z-index: 801;
  width: 34px; height: 34px; border-radius: 8px;
  padding: 0;   /* ★2026-11-11: 必须显式清零——refined/index 页内 button{padding:7px 16px} 会覆盖浏览器默认, 图标溢出按钮右侧 */
  background: rgba(15,23,42,0.9); border: 1px solid rgba(148,163,184,0.35);
  color: #e2e8f0; cursor: pointer; display: grid; place-items: center;
  backdrop-filter: blur(6px); box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
#global-menu-btn:hover { background: rgba(30,41,59,0.95); border-color: rgba(148,163,184,0.55); }
#global-menu-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; }
/* 若页面已有 #topbar .tb-right, 按钮内嵌到顶栏(覆盖 fixed 定位); 高度与 chip 同为 32px */
#global-menu-btn.in-topbar {
  position: static; top: auto; right: auto; z-index: auto;
  width: 32px; height: 32px;
}
#global-menu {
  position: fixed; top: 52px; right: 10px; z-index: 802;
  min-width: 180px; max-width: calc(100vw - 24px);
  background: rgba(15,23,42,0.96); border: 1px solid rgba(148,163,184,0.25);
  border-radius: 10px; padding: 8px 0; box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  backdrop-filter: blur(10px);
  display: none; flex-direction: column;
}
#global-menu.open { display: flex; }
#global-menu a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; font-size: 13px; color: #e2e8f0; text-decoration: none;
}
#global-menu a:hover { background: rgba(34,211,238,0.12); }
#global-menu a.on { color: var(--cyan); font-weight: 600; background: rgba(34,211,238,0.10); }
#global-menu .gm-sep {
  height: 1px; margin: 6px 12px; background: rgba(148,163,184,0.18);
}
/* 2026-10-25 二轮: 四模块分组小标题 */
#global-menu .gm-cap {
  padding: 7px 16px 2px; font-size: 10px; font-weight: 700; letter-spacing: 2px;
  color: #64748b; user-select: none;
}
#global-menu .gm-sep + .gm-cap { padding-top: 4px; }
#global-menu .gm-soon {
  opacity: .55; pointer-events: none;
}

/* 10-02 右上角操作区共享容器: 登录chip + 全局菜单按钮 同一 flex 容器内垂直居中,
 * 高度统一, 间距由 gap 控制 —— 修复各自独立定位导致的错位/重叠/大小不一 */
#top-actions {
  position: fixed; top: 10px; right: 10px; z-index: 800;
  display: flex; align-items: center; gap: 8px;
}
#top-actions #auth-chip {
  position: static; transform: none;
  box-sizing: border-box; height: 34px; padding: 0 14px;
}
#top-actions #global-menu-btn {
  position: static; top: auto; right: auto; z-index: auto;
}
/* 顶栏内嵌形态: 统一 32px 高, 间距交给 .tb-right 的 gap, 不再叠加 margin */
#topbar .tb-right { display: flex; align-items: center; gap: 8px; }

/* 顶栏右侧主要操作按钮共享样式: 登录 chip / 自定义电厂 / 同类 CTA */
.tb-right-btn,
#auth-chip.in-topbar {
  position: static; transform: none;
  box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center;
  height: 32px; padding: 0 12px;
  border: 1px solid rgba(37,99,235,0.6); border-radius: 999px;
  background: rgba(37,99,235,0.92); color: #fff;
  font-size: 12px; font-weight: 500; text-decoration: none; white-space: nowrap;
  cursor: pointer;
}
.tb-right-btn:hover,
#auth-chip.in-topbar:hover { background: rgba(29,78,216,0.95); }

.auth-modal {
  position: relative; width: 320px; max-width: calc(100vw - 32px);
  background: #101828; border: 1px solid rgba(148,163,184,0.35);
  border-radius: 12px; padding: 18px 20px 16px; color: #e2e8f0;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.auth-title { font-size: 15px; font-weight: 700; color: #f1f5f9; }
.auth-sub { display: block; font-size: 10.5px; color: #94a3b8; font-weight: 400; margin-top: 3px; }
.auth-tabs { display: flex; gap: 4px; margin: 12px 0 10px; }
.auth-tabs button {
  flex: 1; padding: 6px 0; font-size: 12.5px; color: #cbd5e1; background: none;
  border: 1px solid rgba(148,163,184,0.3); border-radius: 7px; cursor: pointer;
}
.auth-tabs button.on { background: #2563eb; color: #fff; font-weight: 600; border-color: #2563eb; }
.auth-pane label { display: block; font-size: 11px; color: #94a3b8; margin-bottom: 8px; }
.auth-pane input {
  display: block; width: 100%; margin-top: 3px; padding: 7px 9px;
  background: rgba(15,23,42,0.9); color: #e2e8f0; font-size: 13px;
  border: 1px solid rgba(148,163,184,0.35); border-radius: 7px; box-sizing: border-box;
}
.auth-pane input:focus { outline: none; border-color: #2563eb; }
.auth-go {
  width: 100%; margin-top: 4px; padding: 8px 0; background: #2563eb; color: #fff;
  border: none; border-radius: 8px; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.auth-go:hover { background: #1d4ed8; }
.auth-status { font-size: 11.5px; margin-top: 9px; min-height: 15px; color: #94a3b8; }
.auth-status.err { color: #fca5a5; }
.auth-status.ok { color: #86efac; }
.auth-close {
  position: absolute; top: 8px; right: 10px; background: none; border: none;
  color: #94a3b8; font-size: 18px; cursor: pointer; line-height: 1;
}
.auth-close:hover { color: #f1f5f9; }
.auth-hint { font-size: 10px; color: #94a3b8; line-height: 1.5; margin: -4px 0 8px; }
.auth-center-head { text-align: center; margin-bottom: 12px; }
.auth-center-name { font-size: 15px; font-weight: 700; color: #f1f5f9; }
.auth-center-id { font-size: 10px; color: #94a3b8; margin-top: 2px; }
.auth-logout { margin-top: 14px; background: #475569; }
.auth-logout:hover { background: #334155; }

/* ============ 共享视觉底座(#982 统一, 2026-10-16) ============ */
/* 统一背景: 深空底 + 青色网格线 + 琥珀/青双角流光(纯 CSS, 无 canvas)
 * 采用 opt-in 类 .app-bg: 仅给需要的页面加, 避免污染 eval 等浅色报告页 */
.app-bg::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    linear-gradient(rgba(34,211,238,.05) 1px, transparent 1px) 0 0 / 100% 40px,
    linear-gradient(90deg, rgba(34,211,238,.05) 1px, transparent 1px) 0 0 / 40px 100%,
    var(--bg-deep);
}
.app-bg::after {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(1100px 620px at 82% -12%, rgba(34,211,238,.10), transparent 60%),
    radial-gradient(900px 520px at -8% 112%, rgba(251,191,36,.07), transparent 55%);
}

/* 共享顶栏组件: 品牌 + 四格导航 + 右侧槽位(common.js 注入登录/全局菜单) */
.site-topbar {
  position: sticky; top: 0; z-index: 700;
  display: flex; align-items: center; gap: 14px;
  height: 52px; padding: 0 16px;
  background: rgba(8,15,30,.92);
  border-bottom: 1px solid rgba(148,163,184,.18);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--txt);
}
.site-topbar .tb-brand {
  display: flex; align-items: center; gap: 9px;
  text-decoration: none; color: var(--txt-strong); font-weight: 700; font-size: 15px;
  white-space: nowrap; letter-spacing: .5px;
}
.site-topbar .tb-logo { width: 26px; height: 26px; flex: none; display: block; }
/* 统一模块导航(2026-10-25): 全站 4 模块标签, 单一来源见 common.js MODULE_TABS */
.tb-nav { display: flex; align-items: center; gap: 4px; }
.site-topbar .tb-nav { margin-left: 6px; }
.hd .tb-nav { margin-left: 12px; }
.tb-nav-item, .site-topbar .tb-nav a {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 8px; text-decoration: none; white-space: nowrap;
  font-size: 13px; color: var(--txt-dim); font-weight: 500;
  border: 1px solid transparent; transition: background .15s, color .15s, border-color .15s;
}
.tb-nav-item:hover, .site-topbar .tb-nav a:hover { background: rgba(51,65,85,.6); color: var(--txt-strong); }
.tb-nav-item.on, .site-topbar .tb-nav a.active {
  background: rgba(34,211,238,.16); color: var(--cyan); font-weight: 600;
  border-color: rgba(34,211,238,.30);
}
.tb-nav-item.soon, .site-topbar .tb-nav .off { color: var(--txt-faint); opacity: .8; cursor: default; }
.tb-nav-item.soon:hover { background: transparent; color: var(--txt-faint); }
.tb-nav-item.feat { border-color: rgba(251,191,36,.35); color: #fde68a; margin-left: 6px; }
.tb-nav-item.feat:hover { background: rgba(251,191,36,.12); color: #fde68a; }
.tb-nav-item .soon-tag, .site-topbar .tb-nav .soon-tag {
  font-size: 9px; background: rgba(148,163,184,.22); padding: 1px 4px;
  border-radius: 4px; color: #cbd5e1; margin-left: 3px;
}
.site-topbar .tb-right { margin-left: auto; }

/* ============ AI 助手悬浮组件(2026-10-25, WB.mountAIAssistant) ============ */
#ai-fab {
  position: fixed; z-index: 1500; width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid rgba(34,211,238,.5); background: rgba(15,23,42,.92); color: #e2e8f0;
  font-size: 20px; cursor: pointer; box-shadow: 0 4px 18px rgba(0,0,0,.45);
  transition: transform .15s, box-shadow .15s;
}
#ai-fab:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(34,211,238,.25); }
#ai-panel {
  position: fixed; right: 14px; bottom: 14px; z-index: 1501; width: 350px; max-width: calc(100vw - 28px);
  height: 480px; max-height: 72vh; display: none; flex-direction: column;
  background: rgba(13,20,36,.97); border: 1px solid rgba(34,211,238,.4); border-radius: 14px;
  box-shadow: 0 16px 48px rgba(0,0,0,.55); color: #e2e8f0; font: 13px/1.55 system-ui; overflow: hidden;
}
#ai-panel.open { display: flex; }
#ai-panel .ai-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid rgba(148,163,184,.2); background: rgba(15,23,42,.6);
}
#ai-panel .ai-title { font-weight: 700; font-size: 13.5px; }
#ai-panel .ai-title i { font-style: normal; font-size: 10.5px; color: #22d3ee; margin-left: 4px; }
#ai-panel .ai-quota { margin-left: auto; font-size: 10.5px; color: #94a3b8; }
#ai-panel .ai-close { background: none; border: none; color: #94a3b8; font-size: 18px; cursor: pointer; padding: 0 4px; }
#ai-panel .ai-close:hover { color: #f1f5f9; }
#ai-panel .ai-msgs { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
#ai-panel .ai-msg { max-width: 86%; padding: 7px 10px; border-radius: 10px; white-space: pre-wrap; word-break: break-word; }
#ai-panel .ai-msg.user { align-self: flex-end; background: rgba(34,211,238,.18); border: 1px solid rgba(34,211,238,.35); }
#ai-panel .ai-msg.bot { align-self: flex-start; background: rgba(30,41,59,.7); border: 1px solid rgba(148,163,184,.2); }
#ai-panel .ai-input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid rgba(148,163,184,.2); }
#ai-panel .ai-input input {
  flex: 1; background: #1e293b; border: 1px solid #334155; color: #e2e8f0;
  border-radius: 8px; padding: 8px 10px; font-size: 13px; outline: none;
}
#ai-panel .ai-input input:focus { border-color: rgba(34,211,238,.6); }
#ai-panel .ai-input button {
  background: rgba(34,211,238,.2); border: 1px solid rgba(34,211,238,.45); color: #e2e8f0;
  border-radius: 8px; padding: 0 14px; font: 600 12.5px system-ui; cursor: pointer;
}
#ai-panel .ai-input button:hover { background: rgba(34,211,238,.32); }
