:root {
  --bg: #f4f6fa; --card: #ffffff; --line: #e3e8f0;
  --txt: #1c2333; --sub: #6b7280; --brand: #3557ff;
  --brand-soft: #eef1ff; --ok: #0f9d58; --err: #d93025; --warn: #b26a00;
}
* { box-sizing: border-box; margin: 0; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--txt); min-height: 100vh;
}
.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 16px 40px; }
/* 页面平铺：1080px 无条件生效（不依赖 :has——微信电脑版等旧内核不认识它，会导致页面缩回
   900px 窄条、任务表横滑、下载按钮看不见）。后台页自带 none !important 不受影响。 */

header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.brand { display: flex; gap: 12px; align-items: center; }
.logo {
  width: 42px; height: 42px; border-radius: 10px; background: var(--brand);
  color: #fff; font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
h1 { font-size: 20px; }
.brand p { color: var(--brand); font-size: 14px; font-weight: 500; margin-top: 4px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 20px; margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(20,30,60,.04);
}
.card h2 { font-size: 16px; margin-bottom: 8px; }
.sub { color: var(--sub); font-size: 13px; margin-bottom: 14px; }

/* 兑换码购买入口（兑换码输入框下方） */
.buy-line { margin-top: 12px; font-size: 13px; color: var(--sub); }
.buy-line a {
  display: inline-block; margin-left: 2px; padding: 3px 12px;
  background: #ff4400; color: #fff; border-radius: 15px;
  font-weight: 600; font-size: 13px; text-decoration: none;
  box-shadow: 0 1px 3px rgba(255,68,0,.3);
}
.buy-line a:hover { background: #e63e00; }

.inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
input[type="text"], input[type="password"], input[type="number"], select {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px;
  font-size: 14px; background: #fff; color: var(--txt);
}
input::placeholder { color: #9ca3af; }
.card-row { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; font-size: 13px; }
/* HTML hidden 属性会被 display: flex 覆盖，必须显式再次隐藏 */
.card-row[hidden] { display: none !important; }
.card-row label { color: var(--sub); white-space: nowrap; }
.card-row select { padding: 6px 10px; font-size: 13px; }
.btn-primary {
  background: var(--brand); color: #fff; border: none;
  border-radius: 8px; padding: 10px 22px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.btn-primary:disabled { background: #b9c3e0; cursor: not-allowed; }
.btn-ghost {
  background: #fff; border: 1px solid var(--line); border-radius: 7px;
  padding: 6px 14px; font-size: 13px; cursor: pointer; color: var(--txt);
}
/* 蓝色主按钮（加页/兑换等强调操作） */
.btn-blue {
  background: var(--brand); border: 1px solid var(--brand); border-radius: 7px;
  padding: 6px 14px; font-size: 13px; cursor: pointer; color: #fff; font-weight: 600;
}
.btn-blue:hover { background: #3b51d6; border-color: #3b51d6; }
.hint { font-size: 13px; color: var(--brand); margin-top: 10px; min-height: 18px; }
.hint.err { color: var(--err); }
/* 客户上传旧版 .doc 被拒时的醒目红字提示 */
.doc-reject {
  display: block;
  background: #fdecea;
  color: #c5221f;
  border: 1px solid #f5c6c4;
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 12px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.topbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 16px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.redeem-more { display: inline-flex; align-items: center; gap: 6px; }
/* HTML hidden 属性会被 display: inline-flex 覆盖，必须显式通过选择器优先级再次隐藏。 */
.redeem-more[hidden] { display: none !important; }
.redeem-more input {
  padding: 6px 10px; font-size: 13px; border: 1px solid var(--line, #dfe3ec);
  border-radius: 6px; width: 200px; max-width: 100%;
}
.stack-note {
  margin: 2px 0 14px; font-size: 12px; color: var(--sub); line-height: 1.6;
  background: var(--brand-soft); border: 1px solid #d4dcff;
  border-radius: 8px; padding: 8px 12px;
}
.stack-note[hidden] { display: none !important; }
.stack-note b { color: var(--brand); }
.balance { display: flex; align-items: baseline; gap: 8px; }
.balance .label { color: var(--sub); font-size: 14px; }
.balance .sub-inline { font-size: 11px; color: var(--sub); font-weight: 400; }
.balance .value { color: var(--txt); font-size: 16px; }
.balance b { color: var(--brand); font-size: 24px; font-weight: 700; }

.drop-zone {
  border: 2px dashed #c3cbdd; border-radius: 10px; padding: 28px 18px;
  text-align: center; color: var(--sub); cursor: pointer; transition: .18s;
}
.drop-zone.over, .drop-zone:hover { border-color: var(--brand); background: var(--brand-soft); }
.dz-main { color: var(--txt); font-size: 15px; margin-top: 8px; }
.dz-main .link { color: var(--brand); font-weight: 600; }
.dz-sub { font-size: 12px; margin-top: 5px; }

.file-row { margin-top: 12px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand-soft); border: 1px solid #d6ddff;
  border-radius: 8px; padding: 7px 12px; font-size: 14px;
}
.file-icon {
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 5px; padding: 2px 6px;
}
.file-meta { color: var(--sub); font-size: 12px; }

.opts { display: flex; gap: 12px; align-items: flex-end; margin-top: 16px; flex-wrap: wrap; }
.opt { display: flex; flex-direction: column; gap: 5px; }
.opt label { font-size: 12px; color: var(--sub); font-weight: 600; }

.section-title { font-size: 15px; margin: 22px 0 10px; }

.task-table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; color: var(--sub); font-weight: 600; font-size: 12px;
  padding: 8px 10px; border-bottom: 1px solid var(--line);
}
td { padding: 10px; border-bottom: 1px solid #f0f2f7; vertical-align: middle; }
.t-file { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-msg { color: var(--sub); max-width: 180px; }
.ta-c { text-align: center; }
.ta-c .btn-mini { margin: 0 3px; }
/* 表格外套横向滚动容器（兜底：正常情况表格铺满容器，不会触发横滑） */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; }
/* 任务表铺满页面宽度：不再保底 1000px（否则窗口窄一点整表就横滚，最右列操作被甩出可见区） */
.table-scroll .task-table { min-width: 0; }
/* 时间列/操作列永不折行（窄屏 auto 布局下 nowrap 列优先抢宽，避免时间断行） */
.task-table td:nth-child(6), .task-table td:nth-child(7), .task-table td:last-child { white-space: nowrap; }
/* 翻译页任务表（「我的任务」标题后紧跟的那个表格）：固定列宽、永远铺满卡片，不横滑——
   最右列「⬇ 下载译文」在任何屏宽下都完整可见（页面宽度不动，还是 900px）。
   作用域用相邻兄弟选择器锁定翻译页，不误伤转换页（9 列、标题与表格间有提示段、自带 min-width）和后台。 */
h3.section-title + .table-scroll .task-table { table-layout: fixed; }
h3.section-title + .table-scroll .task-table th,
h3.section-title + .table-scroll .task-table td { padding: 8px 6px; overflow: hidden; }
h3.section-title + .table-scroll .task-table .t-file { max-width: none; }
/* 时间列允许折行（19 位时间串在窄卡片里放不下，折两行比把按钮挤出屏外强）；状态徽章/按钮组同理 */
h3.section-title + .table-scroll .task-table td:nth-child(6),
h3.section-title + .table-scroll .task-table td:nth-child(7) { white-space: normal; }
h3.section-title + .table-scroll .task-table .st { white-space: normal; }
h3.section-title + .table-scroll .task-table td:last-child { white-space: normal; }
/* 列宽（桌面卡片内约 826px）：文件 18 / 方向 12 / 页数 5 / 状态 12 / 说明 8 / 提交 13 / 完成 13 / 操作 19 */
h3.section-title + .table-scroll .task-table th:nth-child(1) { width: 18%; }
h3.section-title + .table-scroll .task-table th:nth-child(2) { width: 12%; }
h3.section-title + .table-scroll .task-table th:nth-child(3) { width: 5%; }
h3.section-title + .table-scroll .task-table th:nth-child(4) { width: 12%; }
h3.section-title + .table-scroll .task-table th:nth-child(5) { width: 8%; }
h3.section-title + .table-scroll .task-table th:nth-child(6) { width: 13%; }
h3.section-title + .table-scroll .task-table th:nth-child(7) { width: 13%; }
h3.section-title + .table-scroll .task-table th:nth-child(8) { width: 19%; }
/* 中等宽度窗口（≤980px：小桌面窗口/平板/微信平板）：隐藏两个时间列（提交/完成）腾出宽度，
   保留 文件/方向/页数/状态/说明/操作。 */
@media (max-width: 980px) {
  /* 隐藏次要列：提交时间(6) / 完成时间(7) */
  h3.section-title + .table-scroll .task-table th:nth-child(6), h3.section-title + .table-scroll .task-table td:nth-child(6),
  h3.section-title + .table-scroll .task-table th:nth-child(7), h3.section-title + .table-scroll .task-table td:nth-child(7) { display: none; }
  /* 列宽：文件 26% / 方向 10% / 页数 7% / 状态 13% / 说明 14% / 操作 30% */
  h3.section-title + .table-scroll .task-table th:nth-child(1) { width: 26%; }
  h3.section-title + .table-scroll .task-table th:nth-child(2) { width: 10%; }
  h3.section-title + .table-scroll .task-table th:nth-child(3) { width: 7%; }
  h3.section-title + .table-scroll .task-table th:nth-child(4) { width: 13%; }
  h3.section-title + .table-scroll .task-table th:nth-child(5) { width: 14%; }
  h3.section-title + .table-scroll .task-table th:nth-child(8) { width: 30%; }
}
/* 微信等窄屏（≤640px）：翻译页任务表（「我的任务」标题后紧跟的那个表格）不再整表 1000px 横滚——
   否则最右列「⬇ 下载译文」被甩出屏外，要左右滑才看得见。改为固定列宽自适应屏宽 + 隐藏次要列，
   保留 文件/方向/页数/状态/操作，下载按钮一屏可见。
   作用域用相邻兄弟选择器锁定翻译页，避免误伤转换页（9 列、标题与表格间有提示段）和后台（admin）。 */
@media (max-width: 640px) {
  h3.section-title + .table-scroll .task-table { min-width: 0; table-layout: fixed; }
  h3.section-title + .table-scroll .task-table th,
  h3.section-title + .table-scroll .task-table td { padding: 8px 5px; overflow: hidden; }
  h3.section-title + .table-scroll .task-table .t-file { max-width: none; }
  /* 列宽：文件 33% / 方向 15% / 页数 8% / 状态 17% / 操作 27% */
  h3.section-title + .table-scroll .task-table th:nth-child(1) { width: 33%; }
  h3.section-title + .table-scroll .task-table th:nth-child(2) { width: 15%; }
  h3.section-title + .table-scroll .task-table th:nth-child(3) { width: 8%; }
  h3.section-title + .table-scroll .task-table th:nth-child(4) { width: 17%; }
  h3.section-title + .table-scroll .task-table th:nth-child(8) { width: 27%; }
  /* 隐藏次要列：说明(5) / 提交时间(6) / 完成时间(7) */
  h3.section-title + .table-scroll .task-table th:nth-child(5), h3.section-title + .table-scroll .task-table td:nth-child(5),
  h3.section-title + .table-scroll .task-table th:nth-child(6), h3.section-title + .table-scroll .task-table td:nth-child(6),
  h3.section-title + .table-scroll .task-table th:nth-child(7), h3.section-title + .table-scroll .task-table td:nth-child(7) { display: none; }
  /* 状态徽章/操作按钮在固定列宽内允许换行，不被撑破裁切 */
  h3.section-title + .table-scroll .task-table .st { white-space: normal; }
  h3.section-title + .table-scroll .task-table td:last-child { white-space: normal; }
}
/* 更窄的手机（≤480px，覆盖 320~430 全系）：连「方向」一并隐藏，宽度让给 文件/状态/操作 */
@media (max-width: 480px) {
  h3.section-title + .table-scroll .task-table th:nth-child(2),
  h3.section-title + .table-scroll .task-table td:nth-child(2) { display: none; }
  h3.section-title + .table-scroll .task-table th:nth-child(1) { width: 42%; }
  h3.section-title + .table-scroll .task-table th:nth-child(3) { width: 10%; }
  h3.section-title + .table-scroll .task-table th:nth-child(4) { width: 20%; }
  h3.section-title + .table-scroll .task-table th:nth-child(8) { width: 28%; }
}
.empty td { text-align: center; color: var(--sub); padding: 24px; }
.st { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.s-queued { background: #eef0f5; color: var(--sub); }
.s-run { background: #e8f0fe; color: #1a56db; }
.s-done { background: #e3f4ea; color: var(--ok); }
.s-fail { background: #fdecea; color: var(--err); }
.s-muted { background: #eef0f5; color: var(--sub); }
.dl { color: var(--brand); font-weight: 600; text-decoration: none; }
.dl:hover { text-decoration: underline; }
.codes-out {
  width: 100%; margin-top: 12px; padding: 10px;
  border: 1px solid var(--line); border-radius: 8px;
  font-family: monospace; font-size: 13px; resize: vertical;
}
code { background: #f1f3f8; padding: 2px 6px; border-radius: 4px; }
footer { text-align: center; color: var(--sub); font-size: 12px; margin-top: 16px; line-height: 1.8; padding: 12px 16px; }
footer .footer-brand, footer .contact { text-align: center; }
footer .footer-brand { color: var(--sub); opacity: 0.8; }
footer .contact { margin-top: 2px; color: var(--sub); opacity: 0.8; }
footer .beian { margin-top: 4px; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0; }
footer .beian a { color: var(--sub); text-decoration: none; }
footer .beian a:hover { color: var(--accent); }
footer .beian .sep { margin: 0 10px; color: var(--sub); opacity: 0.5; }
footer .beian .gongan { display: inline-flex; align-items: center; gap: 4px; }
footer .beian .beian-shield { flex-shrink: 0; }

/* ---- 管理后台：统计卡片 / 标签 / 小按钮 ---- */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px; margin-top: 8px;
}
.stat-cell {
  background: var(--brand-soft); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; text-align: center;
}
.stat-num { font-size: 20px; font-weight: 700; color: var(--brand); }
.stat-label { font-size: 12px; color: var(--sub); margin-top: 4px; }
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; background: #eef1f5; color: var(--sub);
}
.tag.ok { background: #e6f4ea; color: var(--ok); }
.tag.bad { background: #fdecea; color: var(--err); }
.tag.warn { background: #fef4e6; color: var(--warn); }
.btn-mini {
  border: 1px solid var(--line); background: #fff; color: var(--brand);
  border-radius: 6px; padding: 4px 10px; font-size: 12px; cursor: pointer;
  margin-right: 4px;
}
.btn-mini:hover { background: var(--brand-soft); }
.btn-danger { color: var(--err); border-color: #f5c2c0; }
.btn-danger:hover { background: #fdecea; }

.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 10px; }
.section-head h2 { margin-bottom: 0; }
.section-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.section-tools input[type="text"] { width: 190px; }

/* 兑换码批次列表：明细展开行 */
tr.detail-row > td { background: #f7f9fc; padding: 10px 12px; border-bottom: 2px solid var(--line); }
tr.detail-row table { margin: 0; box-shadow: none; }

/* 下载按钮（链接样式，醒目） */
.dl-btn {
  display: inline-block; text-decoration: none;
  background: var(--brand); color: #fff !important;
  border: 1px solid var(--brand); font-weight: 600;
}
.dl-btn:hover { background: #2a46d6; border-color: #2a46d6; }

/* ---- 客户页：批量文件列表 ---- */
.file-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.file-list .file-chip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.file-list .f-ok { border-color: #b7dfc6; background: #f4fbf6; }
.file-list .f-err { border-color: #f3c1bd; background: #fdf5f4; }
.file-list .f-wait { border-style: dashed; }
.file-list .f-name { font-size: 14px; font-weight: 600; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .f-state { font-weight: 700; margin-left: auto; }
.f-ok .f-state { color: var(--ok); }
.f-err .f-state { color: var(--err); }
.f-wait .f-state { color: var(--sub); }
.f-del { border: none; background: none; color: var(--sub); font-size: 18px; cursor: pointer; line-height: 1; padding: 0 4px; }
.f-del:hover { color: var(--err); }
