* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* 背景层级 */
  --bg: #0a0a14;
  --bg2: #14141f;
  --bg3: #1e1e2e;
  /* 边框 */
  --border: #2a2a3a;
  /* 文字 */
  --text: #e8e8f0;
  --text2: #8a8aa0;
  /* 品牌色：金色（中式奢华） */
  --accent: #c9a961;
  --accent-hover: #d4b47f;
  --accent-text: #2a1a00;
  /* 语义色 */
  --success: #4ade80;
  --warning: #fbbf24;
  --error: #f87171;
  /* 标签色（互动页标准） */
  --tag-blue: #1a3a5c; --tag-blue-text: #5ab4ff;
  --tag-green: #0f3020; --tag-green-text: #4caf82;
  --tag-orange: #3a2000; --tag-orange-text: #ffaa44;
  --tag-red: #3a0f0f; --tag-red-text: #ff6b6b;
  /* 圆角 */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  /* 阴影 */
  --shadow: 0 4px 20px rgba(0,0,0,0.35);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.25);
  /* 字体 */
  --font-sans: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

body.day {
  --bg: #f5f5f5;
  --bg2: #ffffff;
  --bg3: #efefef;
  --border: #ddd;
  --text: #1a1a1a;
  --text2: #666;
  --accent: #c9a961;
  --accent-hover: #b88b4a;
  --accent-text: #2a1a00;
  /* 标签色（日间） */
  --tag-blue: #e8f3ff; --tag-blue-text: #1677ff;
  --tag-green: #f6ffed; --tag-green-text: #389e0d;
  --tag-orange: #fff7e6; --tag-orange-text: #d46b08;
  --tag-red: #fff1f0; --tag-red-text: #f5222d;
}

body.day td { border-bottom: 1px solid #eee; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  font-size: 14px;
}

/* ── 底部固定导航栏 ── */
#bottom-nav {
  flex-shrink: 0;
  display: flex;
  align-items: stretch;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 200;
}
.bnav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 2px 6px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text2);
  font-size: 11px;
  font-family: inherit;
  transition: color 0.15s, background 0.15s;
  min-height: 52px;
}
.bnav-item:hover { background: var(--bg3); color: var(--text); }
.bnav-item.active { color: var(--accent); }
.bnav-item.active .bnav-icon svg { stroke: var(--accent); }
.bnav-icon { width: 20px; height: 20px; line-height: 1; transition: transform 0.15s; display: inline-flex; align-items: center; justify-content: center; }
.bnav-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; }
.bnav-label { font-size: 11px; line-height: 1.2; letter-spacing: 0.5px; }

/* ── 主区域 ── */
#main { flex: 1; display: flex; flex-direction: column; overflow: hidden; transition: margin-left 0.25s ease; }

#topbar {
  height: 52px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 12px; flex-shrink: 0; background: var(--bg);
}
#topbar .brand {
  display: flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 700; color: var(--text); flex-shrink: 0;
}
#topbar #page-title {
  font-size: 14px; font-weight: 500; color: var(--text); margin-left: 10px;
}
#topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
#search-box {
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 12px; color: var(--text); font-size: 13px; width: 200px; outline: none;
}
#search-box::placeholder { color: var(--text2); }
#search-box:focus { border-color: var(--accent); }
#today-date { font-size: 12px; color: var(--text2); }

#workspace { flex: 1; overflow-y: auto; padding: 24px; }
#workspace::-webkit-scrollbar { width: 4px; }
#workspace::-webkit-scrollbar-track { background: transparent; }
#workspace::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* gewe 托管面板激活时 workspace 样式 */
#workspace.gewe-active {
  padding: 0 !important;
  background: var(--bg2) !important;
  overflow-y: auto !important;
}

#workspace.gewe-active #panel-gewe {
  height: calc(100dvh - 70px - 56px);
  overflow-y: auto;
}

.panel { display: none; }
.panel.active { display: block; }

