
/* ========== 全局设计 Tokens — 华纳云 HNCloud 风格（科技蓝 + 冰白云平台配色） ========== */
:root {
  /* 品牌色：科技蓝（华纳云 "上云无忧" 强调色系） */
  --brand-50:  #EEF4FF;
  --brand-100: #D6E4FF;
  --brand-200: #AECBFF;
  --brand-300: #7CAAFF;
  --brand-400: #4C8EFF;
  --brand-500: #2E7BFF;   /* 主品牌（华纳蓝 logo） */
  --brand-600: #1677FF;   /* CTA/按钮/高亮 */
  --brand-700: #0D5FE6;
  --brand-800: #0C4FC4;
  --brand-900: #0E3E95;

  /* 背景：冰蓝白（云平台风格，空气感） */
  --bg-app:    #F5F8FD;
  --bg-card:   #ffffff;
  --bg-sub:    #F8FAFE;
  --bg-hover:  #EEF4FB;
  --bg-panel:  #FAFCFF;

  /* 边框/分割：冰蓝色描边 */
  --border:    #E5ECF5;
  --border-2:  #D5E0EF;
  --border-3:  #BFCDE0;

  /* 文字：深墨蓝（华纳大标题）→ 中灰蓝 → 浅灰蓝 */
  --text-1:    #1D2B4A;
  --text-2:    #2A3548;
  --text-3:    #55647A;
  --text-4:    #8695AB;

  /* 语义色：华纳云云产品语义绿/琥珀/红 */
  --ok-500:    #0AAE6A;  --ok-600: #06955a;  --ok-bg: #E6F8EF;
  --warn-500:  #FFA940;  --warn-600:#D98A1E;  --warn-bg:#FFF5E4;
  --err-500:   #F04D4D;  --err-600: #D93B3B;  --err-bg: #FFEBEB;
  --info-500:  #2E7BFF;  --info-600: #1677FF;  --info-bg: #E8F1FF;
  --acc-1:     #FFA940;  --acc-1-bg:#FFF5E4;  /* 琥珀金 — 今日互动 */
  --acc-2:     #0AAE6A;  --acc-2-bg:#E6F8EF;  /* 翠绿 — 话术总数 */
  --acc-4:     #625DF5;  --acc-4-bg:#EEECFF;  /* 星紫 — 任务总数（云产品点缀） */

  --purple-500:#625DF5;  /* 云紫点缀，极小面积使用 */

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 2px rgba(22,55,110,.04), 0 1px 2px rgba(22,55,110,.03);
  --shadow:    0 4px 14px -6px rgba(22,55,110,.10), 0 2px 4px -2px rgba(22,55,110,.05);
  --shadow-lg: 0 18px 40px -12px rgba(22,55,110,.18), 0 6px 14px -6px rgba(22,55,110,.08);
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,.6);

  /* 华纳风渐变（品牌+冰蓝） */
  --grad-brand: linear-gradient(135deg, #1677FF 0%, #4C8EFF 60%, #7EADFF 100%);
  --grad-brand-soft: linear-gradient(135deg, #EEF4FF 0%, #ffffff 100%);
  --grad-hero: linear-gradient(135deg, #EEF4FF 0%, #F8FAFE 30%, #ffffff 100%);
  --grad-sidebar: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-app) 100%);

  /* 登录页浅色背景 */
  --login-bg-1: #DCE8FF;
  --login-bg-2: #E6F2FF;
  --login-bg-3: #EEF4FF;

  /* 字号梯度 token */
  --fs-h1: 22px;      /* 页面主标题 */
  --fs-h2: 16px;      /* 区块标题 */
  --fs-h3: 14.5px;    /* 卡片标题 */
  --fs-body: 13.5px;  /* 正文 */
  --fs-caption: 12px;/* 副文案/辅助 */
  --fs-mini: 11px;    /* 最小文字 */

  /* 字重梯度（收敛为 400/600/700） */
  --fw-normal: 400;
  --fw-medium: 600;
  --fw-bold: 700;
}
/* ========== 深色主题覆盖（Linear/Vercel 风格） ========== */
[data-theme="dark"] {
  --brand-400: #3B8BFF;
  --brand-500: #3B8BFF;
  --brand-600: #3B8BFF;
  --brand-700: #5C9DFF;
  --brand-50:  #172033;
  --brand-100: #1A2536;
  --brand-200: #1F3050;
  --bg-app:    #0B1220;
  --bg-card:   #111A2B;
  --bg-sub:    #0E1726;
  --bg-hover:  #172033;
  --bg-panel:  #0F1A2C;
  --border:    #1E2A40;
  --border-2:  #283450;
  --border-3:  #3A4768;
  --text-1:    #E6EDF7;
  --text-2:    #C9D3E3;
  --text-3:    #8B97AB;
  --text-4:    #5C6680;
  --ok-500:    #2BD68E;  --ok-600: #18C77A;  --ok-bg:   #0E2A20;
  --warn-500:  #FFB866;  --warn-600: #E69A3D; --warn-bg: #2A2010;
  --err-500:   #FF6B6B;  --err-600: #E85555;  --err-bg:  #2A1010;
  --info-500:  #3B8BFF;  --info-600: #5C9DFF; --info-bg: #102030;
  --acc-1:     #FFB866;  --acc-1-bg: #2A2010;
  --acc-2:     #2BD68E;  --acc-2-bg: #0E2A20;
  --acc-4:     #8B86F8;  --acc-4-bg: #181638;
  --purple-500:#8B86F8;
  --shadow-sm: 0 0 0 1px rgba(0,0,0,.25);
  --shadow:    0 0 0 1px rgba(0,0,0,.3), 0 4px 14px -6px rgba(0,0,0,.4);
  --shadow-lg: 0 0 0 1px rgba(0,0,0,.3), 0 18px 40px -12px rgba(0,0,0,.5);
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,.05);
  --grad-brand: linear-gradient(135deg, #3B8BFF 0%, #5C9DFF 100%);
  --grad-brand-soft: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-sub) 100%);
  --grad-hero: linear-gradient(135deg, var(--bg-sub) 0%, var(--bg-card) 100%);
  --grad-sidebar: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-sub) 100%);
  /* 登录页深色背景 */
  --login-bg-1: #0B1220;
  --login-bg-2: #0E1726;
  --login-bg-3: #111A2B;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-feature-settings: "tnum" 1, "ss01" 1, "cv11" 1, "kern" 1;
  font-variant-numeric: tabular-nums;
  background: var(--bg-app);
  color: var(--text-2);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
