/* ============================================
   BEISAX 佰赛思 - 管理后台样式
   ============================================ */

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

:root {
  --navy: #0b2447;
  --primary: #0a84ff;
  --primary-dark: #0050b3;
  --danger: #e5493a;
  --ok: #0a9a8d;
  --text: #1c1f26;
  --text-light: #5f6b7a;
  --bg: #f3f5f9;
  --white: #ffffff;
  --border: #e3e7ee;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(11, 36, 71, .08);
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ---------- 通用控件 ---------- */
.btn {
  display: inline-block;
  padding: 9px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  transition: all .2s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #c93a2c; color: #fff; }
.btn-ghost { background: #f0f4fa; border-color: var(--border); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: var(--white);
  outline: none;
  transition: border .2s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10,132,255,.12); }
textarea.input { resize: vertical; min-height: 60px; }
.input-color {
  width: 100%;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  cursor: pointer;
}
.input-file { display: block; margin: 10px 0; font-size: 13px; }

/* ---------- 通用控件 ---------- */
.page-actions { display: flex; gap: 10px; align-items: center; }
.page-hint {
  font-size: 12.5px;
  color: var(--text-light);
  background: #eef5ff;
  border-radius: 8px;
  padding: 8px 14px;
  margin-bottom: 16px;
}
.field-hint { font-size: 12px; color: var(--text-light); margin-top: 4px; }
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* 状态徽标 */
.state-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.state-on { background: #ddf6f3; color: #0a9a8d; }
.state-off { background: #f0f3f8; color: var(--text-light); }

/* 排序按钮 */
.sort-btns { display: inline-flex; gap: 4px; }
.sort-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-light);
  font-size: 13px;
  line-height: 1;
  transition: all .2s;
}
.sort-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.sort-btn:disabled { opacity: .3; cursor: not-allowed; }

/* 行状态 */
tr.row-off td { opacity: .55; }
tr.row-off .td-title { text-decoration: line-through; }

/* 启用开关 */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  cursor: pointer;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute;
  inset: 0;
  background: #ccd3dd;
  border-radius: 11px;
  transition: background .25s;
}
.switch .slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .25s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ---------- 图标选择器 ---------- */
.icon-picker {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.icon-option {
  aspect-ratio: 1;
  border: 2px solid var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  cursor: pointer;
  transition: all .2s;
  background: #fafbfd;
}
.icon-option svg { width: 22px; height: 22px; }
.icon-option:hover { border-color: var(--primary); color: var(--primary); }
.icon-option.active {
  border-color: var(--primary);
  background: #eef6ff;
  color: var(--primary);
  box-shadow: 0 0 0 3px rgba(10,132,255,.15);
}

/* ---------- 公告列表 ---------- */
.notice-list { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.notice-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
}
.notice-card .nc-main { flex: 1; min-width: 0; }
.notice-card .nc-title {
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 10px;
}
.notice-card .nc-date { font-size: 12px; color: var(--text-light); font-weight: 400; }
.notice-card .nc-content {
  font-size: 13px;
  color: var(--text-light);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.notice-card.off .nc-title, .notice-card.off .nc-content { opacity: .5; }

/* ---------- 图片管理 ---------- */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.image-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow);
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  border: 2px solid transparent;
}
.image-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.image-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  background: #f0f3f8;
}
.image-card .ic-name {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 8px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.image-card .ic-size { font-size: 11px; color: var(--text-lighter, #9aa5b5); }
.image-card .ic-del {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-light);
  padding: 3px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all .2s;
}
.image-card .ic-del:hover { border-color: var(--danger); color: var(--danger); }

/* ---------- 仪表盘：趋势图 + 排行 ---------- */
.dash-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}
.trend-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 180px;
  padding: 10px 6px 0;
  border-bottom: 1px solid var(--border);
}
.trend-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  height: 100%;
  min-width: 0;
}
.trend-col .tc-bars {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}
.trend-col .bar {
  width: 14px;
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height .4s;
}
.bar.pv { background: linear-gradient(180deg, #0a84ff, #5cabff); }
.bar.click { background: linear-gradient(180deg, #ff9a44, #ffb36e); }
.trend-col .tc-day { font-size: 11px; color: var(--text-light); }
.trend-col .tc-val { font-size: 10.5px; color: var(--text-light); }
.chart-note { font-size: 12px; color: var(--text-light); margin-top: 8px; }
.click-rank { display: flex; flex-direction: column; gap: 6px; }
.rank-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}
.rank-item .rk-no {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: #f0f3f8;
  color: var(--text-light);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rank-item:nth-child(-n+3) .rk-no { background: #ffe9d6; color: #f07700; }
.rank-item .rk-name {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text);
}
.rank-item .rk-count {
  font-weight: 700;
  color: var(--navy);
  flex-shrink: 0;
}
.rank-empty { color: var(--text-light); font-size: 13px; padding: 20px 0; text-align: center; }

/* ---------- 图床链接 ---------- */
.image-card.remote { border-style: dashed; }
.image-card .remote-badge {
  display: inline-block;
  font-size: 10px;
  color: #fff;
  background: linear-gradient(135deg, #0a84ff, #00b3a4);
  padding: 1px 8px;
  border-radius: 8px;
  margin-top: 4px;
}

/* ---------- 附件列表 ---------- */
.file-list { display: flex; flex-direction: column; gap: 6px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: #f7f9fc;
  border-radius: 8px;
  font-size: 13px;
}
.file-item .fi-icon { font-size: 18px; }
.file-item .fi-name {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text);
}
.file-item .fi-size { color: var(--text-light); font-size: 12px; flex-shrink: 0; }
.file-item .fi-del {
  color: var(--text-light);
  font-size: 12.5px;
  border: 1px solid var(--border);
  padding: 2px 10px;
  border-radius: 6px;
  flex-shrink: 0;
  transition: all .2s;
}
.file-item .fi-del:hover { border-color: var(--danger); color: var(--danger); }
.file-empty { color: var(--text-lighter, #9aa5b5); font-size: 12.5px; }

/* ---------- 购买链接编辑器 ---------- */
.buylink-add {
  display: grid;
  grid-template-columns: 110px 1fr 1.4fr auto;
  gap: 8px;
  margin-top: 8px;
}
.bl-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  background: var(--p-color, #0a84ff);
  flex-shrink: 0;
}
.bl-chip.plain { background: #eef2f8; color: var(--text-light); }

/* ---------- 多语言输入 ---------- */
.ml-inputs { display: flex; flex-direction: column; gap: 6px; }
.ml-input {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.ml-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 0 8px;
  background: var(--navy);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 8px 0 0 8px;
  letter-spacing: .5px;
}
.ml-input .input { border-radius: 0 8px 8px 0; }
.lang-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.lang-check {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
  user-select: none;
}
.lang-check:hover { border-color: var(--primary); }
.lang-check.on { border-color: var(--primary); background: #eef6ff; color: var(--primary-dark); font-weight: 600; }
.lang-check input { accent-color: var(--primary); }

/* ---------- AI 助手 ---------- */
.ai-log {
  margin-top: 14px;
  background: #0b2447;
  border-radius: 10px;
  padding: 12px 14px;
  max-height: 260px;
  overflow-y: auto;
  font-size: 12.5px;
  line-height: 1.8;
  color: #9fd0ff;
  font-family: Consolas, Monaco, monospace;
  white-space: pre-wrap;
  word-break: break-all;
}
.ai-log .log-ok { color: #7ce7b9; }
.ai-log .log-err { color: #ff9a8a; }
.ai-log .log-info { color: #9fd0ff; }
.ai-status-on {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 12px;
  background: #ddf6f3;
  color: #0a9a8d;
  font-size: 12.5px;
  font-weight: 700;
}
.ai-status-off {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 12px;
  background: #ffe9e7;
  color: #e5493a;
  font-size: 12.5px;
  font-weight: 700;
}
.ai-preview {
  margin-top: 14px;
  background: #f7f9fc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-all;
  display: none;
}
.ai-preview.show { display: block; }
.ai-preview .pv-title { font-weight: 700; color: var(--navy); }
.ai-preview .pv-label { color: var(--text-light); font-size: 12px; margin-top: 6px; }

/* AI 高级配置折叠区 */
.ai-advanced {
  margin-top: 14px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0 14px;
  background: #fafbfd;
}
.ai-advanced summary {
  cursor: pointer;
  padding: 12px 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-light);
  user-select: none;
}
.ai-advanced summary:hover { color: var(--primary); }
.ai-advanced[open] { padding-bottom: 14px; }

/* ---------- 备份列表 ---------- */
.backup-list { display: flex; flex-direction: column; gap: 8px; }
.backup-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #f7f9fc;
  border-radius: 8px;
  font-size: 13px;
}
.backup-item .bi-name { font-weight: 600; color: var(--navy); }
.backup-item .bi-time { color: var(--text-light); font-size: 12px; }
.backup-item .bi-size { color: var(--text-light); font-size: 12px; }
.backup-item .bi-restore {
  margin-left: auto;
  padding: 4px 14px;
  font-size: 12.5px;
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 6px;
  transition: all .2s;
}
.backup-item .bi-restore:hover { background: var(--primary); color: #fff; }
.backup-empty { color: var(--text-light); font-size: 13px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  padding: 11px 26px;
  background: rgba(11, 36, 71, .93);
  color: #fff;
  font-size: 14px;
  border-radius: 10px;
  z-index: 9999;
  opacity: 0;
  transition: all .3s;
  pointer-events: none;
  box-shadow: 0 12px 32px rgba(0,0,0,.25);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: rgba(10, 154, 141, .95); }
.toast.err { background: rgba(229, 73, 58, .95); }

/* ---------- 登录页 ---------- */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0b2447 0%, #0d3a6e 55%, #0a84ff 130%);
  padding: 20px;
}
.login-card {
  width: 380px;
  background: var(--white);
  border-radius: 18px;
  padding: 40px 36px;
  box-shadow: 0 24px 60px rgba(0,0,0,.3);
  text-align: center;
}
.login-logo { margin-bottom: 14px; }
.login-card h1 { font-size: 22px; color: var(--navy); margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--text-light); margin-bottom: 28px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-hint {
  font-size: 12px;
  color: var(--text-lighter, #9aa5b5);
  margin-top: 4px;
}
.login-err {
  color: var(--danger);
  font-size: 13px;
  min-height: 20px;
  margin-top: 12px;
}

/* ---------- 主界面布局 ---------- */
.main-view {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 220px;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 800;
}
/* 移动端底部导航（默认隐藏，≤900px 显示） */
.mobile-tabbar { display: none; }
/* 移动端铃铛（≤900px 显示，固定右上角） */
.mob-bell {
  display: none;
  position: fixed;
  top: calc(10px + env(safe-area-inset-top, 0px));
  right: 14px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--white);
  font-size: 19px;
  box-shadow: 0 6px 16px rgba(11, 36, 71, .15);
  z-index: 950;
  cursor: pointer;
}
.mob-bell-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: #e5493a;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.side-name { font-size: 16px; font-weight: 700; letter-spacing: .5px; }
.side-sub { font-size: 11px; color: rgba(255,255,255,.55); }
.side-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.side-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,.8);
  font-size: 14px;
  transition: all .2s;
}
.side-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.side-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.side-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-direction: column; gap: 8px; }
.side-link {
  color: rgba(255,255,255,.65);
  font-size: 13px;
  background: none;
  border: none;
  text-align: left;
  padding: 4px 6px;
  transition: color .2s;
}
.side-link:hover { color: #fff; }
.side-link.danger:hover { color: #ff8a80; }

.content {
  flex: 1;
  margin-left: 220px;
  padding: 28px 32px 60px;
}
.page-title { font-size: 22px; font-weight: 800; color: var(--navy); margin-bottom: 20px; }
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.page-head .page-title { margin-bottom: 0; }

/* ---------- 仪表盘 ---------- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}
.stat-card.clickable {
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  position: relative;
}
.stat-card.clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(11, 36, 71, .12);
}
.stat-card.clickable::after {
  content: '查看 →';
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 11px;
  color: var(--primary);
  opacity: 0;
  transition: opacity .15s;
}
.stat-card.clickable:hover::after { opacity: 1; }
.stat-card .num { font-size: 30px; font-weight: 800; color: var(--navy); }
.stat-card .label { font-size: 13px; color: var(--text-light); margin-top: 2px; }
.dash-panel {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.dash-panel h3 { font-size: 15px; margin-bottom: 12px; }
.h3-sub { font-size: 11.5px; font-weight: 400; color: var(--text-light); margin-left: 6px; }
.trend-col.clickable { cursor: pointer; }
.trend-col.clickable:hover .tc-bars .bar { filter: brightness(1.15); }
.rank-item.clickable { cursor: pointer; border-radius: 6px; padding: 3px 6px; margin: 0 -6px; transition: background .15s; }
.rank-item.clickable:hover { background: #f4f8ff; }

/* ---------- 仪表盘：AI 分析 ---------- */
.ai-analyze-panel { margin-bottom: 18px; }
.ai-analyze-actions { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.ai-analyze-result {
  max-height: 460px;
  overflow: auto;
  background: #f7f9fc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.ai-analyze-result.loading {
  color: var(--text-light);
  font-style: italic;
}
.ai-analyze-result:empty { display: none; }
.ai-analyze-result h4 {
  font-size: 14px;
  color: var(--navy);
  margin: 14px 0 6px;
}
.ai-analyze-result h4:first-child { margin-top: 0; }
.ai-analyze-result ul { padding-left: 20px; margin: 4px 0; }
.ai-analyze-result li { margin: 3px 0; }
.ai-analyze-result b { color: var(--navy); }
.ai-analyze-result .ai-note { font-size: 12px; color: var(--text-light); margin-top: 10px; border-top: 1px dashed var(--border); padding-top: 8px; }
.dash-tips { list-style: none; }
.dash-tips li {
  padding: 7px 0;
  font-size: 13.5px;
  color: var(--text-light);
  border-bottom: 1px dashed var(--border);
}
.dash-tips li:last-child { border-bottom: none; }
.dash-tips code {
  background: #eef2f8;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--primary-dark);
}

/* ---------- 表格 ---------- */
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
.toolbar .input { max-width: 260px; }
.toolbar-count { font-size: 13px; color: var(--text-light); margin-left: auto; }
.table-wrap {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
  max-height: 66vh;
}
.table { width: 100%; border-collapse: collapse; min-width: 760px; }
.table th {
  text-align: left;
  padding: 12px 14px;
  background: #f7f9fc;
  font-size: 12.5px;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  vertical-align: middle;
}
.table tr:hover td { background: #fafcff; }
.td-img {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 8px;
  background: #f0f3f8;
}
.td-title {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.badge-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.badge-chip.hot { background: #ffe9e7; color: #e5493a; }
.badge-chip.new { background: #ddf6f3; color: #0a9a8d; }
.badge-chip.sale { background: #fff0df; color: #f07700; }
.badge-chip.none { background: #f0f3f8; color: var(--text-light); }
.cat-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  background: #eaf2ff;
  color: var(--primary-dark);
}
.op-btn {
  padding: 4px 12px;
  font-size: 12.5px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-light);
  margin-right: 6px;
  transition: all .2s;
}
.op-btn.edit:hover { border-color: var(--primary); color: var(--primary); }
.op-btn.del:hover { border-color: var(--danger); color: var(--danger); }
.empty-row td { text-align: center; padding: 40px; color: var(--text-light); }

/* ---------- 轮播卡片 ---------- */
.slide-list { display: flex; flex-direction: column; gap: 14px; }
.slide-card {
  display: flex;
  gap: 16px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
  align-items: center;
}
.slide-preview {
  width: 240px;
  height: 90px;
  border-radius: 10px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  color: #fff;
  overflow: hidden;
  position: relative;
}
.slide-preview img {
  height: 72px;
  width: 72px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.3));
}
.slide-preview .sp-text { flex: 1; min-width: 0; }
.slide-preview .sp-title {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slide-preview .sp-kicker {
  font-size: 11px;
  opacity: .8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slide-info { flex: 1; min-width: 0; }
.slide-info .si-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.slide-info .si-desc {
  font-size: 12.5px;
  color: var(--text-light);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.slide-actions { flex-shrink: 0; }
.slide-card.off { opacity: .55; }
.slide-card.off .slide-preview { filter: grayscale(.6); }

/* ---------- 表单卡片 ---------- */
.form-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  max-width: 640px;
}
.form-card h3 { font-size: 15px; margin-bottom: 16px; color: var(--navy); }
.card-desc { font-size: 13px; color: var(--text-light); margin-bottom: 14px; }

/* ---------- 网站信息：favicon / og 图 ---------- */
.favicon-row { display: flex; align-items: flex-start; gap: 14px; }
.favicon-preview {
  width: 64px; height: 64px; flex: 0 0 64px;
  border: 1px dashed var(--border); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: #fff;
}
.favicon-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.favicon-preview.og-preview { width: 120px; height: 68px; flex-basis: 120px; border-radius: 8px; }
.favicon-inputs { flex: 1; min-width: 0; }
.favicon-url-row { display: flex; gap: 8px; }
.favicon-url-row .input { flex: 1; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-input {
  width: 44px; height: 38px; flex: 0 0 44px;
  padding: 2px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; cursor: pointer;
}
.code-input { font-family: Consolas, Menlo, monospace; font-size: 12.5px; line-height: 1.6; }
.form-row { margin-bottom: 14px; }
.form-row label {
  display: block;
  font-size: 12.5px;
  color: var(--text-light);
  margin-bottom: 6px;
  font-weight: 600;
}
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.form-actions { display: flex; align-items: center; gap: 16px; }
.save-tip { font-size: 13px; color: var(--ok); }

.img-picker { display: flex; gap: 14px; align-items: flex-start; }
.img-preview {
  width: 120px;
  height: 120px;
  border-radius: 10px;
  background: #f0f3f8;
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 12px;
  overflow: hidden;
  flex-shrink: 0;
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-actions { flex: 1; display: flex; flex-direction: column; gap: 8px; }

.danger-card { border: 1px solid rgba(229,73,58,.25); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(11, 36, 71, .5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--white);
  border-radius: 16px;
  width: 640px;
  max-width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,.3);
}
.modal-sm { width: 400px; }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; }
.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: #f0f3f8;
  font-size: 18px;
  color: var(--text-light);
  transition: all .2s;
}
.modal-close:hover { background: #ffe9e7; color: var(--danger); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}
.modal-foot .btn-danger { margin-right: auto; }
.confirm-text { font-size: 14px; line-height: 1.8; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .sidebar { display: none; }           /* 侧边栏隐藏，改用底部导航 */
  .content { margin-left: 0; padding: 16px 14px 90px; }
  /* 仅登录后显示底部导航和铃铛 */
  body.logged-in .mob-bell { display: flex; align-items: center; justify-content: center; }
  body.logged-in .mobile-tabbar { display: flex; }
  /* 移动端底部导航 */
  .mobile-tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 64px;
    background: var(--white);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(11, 36, 71, .08);
    z-index: 900;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .mob-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: none;
    background: transparent;
    font-size: 18px;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px 0;
    transition: color .2s;
  }
  .mob-tab span { font-size: 10.5px; }
  .mob-tab.active { color: var(--primary); }
  .mob-tab:active { background: #f2f7ff; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .form-row-2, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
  .slide-card { flex-direction: column; align-items: stretch; }
  .slide-preview { width: 100%; }
}

/* ---------- 后台移动端（≤640px） ---------- */
@media (max-width: 640px) {
  .content { margin-left: 0; padding: 14px 10px 90px; min-width: 0; max-width: 100%; overflow-x: hidden; }
  .page-title { font-size: 18px; }
  .page-head { flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
  .page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  /* 消息盒子移动端：全屏化 */
  .msg-box {
    top: 0;
    right: 0;
    left: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  .page-actions .btn { padding: 8px 12px; font-size: 12.5px; }
  .stat-cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .num { font-size: 24px; }
  .stat-card .label { font-size: 11.5px; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-panel { padding: 16px; }
  .trend-chart { height: 150px; }
  /* 表格横向滚动 + 紧凑 */
  .table-wrap { max-height: none; -webkit-overflow-scrolling: touch; }
  .table-wrap table { min-width: 560px; }
  .table-wrap th, .table-wrap td { padding: 8px 10px; font-size: 12px; }
  /* 弹窗全屏化 */
  .modal-mask { padding: 0; }
  .modal { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
  .modal-body { padding: 14px; }
  .modal-header { padding: 12px 14px; }
  .modal-header h3 { font-size: 15px; }
  .form-card { padding: 16px; }
  .form-card h3 { font-size: 14px; }
  .btn { padding: 8px 14px; font-size: 13px; }
  .input { font-size: 14px; padding: 9px 10px; }
  /* 工具栏换行 */
  .toolbar { flex-wrap: wrap; gap: 8px; }
  .toolbar .input { flex: 1 1 auto; min-width: 100px; }
  /* 分类/公告列表卡片化 */
  .nc-item, .slide-item { padding: 12px; }
  /* AI 面板 */
  .ai-analyze-result { font-size: 12.5px; padding: 12px; }
  .favicon-row { flex-direction: column; }
  .favicon-url-row { flex-wrap: wrap; }
  .favicon-url-row .input { flex: 1 1 100%; }
  /* 登录页 */
  .login-card { width: calc(100vw - 40px); padding: 26px 22px; }
  /* 确认框跟随 modal 全屏规则 */
}

/* ---------- 消息盒子 ---------- */
.bell-link { position: relative; display: flex; align-items: center; justify-content: space-between; width: 100%; }
.bell-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #e5493a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.msg-box {
  position: fixed;
  top: 60px;
  right: 24px;
  width: 460px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 100px);
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(11, 36, 71, .22);
  z-index: 1001;           /* 必须高于 modal-mask(1000)，否则被遮罩盖住 */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: msgIn .28s cubic-bezier(.22, .9, .3, 1);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(-12px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.msg-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.msg-box-head h3 { font-size: 16px; color: var(--navy); margin: 0; }
.msg-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px 0;
}
.msg-tab {
  flex: 1;
  padding: 9px 0;
  border: none;
  background: transparent;
  border-radius: 10px 10px 0 0;
  font-size: 13.5px;
  color: var(--text-light);
  cursor: pointer;
  position: relative;
  transition: all .2s;
}
.msg-tab.active { background: #f2f7ff; color: var(--primary); font-weight: 700; }
.msg-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #e5493a;
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  vertical-align: middle;
  margin-left: 2px;
}
.msg-box-body {
  flex: 1;
  min-height: 0;           /* flex 子项可收缩，否则内容撑破容器无法滚动 */
  overflow-y: auto;
  padding: 14px 16px;
}
.msg-pane { display: none; }
.msg-pane.active { display: block; }
.msg-box-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.task-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: #fbfcfe;
  transition: border-color .2s;
}
.task-item.running { border-color: #0a84ff; background: #f4f9ff; }
.task-item.done { border-color: #d6f0dd; }
.task-item.failed { border-color: #ffd8d4; background: #fff7f6; }
.task-item.queued { border-color: #f0e3c8; }
.task-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.task-type { font-weight: 700; color: var(--navy); font-size: 13.5px; }
.task-status { font-size: 11px; padding: 2px 10px; border-radius: 10px; font-weight: 600; }
.task-status.queued { background: #fdf3dd; color: #b07d1f; }
.task-status.running { background: #e3f2ff; color: #0a6fd1; }
.task-status.done { background: #e1f6e7; color: #1e8e4a; }
.task-status.failed { background: #ffe9e7; color: #e5493a; }
.task-meta { font-size: 11.5px; color: var(--text-light); }
.task-progress { margin: 8px 0 4px; }
.task-bar {
  height: 6px;
  background: #eef1f6;
  border-radius: 3px;
  overflow: hidden;
}
.task-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #0a84ff, #5cabff);
  border-radius: 3px;
  transition: width .5s;
}
.task-bar-fill.done { background: linear-gradient(90deg, #2ea043, #57c46c); }
.task-bar-fill.failed { background: #e5493a; }
.task-log-preview {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-actions { margin-top: 8px; display: flex; gap: 8px; }
.task-actions .btn { padding: 5px 12px; font-size: 12px; }
.msg-item {
  display: flex;
  gap: 10px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .2s;
  border-radius: 8px;
}
.msg-item:hover { background: #f6f9fd; }
.msg-item.unread { background: #f0f7ff; }
.msg-icon { font-size: 20px; flex-shrink: 0; }
.msg-body { flex: 1; min-width: 0; }
.msg-title { font-size: 13.5px; font-weight: 600; color: var(--navy); }
.msg-content { font-size: 12.5px; color: var(--text-light); margin-top: 3px; }
.msg-time { font-size: 11px; color: var(--text-lighter); margin-top: 4px; }
.msg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e5493a;
  flex-shrink: 0;
  margin-top: 6px;
}
.msg-empty { text-align: center; color: var(--text-light); padding: 40px 0; font-size: 13px; }
.log-line {
  font-family: Consolas, Menlo, monospace;
  font-size: 12px;
  line-height: 1.8;
  padding: 3px 0;
  border-bottom: 1px dashed #f0f2f6;
  word-break: break-all;
}
.log-line .log-time { color: var(--text-lighter); margin-right: 8px; }
.log-line.log-ok { color: #1e8e4a; }
.log-line.log-err { color: #e5493a; }
.log-line.log-info { color: var(--text); }
.log-select { width: 100%; margin-bottom: 10px; }
.log-select-title { font-size: 12px; color: var(--text-light); margin-bottom: 6px; }
.msg-preview {
  background: #f7f9fc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 8px;
}
.msg-preview .pv-title { font-weight: 700; color: var(--navy); font-size: 13px; }
.msg-preview .pv-body { font-size: 12.5px; color: var(--text); margin-top: 4px; line-height: 1.7; }
.msg-preview-actions { margin-top: 10px; display: flex; gap: 8px; }

/* 图标在名称前内联显示（仅移动端卡片模式显示，桌面端隐藏避免重复）
   注意：此规则必须在 640px 媒体查询之前定义 */
.cat-icon-inline { display: none; }
/* ---------- 移动端覆盖（放末尾确保优先于基础样式） ---------- */
@media (max-width: 640px) {
  /* 消息盒子全屏化 */
  .msg-box {
    top: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
  }
  /* 分类表格卡片化：行变卡片，名称完整横排（避免窄列竖排） */
  .table-wrap table#catTable { min-width: 0; }
  .table-wrap thead#catHead { display: none; }
  .table-wrap tbody#catTableBody { display: grid; gap: 10px; }
  .table-wrap tbody#catTableBody tr {
    display: grid;
    grid-template-columns: auto auto auto 1fr;
    gap: 6px 10px;
    align-items: center;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: var(--shadow-sm);
  }
  .table-wrap tbody#catTableBody tr.empty-row { text-align: center; }
  /* 名称行：图标 + 名称 + 描述 横排，占满第一行 */
  .table-wrap tbody#catTableBody td[data-label="名称"] {
    grid-column: 1 / -1;
    grid-row: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 8px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #eef1f6;
    margin-bottom: 8px;
  }
  .table-wrap tbody#catTableBody td[data-label="名称"] .cat-icon-inline { display: inline-flex; align-items: center; }
  .table-wrap tbody#catTableBody td[data-label="名称"] b { font-size: 14px; }
  .table-wrap tbody#catTableBody td[data-label="名称"] br { display: none; }
  .table-wrap tbody#catTableBody td[data-label="名称"] span[style] { display: inline-block; }
  /* 隐藏手机端冗余的图标/标识列 */
  .table-wrap tbody#catTableBody td[data-label="图标"] { display: none; }
  .table-wrap tbody#catTableBody td[data-label="标识"] { display: none; }
  /* 第二行：排序 | 状态 | 商品数 | 操作（4 列 grid） */
  .table-wrap tbody#catTableBody tr > td:not([data-label="名称"]):not([data-label="图标"]):not([data-label="标识"]) {
    grid-row: 2;
    display: flex;
    align-items: center;
    font-size: 12px;
    color: var(--text-light);
    white-space: nowrap;
  }
  .table-wrap tbody#catTableBody td[data-label="排序"] { grid-column: 1; }
  .table-wrap tbody#catTableBody td[data-label="状态"] { grid-column: 2; color: var(--text); }
  .table-wrap tbody#catTableBody td[data-label="商品"] { grid-column: 3; }
  .table-wrap tbody#catTableBody td:last-child { grid-column: 4; justify-self: end; }
  .table-wrap tbody#catTableBody td[data-label="排序"] .sort-btns { gap: 4px; }
  .table-wrap tbody#catTableBody td[data-label="排序"] .sort-btn { width: 24px; height: 24px; }
  .table-wrap tbody#catTableBody td:last-child .op-btn { padding: 4px 8px; font-size: 11.5px; }
  .table-wrap tbody#catTableBody td::before { display: none; }
}