/* ── 通用 Tab 切换 ── */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  background: var(--bg3);
  border-radius: var(--radius-lg);
  padding: 4px;
  width: fit-content;
}
.tabs > div {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius);
  color: var(--text2);
  transition: all 0.15s;
  white-space: nowrap;
}
.tabs > div:hover { color: var(--text); background: var(--bg2); }
.tabs > div.active {
  background: var(--bg2);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ── 胶囊 Tab（互动页标准）：JS 切 class，不再写内联颜色 ──
   激活 = 卡片底 + 主文字色 + 投影（日间=白底深字，夜间=深底亮字，自动适配） */
.tabs > div.tab-on {
  background: var(--bg2);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.tabs > div.tab-on svg { color: var(--accent); }
.tabs > div:not(.tab-on):hover { color: var(--text); background: var(--bg2); }

/* ── 基础按钮系统 ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  color: var(--text);
  background: var(--bg3);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn:hover {
  border-color: #555;
  background: #2a2a3a;
  color: var(--text);
}
.btn:active {
  transform: scale(0.96);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}
.btn-primary:disabled {
  background: #3a3a4a;
  border-color: #3a3a4a;
  color: #6a6a7a;
}

.btn-default {
  background: var(--bg3);
  border-color: var(--border);
  color: var(--text);
}
.btn-default:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: transparent;
  border-color: #4a2020;
  color: var(--error);
}
.btn-danger:hover:not(:disabled) {
  background: #2a0f0f;
  border-color: var(--error);
  color: #fff;
}

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── 卡片 ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 16px; color: var(--text); }

/* ── 表单行（互动页/托管面板同款） ── */
.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* ── 统计条（互动页标准） ── */
.stat-bar { display: flex; gap: 16px; margin-bottom: 16px; }
.stat {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  flex: 1;
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.stat .num { font-size: 28px; font-weight: 600; color: var(--accent); }
.stat .label { font-size: 12px; color: var(--text2); margin-top: 4px; }

/* ── 日志框（互动页标准） ── */
.log-box {
  background: var(--bg3);
  color: var(--text2);
  padding: 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: monospace;
  max-height: 260px;
  overflow-y: auto;
  line-height: 1.7;
  border: 1px solid var(--border);
}
.log-ok { color: var(--success); }
.log-fail { color: var(--error); }
.log-info { color: var(--accent); }
.log-warn { color: var(--warning); }

/* ── 表单项 ── */
.form-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.form-item label {
  font-size: 12px;
  color: var(--text2);
}
.form-item input,
.form-item select,
.form-item textarea {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-item input:focus,
.form-item select:focus,
.form-item textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.15);
}
.form-item input::placeholder,
.form-item textarea::placeholder {
  color: #6a6a7a;
}

/* ── 表格 ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  padding: 10px 14px;
  text-align: left;
  color: var(--text2);
  font-weight: 500;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.5px;
  background: var(--bg3);
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid #1e1e1e;
  color: var(--text);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); }

/* ── 标签 ── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
}
.tag-blue { background: var(--tag-blue); color: var(--tag-blue-text); }
.tag-green { background: var(--tag-green); color: var(--tag-green-text); }
.tag-orange { background: var(--tag-orange); color: var(--tag-orange-text); }
.tag-red { background: var(--tag-red); color: var(--tag-red-text); }

/* ── 统计卡 ── */
.stat-row { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  min-width: 140px;
  flex: 1;
}
.stat-card .num {
  font-size: 28px;
  font-weight: 300;
  color: var(--accent);
}
.stat-card .label {
  font-size: 12px;
  color: var(--text2);
  margin-top: 4px;
}

/* ── 空状态 ── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text2);
  font-size: 13px;
}
.empty .icon {
  font-size: 32px;
  margin-bottom: 12px;
}

/* ── 占位图 ── */
.placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--text2);
  font-size: 13px;
  gap: 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.placeholder .big { font-size: 36px; }

/* ── 模态框 ── */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-mask.hidden { display: none !important; }
.modal-mask:not(.hidden) { display: flex; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  min-width: 400px;
  max-width: 520px;
  box-shadow: var(--shadow);
}

/* 手机端：.modal 类兜底是 min-width:400px，窄屏必然溢出 → 归零 min-width 并钳到视口内 */
@media (max-width: 768px) {
  .modal {
    min-width: 0;
    width: calc(100vw - 24px);
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 18px 16px;
  }
}
.modal-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text);
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ── 工具栏 ── */
.table-wrap { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text2);
}
.table-toolbar strong { color: var(--text); }