/* 登录页 — 华纳云首屏冰蓝白科技风 */
#login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 15% -10%, var(--login-bg-1) 0%, transparent 60%),
    radial-gradient(900px 600px at 110% 110%, var(--login-bg-2) 0%, transparent 55%),
    linear-gradient(160deg, var(--login-bg-3) 0%, var(--bg-app) 100%);
  position: relative;
  overflow: hidden;
}
#login-page::before {
  content: '';
  position: absolute;
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(22,119,255,0.10) 0%, transparent 70%);
  top: -260px; right: -220px;
}
#login-page::after {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(76,142,255,0.10) 0%, transparent 70%);
  bottom: -200px; left: -180px;
}
.login-box {
  position: relative; z-index: 2;
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: 22px;
  padding: 44px 40px;
  width: 400px;
  box-shadow: 0 30px 70px -20px rgba(22,87,180,.18), 0 8px 24px -8px rgba(22,87,180,.08);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(135deg, #1677FF, #4C8EFF);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.5px;
}
.login-logo p {
  color: var(--text-3);
  font-size: 12px;
  margin-top: 8px;
}
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 8px;
}
.form-group input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-sub);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  color: var(--text-1);
  font-size: 14px;
  transition: all 0.2s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--brand-600);
  background: var(--bg-card);
  box-shadow: 0 0 0 4px rgba(22,119,255,0.12);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(.4,0,.2,1);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--grad-brand);
  color: white;
  box-shadow: 0 1px 2px rgba(46,103,148,0.25), 0 1px 0 rgba(255,255,255,.15) inset;
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 6px 16px -4px rgba(46,103,148,.35); }
.btn-success {
  background: linear-gradient(180deg, var(--ok-500) 0%, var(--ok-600) 100%);
  color: white;
  box-shadow: 0 1px 2px rgba(47,154,111,0.25);
}
.btn-success:hover { filter: brightness(1.06); box-shadow: 0 6px 16px -4px rgba(47,154,111,.3); }
.btn-danger {
  background: linear-gradient(180deg, var(--err-500) 0%, var(--err-600) 100%);
  color: white;
  box-shadow: 0 1px 2px rgba(210,82,76,0.25);
}
.btn-danger:hover { filter: brightness(1.06); box-shadow: 0 6px 16px -4px rgba(210,82,76,.3); }
.btn-warning {
  background: linear-gradient(180deg, var(--warn-500) 0%, var(--warn-600) 100%);
  color: white;
  box-shadow: 0 1px 2px rgba(217,149,36,0.25);
}
.btn-warning:hover { filter: brightness(1.06); }
.btn-secondary {
  background: linear-gradient(180deg, #6b7a8e 0%, #505f74 100%);
  color: white;
}
.btn-secondary:hover { filter: brightness(1.08); }
.btn-outline {
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
}
.btn-outline:hover {
  border-color: var(--brand-400);
  color: var(--brand-700);
  background: var(--brand-50);
}
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 7px; }

