@import url('/fonts/misans-heavy.css');

:root {
  --bg: #f5f6fa; --card: #ffffff; --border: #e5e7eb;
  --text: #1f2329; --muted: #8a919f;
  --primary: #4f46e5; --primary-hover: #4338ca;
  --danger: #e5484d; --success: #30a46c;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
}
.hidden { display: none !important; }

/* ---------- 登录页 ---------- */
.auth-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 36px 40px; width: 400px; box-shadow: 0 8px 30px rgba(0,0,0,.06);
}
.brand-row { font-size: 16px; font-weight: 700; text-align: center; }
.brand-logo { font-size: 20px; }
.platform-tag {
  text-align: center; color: var(--primary); font-size: 11px; font-weight: 700;
  letter-spacing: 2px; margin-top: 6px; text-transform: uppercase;
}
.auth-caption { text-align: center; color: var(--muted); font-size: 11px; letter-spacing: 3px; margin-top: 22px; }
.auth-title { font-size: 22px; text-align: center; margin: 6px 0 20px; }
.auth-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 16px; font-size: 12px; color: var(--muted);
}
.admin-link { color: var(--muted); text-decoration: none; }
.admin-link:hover { color: var(--primary); }
.tip { color: var(--muted); font-size: 12px; text-align: center; margin-top: 14px; }
#authForm label, #adminForm label, #initForm label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
#authForm .btn.full, #adminForm .btn.full, #initForm .btn.full { margin-top: 16px; }