/* ── 客情分析 · 圆环图 ── */
#panel-analysis .analysis-chart-card { overflow: visible; }
.analysis-pie-host {
  min-height: 200px;
  padding: 12px 14px 16px;
}
.analysis-pie-host-wide { min-height: 248px; }
.analysis-pie-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 18px 22px;
}
.analysis-pie-chart-wrap {
  position: relative;
  flex-shrink: 0;
  z-index: 0;
  border-radius: 50%;
  padding: 6px;
  background:
    radial-gradient(ellipse 85% 75% at 30% 22%, rgba(255, 255, 255, 0.09) 0%, transparent 55%),
    radial-gradient(circle at 50% 100%, rgba(0, 0, 0, 0.25) 0%, transparent 52%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 4px 24px rgba(0, 0, 0, 0.35),
    0 1px 0 rgba(255, 255, 255, 0.03);
}
body.day .analysis-pie-chart-wrap {
  background:
    radial-gradient(ellipse 85% 75% at 30% 22%, rgba(255, 255, 255, 0.85) 0%, transparent 52%),
    radial-gradient(circle at 50% 100%, rgba(0, 0, 0, 0.06) 0%, transparent 50%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 4px 20px rgba(0, 0, 0, 0.08),
    0 1px 0 rgba(0, 0, 0, 0.04);
}
.analysis-pie-svg {
  display: block;
  shape-rendering: geometricPrecision;
}
.analysis-pie-svg text {
  font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
@keyframes analysis-pie-slice-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.analysis-pie-slice {
  opacity: 0;
  animation: analysis-pie-slice-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transition: filter 0.2s ease;
}
.analysis-pie-slice:hover {
  filter: brightness(1.08) saturate(1.05) drop-shadow(0 4px 14px rgba(0, 0, 0, 0.35));
}
body.day .analysis-pie-slice:hover {
  filter: brightness(1.04) saturate(1.03) drop-shadow(0 3px 10px rgba(0, 0, 0, 0.12));
}
.analysis-pie-center-line1 {
  fill: var(--text);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.analysis-pie-center-line2 {
  fill: var(--text2);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
}
.analysis-pie-empty { padding: 28px 16px !important; }
.analysis-pie-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
  flex: 1 1 168px;
  max-width: 100%;
  font-size: 12px;
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.analysis-pie-legend-item {
  display: grid;
  grid-template-columns: 12px 1fr auto auto;
  align-items: center;
  gap: 8px 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.analysis-pie-legend-item:last-child { border-bottom: none; }
.analysis-pie-legend-item--click {
  border-radius: 6px;
  margin: 0 -4px;
  padding-left: 4px;
  padding-right: 4px;
  transition: background 0.15s ease;
}
.analysis-pie-legend-item--click:hover {
  background: var(--bg3);
}
.analysis-pie-legend-item--click:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.analysis-pie-dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
body.day .analysis-pie-dot { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.analysis-pie-lab {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.analysis-pie-num { color: var(--text2); font-variant-numeric: tabular-nums; }
.analysis-pie-pct {
  color: var(--text2);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: right;
}
@media (prefers-reduced-motion: reduce) {
  .analysis-pie-slice {
    animation: none;
    opacity: 1;
    filter: none;
  }
}

/* ── 登录遮罩 + 毛玻璃 ── */
#login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: opacity 0.35s ease;
}
#login-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}
#login-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px 32px;
  width: 360px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
  animation: loginSlideIn 0.35s ease;
}
@keyframes loginSlideIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
#login-box .login-icon { font-size: 40px; margin-bottom: 12px; }
#login-box h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}
#login-box #login-subtitle {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 24px;
}
#login-form { display: flex; flex-direction: column; gap: 12px; }
#login-form input {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
#login-form input:focus { border-color: var(--accent); }
#login-form input::placeholder { color: var(--text2); }
#login-error { color: var(--error); font-size: 12px; min-height: 18px; }
#login-btn {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: var(--radius);
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
#login-btn:hover:not(:disabled) { background: var(--accent-hover); }
#login-btn:disabled { opacity: 0.5; cursor: not-allowed; }
#login-hint {
  font-size: 11px;
  color: var(--warning);
  margin-top: 12px;
}
.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 38px !important; }
.pwd-eye {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text2);
  cursor: pointer;
  padding: 0;
  line-height: 0;
}
.pwd-eye:hover { color: var(--text); }
.pwd-eye svg { width: 17px; height: 17px; }
body.day #login-btn { background: #111; color: #fff; }
body.day #login-btn:hover { background: #333; }

/* 锁屏时的标题样式 */
#login-overlay .lock-msg {
  font-size: 12px;
  color: var(--text2);
  margin-top: 16px;
}