/* 主布局 */
#main-app { display: none; }
.app-layout {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 232px;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}
.sidebar-header {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--grad-brand-soft);
}
.sidebar-header h2 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.2px;
  background: linear-gradient(135deg, #1677FF 0%, #4C8EFF 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar-header p {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
  letter-spacing: 0.3px;
}
.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  overflow-y: auto;
}
.nav-group { margin-bottom: 6px; }
.nav-group-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-4);
  padding: 8px 14px 4px;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-3);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 3px;
  border: 1px solid transparent;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--brand-700);
}
.nav-item.active {
  background: linear-gradient(90deg, rgba(22,119,255,0.10), rgba(76,142,255,0.05));
  color: var(--brand-700);
  border-color: rgba(76,142,255,0.3);
  font-weight: 700;
  box-shadow: var(--shadow-inset);
}
.nav-item.active::before {
  content: '';
  width: 3px; height: 18px; border-radius: 3px;
  background: linear-gradient(180deg, #1677FF, #4C8EFF);
  margin-left: -6px;
  margin-right: 4px;
}
.nav-icon { font-size: 17px; }
.sidebar-footer {
  padding: 14px 16px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(135deg, #1677FF 0%, #4C8EFF 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 6px 14px -4px rgba(22,119,255,.35);
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text-1); }
.user-role { font-size: 11px; color: var(--text-4); }
.logout-btn {
  width: 100%;
  padding: 8px;
  font-size: 12px;
  background: var(--bg-card);
  color: var(--err-600);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  transition: all .15s;
}
.logout-btn:hover { background: var(--err-bg); border-color: var(--err-500); color: var(--err-600); }

.main-content {
  flex: 1;
  margin-left: 232px;
  padding: 22px 28px;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.page-title { font-size: var(--fs-h1); font-weight: var(--fw-bold); color: var(--text-1); letter-spacing: 0.3px; }
.page-subtitle { font-size: var(--fs-caption); color: var(--text-3); margin-top: 5px; }

/* 面包屑 */
.breadcrumb { font-size: var(--fs-mini); color: var(--text-4); margin-bottom: 4px; }
.breadcrumb .sep { margin: 0 4px; opacity: .5; }
.breadcrumb .current { color: var(--text-1); font-weight: var(--fw-medium); }

/* 密度切换器 */
.density-toggle { display: inline-flex; border: 1px solid var(--border-2); border-radius: 8px; overflow: hidden; }
.density-toggle button {
  font-size: var(--fs-mini); padding: 3px 8px; border: none; background: transparent;
  color: var(--text-4); cursor: pointer; font-weight: var(--fw-medium); transition: all .15s;
}
.density-toggle button:hover { color: var(--text-2); }
.density-toggle button.on { background: var(--brand-600); color: #fff; }

/* 密度三档 */
[data-density="compact"] .data-table th, [data-density="compact"] .data-table td { padding: 6px 10px; font-size: 12px; }
[data-density="compact"] .stat-card { padding: 14px 16px 16px; }
[data-density="compact"] .panel { padding: 14px 16px; }
[data-density="comfort"] .data-table th, [data-density="comfort"] .data-table td { padding: 16px 18px; font-size: 14px; }
[data-density="comfort"] .stat-card { padding: 26px 28px 28px; }
[data-density="comfort"] .panel { padding: 28px 30px; }

/* 空状态统一组件 */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 20px; text-align: center; gap: 6px;
}
.empty-state .empty-icon { font-size: 36px; opacity: .45; }
.empty-state .empty-title { font-size: var(--fs-h3); font-weight: var(--fw-medium); color: var(--text-3); }
.empty-state .empty-desc { font-size: var(--fs-caption); color: var(--text-4); }
.empty-state .empty-cta {
  margin-top: 8px; padding: 6px 14px; border-radius: var(--radius-sm);
  background: var(--brand-600); color: #fff; border: none; cursor: pointer;
  font-size: var(--fs-caption); font-weight: var(--fw-medium); transition: all .15s;
}
.empty-state .empty-cta:hover { background: var(--brand-700); }

/* 主题切换按钮 */
.theme-toggle {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--border-2);
  background: var(--bg-sub); color: var(--text-3); font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
}
.theme-toggle:hover { border-color: var(--brand-500); color: var(--brand-600); }

/* 新手引导 checklist 卡片 */
.onboard-checklist {
  background: linear-gradient(135deg, var(--brand-50) 0%, var(--bg-card) 100%);
  border: 1px solid var(--brand-200); border-radius: var(--radius-lg);
  padding: 18px 22px; margin-bottom: 18px; position: relative; overflow: hidden;
}
.onboard-checklist::after {
  content: ''; position: absolute; width: 160px; height: 160px; right: -40px; top: -40px;
  border-radius: 50%; background: radial-gradient(circle, var(--brand-100) 0%, transparent 70%); opacity: .6;
}
.onboard-checklist h3 { font-size: var(--fs-h2); font-weight: var(--fw-bold); color: var(--brand-700); margin-bottom: 4px; position: relative; z-index: 2; }
.onboard-checklist p { font-size: var(--fs-caption); color: var(--text-3); margin-bottom: 12px; position: relative; z-index: 2; }
.onboard-steps { display: flex; flex-direction: column; gap: 8px; position: relative; z-index: 2; }
.onboard-step { display: flex; align-items: center; gap: 10px; font-size: var(--fs-body); }
.onboard-step .step-dot {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-3);
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: var(--fw-bold); color: var(--text-4); flex-shrink: 0;
}
.onboard-step.done .step-dot { background: var(--ok-500); border-color: var(--ok-500); color: #fff; }
.onboard-step .step-label { color: var(--text-2); }
.onboard-step.done .step-label { color: var(--text-4); text-decoration: line-through; }
.onboard-step .step-cta { margin-left: auto; font-size: var(--fs-mini); color: var(--brand-600); font-weight: var(--fw-medium); cursor: pointer; }
.onboard-step.done .step-cta { color: var(--ok-600); }
.onboard-progress { height: 4px; background: var(--border); border-radius: 2px; margin-top: 12px; overflow: hidden; position: relative; z-index: 2; }
.onboard-progress-bar { height: 100%; background: linear-gradient(90deg, var(--brand-500), var(--ok-500)); border-radius: 2px; transition: width .3s; }

/* onboarding 全屏引导遮罩 */
.onboard-mask {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 9999;
  pointer-events: auto;
}
.onboard-highlight {
  position: absolute; border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(11,18,32,.6);
  border: 2px solid var(--brand-500);
  transition: all .25s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}
.onboard-tooltip {
  position: absolute; background: var(--bg-card); border: 1px solid var(--border-2);
  border-radius: var(--radius-lg); padding: 18px 20px; width: 300px;
  box-shadow: var(--shadow-lg); z-index: 10000;
}
.onboard-tooltip .ot-step { font-size: var(--fs-mini); font-weight: var(--fw-bold); color: var(--brand-600); text-transform: uppercase; letter-spacing: .5px; }
.onboard-tooltip .ot-title { font-size: var(--fs-h2); font-weight: var(--fw-bold); color: var(--text-1); margin-top: 4px; }
.onboard-tooltip .ot-desc { font-size: var(--fs-body); color: var(--text-3); margin-top: 8px; line-height: 1.5; }
.onboard-tooltip .ot-actions { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.onboard-tooltip .ot-btn {
  padding: 7px 16px; border-radius: var(--radius-sm); font-size: var(--fs-caption); font-weight: var(--fw-medium);
  border: 1px solid var(--border-2); background: var(--bg-card); color: var(--text-3); cursor: pointer; transition: all .15s;
}
.onboard-tooltip .ot-btn:hover { background: var(--bg-hover); color: var(--text-1); }
.onboard-tooltip .ot-btn.primary { background: var(--brand-600); color: #fff; border-color: var(--brand-600); }
.onboard-tooltip .ot-btn.primary:hover { background: var(--brand-700); }

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.22s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: linear-gradient(180deg, #ffffff 0%, var(--bg-panel) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px 22px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: all .2s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--border-2);
}
.stat-card::after {
  content: '';
  position: absolute;
  width: 200px; height: 200px;
  right: -70px; top: -70px;
  border-radius: 50%;
  opacity: 0.55;
}
.stat-card.purple::after { background: radial-gradient(circle, #E8E6FF 0%, transparent 70%); }  /* 星紫 */
.stat-card.green::after  { background: radial-gradient(circle, #D8F3E6 0%, transparent 70%); }  /* 翠绿 */
.stat-card.blue::after   { background: radial-gradient(circle, #DCE8FF 0%, transparent 70%); }  /* 科技蓝 */
.stat-card.orange::after { background: radial-gradient(circle, #FFEACC 0%, transparent 70%); }  /* 琥珀 */
.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  border-top-left-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-lg);
}
.stat-card.purple::before { background: linear-gradient(180deg, #7C76F8, #625DF5); }
.stat-card.green::before  { background: linear-gradient(180deg, #2BD68E, #0AAE6A); }
.stat-card.blue::before   { background: linear-gradient(180deg, #4C8EFF, #1677FF); }
.stat-card.orange::before { background: linear-gradient(180deg, #FFC477, #FFA940); }
.stat-card .label { font-size: 12.5px; color: var(--text-3); margin-bottom: 8px; font-weight: 700; letter-spacing: .2px; }
.stat-card .value { font-size: 32px; font-weight: 800; color: var(--text-1); letter-spacing: -0.5px; line-height: 1.1; position: relative; z-index: 2; }
.stat-card .sub { font-size: 12px; margin-top: 8px; font-weight: 700; position: relative; z-index: 2; letter-spacing: .2px; }
.stat-card.purple .value { color: var(--acc-4); }
.stat-card.green .value  { color: var(--ok-600); }
.stat-card.blue .value   { color: var(--brand-600); }
.stat-card.orange .value { color: var(--warn-600); }
.stat-card .sub.success { color: var(--ok-600); }
.stat-card .sub.warning { color: var(--warn-600); }

/* 通用容器 */
.panel {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-sub) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.panel-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: .2px;
}

/* 表格 */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.data-table th {
  color: var(--text-3);
  font-weight: 700;
  font-size: 11.5px;
  background: var(--bg-panel);
  letter-spacing: 0.6px;
}
.data-table th:first-child { border-top-left-radius: var(--radius-sm); }
.data-table th:last-child  { border-top-right-radius: var(--radius-sm); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }
.data-table td { color: var(--text-2); }
.log-date-separator td {
  background: var(--bg-2) !important;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-1) !important;
  padding: 8px 12px;
  border-bottom: 2px solid var(--border-2);
  border-top: 2px solid var(--border-2);
}
.log-date-separator:hover td { background: var(--bg-2) !important; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
}
.status-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
}
.status-online  { background: var(--ok-bg);   color: var(--ok-600); border-color: rgba(47,154,111,.18); }
.status-online::before  { background: var(--ok-500); animation: pulse 1.5s infinite; }
.status-offline { background: var(--bg-sub);        color: var(--text-3); border-color: var(--border); }
.status-offline::before { background: var(--text-4); }
.status-running { background: var(--info-bg); color: var(--info-600); border-color: rgba(61,127,177,.2); }
.status-running::before { background: var(--info-500); animation: pulse 1.5s infinite; }
.status-idle    { background: var(--bg-sub);        color: var(--text-3); border-color: var(--border); }
.status-idle::before    { background: var(--text-4); }
.status-warning { background: rgba(251,191,36,.12); color: var(--warn-500); border-color: rgba(251,191,36,.3); }
.status-warning::before { background: var(--warn-500); animation: pulse 1.5s infinite; }
.status-danger  { background: rgba(248,113,113,.12); color: var(--err-500); border-color: rgba(248,113,113,.3); }
.status-danger::before  { background: var(--err-500); animation: pulse 1.5s infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
/* ⭐ 无障碍关闭时闪烁警告 */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* 设备网格 */
.device-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
/* 表格视图时，device-grid 不用 grid 布局，让表格撑满 */
.device-grid.device-grid-table {
  display: block;
  width: 100%;
}
/* 紧凑表格视图（100+台设备） */
.device-table-wrap {
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  width: 100%;
}
.device-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: auto;
}
.device-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-panel);
  box-shadow: 0 1px 0 var(--border);
}
.device-table th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.device-table th:hover { background: var(--bg-hover); }
.device-table th.sort-active { color: var(--brand-500); }
.device-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.device-table tr { cursor: pointer; transition: background 0.15s; }
.device-table tbody tr:hover { background: var(--bg-hover); }
.device-table tr.selected { background: rgba(61,127,177,0.06); }
.device-table tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--brand-500); }
.device-table .col-cb { width: 40px; text-align: center; }
.device-table .col-status { width: 80px; }
.device-table .col-actions { width: 220px; white-space: nowrap; }
.device-table .row-offline { opacity: 0.5; }
/* 统计栏 */
.device-stats-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.device-stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.device-stat-item:hover { border-color: var(--brand-300); }
.device-stat-item.active { background: var(--brand-50); border-color: var(--brand-500); }
.device-stat-item .stat-num { font-weight: 700; font-size: 15px; }
.device-stat-item .stat-label { color: var(--text-3); }
/* 状态指示点 */
.dot { display:inline-block; width:8px; height:8px; border-radius:50%; }
.dot-online { background: var(--ok-500); box-shadow:0 0 4px rgba(16,185,129,0.5); }
.dot-offline { background: var(--text-4); }
.dot-busy { background: var(--warn-500); }
/* 机型分组折叠 */
.model-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.model-group-header:hover { background: var(--bg-hover); }
.model-group-header .toggle { font-size: 10px; transition: transform 0.2s; }
.model-group-header.collapsed .toggle { transform: rotate(-90deg); }
.model-group-body { display: ; }
.model-group-body.collapsed { display: none; }
.device-card {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-panel) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: all 0.22s cubic-bezier(.4,0,.2,1);
  cursor: pointer;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.device-card:hover {
  border-color: var(--brand-300);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.device-card.selected {
  border-color: var(--brand-500);
  background: var(--brand-50);
  box-shadow: 0 0 0 3px rgba(61,127,177,0.10), var(--shadow-sm);
}
.device-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}
.device-name { font-weight: 700; font-size: 14px; color: var(--text-1); line-height: 1.3; }
.device-model { font-size: 11px; color: var(--text-4); margin-top: 3px; }
.device-info {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.9;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 10px;
}
.device-info span { color: var(--text-2); font-weight: 600; }
.device-checkbox {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 18px;
  height: 18px;
  accent-color: var(--brand-500);
  cursor: pointer;
}
.device-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-start;
  align-items: center;
}
.btn-device-danger {
  color: var(--err-600) !important;
  border-color: rgba(210,82,76,0.35) !important;
}
.btn-device-danger:hover {
  background: var(--err-bg) !important;
  border-color: var(--err-500) !important;
}

/* 模态框 */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(22,42,65, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.18s;
}
.modal-overlay.show { display: flex; }
.modal {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-sub) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 600px;
  max-width: 92vw;
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px -15px rgba(22,42,65,.25), 0 8px 20px -10px rgba(22,42,65,.12);
  animation: modalIn 0.22s cubic-bezier(.4,0,.2,1);
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg-panel) 100%);
}
.modal-title { font-size: 15.5px; font-weight: 700; color: var(--text-1); letter-spacing: .2px; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-1); }
.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modal.large { width: 820px; }
.modal-content {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-sub) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 600px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
  box-shadow: 0 25px 60px -15px rgba(22,42,65,.25);
}
.modal-title { margin-bottom: 16px; }
.modal-close { position: absolute; top: 14px; right: 14px; }

/* 表单 */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.form-item { margin-bottom: 14px; }
.form-item.full { grid-column: 1 / -1; }
.form-label {
  display: block;
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: 7px;
  font-weight: 600;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  background: var(--bg-sub);
  box-shadow: 0 0 0 3px rgba(61,127,177,0.12);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 11.5px; color: var(--text-3); margin-top: 5px; line-height: 1.6; }

/* form-control 兼容（select/input/textarea 默认白色背景修复） */
.form-control {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--brand-500);
  background: var(--bg-sub);
  box-shadow: 0 0 0 3px rgba(61,127,177,0.12);
}
.form-control::placeholder { color: var(--text-4); }

/* 开关 */
.switch-group {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.switch-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.switch-item input { accent-color: var(--brand-600); width: 16px; height: 16px; cursor: pointer; }
.switch-item label { font-size: 13px; color: var(--text-2); cursor: pointer; }

/* 话术列表 */
.script-group-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.script-group-item {
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  transition: all 0.15s;
  position: relative;
}
.script-group-item:hover {
  border-color: var(--brand-300);
  border-left-color: var(--brand-400);
  background: var(--brand-50);
  transform: translateX(2px);
}
.script-group-item.active {
  border-color: var(--brand-400);
  border-left-color: var(--brand-600);
  background: linear-gradient(135deg, var(--brand-50), var(--bg-card));
  box-shadow: 0 2px 8px rgba(61,127,177,0.12);
}
.script-group-item > div:first-child {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.script-group-name { font-weight: 700; font-size: 13.5px; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.script-group-desc { font-size: 11px; color: var(--text-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.script-group-count {
  background: var(--brand-50);
  color: var(--brand-700);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--brand-100);
  flex-shrink: 0;
}

/* 话术条目 */
.script-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 14px;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-panel) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  gap: 10px;
  transition: all 0.15s;
}
.script-item:hover {
  border-color: var(--brand-200);
  box-shadow: var(--shadow-sm);
}
.script-item.selected {
  border-color: var(--brand-500);
  background: var(--brand-50);
  box-shadow: 0 0 0 2px rgba(61,127,177,0.08);
}
.script-check {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--brand-500);
  cursor: pointer;
  flex-shrink: 0;
}
.script-body { flex: 1; }
.script-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-700);
  margin-bottom: 3px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.script-name-edit {
  font-size: 12px;
  padding: 2px 8px;
  border: 1px dashed var(--brand-400);
  background: var(--bg-card);
  border-radius: 5px;
  min-width: 140px;
  color: var(--brand-700);
  font-weight: 600;
}
.script-name-save {
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
  color: var(--brand-600);
}
.script-content { font-size: 13.5px; line-height: 1.6; color: var(--text-1); font-weight: 500; }
.script-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 6px;
}
.script-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* 两栏布局 */
.two-col {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 18px;
}
.sidebar-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  box-shadow: var(--shadow-sm);
}
.content-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

/* 日志终端 */
.log-terminal {
  background: #0f172a;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-family: 'Consolas', 'Monaco', 'Cascadia Code', monospace;
  font-size: 12px;
  line-height: 1.8;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border-2);
}
.log-line { display: flex; gap: 10px; }
.log-time { color: var(--text-3); flex-shrink: 0; }
.log-device { color: var(--info-500); flex-shrink: 0; }
.log-action { color: var(--ok-500); flex-shrink: 0; }
.log-content { color: var(--text-3); flex: 1; word-break: break-all; }
.log-content.success { color: var(--ok-500); }
.log-content.failed { color: var(--err-500); }

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
  background: linear-gradient(180deg, var(--bg-panel) 0%, var(--bg-card) 100%);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}
