/* ============================================================
   AI教辅工具箱 网站版 · 全局样式
   色板与桌面版 src/styles.css 一致，页签栏抄 OriginalEdu 的 .oe-rail
   ============================================================ */
:root {
  --primary: #4f6ef7;
  --primary-dark: #3d5ae0;
  --primary-grad: linear-gradient(135deg, #4f6ef7, #6d5cf0);
  --bg: #eef1f8;
  --card: #ffffff;
  --text: #2b3245;
  --ink: #1c2438;
  --muted: #8a93a6;
  --border: #e4e8f1;
  --danger: #e5484d;
  --success: #30a46c;
  --warn: #b26a00;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 39, 70, .04), 0 8px 24px rgba(28, 39, 70, .06);
  --ring: 0 0 0 3px rgba(79, 110, 247, .16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; min-height: 100%;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--text); background: var(--bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- 用户中心顶部栏（原左侧栏改到上方）---------------- */
.user-top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap;
  padding: 10px 22px; background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border); box-shadow: 0 1px 4px rgba(28, 39, 70, .05);
}
.user-top .brand {
  display: flex; align-items: center; gap: 10px; flex: 0 0 auto;
  font-size: 14px; font-weight: 700; color: var(--ink);
}
.user-top .brand:hover { text-decoration: none; }
.user-top .brand .mark {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 10px;
  background: var(--primary-grad); color: #fff; font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; letter-spacing: .5px;
}
.user-top .brand .brand-t { display: flex; flex-direction: column; gap: 2px; white-space: nowrap; }
.user-top .brand small { font-size: 12px; font-weight: 400; color: var(--muted); }

.top-nav { display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; min-width: 0; }
.top-grp { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.top-sep { flex: 0 0 auto; width: 1px; height: 18px; background: #e2e7f2; }
.top-grp a.item {
  padding: 7px 12px; border-radius: 8px; font-size: 14px; color: #4a5468;
  white-space: nowrap; transition: all .16s ease;
}
.top-grp a.item:hover { background: #f3f6fd; color: var(--ink); text-decoration: none; }
.top-grp a.item.active { background: #edf1ff; color: var(--primary-dark); font-weight: 700; }

.top-side { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* 右上角的「生成记录」：跟用户卡片一样带边框，高度对齐头像卡片 */
.top-side .top-grp a.item {
  display: inline-flex; align-items: center; min-height: 44px;
  border: 1px solid #dbe3f7; background: #fff; padding: 0 14px; border-radius: 10px;
}
.top-side .top-grp a.item:hover { background: #f5f8ff; border-color: #cfd9f0; }
.top-side .top-grp a.item.active { background: #edf1ff; border-color: #cddcff; }
.top-lic {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  background: linear-gradient(135deg, #eef2ff, #f7f9ff); border: 1px solid #dbe3f7;
  font-size: 12px; color: #66708a; white-space: nowrap;
}
.top-lic:hover { text-decoration: none; border-color: #cfd9f0; }
.top-lic .lic-t { font-size: 12px; font-weight: 700; color: var(--ink); }
.top-lic .lic-d { font-weight: 700; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.top-lic .lic-s { color: var(--muted); }
.top-lic.off { background: linear-gradient(135deg, #fff6e6, #fffaf0); border-color: #f0dcae; }
.top-lic.off .lic-t { color: #8a5a00; }
/* 顶栏「余额」：实心蓝色药丸，数字由接口返回的 balance 刷新 */
.top-side .top-grp a.item.bal {
  background: var(--primary-grad); border-color: transparent; color: #fff; font-weight: 700;
}
.top-side .top-grp a.item.bal:hover { background: var(--primary-grad); border-color: transparent; color: #fff; filter: brightness(1.06); }
.top-side .top-grp a.item.bal.active { background: var(--primary-grad); border-color: transparent; color: #fff; }
.top-side .top-grp a.item.bal span { font-variant-numeric: tabular-nums; }

/* 右上角用户菜单（头像 + 打码手机号 + 用户类型，点开为下拉菜单） */
.user-menu { position: relative; }
.user-menu .um-btn {
  display: flex; align-items: center; gap: 9px; padding: 3px 10px 3px 4px;
  background: #fff; border: 1px solid transparent; border-radius: 12px;
  font: inherit; color: var(--ink); text-align: left; cursor: pointer;
}
.user-menu .um-btn:hover,
.user-menu.open .um-btn { background: #f5f8ff; border-color: #e3eaf7; }
.um-ava {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 50%;
  background: #e8efff; color: #3b6ef0;
  display: flex; align-items: center; justify-content: center;
}
.user-menu .um-txt { display: flex; flex-direction: column; gap: 4px; }
.user-menu .um-name {
  font-size: 14px; font-weight: 700; line-height: 1; color: var(--ink);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.um-badge {
  align-self: flex-start; padding: 2px 7px; border-radius: 6px; line-height: 1.1;
  font-size: 11px; font-weight: 600; color: #3b6ef0;
  background: #eef3ff; border: 1px solid #d7e2fb; white-space: nowrap;
}
.um-badge.ok { color: #0f8a5f; background: #eaf8f1; border-color: #c3ecd9; }
.user-menu .um-drop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  display: none; min-width: 172px; padding: 6px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(28, 39, 70, .14);
}
.user-menu.open .um-drop { display: block; }
.user-menu .um-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 8px; font-size: 14px; color: #333b4d; white-space: nowrap;
}
.user-menu .um-item svg { flex: 0 0 auto; color: #6b7488; }
.user-menu .um-item:hover { background: #f3f6fd; color: var(--ink); text-decoration: none; }
.user-menu .um-item.danger:hover { background: #fdf1f1; color: var(--danger); }
.user-menu .um-item.danger:hover svg { color: var(--danger); }
.user-menu button.um-item {
  width: 100%; background: none; border: 0; font: inherit; font-size: 14px;
  text-align: left; cursor: pointer;
}
.user-menu .um-item:focus { outline: none; }
.user-menu .um-item:focus-visible { outline: none; background: #f3f6fd; color: var(--ink); }

/* ---------------- 手机端汉堡菜单 + 左侧抽屉 ---------------- */
.top-burger {
  display: none; align-items: center; justify-content: center; margin-left: auto;
  width: 40px; height: 38px; padding: 0; cursor: pointer;
  background: #fff; border: 1px solid #dbe3f7; border-radius: 10px; color: #333b4d;
}
.top-burger:hover { background: #f5f8ff; border-color: #cfd9f0; }
.m-mask { position: fixed; inset: 0; z-index: 940; background: rgba(24, 32, 54, .42); }
.m-mask[hidden] { display: none; }
body.m-open { overflow: hidden; }
.m-drawer {
  position: absolute; top: 0; left: 0; bottom: 0; width: 274px; max-width: 84vw;
  display: flex; flex-direction: column; overflow-y: auto; background: #fff;
  box-shadow: 0 12px 40px rgba(24, 32, 54, .22);
}
/* 只写 from：动画不填充，任何情况下抽屉都停在原位（可见） */
.m-mask:not([hidden]) .m-drawer { animation: drawer-in .18s ease-out; }
@keyframes drawer-in { from { transform: translateX(-100%); } }
.md-user {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 16px 12px 16px 14px;
  background: linear-gradient(135deg, #eef2ff, #f8faff); border-bottom: 1px solid #e6ebf7;
}
.md-uinfo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.md-name {
  font-size: 15px; font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.md-x {
  flex: none; margin-left: auto; width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: transparent; color: #98a1b3; font-size: 20px; line-height: 1; cursor: pointer;
}
.md-x:hover { background: #eaf0fd; color: var(--ink); }
.md-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.md-sep { flex: none; height: 1px; margin: 6px 10px; background: var(--border); }
.md-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 10px; border: 0; border-radius: 9px;
  background: none; font: inherit; font-size: 15px; color: #333b4d; text-align: left;
  white-space: nowrap; cursor: pointer;
}
.md-item svg { flex: 0 0 auto; color: #6b7488; }
.md-item:hover { background: #f3f6fd; color: var(--ink); text-decoration: none; }
.md-item.active { background: #eef2ff; color: var(--primary-dark); font-weight: 700; }
.md-item.active svg { color: var(--primary); }
.md-item.danger { color: var(--danger); }
.md-item.danger svg { color: #d4757a; }
.md-item.danger:hover { background: #fdf1f1; }
#activate { scroll-margin-top: 76px; }

/* 用户设置页：账号卡片 */
.us-hero {
  position: relative; overflow: hidden; margin-bottom: 14px; padding: 20px 24px 22px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.us-hero::after {
  content: ""; position: absolute; top: 0; right: 0; width: 48%; height: 100%; pointer-events: none;
  background-image: radial-gradient(#cfdcf6 1.2px, transparent 1.2px);
  background-size: 10px 10px; opacity: .55;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 60%);
  mask-image: linear-gradient(90deg, transparent, #000 60%);
}
.us-hero-t { position: relative; z-index: 1; margin-bottom: 16px; font-size: 15px; font-weight: 700; color: var(--ink); }
.us-hero-body { position: relative; z-index: 1; display: flex; align-items: center; gap: 16px; }
.us-ava {
  flex: 0 0 auto; width: 54px; height: 54px; border-radius: 50%;
  background: #e8efff; color: #3b6ef0; display: flex; align-items: center; justify-content: center;
}
.us-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.us-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.us-name { font-size: 20px; font-weight: 700; letter-spacing: .2px; color: var(--ink); font-variant-numeric: tabular-nums; }
.us-badge {
  padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600;
  color: #3b6ef0; background: #eef3ff; border: 1px solid #d7e2fb;
}
.us-badge.ok { color: #0f8a5f; background: #eaf8f1; border-color: #c3ecd9; }
.us-meta { display: flex; gap: 26px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.us-meta .v { color: #3a4256; }
.us-meta .v.exp { color: var(--danger); }
.us-rec td:first-child { font-weight: 600; color: var(--ink); }
.top-side .side-user { margin-top: 0; }
.top-side .side-out { align-self: center; }
.user-main { padding: 18px 22px 40px; min-width: 0; }

.nav-grp { padding: 14px 12px 6px; font-size: 12px; font-weight: 700; letter-spacing: .6px; color: #a3abbd; }
.side-user {
  display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 8px 10px;
  border-radius: 10px; color: var(--ink); font-size: 14px; font-weight: 600;
}
.side-user:hover { background: #f3f6fd; text-decoration: none; }
.side-user .ava {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; background: var(--primary-grad);
  color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.side-user .nm { overflow: hidden; white-space: nowrap; }
.side-out {
  align-self: flex-start; padding: 4px 10px 4px 12px; font-size: 13px; color: var(--muted);
  border-radius: 8px;
}
.side-out:hover { background: #fdf1f1; color: var(--danger); text-decoration: none; }

/* ---------------- 页面骨架 ---------------- */
.wrap { max-width: 1440px; margin: 0 auto; padding: 18px 24px 40px; }
.wrap--narrow { max-width: 1080px; }
.page-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 18px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.page-bar h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); }
.page-bar .desc { color: var(--muted); font-size: 13px; margin-top: 3px; }
/* 生成记录页：标题左侧显示当前用户头像 */
.rec-head { display: flex; align-items: center; gap: 12px; }
.rec-ava {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #e8efff; border: 1px solid #d7e2fb;
  color: #3b6ef0; font-size: 17px; font-weight: 700; line-height: 1;
}
.page-title { font-size: 24px; letter-spacing: .5px; margin: 0 0 8px; }
.page-sub { color: var(--muted); margin: -4px 0 22px; font-size: 14px; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 14px;
}
.sec-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: linear-gradient(90deg, #e9f0ff, #f6f9ff 65%);
  border: 1px solid #dbe5fb; border-left: 3px solid var(--primary); border-radius: 10px;
  padding: 10px 14px; margin: 0 0 14px; font-size: 14px; font-weight: 700; color: var(--ink);
}
.sec-bar .tip { font-weight: 400; font-size: 12px; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* 一行几项看屏宽自己排，保证下拉里的长选项文字不被压扁（知识卡片那行四项） */
.grid-fit { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
/* 设置表单：卡内一行两个字段 */
.set-grid { display: grid; gap: 14px 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.set-grid .span-all { grid-column: 1 / -1; }
/* 设置分组卡片：一行两张卡，只有一组时铺满 */
.set-cards { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.set-cards.one-col { grid-template-columns: minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }

/* 选项卡：分段控件 */
.seg {
  display: inline-flex; gap: 3px; padding: 3px;
  background: #e7ebf4; border-radius: 11px;
}
.seg a {
  padding: 8px 22px; border-radius: 9px; font-size: 14px; font-weight: 600;
  color: #5b6780; white-space: nowrap; transition: all .16s ease;
}
.seg a:hover { color: var(--primary-dark); text-decoration: none; }
.seg a.active { background: #fff; color: var(--primary-dark); box-shadow: 0 1px 4px rgba(28, 39, 70, .14); }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 13px; color: #66708a; margin-bottom: 6px; font-weight: 600; }
.input, .select, textarea {
  width: 100%; padding: 9px 12px; font-size: 14px; font-family: inherit;
  color: var(--text); background: #fff; outline: none;
  border: 1px solid #dde3ee; border-radius: 9px; transition: border .18s, box-shadow .18s;
}
.input::placeholder, textarea::placeholder { color: #aeb6c6; }
.input:hover, .select:hover, textarea:hover { border-color: #c6cfe1; }
.input:focus, .select:focus, textarea:focus { border-color: var(--primary); box-shadow: var(--ring); }
textarea { resize: vertical; min-height: 120px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.inline-tip { background: #fffbe6; border: 1px solid #ffe58f; border-radius: 8px; padding: 8px 12px; font-size: 12px; color: #4d3c0a; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; font-size: 14px; font-weight: 600; cursor: pointer;
  color: #3b445c; background: #fff; border: 1px solid #dde3ee; border-radius: 9px;
  transition: all .18s ease; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(30, 40, 80, .12); text-decoration: none; }
.btn:active { transform: none; box-shadow: none; }
.btn:focus-visible { box-shadow: var(--ring); outline: none; }
.btn.primary {
  background: var(--primary-grad); color: #fff; border-color: transparent;
  box-shadow: 0 4px 12px rgba(79, 110, 247, .28);
}
.btn.primary:hover { box-shadow: 0 6px 18px rgba(79, 110, 247, .36); }
.btn.danger { color: var(--danger); border-color: #f1c6c8; background: #fff; }
.btn.danger:hover { background: #fdf1f1; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--primary); }
.btn.ghost:hover { background: #f2f5fd; box-shadow: none; }
.btn.small { padding: 5px 11px; font-size: 12px; }
.btn.tint-blue { color: #2f5fe0; border-color: #c9d8fb; background: #eef3fe; }
.btn.tint-blue:hover { background: #e2ebfd; }
.btn.tint-green { color: #14854b; border-color: #bfe6d0; background: #ecf8f1; }
.btn.tint-green:hover { background: #ddf3e6; }
.btn.tint-amber { color: #b25b09; border-color: #f3d9b5; background: #fdf5e8; }
.btn.tint-amber:hover { background: #fbebd3; }
.btn.tint-cyan { color: #0b7f96; border-color: #bfe3ea; background: #ecf8fb; }
.btn.tint-cyan:hover { background: #ddf1f7; }
.btn.tint-violet { color: #6b3fd4; border-color: #d8ccf7; background: #f4f0fe; }
.btn.tint-violet:hover { background: #eae2fd; }
.btn.tint-red { color: #c5343a; border-color: #f5c2c5; background: #fdf1f1; }
.btn.tint-red:hover { background: #fbe4e4; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------------- 状态块 ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: #e6f7ef; color: var(--success); }
.badge.warn { background: #fff3e0; color: var(--warn); }
.badge.err { background: #fdecec; color: var(--danger); }
.badge.wait { background: #eef1f8; color: #7b8499; }
.ocr-prog { font-size: 12px; color: var(--muted); margin-top: 5px; max-width: 240px; line-height: 1.45; }
.ocr-prog:empty { display: none; }
.badge.err + .ocr-prog { color: var(--danger); }
.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px;
  border-radius: 999px; background: #f1f4fa; border: 1px solid #e4e9f3;
  font-size: 12px; color: #5b6780; font-weight: 600;
}
.empty { text-align: center; color: var(--muted); padding: 46px 20px; font-size: 14px; }
.empty::before {
  content: ""; display: block; width: 54px; height: 54px; margin: 0 auto 12px;
  border-radius: 16px; background: #f5f7fc; border: 1px dashed #d7dfef;
}
.divider { height: 1px; background: var(--border); margin: 18px 0; }

/* ---------------- 表格（管理中心）---------------- */
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th, table.tb td { padding: 10px 12px; border-bottom: 1px solid #eef1f7; text-align: left; vertical-align: middle; }
table.tb th {
  background: #f5f8fd; color: #5b6780; font-size: 12px; font-weight: 700; letter-spacing: .3px;
  white-space: nowrap; border-bottom: 1px solid #e6ebf4;
}
table.tb th:first-child { border-top-left-radius: 10px; }
table.tb th:last-child { border-top-right-radius: 10px; }
table.tb tbody tr:last-child td, table.tb tr:last-child td { border-bottom: none; }
table.tb tr:hover td { background: #f7faff; }
table.tb td.ops { white-space: nowrap; }
table.tb .mono { font-family: Consolas, Menlo, monospace; }
/* 风格管理：提示词动辄几百字，列表只给一截，鼠标悬浮看全文 */
table.tb td.prompt-cell { min-width: 430px; max-width: 620px; color: #46536e; line-height: 1.7; }
table.tb td.prompt-cell .muted { font-size: 12px; color: #97a2b8; white-space: nowrap; }

.filters {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; box-shadow: var(--shadow);
}
.filters .input, .filters .select { width: auto; min-width: 160px; }

.pager { display: flex; align-items: center; gap: 6px; margin-top: 14px; font-size: 13px; }
.pager a, .pager span.cur {
  padding: 5px 11px; border: 1px solid #dde3ee; border-radius: 8px; background: #fff; color: #3b445c;
}
.pager a:hover { border-color: var(--primary); color: var(--primary-dark); text-decoration: none; }
.pager span.cur { background: var(--primary-grad); border-color: transparent; color: #fff; font-weight: 700; }
.pager .muted { border: none; background: none; color: var(--muted); }

/* ---------------- 统计卡 ---------------- */
.stat {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 6px;
  padding: 16px 18px;
}
.stat::after {
  content: ""; position: absolute; right: -26px; top: -26px; width: 92px; height: 92px;
  border-radius: 50%; background: rgba(79, 110, 247, .10);
}
.stat .num { font-size: 28px; font-weight: 800; color: var(--ink); line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat .lbl { font-size: 12px; color: var(--muted); letter-spacing: .3px; }
.stat.blue::after { background: rgba(79, 110, 247, .12); }
.stat.green::after { background: rgba(48, 164, 108, .12); }
.stat.orange::after { background: rgba(226, 148, 34, .14); }
.stat.purple::after { background: rgba(139, 92, 246, .12); }

/* ---------------- 登录/注册 ---------------- */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background: linear-gradient(135deg, #e7eefc 0%, #f5f7ff 45%, #e3eafa 100%);
}
.auth-card {
  width: 100%; max-width: 420px; background: #fff; border: 1px solid #e3e9f7;
  border-radius: 16px; box-shadow: 0 18px 50px rgba(40, 60, 120, .12); padding: 30px 30px 26px;
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 20px; font-weight: 700; text-align: center; color: var(--ink); margin-bottom: 4px; }
.auth-brand .mark {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 11px; background: var(--primary-grad);
  color: #fff; font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.auth-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.auth-alt { text-align: center; font-size: 13px; color: var(--muted); margin-top: 16px; }

/* 前台登录/注册：左侧品牌区 + 右侧表单卡片 */
.auth-page.auth-split {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: stretch;
  min-height: 100vh; min-height: 100dvh; padding: 0;
}
.auth-hero {
  position: relative; overflow: hidden; display: flex; flex-direction: column;
  justify-content: space-between; gap: 40px; padding: 44px 52px; color: #fff;
  background: linear-gradient(150deg, #4f6ef7, #5a58e8 55%, #6d5cf0);
}
.auth-hero::after {
  content: ""; position: absolute; right: -120px; bottom: -140px; width: 380px; height: 380px;
  border-radius: 50%; background: rgba(255, 255, 255, .1);
}
.hero-top { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.hero-mark {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 13px; background: rgba(255, 255, 255, .18);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800;
}
.hero-name { font-size: 18px; font-weight: 700; white-space: nowrap; }
.hero-slogan { position: relative; z-index: 1; font-size: 30px; font-weight: 800; line-height: 1.5; }
.auth-side { display: flex; align-items: center; justify-content: center; padding: 32px 24px; }
.auth-h { font-size: 22px; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.auth-tip { font-size: 13px; color: var(--muted); margin-bottom: 22px; }
.alert {
  background: #fdecec; border: 1px solid #f1c6c8; border-left: 4px solid var(--danger);
  color: #8a1f22; border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px;
}
.alert.ok { background: #e9f8f0; border-color: #b7e3c9; border-left-color: var(--success); color: #1c6b45; }

@media (max-width: 900px) {
  .auth-page.auth-split { grid-template-columns: minmax(0, 1fr); align-content: start; }
  /* 手机上品牌区收成顶部一条，只留图标 + 站名 */
  .auth-hero { flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; padding: 14px 18px; }
  .auth-hero::after, .hero-slogan { display: none; }
  .auth-side { align-items: flex-start; padding: 20px 16px 34px; }
  .auth-page.auth-split .auth-card { padding: 22px 20px; box-shadow: 0 10px 30px rgba(40, 60, 120, .1); }
  /* 输入框 16px：iOS 聚焦时不会再自动放大整页 */
  .auth-page.auth-split .input { font-size: 16px; }
}

/* ---------------- 管理端外壳 ---------------- */
.adm-shell { display: flex; min-height: 100vh; }
.adm-side {
  flex: 0 0 246px; background: #fff; border-right: 1px solid var(--border);
  padding: 18px 12px 16px; display: flex; flex-direction: column; gap: 3px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.adm-side::-webkit-scrollbar { width: 6px; }
.adm-side::-webkit-scrollbar-thumb { background: #dfe4ee; border-radius: 3px; }
.adm-side .brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 700; color: var(--ink);
  padding: 2px 8px 16px; margin-bottom: 10px; border-bottom: 1px solid var(--border);
}
.adm-side .brand .mark {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 10px;
  background: var(--primary-grad); color: #fff; font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; letter-spacing: .5px;
}
.adm-side .brand .brand-t { display: flex; flex-direction: column; gap: 2px; white-space: nowrap; }
.adm-side .brand small { font-size: 12px; font-weight: 400; color: var(--muted); }
.adm-side a.item {
  position: relative; padding: 9px 12px 9px 15px; border-radius: 9px;
  color: #4a5468; font-size: 14px; white-space: nowrap; transition: all .16s ease;
}
.adm-side a.item:hover { background: #f3f6fd; color: var(--ink); text-decoration: none; }
.adm-side a.item.active { background: #edf1ff; color: var(--primary-dark); font-weight: 700; }
.adm-side a.item.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--primary-grad);
}
.adm-main { flex: 1 1 auto; min-width: 0; padding: 18px 22px 40px; }
.adm-top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 6px;
  min-height: 54px; padding: 10px 16px; margin-bottom: 16px;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(6px);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow);
}
.adm-top h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); }
.adm-top .top-link {
  font-size: 14px; color: #5b6780; padding: 7px 12px; border-radius: 8px; white-space: nowrap;
}
.adm-top .top-link:hover { background: #f2f5fd; color: var(--primary-dark); text-decoration: none; }
.adm-top .who {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px;
  border: 1px solid var(--border); border-radius: 999px; color: #3b445c; font-size: 14px; white-space: nowrap;
}
.adm-top .who:hover { background: #f7f9ff; text-decoration: none; border-color: #cfd9f0; }
.adm-top .who .ava {
  width: 26px; height: 26px; border-radius: 50%; background: var(--primary-grad); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.adm-top .who .out { font-size: 12px; color: var(--muted); }

/* ---------------- 分步向导 ---------------- */
/* 分页卡片：竖版比例，像一张卡片图；正文只读展示，点开才进弹窗编辑 */
.page-view {
  aspect-ratio: 3 / 4; height: auto; min-height: 240px; overflow: hidden; padding: 10px 12px; cursor: pointer;
  font-size: 13px; line-height: 1.75; white-space: pre-wrap; word-break: break-word;
  background: #fbfcfe; border: 1px dashed var(--border); border-radius: 9px;
}
.page-view:hover { border-style: solid; border-color: var(--primary); background: #f7faff; }
.page-view.is-empty { color: var(--muted); }
/* 分页卡片：扁平样式——蓝色页码 + 描边小按钮，正文直接铺开，不套虚线框 */
.card.pg-card { margin: 0; padding: 14px; box-shadow: none; }
.pgc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
/* 页码和按钮都不许被挤：宁可换行也不把「第 1 页」压成竖排 */
.pgc-head .pgc-title { flex: 0 0 auto; }
.pgc-head .row { gap: 8px; flex: 0 0 auto; flex-wrap: nowrap; }
.pgc-title { font-size: 15px; font-weight: 700; color: var(--primary); }
.pgc-head .btn { padding: 4px 12px; font-size: 12px; color: var(--primary); border-color: #c9d6fb; border-radius: 6px; }
.pgc-head .btn.danger { color: var(--danger); border-color: #f1c6c8; }
.pg-card .page-view { padding: 0; background: transparent; border: 0; border-radius: 0; }
.pg-card .page-view:hover { background: transparent; }
/* 分页卡片：编辑/删除放页头，字数在页脚右下 */
.pg-cnt { font-size: 12px; color: var(--muted); text-align: right; margin-top: 8px; }
/* 分页列表：一行 4 个，最多露两行（8 个），再多内部滚动；两行高度由脚本按实际卡片高设置 */
#pageList.grid-4 { overflow-y: auto; align-content: start; scrollbar-gutter: stable; padding-right: 4px; }
/* 每步卡片底部整行：设置项 + 上一步/下一步，同一条底栏（虚线分隔，像卡片页脚） */
.step-foot {
  margin-top: 16px; padding-top: 13px; border-top: 1px dashed var(--border);
}
.step-foot .tip { font-size: 12px; color: var(--muted); }
.step-foot .btn.primary { padding: 8px 20px; border-radius: 999px; }
/* 第 1 步底栏：分页设置（小输入框）和下一步同一行；改页数会自动重切，所以没有「重新切分」 */
.split-foot { gap: 8px; }
.split-foot label { font-size: 13px; font-weight: 600; color: var(--ink); flex: none; }
.split-foot .input { width: 92px; flex: none; padding: 6px 8px; }
.split-foot .unit { font-size: 13px; color: #66708a; flex: none; }
/* 两栏流程页：左栏放提示词 + 运行日志，右栏宽（流程条 + 当前这一步） */
.flow-2 { grid-template-columns: minmax(0, 400px) minmax(0, 1fr); align-items: start; }
.flow-left { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* 运行日志限高写在 CSS 里，手机上可以改（内联 style 优先级压不住） */
.flow-left #runLog { min-height: 150px; max-height: 260px; }
/* 右栏铺到页面底部：高度由脚本按位置设置，当前这一步的卡片吃满剩余高度 */
.flow-right { display: flex; flex-direction: column; min-width: 0; }
.flow-right .step-pane { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.flow-right .step-pane > .step-foot { margin-top: auto; }
.flow-right #matBox { flex: 1 1 auto; min-height: 320px; margin-bottom: 16px; }
/* 提示词框和分页编辑框的高度放 CSS 里，手机上才改得动（内联 style 优先级压不住） */
#source { min-height: 300px; }
#pgText { min-height: 300px; }
/* 批量出图：内容区在卡片内部滚动（底部按钮始终可见，卡片不撑出窗口） */
.flow-right .step-pane > .pane-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden;
  scrollbar-gutter: stable; padding-right: 4px; padding-bottom: 2px;
}
.steps { display: flex; align-items: center; flex-wrap: wrap; row-gap: 10px; margin-bottom: 18px; }
.step {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: #98a1b3; white-space: nowrap;
}
.step .no {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  background: #fff; border: 1px solid #e6ebf4; color: #98a1b3;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.step.active { color: var(--primary-dark); font-weight: 700; }
.step.active .no {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 4px 10px rgba(79, 110, 247, .28);
}
.step.done { color: #5a6478; }
.step.done .no { background: var(--success); border-color: var(--success); color: #fff; }
.step-line { flex: 1 1 auto; min-width: 24px; height: 1px; background: #e6ebf4; margin: 0 16px; }

/* ---------------- 竖排流程说明（课本下载三步） ---------------- */
.dl-grid { grid-template-columns: minmax(0, 380px) minmax(0, 1fr); align-items: start; }
.flow-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; }
.flow-step { display: flex; gap: 12px; margin-bottom: 16px; }
.flow-step:last-child { margin-bottom: 0; }
.flow-no {
  flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%; background: #22293c; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.flow-name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flow-tip { font-size: 13px; color: var(--muted); line-height: 1.75; margin-top: 4px; }

/* ---------------- 下载进度 ---------------- */
.bar-track { height: 8px; border-radius: 999px; background: #e8ecf6; overflow: hidden; }
.bar-fill { height: 100%; width: 0; border-radius: 999px; background: var(--primary); transition: width .3s ease; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-pct { font-size: 13px; color: var(--muted); flex: 0 0 auto; }
.book-line { display: flex; gap: 14px; align-items: flex-start; }
.book-cover {
  flex: 0 0 96px; width: 96px; height: 132px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--border); background: #f4f6fb;
}
.book-name { font-size: 15px; font-weight: 600; line-height: 1.6; }
.book-tag { font-size: 13px; color: var(--muted); margin-top: 6px; }
.err-box {
  margin-top: 14px; padding: 11px 14px; font-size: 13px; line-height: 1.7; word-break: break-all;
  background: #fdecec; border: 1px solid #f7c7c7; border-left: 4px solid var(--danger);
  border-radius: 10px; color: #a11f24;
}
.ok-box {
  margin-top: 14px; padding: 12px 14px; font-size: 14px;
  background: #e6f7ef; border: 1px solid #bde7d1; border-left: 4px solid var(--success);
  border-radius: 10px; color: #136c46;
}

/* ---------------- 课本详情（识别正文）---------------- */
.dt-grid { grid-template-columns: minmax(0, 280px) minmax(0, 1fr); align-items: start; }
.chp-list a {
  display: block; padding: 8px 10px; margin-bottom: 6px; font-size: 13px; line-height: 1.5;
  color: var(--text); background: #f7f9fd; border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer;
}
.chp-list a:hover { border-color: var(--primary); color: var(--primary); }
.chp-list a:last-child { margin-bottom: 0; }
.pg-nav { display: flex; flex-wrap: wrap; gap: 6px; max-height: 220px; overflow: auto; }
.pg-nav a {
  min-width: 30px; padding: 4px 7px; text-align: center; font-size: 12px; color: #5b6780;
  background: #f5f7fc; border: 1px solid var(--border); border-radius: 7px; cursor: pointer;
}
.pg-nav a:hover { border-color: var(--primary); color: var(--primary); }
.pg-nav a.on { background: #eaf1ff; border-color: var(--primary); color: var(--primary); font-weight: 600; }
.pg-item { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px; background: #fff; }
.pg-item.on { border-color: var(--primary); box-shadow: 0 0 0 2px #eaf1ff; }
.pg-head {
  padding: 8px 14px; font-size: 13px; font-weight: 600; color: #5b6780;
  background: #f7f9fd; border-bottom: 1px solid var(--border); border-radius: 9px 9px 0 0;
}
.pg-text {
  padding: 12px 14px; font-size: 14px; line-height: 1.85; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
}
.empty.sm { padding: 14px 10px; font-size: 13px; text-align: left; }
.empty.sm::before { display: none; }

/* ---------------- 图片网格 ---------------- */
/* 「生成结果」整体框：浅蓝底 + 边框，把标题和网格一起包住 */
.result-box {
  border: 1px solid #cddcf0; border-radius: 12px; background: #f6faff;
  padding: 14px 16px 16px;
}
.result-box .img-cell { background: #fff; }
.img-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.img-cell {
  position: relative; border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: #fafbfe; min-height: 150px; display: flex; align-items: center; justify-content: center;
}
.img-cell img { width: 100%; display: block; cursor: zoom-in; }
.img-cell .st { font-size: 12px; color: var(--muted); padding: 16px; text-align: center; }
.img-cell .st.run { color: var(--primary); }
.img-cell .st.err { color: var(--danger); }
/* 每张图上的「下载 / 重新生成」，压在缩略图右下角、页码条上面 */
.img-cell .cell-ops { position: absolute; right: 6px; bottom: 26px; display: flex; gap: 6px; }
.img-cell .cell-ops .btn {
  padding: 3px 9px; font-size: 12px; background: rgba(255, 255, 255, .94);
  box-shadow: 0 1px 4px rgba(24, 32, 54, .18);
}
.img-cell .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 8px; font-size: 12px;
  text-align: center;
  background: rgba(255, 255, 255, .9); color: var(--muted);
}
/* 每格左上角的「选择生图」勾选框：按页勾，勾上的页才出图 */
.img-cell .pick {
  position: absolute; top: 6px; left: 6px; z-index: 2; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center; border-radius: 6px;
  background: rgba(255, 255, 255, .92); box-shadow: 0 1px 4px rgba(24, 32, 54, .18); cursor: pointer;
}
.img-cell .pick input { width: 14px; height: 14px; margin: 0; cursor: pointer; accent-color: #3b6ef0; }
/* 第 3 步结果格：按钮不再压在图上（两张并排会被裁掉），放到图下面、一行一个，电脑和手机同款 */
#imgGrid .img-cell { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; }
#imgGrid .img-cell .st { margin: auto 0; }
#imgGrid .cell-ops { position: static; display: flex; flex-direction: column; gap: 6px; padding: 8px 8px 0; }
#imgGrid .cell-ops .btn { width: 100%; padding: 5px 8px; font-size: 12.5px; }
#imgGrid .cap { position: static; margin-top: 6px; padding: 5px 8px 8px; }
/* 生成记录：一行最多 6 张缩略图，图内可放大 / 下载 / 删除 */
#imgBox { grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: start; }
/* 缩略图不锁宽高：宽度跟格子走，高度按图片自身比例，图不再被压扁或留白 */
#imgBox .img-cell { min-height: 0; background: #fff; border-color: #d3ddee; box-shadow: 0 1px 3px rgba(28, 39, 70, .06); }
#imgBox .img-cell img {
  width: 100%; height: auto; display: block; background: #fff; cursor: zoom-in;
}
#imgBox .cell-ops .btn { padding: 3px 7px; font-size: 11px; }
/* 记录卡片铺到页面底部：图多就往下排，图少也把内容区撑满，页脚分页贴底部（高度由脚本按实际位置算） */
#recCard { min-height: 60vh; display: flex; flex-direction: column; }
#recCard #imgBox, #recCard #tableBox, #recCard #empty { flex: 1 1 auto; }
#recCard .pager { margin-top: auto; padding-top: 14px; }
/* 图片放大预览 */
.lightbox {
  position: fixed; inset: 0; z-index: 950; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(12, 18, 32, .84); cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 92vw; max-height: 86vh; border-radius: 8px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .5); background: #fff;
}
.lightbox .lb-close { position: absolute; top: 18px; right: 18px; }
.out-box {
  min-height: 160px; max-height: 520px; overflow: auto; padding: 14px 16px; font-size: 14px;
  line-height: 1.75; white-space: pre-wrap; word-break: break-word;
  background: #fbfcfe; border: 1px dashed var(--border); border-radius: 10px;
}
/* 资料生成正文的空 / 等待 / 失败三种状态：圆形图标 + 主副两行，别只剩一个虚线小方块 */
#matBox .empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-sizing: border-box; min-height: 100%; padding: 30px 20px;
  text-align: center; white-space: normal; color: #7c869c; font-size: 13.5px; line-height: 1.7;
}
#matBox .empty::before {
  content: ""; display: block; width: 62px; height: 62px; margin: 0 0 14px;
  border: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px #d8e4fb;
  background: #eef4ff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%233b6ef0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5'/%3E%3Cpath d='M9 13h6M9 17h4'/%3E%3C/svg%3E") center / 30px 30px no-repeat;
}
#matBox .empty b { display: block; font-size: 15px; font-weight: 600; color: #33405c; }
#matBox .empty i { display: block; font-style: normal; margin-top: 4px; }
#matBox .empty.wait::before { animation: matBreath 1.5s ease-in-out infinite; }
#matBox .empty.bad { color: #b0383a; }
#matBox .empty.bad b { color: #b0383a; }
#matBox .empty.bad::before {
  box-shadow: inset 0 0 0 1px #f2d6d6;
  background-color: #fdefef;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23d9534f' stroke-width='1.6' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5v6M12 16.6v.4'/%3E%3C/svg%3E");
}
@keyframes matBreath { 50% { box-shadow: inset 0 0 0 1px #c3d5f8, 0 0 0 7px rgba(59, 110, 240, .09); } }
.log-box {
  max-height: 220px; overflow: auto; background: #1c2333; color: #d6e0f5;
  border-radius: 10px; padding: 10px 12px; font-size: 12px; line-height: 1.7;
  font-family: Consolas, Menlo, monospace; white-space: pre-wrap;
}
.log-box .t { color: #7f95c0; }
.log-box .e { color: #ffb4ab; }

/* ---------------- Toast ---------------- */
.toast-wrap { position: fixed; top: 18px; right: 22px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #fff; border: 1px solid var(--border); box-shadow: 0 10px 30px rgba(28, 39, 70, .14);
  border-radius: 10px; padding: 12px 18px; font-size: 14px; border-left: 4px solid var(--primary);
  animation: slide-in .25s ease; max-width: 380px;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
@keyframes slide-in { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 900; overflow: auto;
  background: rgba(24, 32, 54, .45);
  display: flex; align-items: center; justify-content: center; padding: 24px 16px;
}
.modal-mask[hidden] { display: none; }
.modal {
  width: 100%; max-width: 620px; margin: auto; background: #fff; border-radius: 14px;
  box-shadow: 0 18px 48px rgba(24, 32, 54, .24); animation: pop-in .18s ease;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; gap: 10px; padding: 15px 18px;
  border-bottom: 1px solid var(--border); border-radius: 14px 14px 0 0;
  background: linear-gradient(180deg, #fafbff, #fff);
  font-size: 16px; font-weight: 700; color: var(--ink);
}
.modal-body { padding: 16px 18px 18px; }

/* ---------------- 积分充值弹窗 ---------------- */
.rc-modal { max-width: 400px; }
.rc-stat {
  display: flex; gap: 10px; margin-bottom: 14px; padding: 11px 14px;
  background: #f6f8fd; border: 1px solid var(--border); border-radius: 10px;
}
.rc-stat > div { flex: 1; min-width: 0; }
.rc-stat small { display: block; margin-bottom: 2px; font-size: 12px; color: var(--muted); }
.rc-stat b { display: block; font-size: 14px; color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-stat .rc-num { font-size: 20px; line-height: 1.25; font-family: Consolas, Menlo, monospace; }
.rc-stat .rc-num em { font-style: normal; font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.rc-big { height: 46px; font-size: 17px; }
.code-box {
  max-height: 260px; overflow: auto; margin: 10px 0 0; padding: 10px 12px;
  background: #f6f8fd; border: 1px solid var(--border); border-radius: 9px;
  font-family: Consolas, Menlo, monospace; font-size: 13px; line-height: 1.8;
  white-space: pre-wrap; word-break: break-all;
}

/* ---------------- 确认弹窗（Jf.confirm）---------------- */
.cfm-mask {
  position: fixed; inset: 0; z-index: 960; overflow: auto;
  background: rgba(24, 32, 54, .45);
  display: flex; align-items: center; justify-content: center; padding: 24px 16px;
}
.cfm {
  width: 100%; max-width: 380px; margin: auto; padding: 22px 22px 18px;
  background: #fff; border-radius: 14px; box-shadow: 0 18px 48px rgba(24, 32, 54, .24);
  animation: pop-in .18s ease; text-align: center;
}
.cfm-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.cfm-text { margin-top: 8px; font-size: 13px; line-height: 1.7; color: var(--muted); }
.cfm-ops { display: flex; gap: 10px; margin-top: 18px; }
.cfm-ops .btn { flex: 1; height: 38px; }
.cfm-yes.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.cfm-yes.danger:hover { background: #d13c41; border-color: #d13c41; }

/* ---------------- 卡密激活弹窗 ---------------- */
.act-modal { max-width: 420px; }
.act-head {
  position: relative; padding: 20px 20px 0; text-align: center;
  font-size: 17px; font-weight: 700; color: var(--ink);
}
.act-x {
  position: absolute; top: 12px; right: 12px; width: 30px; height: 30px;
  border: 0; background: transparent; border-radius: 8px; cursor: pointer;
  font-size: 20px; line-height: 1; color: #98a1b3;
}
.act-x:hover { background: #f3f6fd; color: var(--ink); }
.act-body { padding: 18px 22px 22px; }
.act-input { height: 46px; font-size: 15px; }
.act-tips { margin: 12px 0 18px; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.9; }
.act-btn { width: 100%; height: 44px; font-size: 15px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1200px) {
  .wrap { padding: 14px 16px 32px; }
  .img-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #imgBox { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #pageList.grid-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .grid-2, .grid-3, .set-cards, .dl-grid, .dt-grid, .flow-2 { grid-template-columns: minmax(0, 1fr); }
  #pageList.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .img-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #imgBox { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .adm-shell { flex-direction: column; }
  .adm-side { flex: none; height: auto; position: static; flex-direction: row; overflow-x: auto; align-items: center; }
  .adm-side .brand { padding: 6px 10px; border-bottom: none; margin-bottom: 0; }
  .adm-side .nav-grp { display: none; }
  .adm-side .lic-card { margin-top: 0; }
  .adm-top { position: static; }
  /* 顶栏收成一行：品牌 + 分组导航，右侧汉堡；生成记录和用户项进左侧抽屉 */
  .user-top { position: static; padding: 8px 14px; row-gap: 8px; }
  .user-top > .top-sep { display: none; }
  .top-nav { gap: 6px 12px; }
  .top-side { display: none; }
  .top-burger { display: inline-flex; }
  .user-main { padding: 14px 16px 32px; }
  .us-cols { grid-template-columns: minmax(0, 1fr); }
  .us-side { position: static; }
  /* 两栏工作台叠成上下后，右栏不再撑满窗口高度，也不做卡片内部滚动 */
  .flow-right { min-height: 0 !important; height: auto !important; }
  .flow-right .step-pane > .pane-body { overflow: visible; max-height: none !important; }
  .flow-right #matBox { min-height: 160px; max-height: 46vh !important; }
  #pageList.grid-4 { max-height: none !important; }
  /* 流程条钉在屏幕上沿：滚动时始终看得见当前在第几步，配合切步回到顶部就是「一步一屏」 */
  .steps {
    position: sticky; top: 0; z-index: 30; margin: 0 -8px 14px; padding: 8px 8px 4px;
    background: var(--bg);
  }
  /* 卡片标题栏：标题不被挤断行，按钮一排放不下就整排换到下一行 */
  .sec-bar { flex-wrap: wrap; row-gap: 8px; }
  /* 标题占满剩余宽度、放不下就自己折行（0 收缩会在 320 宽的屏上顶出屏幕） */
  .sec-bar > span { flex: 1 1 auto; min-width: 0; }
  .sec-bar > span.row { flex: 0 1 auto; flex-wrap: wrap; justify-content: flex-end; }
  /* 分页卡片：整宽一张，正文限高，不再保持 3:4 竖版 */
  #pageList.grid-4 { grid-template-columns: minmax(0, 1fr); }
  .card.pg-card { padding: 12px; }
  .pg-card .page-view { aspect-ratio: auto; min-height: 96px; max-height: 150px; }
  /* 空态占位收小，别撑出一大片空白 */
  .empty { padding: 28px 14px; font-size: 13px; }
  .empty::before { width: 42px; height: 42px; border-radius: 13px; margin-bottom: 10px; }
  /* 资料生成的空状态：手机上图标收一档，别把整屏撑得太空 */
  #matBox .empty { padding: 22px 14px; }
  #matBox .empty::before { width: 52px; height: 52px; background-size: 26px 26px; margin-bottom: 12px; }
  /* 底栏提示单独占一行，按钮留在下一行不被挤成一列 */
  .step-foot .tip { flex: 1 1 100%; order: -1; }
  /* 分页设置输入框再收一档，好让「分页设置 __ 页」和「下一步」尽量留在同一行 */
  .split-foot .input { width: 86px; padding: 5px 6px; }
  /* 出图参数：画面比例 / 分辨率 / 同时生成 三个并成一行，卡片风格独占一行 */
  .grid-fit { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .grid-fit > .field:nth-child(4) { grid-column: 1 / -1; }
  .grid-fit .field { margin-bottom: 10px; }
  .grid-fit label { font-size: 12.5px; }
  /* 一格只有 100px 出头，下拉框的内边距收掉，免得选项被截 */
  .grid-fit .select { padding: 9px 4px 9px 8px; }
  /* 第 2/3 步：左栏（提示词 + 开始生成 + 运行日志）不再跟在下面，这一步就该只有这一屏 */
  body[data-step="2"] .flow-left,
  body[data-step="3"] .flow-left { display: none; }
  /* 第 3 步卡片上面那条标题栏（批量出图 (N 页 × …)）和流程条重复，手机上不出现 */
  body[data-step="3"] .step-pane[data-step="3"] > .sec-bar { display: none; }
  /* 「统一模板」「选择生图」的长说明：.row 会按 max-content 判断换行，长中文句子就被整个甩到方框下面去了；
     给文字 flex:1 1 0 + min-width:0，它就永远待在方框右边、自己在行内折行 */
  #unifyRow > span, #pickAll + span { flex: 1 1 0; min-width: 0; }
  /* 结果格：手机上同款竖排按钮，但收小一档，免得四张图把页面撑太长 */
  #imgGrid .cell-ops { gap: 5px; padding: 6px 6px 0; }
  #imgGrid .cell-ops .btn { padding: 3px 6px; font-size: 11.5px; }
  #imgGrid .cap { font-size: 11px; padding: 4px 6px 6px; }
  /* 没生成文案之前，第 1 步下面那一整屏（流程条 + 资料生成卡）不出现，手机上只留提示词那一屏 */
  body[data-step="1"]:not(.mat-ready):not(.mat-win) .steps,
  body[data-step="1"]:not(.mat-ready):not(.mat-win) .step-pane[data-step="1"] { display: none; }
  /* 点「开始生成」= 在当前页下面开一整屏看文案。顶栏不参与这块布局，永远留在屏幕上沿，退出也从顶栏走 */
  body.mat-win { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
  body.mat-win .user-top { flex: none; margin-left: 0; }
  body.mat-win .user-main {
    flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column;
    margin: 0; padding: 2px 14px 10px;
  }
  body.mat-win .flow-2 { flex: 1 1 auto; min-height: 0; align-items: stretch; }
  body.mat-win .flow-left { display: none; }
  body.mat-win .flow-right { height: auto !important; min-height: 0; overflow: hidden; background: #fff; }
  /* 顶栏 → 流程条 → 卡片之间不留那两条白带 */
  body.mat-win .steps { margin: 0 -8px 6px; padding: 2px 8px 0; }
  /* 正文自己滚，底栏「分页设置 / 下一步」始终钉在屏幕下沿 */
  body.mat-win .flow-right .step-pane { min-height: 0; margin-bottom: 0; }
  body.mat-win .flow-right #matBox {
    flex: 1 1 auto; min-height: 0; max-height: none !important; margin-bottom: 0;
    font-size: 15.5px; line-height: 1.8;
  }
}
/* 手机竖屏：一行一项、去掉所有限高，整页自然滚动 */
@media (max-width: 620px) {
  .user-main { padding: 12px 12px 26px; }
  .card { padding: 14px; border-radius: 12px; }
  #source, #pgText { min-height: 200px; }
  /* 三步流程条排紧 */
  .steps { margin-bottom: 14px; row-gap: 8px; }
  .step { font-size: 13px; gap: 7px; }
  .step .no { width: 25px; height: 25px; font-size: 12px; }
  /* 卡片标题栏：按钮挤不下就换到下一行 */
  .sec-bar { flex-wrap: wrap; row-gap: 8px; padding: 9px 12px; font-size: 13.5px; }
  /* 输入框 16px，iOS 聚焦不会放大整页；下拉框单独收小一档，否则「卡片风格」展开的那一列字比周围标签大得多 */
  .input, textarea { font-size: 16px; }
  .select { font-size: 14px; }
  #imgBox { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 左侧提示词 + 日志缩矮，先让流程区露出来 */
  .flow-left { gap: 12px; }
  .flow-left #runLog { min-height: 104px; max-height: 170px; }
  .flow-right #matBox { min-height: 200px; }
  .result-box { padding: 12px; }
  .log-box { font-size: 11.5px; }
  /* 弹窗贴边 */
  .modal-mask, .cfm-mask { padding: 14px 10px; }
  .modal-head { padding: 13px 14px; }
  .modal-body { padding: 14px 14px 16px; }
  .act-body { padding: 16px; }
  .cfm { padding: 20px 16px 16px; }
  .toast-wrap { left: 12px; right: 12px; top: 12px; }
  .toast { max-width: none; }
  /* 用户设置 / 生成记录页头 */
  .us-phead { padding: 14px 16px; }
  .us-phead h1 { font-size: 18px; }
  .us-hero, .us-panel { padding: 16px; }
  .us-meta { gap: 14px; }
  table.us-rec th, table.us-rec td { padding: 9px 10px; }
  .page-bar { padding: 12px 14px; }
  .rec-head { gap: 10px; }
  /* 生成记录的分页码一行放不下就换行，不撑出屏幕 */
  .pager { flex-wrap: wrap; }
}
@media (max-width: 1100px) {
  .step-line { display: none; }
  .step { margin-right: 18px; }
}

/* ---------------- 用户设置页：页头 + 左侧菜单 + 内容 ---------------- */
.us-phead {
  display: flex; align-items: center; gap: 16px; justify-content: space-between; flex-wrap: wrap;
  padding: 16px 22px; margin-bottom: 16px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.us-phead h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: .2px; color: var(--ink); }
.us-phead p { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.us-back {
  background: var(--primary-grad); color: #fff; border-color: transparent;
  padding: 10px 20px; border-radius: 10px; box-shadow: 0 4px 12px rgba(79, 110, 247, .28);
}
.us-back:hover { color: #fff; box-shadow: 0 6px 18px rgba(79, 110, 247, .36); }

.us-cols { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 16px; align-items: start; }
.us-side {
  position: sticky; top: 76px;
  padding: 14px 12px; background: #fff;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.us-side-t { padding: 2px 10px 10px; font-size: 12px; font-weight: 700; letter-spacing: .6px; color: #a3abbd; }
.us-menu { display: flex; flex-direction: column; gap: 2px; }
.us-menu .us-item {
  display: flex; align-items: center; gap: 10px; padding: 10px;
  border-radius: 9px; font-size: 14px; font-weight: 600; color: #4a5468;
}
.us-menu .us-item svg { flex: 0 0 auto; color: #6b7488; }
.us-menu .us-item > span { white-space: nowrap; }
.us-menu .us-item:hover { background: #f4f7fd; color: var(--ink); text-decoration: none; }
.us-menu .us-item.active { background: #eef2ff; color: var(--primary-dark); }
.us-menu .us-item.active svg { color: var(--primary); }
.us-menu .us-item .us-chev { display: none; margin-left: auto; }
.us-menu .us-item.active .us-chev { display: block; color: #6f8bf5; }
.us-menu .us-item.off { color: #9aa3b5; font-weight: 500; cursor: not-allowed; }
.us-menu .us-item.off:hover { background: transparent; }
.us-menu .us-item.off svg { color: #b3bbcb; }
.us-soon {
  margin-left: auto; padding: 1px 6px; font-size: 11px; font-style: normal; white-space: nowrap;
  color: #a3abbd; background: #fafbfe; border: 1px dashed #d7dfef; border-radius: 5px;
}
.us-body { min-width: 0; }
#account, #activate { scroll-margin-top: 80px; }

.us-panel { padding: 20px 22px; }
.us-panel-t {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 14px; margin-bottom: 4px; border-bottom: 1px solid #eef1f7;
}
.us-panel-t h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); }
.us-redeem { padding: 9px 18px; border-radius: 9px; }

/* 激活记录表：浅蓝行 + 圆角 */
table.us-rec { margin-top: 6px; border-collapse: separate; border-spacing: 0 8px; }
table.us-rec th, table.us-rec td { border: 0; padding: 11px 14px; }
table.us-rec th { background: transparent; color: #8a93a6; font-size: 13px; font-weight: 600; }
table.us-rec td { background: #f5f8ff; font-size: 13px; color: #3a4256; }
table.us-rec tbody tr:hover td { background: #eef3ff; }
table.us-rec td:first-child { border-radius: 9px 0 0 9px; font-weight: 700; color: var(--ink); }
table.us-rec td:last-child { border-radius: 0 9px 9px 0; }

/* ---------------- 余额明细 ---------------- */
/* 余额 + 扣费规则：规则那行弱一些，别和数字抢 */
.bal-sum { display: flex; align-items: baseline; gap: 12px 22px; flex-wrap: wrap; margin-bottom: 14px; }
.bal-now { font-size: 15px; color: var(--ink); }
.bal-now b { font-size: 21px; font-weight: 800; color: var(--primary-dark); font-variant-numeric: tabular-nums; }
.bal-rule { font-size: 12.5px; color: var(--muted); line-height: 1.7; }
/* 带文字前缀的筛选项：日期框在手机上会被 Chrome 拉得很宽，这里收住 */
.filters .fl { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: #55607a; white-space: nowrap; }
.filters .fl .input[type="date"] { min-width: 148px; }
.tb-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tb-wrap table.tb { min-width: 640px; }
table.tb .pos { color: var(--success); font-weight: 700; }
table.tb .neg { color: var(--danger); font-weight: 700; }
table.tb td .badge { margin-left: 8px; }

/* ---------------- 网页排版：三栏工作台（上传文档 / 代码预览 / 效果预览） ---------------- */
/* 左栏 400px（与知识卡片页左栏一致），中栏同宽，右栏自适应 */
.wb-page { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 400px) minmax(0, 1fr); gap: 14px; }
.wb-panel {
  display: flex; flex-direction: column; min-width: 0; overflow: hidden;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.wb-head {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid #eef1f7;
  background: linear-gradient(180deg, #fafbff, #fff);
}
.wb-head h3 { margin: 0; font-size: 14px; font-weight: 700; color: var(--ink); letter-spacing: .2px; }
.wb-body {
  flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 10px;
  padding: 12px 14px 14px; overflow: auto;
}
/* 中/右栏：内容区自己滚，不留内边距 */
.wb-body-fill { padding: 0; overflow: hidden; }

.wb-btn {
  flex: none; padding: 6px 12px; font-family: inherit; font-size: 12.5px; font-weight: 600;
  color: #fff; border: 0; border-radius: 8px; cursor: pointer; transition: filter .15s ease;
}
.wb-btn:hover { filter: brightness(1.06); }
.wb-btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.wb-green { background: #22a06b; box-shadow: 0 3px 10px rgba(34, 160, 107, .24); }
.wb-coral { background: #f2683c; box-shadow: 0 3px 10px rgba(242, 104, 60, .24); }

/* 上传框：给足高度，看起来像一个能放下整份文档的区域 */
.wb-drop {
  flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 200px; padding: 32px 14px; text-align: center; cursor: pointer;
  border: 1px dashed #c9d4e8; border-radius: 10px; background: #f8fafe;
  transition: border-color .15s ease, background .15s ease;
}
.wb-drop:hover, .wb-drop.over { border-color: var(--primary); background: #eef4ff; }
.wb-plus { font-size: 26px; line-height: 1; font-weight: 300; color: #9fb0cc; }
.wb-drop.on .wb-plus { color: var(--success); font-weight: 600; }
.wb-drop-t {
  max-width: 100%; font-size: 13.5px; font-weight: 600; color: #2b3245;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wb-drop-s { font-size: 12px; color: #8a93a6; }

.wb-row { flex: none; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #4a5468; }
.wb-main { flex: none; width: 100%; padding: 11px 0; font-size: 14px; }
.wb-logtitle { flex: none; font-size: 13px; font-weight: 600; color: #4a5468; }
.wb-log { flex: 1 1 auto; min-height: 96px; max-height: none; }
.wb-log .wb-idle { color: #7f95c0; }

/* 代码预览：白底等宽块，占满整栏 */
.wb-code {
  flex: 1 1 auto; min-height: 0; margin: 12px 14px 14px; padding: 12px; overflow: auto;
  background: #fff; color: #2b3245; border: 1px solid #e6e9f0; border-radius: 10px;
  font-family: Consolas, Menlo, monospace; font-size: 12.5px; line-height: 1.75;
  white-space: pre-wrap; word-break: break-word;
}
.wb-code .wb-empty { color: #8a93a6; }

/* 效果预览：iframe 铺满整栏 */
.wb-prev {
  flex: 1 1 auto; min-height: 0; width: auto; height: auto; margin: 12px 14px 14px;
  border: 1px solid #e6e9f0; border-radius: 10px; background: #fff;
}

@media (max-width: 1240px) {
  .wb-page { grid-template-columns: minmax(0, 1fr); height: auto !important; }
  .wb-code, .wb-prev { flex: none; height: 340px; }
  .wb-log { max-height: 220px; }
}

/* 余额明细（放在文件末尾，才能盖住上面 .tb-wrap 的 640px 最小宽） */
@media (max-width: 620px) {
  .tb-wrap table.tb { min-width: 0; }
  .tb-wrap table.tb.us-rec th.col-sm,
  .tb-wrap table.tb.us-rec td.col-sm { display: none; }
  .bal-now b { font-size: 19px; }
}
