/* ========================================
   9999 Gold — Premium Mini Dashboard
   ======================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('lib/fonts/inter-400.ttf') format('truetype');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('lib/fonts/inter-500.ttf') format('truetype');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('lib/fonts/inter-600.ttf') format('truetype');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('lib/fonts/inter-700.ttf') format('truetype');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('lib/fonts/jetbrains-700.ttf') format('truetype');
}

@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('lib/fonts/jetbrains-800.ttf') format('truetype');
}

:root {
  --bg-primary: #1a1f2e;
  --bg-secondary: #222836;
  --card-bg: rgba(34, 40, 54, 0.7);
  --border-color: rgba(255, 255, 255, 0.1);
  --text-primary: #e8ecf4;
  --text-muted: #8b949e;

  --gold-glow: rgba(212, 175, 55, 0.4);
  --green: #3fb950;
  --red: #f85149;

  --radius-lg: 16px;
  --radius-sm: 8px;
}

/* --- 单图标极简主题切换器 --- */
.theme-icon-btn {
  font-size: 18px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s, filter 0.2s, background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  line-height: 1;
  /* 防止 Emoji 被行高裁剪 */
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
}

.theme-icon-btn:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.15);
}

.theme-icon-btn:active {
  transform: scale(0.9);
}

body.theme-light .theme-icon-btn {
  background: rgba(0, 0, 0, 0.05);
}

body.theme-light .theme-icon-btn:hover {
  background: rgba(0, 0, 0, 0.12);
}

/* ── Apple 风格明亮模式覆盖 ── */
body.theme-light {
  --bg-primary: #eef0f4;
  /* 柔和灰底，不刺眼 */
  --bg-secondary: #f8f9fb;
  --card-bg: rgba(255, 255, 255, 0.92);
  --border-color: rgba(0, 0, 0, 0.1);
  /* 边框加深，可见区分 */
  --text-primary: #1a1a2e;
  --text-muted: #6b7280;

  --gold-glow: rgba(0, 0, 0, 0);
  --green: #16a34a;
  --red: #dc2626;

  background-image: none;
}

/* 明亮模式组件打磨 */
body.theme-light .mini-dashboard {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

body.theme-light .top-bar {
  border-bottom-color: rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  color: #1a1a2e;
}

body.theme-light .vertical-label {
  color: #1a1a2e;
  font-weight: 700;
}

body.theme-light .logout-link:hover {
  color: #000;
}

body.theme-light .box-info-container {
  background: #f0f1f5;
}

body.theme-light .info-tag {
  color: #1a1a2e;
  font-weight: 600;
}

body.theme-light .info-time {
  color: #6b7280;
}

body.theme-light .basis-value {
  text-shadow: none;
  font-weight: 700;
}

body.theme-light .compact-card__prices {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

body.theme-light .price-item {
  color: #6b7280;
  font-weight: 500;
}

body.theme-light .price-item b {
  color: #1a1a2e;
  font-weight: 700;
}

body.theme-light .compact-card__basis-box {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* --- 监控总控条明亮模式适配 --- */
body.theme-light #controlCenter {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
}

body.theme-light .control-item {
  color: #1d1d1f;
}

body.theme-light .control-item:hover {
  background: rgba(0, 0, 0, 0.05);
}

body.theme-light .control-item.active {
  color: #1d1d1f;
}

body.theme-light .status-dot {
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}




* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(at 0% 0%, rgba(31, 38, 52, 0.5) 0, transparent 50%),
    radial-gradient(at 50% 0%, rgba(13, 17, 23, 1) 0, transparent 80%);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  padding: 10px;
}

.mini-dashboard {
  width: 100%;
  max-width: 450px;
  /* 适度拉宽，缓解长数字溢出 */
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 10px 16px 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 12px;

  /* 支持拖动悬浮的新增属性 */
  position: absolute;
  top: 15%;
  /* 改为固定顶部距离 */
  left: 50%;
  z-index: 1000;
  flex-shrink: 0;
  /* 整个面板不参与压缩 */
}

.top-bar:active {
  cursor: grabbing;
}

/* 激活或拖动中禁用过渡，防止“飞走”效应 */
.draggable-window:active,
.draggable-window.dragging {
  transition: none !important;
}

/* 顶部工具栏（兼拖动手柄） */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-color);
  cursor: grab;
  user-select: none;
  min-height: 0;
}

.top-bar-left {
  display: flex;
  gap: 6px;
  align-items: center;
}

.top-btn {
  font-size: 14px;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s;
  padding: 2px;
}

.top-btn:hover {
  opacity: 0.8;
}

