/* wxmp 全局样式 — 红白商务风 */
:root {
  --red: #DC2626;
  --red-hover: #b91c1c;
  --red-light: #fef2f2;
  --red-border: #fecaca;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --green: #059669;
  --green-light: #ecfdf5;
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 220px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  font-size: 14px;
  height: 100vh;
  overflow: hidden;
}

/* ─── 布局 ─── */
.layout { display: flex; height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
}

.sidebar .logo {
  padding: 20px;
  font-size: 18px;
  font-weight: 700;
  color: var(--red);
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  user-select: none;
}
.sidebar .logo span { color: var(--gray-900); font-weight: 500; }

.sidebar nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--gray-500); text-decoration: none; font-size: 14px;
  cursor: pointer; transition: all 0.15s; margin-bottom: 2px;
}
.sidebar nav a:hover { background: var(--red-light); color: var(--red); }
.sidebar nav a.active { background: var(--red-light); color: var(--red); font-weight: 600; }
.sidebar nav a .ico { font-size: 16px; width: 20px; text-align: center; }

.sidebar .user {
  padding: 16px; border-top: 1px solid var(--gray-100);
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--gray-500);
}
.sidebar .user .av {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--red); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}

.main { flex: 1; overflow-y: auto; padding: 28px 32px; }
.main section { display: none; }
.main section.active { display: block; }

.page-title { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.page-sub { font-size: 14px; color: var(--gray-400); margin-bottom: 24px; }

/* ─── 卡片 ─── */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff; border-radius: var(--radius);
  padding: 20px; border: 1px solid var(--gray-100);
  transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.stat-card .s-label { font-size: 13px; color: var(--gray-400); margin-bottom: 6px; }
.stat-card .s-val { font-size: 28px; font-weight: 700; }
.stat-card .s-sub { font-size: 12px; color: var(--gray-400); margin-top: 4px; }
.stat-card.hl { border-left: 3px solid var(--red); }

.card {
  background: #fff; border-radius: var(--radius);
  border: 1px solid var(--gray-100); padding: 20px; margin-bottom: 16px;
}
.card-flush {
  background: #fff; border-radius: var(--radius);
  border: 1px solid var(--gray-100); margin-bottom: 16px; overflow: hidden;
}
.sec-title { font-size: 15px; font-weight: 600; color: var(--gray-700); margin-bottom: 12px; }

/* ─── 按钮 ─── */
.btn {
  padding: 8px 20px; border-radius: var(--radius-sm); font-size: 14px;
  cursor: pointer; border: none; font-family: inherit; font-weight: 500;
  transition: all 0.15s; display: inline-flex; align-items: center; gap: 6px;
}
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-hover); }
.btn-out { background: #fff; color: var(--red); border: 1px solid var(--red-border); }
.btn-out:hover { background: var(--red-light); }
.btn-ghost { background: transparent; color: var(--gray-500); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-sm { padding: 5px 14px; font-size: 13px; }
.btn-xs { padding: 3px 10px; font-size: 12px; }

/* ─── 标签 ─── */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500;
}
.badge-red { background: var(--red-light); color: var(--red); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-gray { background: var(--gray-100); color: var(--gray-500); }

/* ─── 表格 ─── */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; padding: 10px 16px; font-size: 12px; font-weight: 600;
  color: var(--gray-400); text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--gray-100);
}
.tbl td { padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--gray-50); }
.tbl tr:hover td { background: var(--gray-50); }

/* ─── 表单 ─── */
.f-group { margin-bottom: 16px; }
.f-group label {
  display: block; font-size: 14px; font-weight: 500;
  color: var(--gray-700); margin-bottom: 6px;
}
.f-group input, .f-group select, .f-group textarea {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit; outline: none; transition: border 0.15s;
}
.f-group input:focus, .f-group select:focus, .f-group textarea:focus {
  border-color: var(--red); box-shadow: 0 0 0 3px var(--red-light);
}

/* ─── 登录页 ─── */
.login-wrap {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--gray-50);
}
.login-card {
  background: #fff; border-radius: 16px; padding: 40px;
  width: 400px; box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid var(--gray-200);
}
.login-card h1 { font-size: 24px; margin-bottom: 4px; }
.login-card h1 span { color: var(--red); }
.login-card .sub { color: var(--gray-400); font-size: 14px; margin-bottom: 28px; }
.login-card .btn-red { width: 100%; justify-content: center; padding: 12px; font-size: 15px; margin-top: 8px; }
.login-card .err { color: var(--red); font-size: 13px; margin-top: 12px; text-align: center; min-height: 18px; }