.empty-icon { font-size: 46px; margin-bottom: 14px; opacity: 0.6; filter: grayscale(.2); }
.empty-title { font-size: 14.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 700; }
.empty-desc { font-size: 12.5px; color: var(--text-4); line-height: 1.6; }

/* Toast */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 11px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-1);
  background: var(--bg-card);
  border-left: 4px solid var(--brand-600);
  box-shadow: 0 10px 24px -10px rgba(22,42,65,.25), 0 2px 6px rgba(22,42,65,.04);
  animation: slideIn 0.25s cubic-bezier(.4,0,.2,1);
  min-width: 240px;
  font-weight: 600;
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.success { border-left-color: var(--ok-600); background: linear-gradient(180deg, var(--bg-card), var(--ok-bg)); color: var(--ok-600); }
.toast.error   { border-left-color: var(--err-600); background: linear-gradient(180deg, var(--bg-card), var(--err-bg)); color: var(--err-600); }
.toast.info    { border-left-color: var(--info-600); background: linear-gradient(180deg, var(--bg-card), var(--info-bg)); color: var(--info-600); }
.toast.warning { border-left-color: var(--warn-600); background: linear-gradient(180deg, var(--bg-card), var(--warn-bg)); color: var(--warn-600); }

/* =========================================================
   法律免责声明弹窗（登录后强制确认）
   - 强制：禁止点击遮罩 / X 按钮 / ESC 关闭
   - 只允许点「同意并继续」或「不同意并关闭」两个按钮
   - 不同意：window.close() 尝试关闭当前浏览器标签页
========================================================= */
#legal-disclaimer {
  z-index: 2147483646;
  background: rgba(10, 22, 38, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
#legal-disclaimer .modal {
  width: min(640px, calc(100vw - 40px));
  max-height: min(86vh, 720px);
  border-radius: 14px;
  box-shadow: 0 30px 80px -24px rgba(10, 22, 38, 0.45), 0 4px 18px rgba(10,22,38,.18);
  border: 1px solid rgba(15, 53, 91, 0.15);
}
#legal-disclaimer .modal-header {
  background: linear-gradient(180deg, var(--bg-sub) 0%, var(--bg-card) 100%);
  border-bottom: 1px solid var(--border);
  padding: 18px 22px;
}
#legal-disclaimer .modal-title {
  color: var(--text-1);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