.top-btn.active {
  opacity: 1;
}

.top-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* 区域隐藏动画 */
.section-hidden {
  display: none !important;
}




.logout-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12px;
  transition: all 0.2s;
}

.logout-link:hover {
  color: #fff;
}

.top-bar span {
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  margin-left: 4px;
}

/* 双面板联动容器 */
.dual-panel-wrapper {
  display: flex;
  gap: 16px;
  width: 100%;
  flex-wrap: wrap;
  /* 跨设备自适应 */
}

/* 紧凑内容区 */
.compact-card {
  display: flex;
  flex: 1;
  min-width: 420px;
  flex-direction: column;
  gap: 10px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.card-header-inner {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  opacity: 0.8;
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.compact-card__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.dual-title {
  text-align: center;
  font-size: 16px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.dual-body {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  flex-shrink: 0;
  /* 禁止整体压缩 */
}

.basis-half {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
}

.vertical-label {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  font-weight: 500;
  text-align: center;
  min-width: 13px;
  /* 防止文字宽度在弹性伸缩时被扭曲 */
}

.compact-card__prices {
  display: flex;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.price-item {
  font-size: 12px;
  color: var(--text-muted);
}

.price-item b {
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  margin-left: 4px;
}

/* 联合信息展示区样式 */
.box-info-container {
  display: grid;
  grid-template-columns: auto auto 1fr;
  /* 标签列自适应最大宽度，两行共享对齐 */
  row-gap: 2px;
  column-gap: 8px;
  flex-shrink: 0;
  /* 禁止压缩 */
  min-height: 52px;
  /* 锁定最小高度 */
  font-size: 14px;
  font-weight: normal;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
  padding: 8px;
  border-radius: var(--radius-sm);
  margin-top: 0;
  margin-bottom: 0;
  width: 100%;
  box-sizing: border-box;
}

.info-row {
  display: contents;
  font-size: 12px;
  white-space: nowrap;
}

.info-tag {
  font-weight: 600;
  text-align: right;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-time {
  color: var(--text-muted);
  opacity: 0.6;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
}

.info-num {
  text-align: left;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: -0.2px;
  /* 微调间距 */
}

/* 基差视觉核心 */
.compact-card__basis-box {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-lg);
  padding: 15px 5px;
  display: flex;
  flex: 1;
  /* 虽然占满，但禁止缩水 */
  flex-shrink: 0;
  min-height: 70px;
  /* 固定最小体感高度 */
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: visible;
  transition: all 0.4s ease;
}

.compact-card__basis-box::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, var(--glow-color, transparent) 0%, transparent 70%);
  opacity: 0.15;
  pointer-events: none;
}

.basis-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.05em;
  text-shadow: 0 0 20px var(--glow-color, transparent);
  transition: color 0.3s ease;
}

/* 状态色 - 兼容多路独立窗口 ID */
[id^="basisExpand"] {
  color: var(--red);
  --glow-color: var(--red);
}

[id^="basisShrink"] {
  color: var(--green);
  --glow-color: var(--green);
}

/* 动画反馈 */
@keyframes flash-green {
  0% {
    color: #fff;
    text-shadow: 0 0 15px var(--green);
  }

  100% {
    color: var(--text-primary);
  }
}

@keyframes flash-red {
  0% {
    color: #fff;
    text-shadow: 0 0 15px var(--red);
  }

  100% {
    color: var(--text-primary);
  }
}

.price-up {
  animation: flash-green 0.8s ease-out;
}

.price-down {
  animation: flash-red 0.8s ease-out;
}

/* 响应式：如果不满足 100vh，允许滚动 */
@media (max-height: 500px) {
  body {
    height: auto;
    padding: 20px 10px;
  }

  /* .mini-dashboard { margin: 0 auto; } */
}

.error-msg {
  position: fixed;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--red);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 10px;
  display: none;
}

/* ========================================
   通屏鉴权页面 (Auth Full-Screen Split)
   ======================================== */
#authShield {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

#authShield.active {
  opacity: 1;
  pointer-events: auto;
}

/* 登录界面显示时，隐藏顶部控制胶囊 */
#authShield.active~#controlCenter {
  display: none !important;
}

/* 左右分屏容器 */
.auth-split {
  display: flex;
  width: 100%;
  height: 100%;
}