/* 管理端（深色风格） */
body.admin-portal { background: #14161f; }
.auth-card.dark {
  background: #1d2130; border-color: #2a3042; color: #e8eaf2;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}
.auth-card.dark .platform-tag { color: #818cf8; }
.auth-card.dark .auth-caption { color: #6b7288; }
.auth-card.dark label { color: #9aa3b8; }
.auth-card.dark input {
  background: #14161f; border-color: #2a3042; color: #e8eaf2;
}
.auth-card.dark input:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,.2); }
.auth-card.dark .admin-link { color: #6b7288; }
.auth-card.dark .admin-link:hover { color: #818cf8; }
.auth-card.dark .muted { color: #9aa3b8; }
.topbar.dark { background: #1d2130; border-bottom-color: #2a3042; }
.topbar.dark .brand { color: #e8eaf2; }
.topbar.dark .nav-btn:hover { background: #262b3d; color: #e8eaf2; }
.topbar.dark .nav-btn.active { background: #312e5e; color: #a5b4fc; }
.topbar.dark .uname { color: #e8eaf2; }
.topbar.dark .btn.ghost { background: transparent; border-color: #2a3042; color: #9aa3b8; }
.topbar.dark .btn.ghost:hover { border-color: #6366f1; color: #a5b4fc; }
body.admin-portal .card { background: #1d2130; border-color: #2a3042; color: #e8eaf2; }
body.admin-portal h2, body.admin-portal h3, body.admin-portal .name { color: #e8eaf2; }
body.admin-portal .tabs { background: #14161f; }
body.admin-portal .tab { color: #6b7288; }
body.admin-portal .tab.active { background: #262b3d; color: #e8eaf2; box-shadow: none; }
body.admin-portal input, body.admin-portal textarea, body.admin-portal select {
  background: #14161f; border-color: #2a3042; color: #e8eaf2;
}
body.admin-portal .desc, body.admin-portal th, body.admin-portal .muted { color: #9aa3b8; }
body.admin-portal .provider-item, body.admin-portal .table td, body.admin-portal .table th { border-bottom-color: #2a3042; }
body.admin-portal .btn.ghost { background: transparent; border-color: #2a3042; color: #9aa3b8; }
body.admin-portal .btn.ghost:hover { border-color: #6366f1; color: #a5b4fc; }
body.admin-portal .code-text { background: #14161f; color: #c7d2fe; }
body.admin-portal .drop { border-color: #2a3042; color: #6b7288; }
body.admin-portal .tag { background: #262b3d; color: #9aa3b8; }
body.admin-portal .tag.on { background: #11362a; color: #4ade80; }
body.admin-portal .empty { color: #6b7288; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 58px; position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 17px; white-space: nowrap; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav-btn {
  border: none; background: none; padding: 8px 14px; border-radius: 8px;
  cursor: pointer; font-size: 14px; color: var(--muted);
}
.nav-btn:hover { background: var(--bg); color: var(--text); }
.nav-btn.active { background: #eef2ff; color: var(--primary); font-weight: 600; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.credits { font-size: 13px; color: var(--muted); }
.credits b { color: #f59e0b; font-size: 15px; }
.uname { font-size: 14px; font-weight: 600; }

/* ---------- 布局 ---------- */
main { max-width: 960px; margin: 24px auto; padding: 0 20px; }
main.wide { max-width: 1360px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; margin-bottom: 20px;
}
.card.inner { box-shadow: none; margin-top: 16px; }
.card.narrow { max-width: 520px; margin: 0 auto; }
h2 { font-size: 18px; margin-bottom: 16px; }
h3 { font-size: 15px; margin-bottom: 12px; }
.row { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 14px; }
.row.between { justify-content: space-between; align-items: center; }
.row.end { justify-content: flex-end; }
.grow { flex: 1; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.8; }
.small { font-size: 12px; }
hr { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; color: var(--text); font-weight: 700; }
input, textarea, select {
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
  outline: none; width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
textarea { resize: vertical; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 10px 0; }
.check input { width: auto; }
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; }
.send-code { white-space: nowrap; min-width: 110px; }
.send-code:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 按钮 ---------- */
.btn {
  border: none; border-radius: 8px; padding: 10px 20px; font-size: 14px;
  cursor: pointer; font-family: inherit; transition: .15s;
}
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ghost { background: #fff; border: 1px solid var(--border); color: var(--text); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 标签页/分段 ---------- */
.tabs { display: flex; background: var(--bg); border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.tabs.inline { margin-bottom: 20px; display: inline-flex; }
.tab { flex: 1; border: none; background: none; padding: 9px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--muted); font-family: inherit; }
.tabs.inline .tab { flex: none; padding: 8px 18px; }
.tab.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.seg { display: inline-flex; background: var(--bg); border-radius: 10px; padding: 4px; }
.seg-btn { border: none; background: none; padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--muted); font-family: inherit; }
.seg-btn.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.08); }

/* ---------- 上传/图片 ---------- */
.drop {
  border: 2px dashed var(--border); border-radius: 10px; padding: 22px;
  text-align: center; color: var(--muted); cursor: pointer; font-size: 13px;
}
.drop:hover { border-color: var(--primary); color: var(--primary); }
.img-preview { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.img-preview img { width: 120px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }

/* ---------- 任务 ---------- */
.cost-hint { font-size: 13px; color: var(--muted); }
.cost-hint b { color: #f59e0b; }
.task-status { font-size: 14px; margin-bottom: 10px; }
.progress { height: 6px; background: var(--bg); border-radius: 4px; overflow: hidden; margin-bottom: 14px; }
.progress-bar { height: 100%; width: 0; background: var(--primary); transition: width .5s; border-radius: 4px; }
.video-player { width: 100%; max-height: 420px; border-radius: 10px; background: #000; margin-bottom: 10px; }

/* ---------- 历史 ---------- */
.history-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.h-item { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.h-item video { width: 100%; height: 170px; object-fit: contain; background: #000; display: block; }
.h-info { padding: 10px 12px; font-size: 12px; }
.h-info .p { color: var(--text); margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.h-info .meta { color: var(--muted); display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.status-badge { padding: 2px 8px; border-radius: 20px; font-size: 11px; }
.status-done { background: #e8f7ef; color: var(--success); }
.status-processing { background: #fff5e0; color: #d97706; }
.status-error { background: #fdebec; color: var(--danger); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; grid-column: 1/-1; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
.table th, .table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 500; }
.code-text { font-family: Consolas, monospace; background: var(--bg); padding: 2px 6px; border-radius: 4px; }

/* ---------- 其他 ---------- */
.error { color: var(--danger); font-size: 13px; margin: 8px 0; min-height: 18px; }
.msg { color: var(--success); font-size: 13px; margin-top: 10px; min-height: 18px; }
.provider-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.provider-item .info { flex: 1; }
.provider-item .name { font-weight: 600; font-size: 14px; }
.provider-item .desc { color: var(--muted); font-size: 12px; margin-top: 3px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: var(--bg); color: var(--muted); }
.tag.on { background: #e8f7ef; color: var(--success); }
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: rgba(30,32,38,.92); color: #fff; padding: 10px 22px;
  border-radius: 10px; font-size: 14px; z-index: 99; max-width: 80vw;
}

/* 公告条 */
.notice-bar {
  background: #e7f8f0; border: 1px solid #c3ecd7; color: #129d63;
  border-radius: 10px; padding: 10px 16px; font-size: 13px; margin-bottom: 16px;
  line-height: 1.6;
}
.params-row .field { flex: 1; min-width: 120px; }
.cost-hint b { color: #f59e0b; }
.ledger-plus { color: var(--success); font-weight: 600; }
.ledger-minus { color: var(--danger); font-weight: 600; }

/* ---------- 三栏任务台（参考先见AI） ---------- */
.studio-grid {
  display: grid; grid-template-columns: 268px 1fr 300px; gap: 18px;
  align-items: start;
}
@media (max-width: 1100px) { .studio-grid { grid-template-columns: 1fr; } }
.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; min-height: 560px;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 14px; }
.panel-cap { font-size: 10px; letter-spacing: 2px; color: #b3bac5; text-transform: uppercase; font-weight: 600; }
.panel-title { font-size: 20px; font-weight: 900; margin-top: 2px; color: var(--text); font-family: 'MiSans', 'PingFang SC', 'Microsoft YaHei', sans-serif; }
.panel-title-sm { font-size: 20px; font-weight: 900; color: var(--text); white-space: nowrap; font-family: 'MiSans', 'PingFang SC', 'Microsoft YaHei', sans-serif; }
.date-picker { width: auto; font-size: 12px; padding: 5px 6px; border-radius: 6px; color: var(--muted); max-width: 128px; }
.batch-link { font-size: 13px; color: var(--primary); text-decoration: none; padding: 5px 12px; border: 1px solid var(--border); border-radius: 8px; }
.batch-link:hover { border-color: var(--primary); }

/* 左栏任务列表 */
.filter-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.ftab {
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 5px 12px; font-size: 12px; color: var(--muted); cursor: pointer; font-family: inherit;
}
.ftab.active { background: #eef2ff; border-color: var(--primary); color: var(--primary); font-weight: 600; }
.side-task-list { display: flex; flex-direction: column; gap: 8px; max-height: 620px; overflow-y: auto; }
.side-task {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  cursor: pointer; transition: .15s;
}
.side-task:hover { border-color: var(--primary); background: #fafbff; }
.side-task.selected { border-color: var(--primary); background: #eef2ff; }
.side-task .p {
  font-size: 13px; color: var(--text); margin-bottom: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.side-task .meta { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }

/* 中栏表单（按先见AI 截图还原） */
.panel-center { padding: 22px 26px; }
.center-title-row { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.center-title-row .panel-title { font-size: 20px; }
.batch-link {
  font-size: 13px; color: var(--primary); text-decoration: none;
  padding: 8px 22px; border: 1px solid var(--primary); border-radius: 10px; white-space: nowrap;
}
.batch-link:hover { background: #eef2ff; }
.model-select { font-weight: 700; font-size: 15px; padding: 12px 14px; border-radius: 10px; }
.param-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.param-row .field { min-width: 0; }
.param-row select { padding: 11px 12px; }
.char-count { float: right; font-weight: 400; font-size: 11px; }
.panel-center textarea { line-height: 1.9; font-size: 13px; }
.auto-pill {
  display: inline-flex; align-items: center; gap: 6px; margin-top: -26px; margin-left: 10px;
  background: #e8f5fe; border: 1px solid #cfe9fb; border-radius: 20px;
  padding: 4px 12px; font-size: 13px; font-weight: 600; position: relative;
  box-shadow: 0 1px 4px rgba(30, 155, 240, .12); color: #1e9bf0;
}
.auto-pill input { width: auto; margin: 0; accent-color: #1e9bf0; }
.auto-pill label { cursor: pointer; margin: 0; }
.info-dot {
  width: 15px; height: 15px; line-height: 15px; text-align: center;
  background: #1e9bf0; color: #fff; border-radius: 50%;
  font-size: 10px; font-style: normal; font-weight: 700; cursor: help;
}
/* 素材库使用说明弹层（点击 ⓘ 弹出） */
.mat-help {
  position: absolute; bottom: calc(100% + 12px); left: 0; width: 340px; max-width: 78vw;
  background: #fff; border-radius: 14px; padding: 14px 16px; text-align: left;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .16); z-index: 40; cursor: default;
}
.mat-help::after {
  content: ''; position: absolute; left: 22px; top: 100%;
  border: 7px solid transparent; border-top-color: #fff;
}
.mh-title { font-weight: 700; font-size: 13px; color: var(--text); margin-bottom: 6px; }
.mh-body { font-size: 12px; color: var(--text); line-height: 1.9; }
.mh-body b { color: var(--primary); }
.mh-at {
  display: inline-block; width: 16px; height: 16px; line-height: 16px; text-align: center;
  background: linear-gradient(135deg, #8b5cf6, #ec4899); color: #fff;
  border-radius: 50%; font-size: 10px; font-weight: 700; vertical-align: -2px;
}
/* 提示词输入区：底部内嵌 自动@ 与 @ 按钮栏 */
.prompt-box { position: relative; }
.prompt-box textarea {
  width: 100%; border-radius: 14px; resize: vertical;
  padding: 12px 14px 52px; display: block;
}
.prompt-bar {
  position: absolute; left: 10px; right: 10px; bottom: 10px;
  display: flex; justify-content: space-between; align-items: flex-end;
  pointer-events: none;
}
.prompt-bar .auto-pill { pointer-events: auto; margin-top: 0; margin-left: 0; }
.at-wrap { position: relative; pointer-events: auto; }
.at-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6 0%, #b845ec 55%, #ec4899 100%); color: #fff;
  border: none; font-size: 20px; font-weight: 800; font-style: italic; cursor: pointer;
  box-shadow: 0 2px 10px rgba(168, 85, 247, .4); transition: transform .15s, box-shadow .15s;
  position: relative;
}
/* 右下角白色尖角（同参考样式） */
.at-btn::after {
  content: ''; position: absolute; right: -1px; bottom: -1px;
  width: 0; height: 0;
  border-left: 10px solid transparent; border-bottom: 10px solid var(--card, #fff);
  filter: drop-shadow(-1px -1px 1px rgba(168, 85, 247, .25));
}
.at-btn:hover { transform: scale(1.08); box-shadow: 0 3px 14px rgba(168, 85, 247, .55); }
.at-pop {
  position: absolute; bottom: 44px; right: 0; min-width: 150px; max-height: 220px; overflow: auto;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .14); padding: 6px; z-index: 30;
}
.at-pop button {
  display: block; width: 100%; text-align: left; padding: 7px 12px;
  border: none; background: none; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text);
}
.at-pop button:hover { background: var(--bg); color: var(--primary); }
.at-pop .at-kind {
  float: right; font-size: 10px; color: var(--muted);
  background: var(--bg); border-radius: 8px; padding: 1px 6px; margin-left: 8px;
}
.at-pop .empty-hint { font-size: 12px; color: var(--muted); padding: 8px 12px; white-space: nowrap; }
.upload-row {
  display: grid; grid-template-columns: 1fr 1.1fr; gap: 12px; align-items: stretch;
  background: var(--bg); border-radius: 12px; padding: 14px;
}
.upload-specs { font-size: 12px; color: var(--muted); line-height: 2; align-self: center; }
.upload-specs b { color: var(--text); font-weight: 600; }
.inline-drop {
  display: flex; align-items: center; justify-content: center;
  border: 1.5px dashed var(--border); border-radius: 10px; background: #fff;
  padding: 26px 10px; font-size: 13px; color: var(--muted); cursor: pointer;
}
.inline-drop:hover { border-color: var(--primary); color: var(--primary); }
.img-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.img-item { position: relative; }
.img-item img { width: 86px; height: 60px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.img-item .rm {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--danger); color: #fff; border: none; font-size: 11px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.img-item .first-tag {
  position: absolute; left: 0; bottom: 0; background: rgba(0,0,0,.55); color: #fff;
  font-size: 10px; padding: 1px 5px; border-radius: 0 0 8px 8px;
}
/* 视频 / 音频 / 上传中素材卡片 */
.img-item video { width: 86px; height: 60px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.mat-audio {
  width: 86px; height: 60px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; overflow: hidden;
}
.mat-audio .emoji { font-size: 18px; }
.mat-name { font-size: 9px; color: var(--muted, #8a919f); max-width: 78px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-uploading {
  width: 86px; height: 60px; border-radius: 8px; border: 1px dashed var(--primary);
  background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 10px; color: var(--primary); animation: matPulse 1.2s ease-in-out infinite;
}
@keyframes matPulse { 0%, 100% { opacity: .65; } 50% { opacity: 1; } }
.sound-row { display: flex; align-items: center; gap: 14px; margin: 16px 0; }
.sound-check { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.sound-check input { width: auto; accent-color: #ec4899; }
.sound-check label { font-size: 14px; font-weight: 600; cursor: pointer; }
.remark-input { flex: 1; background: var(--bg); border-color: transparent; font-size: 13px; }
.remark-input:focus { background: #fff; border-color: var(--primary); }

/* 底部提交条 */
.submit-bar {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  background: linear-gradient(90deg, #6366f1, #4f46e5); color: #fff;
  border: none; border-radius: 12px; padding: 16px 22px;
  font-size: 14px; font-family: inherit; cursor: pointer; transition: .15s;
}
.submit-bar:hover { filter: brightness(1.08); }
.submit-bar:disabled { background: #b9bdc9; cursor: not-allowed; filter: none; }
.sb-status { font-weight: 600; white-space: nowrap; }
.sb-right { display: flex; align-items: center; gap: 14px; font-weight: 700; }
.sb-right .arr { font-size: 18px; opacity: .9; }

/* 右栏预览 */
.panel-right { display: flex; flex-direction: column; }
.preview-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 60px 10px; text-align: center;
}
.preview-logo {
  width: 74px; height: 74px; border-radius: 20px; background: linear-gradient(135deg, #eef2ff, #fce7f3);
  display: flex; align-items: center; justify-content: center; font-size: 34px; margin-bottom: 8px;
}
.preview-slogan { font-size: 15px; font-weight: 600; }
.preview-sub { font-size: 12px; color: var(--muted); }
.preview-box { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.preview-processing { text-align: center; padding: 40px 0; }
.spinner {
  width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; margin: 0 auto 14px; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.preview-meta { font-size: 12px; color: var(--muted); line-height: 1.8; }
.preview-actions { display: flex; gap: 10px; }
.preview-actions .btn { flex: 1; text-align: center; text-decoration: none; }

/* ---------- 充值中心（账户余额，参考先见AI） ---------- */
.recharge-wrap { display: flex; justify-content: center; }
.rc-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 24px 28px; width: 560px; max-width: 100%;
  box-shadow: 0 8px 30px rgba(0,0,0,.05);
}
.rc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.rc-head-left { display: flex; align-items: center; gap: 12px; }
.rc-icon {
  width: 42px; height: 42px; border-radius: 10px; background: #eef2ff;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.rc-title { font-size: 17px; font-weight: 700; }
.rc-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.rc-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; overflow: hidden;
  background: linear-gradient(90deg, #4f7df5, #2f56d9); border-radius: 12px;
  padding: 18px 0; margin-bottom: 20px;
}
.rc-stat { text-align: center; color: #dbe6ff; font-size: 12px; line-height: 1.7; }
.rc-stat b { display: block; color: #fff; font-size: 24px; line-height: 1.2; }
.rc-block { margin-bottom: 18px; }
.rc-label { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.rc-label .rate { font-weight: 400; font-size: 12px; color: var(--muted); }
.pay-tabs { display: flex; gap: 8px; }
.pay-tab {
  border: 1.5px solid var(--border); background: #fff; border-radius: 10px;
  padding: 9px 22px; font-size: 13px; color: var(--muted); cursor: pointer; font-family: inherit;
}
.pay-tab.active { border-color: var(--primary); color: var(--primary); font-weight: 600; background: #f5f7ff; }
.amount-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 620px) { .amount-grid { grid-template-columns: repeat(2, 1fr); } }
.amount-item {
  border: 1.5px solid var(--border); border-radius: 12px; background: #fff;
  padding: 14px 8px; text-align: center; cursor: pointer; transition: .15s; font-family: inherit;
}
.amount-item:hover { border-color: var(--primary); }
.amount-item.selected { border-color: var(--primary); background: #f5f7ff; box-shadow: 0 0 0 2px rgba(79,113,245,.15); }
.amount-item .money { font-size: 20px; font-weight: 800; color: var(--text); }
.amount-item .money::after { content: ' ¥'; font-size: 13px; font-weight: 600; }
.amount-item .get { font-size: 11px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.amount-item .bonus { font-size: 11px; color: #e0620d; margin-top: 2px; }
.pay-hint {
  margin-top: 12px; background: #f5f7ff; border: 1px solid #d6e0fb; border-radius: 10px;
  padding: 10px 14px; font-size: 13px; color: #2f56d9; line-height: 1.7;
}
.rc-contact {
  display: flex; align-items: center; gap: 14px;
  background: #fff7e8; border: 1px solid #f5d98a; border-radius: 12px;
  padding: 12px 16px; margin-bottom: 20px;
}
.rc-contact-text { font-size: 13px; line-height: 1.8; color: #8a6d1a; }
.rc-contact-text b { color: #6b5310; }

/* 收款码 + 订单提交 */
.pay-area {
  margin-top: 14px; display: grid; grid-template-columns: 190px 1fr; gap: 16px;
  background: var(--bg); border-radius: 12px; padding: 16px;
}
.pay-qr { text-align: center; }
.pay-qr img {
  width: 170px; height: 170px; object-fit: contain; background: #fff;
  border: 1px solid var(--border); border-radius: 10px; display: block; margin: 0 auto 8px;
}
.qr-tip { font-size: 12px; color: var(--muted); line-height: 1.6; }
.pay-order { display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.pay-order-info { font-size: 13px; line-height: 1.9; }
.pay-order-info b { color: var(--primary); }
.pay-order input { background: #fff; }
.order-status-pending { color: #d97706; font-weight: 600; }
.order-status-confirmed { color: var(--success); font-weight: 600; }
.order-status-rejected { color: var(--danger); font-weight: 600; }

/* 管理端：收款码预览 */
.qr-preview { width: 130px; height: 130px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; margin-top: 8px; background: #fff; }

/* 站点设置-面额行 */
.preset-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.preset-row input { width: 100px; }

/* 页脚 */
.site-footer { text-align: center; color: var(--muted); font-size: 12px; padding: 26px 0 30px; }

/* 积分调整独立密码 & 确认弹窗 */
.credit-pass-box {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #fff8e6; border: 1px solid #f5d98a; border-radius: 10px;
  padding: 10px 14px; margin-bottom: 14px; font-size: 13px;
}
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,18,30,.55); z-index: 90;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: #fff; border-radius: 14px; padding: 24px 26px; width: 380px; max-width: 92vw;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal h3 { margin-bottom: 10px; }
.modal-info { font-size: 14px; line-height: 1.8; margin-bottom: 10px; }
.modal-info b { color: var(--primary); }

/* ---------- 充值管理统计卡片 ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 14px 0 18px; }
@media (max-width: 900px) { .stat-cards { grid-template-columns: repeat(2, 1fr); } }
.stat-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--bg); }
.stat-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--text); line-height: 1.25; }
.stat-value.warn { color: #d97706; }
.stat-sub { font-size: 11px; color: var(--muted); margin-top: 5px; }
body.admin-portal .stat-card { background: #14161f; border-color: #2a3042; }
body.admin-portal .stat-value { color: #e8eaf2; }
body.admin-portal .stat-value.warn { color: #fbbf24; }

/* ---------- 素材库页 ---------- */
.lib-wrap { max-width: 1080px; margin: 0 auto; padding: 22px 16px 40px; }
.lib-card {
  background: #fff; border: 1px solid var(--border); border-radius: 16px;
  padding: 22px 24px; box-shadow: 0 6px 24px rgba(17,24,39,.05);
}
.lib-head { display: flex; align-items: flex-start; justify-content: space-between; }
.lib-eyebrow { font-size: 11px; letter-spacing: 2px; color: #c2c8d2; font-weight: 700; }
.lib-title { font-size: 22px; font-weight: 900; color: var(--text); margin-top: 2px; font-family: 'MiSans', 'PingFang SC', 'Microsoft YaHei', sans-serif; }
.lib-browser-btn {
  border: 1px solid #f5c26b; background: #fff7e8; color: #b45309;
  font-size: 13px; font-weight: 700; border-radius: 8px; padding: 7px 14px; cursor: pointer;
}
.lib-browser-btn:hover { background: #fdecc8; }
.lib-help { font-size: 13px; color: #6b7280; line-height: 1.9; margin: 12px 0 16px; }
.lib-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lib-tb {
  border: 1px solid var(--border); background: #f6f7f9; color: var(--text);
  font-size: 13px; font-weight: 600; border-radius: 8px; padding: 8px 16px; cursor: pointer;
}
.lib-tb:hover { background: #eceef2; }
.lib-tb.sm { padding: 8px 12px; font-weight: 500; }
.lib-tb.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.lib-tb.primary:hover { filter: brightness(1.06); }
.lib-tb.on { background: #e8f5fe; border-color: #9fd3fb; color: #1e9bf0; }
.lib-search {
  flex: 1; min-width: 160px; max-width: 260px; margin-left: auto;
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: 13px; outline: none;
}
.lib-search:focus { border-color: var(--primary); }
.lib-banner {
  margin-top: 14px; background: #f3f4f6; color: #9ca3af; font-size: 13px;
  border-radius: 8px; padding: 12px 16px;
}
.lib-banner.hidden { display: none; }
.lib-body { display: grid; grid-template-columns: 200px 1fr; gap: 22px; margin-top: 18px; }
@media (max-width: 760px) { .lib-body { grid-template-columns: 1fr; } }
.lib-side {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px; align-self: start;
  display: flex; flex-direction: column; gap: 4px;
}
.lib-side-title { font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.lib-side-cats { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; }
.lib-newcat {
  border: 1px solid var(--border); background: #fff; border-radius: 6px;
  font-size: 12px; padding: 3px 10px; cursor: pointer; color: #4b5563;
}
.lib-newcat:hover { background: #f3f4f6; }
.cat {
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  font-size: 13px; padding: 8px 12px; cursor: pointer; color: var(--text);
}
.cat:hover { background: #f6f7f9; }
.cat.active { border-color: var(--primary); color: var(--primary); background: #f5f0ff; }
.cat span { color: #9ca3af; font-size: 12px; }
.cat.active span { color: var(--primary); }
.lib-main { min-height: 320px; }
.lib-note { font-size: 13px; color: #9ca3af; margin-bottom: 12px; }
.lib-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px;
}
.mat-card {
  position: relative; border: 1px solid var(--border); border-radius: 12px; background: #fff;
  padding: 10px; display: flex; flex-direction: column; gap: 6px; transition: box-shadow .15s, border-color .15s;
}
.mat-card:hover { box-shadow: 0 6px 18px rgba(17,24,39,.1); }
.mat-card.sel { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(139,92,246,.15); }
.mat-check { position: absolute; top: 8px; left: 8px; width: 16px; height: 16px; cursor: pointer; z-index: 2; }
.mat-pv {
  height: 96px; border-radius: 8px; overflow: hidden; background: #f3f4f6;
  display: flex; align-items: center; justify-content: center;
}
.mat-pv img, .mat-pv video { width: 100%; height: 100%; object-fit: cover; }
.mat-pv.audio { font-size: 34px; }
.mat-ico { opacity: .6; }
.mat-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-meta { font-size: 11px; color: #9ca3af; }
.mat-cat-sel {
  border: 1px solid var(--border); border-radius: 6px; font-size: 12px; padding: 3px 6px;
  color: #4b5563; background: #fff; outline: none; max-width: 100%;
}
.mat-ops { display: none; gap: 6px; }
.mat-card:hover .mat-ops { display: flex; }
.mat-ops button {
  flex: 1; border: 1px solid var(--border); background: #f9fafb; border-radius: 6px;
  font-size: 12px; padding: 4px 6px; cursor: pointer; color: #4b5563;
}
.mat-ops button:hover { background: #f3f4f6; color: var(--text); }
.lib-empty { text-align: center; color: #b0b6c0; font-size: 14px; padding: 70px 0; }
#toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%) translateY(20px);
  background: rgba(23,23,35,.92); color: #fff; font-size: 14px; padding: 10px 18px;
  border-radius: 10px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 999; max-width: 80vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 联系客服弹窗 ---------- */
.cs-modal { width: 430px; max-width: 94vw; }
.cs-head { display: flex; align-items: center; justify-content: space-between; }
.cs-x {
  border: none; background: none; font-size: 22px; line-height: 1; color: #9ca3af;
  cursor: pointer; padding: 2px 6px; border-radius: 6px;
}
.cs-x:hover { color: var(--text); background: #f3f4f6; }
.cs-sub { font-size: 13px; color: #8b93a1; margin: 8px 0 16px; }
.cs-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cs-card { min-width: 0; overflow: hidden; }
@media (max-width: 480px) { .cs-cards { grid-template-columns: 1fr; } }
.cs-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; background: #fafbfc;
}
.cs-qr { position: relative; width: 100%; max-width: 170px; aspect-ratio: 1 / 1; height: auto; margin: 0 auto; border-radius: 10px; background: #fff; border: 1px solid var(--border); overflow: hidden; }
.cs-qr img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; display: block; }
.cs-qr img.hidden { display: none; }
.cs-badge {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 34px; height: 34px; border-radius: 50%; background: #fff;
  display: none; align-items: center; justify-content: center; font-size: 17px;
  box-shadow: 0 2px 10px rgba(17,24,39,.18);
}
.cs-qq { background: linear-gradient(135deg, #eef3ff, #e3ecff); }
.cs-qr.qq .cs-badge { display: flex; }
.cs-wx { background: linear-gradient(135deg, #ecfaf1, #dcf5e7); }
.cs-qr.wx .cs-badge { display: flex; }
.cs-name { font-size: 14px; font-weight: 800; color: var(--text); }
.cs-desc { font-size: 12px; color: #9ca3af; }
.cs-empty { text-align: center; color: #b0b6c0; font-size: 13px; padding: 18px 0 4px; }
.cs-empty.hidden { display: none; }

/* 联系客服弹窗整体放大，二维码保持原图不叠图标 */
.cs-modal { width: 560px; }
.cs-cards { gap: 18px; }
.cs-card { padding: 18px; }
.cs-qr { max-width: 240px; }
.cs-badge { display: none !important; }
.cs-name { font-size: 15px; }
.cs-desc { font-size: 13px; }
.cs-qr.qq, .cs-qr.wx { background: #fff; }