/* ─── 主题卡片（选题中心） ─── */
.theme-row {
  padding: 18px 20px; border-bottom: 1px solid var(--gray-100);
}
.theme-row:last-child { border-bottom: none; }
.theme-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; flex-wrap: wrap; gap: 8px;
}
.theme-name { font-size: 16px; font-weight: 600; color: var(--gray-900); }
.theme-desc { font-size: 13px; color: var(--gray-500); margin-bottom: 10px; }
.theme-meta { display: flex; flex-direction: column; gap: 6px; }
.theme-meta > div { font-size: 13px; color: var(--gray-700); }
.meta-label {
  display: inline-block; width: 64px; flex-shrink: 0;
  color: var(--gray-400); font-size: 12px;
}
.theme-aud {
  margin-top: 10px; font-size: 13px; color: var(--red);
  background: var(--red-light); border-radius: var(--radius-sm);
  padding: 8px 12px; display: inline-block;
}
.chip {
  display: inline-block; padding: 2px 8px; margin: 2px 4px 2px 0;
  background: var(--gray-100); color: var(--gray-700);
  border-radius: 6px; font-size: 12px;
}

/* ─── 文章编辑器 ─── */
.ed-title {
  width: 100%; padding: 12px 16px; margin-bottom: 10px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  font-size: 18px; font-weight: 600; outline: none;
}
.ed-title:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-light); }
.ed-digest {
  width: 100%; padding: 10px 16px; margin-bottom: 12px;
  border: 1px solid var(--gray-200); border-radius: var(--radius-sm);
  font-size: 14px; outline: none;
}
.ed-digest:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-light); }

.ed-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 10px; background: #fff; border: 1px solid var(--gray-200);
  border-bottom: none; border-radius: var(--radius) var(--radius) 0 0;
}
.ed-toolbar .tbtn { min-width: 34px; justify-content: center; padding: 5px 10px; }
.ed-toolbar .tdiv { width: 1px; height: 20px; background: var(--gray-200); margin: 0 6px; }

/* AI 生成按钮 + 进度状态（T5.7） */
.ed-gen-status {
  font-size: 12px; color: var(--gray-400); margin-left: 8px; white-space: nowrap;
}
.ed-gen-status.busy { color: var(--red); font-weight: 500; }
.ed-gen-status.done { color: var(--green); }

.ed-content {
  width: 100%; min-height: 46vh; padding: 16px;
  border: 1px solid var(--gray-200); border-radius: 0 0 var(--radius) var(--radius);
  font-family: "SF Mono", Consolas, "Courier New", monospace;
  font-size: 14px; line-height: 1.7; resize: vertical; outline: none;
  background: #fff; color: var(--gray-900);
}
.ed-content:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-light); }

/* 编辑器双栏布局 + 事实/来源侧边栏（T5.8） */
.ed-main { display: flex; gap: 12px; align-items: stretch; }
.ed-main .ed-content { min-height: 46vh; flex: 1; }

.ed-claims {
  width: 280px; flex-shrink: 0; display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); overflow: hidden; max-height: 60vh;
}
.ed-claims-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--gray-100);
  font-size: 13px; font-weight: 600; color: var(--gray-900);
}
/* 侧边栏 tab（T5.9） */
.ed-claims-tabs { display: flex; gap: 4px; }
.ed-claims-tab {
  background: none; border: none; cursor: pointer;
  padding: 4px 10px; border-radius: 6px;
  font-size: 12px; color: var(--gray-500); font-weight: 500;
}
.ed-claims-tab:hover { background: var(--gray-100); }
.ed-claims-tab.active { background: var(--red-light); color: var(--red); }
.ed-claims-body { flex: 1; overflow-y: auto; padding: 10px 14px; font-size: 12px; }
.ed-claims-empty { color: var(--gray-400); padding: 12px 0; text-align: center; }
.ed-claim-item {
  padding: 10px 0; border-bottom: 1px solid var(--gray-100);
}
.ed-claim-item:last-child { border-bottom: none; }
.ed-claim-text { color: var(--gray-700); line-height: 1.6; margin-bottom: 6px; }
.ed-claim-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.ed-claim-src {
  display: inline-flex; align-items: center; gap: 4px; color: var(--gray-500);
  background: var(--gray-100); border-radius: 4px; padding: 2px 6px; margin: 2px 4px 2px 0;
  max-width: 100%; word-break: break-all;
}
.ed-claim-src a { color: var(--gray-600); text-decoration: none; }
.ed-claim-src a:hover { color: var(--red); }
.ed-claim-none { color: var(--gray-400); font-size: 11px; }