/* ── 左侧品牌区 ── */
.auth-brand {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(135deg, #0d1117 0%, #161b22 40%, #1a1e2e 70%, #0d1117 100%);
  background-size: 400% 400%;
  animation: brandGradient 12s ease infinite;
  position: relative;
  overflow: hidden;
}

/* 品牌区流体渐变动画 */
@keyframes brandGradient {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/* 品牌区装饰大光斑 */
.auth-brand::before {
  content: '';
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(63, 185, 80, 0.15) 0%, transparent 70%);
  top: 20%;
  left: 15%;
  animation: floatOrb 8s ease-in-out infinite;
}

.auth-brand::after {
  content: '';
  position: absolute;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(248, 81, 73, 0.12) 0%, transparent 70%);
  bottom: 15%;
  right: 20%;
  animation: floatOrb 10s ease-in-out infinite reverse;
}

@keyframes floatOrb {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  50% {
    transform: translate(30px, -20px) scale(1.1);
  }
}

.auth-brand-inner {
  text-align: center;
  z-index: 1;
}

.auth-brand-logo {
  font-size: 56px;
  margin-bottom: 20px;
}

.auth-brand-title {
  font-size: 32px;
  font-weight: 700;
  color: #f0f6fc;
  letter-spacing: 2px;
  margin-bottom: 12px;
}

.auth-brand-slogan {
  font-size: 15px;
  color: #8b949e;
  letter-spacing: 1px;
}

/* ── 右侧表单区 ── */
.auth-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: 40px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

/* ── Tab 切换 ── */
.auth-tabs {
  display: flex;
  margin-bottom: 24px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.08);
}

.auth-tab {
  flex: 1;
  padding: 12px;
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 600;
  transition: all 0.3s;
  font-size: 16px;
  text-align: center;
}

.auth-tab.active {
  color: #fff;
  border-bottom: 2px solid var(--primary, #3b82f6);
  margin-bottom: -2px;
}

/* ── 表单 ── */
.auth-form {
  display: none;
  animation: authSlideIn 0.35s ease;
}

.auth-form.active {
  display: block;
}

@keyframes authSlideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.auth-input-group {
  position: relative;
  margin-bottom: 16px;
}

.auth-input-group input {
  width: 100%;
  padding: 14px 16px;
  padding-right: 44px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: border-color 0.3s;
  box-sizing: border-box;
}

.auth-input-group input:focus {
  border-bottom-color: var(--primary, #3b82f6);
  background: rgba(0, 0, 0, 0.35);
}

.auth-input-group input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

/* 密码显隐眼睛 */
.pwd-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 16px;
  opacity: 0.4;
  transition: opacity 0.2s;
  user-select: none;
}

.pwd-toggle:hover {
  opacity: 0.8;
}

/* ── 提交按钮 ── */
.auth-submit {
  width: 100%;
  padding: 14px;
  background: var(--primary, #3b82f6);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 4px;
}

.auth-submit:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.auth-submit:active {
  transform: translateY(0);
}

.auth-submit--green {
  background: var(--green);
}

/* ── 错误提示 ── */
.auth-error {
  color: var(--red);
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 18px;
  display: none;
  text-align: center;
}

/* ── 游客入口 ── */
.auth-guest-hint {
  text-align: center;
  margin-top: 16px;
}

.auth-guest-hint a {
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: none;
  transition: color 0.2s;
}

.auth-guest-hint a:hover {
  color: var(--text-primary);
}

/* ── 卡片错误抖动反馈 ── */
@keyframes authShake {

  0%,
  100% {
    transform: translateX(0);
  }

  20% {
    transform: translateX(-6px);
  }

  40% {
    transform: translateX(6px);
  }

  60% {
    transform: translateX(-4px);
  }

  80% {
    transform: translateX(4px);
  }
}

.auth-card.shake {
  animation: authShake 0.4s ease;
}

/* ── 访客延迟提示条 ── */
.guest-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(248, 81, 73, 0.9);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 10px 20px;
  display: none;
  justify-content: center;
  align-items: center;
  gap: 16px;
  font-size: 13px;
  font-weight: 600;
  z-index: 10001;
}

.guest-banner.active {
  display: flex;
}

.guest-banner a {
  color: #fff;
  text-decoration: underline;
  font-weight: 700;
}

/* ── 亮色主题适配 ── */
body.theme-light #authShield {
  background: rgba(255, 255, 255, 0.95);
}

body.theme-light .auth-form-side {
  background: #f5f5f7;
}

body.theme-light .auth-card {
  background: #ffffff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.06);
}

body.theme-light .auth-input-group input {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #0f172a;
}

body.theme-light .auth-input-group input::placeholder {
  color: #94a3b8;
}

body.theme-light .auth-input-group input:focus {
  background: #fff;
}

body.theme-light .auth-tab {
  color: #86868b;
}

body.theme-light .auth-tab.active {
  color: #1d1d1f;
}

