/* ============ 后台 ============ */
body.admin { background: #f5f5f7; }

/* ---- 登录 ---- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(900px 400px at 50% -10%, rgba(0, 113, 227, 0.12), transparent 70%), #f5f5f7;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 22px;
  padding: 34px 30px 30px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.10);
}
.login-card .logo {
  width: 46px; height: 46px;
  border-radius: 13px;
  background: linear-gradient(145deg, #1d1d1f, #4a4a4f);
  color: #fff;
  display: grid; place-items: center;
  font-size: 20px;
  margin-bottom: 18px;
}
.login-card h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.02em; }
.login-card p { margin: 0 0 24px; color: var(--muted); font-size: 13px; }

/* ---- 布局 ---- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 224px;
  flex: none;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px 20px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.02em;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  color: #4b4b50;
  font-size: 13.5px;
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(0, 0, 0, 0.04); }
.nav-item.active { background: rgba(0, 113, 227, 0.10); color: var(--blue); font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; font-size: 14px; opacity: 0.85; }
.sidebar .foot { margin-top: auto; padding: 10px; font-size: 11.5px; color: #98989d; line-height: 1.6; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 26px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h2 { margin: 0; font-size: 16px; letter-spacing: -0.01em; }
.topbar .spacer { margin-left: auto; }
.topbar .who { font-size: 12.5px; color: var(--muted); }

.content { padding: 24px 26px 60px; }
.panel { display: none; }
.panel.active { display: block; animation: fade 0.2s ease; }

/* ---- 卡片 ---- */
.card {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.045);
  margin-bottom: 18px;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.card-head h3 { margin: 0; font-size: 15px; letter-spacing: -0.01em; }
.card-head .spacer { margin-left: auto; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.045);
}
.stat-card b { display: block; font-size: 26px; letter-spacing: -0.03em; line-height: 1.2; }
.stat-card span { font-size: 12px; color: var(--muted); }
.stat-card.accent b { color: var(--blue); }