#legal-disclaimer .legal-badge {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-700));
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  letter-spacing: 1px;
}
#legal-disclaimer .modal-body {
  padding: 18px 22px;
  overflow: auto;
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-2);
}
#legal-disclaimer .legal-body-title {
  font-weight: 700;
  color: var(--text-1);
  margin: 10px 0 4px;
}
#legal-disclaimer .legal-body-title:first-child { margin-top: 0; }
#legal-disclaimer .legal-body p { margin: 4px 0 8px; }
#legal-disclaimer .legal-body ul { padding-left: 20px; margin: 4px 0 8px; }
#legal-disclaimer .legal-body li { margin: 3px 0; }
#legal-disclaimer .legal-warning {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--warn-bg), rgba(251,191,36,0.08));
  border: 1px solid var(--warn-500);
  color: var(--warn-600);
  font-size: 13px;
  font-weight: 600;
}
#legal-disclaimer .legal-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--brand-50);
  border: 1px dashed var(--border-3);
}
#legal-disclaimer .legal-checkbox-row input { margin-top: 4px; }
#legal-disclaimer .legal-checkbox-row label {
  font-size: 13px;
  color: var(--text-1);
  font-weight: 600;
  line-height: 1.6;
  user-select: none;
  cursor: pointer;
}
#legal-disclaimer .modal-footer {
  border-top: 1px solid var(--border);
  padding: 14px 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-sub);
}
#legal-disclaimer .btn-disagree {
  background: var(--bg-card);
  color: var(--err-600);
  border: 1px solid var(--err-500);
  font-weight: 600;
}
#legal-disclaimer .btn-disagree:hover { background: var(--err-bg); }
#legal-disclaimer .btn-agree:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* 工具类 */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mt-10 { margin-top: 10px; }
.text-sm { font-size: 12.5px; }
.text-muted { color: var(--text-3); }
.text-success { color: var(--ok-600); }
.text-warning { color: var(--warn-600); }
.text-danger { color: var(--err-600); }
.w-full { width: 100%; }