/* ── 手机端适配 ── */
@media (max-width: 768px) {
  .auth-split {
    flex-direction: column;
  }

  .auth-brand {
    flex: none;
    height: 200px;
  }

  .auth-brand-logo {
    font-size: 36px;
    margin-bottom: 10px;
  }

  .auth-brand-title {
    font-size: 22px;
  }

  .auth-brand-slogan {
    font-size: 13px;
  }

  .auth-form-side {
    flex: 1;
    padding: 24px 16px;
    align-items: flex-start;
  }

  .auth-card {
    max-width: 100%;
    padding: 24px 20px;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===================== 【监控管理中心：总控条】 ===================== */
#controlCenter {
  position: fixed;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 10px;
  padding: 8px 15px;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50px;
  z-index: 10000;
  /* 绝对置顶 */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.control-item {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 20px;
  opacity: 0.35;
  transition: all 0.3s ease;
}

.control-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4b5563;
  /* 初始灰色（关闭） */
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
}

/* 激活状态（开启中） */
.control-item.active {
  color: var(--text-primary);
  opacity: 1;
}

.control-item.active .status-dot {
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

/* 荧光指示器容器 */
.status-indicator {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

/* 主力火焰呼吸脉冲 */
.status-indicator.is-main svg {
  animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {

  0%,
  100% {
    opacity: 1;
    filter: drop-shadow(0 0 4px #ef4444) drop-shadow(0 0 8px rgba(239, 68, 68, 0.5));
  }

  50% {
    opacity: 0.7;
    filter: drop-shadow(0 0 8px #ef4444) drop-shadow(0 0 16px rgba(239, 68, 68, 0.7));
  }
}

/* 窗口隐藏动画 */
.window-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: scale(0.95) translate(-50%, -50%) !important;
  pointer-events: none !important;
}

.draggable-window {
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
   基差报警系统样式
   ======================================== */

/* 报警触发时基差盒子的脉冲效果 */
@keyframes alert-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(248, 81, 73, 0);
  }

  50% {
    box-shadow: 0 0 20px 4px rgba(248, 81, 73, 0.5);
  }
}

.compact-card__basis-box.alert-triggered {
  border-color: var(--red) !important;
  animation: alert-pulse 1s ease-in-out infinite;
}

.compact-card__basis-box.alert-triggered .basis-value {
  animation: alert-flash 0.8s ease-in-out infinite alternate;
}

@keyframes alert-flash {
  from {
    opacity: 1;
  }

  to {
    opacity: 0.5;
  }
}

/* 内嵌式报警行（dual-body 下方，每侧对应一个铃铛+阈值） */
.alert-row {
  display: flex;
  gap: 4px;
  justify-content: space-between;
  margin-top: 4px;
  overflow: hidden;
}

.alert-cell {
  flex: 1;
  display: flex;
  gap: 3px;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

/* 内嵌铃铛图标 */
.alert-bell-inline {
  font-size: 16px;
  cursor: pointer;
  user-select: none;
  opacity: 0.35;
  transition: all 0.25s ease;
  flex-shrink: 0;
  line-height: 1;
}

.alert-bell-inline:hover {
  opacity: 0.7;
  transform: scale(1.15);
}

.alert-bell-inline.alert-on {
  opacity: 1;
  filter: drop-shadow(0 0 4px rgba(234, 179, 8, 0.5));
}

.alert-input {
  flex: 1;
  min-width: 0;
  max-width: 65px;
  padding: 3px 4px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  text-align: center;
  outline: none;
  transition: border-color 0.2s, color 0.2s;
  -moz-appearance: textfield;
  appearance: textfield;
  box-sizing: border-box;
}

.alert-input::-webkit-outer-spin-button,
.alert-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.alert-input:focus {
  border-color: var(--red);
  color: var(--text-primary);
}

.alert-input::placeholder {
  color: var(--text-muted);
  opacity: 0.4;
}

/* 输入框有值时高亮 */
.alert-input.has-value {
  color: var(--text-primary);
  border-color: rgba(248, 81, 73, 0.3);
  background: rgba(248, 81, 73, 0.06);
}

/* 清空阈值按钮 */
.alert-clear-btn {
  flex-shrink: 0;
  cursor: pointer;
  opacity: 0.3;
  transition: all 0.2s ease;
  line-height: 1;
  padding: 2px;
  border-radius: 4px;
}

.alert-clear-btn:hover {
  opacity: 0.9;
  color: var(--red);
  background: rgba(248, 81, 73, 0.1);
}

/* 铃铛开关 */
.alert-bell {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 20px;
  transition: all 0.3s ease;
  font-size: 16px;
  user-select: none;
  opacity: 0.5;
}

.alert-bell:hover {
  background: rgba(255, 255, 255, 0.05);
  opacity: 0.8;
}

.alert-bell.active {
  opacity: 1;
}

.alert-bell.ringing {
  animation: bell-shake 0.4s ease-in-out infinite;
  color: var(--red) !important;
}

@keyframes bell-shake {

  0%,
  100% {
    transform: rotate(0deg);
  }

  25% {
    transform: rotate(12deg);
  }

  75% {
    transform: rotate(-12deg);
  }
}

/* 亮色主题适配 */
body.theme-light .alert-input {
  background: rgba(0, 0, 0, 0.04);
  border-color: #e2e8f0;
  color: #64748b;
}

body.theme-light .alert-input.has-value {
  color: #0f172a;
  background: rgba(220, 38, 38, 0.05);
  border-color: rgba(220, 38, 38, 0.2);
}

/* ========================================
   全局自定义确认弹窗
   ======================================== */
.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.confirm-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.confirm-box {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  min-width: 280px;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.confirm-overlay.active .confirm-box {
  transform: translateY(0) scale(1);
}

.confirm-msg {
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.confirm-btn {
  padding: 8px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.confirm-btn.cancel {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

.confirm-btn.cancel:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
}

.confirm-btn.ok {
  background: var(--red);
  color: #fff;
}

.confirm-btn.ok:hover {
  opacity: 0.85;
}

/* ========================================
   手机端响应式适配
   ======================================== */
@media (max-width: 500px) {

  /* 允许页面纵向滚动 */
  body {
    height: auto;
    overflow: auto;
    align-items: flex-start;
    padding: 70px 10px 16px;
  }

  /* 窗口容器改为纵向流式布局 */
  #basisWindowsContainer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
  }

  /* 修复：窗口从 absolute 改为 relative 流式居中 */
  .mini-dashboard {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    padding: 8px 10px 12px;
    width: 100%;
    max-width: 500px;
  }

  /* 手机端窗口平滑收起动画 */
  #basisWindowsContainer {
    transition: gap 0.4s ease;
  }

  .mini-dashboard {
    max-height: 600px;
    overflow: hidden;
    transition: max-height 0.4s ease 0.1s, opacity 0.15s ease, margin 0.4s ease 0.1s, padding 0.4s ease 0.1s;
  }

  .mini-dashboard.window-hidden {
    max-height: 0 !important;
    opacity: 0 !important;
    margin: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    border-width: 0 !important;
    pointer-events: none;
    transition: opacity 0.15s ease, max-height 0.35s ease 0.15s, margin 0.35s ease 0.15s, padding 0.35s ease 0.15s, border-width 0.35s ease 0.15s;
  }

  /* 修复：内框超出外框 */
  .compact-card {
    min-width: 0;
    padding: 10px;
  }

  /* 修复：去掉手机端多余的标题栏分隔线 */
  .top-bar {
    border-bottom: none;
  }

  .basis-value {
    font-size: 30px;
  }

  /* 控制栏手机端居中+紧凑 */
  #controlCenter {
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    top: 6px !important;
    padding: 5px 12px;
    gap: 6px;
    font-size: 13px;
  }

  .control-item {
    gap: 2px;
    font-size: 13px;
    padding: 3px 6px;
  }

  .theme-icon-btn {
    font-size: 18px;
  }
}

/* ========================================
   用户头像下拉菜单
   ======================================== */
.user-menu-wrapper {
  position: relative;
  display: none;
  /* 默认隐藏，通过 JS 添加 .user-menu-visible 显示 */
}

.user-menu-wrapper.user-menu-visible {
  display: block;
}

.user-avatar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  position: relative;
}

.user-avatar-btn:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.15);
}

.user-avatar-btn:active {
  transform: scale(0.9);
}

/* 未读通知角标 */
.user-avatar-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  padding: 0 4px;
  background: #EF4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
  border-radius: 8px;
  display: none;
  /* JS 控制显示 */
  pointer-events: none;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
}

.user-avatar-badge.active {
  display: block;
}

/* 下拉菜单面板 */
.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 220px;
  background: #1e2433;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  padding: 6px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out, visibility 0.2s;
  z-index: 50;
}