@media (max-width: 900px) {
  .ed-main { flex-direction: column; }
  .ed-claims { width: 100%; max-height: 40vh; }
}

.ed-statusbar {
  display: flex; align-items: center; gap: 16px; margin-top: 10px;
  font-size: 12px; color: var(--gray-400);
}
.ed-save.saving { color: var(--gray-500); }
.ed-save.saved { color: var(--green); }
.ed-words { margin-left: auto; }
.ed-id { color: var(--gray-400); }

.ed-preview-panel {
  margin-top: 16px; background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); overflow: hidden;
}
.ed-preview-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--gray-100);
  font-size: 14px; font-weight: 600;
}
.ed-preview-frame { width: 100%; height: 52vh; border: none; }

/* ─── 文章列表 ─── */
.al-filters {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 16px; margin-bottom: 16px;
}
.al-input {
  padding: 8px 12px; border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm); font-size: 13px; font-family: inherit;
  outline: none; min-width: 120px;
}
.al-input:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-light); }
.al-date-sep { color: var(--gray-400); font-size: 13px; }
.al-pager {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin-top: 16px;
}
.al-pageinfo { font-size: 13px; color: var(--gray-400); }
.al-empty { text-align: center; color: var(--gray-400); padding: 32px; font-size: 13px; }
.art-title-link { color: var(--gray-900); text-decoration: none; font-weight: 500; }
.art-title-link:hover { color: var(--red); }

/* 状态徽章（除现有 red/green/gray 外补充） */
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-blue { background: #eff6ff; color: #2563eb; }

/* ─── Toast ─── */
.toast {
  position: fixed; top: 20px; right: 20px;
  background: var(--gray-900); color: #fff;
  padding: 12px 24px; border-radius: var(--radius-sm);
  font-size: 14px; z-index: 999;
  opacity: 0; transform: translateY(-10px);
  transition: all 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ─── 响应式 ─── */
@media (max-width: 900px) {
  .sidebar { width: 56px; }
  .sidebar .logo { font-size: 0; padding: 16px 8px; }
  .sidebar .logo::after { content: "W"; font-size: 20px; color: var(--red); }
  .sidebar nav a { font-size: 0; justify-content: center; padding: 12px; }
  .sidebar nav a .ico { font-size: 18px; }
  .sidebar .user { justify-content: center; font-size: 0; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 20px 16px; }
}

/* ─── 素材库（assets.html 来源 tab，T4.6） ─── */
.as-search-row { display: flex; gap: 10px; align-items: center; }
.as-search-hint { font-size: 12px; color: var(--gray-400); margin-top: 8px; }
.as-search-result {
  margin-top: 12px; border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm); padding: 14px 16px;
  background: var(--gray-50); font-size: 13px;
}
.as-search-result .sr-head { font-weight: 600; color: var(--gray-700); margin-bottom: 8px; }
.as-search-result .sr-item {
  display: flex; gap: 8px; align-items: baseline; padding: 6px 0;
  border-bottom: 1px dashed var(--gray-200);
}
.as-search-result .sr-item:last-child { border-bottom: none; }
.as-search-result .sr-item .sr-url { color: var(--gray-400); font-size: 12px; word-break: break-all; }
.as-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.as-form-grid textarea { min-height: 60px; resize: vertical; font-family: inherit; }
.as-form-grid input[type="checkbox"] { width: auto; margin-right: 6px; }

/* ─── 素材库 Tab（T6.6：资料来源/图片/图表） ─── */
.tab-bar {
  display: flex; gap: 8px; border-bottom: 2px solid var(--gray-100);
  margin-bottom: 18px; padding-bottom: 0;
}
.tab-btn {
  border: none; background: transparent; cursor: pointer;
  padding: 10px 18px; font-size: 14px; color: var(--gray-400);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  font-weight: 500; transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--gray-700); }
.tab-btn.active { color: var(--red); border-bottom-color: var(--red); font-weight: 600; }