/* ── 强制改密弹窗 ── */
#force-pwd-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
#force-pwd-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px 32px;
  width: 360px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
  animation: loginSlideIn 0.35s ease;
}
#force-pwd-box .login-icon { font-size: 40px; margin-bottom: 12px; }
#force-pwd-box h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}
#force-pwd-form { display: flex; flex-direction: column; gap: 12px; }
#force-pwd-form input {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
#force-pwd-form input:focus { border-color: var(--accent); }
#force-pwd-form input::placeholder { color: var(--text2); }
#fpwd-error { color: var(--error); font-size: 12px; min-height: 18px; }
#fpwd-btn {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: var(--radius);
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
#fpwd-btn:hover:not(:disabled) { background: var(--accent-hover); }
#fpwd-btn:disabled { opacity: 0.5; cursor: not-allowed; }
body.day #fpwd-btn { background: #111; color: #fff; }
body.day #fpwd-btn:hover { background: #333; }

/* ── 客户列表筛选栏 ── */
.customer-filters {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-label {
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
}
.filter-select {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 8px;
  color: var(--text);
  font-size: 12px;
  outline: none;
  cursor: pointer;
  min-width: 90px;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 24px;
}
.filter-select:focus { border-color: var(--accent); }
.filter-select:hover { border-color: #555; }
.filter-reset-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 12px;
  color: var(--text2);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-reset-btn:hover {
  color: var(--text);
  border-color: #555;
  background: var(--bg3);
}
.filter-select-wide { min-width: 160px; max-width: 260px; text-overflow: ellipsis; }

.filter-text-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 8px;
  color: var(--text);
  font-size: 12px;
  outline: none;
  width: 140px;
  transition: border-color 0.2s;
}
.filter-text-input::placeholder { color: var(--text2); }
.filter-text-input:focus { border-color: var(--accent); }
.filter-text-input:hover { border-color: #555; }

/* 返还提醒：保单号 / 险种列长文本省略（无列宽拖拽） */
#survival-table th:nth-child(2),
#survival-table td:nth-child(2),
#survival-table th:nth-child(3),
#survival-table td:nth-child(3) {
  max-width: 14em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 手机端响应式适配 ── */
@media (max-width: 768px) {
  body { font-size: 14px; }

  #main { width: 100%; }

  #topbar {
    padding: 0 10px;
    gap: 6px;
    height: 48px;
  }
  #topbar #search-box { width: 100px; font-size: 12px; padding: 6px 8px; border-radius: var(--radius); }
  #topbar #today-date { display: none; }
  #topbar-right { gap: 4px; flex-wrap: nowrap; }
  #topbar-right .btn { font-size: 11px; padding: 5px 9px; min-height: 30px; }
  #page-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 80px; }

  #workspace { padding: 10px; }

  /* 内容矩阵：豁免全局 table min-width:600px，三列按百分比贴合屏宽 */
  #weekly-matrix { min-width: 0 !important; table-layout: fixed; }
  #weekly-matrix th, #weekly-matrix td { white-space: normal; }

  .stat-row { gap: 6px; flex-wrap: wrap; }
  .stat-card { min-width: 0; padding: 10px 12px; flex: 1 1 calc(50% - 6px); }
  .stat-card .num { font-size: 20px; }
  .stat-card .label { font-size: 11px; }

  .table-wrap { border-radius: var(--radius); overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; }
  .table-wrap::after {
    content: ''; position: absolute; right: 0; top: 0; bottom: 0; width: 24px; pointer-events: none;
    background: linear-gradient(to right, transparent, var(--bg2));
    opacity: 0.8; transition: opacity 0.3s;
  }
  .table-toolbar { padding: 8px 10px; font-size: 12px; flex-wrap: wrap; gap: 6px; }

  table { min-width: 600px; font-size: 13px; }
  th { padding: 8px 10px; font-size: 12px; white-space: nowrap; }
  td { padding: 8px 10px; white-space: nowrap; }

  .customer-filters { padding: 6px 10px; gap: 6px; flex-wrap: wrap; }
  .filter-text-input { width: 90px; font-size: 12px; }
  .filter-select { min-width: 65px; font-size: 12px; }

  .done-btn, .btn { min-height: 32px; min-width: 32px; padding: 4px 10px; transition: transform 0.1s; }
  .done-btn:active, .btn:active { transform: scale(0.95); opacity: 0.8; }

  /* 好友页 / 互动页 Tab：手机端两行两列四宫格（与发布页 pub-tabs 同款布局） */
  .friends-tabs, .gw-tabs {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100% !important;
    gap: 4px !important;
    box-sizing: border-box;
  }
  .friends-tabs > div, .gw-tabs > div {
    min-width: 0;
    text-align: center;
    padding: 11px 4px !important;
    font-size: 15px !important;
    white-space: nowrap;
  }

  #login-box { width: 90vw; max-width: 340px; padding: 28px 24px 24px; }
  #force-pwd-box { width: 90vw; max-width: 340px; padding: 28px 24px 24px; }
  #chgpwd-modal > div { width: 90vw !important; max-width: 340px; }

  /* 动态创建的 modal（fixed 50% 居中） */
  div[id$="-modal"][style*="position:fixed"] {
    width: 92vw !important;
    max-width: 400px !important;
    top: 5vh !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    max-height: 88vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  #cal-layout { grid-template-columns: 1fr !important; }

  #panel-analysis .analysis-pane > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  .analysis-tab { font-size: 11px; padding: 5px 8px; }

  /* OCR 表单 3列 → 单列 */
  #panel-ocr-scan > div { flex-direction: column !important; }
  #panel-ocr-scan > div > div:first-child { flex: none !important; }
  #ocr-form-section div[style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  #ocr-form-section div[style*="grid-column:span 2"] {
    grid-column: span 1 !important;
  }
  #panel-import > div { max-width: 100% !important; }

  .vip-tab { font-size: 11px; padding: 5px 8px; }

  #survival-filter-bar { padding: 8px 10px; }
  #survival-filter-bar input { width: 100% !important; min-width: 0 !important; max-width: none !important; }

  /* 家庭保障档案紧凑 */
  #customer-family-view table { min-width: 500px; }
  #customer-family-view > div { padding: 12px; }
}

@media (max-width: 480px) {
  table { min-width: 480px; font-size: 12px; }
  th { padding: 6px 8px; font-size: 11px; }
  td { padding: 6px 8px; }
  .stat-card { flex: 1 1 100%; }
  .stat-card .num { font-size: 18px; }
  #topbar #search-box { width: 80px; font-size: 11px; }
  #page-title { max-width: 60px; }
  .done-btn { font-size: 11px; padding: 3px 6px; }
}

/* ── 移动端：输入框字号强制 ≥16px，防止微信/iOS 自动缩放页面 ── */
@media (max-width: 768px) {
  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="date"],
  input[type="search"],
  input[type="tel"],
  textarea,
  select {
    font-size: 16px !important;
  }
}