/* PC hover 展开 */
.user-menu-wrapper:hover .user-dropdown,
.user-menu-wrapper.menu-open .user-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 用户信息头部 */
.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.user-dropdown-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-dropdown-avatar svg {
  color: #F59E0B;
}

.user-dropdown-info {
  overflow: hidden;
}

.user-dropdown-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-dropdown-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.user-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  letter-spacing: 0.3px;
}

body.theme-light .user-role-badge {
  background: rgba(0, 0, 0, 0.05);
}

.user-dropdown-expire {
  font-size: 10px;
  color: #f59e0b;
  margin-top: 4px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

body.theme-light .user-dropdown-expire {
  color: #d97706;
}

/* 菜单项 */
.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  min-height: 44px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
  box-sizing: border-box;
}

.user-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.user-dropdown-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color 0.15s;
}

.user-dropdown-item:hover svg {
  color: var(--text-primary);
}

.user-dropdown-item-label {
  flex: 1;
}

/* 菜单箭头指示 */
.user-dropdown-arrow {
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.5;
}

/* 通知角标（菜单行内） */
.user-dropdown-badge {
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  padding: 0 5px;
  background: #EF4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
  border-radius: 9px;
}

/* 分隔线 */
.user-dropdown-divider {
  height: 1px;
  margin: 4px 12px;
  background: rgba(255, 255, 255, 0.06);
}

