:root {
  --red: #CC0033;
  --orange: #FE8A27;
  --ink: #16181d;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f7f8fa;
  --card: #fff;
  --ok: #0f7b4f;
  --bad: #b42318;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.6 system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
header.top {
  display: flex; align-items: center; gap: 20px; padding: 12px 24px;
  background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 9;
}
.brand { font-weight: 700; letter-spacing: .3px; }
.brand small { font-weight: 500; color: var(--muted); margin-left: 4px; }
.brand .dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: linear-gradient(135deg, var(--red), var(--orange)); margin-right: 8px;
}
nav { display: flex; gap: 4px; flex: 1; }
nav a {
  white-space: nowrap;
  padding: 6px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: 14px;
}
nav a:hover { background: #f1f2f4; }
nav a.on { background: var(--red); color: #fff; }
.inline { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.who { color: var(--muted); font-size: 13px; }
main { max-width: 1080px; margin: 0 auto; padding: 28px 20px 60px; }
h1 { font-size: 24px; margin: 0 0 6px; }
h2 { font-size: 18px; }
h2.sec { margin-top: 36px; }
h3 { font-size: 15px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.tiny { font-size: 12.5px; }
.bad-text { color: var(--bad); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px; margin: 14px 0;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 760px) { .grid2, .grid3 { grid-template-columns: 1fr; } nav { overflow-x: auto; } }

a.feature { text-decoration: none; color: inherit; display: block; transition: .15s; }
a.feature:hover { border-color: var(--red); transform: translateY(-2px); }
a.feature h2 { margin: 0 0 8px; }
.pill {
  display: inline-block; margin-top: 12px; padding: 3px 10px; border-radius: 999px;
  background: #fff1f4; color: var(--red); font-size: 12.5px;
}

form.form label, .card label { display: block; margin-bottom: 14px; font-size: 13.5px; color: #374151; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }
input, select {
  width: 100%; margin-top: 6px; padding: 0 12px; height: 44px; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff;
}
select { padding-right: 34px; }
textarea { box-sizing: border-box; }
input:focus, select:focus { outline: 2px solid #ffd9c9; border-color: var(--orange); }
input[type=file] { padding: 8px; background: #fafafa; }
input.num { width: 80px; display: inline-block; }

button { font: inherit; cursor: pointer; border-radius: 10px; padding: 9px 18px; border: 1px solid transparent; }
button, .btn { min-height: 42px; box-sizing: border-box; }
button, .btn, button.primary, button.ghost, .btn.ghost {
  display: inline-flex; align-items: center; justify-content: center;
}
button.primary { background: var(--red); color: #fff; }
button.primary:hover { background: #a8002a; }
button.ghost { background: #fff; border-color: var(--line); padding: 0 16px; font-size: 14px; }
button.ghost:hover { border-color: var(--red); color: var(--red); }
.actions { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
a.btn {
  display: inline-block; padding: 8px 14px; border-radius: 10px; text-decoration: none;
  border: 1px solid var(--line); color: var(--ink); background: #fff; font-size: 13.5px;
}
a.btn.primary { background: var(--red); color: #fff; border-color: var(--red); }

table.list { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 12px; overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
table.list th { background: #fafbfc; color: var(--muted); font-weight: 600; }
table.list tr:last-child td { border-bottom: 0; }

.tag { font-size: 12px; padding: 2px 9px; border-radius: 999px; vertical-align: middle; }
.tag.queued { background: #eef2ff; color: #3730a3; }
.tag.running { background: #fff7e6; color: #a15c00; }
.tag.done { background: #e8f7ef; color: var(--ok); }
.tag.failed { background: #fdecea; color: var(--bad); }

.alert { padding: 12px 16px; border-radius: 12px; margin: 0 0 16px; font-size: 14px; }
.alert.bad { background: #fdecea; color: var(--bad); border: 1px solid #f7c9c4; }
.alert.good { background: #e8f7ef; color: var(--ok); border: 1px solid #bfe6d2; }

.login-wrap { display: flex; justify-content: center; padding-top: 8vh; }
.login { width: 360px; }
.login h1 { margin-bottom: 2px; }

figure.shot { margin: 0; padding: 12px; }
figure.shot img { width: 100%; border-radius: 10px; display: block; background: #fafafa; }
figure.shot figcaption { font-size: 12px; color: var(--muted); margin: 8px 0; }

pre {
  background: #0f1115; color: #e6e6e6; padding: 14px; border-radius: 10px;
  overflow: auto; font-size: 12.5px; max-height: 320px; white-space: pre-wrap;
}
details summary { cursor: pointer; color: var(--muted); font-size: 13px; margin: 8px 0; }
.bar { height: 4px; background: #eee; border-radius: 4px; overflow: hidden; margin-top: 12px; }
.bar span {
  display: block; height: 100%; width: 40%; border-radius: 4px;
  background: linear-gradient(90deg, var(--red), var(--orange));
  animation: slide 1.2s ease-in-out infinite alternate;
}
@keyframes slide { from { margin-left: 0; } to { margin-left: 60%; } }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 0 40px; }

.chk { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; color: #374151; }
.chk input[type=checkbox] { width: auto; margin: 3px 0 0; accent-color: #CC0033; }

/* 必填星号统一红色（品牌红 #CC0033）。只作用于 .req，避免把 label 里的 2FDEAL Logo 等正文也染红 */
b.req { color: #CC0033; font-weight: 700; }

/* 列表分页：首页 / 上一页 / 页码 / 下一页 / 尾页 / 跳页 */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 16px 0 6px; }
.pager .pg { display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 32px; padding: 0 10px; border: 1px solid #d1d5db; border-radius: 8px;
  background: #fff; color: #374151; font-size: 13px; text-decoration: none; }
.pager .pg:hover { border-color: #9ca3af; }
.pager .pg.on { background: #CC0033; border-color: #CC0033; color: #fff; font-weight: 600; }
.pager .pg.off { color: #c3c7cd; border-color: #e5e7eb; cursor: not-allowed; }
.pager .gap { color: #9ca3af; padding: 0 2px; }
.pager .jump { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px;
  font-size: 13px; color: #6b7280; }
.pager .jump input { width: 62px; height: 32px; padding: 0 8px; border: 1px solid #d1d5db;
  border-radius: 8px; font-size: 13px; text-align: center; }
.pager .jump button { height: 32px; padding: 0 12px; border: 1px solid #d1d5db; border-radius: 8px;
  background: #fff; color: #374151; font-size: 13px; cursor: pointer; }
.pager .jump button:hover { border-color: #9ca3af; }
.pginfo { margin: 0 0 18px; }
@media (max-width: 620px) {
  .pager .jump { margin-left: 0; width: 100%; }
}

/* 列表筛选栏 */
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin: 0 0 14px; }
.filters label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: #374151; }
.filters select { height: 34px; min-width: 150px; padding: 0 10px; border: 1px solid #d1d5db;
  border-radius: 8px; background: #fff; font-size: 13px; color: #111827; }
.filters button, .filters .btn { height: 34px; padding: 0 16px; display: inline-flex;
  align-items: center; }
@media (max-width: 620px) { .filters select { min-width: 0; width: 100%; } .filters label { flex: 1 1 100%; } }

/* 长标题拆分 + 宽度计数 */
/* 拆分区不再套虚线框：内容与外层字段严格同一条左基线 */
.split-box { margin: 0 0 6px; padding: 0; border: 0; background: none; }
.split-box > label:first-child { margin-bottom: 10px; }
.split-box textarea { width: 100%; min-height: 62px; padding: 9px 11px; border: 1px solid #d1d5db;
  border-radius: 8px; font: inherit; font-size: 13px; resize: vertical; box-sizing: border-box; }
.split-actions { display: flex; flex-wrap: wrap; margin-top: 10px; align-items: center; gap: 10px; }
.split-actions button, .split-actions .btn {
  flex: 0 0 auto; width: auto; min-width: 132px; height: 44px; min-height: 44px; padding: 0 18px;
}
.split-actions { gap: 12px; }
.split-actions .tiny { line-height: 1.45; }
.split-alts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.chip { border: 1px solid #d1d5db; background: #fff; border-radius: 999px; padding: 4px 11px;
  font-size: 12px; color: #374151; cursor: pointer; }
.chip:hover { border-color: #CC0033; color: #CC0033; }
.wc { display: block; min-height: 16px; margin-top: 4px; font-size: 11px; color: #6b7280; }
.wc.over { color: #CC0033; font-weight: 600; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px;
  background: #fdf2f4; color: #CC0033; border: 1px solid #f4c9d2; }
.linkbtn { border: 0; background: none; padding: 0; font-size: 12px; color: #6b7280;
  text-decoration: underline; cursor: pointer; }
.linkbtn:hover { color: #CC0033; }
.btn.ghost { background: #fff; color: #374151; border: 1px solid #d1d5db; }

/* 广告页布局 */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { margin-bottom: 4px; }
.quota-chip { background: #fff; border: 1px solid #edeef0; border-radius: 999px; padding: 8px 14px;
  font-size: 12.5px; color: #374151; white-space: nowrap; }
.quota-chip b { color: #CC0033; }
.ads-form { padding: 4px 18px 16px; }
.fsection { padding: 16px 0; border-bottom: 1px solid #f1f2f4; }
.fsection:first-of-type { padding-top: 10px; }
.fsection:last-of-type { border-bottom: 0; }
.fsec { font-size: 13.5px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; color: #111827; font-weight: 700; }
.fsec .num { width: 20px; height: 20px; border-radius: 6px; background: #fdf2f4; color: #CC0033;
  font-size: 12px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.sticky-actions { position: static; z-index: auto; background: #fff; padding: 16px 0 4px;
  border-top: 1px solid #eef0f2; margin-top: 8px; box-shadow: none; }
.hist-box { margin: 12px 0 16px; padding-top: 10px; border-top: 1px dashed #eceef1;
  display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.hist-list { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.hist-item { display: inline-flex; gap: 6px; align-items: baseline; border: 1px solid #eceef1;
  background: #fff; border-radius: 999px; padding: 4px 10px; cursor: pointer; max-width: 100%; }
.hist-item b { font-size: 12px; color: #111827; font-weight: 600; }
.hist-item span { font-size: 11px; color: #9ca3af; }
.hist-item:hover { border-color: #CC0033; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip.static { cursor: default; border-color: #eceef1; color: #374151; }
.alert.ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; border-radius: 8px;
  padding: 9px 12px; font-size: 13px; margin-bottom: 12px; }

/* hidden 属性优先于 .row 的 flex */
[hidden] { display: none !important; }

/* 移动端 */
.sticky-actions button { white-space: nowrap; }
@media (max-width: 720px) {
  header.top { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  nav { order: 3; flex: 1 1 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  nav::-webkit-scrollbar { display: none; }
  main { padding: 18px 14px 60px; }
  .page-head { gap: 8px; }
  h1 { font-size: 20px; }
  .sticky-actions { padding-bottom: 8px; }
  .sticky-actions .tiny { display: none; }
}

/* 主标题空/太短时引导补钩子 */
.btn.attn { border-color: #CC0033; color: #CC0033; box-shadow: 0 0 0 3px rgba(204, 0, 51, .08); }

/* 复选框不吃 44px 控件高度 */
input[type=checkbox], input[type=radio] {
  width: 14px; height: 14px; min-height: 0; margin: 0 7px 0 0; padding: 0; vertical-align: middle;
}
label.chk { display: flex; align-items: center; min-height: 44px; margin-bottom: 0; }
.chk-row { display: flex; align-items: center; gap: 32px; flex-wrap: wrap; margin-bottom: 10px; }
label.chk input[type=checkbox] { margin-top: 0; }
@media (max-width: 640px) { label.chk { min-height: 38px; } }

/* 按钮统一字重字号：主/次只靠填充色区分，不做大小差 */
button, .btn { font-size: 14px; font-weight: 600; }
.split-actions button, .split-actions .btn { font-size: 14px; font-weight: 600; }
button.primary { font-weight: 600; }
.linkbtn { font-size: 12.5px; font-weight: 500; }

/* 历史 chip / 文字按钮不吃 42px 按钮高度 */
.hist-item { min-height: 26px; height: auto; padding: 3px 10px; font-weight: 400; }
.hist-item b { font-size: 12px; }
.hist-item span { font-size: 11px; }
.linkbtn { min-height: 0; height: auto; }

/* 提交按钮与拆分区按钮同高；顶栏退出按钮单独小一号 */
.sticky-actions button { height: 44px; min-height: 44px; }
header.top button { height: 36px; min-height: 36px; font-size: 13px; padding: 0 12px; }

/* 文件选择：原生按钮改成本站按钮样式，别在框里露出一个小的系统按钮 */
input[type=file] { padding: 6px 10px; cursor: pointer; }
input[type=file]::file-selector-button {
  height: 30px; margin-right: 12px; padding: 0 14px; border-radius: 8px;
  border: 1px solid #d1d5db; background: #fff; color: #374151;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
input[type=file]::file-selector-button:hover { border-color: #CC0033; color: #CC0033; }

/* 提示语独占一行，永远不会被按钮压住 */
#splitMsg { margin: 8px 0 0; line-height: 1.5; }
#splitMsg:empty { display: none; }
.split-box, .split-actions { min-width: 0; }
.split-box textarea { width: 100%; max-width: 100%; }
@media (max-width: 520px) {
  .split-actions { gap: 10px; }
  .split-actions button, .split-actions .btn { min-width: 0; flex: 1 1 0; }
}

/* 提示行：说明文字 + 重新拆分的文字按钮 */
.split-hint { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 9px 0 0; }
.split-hint #splitMsg { margin: 0; }

/* 填充后的操作条：徽标 + 撤销 + 反馈，一行内紧凑排列（不要用两栏 grid） */
.split-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 8px; }

/* 字段内的补充说明（跟随字段，不单独占一行漂着） */
.field-note { display: block; margin-top: 6px; font-size: 12px; line-height: 1.55; color: #6b7280; }

/* ---------- 管理页：行内小控件 & KPI（不要沿用表单大件规格） ---------- */
.tbl button, .list button, .tbl .btn, .list .btn {
  min-height: 30px; height: 30px; padding: 0 12px; font-size: 12.5px; font-weight: 500;
}
.tbl input, .list input { height: 30px; min-height: 30px; padding: 0 8px; font-size: 13px; border-radius: 7px; }
.tbl td, .list td { vertical-align: middle; }
form.inline { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
form.inline label { margin: 0; }
form.inline button { min-height: 34px; height: 34px; font-size: 13px; font-weight: 600; padding: 0 16px; }
.kpis { display: grid; gap: 10px; margin: 8px 0 2px; }
.kpis.four { grid-template-columns: repeat(4, minmax(0, 186px)); justify-content: start; }
.kpis.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpis .kpi { background: #fafbfc; border: 1px solid #eef0f2; border-radius: 10px; padding: 10px 12px; }
.kpis .kpi b { display: block; font-size: 20px; line-height: 1.3; }
.kpis .kpi span { font-size: 12px; color: #6b7280; }
@media (max-width: 860px) {
  .kpis.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.inline-form { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.inline-form label { flex: 1 1 240px; margin: 0; }
.tbl.dict td { padding: 7px 10px; }
.tbl.dict input { height: 34px; min-height: 34px; width: 100%; font-size: 13px; }
.tbl.dict .dname { white-space: nowrap; }
.tbl.dict .dname b { font-size: 13.5px; }
.tbl.dict .dname span { display: block; font-size: 11px; color: #9ca3af; }
.tbl.dict td.save { width: 86px; text-align: right; }
.tbl.dict td.save button { min-height: 34px; height: 34px; font-size: 13px; }
.tbl.dict th { font-size: 12px; color: #6b7280; font-weight: 600; background: #fafbfc; }

/* 词典表：定宽列，输入框铺满、不裁字 */
.tbl.dict { width: 100%; table-layout: fixed; }
.tbl.dict th:nth-child(1), .tbl.dict td:nth-child(1) { width: 150px; }
.tbl.dict th:last-child, .tbl.dict td:last-child { width: 84px; }
.tbl.dict td { overflow: hidden; }

/* 表格单元格里的行内表单：不换行、与输入框同高 */
.list form.inline, .tbl form.inline { flex-wrap: nowrap; gap: 8px; align-items: center; }
.list form.inline button, .tbl form.inline button {
  min-height: 30px; height: 30px; font-size: 12.5px; font-weight: 500; padding: 0 12px;
}
.list td, .list th { white-space: nowrap; }
.list td.op, .tbl td.op { white-space: nowrap; }

/* 表格单元里的多个行内表单要并排，不要各占一行 */
.list td form.inline, .tbl td form.inline { display: inline-flex; vertical-align: middle; }

/* ---------- 窄屏：导航可横滑，表格横向滚动而不是压成一条 ---------- */
header.top { gap: 10px; }
header.top nav { overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap; }
header.top nav::-webkit-scrollbar { display: none; }
header.top nav a { flex: 0 0 auto; }
.tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 760px) {
  .tbl.dict { min-width: 720px; }
  .list { min-width: 560px; }
}

@media (max-width: 520px) {
  header.top nav { flex-wrap: wrap; overflow: visible; row-gap: 6px; }
  header.top nav a { flex: 0 0 auto; }
}

/* 管理页：主管理员标记 & 危险按钮 */
.badge-owner { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: #fff1f3; color: #CC0033; font-size: 11px; font-weight: 600; vertical-align: 1px; }
button.danger, .btn.danger { background: #fff; border: 1px solid #f1c6ce; color: #CC0033; }
button.danger:hover, .btn.danger:hover { background: #CC0033; border-color: #CC0033; color: #fff; }
.list td button.danger { min-height: 30px; height: 30px; font-size: 12.5px; font-weight: 500; padding: 0 12px; }

/* 绑定 IP 输入框：窄一点，够填 v4/v6 */
.list input.ipt { width: 132px; font-size: 12.5px; }

/* 正文链接统一品牌红，别用浏览器默认蓝紫 */
main a:not(.btn):not(.feature):not(.pg) { color: #CC0033; text-decoration-color: rgba(204,0,51,.35); }
main a:not(.btn):not(.feature):not(.pg):hover { text-decoration-color: #CC0033; }

/* 账号表列宽固定，表头与单元格不再错位 */
table.list th:nth-child(1) { width: 56px; }
table.list th:nth-child(3) { width: 86px; }
table.list th:nth-child(5) { width: 196px; }
table.list th:nth-child(6) { width: 62px; }

/* 任务页返回：轻量文字按钮，不要抢标题 */
.backline { margin: 0 0 6px; }
a.btn.back { height: 32px; min-height: 32px; padding: 0 12px; font-size: 13px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px; }

/* 登录日志 */
.sec-link { margin-left: 8px; font-weight: 500; text-decoration: none; }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.filters label { margin: 0; font-size: 13px; color: var(--muted); }
.filters input { height: 38px; min-height: 38px; width: 170px; margin-top: 4px; }
.filters select { height: 38px; min-height: 38px; width: 130px; margin-top: 4px; }
.filters button { height: 38px; min-height: 38px; }
table.logins td.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
table.logins td.ua { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.lres { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.lres.ok { background: #e8f7ee; color: #11663a; }
.lres.fail { background: #fdecef; color: #a3002a; }
.lres.denied { background: #fff3e6; color: #9a4b00; }
.lres.locked { background: #eef0f3; color: #475569; }
.lres.bad_input { background: #eef0f3; color: #475569; }
.lres.logout { background: #f4f5f7; color: #6b7280; }
@media (max-width: 760px) {
  .filters input, .filters select { width: 100%; }
  .filters { gap: 10px; }
}

/* 失败来源提示：一行小字，不要占一张卡的高度 */
.hotline { margin: -2px 0 14px; }