/* 素材网格 */
.am-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px; padding: 16px;
}
.am-card {
  border: 1px solid var(--gray-100); border-radius: var(--radius-sm);
  overflow: hidden; background: #fff; display: flex; flex-direction: column;
  transition: box-shadow .15s;
}
.am-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.am-thumb {
  height: 140px; background: var(--gray-50); display: flex;
  align-items: center; justify-content: center; overflow: hidden;
}
.am-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.am-img-err { color: var(--gray-400); font-size: 12px; text-align: center; }
.am-meta { padding: 10px 12px 6px; flex: 1; }
.am-method { display: flex; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
.am-dim { font-size: 12px; color: var(--gray-400); margin-bottom: 4px; }
.am-src {
  font-size: 12px; color: var(--gray-500); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.am-actions { display: flex; gap: 6px; padding: 8px 12px 12px; }
.am-empty {
  grid-column: 1 / -1; text-align: center; color: var(--gray-400);
  padding: 32px 16px; font-size: 13px;
}

/* ─── 双端预览（T6.7：桌面/手机切换，PRD §8.6/§9） ─── */
.ed-preview-tools {
  display: flex; align-items: center; gap: 8px;
}
.ed-device-btn.active {
  background: var(--red); color: #fff; border-color: var(--red);
}
.ed-preview-stage {
  background: #f3f4f6; padding: 14px; display: flex; justify-content: center;
}
.ed-preview-frame {
  width: 100%; height: 52vh; border: none; background: #fff;
  border-radius: 4px; transition: width .2s ease;
}
/* 手机预览：375px 宽 + 圆角边框模拟手机屏 */
.ed-preview-frame.ed-device-mobile {
  width: 375px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
@media (max-width: 480px) {
  .ed-preview-frame.ed-device-mobile { width: 100%; }
  .ed-preview-tools { flex-wrap: wrap; }
}

/* ============ 内容日历（T8.4） ============ */
.cal-month-label { font-weight: 600; font-size: 15px; padding: 0 10px; min-width: 110px; text-align: center; }
.cal-grid { padding: 8px; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 4px; }
.cal-weekhead { margin-bottom: 4px; }
.cal-cell { border: 1px solid var(--gray-100); border-radius: 6px; min-height: 72px; padding: 4px 6px; cursor: pointer; overflow: hidden; background: #fff; }
.cal-cell.cal-empty { border: none; background: transparent; cursor: default; }
.cal-cell.cal-head { border: none; min-height: auto; text-align: center; color: var(--gray-500); font-size: 12px; cursor: default; background: transparent; }
.cal-cell.cal-today { border-color: var(--red); }
.cal-cell.cal-selected { background: var(--red-light); }
.cal-daynum { font-size: 12px; color: var(--gray-500); margin-bottom: 2px; }
.cal-today .cal-daynum { color: var(--red); font-weight: 700; }
.cal-dot { font-size: 11px; line-height: 1.4; color: #1f2937; background: var(--gray-100); border-radius: 4px; padding: 1px 4px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-dot:hover { background: var(--red-light); color: var(--red); }
.cal-more { font-size: 11px; color: var(--red); font-weight: 600; }
.cal-list { padding: 8px 12px 12px; border-top: 1px solid var(--gray-100); }
.cal-list-title { font-size: 13px; font-weight: 600; color: var(--gray-500); margin-bottom: 8px; }
.cal-list-item { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px dashed var(--gray-100); font-size: 13px; }
.cal-list-time { margin-left: auto; color: var(--gray-400); font-size: 12px; }

/* ============ 系统设置（T8.5） ============ */
.st-card { padding: 20px 24px; }
.st-tab { padding: 4px 0; }
.st-row { display: flex; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 1px dashed var(--gray-100); font-size: 14px; }
.st-row label { width: 120px; color: var(--gray-500); flex-shrink: 0; }
.st-value { font-weight: 600; }
.st-field { display: flex; align-items: center; gap: 16px; padding: 10px 0; font-size: 14px; }
.st-field label { width: 120px; color: var(--gray-500); flex-shrink: 0; }
.st-field select, .st-field input[type="time"] { padding: 6px 10px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: 13px; min-width: 220px; }
.st-check { width: 16px; height: 16px; accent-color: var(--red); }
.st-check-wrap { display: inline-flex; align-items: center; gap: 8px; color: #1f2937; font-weight: 500; }
.st-hint { font-size: 12px; color: var(--gray-400); line-height: 1.7; margin: 10px 0 0; padding: 10px 12px; background: var(--gray-50, #f9fafb); border-radius: 6px; }
.st-actions { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--gray-100); }

/* T9.2：编辑器审核/预约操作栏 */
.ed-actions { display: flex; align-items: center; gap: 8px; padding: 10px 0 4px; flex-wrap: wrap; }
.ed-actions .btn { margin: 0; }
.ed-schedule-time { padding: 6px 8px; border: 1px solid var(--border, #ddd); border-radius: 6px; font-size: 13px; }
.ed-status-badge { margin-left: auto; font-size: 13px; color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; padding: 3px 10px; border-radius: 12px; font-weight: 600; }