/* 主题切换 Toggle Switch */
.theme-toggle-switch {
  position: relative;
  width: 36px;
  height: 20px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.theme-toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #F59E0B;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.theme-toggle-switch.is-light::after {
  transform: translateX(16px);
}

.theme-toggle-switch.is-light {
  background: rgba(245, 158, 11, 0.25);
}

/* 退出登录（红色警示） */
.user-dropdown-item.danger {
  color: #EF4444;
}

.user-dropdown-item.danger svg {
  color: #EF4444;
}

.user-dropdown-item.danger:hover {
  background: rgba(239, 68, 68, 0.08);
}

/* --- 亮色主题适配 --- */
body.theme-light .user-avatar-btn {
  background: rgba(0, 0, 0, 0.05);
}

body.theme-light .user-avatar-btn:hover {
  background: rgba(0, 0, 0, 0.12);
}

body.theme-light .user-dropdown {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

body.theme-light .user-dropdown-header {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

body.theme-light .user-dropdown-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

body.theme-light .user-dropdown-divider {
  background: rgba(0, 0, 0, 0.06);
}

body.theme-light .theme-toggle-switch {
  background: rgba(0, 0, 0, 0.08);
}

/* --- prefers-reduced-motion --- */
@media (prefers-reduced-motion: reduce) {

  .user-dropdown,
  .user-avatar-btn,
  .theme-toggle-switch::after {
    transition: none;
  }
}

/* --- 手机端 --- */
@media (max-width: 500px) {
  .user-dropdown {
    right: -8px;
    min-width: 200px;
  }
}

/* ========================================
   密码修改 Modal
   ======================================== */
.pwd-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
}

.pwd-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.pwd-modal {
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  width: 360px;
  max-width: 90vw;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s ease;
}

.pwd-modal-overlay.active .pwd-modal {
  transform: scale(1) translateY(0);
}

.pwd-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.pwd-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: #e2e8f0;
}

.pwd-modal-close {
  font-size: 22px;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.pwd-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.pwd-field {
  margin-bottom: 16px;
}

.pwd-field label {
  display: block;
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 6px;
  font-weight: 500;
}

.pwd-field input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.pwd-field input:focus {
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.pwd-strength {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  height: 16px;
}

.pwd-strength-bar {
  height: 4px;
  border-radius: 2px;
  transition: width 0.3s ease, background 0.3s ease;
  max-width: 140px;
}

.pwd-strength-label {
  font-size: 11px;
  font-weight: 500;
}

.pwd-error {
  color: #ef4444;
  font-size: 12px;
  margin-bottom: 12px;
  display: none;
}

.pwd-submit {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.pwd-submit:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.pwd-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* 亮色主题适配 */
.theme-light .pwd-modal {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.theme-light .pwd-modal-title {
  color: #1e293b;
}

.theme-light .pwd-modal-close {
  color: #64748b;
}

.theme-light .pwd-modal-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #1e293b;
}

.theme-light .pwd-field label {
  color: #64748b;
}

.theme-light .pwd-field input {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.1);
  color: #1e293b;
}

.theme-light .pwd-field input:focus {
  border-color: rgba(99, 102, 241, 0.5);
}

/* ========================================
   通知面板（微信风格右侧滑出）
   ======================================== */
.notif-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s;
}

.notif-panel-overlay.open {
  opacity: 1;
  visibility: visible;
}

.notif-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  max-width: 85vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.4);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.notif-panel.open {
  transform: translateX(0);
}

