/* =============================================================
   龙虾AI销售CRM — 企业管理后台
   设计系统 v2.0
   ============================================================= */

/* ---------- 颜色与变量 ---------- */
:root {
  /* 主色调：蓝紫渐变 */
  --primary: #5b21b6;
  --primary-light: #ede9fe;
  --primary-dark: #4c1d95;
  --accent: #3b82f6;
  --gradient: linear-gradient(135deg, #5b21b6 0%, #3b82f6 100%);
  --gradient-soft: linear-gradient(135deg, #ede9fe 0%, #dbeafe 100%);
  /* 状态色 */
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #3b82f6;
  --info-light: #dbeafe;
  /* 中性色 */
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --text: #0f172a;
  --text-primary: #0f172a;  /* 【BUG#R91 修复】原变量未定义，导致 .dashboard-card h3 等 fallback 到 inherited */
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 60px rgba(91, 33, 182, 0.12);
  /* 圆角 */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

/* ---------- 基础 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea { font-family: inherit; }

/* =========================================================
   登录页（全新设计：左右双栏 + 品牌区）
   ========================================================= */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background: var(--bg);
}
.login-brand {
  flex: 1;
  background: var(--gradient);
  color: #fff;
  padding: 60px 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-brand::before {
  content: ''; position: absolute; top: -100px; right: -100px; width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
  border-radius: 50%;
}
.login-brand::after {
  content: ''; position: absolute; bottom: -150px; left: -50px; width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  border-radius: 50%;
}
.login-brand-logo {
  font-size: 28px; font-weight: 700; display: flex; align-items: center; gap: 10px; position: relative;
}
.login-brand-logo .emoji { font-size: 36px; }
.login-brand-tagline {
  font-size: 36px; font-weight: 800; line-height: 1.25; margin: 40px 0 16px; position: relative; max-width: 480px;
}
.login-brand-desc {
  font-size: 16px; opacity: 0.85; line-height: 1.7; max-width: 440px; position: relative;
}
.login-brand-features {
  display: flex; flex-direction: column; gap: 14px; margin-top: 32px; position: relative;
}
.login-brand-feat {
  display: flex; align-items: center; gap: 12px; font-size: 14px; opacity: 0.92;
}
.login-brand-feat .check {
  width: 22px; height: 22px; background: rgba(255,255,255,0.25); border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.login-brand-footer {
  font-size: 12px; opacity: 0.7; position: relative;
}

/* 右侧表单区 */
.login-form-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.login-card {
  background: #fff;
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-card-title {
  font-size: 22px; font-weight: 700; margin-bottom: 6px;
}
.login-card-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 28px; }
.login-field { margin-bottom: 16px; }
.login-field label {
  display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px;
}
.login-field input {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px; transition: border-color 0.15s, box-shadow 0.15s;
  background: #fff; color: var(--text);
}
.login-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  outline: none;
}
.login-field input.error { border-color: var(--danger); }
.login-default-hint {
  background: var(--info-light);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 12.5px;
  color: #1e40af;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}
.login-default-hint code {
  background: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 12px;
  color: var(--primary-dark);
  border: 1px solid #bfdbfe;
}
.login-submit {
  width: 100%;
  padding: 13px;
  background: var(--gradient);
  color: #fff;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
  box-shadow: 0 4px 12px rgba(91, 33, 182, 0.3);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.login-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(91, 33, 182, 0.4);
}
.login-submit:active:not(:disabled) { transform: translateY(0); }
.login-submit:disabled { opacity: 0.7; cursor: not-allowed; }
.login-submit .spinner {
  width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.login-feedback {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  display: none;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}
.login-feedback.show { display: flex; }
.login-feedback.error { background: var(--danger-light); color: #991b1b; }
.login-feedback.success { background: var(--success-light); color: #065f46; }
.login-feedback.info { background: var(--info-light); color: #1e40af; }

.login-mobile-toggle { display: none; }

/* =========================================================
   Admin 主面板（统一风格）
   ========================================================= */
.admin-panel { background: var(--bg); min-height: 100vh; }
.admin-header {
  background: var(--gradient);
  color: #fff;
  padding: 14px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}

.admin-title { font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.admin-title .plan-tag {
  background: rgba(255,255,255,0.2); padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 500;
}
.admin-user { font-size: 13px; opacity: 0.95; display: flex; align-items: center; gap: 12px; }
.admin-user a { color: #fff; opacity: 0.85; }
.admin-user a:hover { opacity: 1; }
.admin-user .divider { opacity: 0.4; }

/* 主布局：左侧 sidebar + 右侧 main */
.admin-body {
  display: flex;
  min-height: calc(100vh - 56px);
  transition: padding 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 侧边栏 */
.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #1e293b;
  color: #cbd5e1;
  padding: 16px 0;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  transition: width 0.25s ease;
  box-shadow: 2px 0 4px rgba(0,0,0,0.05);
}
.admin-sidebar::-webkit-scrollbar { width: 6px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: #475569; border-radius: 3px; }

.sidebar-section { margin-bottom: 8px; }
.sidebar-section-title {
  /* 【2026-08-02 协调】主模块标题 11px→13px, 去 uppercase(中文不需), 加亮, 给呼吸 */
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #94a3b8;
  padding: 12px 20px 8px;
}

/* 折叠态 */
.admin-panel.sidebar-collapsed .admin-sidebar {
  width: 56px;
}
.admin-panel.sidebar-collapsed .admin-sidebar .sidebar-section-title,
.admin-panel.sidebar-collapsed .admin-sidebar .nav-text {
  min-width: 0;
  flex: 1;
  display: none;
}
.admin-panel.sidebar-collapsed .admin-sidebar .nav-item {
  justify-content: center;
  padding: 12px 0;
}
.admin-panel.sidebar-collapsed .admin-sidebar .nav-item {
  position: relative;
}
.admin-panel.sidebar-collapsed .admin-sidebar .nav-item::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  background: #1e293b;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  margin-left: 8px;
  z-index: 999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  font-weight: 500;
}
.admin-panel.sidebar-collapsed .admin-sidebar .nav-item:hover::after {
  opacity: 1;
}
.admin-panel.sidebar-collapsed .admin-main {
  max-width: none;
}

/* nav item */
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  font-size: 14px;
  color: #cbd5e1;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  font-weight: 500;
  text-decoration: none;
}
.nav-item:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
  text-decoration: none;
}
.nav-item.active {
  color: #fff;
  background: rgba(167,139,250,0.18);
  border-left-color: #a78bfa;
  font-weight: 600;
  box-shadow: inset 2px 0 0 #a78bfa;
}
.admin-panel.sidebar-collapsed .nav-item.active {
  background: linear-gradient(90deg, rgba(167,139,250,0.25) 0%, transparent 100%);
  border-left-color: transparent;
  box-shadow: inset 3px 0 0 #a78bfa;
}


/* header 左侧 + 折叠按钮 */
.admin-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.sidebar-toggle {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.25); }
.sidebar-toggle { position: relative; z-index: 1100; }

/* 主内容区 */
.admin-main {
  flex: 1;
  padding: 24px 32px;
  max-width: 1280px;
  margin: 0 auto;
  min-width: 0; /* 防止 flex 子项溢出 */
}

/* 移动端 */
@media (max-width: 768px) {
  /* header 简化：隐藏次要信息 */
  .admin-user #userName,
  .admin-user #planTag,
  .admin-user .user-sep,
  .admin-user a[target="_blank"] {
    display: none;
  }
  .admin-title { font-size: 14px; }
  .admin-header { padding: 10px 16px; }

  /* sidebar 抽屉式 */
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s;
    padding-top: 56px;
    pointer-events: none;  /* 隐藏时不接收点击 */
  }
  .admin-panel:not(.sidebar-collapsed) .admin-sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 16px rgba(0,0,0,0.15);
    pointer-events: auto;  /* 展开时接收点击 */
  }

  /* 遮罩 */
  .sidebar-overlay {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
  }
  .admin-panel:not(.sidebar-collapsed) .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  /* nav item 加大触摸区 */
  .nav-item { padding: 14px 20px; font-size: 14px; }

  /* main 紧凑 */
  .admin-main { padding: 16px; }
  
  /* 卡片 2x2 宫格 */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .stat-card { padding: 14px 8px; }
  .stat-num { font-size: 22px !important; }
  .stat-label { font-size: 11px !important; }
  
  /* dashboard-row 上下排列 */
  .dashboard-row { grid-template-columns: 1fr; gap: 12px; margin-bottom: 16px; }
  .dashboard-card { padding: 14px; }
  .trend-chart { height: 80px; }
  
  /* 用量表格横向滚动 */
  .usage-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .usage-table { min-width: 480px; }
  .usage-table th, .usage-table td { padding: 8px 6px !important; font-size: 12px; }
  
  /* h2 缩小 */
  .tab-pane > h2 { font-size: 18px; }
  h3 { font-size: 14px; }
}

.tab-pane > h2 {
  font-size: 22px; font-weight: 700; margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}
.title-icon {
  width: 1.2em; height: 1.2em;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -0.2em;
  color: var(--primary) !important;
}
.nav-icon {
  width: 17px; height: 17px;
  flex-shrink: 0;
  display: inline-block;
  opacity: 0.85;
}
.nav-item:hover .nav-icon { opacity: 1; }
.nav-item.active .nav-icon { color: #a78bfa; opacity: 1; }
.tab-pane .config-title {
  display: flex; align-items: center; gap: 6px;
}

.tab-desc { color: var(--text-secondary); font-size: 14px; margin-bottom: 20px; }

/* 配置卡片 */
.config-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

/* D2 2026-07-27 公共组件: panel-header / panel-empty / panel-loading */
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.panel-header-left { display: flex; align-items: baseline; gap: 8px; }
.panel-header-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin: 0; }
.panel-header-sub { font-size: 12px; color: var(--text-secondary); }
.panel-header-count {
  background: #f1f5f9; color: var(--text-secondary);
  font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 500;
}
.panel-header-right { display: flex; align-items: center; gap: 8px; }
.panel-header-action {
  padding: 7px 14px; border: 1px solid var(--border);
  background: #fff; color: var(--text-primary);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 12px;
  transition: all 0.15s;
}
.panel-header-action:hover { background: #f8fafc; border-color: var(--primary); color: var(--primary); }
.panel-header-action.primary {
  background: var(--gradient); color: #fff;
  border: none; font-weight: 500;
}
.panel-header-action.primary:hover { opacity: 0.9; }

.panel-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 24px; color: var(--text-secondary); font-size: 13px;
  background: #fafbfc; border: 1px dashed var(--border); border-radius: var(--radius-lg);
  text-align: center; gap: 8px;
}
.panel-empty-icon { font-size: 36px; opacity: 0.4; }
.panel-empty-tip { font-size: 11px; color: #94a3b8; }

.panel-loading {
  display: flex; align-items: center; justify-content: center;
  padding: 32px 24px; color: var(--text-secondary); font-size: 12px; gap: 8px;
}
.panel-loading::before {
  content: ''; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #e2e8f0; border-top-color: var(--primary);
  animation: panel-spin 0.8s linear infinite;
}
@keyframes panel-spin { to { transform: rotate(360deg); } }

/* sub-tab 导航（用于 tab-billing 内的 套餐 / AI 账单 切换） */
.subtab-nav {
  display: inline-flex; gap: 0;
  background: #f1f5f9; border-radius: var(--radius-md);
  padding: 3px; margin-bottom: 14px;
}
.subtab-nav button {
  padding: 6px 16px; border: none; background: transparent;
  font-size: 13px; color: var(--text-secondary);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: all 0.15s; font-weight: 500;
}
.subtab-nav button.active {
  background: #fff; color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.subtab-nav button:hover:not(.active) { color: var(--text-primary); }

/* A+C 2026-07-27 侧边栏 section 折叠 */
.sidebar-section-title {
  cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; margin: 0;
}
.sidebar-section-title:hover { color: #cbd5e1; }
.sidebar-section-toggle {
  width: 14px; height: 14px; transition: transform 0.2s;
  color: var(--text-secondary); flex-shrink: 0;
}
.sidebar-section.collapsed .sidebar-section-toggle { transform: rotate(-90deg); }
.sidebar-section.collapsed .nav-item { display: none; }

/* 侧边栏搜索无结果 */
.sidebar-no-match {
  padding: 30px 16px; text-align: center;
  color: var(--text-secondary); font-size: 13px;
}
.sidebar-no-match svg { display: block; margin: 0 auto 8px; opacity: 0.3; }

/* A+C 2026-07-27 标准化徽章 */
.nav-badge {
  margin-left: auto; color: #fff;
  font-size: 10px; padding: 2px 6px;
  border-radius: 6px; font-weight: 600;
  letter-spacing: 0.2px; flex-shrink: 0;
}
.nav-badge.v1 { background: var(--gradient); }
.nav-badge.d2 { background: linear-gradient(135deg,#0ea5e9,#06b6d4); }
.nav-badge.new { background: linear-gradient(135deg,#faad14,#fa541c); }

/* A+C 2026-07-27 面包屑 */
.admin-breadcrumb {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; margin-left: 8px;
  background: #f1f5f9; border-radius: var(--radius-sm);
  font-size: 12px; color: var(--text-secondary);
  max-width: 360px; white-space: nowrap; overflow: hidden;
}
.admin-breadcrumb .crumb-text {
  color: var(--text-primary); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis;
}
.admin-breadcrumb svg { flex-shrink: 0; }
@media (max-width: 1100px) { .admin-breadcrumb { display: none; } }
.config-title {
  font-size: 15px; font-weight: 600; margin-bottom: 4px;
  display: flex; align-items: center; gap: 8px;
}
.config-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; line-height: 1.6; }
.config-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.config-row label { min-width: 110px; font-size: 13px; color: var(--text-secondary); }
.config-row input, .config-row select, .config-row textarea {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; flex: 1; min-width: 200px;
}
.config-row input:focus, .config-row select:focus, .config-row textarea:focus {
  border-color: var(--primary); outline: none;
  box-shadow: 0 0 0 3px var(--primary-light);
}
.config-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.5; }
.config-hint a { color: var(--accent); }

button {
  padding: 8px 16px; background: #fff;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text); transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: inherit; cursor: pointer; outline: none;
}
button .title-icon {
  width: 16px; height: 16px; flex-shrink: 0;
}
button:hover { background: var(--bg-subtle); border-color: var(--text-muted); }
button.btn-primary, button.primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
button.btn-primary:hover, button.primary:hover {
  background: var(--primary-dark); border-color: var(--primary-dark);
}
button.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
button.btn-danger:hover { background: #dc2626; }
button.btn-test { background: var(--info-light); color: #1e40af; border-color: #bfdbfe; }

/* 统计卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.dashboard-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 768px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px !important; margin-bottom: 16px; }
  .dashboard-row { grid-template-columns: minmax(0, 1fr) !important; gap: 12px; margin-bottom: 16px; }
  .quick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px !important; }
  .admin-main { max-width: 100% !important; min-width: 0 !important; }
  .stat-card { min-width: 0; padding: 12px 6px !important; }
  .stat-icon { width: 18px !important; height: 18px !important; margin-bottom: 4px !important; }
  .stat-num { font-size: 18px !important; }
  .stat-label { font-size: 10px !important; }
}
.dashboard-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  border: 1px solid var(--border);
}
.dashboard-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 6px;
}
.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
  padding: 10px 0;
}
.funnel-chart { padding: 4px 0; }
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  text-align: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon { width: 36px; height: 36px; margin-bottom: 8px; }
.stat-num {
  font-size: 32px; font-weight: 700; color: var(--primary);
  line-height: 1.1;
}
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* 表格 */
.plan-table, .usage-table {
  width: 100%; border-collapse: collapse;
  background: #fff; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm);
  font-size: 13px;
}
.plan-table th, .usage-table th {
  background: var(--bg-subtle);
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.plan-table td, .usage-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.plan-table tr:last-child td, .usage-table tr:last-child td { border-bottom: none; }
.plan-table tr:hover { background: var(--bg-subtle); }
.plan-table tr.recommended { background: linear-gradient(90deg, var(--primary-light), transparent); }

/* Toast */
.toast {
  position: fixed; top: 80px; right: 24px;
  padding: 12px 20px; border-radius: var(--radius);
  background: #fff; box-shadow: var(--shadow-md);
  font-size: 13px; z-index: 9999;
  max-width: 360px;
  animation: toastSlide 0.3s ease-out;
  display: flex; align-items: center; gap: 8px;
  overflow: hidden;
}
.toast-text { flex: 1; }
.toast-close { cursor: pointer; opacity: 0.5; font-size: 18px; line-height: 1; }
.toast-close:hover { opacity: 1; }
.toast-bar {
  position: absolute; bottom: 0; left: 0; height: 3px;
  background: currentColor; opacity: 0.4;
  transform-origin: left;
  animation: toastbar 3s linear forwards;  /* 【BUG#R92 修复】原关键帧 toastbar 未应用，导致进度条不消失 */
}
@keyframes toastbar { from { width: 100%; } to { width: 0; } }
.toast.success { background: var(--success-light); color: #065f46; border-left: 4px solid var(--success); }
.toast.error { background: var(--danger-light); color: #991b1b; border-left: 4px solid var(--danger); }
.toast.info { background: var(--info-light); color: #1e40af; border-left: 4px solid var(--info); }
@keyframes toastSlide {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* 弹窗 */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5);
  z-index: 9999; display: none; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal-card {
  background: #fff; border-radius: var(--radius-xl); padding: 28px;
  max-width: 420px; width: 100%; box-shadow: var(--shadow-lg);
  max-height: 90vh; overflow-y: auto;
}

/* 响应式：移动端 */
@media (max-width: 768px) {
  .login-page { flex-direction: column; }
  .login-brand { padding: 32px 24px; }
  .login-brand-tagline { font-size: 24px; }
  .login-form-wrap { padding: 24px 16px; }
  .admin-main { padding: 16px; }
  .admin-header { padding: 12px 16px; }
  .admin-nav { padding: 0 12px; top: 52px; }
  .nav-item { padding: 12px 12px; font-size: 12.5px; }
  .config-card { padding: 16px; }
  .stat-num { font-size: 24px; }
}

/* 快捷入口 */
.quick-actions { background: #fff; border-radius: 12px; padding: 20px; margin-bottom: 24px; border: 1px solid var(--border); }
.quick-actions h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; color: var(--text-primary); display: flex; align-items: center; gap: 6px; }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.quick-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 14px; background: #f8fafc; border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; text-decoration: none;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.2s ease,
              border-color 0.15s ease,
              background 0.15s ease; text-align: center;
  position: relative; overflow: hidden;
}
.quick-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: linear-gradient(90deg, #5b21b6, #7c3aed, #a78bfa);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.quick-card:hover {
  background: #fff;
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(91, 33, 182, 0.15);
}
.quick-card:hover::before { transform: scaleX(1); }
.quick-card:active { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(91, 33, 182, 0.12); }
.quick-card .title-icon { width: 28px; height: 28px; }
.quick-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.quick-desc { font-size: 11px; color: var(--text-secondary); }

/* 数据流转图 */
.flow-diagram {
  display: flex; align-items: center; gap: 10px;
  padding: 14px; background: #fafbfc; border-radius: 8px;
  overflow-x: auto;
}
.flow-col {
  display: flex; flex-direction: column; gap: 8px;
}
.flow-col-multi { min-width: 110px; }
.flow-node {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 8px;
  background: #fff; border: 1px solid #e2e8f0;
  font-size: 12px; color: #1e293b;
  white-space: nowrap;
}
.flow-node small { color: #94a3b8; font-size: 10px; }
.flow-source { border-left: 3px solid #3b82f6; }
.flow-core { background: #f3e8ff; border: 1px solid #c084fc; font-weight: 600; min-width: 130px; }
.flow-action { border-left: 3px solid #10b981; }
.flow-output { border-left: 3px solid #f59e0b; }
.flow-arrow {
  color: #94a3b8; font-size: 20px; font-weight: 700;
  flex-shrink: 0;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: 4px;
}
.skeleton-text { height: 14px; margin: 6px 0; }
.skeleton-num { height: 32px; width: 60%; margin: 8px 0; }
@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* 按钮 loading 态 */
button.loading, button:disabled {
  opacity: 0.6;
  cursor: not-allowed !important;
  pointer-events: none;
}
button.loading::before {
  content: ''; display: inline-block; width: 12px; height: 12px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin 0.6s linear infinite;
  margin-right: 6px; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 工具提示 */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute; bottom: -28px; left: 50%;
  transform: translateX(-50%);
  padding: 4px 8px; background: #0f172a; color: #fff;
  font-size: 11px; border-radius: 4px;
  white-space: nowrap; z-index: 100;
  pointer-events: none;
  animation: tooltipIn 0.15s ease-out;
}
@keyframes tooltipIn { from { opacity: 0; transform: translateX(-50%) translateY(2px); } to { opacity: 1; } }

/* 空状态 */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px; padding: 40px 20px; color: var(--text-muted);
  text-align: center;
}
.empty-state svg { color: #cbd5e1; }
.empty-state-title { font-size: 13px; font-weight: 500; color: #475569; }
.empty-state-desc { font-size: 12px; color: #94a3b8; }
.empty-state-action { margin-top: 8px; }

/* 焦点态（可访问性） */
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--primary, #5b21b6);  /* 【BUG#R95 修复】原 fallback #722ed1 与 --primary #5b21b6 不一致 */
  outline-offset: 2px;
}

/* 文本截断 */
.text-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 暗色模式 */
body.dark-mode {
  background: #0f172a;
  color: #e2e8f0;
}
body.dark-mode .stat-card,
body.dark-mode .dashboard-card,
body.dark-mode .config-card,
body.dark-mode .plan-table {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}
body.dark-mode .stat-num { color: #a78bfa; }
body.dark-mode .stat-label { color: #94a3b8; }
body.dark-mode input, body.dark-mode select, body.dark-mode textarea {
  background: #1e293b; color: #e2e8f0; border-color: #334155;
}
body.dark-mode .skeleton {
  background: linear-gradient(90deg, #1e293b 0%, #334155 50%, #1e293b 100%);
  background-size: 200% 100%;
}

/* 顶部全局搜索 */
.admin-search {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 4px 10px;
  margin-left: 16px;
  min-width: 280px;
  color: rgba(255,255,255,0.7);
}
.admin-search input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 13px;
  flex: 1;
}
.admin-search input::placeholder { color: rgba(255,255,255,0.5); }
.admin-search svg { color: rgba(255,255,255,0.6); width: 14px; height: 14px; }
.search-shortcut {
  font-size: 10px; padding: 1px 5px;
  background: rgba(255,255,255,0.15);
  border-radius: 3px;
  color: rgba(255,255,255,0.6);
}
@media (max-width: 768px) {
  .admin-search { display: none; }
  .admin-title { font-size: 13px; }
}

/* §3.1 maintenance banner (招标/司法/公众号 等后端缺路由的模块) */
.maint-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 16px 0;
  padding: 14px 18px;
  background: linear-gradient(135deg, #fff7e6 0%, #fffbe6 100%);
  border: 1px solid #ffd591;
  border-left: 4px solid #fa8c16;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(250,140,22,0.08);
}
.maint-banner .maint-icon {
  font-size: 22px;
  line-height: 1.2;
  flex-shrink: 0;
}
.maint-banner .maint-body {
  flex: 1;
  min-width: 0;
}
.maint-banner .maint-title {
  font-size: 14px;
  font-weight: 700;
  color: #d4380d;
  margin-bottom: 4px;
}
.maint-banner .maint-sub {
  font-size: 12px;
  color: #874d00;
  line-height: 1.5;
}
.maint-banner .maint-sub code {
  background: rgba(0,0,0,0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  color: #c41d7f;
}

/* §3.3 demo-mode banner (AI 外呼 数据为模拟) */
.demo-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f0f5ff 0%, #e6f4ff 100%);
  border: 1px solid #91caff;
  border-left: 4px solid var(--accent);
  border-radius: 10px;
}
.demo-banner .demo-icon {
  font-size: 20px;
  line-height: 1.2;
  flex-shrink: 0;
}
.demo-banner .demo-body {
  flex: 1;
  min-width: 0;
}
.demo-banner .demo-title {
  font-size: 13px;
  font-weight: 700;
  color: #0958d9;
  margin-bottom: 2px;
}
.demo-banner .demo-sub {
  font-size: 12px;
  color: #003eb3;
  line-height: 1.5;
}
.demo-banner .demo-sub code {
  background: rgba(0,0,0,0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  color: #c41d7f;
}

/* §3.1 maintenance banner (招标/司法/公众号 等后端缺路由的模块) */
.maint-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 16px 0;
  padding: 14px 18px;
  background: linear-gradient(135deg, #fff7e6 0%, #fffbe6 100%);
  border: 1px solid #ffd591;
  border-left: 4px solid #fa8c16;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(250,140,22,0.08);
}
.maint-banner .maint-icon {
  font-size: 22px;
  line-height: 1.2;
  flex-shrink: 0;
}
.maint-banner .maint-body {
  flex: 1;
  min-width: 0;
}
.maint-banner .maint-title {
  font-size: 14px;
  font-weight: 700;
  color: #d4380d;
  margin-bottom: 4px;
}
.maint-banner .maint-sub {
  font-size: 12px;
  color: #874d00;
  line-height: 1.5;
}
.maint-banner .maint-sub code {
  background: rgba(0,0,0,0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  color: #c41d7f;
}

/* §3.3 demo-mode banner (AI 外呼 数据为模拟) */
.demo-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f0f5ff 0%, #e6f4ff 100%);
  border: 1px solid #91caff;
  border-left: 4px solid var(--accent);
  border-radius: 10px;
}
.demo-banner .demo-icon {
  font-size: 20px;
  line-height: 1.2;
  flex-shrink: 0;
}
.demo-banner .demo-body {
  flex: 1;
  min-width: 0;
}
.demo-banner .demo-title {
  font-size: 13px;
  font-weight: 700;
  color: #0958d9;
  margin-bottom: 2px;
}
.demo-banner .demo-sub {
  font-size: 12px;
  color: #003eb3;
  line-height: 1.5;
}
.demo-banner .demo-sub code {
  background: rgba(0,0,0,0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  color: #c41d7f;
}

/* §3.2 全局搜索 toast 类型新增 warning */
.toast.warning { background: #fff7e6; color: #874d00; border-left: 4px solid #fa8c16; }

/* ============================================================
 * Full-opt 新增: 快捷入口下拉 (2026-07-28)
 * ============================================================ */
.admin-quickmenu { position: relative; display: inline-block; }
.admin-quickmenu > a { color: inherit; text-decoration: none; cursor: pointer; }
.quickmenu-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0;
  display: none; flex-direction: column;
  min-width: 200px; padding: 8px;
  background: rgba(12, 11, 41, 0.96);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 200;
}
.quickmenu-dropdown a {
  display: flex !important; align-items: center; gap: 10px;
  padding: 10px 14px;
  color: #e8e7ff !important; font-size: 13px;
  text-decoration: none;
  border-radius: 8px;
  transition: background .2s ease, color .2s ease;
}
.quickmenu-dropdown a:hover {
  background: rgba(139,92,246,0.18);
  color: #a78bfa !important;
}


/* ============================================================
 * UI-FIX 2026-07-28
 * ============================================================ */

/* 话术编辑器 modal 滚动到底时 footer 仍可见 */
#botScriptEditorOverlay .sales-login-modal > div:last-child {
  position: sticky;
  bottom: -1px;
  background: #fff;
  padding-top: 12px;
  margin-top: 16px;
  border-top: 1px solid #e2e8f0;
  z-index: 10;
}

/* 拨号历史 / 客户搜索下拉最后一行去掉下边框 */
#dialHistoryDropdown > div:last-child,
#customerSuggestDropdown > div:last-child {
  border-bottom: none !important;
}

/* ============================================================
 * MOBILE-FIX 2026-07-29 (B方案)
 * 修复：sidebar 抽屉式 + main 紧凑 + 表格横滚 + 表单单列
 * ============================================================ */

/* 主体：手机端根容器 */
@media (max-width: 768px) {
  /* 全局：禁止横向滚（防 sidebar 漏出） */
  html, body { overflow-x: hidden; }

  /* header 进一步紧凑 */
  .admin-header {
    padding: 8px 12px !important;
    gap: 8px;
  }
  .admin-header-left { gap: 8px; flex: 1; min-width: 0; }
  .admin-title {
    font-size: 13px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .admin-user {
    font-size: 12px;
    gap: 4px;
    flex-wrap: wrap;
  }
  /* 手机端：面包屑 + 快捷入口 + CRM 面板链接隐藏（节省横向空间） */
  .admin-breadcrumb,
  .admin-user a[target="_blank"],
  .admin-user #userName,
  .admin-user #planTag,
  .admin-user .user-sep,
  .admin-user .admin-quickmenu { display: none !important; }

  /* sidebar：抽屉式（确保 z-index 高于 header + overlay） */
  .admin-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    height: 100vh !important;
    width: 260px !important;
    max-width: 80vw !important;
    z-index: 1500 !important;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    box-shadow: none;
    padding-top: 56px !important;
  }
  body.is-mobile:not(.sidebar-collapsed) .admin-sidebar,
  body.is-mobile .admin-panel:not(.sidebar-collapsed) .admin-sidebar {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.18);
    pointer-events: auto;
  }

  /* sidebar overlay：遮罩 + 渐显 */
  .sidebar-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0,0,0,0.45);
    z-index: 1400 !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
  }
  body.is-mobile .admin-panel:not(.sidebar-collapsed) .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  /* 汉堡按钮：显眼 + 高 z-index */
  .sidebar-toggle {
    z-index: 1600 !important;
    position: relative !important;
    background: rgba(255,255,255,0.15);
    border: 0;
    width: 36px; height: 36px;
    border-radius: 8px;
    font-size: 18px;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
  }
  .sidebar-toggle:active { transform: scale(0.94); }

  /* main：紧凑 padding */
  .admin-main {
    padding: 12px !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* 卡片栅格：强制单列（手机端表格/详情更适合单列） */
  .stats-grid,
  .dashboard-row,
  .quick-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
  }
  /* 概览区仪表盘：保持 2x2 但紧凑 */
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .stat-card { padding: 12px 6px !important; }
  .stat-num { font-size: 18px !important; }
  .stat-label { font-size: 10px !important; }
  .stat-icon { width: 20px !important; height: 20px !important; }

  /* 表格：横滚 + 小屏字号 */
  .plan-table, .usage-table, .data-table, table {
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    font-size: 12px;
  }
  .plan-table th, .usage-table th,
  .plan-table td, .usage-table td,
  table th, table td {
    padding: 8px 6px !important;
    white-space: nowrap;
  }

  /* 表单：单列 + 全宽 input */
  form .form-row,
  .form-grid,
  .config-form-grid,
  .kv-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }
  form input[type="text"],
  form input[type="number"],
  form input[type="email"],
  form input[type="password"],
  form select,
  form textarea,
  .config-card input,
  .config-card select,
  .config-card textarea {
    width: 100% !important;
    box-sizing: border-box !important;
    font-size: 14px !important;
    padding: 10px 12px !important;
  }

  /* 按钮：全宽主要 CTA */
  .btn-primary,
  button.btn-save,
  button.btn-submit,
  form button[type="submit"] {
    width: 100% !important;
    padding: 12px !important;
    font-size: 14px !important;
  }

  /* modal / dialog：全屏 */
  .modal, .dialog, .sales-login-modal,
  .modal-overlay .modal-content,
  .modal-overlay > div {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }

  /* 卡片：紧凑 padding */
  .config-card, .dashboard-card,
  .card, .panel-card {
    padding: 12px !important;
    margin-bottom: 12px !important;
  }

  /* nav item：触摸友好 */
  .nav-item {
    padding: 14px 18px !important;
    font-size: 14px !important;
    min-height: 48px;
  }
  .nav-icon { width: 20px !important; height: 20px !important; }

  /* badge：稍大更清晰 */
  .nav-badge { font-size: 9px !important; padding: 1px 5px !important; letter-spacing: 0.2px; }
  .nav-item { padding: 12px 16px !important; gap: 10px !important; font-size: 13px !important; }
  .nav-text { font-size: 13px !important; }

  /* 顶栏子元素：手机端隐藏面包屑 */
  .admin-breadcrumb { display: none !important; }

  /* 快捷入口卡片（admin 主页） */
  .quick-card { padding: 14px 8px !important; }
  .quick-title { font-size: 12px !important; }
  .quick-desc { font-size: 10px !important; }
}

/* 横屏手机（窄高度） */
@media (max-width: 768px) and (max-height: 500px) {
  .admin-sidebar { padding-top: 48px !important; }
  .nav-item { padding: 10px 18px !important; min-height: 40px; }
}

/* 超窄屏（<480px） */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
  }
  .admin-title { font-size: 12px !important; }
}

/* ═══════════════════════════════════════════════════════════════════════
   2026-08-08 D-mob · A+B 档适配补全
   - 登录页竖排（A：左右双栏 → 上下堆叠）
   - quick-grid 4 列 → 2×2（A：快链区挤）
   - 配置表单 label/input 堆叠（B：flex-wrap 还是会挤）
   - 表格 min-width 480→360（A：iPhone SE 375 留余地）
   - 触摸目标 44px（B：苹果 HIG / Material 标准）
   - toast 全宽底部（A：避免覆盖移动 header）
   - modal/popup <480 全屏（B：弹窗不再半屏挤压）
   - 超窄屏 <360 字体再小一档（B：极小屏兜底）
   ═══════════════════════════════════════════════════════════════════════ */

/* ── 1. 登录页：左右 → 上下 ──────────────────────────────────────── */
@media (max-width: 768px) {
  .login-page {
    flex-direction: column !important;
    min-height: 100vh;
  }
  .login-brand {
    flex: 0 0 auto !important;
    width: 100% !important;
    padding: 24px 20px !important;
    /* 收起底部装饰圆 + 简化文案 */
  }
  .login-brand-features { display: none !important; }   /* 卖点列表移到落地页 */
  .login-brand-footer { display: none !important; }      /* 版权信息隐藏 */
  .login-brand-tagline { font-size: 22px !important; margin-bottom: 6px !important; }
  .login-brand-desc { font-size: 13px !important; opacity: 0.85; }
  .login-brand-logo { font-size: 22px !important; margin-bottom: 8px !important; }
  .login-form-wrap {
    flex: 1 !important;
    padding: 24px 20px !important;
    align-items: flex-start;
  }
  .login-card { max-width: 100% !important; width: 100% !important; }
  .login-default-hint { padding: 10px 12px !important; font-size: 12px !important; }
}
@media (max-width: 480px) {
  .login-brand-tagline { font-size: 18px !important; }
  .login-brand-desc { font-size: 12px !important; line-height: 1.5 !important; }
  .login-card-title { font-size: 18px !important; }
  .login-card-sub { font-size: 13px !important; margin-bottom: 18px !important; }
  .login-field input { font-size: 15px !important; padding: 10px 12px !important; }  /* 防 iOS 自动放大 */
  .login-submit { padding: 12px !important; font-size: 14px !important; }
}

/* ── 2. quick-grid 4 → 2×2 ───────────────────────────────────────── */
@media (max-width: 768px) {
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  .quick-icon { font-size: 26px !important; }
}
@media (max-width: 360px) {
  .quick-grid { grid-template-columns: 1fr !important; }   /* 极窄屏单列 */
}

/* ── 3. 配置表单：label/input 上下堆叠 ─────────────────────────────── */
@media (max-width: 768px) {
  .config-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    margin-bottom: 14px !important;
  }
  .config-row label {
    min-width: 0 !important;
    font-size: 12px !important;
    font-weight: 600;
    color: var(--text-secondary);
  }
  .config-row input,
  .config-row select,
  .config-row textarea {
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
    font-size: 15px !important;          /* 防 iOS 自动放大 */
    padding: 10px 12px !important;
  }
  .config-row button { width: 100% !important; }
  .config-title { font-size: 15px !important; }
  .config-desc { font-size: 12px !important; }
}

/* ── 4. 表格：min-width 480 → 360，padding 收窄 ─────────────────────── */
@media (max-width: 768px) {
  .usage-table { min-width: 360px !important; }
  .plan-table  { min-width: 320px !important; }
  .usage-table th, .plan-table th { padding: 8px 6px !important; font-size: 11px !important; }
  .usage-table td, .plan-table td { padding: 8px 6px !important; font-size: 12px !important; }
  /* table-wrap 加滑动提示 */
  .usage-table-wrap::after {
    content: '← 左右滑动 →';
    display: block;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    padding: 6px;
    background: linear-gradient(90deg, transparent, var(--bg-subtle) 20%, var(--bg-subtle) 80%, transparent);
  }
}

/* ── 5. 全局触摸目标 ≥44px (B：移动可用性) ────────────────────────── */
@media (max-width: 768px) {
  button, .btn, .panel-header-action, .nav-item, .quick-card,
  input[type="checkbox"], input[type="radio"] {
    min-height: 44px !important;
  }
  /* 例外：紧凑型 inline 按钮 */
  .toast-close, .panel-empty button { min-height: auto !important; }
  /* 滚动容器可滚动（移动 touch） */
  .config-card, .dashboard-card, .panel-card {
    -webkit-overflow-scrolling: touch;
  }
}

/* ── 6. toast：全宽底部（避免压 header） ─────────────────────────── */
@media (max-width: 768px) {
  .toast {
    top: auto !important;
    right: 12px !important;
    left: 12px !important;
    bottom: 16px !important;
    max-width: none !important;
    width: auto !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,.15) !important;
  }
}

/* ── 7. sub-tab / 子标签页：横滚 ──────────────────────────────────── */
@media (max-width: 768px) {
  .subtab-nav {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    gap: 4px !important;
  }
  .subtab-nav button {
    flex-shrink: 0 !important;
    padding: 8px 12px !important;
    font-size: 12px !important;
  }
}

/* ── 8. dashboard-card / chart 卡片 ───────────────────────────────── */
@media (max-width: 768px) {
  .dashboard-card { padding: 12px !important; }
  .dashboard-card-title { font-size: 14px !important; }
  .funnel-chart, .trend-chart { padding: 6px 0 !important; }
  /* chart 容器避免太小看不清楚 */
  canvas { max-width: 100% !important; height: auto !important; }
}

/* ── 9. 极窄屏 <360 兜底 ─────────────────────────────────────────── */
@media (max-width: 360px) {
  body { font-size: 12px !important; }
  .admin-main { padding: 12px !important; }
  .stat-num { font-size: 18px !important; }
  .stat-label { font-size: 10px !important; }
  .panel-header-title { font-size: 14px !important; }
  .tab-pane > h2 { font-size: 16px !important; }
  h3 { font-size: 13px !important; }
  .quick-grid { grid-template-columns: 1fr !important; }
}

/* =============================================================
   【D24 BUGFIX】sales-login-overlay 全屏 modal 样式
   用于 #botScriptEditorOverlay / #buyDialog / #aiCallSummaryDetailOverlay
   之前缺失,导致 modal 叠加在表单下方而非居中弹出
   ============================================================= */
.sales-login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.sales-login-overlay[style*="display: flex"],
.sales-login-overlay.show { display: flex !important; }
.sales-login-modal {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.sales-login-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  padding: 28px;
  max-width: 420px;
  width: 100%;
}