/* ── AI 助手 ── */
#ai-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 900;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #b88b4a);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s, box-shadow 0.2s;
}
#ai-fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(0, 0, 0, 0.3); }
#ai-fab:active { transform: scale(0.95); }

#ai-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 96px;
  z-index: 950;
  width: 420px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
  animation: aiSlideUp 0.25s ease-out;
}
@keyframes aiSlideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

#ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
  flex-shrink: 0;
}
.ai-header-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 14px;
  transition: all 0.15s;
}
.ai-header-btn:hover { background: var(--bg2); color: var(--text); }

#ai-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#ai-chat-body::-webkit-scrollbar { width: 4px; }
#ai-chat-body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.ai-bubble {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.7;
  word-break: break-word;
}
.ai-bubble-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), #b88b4a);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-bubble-assistant {
  align-self: flex-start;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.ai-bubble-assistant table { width: 100%; margin: 8px 0; border-collapse: collapse; font-size: 12px; }
.ai-bubble-assistant th, .ai-bubble-assistant td { padding: 4px 8px; border: 1px solid var(--border); text-align: left; }
.ai-bubble-assistant th { background: var(--bg2); font-weight: 600; }
.ai-bubble-assistant p { margin: 4px 0; }
.ai-bubble-assistant ul, .ai-bubble-assistant ol { padding-left: 18px; margin: 4px 0; }
.ai-bubble-assistant code { background: var(--bg2); padding: 1px 5px; border-radius: 3px; font-size: 12px; }
.ai-bubble-assistant strong { color: var(--accent); }