.notif-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.notif-panel-title {
  font-size: 15px;
  font-weight: 600;
  color: #e2e8f0;
}

.notif-panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.notif-mark-all {
  font-size: 12px;
  color: #6366f1;
  cursor: pointer;
  transition: opacity 0.15s;
}

.notif-mark-all:hover {
  opacity: 0.8;
}

.notif-panel-close {
  font-size: 20px;
  color: #94a3b8;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.notif-panel-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.notif-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: #64748b;
  gap: 12px;
}

.notif-empty p {
  margin: 0;
  font-size: 13px;
}

/* 通知列表项 */
.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  cursor: default;
  transition: background 0.15s;
  position: relative;
}

.notif-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.notif-item.unread {
  background: rgba(99, 102, 241, 0.06);
}

.notif-item-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  margin-top: 2px;
}

.notif-item-body {
  flex: 1;
  min-width: 0;
}

.notif-item-title {
  font-size: 13px;
  color: #e2e8f0;
  font-weight: 500;
  line-height: 1.4;
}

.notif-item-content {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.notif-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.notif-item-time {
  font-size: 11px;
  color: #64748b;
}

.notif-read-btn {
  font-size: 11px;
  color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 4px;
  padding: 1px 10px;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1.6;
}

.notif-read-btn:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(99, 102, 241, 0.4);
}

.notif-item-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6366f1;
  flex-shrink: 0;
  margin-top: 6px;
  box-shadow: 0 0 6px rgba(99, 102, 241, 0.5);
}

/* 亮色主题 */
.theme-light .notif-panel {
  background: rgba(255, 255, 255, 0.97);
  border-left-color: rgba(0, 0, 0, 0.06);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.1);
}

.theme-light .notif-panel-header {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

.theme-light .notif-panel-title {
  color: #1e293b;
}

.theme-light .notif-panel-close {
  color: #64748b;
}

.theme-light .notif-panel-close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #1e293b;
}

.theme-light .notif-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

.theme-light .notif-item.unread {
  background: rgba(99, 102, 241, 0.04);
}

.theme-light .notif-item-icon {
  background: rgba(0, 0, 0, 0.04);
  color: #64748b;
}

.theme-light .notif-item-title {
  color: #1e293b;
}

.theme-light .notif-item-content {
  color: #64748b;
}

/* ========================================
   快捷建仓 Modal
   ======================================== */
.qo-overlay {
  position: fixed;
  inset: 0;
  z-index: 99990;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(13, 17, 23, 0.5);
}

.qo-overlay.active {
  display: flex;
}

.qo-modal {
  background: rgba(20, 25, 35, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 28px 32px;
  border-radius: 16px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  width: 340px;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.6);
  animation: qoFadeIn 0.25s ease;
}

@keyframes qoFadeIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.qo-modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #f8fafc;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.qo-contract-label {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 400;
  margin-left: auto;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 6px;
}

.qo-form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.qo-form-row label {
  width: 72px;
  text-align: right;
  font-size: 13px;
  color: #94a3b8;
  flex-shrink: 0;
}

.qo-input,
.qo-select {
  flex: 1;
  height: 36px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #f8fafc;
  font-size: 14px;
  padding: 0 12px;
  outline: none;
  transition: border-color 0.2s;
}

.qo-input:focus,
.qo-select:focus {
  border-color: rgba(245, 158, 11, 0.6);
}

.qo-select {
  cursor: pointer;
}

.qo-select option {
  background: #1a1f2e;
  color: #f8fafc;
}

.qo-error {
  color: #f85149;
  font-size: 12px;
  min-height: 18px;
  margin-bottom: 8px;
  text-align: center;
}

.qo-actions {
  display: flex;
  gap: 10px;
}

.qo-btn-submit {
  flex: 1;
  height: 38px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  transition: all 0.2s;
}

.qo-btn-submit:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

.qo-btn-cancel {
  flex: 1;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.qo-btn-cancel:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: #f8fafc;
}

/* ========================================
   持仓子窗口（基差卡片底部附着）
   ======================================== */
.qo-sub-window {
  margin: 0 8px 8px;
  padding: 10px 14px;
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 8px;
  display: flex;
  align-items: center;
  animation: qoSlideIn 0.3s ease;
}

@keyframes qoSlideIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 左侧信息区 */
.qo-sub-left {
  flex: 1;
  min-width: 0;
}

/* 第一行：方向 | 乘数 | 【基差：-1.49】 */
.qo-sub-line1 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
  font-size: 14px;
}

.qo-sub-dir {
  font-size: 13px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 4px;
}