/* ---- 表格 ---- */
.table-wrap { overflow-x: auto; border-radius: 12px; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 640px; }
table.tb th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  font-size: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: #fafafa;
}
table.tb td { padding: 12px; border-bottom: 1px solid #f0f0f2; vertical-align: middle; }
table.tb tr:last-child td { border-bottom: none; }
table.tb tr:hover td { background: #fafafd; }
.mono { font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 12px; letter-spacing: 0.02em; }

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}
.pill.ok { background: rgba(48, 209, 88, 0.14); color: #1d7a3a; }
.pill.warn { background: rgba(255, 159, 10, 0.16); color: #a15c00; }
.pill.err { background: rgba(255, 69, 58, 0.12); color: #b3261e; }
.pill.mute { background: rgba(0, 0, 0, 0.06); color: #6e6e73; }

.row-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
td .row-actions { justify-content: flex-end; }
.mini {
  height: 26px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  color: #4b4b50;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.mini:hover { border-color: var(--blue); color: var(--blue); }
.mini.danger:hover { border-color: var(--red); color: var(--red); }

/* ---- 表单 ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field input, .field select, .field textarea { font-size: 13.5px; height: 40px; }
.field textarea { height: auto; min-height: 92px; }
.field label { font-size: 12px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.toolbar .field { margin-bottom: 0; }
.toolbar .field input, .toolbar .field select { height: 36px; min-width: 130px; }
/* 长地址输入框：桌面端撑满一行，窄屏必须允许收缩，否则会把页面顶出横向滚动条 */
.field.grow { flex: 1 1 auto; min-width: 320px; }

/* ---- 图表 ---- */
.chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 150px;
  padding: 8px 2px 0;
}
.chart .bar-wrap { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.chart .bar {
  width: 100%;
  max-width: 34px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #4aa3f0, #0071e3);
  min-height: 3px;
  transition: height 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.chart .bar-lbl { font-size: 10px; color: #98989d; white-space: nowrap; }
.chart .bar-val { font-size: 10px; color: var(--muted); }

/* ---- 日志 ---- */
.log-line { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed #eee; font-size: 12.5px; }
.log-line:last-child { border-bottom: none; }
.log-line time { color: #98989d; flex: none; font-variant-numeric: tabular-nums; }
.log-line .tag { flex: none; }
/* 动态正文可以压缩换行，IP 不许被挤断 —— 否则窄屏会把整行顶出屏幕 */
.log-line .log-msg { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.log-line .log-code { color: #6e6e73; }
.log-line .log-ip { flex: none; color: #98989d; white-space: nowrap; }

/* ---- 提示条 ---- */
.banner {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 11px 16px;
  border-radius: 12px;
  background: rgba(0, 113, 227, 0.07);
  border: 1px solid rgba(0, 113, 227, 0.15);
  color: #08457e;
  font-size: 12.5px;
  margin-bottom: 16px;
}
.banner.warn { background: rgba(255, 159, 10, 0.09); border-color: rgba(255, 159, 10, 0.25); color: #8a5200; }

@media (max-width: 860px) {
  .sidebar { width: 64px; padding: 14px 8px; }
  .sidebar .brand span:last-child, .nav-item span:last-child, .sidebar .foot { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .content { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ---- 批量选择条 ---- */
.bulk-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  margin-top: 12px;
  border-radius: 12px;
  background: rgba(0, 113, 227, 0.06);
  border: 1px solid rgba(0, 113, 227, 0.16);
  font-size: 12.5px;
  color: #08457e;
}
.bulk-bar.show { display: flex; }
.bulk-bar .mini { background: #fff; }
.tb td .row-check, .tb th .row-check { width: 15px; height: 15px; }
.tb tr.picked td { background: rgba(0, 113, 227, 0.045); }

/* ---- 批量操作按钮 ---- */
.mini.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.mini.primary:hover { color: #fff; opacity: 0.9; }
.btn.danger {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* ---- 富文本编辑器 ---- */
.rte {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.rte-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: #fafafc;
  border-bottom: 1px solid var(--line);
}
.rte-bar button {
  height: 28px;
  min-width: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  font-size: 12px;
  color: #4b4b50;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
}
.rte-bar button:hover { background: #fff; border-color: var(--line); color: var(--blue); }
.rte-bar button.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.rte-sep { width: 1px; height: 18px; background: var(--line); margin: 0 6px; }
.rte-body {
  min-height: 180px;
  max-height: 420px;
  overflow: auto;
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.72;
  color: #1d1d1f;
  outline: none;
}
.rte-body:empty::before {
  content: attr(data-placeholder);
  color: #b0b0b6;
  font-size: 12.5px;
}
.rte-body h2 { font-size: 18px; margin: 14px 0 8px; font-weight: 600; }
.rte-body h3 { font-size: 15px; margin: 12px 0 6px; font-weight: 600; }
.rte-body p { margin: 0 0 10px; }
.rte-body ul, .rte-body ol { margin: 0 0 10px; padding-left: 22px; }
.rte-body li { margin: 3px 0; }
.rte-body blockquote {
  margin: 10px 0;
  padding: 8px 14px;
  border-left: 3px solid var(--blue);
  background: rgba(0, 113, 227, 0.05);
  color: #3a3a3f;
  border-radius: 0 8px 8px 0;
}
.rte-body pre {
  background: #f5f5f7;
  border-radius: 8px;
  padding: 10px 12px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  overflow: auto;
}
.rte-body code { background: #f5f5f7; border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.rte-body img { max-width: 100%; border-radius: 10px; }
.rte-body a { color: var(--blue); }
.rte-body hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
.rte-source {
  display: block;
  width: 100%;
  min-height: 180px;
  border: none;
  padding: 14px 16px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 12px;
  line-height: 1.6;
  color: #1d1d1f;
  outline: none;
  resize: vertical;
}

/* ---- 支付 / 客服 ---- */
.check-line {
  display: inline-flex; align-items: center; gap: 7px; height: 36px;
  font-size: 13px; color: var(--text); cursor: pointer; white-space: nowrap;
}
.check-line input { width: 16px; height: 16px; }
.pm-row td { vertical-align: top; }
.pm-field { display: flex; flex-direction: column; gap: 6px; }
.pm-field input, .pm-field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px;
  font-size: 12px; font-family: inherit; background: #fff; color: var(--text);
}
.pm-field textarea { resize: vertical; min-height: 34px; }
.pm-field input.mono, .pm-field textarea.mono { font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; }
.pm-tip { font-size: 11px; color: var(--muted); line-height: 1.6; }
.pm-qr-preview {
  width: 46px; height: 46px; object-fit: contain; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; margin-top: 4px;
}
.tk-msg {
  padding: 9px 12px; border-radius: 12px; background: #f5f5f7; font-size: 13px;
  line-height: 1.65; max-width: 92%; white-space: pre-wrap; word-break: break-word;
}
.tk-msg.admin { background: rgba(0, 113, 227, 0.08); align-self: flex-start; }
.tk-msg.user { align-self: flex-end; }
.tk-msg-head { font-size: 11px; color: var(--muted); margin-bottom: 4px; }

/* ---- 应用标记（置顶 / 加粗 / 锁定） ---- */
.flag-row { display: flex; gap: 4px; }
.flag-chip {
  min-width: 24px;
  height: 22px;
  padding: 0 5px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: #c7c7cc;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
}
.flag-chip:hover { border-color: #b9b9be; color: #6e6e73; }
.flag-chip.on { font-weight: 700; }

/* ---------------- 源内广告：配置未生效警告 ---------------- */
.sa-warn {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 11px 14px;
  border-radius: 12px;
  background: #fff8e6;
  border: 1px solid #f0d08c;
  color: #8a5a00;
  font-size: 13px;
  line-height: 1.5;
}
.sa-warn[hidden] { display: none; }
.sa-warn-ic { flex: 0 0 auto; font-size: 15px; }
.sa-warn-txt { flex: 1 1 auto; min-width: 0; }
.sa-warn .btn { flex: 0 0 auto; }
.sa-warn.ok {
  background: #eefaf1;
  border-color: #b7e4c4;
  color: #1d6f3a;
}

/* 标题颜色选择器（应用编辑弹窗） */
.tc-row { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; padding: 4px 0; }
.tc-dot {
  width: 26px; height: 26px; border-radius: 50%; border: 0; padding: 0;
  cursor: pointer; box-shadow: 0 0 0 1px #d2d2d7; transition: transform .12s;
}
.tc-dot:hover { transform: scale(1.08); }
.tc-dot.on { box-shadow: 0 0 0 2px #0071e3, 0 0 0 4px #fff; }
.tc-preview { font-weight: 800; font-size: 15px; color: #1d1d1f; margin-left: 10px; }

/* ---------- 应用弹窗：下载方式编辑器 ---------- */
.dl-rows { display: grid; gap: 8px; }
.dl-row {
  border: 1px solid var(--line, #e5e5ea); border-radius: 10px;
  padding: 8px 10px; background: #fbfbfd;
}
.dl-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dl-line .spacer { flex: 1 1 auto; }
.dl-badge {
  flex: none; font-size: 11px; padding: 2px 8px; border-radius: 6px; font-weight: 500;
  background: rgba(0, 113, 227, 0.1); color: #0071e3;
}
.dl-badge.file { background: rgba(48, 209, 88, 0.16); color: #1d7a3a; }
.dl-badge.pan { background: rgba(255, 159, 10, 0.18); color: #9a5b00; }
.dl-row .dl-label { flex: 1 1 160px; min-width: 120px; height: 32px; }
.dl-row .dl-code { flex: 0 0 120px; width: 120px; height: 32px; }
.dl-row .dl-url { width: 100%; height: 34px; margin-top: 6px; font-size: 12.5px; }
.dl-size { font-size: 11.5px; color: #8e8e93; }
.dl-btn {
  flex: none; height: 28px; min-width: 28px; padding: 0 9px;
  border: 1px solid var(--line, #e5e5ea); background: #fff; border-radius: 7px;
  font-size: 12px; color: #1d1d1f; cursor: pointer; font-family: inherit;
}
.dl-btn:hover { background: #f2f2f5; }
.dl-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.dl-btn.del { color: #d70015; }
.dl-btn.del:hover { background: rgba(215, 0, 21, 0.08); }
.dl-add { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.dl-empty {
  padding: 14px; text-align: center; font-size: 12.5px; color: #8e8e93;
  border: 1px dashed var(--line, #e5e5ea); border-radius: 10px;
}

/* ---------------- 定时采集 / 一键采集 ---------------- */
.sc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 40px;
  padding: 8px;
  border: 1px solid #e5e5ea;
  border-radius: 10px;
  background: #fafafa;
}
.sc-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #e5e5ea;
  font-size: 12px;
  color: #1d1d1f;
  max-width: 100%;
}
.sc-chip b { font-weight: 600; }
.sc-chip i { font-style: normal; color: #8e8e93; font-size: 11px; }
.sc-chip button {
  border: 0;
  background: none;
  color: #8e8e93;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}
.sc-chip button:hover { color: #d70015; }
.sc-empty { color: #8e8e93; font-size: 12px; padding: 6px 4px; }
.sc-state-run { background: #e8f0fe; color: #1a56db; }
.sc-state-ok { background: #e8f7ee; color: #1a7f37; }
.sc-state-fail { background: #fdecec; color: #c0392b; }
.sc-state-wait { background: #f5f5f7; color: #6e6e73; }

/* ---------------- 排版修正 ---------------- */
/* 放在 .field / .toolbar 里的复选框行：别被通用 label / input 规则撑成方块 */
.field label.check-line,
.toolbar label.check-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: auto;
  line-height: 1.4;
  margin: 0;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
}
.field label.check-line input,
.toolbar label.check-line input {
  width: 16px;
  height: 16px;
  min-width: 16px;
  margin: 0;
  flex: none;
}

/* 后台列表的应用图标：图片挂了就回落到首字头像，不要显示破图 */
.icon-cell { position: relative; display: inline-block; width: 34px; height: 34px; }
.icon-cell img { width: 100%; height: 100%; border-radius: 9px; object-fit: cover; display: block; }
.icon-cell .icon-fb {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  border-radius: 9px; font-size: 15px; font-weight: 600; color: #fff;
}
.icon-cell img.is-broken { display: none; }
.icon-cell img.is-broken + .icon-fb { display: flex; }

/* 支付方式里的二维码：已上传的图片只显示缩略图 + 体积，不倒 base64 */
.pm-qr-saved {
  display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted);
  padding: 6px 8px; border: 1px dashed var(--line); border-radius: 8px; background: #fafafa;
}

/* ---------------- 窄屏修正（≤860px） ----------------
   手机上侧边栏收成 64px 图标条，内容区只剩 ~300px：
   长地址输入框和 14 根柱子的图表都会把页面顶宽。 */
@media (max-width: 860px) {
  /* 地址框不再保底 320px */
  .field.grow { min-width: 0; }
  .toolbar .field { flex: 1 1 100%; }
  .toolbar .field input, .toolbar .field select { min-width: 0; width: 100%; }

  /* 图表改为横向滚动：柱子保持可读宽度，页面本身不再溢出 */
  .chart { overflow-x: auto; overflow-y: hidden; gap: 4px; }
  .chart .bar-wrap { flex: 0 0 26px; }
  .chart .bar-lbl { font-size: 9px; }

  /* 动态一行放不下：时间/类型/IP 占第一行，正文独占第二行 */
  .log-line { flex-wrap: wrap; gap: 6px 10px; }
  .log-line .log-msg { flex: 1 1 100%; order: 3; }
  .log-line .log-ip { order: 2; margin-left: auto; }
}

/* ================================================================
   广告管理
   ================================================================ */

.card-head .ad-search {
  height: 32px;
  width: 180px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 12.5px;
  outline: none;
  background: #fff;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.card-head .ad-search:focus {
  border-color: rgba(0, 113, 227, 0.45);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}
.ad-filter {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 12.5px;
  padding: 0 8px;
  outline: none;
  color: var(--text);
}

/* ---- 广告位速查表 ---- */
.ad-slot-list { display: flex; flex-direction: column; gap: 16px; }
.ad-slot-list[hidden] { display: none; }
/* 这些元素自带 display:flex，[hidden] 会被类选择器盖掉，统一兜一层 */
.ad-up-preview[hidden], .ad-up-empty[hidden], .ad-up-bar[hidden] { display: none !important; }
.ad-slot-group { display: flex; flex-direction: column; gap: 8px; }
.ad-slot-page {
  font-size: 11.5px;
  font-weight: 600;
  color: #98989d;
  letter-spacing: 0.06em;
}
.ad-slot-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 8px;
}
.ad-slot-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fbfbfd;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s, background 0.16s, transform 0.16s;
}
.ad-slot-item:hover {
  border-color: rgba(0, 113, 227, 0.4);
  background: #fff;
  transform: translateY(-1px);
}
.ad-slot-item b { font-size: 12.5px; font-weight: 600; color: var(--text); }
.ad-slot-item code {
  font-size: 10.5px;
  color: var(--blue);
  font-family: ui-monospace, Menlo, monospace;
}
.ad-slot-item span { font-size: 10.5px; color: #98989d; }

/* ---- 列表 ---- */
.ad-thumb {
  width: 104px;
  height: 44px;
  border-radius: 9px;
  overflow: hidden;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.9);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.ad-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ad-row-title {
  font-weight: 550;
  font-size: 13px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ad-row-sub {
  font-size: 11.5px;
  color: #98989d;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ad-row-slot { font-size: 12px; color: var(--text); }
.ad-row-key {
  font-size: 10.5px;
  color: #98989d;
  font-family: ui-monospace, Menlo, monospace;
}
.ad-style-tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  background: #f0f4fb;
  color: #245b96;
  font-size: 11px;
  white-space: nowrap;
}
.pill.warn { background: rgba(255, 159, 10, 0.12); color: #8a5200; }

/* ---- 编辑器 ---- */
/* .modal.wide 把宽度锁在 620px，这里要用同等特异度覆盖掉 */
.modal.ad-modal {
  width: min(1080px, calc(100vw - 48px));
  max-width: none;
}
.modal.ad-modal .modal-body { overflow-y: auto; }
.ad-live-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 980px;
  background: rgba(48, 209, 88, 0.12);
  color: #1a7f3c;
  font-size: 11px;
  margin-right: 8px;
}
.ad-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 22px;
  align-items: start;
}
.ad-editor-form { min-width: 0; }
.ad-editor-form .form-grid { margin-bottom: 0; }

.ad-style-pick {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.ad-style-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.ad-style-btn:hover { border-color: #c9c9ce; }
.ad-style-btn.on {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
  background: #f7fbff;
}
.ad-style-btn .ad-style-ico {
  font-style: normal;
  font-size: 15px;
  line-height: 1;
  color: var(--blue);
  margin-bottom: 3px;
}
.ad-style-btn b { font-size: 12.5px; font-weight: 600; }
.ad-style-btn span {
  font-size: 10.5px;
  color: #98989d;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 图片上传 */
.ad-upload {
  position: relative;
  border: 1.5px dashed #d6d6dc;
  border-radius: 13px;
  background: #fbfbfd;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s;
  overflow: hidden;
}
.ad-upload:hover, .ad-upload.drag { border-color: var(--blue); background: #f6fbff; }
.ad-up-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 22px 16px;
  color: #98989d;
  font-size: 12px;
}
.ad-up-empty b { color: var(--text); font-size: 13px; font-weight: 550; }
.ad-up-ico { font-size: 20px; opacity: 0.55; }
.ad-up-preview { display: flex; align-items: center; gap: 12px; padding: 10px; }
.ad-up-preview img {
  width: 132px;
  height: 74px;
  object-fit: cover;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  flex: none;
}
.ad-up-meta { display: flex; flex-direction: column; gap: 7px; font-size: 11.5px; color: #6e6e73; }
.ad-up-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 7px;
  font-size: 11.5px;
  color: #6e6e73;
}
.ad-up-bar i {
  display: block;
  height: 5px;
  width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, #0071e3, #34aadc);
  transition: width 0.2s;
  flex: 1 1 auto;
  max-width: 220px;
}

/* 背景预设 */
.ad-bg-presets { display: flex; gap: 7px; margin-bottom: 8px; flex-wrap: wrap; }
.ad-bg-dot {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
  cursor: pointer;
  padding: 0;
  transition: transform 0.16s, box-shadow 0.16s;
}
.ad-bg-dot:hover { transform: scale(1.08); box-shadow: 0 0 0 1px var(--blue); }

.ad-switches {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  padding: 12px 0 2px;
  border-top: 1px dashed var(--line);
  margin-top: 4px;
}

/* 实时预览 */
.ad-editor-preview {
  position: sticky;
  top: 12px;
  background: #f7f8fb;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.ad-preview-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #6e6e73;
}
.ad-preview-head b { font-size: 12.5px; color: var(--text); }
.ad-preview-head span { margin-left: auto; font-size: 11px; color: #98989d; }
.ad-preview {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-preview > .ad { width: 100%; }
.ad-preview-empty {
  color: #98989d;
  font-size: 12px;
  padding: 26px 0;
}
.ad-preview-tip { margin-top: 10px; font-size: 11px; color: #98989d; line-height: 1.6; }
/* 预览里的悬浮广告不要真的浮起来 */
.ad-preview .ad-float-wrap { position: static; width: 100%; max-width: none; animation: none; }
.ad-preview .ad-card { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1); }
.ad-preview .ad-native::after { display: none; }

@media (max-width: 1080px) {
  .ad-editor { grid-template-columns: 1fr; }
  .ad-editor-preview { position: static; }
}
@media (max-width: 720px) {
  .ad-style-pick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .card-head .ad-search { width: 100%; }
  .ad-slot-items { grid-template-columns: 1fr 1fr; }
}

/* 广告面板：窄屏下别把操作按钮挤出表格 */
#adStats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ad-num { display: flex; align-items: baseline; gap: 5px; font-size: 12.5px; }
.ad-num b { font-weight: 600; }
.ad-num span { font-size: 10.5px; color: #98989d; }
.ad-num.sub b { font-weight: 500; color: #6e6e73; }
.ad-actions { flex-wrap: wrap; gap: 5px; }
.ad-actions .mini { padding: 0 7px; font-size: 11.5px; height: 24px; }
.ad-thumb { width: 80px; height: 40px; }
.ad-row-title, .ad-row-sub { max-width: 220px; }
@media (max-width: 860px) {
  #adStats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  #adStats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
