/* ============ 基础 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  /* 主色（默认紫罗兰，html[data-accent] 可切主题） */
  --primary: #5b5ce2;
  --primary-dark: #4748c8;
  --accent: #7c3aed;
  --glow: rgba(91, 92, 226, .35);        /* 主色光晕（阴影统一走这个变量） */
  --primary-soft: rgba(91, 92, 226, .12); /* 主色浅底：选中态/提示条 */

  /* 表面与文字 */
  --bg: #f4f5fb;
  --card: #ffffff;
  --input: #ffffff;
  --soft: #f7f8fd;      /* 次级面板：聊天区/工具条/分组底 */
  --soft-2: #f6f7fc;    /* 三级面板：问答块/表格 hover */
  --text: #1e2233;
  --text-soft: #555a75;
  --muted: #8a8fa8;
  --border: #e6e8f2;
  --border-strong: #d5d8ee;
  --tip-text: #4748c8;
  --green: #16a34a;
  --red: #dc2626;
  --sidebar: #191b2e;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(30, 34, 60, .07);
}
/* —— 主题色：科技蓝 —— */
html[data-accent="blue"] {
  --primary: #2563eb; --primary-dark: #1d4ed8; --accent: #0ea5e9;
  --glow: rgba(37, 99, 235, .35); --primary-soft: rgba(37, 99, 235, .12);
}
/* —— 主题色：商务青 —— */
html[data-accent="teal"] {
  --primary: #0d9488; --primary-dark: #0f766e; --accent: #2dd4bf;
  --glow: rgba(13, 148, 136, .35); --primary-soft: rgba(13, 148, 136, .12);
}
/* —— 主题色：暖橙 —— */
html[data-accent="orange"] {
  --primary: #ea580c; --primary-dark: #c2410c; --accent: #f59e0b;
  --glow: rgba(234, 88, 12, .35); --primary-soft: rgba(234, 88, 12, .12);
}
/* —— 深色模式 —— */
html[data-mode="dark"] {
  --bg: #12141f;
  --card: #1c1f31;
  --input: #262a42;
  --soft: #181b2b;
  --soft-2: #20243a;
  --text: #e7e9f7;
  --text-soft: #aab0cc;
  --muted: #8b90ad;
  --border: #2c3049;
  --border-strong: #3a3f5e;
  --tip-text: var(--primary);
  --shadow: 0 2px 14px rgba(0, 0, 0, .45);
}
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
.hidden { display: none !important; }
.flex1 { flex: 1; }
.muted { color: var(--muted); font-size: 12px; }
.accent { color: var(--primary); }
h3 { font-size: 15px; margin-bottom: 10px; }

button { cursor: pointer; font-family: inherit; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; border: none; border-radius: 10px; padding: 10px 20px;
  font-size: 14px; font-weight: 600; transition: .18s;
  box-shadow: 0 3px 10px var(--glow);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 5px 16px var(--glow); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-mini, .btn-mini-accent, .btn-ghost-mini {
  border-radius: 8px; padding: 6px 12px; font-size: 12.5px; border: 1px solid var(--border);
  background: var(--input); color: var(--text); transition: .15s;
}
.btn-mini:hover, .btn-ghost-mini:hover { border-color: var(--primary); color: var(--primary); }
.btn-mini:active, .opt-chip:active, .quick-chip:active, .sug-chip:active { transform: scale(.96); }
button:focus-visible, .opt-chip:focus-visible, .tdot:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
button[disabled] { opacity: .55; cursor: not-allowed; }
#surveyCustom {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font-size: 13.5px; font-family: inherit; resize: vertical; line-height: 1.6;
}
#surveyCustom:focus { outline: none; border-color: var(--primary); }
.btn-mini-accent { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; border: none; }
.btn-mini-accent:hover { opacity: .9; }
.btn-block { width: 100%; }
input, select, textarea {
  border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font-size: 14px; font-family: inherit; outline: none; transition: border .15s, background .2s; background: var(--input);
  color: var(--text);
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; }
label { font-size: 13px; }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.chk input { width: auto; }
.file-btn { display: inline-flex; align-items: center; cursor: pointer; }