.qo-sub-dir.dir-expand {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.qo-sub-dir.dir-shrink {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.qo-sub-mul {
  color: #e2e8f0;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.qo-sub-basis {
  color: #c9d1d9;
  font-family: 'JetBrains Mono', monospace;
}

/* 第二行：时间 | 内盘 | 外盘 */
.qo-sub-line2 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #8b949e;
  font-family: 'JetBrains Mono', monospace;
}

.qo-sub-time {
  color: #6e7681;
}

.qo-sub-sep {
  color: #3b4048;
}

/* 右侧盈亏区域（固定宽度，水平单行） */
.qo-sub-right {
  flex-shrink: 0;
  min-width: 110px;
  text-align: right;
  padding-left: 12px;
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 3px;
  white-space: nowrap;
}

.qo-sub-pnl-sym {
  font-size: 13px;
  color: #6e7681;
}

.qo-sub-pnl-val {
  font-size: 26px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.5px;
  line-height: 1;
}

.qo-sub-right.pnl-positive .qo-sub-pnl-val {
  color: #3fb950;
  text-shadow: 0 0 8px rgba(63, 185, 80, 0.4);
}

.qo-sub-right.pnl-negative .qo-sub-pnl-val {
  color: #f85149;
  text-shadow: 0 0 8px rgba(248, 81, 73, 0.4);
}

/* 持仓子窗口内嵌平仓按钮 */
.qo-close-btn {
  margin-left: 8px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  line-height: 1.4;
  transition: all 0.15s ease;
  flex-shrink: 0;
  align-self: center;
}

.qo-close-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

/* 平仓 Modal 只读信息行 */
.qo-close-info {
  font-size: 15px;
  font-weight: 600;
  color: #e2e8f0;
  font-family: 'JetBrains Mono', monospace;
}

body.theme-light .qo-close-info {
  color: #1e293b;
}

body.theme-light .qo-close-btn {
  background: linear-gradient(135deg, #d97706, #b45309);
}

/* 建仓 + 按钮高亮（金色脉冲） */
.top-btn.qo-btn {
  color: #e2e8f0;
}

.top-btn.qo-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* ===== 亮色模式适配 ===== */
body.theme-light .qo-modal {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(217, 119, 6, 0.3);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.15);
}

body.theme-light .qo-modal-title {
  color: #1e293b;
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

body.theme-light .qo-contract-label {
  color: #64748b;
  background: rgba(0, 0, 0, 0.04);
}

body.theme-light .qo-form-row label {
  color: #64748b;
}

body.theme-light .qo-input,
body.theme-light .qo-select {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.12);
  color: #1e293b;
}

body.theme-light .qo-select option {
  background: #fff;
  color: #1e293b;
}

body.theme-light .qo-btn-cancel {
  border-color: rgba(0, 0, 0, 0.12);
  color: #64748b;
}

body.theme-light .qo-btn-cancel:hover {
  border-color: rgba(0, 0, 0, 0.25);
  color: #1e293b;
}

body.theme-light .qo-overlay {
  background: rgba(255, 255, 255, 0.4);
}

body.theme-light .qo-sub-window {
  background: rgba(245, 158, 11, 0.05);
  border-color: rgba(217, 119, 6, 0.2);
}

body.theme-light .qo-sub-line2 {
  color: #475569;
}

body.theme-light .qo-sub-time {
  color: #94a3b8;
}

body.theme-light .qo-sub-mul {
  color: #334155;
}

body.theme-light .qo-sub-basis {
  color: #475569;
}

body.theme-light .qo-sub-sep {
  color: #cbd5e1;
}

body.theme-light .qo-sub-pnl-sym {
  color: #94a3b8;
}

body.theme-light .top-btn.qo-btn {
  color: #1e293b;
}

body.theme-light .top-btn.qo-btn:hover {
  color: #000;
  background: rgba(0, 0, 0, 0.06);
}

/* ========================================
   记账页面已平仓记录日期区间筛选
   ======================================== */
.closed-filter-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  width: 190px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.closed-filter-input:hover {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
}

.filter-shortcut-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-shortcut-btn:hover,
.filter-shortcut-btn.active {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.4);
  color: #f59e0b;
}

body.theme-light .closed-filter-input {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.15);
  color: #1f2937;
}

body.theme-light .closed-filter-input:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: #d97706;
}

body.theme-light .filter-shortcut-btn {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
  color: #4b5563;
}

body.theme-light .filter-shortcut-btn:hover,
body.theme-light .filter-shortcut-btn.active {
  background: rgba(217, 119, 6, 0.08);
  border-color: rgba(217, 119, 6, 0.3);
  color: #d97706;
}