/* 筛选栏 */
.filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.filter-bar .form-select, .filter-bar .form-input {
  width: auto;
  min-width: 160px;
}

/* 进度条 */
.progress-bar {
  height: 4px;
  background: var(--border-2);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 10px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  transition: width 0.3s;
}


          /* ===== AI 智能跟播页面专属样式 ===== */
          .ai-hero {
            display:flex;justify-content:space-between;align-items:center;gap:16px;
            padding:24px 28px;border-radius:var(--radius-lg);
            background:var(--grad-hero);border:1px solid var(--border);
            box-shadow:var(--shadow-sm);margin-bottom:20px;
          }
          .ai-hero h1 { font-size:24px; color:var(--text-1); margin-bottom:6px; font-weight:700; }
          .ai-hero p { font-size:13px; color:var(--text-3); }
          .ai-status-pill {
            display:inline-flex;align-items:center;gap:8px;
            padding:8px 16px;border-radius:999px;font-size:13px;font-weight:600;
            background:var(--bg-card);border:1px solid var(--border-2);
          }
          .ai-status-pill .dot { width:8px;height:8px;border-radius:50%; }
          .ai-status-pill.on { background:var(--ok-bg);border-color:var(--ok-500);color:var(--ok-600); }
          .ai-status-pill.on .dot { background:var(--ok-500); box-shadow:0 0 8px var(--ok-500); }
          .ai-status-pill.off { background:var(--bg-sub);color:var(--text-4); }
          .ai-status-pill.off .dot { background:var(--text-4); }

          .ai-layout { display:grid;grid-template-columns:1fr 1fr;gap:16px;align-items:stretch; }
          .ai-layout > .ai-panel:not(.ai-panel-wide) { height:700px; }
          .ai-layout .ai-panel-wide { grid-column: 1 / -1; margin-top:16px; }
          .ai-layout .ai-panel { display:flex;flex-direction:column; }
          .ai-layout .ai-panel .ai-panel-body,
          .ai-layout .ai-panel > .ai-log-wrap { flex:1;display:flex;flex-direction:column; }
          @media (max-width:1100px){ .ai-layout{ grid-template-columns:1fr; } }

          .ai-panel {
            background:var(--bg-card);border:1px solid var(--border);
            border-radius:var(--radius-lg);box-shadow:var(--shadow-sm);
            overflow:hidden;
          }
          .ai-panel-head {
            display:flex;justify-content:space-between;align-items:center;gap:12px;
            padding:14px 18px;border-bottom:1px solid var(--border);
            background:var(--grad-brand-soft);flex-shrink:0;
          }
          .ai-panel-head h3 { font-size:15px;color:var(--text-1);font-weight:700;display:flex;align-items:center;gap:8px; }
          .ai-panel-head .sub { font-size:12px;color:var(--text-4);margin-top:2px;font-weight:400; }
          .ai-panel-body { padding:16px 18px; }

          .ai-config-grid { display:grid;grid-template-columns:1fr 1fr;gap:10px 14px; }
          .ai-config-item label { display:block;font-size:12px;color:var(--text-3);font-weight:600;margin-bottom:4px; }
          .ai-config-item .hint { font-size:11px;color:var(--text-4);font-weight:400; }
          .ai-config-item.full { grid-column:1/-1; }

          .ai-advanced { margin-top:14px;border-top:1px dashed var(--border-2);padding-top:12px; }
          .ai-advanced summary {
            cursor:pointer;font-size:13px;font-weight:600;color:var(--brand-600);
            list-style:none;display:flex;align-items:center;gap:6px;user-select:none;
          }
          .ai-advanced summary::before { content:'▶'; font-size:10px; transition:transform .2s; }
          .ai-advanced[open] summary::before { transform:rotate(90deg); }
          .ai-advanced summary::-webkit-details-marker { display:none; }
          .ai-advanced > .ai-config-grid { margin-top:12px; }

          .ai-actions { display:flex;gap:10px;margin-top:auto;padding-top:14px;flex-wrap:wrap; }
          .ai-test-box { margin-top:12px;padding:10px 14px;border-radius:var(--radius-sm);font-size:13px;display:none; }

          .ai-log-table { font-size:12px;width:100%;border-collapse:collapse; }
          .ai-log-table th { padding:8px 6px;text-align:left;font-size:11px;color:var(--text-4);font-weight:600;border-bottom:1px solid var(--border);white-space:nowrap; }
          .ai-log-table td { padding:7px 6px;border-bottom:1px solid var(--border-2);vertical-align:top;line-height:1.4; }
          .ai-log-table td.ai-log-time { color:var(--text-4);white-space:nowrap; }
          .ai-log-table td.ai-log-task { color:var(--text-3);white-space:nowrap;max-width:80px;overflow:hidden;text-overflow:ellipsis; }
          .ai-log-table td.ai-log-heard { color:var(--text-2); }
          .ai-log-table td.ai-log-reply { color:var(--brand-600);font-weight:500; }
          .ai-log-table td.ai-log-status { white-space:nowrap; }
          .ai-log-table td.ai-log-cost { color:var(--text-4);white-space:nowrap; }

          /* ===== AI 角色卡片网格 ===== */
          .preset-grid { display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:14px; }
          .preset-card {
            position:relative;border:1px solid var(--border);border-radius:var(--radius);
            background:var(--bg-card);padding:16px 16px 14px 20px;
            transition:all .2s;cursor:default;overflow:hidden;
          }
          .preset-card::before {
            content:'';position:absolute;left:0;top:0;bottom:0;width:4px;
            background:var(--brand-400);
          }
          .preset-card:hover { border-color:var(--brand-300);box-shadow:var(--shadow);transform:translateY(-1px); }
          .preset-card.disabled { opacity:.62; }
          .preset-card.disabled::before { background:var(--text-4); }
          .preset-head { display:flex;justify-content:space-between;align-items:flex-start;gap:10px;margin-bottom:10px; }
          .preset-title-row { display:flex;align-items:center;gap:8px;flex-wrap:wrap; }
          .preset-emoji { font-size:20px;line-height:1; }
          .preset-name { font-size:15px;font-weight:700;color:var(--text-1); }
          .preset-id { font-size:11px;color:var(--text-4); }
          .preset-tags { display:flex;gap:6px;flex-wrap:wrap;margin-top:8px; }
          .preset-tag {
            display:inline-flex;align-items:center;gap:3px;padding:2px 8px;border-radius:10px;
            font-size:11px;font-weight:500;
          }
          .preset-tag.model { background:var(--info-bg);color:var(--info-600); }
          .preset-tag.temp { background:var(--warn-bg);color:var(--warn-600); }
          .preset-tag.max { background:var(--ok-bg);color:var(--ok-600); }
          .preset-tag.off { background:var(--err-bg);color:var(--err-600); }
          .preset-desc { font-size:12px;color:var(--text-3);margin-bottom:10px;line-height:1.5; }
          .preset-prompt-prev {
            font-size:11px;color:var(--text-3);font-family:'SF Mono',Consolas,monospace;
            background:var(--bg-sub);padding:8px 10px;border-radius:var(--radius-sm);
            border-left:3px solid var(--brand-400);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
            margin-bottom:12px;line-height:1.4;
          }
          .preset-actions { display:flex;gap:8px; }
          .preset-actions .btn { font-size:12px;padding:5px 12px; }

          .preset-empty {
            text-align:center;padding:40px 20px;color:var(--text-4);
            border:2px dashed var(--border-2);border-radius:var(--radius);background:var(--bg-sub);
          }
          .preset-empty .big { font-size:40px;margin-bottom:10px; }

          /* ===== 角色编辑弹层美化 ===== */
          .ai-modal-overlay {
            display:none;position:fixed;inset:0;background:rgba(15,23,42,0.45);
            backdrop-filter:blur(4px);z-index:1000;align-items:center;justify-content:center;
          }
          .ai-modal-overlay.show { display:flex; }
          .ai-modal {
            background:var(--bg-card);border-radius:var(--radius-lg);
            width:min(660px,92vw);max-height:90vh;overflow-y:auto;
            box-shadow:var(--shadow-lg);animation:aiModalIn .2s ease;
          }
          @keyframes aiModalIn { from{opacity:0;transform:translateY(12px) scale(.98);} to{opacity:1;transform:none;} }
          .ai-modal-head {
            padding:20px 24px;border-bottom:1px solid var(--border);
            background:var(--grad-brand-soft);border-radius:var(--radius-lg) var(--radius-lg) 0 0;
            display:flex;justify-content:space-between;align-items:center;
          }
          .ai-modal-head h3 { font-size:17px;color:var(--text-1);font-weight:700; }
          .ai-modal-body { padding:22px 24px; }
          .ai-modal-foot { padding:16px 24px;border-top:1px solid var(--border);display:flex;justify-content:flex-end;gap:10px; }
        