/* ============ 登录页 ============ */
.auth-wrap { display: flex; min-height: 100vh; }
.auth-left {
  flex: 1.1; background: linear-gradient(150deg, var(--primary-dark) 0%, var(--primary) 55%, var(--accent) 100%);
  color: #fff; display: flex; align-items: center; justify-content: center; padding: 60px;
}
.auth-brand { max-width: 480px; }
.brand-logo {
  width: 64px; height: 64px; border-radius: 18px; background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center; font-size: 32px; margin-bottom: 22px;
  backdrop-filter: blur(4px);
}
.auth-brand h1 { font-size: 34px; letter-spacing: 1px; margin-bottom: 8px; }
.brand-sub { opacity: .85; font-size: 15px; margin-bottom: 34px; }
.brand-feats { list-style: none; }
.brand-feats li {
  padding: 9px 0; font-size: 14.5px; opacity: .92; display: flex; gap: 10px; align-items: center;
}
.brand-feats li span {
  width: 30px; height: 30px; border-radius: 9px; background: rgba(255,255,255,.14);
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px; flex: none;
}
.auth-right { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-card {
  width: 100%; max-width: 400px; background: var(--card); border-radius: 20px;
  box-shadow: 0 10px 40px rgba(30,34,60,.12); padding: 34px 34px 26px;
}
.auth-tabs { display: flex; gap: 6px; background: var(--bg); padding: 5px; border-radius: 12px; margin-bottom: 26px; }
.auth-tabs button {
  flex: 1; border: none; background: transparent; padding: 9px; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: var(--muted); transition: .18s;
}
.auth-tabs button.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow); }
.auth-form label { display: block; margin: 14px 0 6px; color: var(--text-soft); font-weight: 500; }
.auth-form input { width: 100%; }
.auth-err { color: var(--red); font-size: 13px; min-height: 20px; margin-top: 10px; }
.auth-form .btn-primary { margin-top: 6px; padding: 12px; }
.auth-tip { text-align: center; color: var(--muted); font-size: 12px; margin-top: 14px; }