.ai-progress { color: var(--text2); font-size: 12px; }

.ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text2);
  font-size: 13px;
}
.ai-typing::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text2);
  animation: aiDot 1s infinite;
}
@keyframes aiDot { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }

#ai-chat-footer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg3);
  flex-shrink: 0;
}
#ai-input {
  flex: 1;
  min-height: 42px;
  max-height: 120px;
  resize: none;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  line-height: 1.5;
  transition: border-color 0.2s;
}
#ai-input:focus { border-color: var(--accent); }
#ai-input::placeholder { color: var(--text2); }

#ai-send-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent), #b88b4a);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, opacity 0.2s;
}
#ai-send-btn:hover { transform: scale(1.05); }
#ai-send-btn:active { transform: scale(0.95); }

#ai-stop-btn {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: #e74c3c;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
  animation: aiPulse 1.5s infinite;
}
#ai-stop-btn:hover { transform: scale(1.05); background: #c0392b; }
#ai-stop-btn:active { transform: scale(0.95); }
@keyframes aiPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(231,76,60,0.4); } 50% { box-shadow: 0 0 0 8px rgba(231,76,60,0); } }

@media (max-width: 768px) {
  #ai-fab { right: 16px; bottom: 16px; width: 48px; height: 48px; }
  #ai-fab svg { width: 20px; height: 20px; }
  #ai-chat-panel { right: 8px; bottom: 76px; left: 8px; width: auto; height: calc(100vh - 100px); border-radius: var(--radius); }
}

/* Global modal hidden rule */
.modal-mask.hidden { display: none !important; }
.modal-mask { display: none; }
.modal-mask:not(.hidden) { display: flex; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; align-items: center; justify-content: center; }

.done-btn { background: none; border: 1px solid var(--border); color: var(--text2); padding: 3px 10px; border-radius: 4px; font-size: 11px; cursor: pointer; }
.done-btn:hover { border-color: var(--tag-green-text); color: var(--tag-green-text); }
.editable-cell { cursor: pointer; transition: background .15s; }
.editable-cell:hover { background: var(--bg3); outline: 1px dashed var(--border); outline-offset: -1px; }
.btn-paid { background: #1a3a2a; color: #4ade80; border-color: #2d5a3d; }
body.day .btn-paid { background: #d4f5e5; color: #1a7a4a; border-color: #1a7a4a; }
.editable-cell { cursor: pointer; }
.editable-cell:hover { background: var(--bg3); border-radius: 4px; }
.resizable-th { position: relative; }
.col-resizer { position: absolute; right: 0; top: 0; width: 6px; height: 100%; cursor: col-resize; user-select: none; z-index: 1; }
.col-resizer:hover, .col-resizer.dragging { background: var(--primary); opacity: 0.5; }

.empty { text-align: center; padding: 60px 20px; color: var(--text2); font-size: 13px; }
.empty .icon { font-size: 32px; margin-bottom: 12px; }

.placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 300px; color: var(--text2); font-size: 13px; gap: 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; }
.placeholder .big { font-size: 36px; }

/* ── Toast（全局版：容器在 workspace 内、panel 外，#panel-gewe 前缀选择器够不到） ── */
.toast-container {
  position: fixed;
  top: 70px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  animation: toastIn 0.2s ease;
  min-width: 240px;
  color: var(--text);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--error); }
.toast-info { border-left: 4px solid var(--accent); }

