/* ============================================
   主播记账监控台 — Anchor Tracker
   设计系统 & 组件样式
   ============================================ */

/* ---- CSS 变量 ---- */
:root {
  /* 主题色 */
  --primary: #4f46e5;
  --primary-light: #eef2ff;
  --primary-dark: #4338ca;
  --primary-hover: #6366f1;

  /* 功能色 */
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #3b82f6;
  --info-light: #dbeafe;

  /* 中性色 */
  --bg: #f1f5f9;
  --bg-card: #ffffff;
  --bg-hover: #f8fafc;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;

  /* 尺寸 */
  --sidebar-w: 240px;
  --sidebar-collapsed: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);

  /* 动画 */
  --transition: all 0.2s ease;
}

/* ---- Reset ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
*::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

/* ---- 侧边栏 ---- */
.sidebar {
  width: var(--sidebar-w);
  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: 100;
  transition: var(--transition);
}

.sidebar-header {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-light);
}

.logo-icon {
  width: 40px; height: 40px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.logo-text h1 { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.logo-text p { font-size: 11px; color: var(--text-tertiary); }

.nav-menu {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: var(--transition);
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.nav-icon { font-size: 18px; width: 24px; text-align: center; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
}

.data-status {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-tertiary);
}

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
}

/* ---- 主内容区 ---- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---- 顶部栏 ---- */
.topbar {
  height: 60px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-left h2 { font-size: 18px; font-weight: 700; }

.menu-toggle {
  display: none;
  background: none; border: none;
  font-size: 20px; cursor: pointer;
  color: var(--text-secondary);
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.date-display {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 6px 12px;
  background: var(--bg);
  border-radius: var(--radius-xs);
}

/* ---- 视图容器 ---- */
.view-container {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

.view { display: none; animation: fadeIn 0.3s ease; }
.view.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- KPI 网格 ---- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  transition: var(--transition);
}

.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.kpi-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}

.kpi-icon.bg-primary { background: var(--primary-light); }
.kpi-icon.bg-success { background: var(--success-light); }
.kpi-icon.bg-warning { background: var(--warning-light); }
.kpi-icon.bg-info { background: var(--info-light); }
.kpi-icon.bg-danger { background: var(--danger-light); }

.kpi-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.kpi-value { font-size: 24px; font-weight: 700; color: var(--text-primary); }
.kpi-value small { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.kpi-trend { font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.kpi-trend.up { color: var(--danger); }
.kpi-trend.down { color: var(--success); }
.kpi-trend.neutral { color: var(--text-tertiary); }

/* ---- 卡片 ---- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  margin-bottom: 20px;
}

.card-wide { grid-column: 1 / -1; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header h3 { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.card-actions { display: flex; gap: 8px; }

.chart-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.chart-wrapper {
  position: relative;
  height: 280px;
}

/* ---- 表格 ---- */
.table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

tr:hover td { background: var(--bg-hover); }
tr:last-child td { border-bottom: none; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.text-bold { font-weight: 700; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

/* ---- 按钮 ---- */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-xs);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-ghost { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; }

.btn-text { background: none; color: var(--primary); padding: 4px 8px; }
.btn-text:hover { background: var(--primary-light); }

.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---- 表单 ---- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 12px;
}

.form-group { margin-bottom: 12px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.required { color: var(--danger); }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text-primary);
  transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

input[type="date"] { color: var(--text-primary); }

select { cursor: pointer; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.form-calc {
  display: flex;
  gap: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 8px;
}

.calc-item { display: flex; flex-direction: column; gap: 2px; }
.calc-label { font-size: 11px; color: var(--text-tertiary); }
.calc-value { font-size: 16px; font-weight: 700; color: var(--primary); }

/* ---- 工具栏 ---- */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-left { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.toolbar-right { display: flex; gap: 8px; }

.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 11px; color: var(--text-tertiary); font-weight: 600; }
.filter-group input, .filter-group select { padding: 6px 10px; font-size: 13px; width: 140px; }

.search-input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 14px;
  width: 280px;
  background: var(--bg-card);
}

.select-sm { padding: 6px 10px; font-size: 13px; border-radius: var(--radius-xs); border: 1px solid var(--border); }

/* ---- 主播卡片 ---- */
.host-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.host-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  transition: var(--transition);
}

.host-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.host-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.host-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.host-info { flex: 1; }
.host-name { font-size: 16px; font-weight: 700; }
.host-project {
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
  margin-top: 2px;
}

.host-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.host-stat-item { }
.host-stat-label { font-size: 11px; color: var(--text-tertiary); }
.host-stat-value { font-size: 16px; font-weight: 700; }

.host-actions {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.host-actions .btn { flex: 1; justify-content: center; }

/* ---- 录入布局 ---- */
.entry-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.entry-recent-card { display: flex; flex-direction: column; }
.entry-recent-card .card-header { margin-bottom: 8px; }

.recent-list {
  max-height: 520px;
  overflow-y: auto;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 8px;
  transition: var(--transition);
}

.recent-item:hover { background: var(--bg-hover); }

.recent-item-date {
  text-align: center;
  min-width: 50px;
}

.recent-item-date .day { font-size: 18px; font-weight: 700; }
.recent-item-date .month { font-size: 11px; color: var(--text-tertiary); }

.recent-item-info { flex: 1; }
.recent-item-name { font-weight: 600; font-size: 14px; }
.recent-item-detail { font-size: 12px; color: var(--text-secondary); }

.recent-item-actions { display: flex; gap: 4px; }
.recent-item-actions button {
  background: none; border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-tertiary);
  transition: var(--transition);
}
.recent-item-actions button:hover { background: var(--bg); color: var(--text-primary); }
.recent-item-actions .delete-btn:hover { color: var(--danger); }

.badge {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}
.badge.c-gray   { background:#F1EFE8; color:#5F5E5A; }
.badge.c-amber  { background:#FAEEDA; color:#854F0B; }
.badge.c-teal   { background:#E1F5EE; color:#0F6E56; }
.badge.c-coral  { background:#FAECE7; color:#993C1D; }

/* ---- 财务中心 Tab 切换 ---- */
.tabs { display:flex; gap:8px; flex-wrap:wrap; }
.tab-btn {
  padding:8px 16px; border:1px solid var(--border); background:var(--bg);
  color:var(--text-secondary); border-radius:10px; cursor:pointer; font-size:14px; font-weight:500;
  transition:var(--transition);
}
.tab-btn:hover { border-color:var(--primary); color:var(--primary); }
.tab-btn.active { background:var(--primary); border-color:var(--primary); color:#fff; }

/* ---- 进度条 ---- */
.progress-bar {
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
  position: relative;
}

.progress-fill.low { background: var(--danger); }
.progress-fill.mid { background: var(--warning); }
.progress-fill.high { background: var(--success); }

.target-item {
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 12px;
  transition: var(--transition);
}

.target-item:hover { box-shadow: var(--shadow-md); }

.target-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.target-item-name { font-weight: 700; font-size: 15px; }

.target-item-info {
  display: flex;
  gap: 20px;
  margin-top: 10px;
  font-size: 13px;
}

.target-info-item { }
.target-info-label { color: var(--text-tertiary); font-size: 11px; }
.target-info-value { font-weight: 700; font-size: 15px; }

/* ---- 监控网格 ---- */
.monitor-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.refresh-time { color: var(--text-tertiary); font-size: 12px; }

.monitor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.monitor-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--primary);
  transition: var(--transition);
}

.monitor-card.alert { border-left-color: var(--danger); }
.monitor-card.warning { border-left-color: var(--warning); }
.monitor-card.success { border-left-color: var(--success); }

.monitor-card:hover { box-shadow: var(--shadow-md); }

.monitor-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.monitor-card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.monitor-stat { text-align: center; }
.monitor-stat-label { font-size: 11px; color: var(--text-tertiary); }
.monitor-stat-value { font-size: 18px; font-weight: 700; }

.monitor-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.tag-success { background: var(--success-light); color: var(--success); }
.tag-warning { background: var(--warning-light); color: var(--warning); }
.tag-danger { background: var(--danger-light); color: var(--danger); }
.tag-info { background: var(--info-light); color: var(--info); }

/* ---- 预警列表 ---- */
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border: 1px solid var(--border-light);
}

.alert-icon { font-size: 20px; flex-shrink: 0; }
.alert-content { flex: 1; }
.alert-title { font-weight: 600; font-size: 14px; }
.alert-desc { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.alert-time { font-size: 12px; color: var(--text-tertiary); }

.no-data {
  text-align: center;
  padding: 40px;
  color: var(--text-tertiary);
  font-size: 14px;
}

.no-data-icon { font-size: 48px; margin-bottom: 12px; }

/* ---- 弹窗 ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 16px; font-weight: 700; }

.modal-close {
  background: none; border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-tertiary);
  width: 32px; height: 32px;
  border-radius: var(--radius-xs);
  display: flex; align-items: center; justify-content: center;
}

.modal-close:hover { background: var(--bg); }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ---- Toast ---- */
.toast-container {
  position: fixed;
  top: 80px; right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--success);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  animation: slideInRight 0.3s ease;
  max-width: 360px;
}

.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---- 侧边栏遮罩（手机端抽屉） ---- */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 95; /* 低于侧边栏(100)，高于主内容 */
}

/* ---- 响应式 ---- */
@media (max-width: 1024px) {
  .entry-layout { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .chart-row { grid-template-columns: 1fr; }
}

/* 小平板 */
@media (max-width: 900px) {
  .view-container { padding: 18px; }
  .kpi-grid { gap: 12px; }
}

/* 手机 */
@media (max-width: 768px) {
  /* 侧边栏抽屉 + 遮罩 */
  .sidebar {
    width: 82%;
    max-width: 280px;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; }
  .main-content { margin-left: 0; }
  .menu-toggle { display: block; }

  /* 顶栏：去掉占位的日期，按钮收紧 */
  .topbar { padding: 0 14px; height: 54px; }
  .topbar-left h2 { font-size: 16px; }
  .date-display { display: none; }
  .topbar-right { gap: 6px; }
  .topbar-right .btn { padding: 6px 10px; font-size: 12px; }

  /* 视图内容 */
  .view-container { padding: 14px; }
  .card { padding: 16px; }
  .card-header h3 { font-size: 14px; }

  /* KPI 2列紧凑 */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-card { padding: 14px; }
  .kpi-value { font-size: 20px; }
  .kpi-icon { width: 34px; height: 34px; font-size: 17px; }

  /* 工具栏 & 筛选器：2列网格 */
  .toolbar { margin-bottom: 14px; }
  .toolbar-left { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 8px; }
  .search-input { width: 100%; grid-column: 1 / -1; }
  .filter-group { width: 100%; }
  .filter-group input, .filter-group select { width: 100%; }
  .toolbar-right { width: 100%; }
  .toolbar-right .btn { width: 100%; justify-content: center; }

  /* 表单计算结果条：换行不挤 */
  .form-calc { flex-wrap: wrap; gap: 10px 16px; }
  .calc-item { flex: 1 1 28%; }

  /* 表格字体收紧 */
  table { font-size: 12px; }
  th, td { padding: 9px 10px; }

  /* 主播/监控卡片间距 */
  .host-grid, .monitor-grid { gap: 14px; }
  .host-stats { grid-template-columns: 1fr 1fr; }
  .monitor-card-stats { grid-template-columns: 1fr 1fr 1fr; }

  /* 弹窗：接近全宽，按钮堆叠占满 */
  .modal { width: 94%; max-width: 94%; max-height: 90vh; }
  .modal-header { padding: 14px 16px; }
  .modal-header h3 { font-size: 15px; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; flex-direction: column-reverse; gap: 8px; }
  .modal-footer .btn { width: 100%; justify-content: center; }

  /* 登录页 */
  .login-box { padding: 28px 20px; }
  .login-hint-grid { grid-template-columns: 1fr; gap: 8px; }

  .perm-chip { font-size: 10px; padding: 1px 6px; }
}

/* ---- 空状态 ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}

.empty-state-icon { font-size: 56px; margin-bottom: 16px; }
.empty-state-text { font-size: 15px; margin-bottom: 16px; }

/* ---- 登录页 ---- */
.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-overlay.active { display: flex; }

.login-box {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  animation: slideUp 0.4s ease;
}

.login-header { text-align: center; margin-bottom: 28px; }

.login-logo {
  width: 64px; height: 64px;
  background: var(--primary-light);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  margin: 0 auto 16px;
}

.login-header h2 { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.login-header p { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

.login-btn { width: 100%; padding: 12px; font-size: 15px; margin-top: 8px; }

.login-hint {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px dashed var(--border);
}

.login-hint-title {
  font-size: 12px;
  color: var(--text-tertiary);
  font-weight: 600;
  margin-bottom: 12px;
  text-align: center;
}

.login-hint-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.login-hint-card {
  text-align: center;
  padding: 10px 6px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 12px;
}

.login-hint-card code {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: 'Courier New', monospace;
}

.login-hint-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  margin: 0 auto 4px;
}

/* ---- 用户信息条（侧边栏底部） ---- */
.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.user-avatar-sm {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.user-info-sm { flex: 1; min-width: 0; }
.user-name-sm { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.user-role-sm { font-size: 11px; color: var(--text-tertiary); }

.btn-logout {
  background: none;
  border: none;
  width: 32px; height: 32px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-size: 16px;
  color: var(--text-tertiary);
  transition: var(--transition);
}

.btn-logout:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* ---- 角色徽章 ---- */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.perm-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

/* ---- 角色卡片选择器 ---- */
.role-card-pick:hover {
  border-color: var(--primary) !important;
  cursor: pointer;
}

/* ---- 超小屏（<380px） ---- */
@media (max-width: 380px) {
  .topbar-left h2 { font-size: 15px; }
  .kpi-value { font-size: 18px; }
  .kpi-icon { width: 30px; height: 30px; font-size: 15px; }
  .form-calc { gap: 8px 12px; }
  .calc-item { flex-basis: 45%; }
  .monitor-card-stats { grid-template-columns: 1fr; gap: 4px; }
  .monitor-stat-value { font-size: 16px; }
}

/* ---- 话术问诊 对话气泡 ---- */
.chat-box { display:flex; flex-direction:column; gap:10px; }
.chat-bubble { max-width:80%; padding:10px 12px; border-radius:12px; line-height:1.6; }
.chat-who { font-size:11px; opacity:.7; margin-bottom:2px; }
.chat-text { white-space:pre-wrap; word-break:break-word; }
.chat-user { align-self:flex-end; background:var(--primary); color:#fff; border-bottom-right-radius:2px; }
.chat-ai { align-self:flex-start; background:var(--bg-secondary); border:1px solid var(--border-light); border-bottom-left-radius:2px; }
.chat-human { align-self:flex-start; background:#ecfdf5; border:1px solid #a7f3d0; border-bottom-left-radius:2px; }
.fb-detail .fb-meta { font-size:12px; color:var(--text-secondary); margin-bottom:8px; }
.fb-question, .fb-sit { background:var(--bg-secondary); padding:10px 12px; border-radius:8px; margin-bottom:8px; font-size:13px; }
.fb-ask { display:flex; gap:8px; }
.fb-ask input { flex:1; }