/* ============ 主布局 ============ */
.app-wrap { display: flex; min-height: 100vh; }
.sidebar {
  width: 218px; background: var(--sidebar); color: #cdd0e4; position: sticky; top: 0;
  height: 100vh; display: flex; flex-direction: column; padding: 20px 14px; flex: none;
}
.side-logo { display: flex; align-items: center; gap: 10px; padding: 6px 10px 20px; }
.logo-ico {
  width: 38px; height: 38px; border-radius: 11px; font-size: 20px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
}
.logo-txt { font-weight: 700; color: #fff; font-size: 15px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 11px;
  color: #aab0cc; text-decoration: none; font-size: 14px; transition: .15s; cursor: pointer;
}
.nav-item i { font-style: normal; font-size: 17px; width: 22px; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; box-shadow: 0 4px 14px var(--glow); }
.side-user { border-top: 1px solid rgba(255,255,255,.09); padding: 14px 10px 4px; }
.u-email { font-size: 12.5px; color: #fff; word-break: break-all; margin-bottom: 4px; }
.u-credits { font-size: 12px; color: #9aa0c0; margin-bottom: 10px; }
.u-credits b { color: #ffd166; font-size: 15px; }
.btn-ghost-mini {
  width: 100%; background: transparent; color: #9aa0c0; border-color: rgba(255,255,255,.15);
}
.btn-ghost-mini:hover { color: #fff; border-color: #fff; }

.main { flex: 1; padding: 28px 34px; max-width: 1150px; margin: 0 auto; min-width: 0; }
.view-head { margin-bottom: 18px; }
.view-head h2 { font-size: 21px; margin-bottom: 6px; }
.view-head p { color: var(--muted); font-size: 13.5px; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 24px; margin-bottom: 16px; transition: background .25s;
}
.row-flex { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-right { display: flex; justify-content: flex-end; margin-top: 16px; }
.tip { margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: var(--primary-soft); color: var(--tip-text); font-size: 13px; }

/* ============ 问卷 ============ */
.survey-body { margin-top: 18px; display: flex; flex-direction: column; gap: 18px; }
.sq { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.sq-title { font-weight: 600; margin-bottom: 10px; }
.sq-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt-chip {
  border: 1.5px solid var(--border); border-radius: 999px; padding: 7px 15px;
  font-size: 13px; cursor: pointer; transition: .13s; background: var(--input); user-select: none; color: var(--text);
}
.opt-chip:hover { border-color: var(--primary); }
.opt-chip.on { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; border-color: transparent; }
.sq input[type=text] { width: 100%; }

/* ============ 快速出方案 ============ */
.cat-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 8px; }
.cat-grid label {
  display: flex; gap: 7px; align-items: center; border: 1px solid var(--border);
  padding: 9px 12px; border-radius: 10px; cursor: pointer; font-size: 13px; transition: .13s;
}
.cat-grid label:hover { border-color: var(--primary); }
.cat-grid label.on { background: var(--primary-soft); border-color: var(--primary); }
.plan-group {
  background: var(--soft); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 14px; transition: border .15s;
}
.plan-group:hover { border-color: var(--border-strong); }
.plan-group-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 600; flex-wrap: wrap; }
.pg-name { font-size: 14px; }
.pg-badge {
  font-size: 12px; font-weight: 500; color: var(--text-soft); background: var(--input);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px;
}
.pg-count { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-soft); }
.pg-count input { width: 62px; padding: 5px 8px; font-size: 13px; }
.pg-regen-state { margin-top: 8px; min-height: 0; }
.pg-regen-state:empty { display: none; }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; }
@media (max-width: 1100px) { .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .plan-grid { grid-template-columns: 1fr; } }
.plan-row {
  display: flex; gap: 8px; align-items: center; margin-bottom: 0;
  background: var(--input); border: 1px solid var(--border); border-radius: 10px;
  padding: 5px 9px; transition: opacity .15s, border .15s;
}
.plan-row:hover { border-color: var(--primary); }
.plan-row:has(.p-chk:not(:checked)) { opacity: .48; }
.plan-row input[type=checkbox] { flex: none; accent-color: var(--primary); }
.plan-row input[type=text] { flex: 1; padding: 5px 8px; font-size: 13px; border: none; background: transparent; }
.plan-row input[type=text]:focus { border: none; outline: none; box-shadow: 0 1.5px 0 var(--primary); border-radius: 0; }
.plan-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }

/* 历史记录 */
.hist-filter { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.hist-filter .btn-mini.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.hist-item { margin-bottom: 12px; padding: 14px 16px; }
.hist-top { display: flex; align-items: center; gap: 10px; }
.hist-title { font-size: 14px; }
.hist-badge { flex: none; font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.k-plan { background: #ede9fe; color: #6d28d9; }
.k-expert { background: #e0f2fe; color: #0369a1; }
.k-advf { background: #fef3c7; color: #b45309; }
.k-advq { background: #fce7f3; color: #be185d; }
.k-img { background: #dcfce7; color: #15803d; }
.hist-files { margin-top: 10px; }
.hist-img img { max-width: 220px; border-radius: 10px; margin: 6px 8px 0 0; cursor: zoom-in; }
.hist-qa { margin-top: 10px; font-size: 13.5px; }
.hist-qa summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.hist-q { margin-top: 8px; padding: 10px 12px; background: var(--soft-2); border-radius: 10px; }
.hist-a { margin-top: 8px; padding: 10px 12px; background: var(--soft-2); border-radius: 10px; }

/* 深色模式：历史徽章/推荐气泡改半透明底 */
html[data-mode="dark"] .k-plan { background: rgba(139,92,246,.22); color: #c4b5fd; }
html[data-mode="dark"] .k-expert { background: rgba(2,132,199,.22); color: #7dd3fc; }
html[data-mode="dark"] .k-advf { background: rgba(217,119,6,.22); color: #fcd34d; }
html[data-mode="dark"] .k-advq { background: rgba(219,39,119,.22); color: #f9a8d4; }
html[data-mode="dark"] .k-img { background: rgba(22,163,74,.22); color: #86efac; }
html[data-mode="dark"] .bubble.reco { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.4); }
html[data-mode="dark"] .reco-title { color: #fcd34d; }
html[data-mode="dark"] .reco-chip { background: transparent; color: #fcd34d; border-color: rgba(245,158,11,.5); }
html[data-mode="dark"] .reco-chip:hover:not(:disabled) { background: #f59e0b; color: #1e2233; }

/* 军师推荐文件气泡 */
.bubble.reco { background: #fffbeb; border: 1px solid #fde68a; }
.reco-title { font-size: 13.5px; font-weight: 600; color: #92400e; margin-bottom: 8px; }
.reco-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.reco-chip { border: 1px solid #f59e0b; background: var(--input); color: #92400e; border-radius: 999px;
  padding: 6px 14px; font-size: 13px; cursor: pointer; transition: all .15s; }
.reco-chip:hover:not(:disabled) { background: #f59e0b; color: #fff; }
.reco-chip:disabled { opacity: .6; cursor: wait; }
.reco-state { margin-top: 8px; font-size: 13px; }

/* 专家模式上传 Word */
.chat-input-bar .file-btn { display: inline-flex; align-items: center; cursor: pointer; flex: none; }
.sug-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.sug-chip { border: 1px solid var(--primary); color: var(--primary); background: var(--input);
  border-radius: 999px; padding: 5px 13px; font-size: 13px; cursor: pointer; transition: all .15s; }
.sug-chip:hover { background: var(--primary); color: #fff; }
.log-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; }
.job-state { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.job-state.run { color: var(--primary); }
.job-state.err { color: var(--red); }
.log-box {
  background: #14162b; color: #c7e0ff; font-family: Consolas, monospace; font-size: 12px;
  border-radius: 10px; padding: 12px 14px; max-height: 200px; overflow-y: auto; line-height: 1.7;
  white-space: pre-wrap; word-break: break-all;
}
.file-list { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.file-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 13px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 13px;
}
.file-item a { color: var(--primary); text-decoration: none; font-weight: 600; }
.file-item a:hover { text-decoration: underline; }

/* ============ 聊天 ============ */
.chat-card { display: flex; flex-direction: column; }
.chat-topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
/* 顶栏常规按钮：覆盖 .btn-ghost-mini 遗留的 width:100%，保证一行排列、醒目可见 */
.chat-topbar .topbar-btn {
  width: auto;
  background: var(--card);
  color: var(--primary);
  border: 1.5px solid var(--primary);
  font-weight: 600;
  padding: 7px 14px;
}
.chat-topbar .topbar-btn:hover { background: var(--primary); color: #fff; }
.chat-box {
  background: var(--soft); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; height: 430px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px;
  transition: background .25s;
}
.bubble { max-width: 82%; padding: 11px 15px; border-radius: 14px; font-size: 13.8px; line-height: 1.75; word-break: break-word; }
.bubble.user { align-self: flex-end; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; border-bottom-right-radius: 4px; }
.bubble.ai { align-self: flex-start; background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.bubble.sys { align-self: center; background: transparent; color: var(--muted); font-size: 12.5px; max-width: 92%; text-align: center; }
.bubble.ai h4 { margin: 6px 0 4px; color: var(--primary-dark); }
.bubble.ai b { color: var(--primary-dark); }
html[data-mode="dark"] .bubble.ai h4, html[data-mode="dark"] .bubble.ai b { color: var(--accent); }
html[data-mode="dark"] .adv-jump:hover { color: var(--accent); }
.bubble.ai table { border-collapse: collapse; margin: 8px 0; font-size: 12.5px; width: 100%; }
.bubble.ai td, .bubble.ai th { border: 1px solid var(--border); padding: 4px 8px; }
.bubble img.gen-img { max-width: 300px; max-height: 300px; border-radius: 10px; cursor: zoom-in; display: block; }
.img-meta { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.chat-input-bar { display: flex; gap: 10px; margin-top: 12px; align-items: flex-end; }
.chat-input-bar textarea { flex: 1; }
.quick-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.quick-chip {
  border: 1px solid var(--border); background: var(--input); border-radius: 999px; padding: 6px 13px;
  font-size: 12.5px; color: var(--text-soft); transition: .13s;
}
.quick-chip:hover { border-color: var(--primary); color: var(--primary); }
.img-bar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--soft);
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px;
}
.img-bar select { padding: 6px 8px; font-size: 12.5px; }

/* 军师卡片 */
.advisor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 14px; margin-bottom: 16px; }
.adv-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; cursor: pointer; transition: .18s; border: 2px solid transparent;
}
.adv-card:hover { transform: translateY(-3px); border-color: var(--pc, var(--primary)); }
.adv-emoji { font-size: 30px; margin-bottom: 8px; }
.adv-name { font-weight: 700; font-size: 15.5px; margin-bottom: 4px; color: var(--pc, var(--primary)); }
.adv-tag { font-size: 12.8px; color: var(--muted); line-height: 1.6; }

/* 专家模式问题卡 */
.eq { border: 1px solid var(--border); border-radius: 12px; padding: 13px 15px; margin-top: 10px; }
.eq-title { font-weight: 600; font-size: 13.5px; margin-bottom: 9px; }
.eq-opts { display: flex; flex-wrap: wrap; gap: 7px; }
.eq-extra { margin-top: 9px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.eq-extra input { flex: 1; min-width: 200px; padding: 6px 10px; font-size: 13px; }
.eq-sup { margin-top: 12px; }
.eq-sup-title { font-weight: 600; font-size: 13.5px; color: #2E8B57; margin-bottom: 6px; }
.eq-sup textarea { width: 100%; font-size: 13px; }

/* 军师回答里的跳转链接 */
.adv-jump { color: var(--primary); font-weight: 600; text-decoration: underline; cursor: pointer; }
.adv-jump:hover { color: var(--primary-dark); }
.plan-jump {
  color: var(--primary); font-weight: 700; text-decoration: underline; cursor: pointer;
  background: rgba(91,92,226,.08); border-radius: 5px; padding: 1px 4px; transition: .15s;
}
.plan-jump:hover { background: var(--primary); color: #fff; text-decoration: none; }
html[data-mode="dark"] .plan-jump { background: rgba(124,124,255,.15); }
html[data-mode="dark"] .plan-jump:hover { color: #fff; }

/* ============ 积分中心 ============ */
.credit-cards { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; margin-bottom: 16px; }
.credit-balance { background: linear-gradient(135deg, var(--primary-dark), var(--primary) 70%, var(--accent)); color: #fff; }
.cb-label { opacity: .8; font-size: 13px; }
.cb-num { font-size: 44px; font-weight: 800; margin: 8px 0 4px; }
.cb-sub { opacity: .75; font-size: 12.5px; }
.recharge-contact { font-size: 13.5px; line-height: 1.8; white-space: pre-wrap; }
.pw-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.pw-row input { flex: 1; min-width: 110px; padding: 8px 10px; font-size: 12.5px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 2px solid var(--border); }
.tbl td { padding: 8px 10px; border-bottom: 1px solid var(--border); transition: background .12s; }
.tbl tbody tr:hover td { background: var(--soft-2); }
.cost-plus { color: var(--green); font-weight: 700; }
.cost-minus { color: var(--red); font-weight: 700; }
.price-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.price-edit label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.price-edit input { width: 90px; padding: 7px 9px; font-size: 13px; }

/* ============ 通用 ============ */
.toast {
  position: fixed; top: 26px; left: 50%; transform: translateX(-50%);
  background: #23263e; color: #fff; padding: 11px 22px; border-radius: 999px;
  font-size: 13.5px; z-index: 999; box-shadow: 0 8px 30px rgba(0,0,0,.25); animation: pop .2s;
}
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
@keyframes pop { from { opacity: 0; transform: translateX(-50%) translateY(-8px); } }
.spin {
  display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%; animation: rot .7s linear infinite; vertical-align: -2px; margin-right: 6px;
}
.spin.dark { border-color: rgba(91,92,226,.3); border-top-color: var(--primary); }
@keyframes rot { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .auth-left { display: none; }
  .sidebar { width: 64px; }
  .logo-txt, .nav-item span:not(.ico), .u-email, .u-credits { display: none; }
  .main { padding: 18px; }
  .credit-cards { grid-template-columns: 1fr; }
}

/* 图片军师：参考图缩略图条（输入框下方） */
.ref-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ref-thumb { position: relative; width: 72px; height: 72px; border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; background: var(--soft); }
.ref-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: pointer; }
.ref-x { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; line-height: 16px;
  text-align: center; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff;
  font-size: 11px; cursor: pointer; user-select: none; }
.ref-x:hover { background: rgba(200,30,30,.85); }

/* 图片军师：用户消息里随文发出的参考图缩略图 */
.sent-refs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.sent-refs .sent-ref {
  width: 72px; height: 72px; object-fit: cover; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.45); display: block; background: #fff;
}
/* 编辑模式下被编辑的生成图缩略图：紫色描边，与参考图区分 */
.sent-refs .sent-ref-edit { border: 2px solid #ffd54d; box-shadow: 0 0 0 2px rgba(255,213,77,.35); }

/* 图片军师：输入框旁的参考图按钮（与生成按钮同排） */
.chat-input-bar .img-ref-btn { padding: 10px 14px; font-size: 13px; white-space: nowrap; }

/* 图片军师：编辑模式提示条（输入框上方，×取消） */
.img-edit-bar {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
  background: var(--primary-soft); border: 1px solid var(--primary); border-radius: 10px;
  padding: 7px 12px; font-size: 12.5px; color: var(--primary);
}
.img-edit-x {
  margin-left: auto; flex: none; border: none; background: transparent;
  color: var(--primary); border: 1px solid var(--primary); border-radius: 999px; padding: 4px 12px;
  font-size: 12px; cursor: pointer; transition: .15s;
}
.img-edit-x:hover { background: var(--primary); color: #fff; }

/* 图片军师：生成图卡片下的操作按钮（编辑图片 / 下载） */
.img-actions { display: flex; gap: 8px; margin-top: 7px; }
.img-actions .btn-mini { padding: 4px 11px; font-size: 12px; }
.img-actions .img-dl-btn { text-decoration: none; display: inline-flex; align-items: center; }

/* ============ 主题切换（侧栏） ============ */
body { transition: background .25s, color .25s; }
.side-theme {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 12px 10px; margin-bottom: 4px; border-top: 1px solid rgba(255,255,255,.09);
}
.theme-dots { display: flex; gap: 7px; align-items: center; }
.tdot {
  width: 18px; height: 18px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; box-shadow: 0 0 0 1px rgba(255,255,255,.28); transition: .15s;
}
.tdot:hover { transform: scale(1.15); }
.tdot.on { border-color: #fff; transform: scale(1.15); }
.tdot[data-accent="violet"] { background: linear-gradient(135deg, #5b5ce2, #7c3aed); }
.tdot[data-accent="blue"]   { background: linear-gradient(135deg, #2563eb, #0ea5e9); }
.tdot[data-accent="teal"]   { background: linear-gradient(135deg, #0d9488, #2dd4bf); }
.tdot[data-accent="orange"] { background: linear-gradient(135deg, #ea580c, #f59e0b); }
.mode-toggle {
  border: none; background: rgba(255,255,255,.08); color: #fff; border-radius: 8px;
  padding: 4px 9px; font-size: 14px; line-height: 1.4; transition: .15s;
}
.mode-toggle:hover { background: rgba(255,255,255,.18); }

/* 细滚动条（聊天区/日志/页面） */
.chat-box::-webkit-scrollbar, .log-box::-webkit-scrollbar, ::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 全屏等待遮罩 ============ */
.wait-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(30, 34, 60, .45);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
}
.wait-box {
  background: var(--card); border-radius: 18px;
  padding: 34px 44px; text-align: center; max-width: 380px;
  box-shadow: 0 12px 48px rgba(0,0,0,.22);
  animation: waitPop .25s ease-out;
}
@keyframes waitPop { from { transform: scale(.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.wait-spin {
  width: 46px; height: 46px; margin: 0 auto 16px;
  border: 4px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: rot .8s linear infinite;
}
.wait-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.wait-time { font-size: 13.5px; color: var(--muted); margin-bottom: 14px; }
.wait-time b { color: var(--primary); font-size: 15px; }
.wait-eta { font-size: 12.5px; }
.wait-tip {
  font-size: 12.5px; line-height: 1.7; color: #92400e;
  background: #fef3c7; border: 1px solid #f59e0b; border-radius: 10px; padding: 9px 12px;
}

/* ---- 行为记录（管理后台） ---- */
.ev-content { max-width: 420px; word-break: break-all; font-size: 12.5px; line-height: 1.6; }
.ev-fold { margin-top: 4px; }
.ev-fold summary { cursor: pointer; color: var(--accent, #6c5ce7); font-size: 12px; user-select: none; }
.ev-body { max-height: 260px; overflow-y: auto; white-space: pre-wrap; background: var(--bg, #f6f7fb);
  border: 1px solid var(--border, #e6e8f2); border-radius: 8px; padding: 8px 10px; margin-top: 6px;
  font-size: 12px; line-height: 1.7; }

/* ---- 居中确认弹窗（替代原生 confirm） ---- */
.confirm-box { max-width: 340px; padding: 30px 34px; }
.confirm-icon { font-size: 34px; margin-bottom: 10px; }
.confirm-msg { font-size: 14.5px; line-height: 1.8; color: var(--text); margin-bottom: 20px; font-weight: 500; }
.confirm-btns { display: flex; gap: 12px; justify-content: center; }
.confirm-btns .btn-primary { min-width: 96px; }
.confirm-btns .btn-mini { min-width: 96px; padding: 10px 20px; font-size: 14px; }
.confirm-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
/* 积分不足弹窗：按钮竖排，主按钮在顶部更醒目 */
.confirm-btns-col { flex-direction: column; gap: 10px; }
.confirm-btns-col .btn-primary, .confirm-btns-col .btn-mini { width: 100%; }
/* 管理员微信二维码弹窗 */
.qr-img { width: 220px; height: 220px; object-fit: contain; border-radius: 10px;
  border: 1px solid var(--border); background: #fff; margin: 4px 0 14px; }


/* ---- 管理后台·用户编辑（封禁/删除/积分直改） ---- */
.adm-ops { white-space: nowrap; }
.adm-btn {
  border: 1px solid var(--border-strong); background: var(--card); color: var(--text-soft);
  border-radius: 6px; padding: 3px 10px; font-size: 12px; cursor: pointer; margin-right: 4px;
}
.adm-btn:hover { border-color: var(--red); color: var(--red); }
.adm-danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
.adm-credit {
  width: 86px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text);
  border-radius: 6px; padding: 3px 8px; font-size: 13px; margin-right: 4px;
}
.row-banned td { opacity: .55; }
.row-banned td:nth-child(2) { opacity: 1; }


/* ---- 数据看板 ---- */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; text-align: center; }
.stat b { display: block; font-size: 22px; margin-bottom: 4px; word-break: break-all; }
.stat span { font-size: 12px; color: var(--muted); }
.stat.wide { grid-column: 1 / -1; text-align: left; }
.stat.wide b { font-size: 14px; font-weight: 600; line-height: 1.8; }

/* ---- 全站公告条 ---- */
.announce-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border-strong); border-left: 4px solid var(--red);
  border-radius: 10px; padding: 10px 14px; margin: 0 0 14px;
  color: var(--text); font-size: 14px; line-height: 1.6;
}
.announce-close {
  margin-left: auto; border: none; background: none; color: var(--muted);
  font-size: 16px; cursor: pointer; padding: 2px 6px; flex: none;
}
.announce-close:hover { color: var(--red); }
#announceEdit { width: 100%; }


/* ---- 移动端专项适配 ---- */
@media (max-width: 640px) {
  /* 表格横向滚动，不再挤压 */
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl { min-width: 560px; }
  /* 输入框 16px 防 iOS 聚焦自动放大 */
  input, select, textarea { font-size: 16px; }
  /* 触控目标加大 */
  .btn-primary, .btn-mini, .adm-btn, .nav-item { min-height: 38px; }
  .adm-btn { padding: 6px 12px; }
  .adm-credit { width: 76px; padding: 6px 8px; }
  /* 弹窗/遮罩适配小屏 */
  .wait-box, .confirm-box { width: 92vw; max-width: 92vw; }
  .confirm-btns .btn-primary, .confirm-btns .btn-mini { min-width: 110px; }
  /* 弹性行允许换行 */
  .row-flex { flex-wrap: wrap; gap: 8px; }
  .row-flex .btn-primary, .row-flex .btn-mini { flex: none; }
  /* 看板小屏两列 */
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  /* 气泡/正文留白收紧 */
  .view-head h2 { font-size: 20px; }
}


/* ---- 积分中断提示条（生成进度区 / 历史记录共用） ---- */
.partial-note {
  background: var(--bg); border: 1px solid var(--border-strong); border-left: 4px solid var(--red);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 10px;
  font-size: 13px; line-height: 1.7; color: var(--text);
}
