:root {
  --bg: #060a11;
  --bg-soft: #0b1220;
  --panel: rgba(13, 23, 39, 0.82);
  --panel-solid: #0e1828;
  --panel-2: #111f33;
  --border: rgba(143, 174, 207, 0.17);
  --border-strong: rgba(143, 174, 207, 0.3);
  --text: #e7eef8;
  --muted: #8fa3ba;
  --faint: #60758d;
  --accent: #58e1c1;
  --accent-2: #72a9ff;
  --danger: #ff7085;
  --warning: #f6bd61;
  --success: #5ee0a0;
  --running: #70b8ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
  --radius: 16px;
  --mono: "SFMono-Regular", ui-monospace, Menlo, Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(900px 480px at 85% -10%, rgba(54, 122, 162, 0.22), transparent 65%),
    radial-gradient(800px 520px at 5% 100%, rgba(31, 89, 79, 0.18), transparent 60%),
    var(--bg);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
code, pre, .mono { font-family: var(--mono); }

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  padding: 28px;
}
.login-glow {
  position: absolute;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  background: conic-gradient(from 180deg, rgba(88, 225, 193, 0.18), rgba(114, 169, 255, 0.08), transparent 65%);
  filter: blur(10px);
  animation: slow-spin 20s linear infinite;
}
@keyframes slow-spin { to { transform: rotate(360deg); } }
.login-card {
  position: relative;
  width: min(420px, 100%);
  padding: 38px;
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  background: linear-gradient(170deg, rgba(17, 31, 51, 0.96), rgba(8, 15, 26, 0.97));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.login-card h1 { font-size: 30px; letter-spacing: -0.04em; margin: 8px 0 4px; }
.login-card .stack { margin-top: 28px; }
.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #04120e;
  background: linear-gradient(135deg, var(--accent), #b6ffe9);
  font-weight: 900;
  font-size: 24px;
  box-shadow: 0 10px 30px rgba(88, 225, 193, 0.2);
}
.brand-mark.small { width: 36px; height: 36px; border-radius: 11px; font-size: 18px; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 0.18em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.login-footer { margin-top: 22px; color: var(--faint); text-align: center; font-size: 12px; }

.stack { display: grid; gap: 16px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: rgba(5, 11, 20, 0.74);
  color: var(--text);
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: rgba(88, 225, 193, 0.65); box-shadow: 0 0 0 3px rgba(88, 225, 193, 0.1); background: rgba(5, 11, 20, 0.9); }
input::placeholder, textarea::placeholder { color: #52667d; }
textarea { min-height: 112px; padding: 11px 12px; resize: vertical; line-height: 1.55; }
select[multiple] { min-height: 160px; padding: 8px; }
select[multiple] option { padding: 5px 7px; border-radius: 6px; }
.form-error { color: #ff9aaa; background: rgba(255, 112, 133, 0.09); border: 1px solid rgba(255, 112, 133, 0.25); border-radius: 10px; padding: 9px 12px; font-size: 13px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: rgba(20, 35, 56, 0.7);
  color: var(--text);
  padding: 8px 14px;
  font-weight: 700;
  transition: transform 0.12s, border-color 0.15s, background 0.15s;
}
.button:hover { border-color: rgba(88, 225, 193, 0.45); background: rgba(24, 43, 68, 0.9); }
.button:active { transform: translateY(1px); }
.button.primary { color: #04120e; border-color: transparent; background: linear-gradient(135deg, var(--accent), #8ff5dc); }
.button.primary:hover { filter: brightness(1.06); }
.button.ghost { background: transparent; }
.button.danger { color: #ffc0c9; border-color: rgba(255, 112, 133, 0.35); background: rgba(255, 112, 133, 0.08); }
.button.danger:hover { border-color: rgba(255, 112, 133, 0.6); background: rgba(255, 112, 133, 0.14); }
.button.small { min-height: 34px; padding: 5px 11px; font-size: 12px; }
.button.block { width: 100%; min-height: 46px; }
.button:disabled { opacity: 0.55; cursor: not-allowed; }
.button.disabled { pointer-events: none; opacity: 0.4; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0, 1fr); }
.sidebar {
  border-right: 1px solid var(--border);
  background: rgba(7, 13, 23, 0.78);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 4px 24px; }
.brand strong { display: block; font-size: 15px; letter-spacing: -0.02em; }
.brand small { display: block; color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em; }
.nav { display: grid; gap: 5px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-size: 12.5px; font-weight: 650; border: 1px solid transparent; }
.nav a:hover { color: var(--text); background: rgba(24, 43, 68, 0.55); }
.nav a.active { color: var(--accent); background: rgba(88, 225, 193, 0.08); border-color: rgba(88, 225, 193, 0.16); }
.nav-icon { width: 19px; text-align: center; color: var(--faint); }
.nav a.active .nav-icon { color: var(--accent); }

/* 侧边栏折叠分组：一级是分组标题（只占一行），二级才是页面入口。
   分组之间的细线把「日常运营 / 交易与成本 / …」分开，收起后整列只剩 5 行。 */
.nav-group { display: grid; gap: 4px; }
.nav-group + .nav-group { margin-top: 6px; padding-top: 9px; border-top: 1px solid rgba(143, 174, 207, 0.11); }
.nav-group-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 12px 5px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 14px; font-weight: 700; letter-spacing: 0.01em; cursor: pointer; text-align: left; }
.nav-group-head:hover { color: var(--text); background: rgba(24, 43, 68, 0.45); }
.nav-group-head:focus-visible { outline: 2px solid rgba(88, 225, 193, 0.5); outline-offset: 1px; }
.nav-group-label { flex: 1; }
.nav-group-caret { color: var(--faint); font-size: 12px; line-height: 1; transform: rotate(90deg); transition: transform 0.15s ease; }
.nav-group.collapsed .nav-group-caret { transform: rotate(0deg); }
.nav-group.collapsed .nav-group-body { display: none; }
.nav-group.has-active .nav-group-head { color: var(--accent); }
.nav-group.has-active .nav-group-caret { color: var(--accent); }
.nav-group-body { display: grid; gap: 5px; }

/* 汉堡按钮与抽屉遮罩：宽屏左栏本来就常驻，两者都不出现（见 <=820px 的分支）。 */
.nav-toggle { display: none; }
.nav-backdrop { display: none; }
.sidebar-note { margin-top: auto; padding: 14px 11px; display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--border); color: var(--faint); font-size: 11px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(94, 224, 160, 0.09); }

/* 分组全部展开时左栏会比视口高（21 个入口）。侧边栏自己滚，别把下半截顶到屏幕外面去。 */
@media (min-width: 821px) {
  .sidebar { max-height: 100vh; overflow-y: auto; }
}

.main { min-width: 0; }
.topbar { height: 64px; padding: 0 28px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 16px; background: rgba(6, 12, 21, 0.66); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20; }
.topbar-title { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { color: var(--muted); font-size: 12px; padding: 5px 9px; border: 1px solid var(--border); border-radius: 99px; }
.content { padding: 30px 32px 60px; max-width: 1500px; margin: 0 auto; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-head h1 { font-size: 27px; letter-spacing: -0.04em; margin-bottom: 5px; }
.page-head p { color: var(--muted); }
.head-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.center-actions { justify-content: center; margin-top: 16px; }

/* 分销「推广分佣」下的二级 tab（参数配置 / 提现工作台 / 批次工作台…）。 */
.aff-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.aff-tabs a { padding: 8px 14px; color: var(--muted); font-size: 13px; font-weight: 650; border-bottom: 2px solid transparent; }
.aff-tabs a:hover { color: var(--text); }
.aff-tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

.panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); box-shadow: 0 10px 35px rgba(0, 0, 0, 0.14); }
.panel-pad { padding: 20px; }
.section { margin-top: 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head h2 { font-size: 16px; letter-spacing: -0.02em; }
.section-head .hint { color: var(--faint); font-size: 12px; }
/* 任务详情「输入与输出」：用户输入素材 / 任务最终产物都渲染成带预览的 URL 卡片，
   不再把 input_medias 塞进折叠的 JSON 里。 */
.section-head.sub { margin-top: 15px; margin-bottom: 8px; }
.section-head.sub h3 { font-size: 12px; color: var(--muted); letter-spacing: 0.02em; }
.output-card { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 11px; padding: 11px; margin-top: 9px; border: 1px solid var(--border); border-radius: 12px; background: rgba(9, 17, 29, 0.66); }
.output-thumb { position: relative; width: 108px; aspect-ratio: 3 / 4; border-radius: 9px; overflow: hidden; background: #07101c; }
/* 缩略图不预取 CDN 资源：只画类型占位符，点「打开」才真正去下载大图 / 视频。 */
.media-thumb { position: relative; display: grid; place-items: center; width: 100%; height: 100%; background: linear-gradient(145deg, rgba(47, 83, 119, 0.26), rgba(7, 13, 23, 0.66)); }
.media-thumb-label { color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }
.media-play { position: absolute; inset: 0; display: grid; place-items: center; color: var(--accent); font-size: 22px; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6); }
.output-body { min-width: 0; display: grid; gap: 6px; align-content: start; }
.output-url { display: block; color: var(--accent-2); font-size: 11px; }
.media-tag { padding: 1px 7px; border: 1px solid var(--border); border-radius: 5px; color: var(--faint); font-size: 10px; font-weight: 700; white-space: nowrap; }
.media-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.media-actions .button.small { min-height: 28px; padding: 3px 9px; font-size: 11px; }
.label { color: var(--faint); font-size: 10px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.break { overflow-wrap: anywhere; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
/* 卡片数量不固定的区块（今日快照 9 张、趋势 5 张）用这个：窄屏自动折行，
   不会出现 grid-4 那种「4 张 + 孤零零 1 张」的排版。 */
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }

.funnel-base { margin: -4px 0 14px; color: var(--faint); font-size: 11px; }
.funnel-list { display: grid; gap: 15px; }
.funnel-row .funnel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.funnel-row .funnel-head b { font-family: var(--mono); font-size: 14px; color: var(--text); }
.funnel-meta { margin-top: 5px; color: var(--faint); font-size: 11px; }

.filters { padding: 15px; display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(130px, 1fr)) auto; gap: 10px; align-items: end; }
.filters .actions { display: flex; gap: 8px; align-items: center; }
.compact-filters { grid-template-columns: minmax(180px, 1fr) minmax(140px, 1fr) auto; }
/* 「只看今日」之后筛选栏只剩「时间口径 + 说明 + 刷新」，两列就够（见 app.js growthFilterHTML）。 */
.filters.growth-note-filters { grid-template-columns: minmax(0, 1fr) auto; }
/* 「区间渠道总量」的区间选择器：两个日期 + 一段说明 + 查询按钮。默认 .filters 是按
   「一个宽搜索框 + 三个窄条件 + 按钮」排的，说明落到窄列里会被挤成一条竖杠。 */
.filters.ads-range-filters { grid-template-columns: minmax(170px, 1fr) minmax(170px, 1fr) minmax(0, 2fr) auto; }
/* 投放归因的日期选择器：一个日期 + 一句说明 + 查询（看非今日时多一个「回到今天」）。 */
.filters.ads-day-filters { grid-template-columns: minmax(170px, 1fr) minmax(0, 3fr) auto; }
.order-filters { grid-template-columns: minmax(240px, 2fr) repeat(5, minmax(125px, 1fr)); }
.order-filters .actions { grid-column: span 1; }
/* 平台配置（登录白名单 / Meta 上报）：字段个数和宽度都不定，用 auto-fit 自己折行，
   不要把「有几个输入框」写死进网格列数 —— 加一个字段就得改一次 CSS。 */
.platform-form { padding: 15px; display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); gap: 12px; align-items: end; }
.platform-form .wide { grid-column: 1 / -1; }
.platform-form .actions { display: flex; gap: 8px; align-items: center; }
.platform-form input[readonly] { opacity: 0.7; cursor: not-allowed; }
/* 批 I · I1：全额退款的金额由该单实付自动带出、只读（切到部分退款 / 拒付后恢复可填）。 */
#aff-refund-form input[readonly] { opacity: 0.7; cursor: not-allowed; }
/* 验证码点击即复制：看着像代码 chip，不是按钮。 */
.code-chip { padding: 4px 10px; border: 1px solid var(--border); border-radius: 8px; background: rgba(24, 43, 68, 0.55); color: var(--accent); font-size: 13px; letter-spacing: 0.16em; cursor: pointer; }
.code-chip:hover { border-color: rgba(88, 225, 193, 0.45); }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--faint); font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em; font-weight: 800; padding: 4px 14px 11px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid rgba(143, 174, 207, 0.09); vertical-align: top; }
/* 成本合计单元格里上下两行金额（成本 / 收入）按小数点对齐：右对齐 + 等宽数字，
   两位小数是固定的，所以右边缘对齐就等于小数点对齐。 */
.cost-money { text-align: right; font-variant-numeric: tabular-nums; }
/* 成本合计里的当日收入：赚了绿、亏了红。必须是 class，不能写 inline style ——
   线上 CSP 是 style-src 'self'，style 属性和 <style> 块都会被浏览器直接拦掉。 */
.cost-revenue { color: var(--muted); }
.cost-revenue.up { color: var(--success); }
.cost-revenue.down { color: var(--danger); }
tbody tr:hover { background: rgba(47, 83, 119, 0.08); }
/* 成本明细里正在编辑的那一行：和 hover 区分开，一眼看得出上面的表单在改哪条。 */
tbody tr.is-editing { background: rgba(88, 225, 193, 0.12); }
tbody tr:last-child td { border-bottom: none; }
.task-id { color: var(--accent-2); font-family: var(--mono); font-size: 12px; }
.truncate { max-width: 430px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-empty { padding: 46px 20px; text-align: center; color: var(--muted); }

/* 账本时间线的「逐条分录」行（第 9 批：分组行下面把 ledger_events 摊开，缩进 + 弱化）。 */
.txn-sub td {
  color: var(--faint);
  font-size: 12px;
  background: rgba(127, 127, 127, 0.04);
}
/* 用户详情页的列表分区（见 app.js 的 bindCollapsibleSection）：默认收起，展开时才请求接口，
   收起时只留标题行 —— 一个老用户的任务 / 流水可能有几百条，不该点进详情就全拉一遍。 */
.section[data-collapse].is-collapsed > .collapse-body { display: none; }
.section[data-collapse].is-collapsed .section-head { margin-bottom: 0; }
.section[data-collapse] [data-collapse-toggle] { flex: 0 0 auto; margin-left: 8px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; color: var(--muted); font-size: 12px; }

/* 推荐配置：运营先看国家覆盖，再调标签权重，最后发布；所有配置都是 draft → active。 */
.rec-summary { margin-bottom: 2px; }
.section[data-rec-section].rec-collapsed > :not(.section-head) { display: none; }
.section[data-rec-section].rec-collapsed .section-head { margin-bottom: 0; }
.section[data-rec-section].rec-collapsed .section-head .rec-preview-controls,
.section[data-rec-section].rec-collapsed .section-head .head-actions { display: none; }
.rec-section-toggle { flex: 0 0 auto; margin-left: 8px; }
.rec-preview-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rec-preview-controls select { width: min(280px, 60vw); }
.inline-check { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; color: var(--muted); font-size: 12px; font-weight: 700; }
.inline-check input { width: auto; min-height: auto; margin: 0; }
.rec-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(145px, 0.55fr) minmax(120px, 0.35fr) minmax(120px, 0.35fr); gap: 14px; align-items: end; }
.rec-form .wide { grid-column: 1 / -1; }
.rec-form .actions { display: flex; align-items: center; gap: 8px; }
.rec-template-lookup { display: flex; align-items: center; gap: 10px; }
.rec-template-lookup input { font-family: var(--mono); }
.rec-weight { width: 84px; min-height: 35px; padding: 5px 8px; font-family: var(--mono); font-size: 12px; }
.rec-check { width: 16px; min-height: 16px; height: 16px; padding: 0; accent-color: var(--accent); }
.rec-preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 4px 20px 14px; }
.rec-preview-head h2 { margin: 4px 0 3px; font-size: 18px; letter-spacing: -0.03em; }
.rec-preview-head p { font-size: 12px; overflow-wrap: anywhere; }
.rec-coverage { padding: 0 20px 16px; }
.rec-preview-table { border-top: 1px solid var(--border); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border: 1px solid var(--border); border-radius: 99px; font-size: 11px; font-weight: 800; white-space: nowrap; color: var(--muted); background: rgba(143, 164, 186, 0.08); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.success { color: var(--success); background: rgba(94, 224, 160, 0.08); border-color: rgba(94, 224, 160, 0.22); }
.badge.failed { color: var(--danger); background: rgba(255, 112, 133, 0.08); border-color: rgba(255, 112, 133, 0.22); }
.badge.running { color: var(--running); background: rgba(112, 184, 255, 0.08); border-color: rgba(112, 184, 255, 0.2); }
.badge.warning { color: var(--warning); background: rgba(246, 189, 97, 0.08); border-color: rgba(246, 189, 97, 0.2); }
.badge.free { color: var(--accent); background: rgba(88, 225, 193, 0.1); border-color: rgba(88, 225, 193, 0.25); }
.badge.vip { color: #c3a6ff; background: rgba(163, 130, 255, 0.1); border-color: rgba(163, 130, 255, 0.28); }
.badge.unknown { color: var(--muted); }

.alert { padding: 14px 16px; border-radius: 12px; border: 1px solid; margin-top: 14px; }
.alert.error { border-color: rgba(255, 112, 133, 0.28); background: rgba(255, 112, 133, 0.08); color: #ffc0c9; }
.alert.warning { border-color: rgba(246, 189, 97, 0.25); background: rgba(246, 189, 97, 0.07); color: #f5d49d; }
.alert.info { border-color: rgba(114, 169, 255, 0.28); background: rgba(114, 169, 255, 0.08); color: #c3d8ff; }
.alert strong { display: block; margin-bottom: 3px; color: var(--text); }
.alert .mono { font-size: 12px; word-break: break-word; }

.metric { padding: 14px 15px; min-height: 84px; border: 1px solid var(--border); border-radius: 12px; background: rgba(12, 22, 38, 0.72); }
.metric-label { color: var(--faint); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.metric-value { margin-top: 7px; font-size: 17px; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 列表页状态列下面那行「DAG 状态 / 当前节点」：小一号，避免把表格行撑高。 */
.stage-inline { display: flex; align-items: center; gap: 4px; margin-top: 5px; }
.stage-inline .badge { padding: 2px 7px; font-size: 10px; }

/* 「DAG 状态 / 当前节点」两个徽章并排：徽章本身是 inline-flex，这里只负责对齐与收窄。 */
.metric-value-pair { display: flex; align-items: center; gap: 6px; }
.metric-sub { margin-top: 2px; color: var(--faint); font-size: 11px; }
/* 金额一律折美元，原币明细放下面一行小字（表格窄的时候会截断，所以 title 里也放一份）。
   小字用等宽字体：一排 "INR ₹1,497.00 · USD $21.98" 对齐看着比比例字体整齐。 */
.money-usd { font-family: var(--mono); }
.money-mix { margin-top: 2px; color: var(--faint); font-family: var(--mono); font-size: 10px; line-height: 1.35; }
.recharge-total-list { margin-top: 7px; display: grid; gap: 3px; }
.recharge-total-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 15px; font-weight: 750; }
.recharge-total-row .faint { font-size: 10px; font-weight: 500; white-space: nowrap; }

/* 今日快照：运营每天上班最先看的就是这几个数，所以字号比表格里的一格大一档，
   下面一行小字写这个数的口径或拆解。.is-key 给注册率和支付总额 —— 一个看流量质量、一个看钱。 */
.snapshot-card { padding: 15px 16px; min-height: 100px; border: 1px solid var(--border); border-radius: 12px; background: rgba(12, 22, 38, 0.72); }
.snapshot-card.is-key { border-color: rgba(88, 225, 193, 0.34); background: linear-gradient(155deg, rgba(88, 225, 193, 0.12), rgba(12, 22, 38, 0.72) 58%); }
/* 不要省略号：「47 人 · ≈ $4,512.30」这种人数+金额的组合一截断就看不出金额，
   宁可换行也不能把数字吃掉。overflow-wrap 只在真的放不下时才断词。 */
.snapshot-value { margin-top: 8px; font-size: 22px; font-weight: 800; letter-spacing: -0.01em; overflow-wrap: break-word; }
.snapshot-value small { margin-left: 4px; color: var(--faint); font-size: 12px; font-weight: 700; letter-spacing: 0; }
/* 金额（≈ $476.19）自己不许被拆行：换行要换在「人 ·」那个分隔符上，不能把 ≈ 和数字分开。 */
.snapshot-value .nb { white-space: nowrap; }
.snapshot-card.is-key .snapshot-value { color: var(--accent); }
.snapshot-sub { margin-top: 6px; color: var(--faint); font-size: 11px; }
.snapshot-sub b { color: var(--muted); font-family: var(--mono); }

.metric-list { display: grid; gap: 9px; }
.metric-row { display: grid; grid-template-columns: minmax(90px, 150px) minmax(0, 1fr) 70px; gap: 12px; align-items: center; color: var(--muted); font-size: 12px; }
.metric-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metric-row > b { text-align: right; font-family: var(--mono); font-size: 11px; color: var(--text); }
.metric-track { display: block; width: 100%; height: 9px; border-radius: 99px; background: rgba(143, 174, 207, 0.08); overflow: hidden; }
.metric-fill { fill: var(--accent); }
/* 「趋势」分区：一张卡一个指标，折线 / 柱状共用这套卡片，表格视图用普通的 .table-wrap。 */
.trend-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.trend-toolbar .hint { margin-left: auto; color: var(--faint); font-size: 12px; }
.segmented { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 999px; background: rgba(7, 13, 23, 0.6); }
.segmented .segment { padding: 4px 13px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; }
.segmented .segment:hover { color: var(--text); background: rgba(24, 43, 68, 0.6); }
.segmented .segment.active { color: #04120e; background: linear-gradient(135deg, var(--accent), #8ff5dc); }
/* 图比数表宽：168px 一列会把折线挤成一根根竖线，这里给图表单独放宽到 260px。 */
.trend-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.trend-card { padding: 14px 15px 10px; border: 1px solid var(--border); border-radius: 12px; background: rgba(12, 22, 38, 0.72); overflow: hidden; }
.trend-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.trend-total-label { color: var(--faint); font-size: 10px; }
.trend-total { margin-top: 5px; font-size: 19px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* viewBox 等比缩放：圆点不会被拉扁，柱子宽度随卡片一起缩放（见 app.js 的 trendPlot）。 */
.trend-svg { display: block; width: 100%; height: auto; margin-top: 10px; }
.trend-axis { display: flex; justify-content: space-between; margin-top: 4px; color: var(--faint); font-family: var(--mono); font-size: 10px; }

/* 「趋势」表格视图上面那块：挑指标画图 + 导出 CSV。图里的数值都走 SVG 属性，颜色不能写在
   HTML 上（CSP 只给了 style-src 'self'，inline style 会被拦），所以图例 / chip 上那颗点的
   颜色只能按 data-trend-pick 写在样式表里 —— 改 app.js 里 trendMetrics 的 color 时这里要
   跟着一起改。 */
.trend-combo { margin-bottom: 14px; padding: 14px 15px 12px; border: 1px solid var(--border); border-radius: 12px; background: rgba(12, 22, 38, 0.72); }
.trend-combo-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.trend-combo-head .hint { margin-left: auto; color: var(--faint); font-size: 12px; }
.trend-picks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.trend-pick { display: inline-flex; align-items: center; padding: 4px 11px; border: 1px solid var(--border); border-radius: 999px; background: rgba(7, 13, 23, 0.6); color: var(--faint); font-size: 11px; font-weight: 700; }
.trend-pick:hover { color: var(--text); border-color: var(--border-strong); }
.trend-pick.on { color: var(--text); border-color: rgba(88, 225, 193, 0.42); background: rgba(88, 225, 193, 0.1); }
.trend-pick.legend { color: var(--muted); font-weight: 600; }
.trend-pick.legend b { margin-left: 6px; color: var(--text); font-family: var(--mono); }
.trend-swatch { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--muted); }
[data-trend-pick="guests"] .trend-swatch { background: #58e1c1; }
[data-trend-pick="registered_users"] .trend-swatch { background: #7ee0a8; }
[data-trend-pick="paid_orders"] .trend-swatch { background: #72a9ff; }
[data-trend-pick="usd_cents"] .trend-swatch { background: #f6bd61; }
[data-trend-pick="old_paying_users"] .trend-swatch { background: #e879f9; }
[data-trend-pick="old_paying_revenue_usd_cents"] .trend-swatch { background: #22d3ee; }
[data-trend-pick="cost_usd_cents"] .trend-swatch { background: #a3e635; }
[data-trend-pick="aov"] .trend-swatch { background: #b28cff; }
[data-trend-pick="orders_created"] .trend-swatch { background: #ff9d6b; }
[data-trend-pick="failed_orders"] .trend-swatch { background: #ff6b8b; }
.trend-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.trend-combo-svg { display: block; width: 100%; height: auto; margin-top: 12px; }
/* 网格只画横线：横轴是等距自然日，竖线会跟柱子糊在一起。 */
.trend-combo-grid { stroke: rgba(143, 174, 207, 0.12); stroke-width: 1; }
.trend-combo-scale { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; color: var(--faint); font-family: var(--mono); font-size: 10px; }
.breakdown-row { grid-template-columns: minmax(100px, 150px) minmax(0, 1fr) minmax(105px, auto); }
.breakdown-row > span small { display: block; color: var(--faint); font-size: 10px; }
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.detail-item { display: grid; gap: 5px; min-width: 0; }
.detail-item span { color: var(--faint); font-size: 10px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.detail-item strong { font-size: 12px; overflow-wrap: anywhere; }

.alias-list { display: flex; flex-wrap: wrap; gap: 7px; }
.alias { padding: 5px 8px; border-radius: 8px; background: rgba(7, 13, 23, 0.6); border: 1px solid var(--border); color: var(--muted); font-family: var(--mono); font-size: 10px; }
.alias b { color: var(--text); font-weight: 600; }

.waterfall { display: grid; gap: 9px; }
.span-row { display: grid; grid-template-columns: 250px minmax(180px, 1fr) 100px; gap: 14px; align-items: center; }
.span-name { min-width: 0; }
.span-name strong { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.span-name small { color: var(--faint); font-size: 10px; }
.span-track { height: 22px; border-radius: 6px; position: relative; background: rgba(143, 174, 207, 0.06); overflow: hidden; }
.span-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.span-bar { fill: rgba(88, 225, 193, 0.75); }
.span-bar.failed { fill: rgba(255, 112, 133, 0.9); }
.span-bar.running { fill: rgba(112, 184, 255, 0.72); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.span-duration { color: var(--muted); font-family: var(--mono); font-size: 11px; text-align: right; }

.clipboard-helper { position: fixed; opacity: 0; pointer-events: none; }

.timeline { position: relative; display: grid; gap: 0; }
.timeline-item { position: relative; display: grid; grid-template-columns: 165px 18px minmax(0, 1fr); gap: 12px; padding: 0 0 14px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-time { color: var(--faint); font-family: var(--mono); font-size: 10px; padding-top: 2px; text-align: right; }
.timeline-axis { position: relative; display: flex; justify-content: center; }
.timeline-axis::before { content: ""; position: absolute; top: 10px; bottom: -14px; width: 1px; background: var(--border); }
.timeline-item:last-child .timeline-axis::before { display: none; }
.timeline-dot { position: relative; z-index: 1; margin-top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 4px var(--bg-soft); }
.timeline-dot.success { background: var(--success); }
.timeline-dot.failed { background: var(--danger); }
.timeline-dot.warning { background: var(--warning); }
.timeline-dot.info { background: var(--running); }
.timeline-body { padding: 1px 0 9px; min-width: 0; }
.timeline-body strong { font-size: 12px; }
.timeline-body p { color: var(--muted); font-size: 11px; word-break: break-word; }
.timeline-body code { color: var(--faint); font-size: 10px; }

.node-grid, .card-list { display: grid; gap: 10px; }
.node-card, .entity-card { padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: rgba(9, 17, 29, 0.66); }
.entity-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.entity-title { font-weight: 750; font-size: 13px; min-width: 0; }
.entity-title code { color: var(--accent-2); }
.entity-meta { color: var(--faint); font-size: 11px; margin-top: 3px; }
.entity-error { margin-top: 9px; color: #ffafba; font-size: 12px; word-break: break-word; }
.kv { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; color: var(--muted); font-size: 11px; }
.kv b { color: var(--text); font-weight: 600; }

details { border: 1px solid var(--border); border-radius: 10px; background: rgba(7, 13, 23, 0.42); }
details + details { margin-top: 8px; }
summary { list-style: none; cursor: pointer; padding: 10px 12px; color: var(--muted); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--faint); font-family: var(--mono); }
details[open] summary::after { content: "−"; }
details > .detail-body { padding: 0 12px 12px; }
pre { margin: 0; padding: 12px; border-radius: 9px; background: #050a12; border: 1px solid rgba(143, 174, 207, 0.12); color: #b9ccdf; font-size: 11px; line-height: 1.6; overflow: auto; max-height: 480px; white-space: pre-wrap; word-break: break-word; }

.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.link-pill { display: inline-flex; padding: 5px 9px; border: 1px solid var(--border); border-radius: 8px; color: var(--accent-2); font-size: 11px; }

.empty-card, .error-card { padding: 50px 24px; text-align: center; }
.empty-card h2, .error-card h2 { font-size: 18px; margin-bottom: 6px; }
.empty-card p, .error-card p { color: var(--muted); }
.loading { padding: 60px; text-align: center; color: var(--muted); }
.spinner { width: 24px; height: 24px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; margin: 0 auto 12px; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; max-width: 420px; padding: 12px 15px; border-radius: 11px; background: #14243a; border: 1px solid var(--border-strong); box-shadow: var(--shadow); color: var(--text); font-size: 13px; }
.toast.error { border-color: rgba(255, 112, 133, 0.4); color: #ffc0c9; }

@media (max-width: 1100px) {
  .filters { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .filters .wide { grid-column: span 2; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .output-card { grid-template-columns: 84px minmax(0, 1fr); }
  .output-thumb { width: 84px; }
  .media-thumb-label { font-size: 10px; }
  .grid-auto { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-filters { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-row { grid-template-columns: 180px minmax(140px, 1fr) 80px; }
}

@media (max-width: 820px) {
  /* minmax(0, 1fr) 而不是 1fr：单列网格的 1fr 最小值是 min-content，
     左栏横排后的固有宽度会把整列撑到一千多像素，正文被推到屏幕外（2026-11-24 的移动端事故）。 */
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  /* backdrop-filter 会给 fixed 后代造一个包含块（Filter Effects 规范），抽屉因此被压成
     顶栏那么高（实测 92px）、关着时还会把页面顶宽。窄屏这条必须去掉，顺带也让汉堡按钮
     能盖在抽屉上面（没有 backdrop-filter 就不再自建层叠上下文）。 */
  .sidebar { min-height: auto; position: static; flex-direction: row; align-items: center; gap: 12px; padding: 12px 16px; width: 100%; min-width: 0; backdrop-filter: none; }
  .brand { padding: 0; flex: 1 1 auto; }
  .brand small, .sidebar-note { display: none; }

  /* 窄屏不再把 21 个入口摊成一条横滑带（手机上找不到东西），改成右侧抽屉 + 汉堡按钮：
     分组标题在抽屉里重新出现，靠分组折叠控制长度，竖向滚动。 */
  .nav-toggle {
    display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; position: relative; z-index: 42;
    padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
    background: rgba(13, 23, 39, 0.86); color: var(--muted); font-size: 12.5px; font-weight: 700; cursor: pointer;
  }
  .nav-toggle[aria-expanded="true"] { color: var(--accent); border-color: rgba(88, 225, 193, 0.35); }
  .nav-toggle-bars { display: grid; gap: 3px; width: 15px; }
  .nav-toggle-bars i { display: block; height: 1.5px; border-radius: 2px; background: currentColor; transition: transform 0.18s ease, opacity 0.18s ease; }
  .nav-open .nav-toggle-bars i:nth-child(1) { transform: translateY(4.5px) rotate(45deg); }
  .nav-open .nav-toggle-bars i:nth-child(2) { opacity: 0; }
  .nav-open .nav-toggle-bars i:nth-child(3) { transform: translateY(-4.5px) rotate(-45deg); }

  .nav {
    position: fixed; top: 0; right: 0; bottom: 0; left: auto; z-index: 41;
    width: min(86vw, 320px); display: grid; align-content: start; gap: 5px;
    padding: 62px 14px 30px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    background: var(--panel-solid); border-left: 1px solid var(--border-strong); box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5);
    transform: translateX(101%); visibility: hidden; transition: transform 0.22s ease, visibility 0.22s ease;
  }
  .nav-open .nav { transform: none; visibility: visible; }
  .nav-group { display: grid; gap: 4px; }
  .nav-group + .nav-group { margin-top: 6px; padding-top: 9px; border-top: 1px solid rgba(143, 174, 207, 0.11); }
  .nav-group-body { display: grid; gap: 5px; }
  .nav a { padding: 9px 12px; font-size: 13.5px; white-space: normal; }

  .nav-backdrop {
    display: block; position: fixed; inset: 0; z-index: 40; padding: 0; border: 0;
    background: rgba(3, 7, 13, 0.62); opacity: 0; visibility: hidden; transition: opacity 0.22s ease, visibility 0.22s ease; cursor: pointer;
  }
  .nav-open .nav-backdrop { opacity: 1; visibility: visible; }
  body.nav-locked { overflow: hidden; }
  .content { padding: 22px 16px 50px; }
  .topbar { padding: 0 16px; }
  .topbar-title { display: none; }
  .grid-2, .grid-3, .grid-4, .grid-auto { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .compact-filters, .order-filters { grid-template-columns: 1fr; }
  .rec-form { grid-template-columns: 1fr; }
  .platform-form { grid-template-columns: 1fr; }
  .platform-form .wide { grid-column: auto; }
  .rec-form .wide { grid-column: auto; }
  .rec-preview-head { flex-direction: column; }
  .rec-preview-controls { width: 100%; }
  .rec-preview-controls select { width: 100%; }
  .rec-template-lookup { flex-direction: column; align-items: stretch; }
  .detail-grid { grid-template-columns: 1fr; }
  .filters .wide { grid-column: auto; }
  .page-head { flex-direction: column; }
  .span-row { grid-template-columns: 120px minmax(100px, 1fr) 70px; gap: 8px; }
  .timeline-item { grid-template-columns: 105px 14px minmax(0, 1fr); gap: 8px; }
}

/* 运营总览的「总 / 今日 / 近 N 天」对比表：数字列右对齐并等宽，分组表头居中。 */
.metric-table td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.metric-table th:not(:first-child) { text-align: right; }
.metric-table th[colspan] { text-align: center; color: var(--muted); border-bottom: none; padding-bottom: 2px; }
.metric-table th[rowspan] { vertical-align: bottom; }
.metric-table td .faint { font-size: 11px; }

/* 运营总览的子 tab：指标太多，按用途分区，一次只看一类，避免一页滚到底。 */
.tabs-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 5px; border: 1px solid var(--border); border-radius: 999px; background: rgba(7, 13, 23, 0.6); }
.tabs .tab { padding: 7px 16px; border-radius: 999px; border: 1px solid transparent; color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; transition: color 0.15s, background 0.15s; }
.tabs .tab:hover { color: var(--text); background: rgba(24, 43, 68, 0.6); }
.tabs .tab.active { color: #04120e; background: linear-gradient(135deg, var(--accent), #8ff5dc); box-shadow: 0 8px 22px rgba(88, 225, 193, 0.16); }
.tabs-note { color: var(--faint); font-size: 12px; }
.tabs-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* 运营总览的看板按块懒加载（见 app.js 的 boardsByTab）：折叠着的时候连内容都不渲染，
   点「展开」才去拉这一块要的那几节，省得先画一屏空表格等人。 */
.ov-board.ov-collapsed > .ov-board-body { display: none; }
.ov-board > .section-head .hint { flex: 1 1 auto; }
.ov-board-toggle { flex: 0 0 auto; }
/* 「今日快照」里第二段内容（按国家划分）的小标题：同一张卡内换个层级，比再开一张
   看板卡更紧凑，也不至于和块标题（16px）抢驱动点。 */
.ov-subhead { margin: 20px 0 10px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font-size: 13px; font-weight: 700; color: var(--muted); }
.ov-subhead .hint { color: var(--faint); font-size: 11px; font-weight: 400; }
/* 漏斗全景 / 结构拆分 / 渠道码登记这几块的内容本身就是一组小卡片或表单
   （funnelPanel / breakdownPanel / 登记表单），外面已经是一张看板卡了，里面这层就别再
   画一遍边框和底色，否则卡里套卡。加载占位是 .loading，要留着它的内边距。 */
.ov-board .ov-board-body > .panel:not(.loading),
.ov-board .ov-board-body > .grid-2 > .panel,
.ov-board .ov-board-body > .grid-3 > .panel {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

@media (max-width: 820px) {
  .tabs { width: 100%; border-radius: 14px; }
  .tabs .tab { padding: 7px 12px; font-size: 12px; }
  .tabs-bar { margin-bottom: 14px; }
}

.impersonation-duration { display: inline-flex; align-items: center; gap: 6px; }
.impersonation-duration select { width: 112px; padding: 6px 8px; }

/* 支付配置页：套餐 / 付款方式展示 / 路由规则三块都在这一页，用 tab 分区。 */
.pm-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 5px; margin-bottom: 18px; border: 1px solid var(--border); border-radius: 999px; background: rgba(7, 13, 23, 0.6); }
.pm-tab { padding: 7px 16px; border-radius: 999px; border: 1px solid transparent; background: none; color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; cursor: pointer; transition: color 0.15s, background 0.15s; }
.pm-tab:hover { color: var(--text); background: rgba(24, 43, 68, 0.6); }
.pm-tab.active { color: #04120e; background: linear-gradient(135deg, var(--accent), #8ff5dc); box-shadow: 0 8px 22px rgba(88, 225, 193, 0.16); }

/* 干跑 / 保存后提示：这类提示是「会出事」的那种，用警告色整块标出来。 */
.pm-warn { margin: 0 0 12px; padding: 10px 14px; border: 1px solid rgba(246, 189, 97, 0.28); border-radius: 10px; background: rgba(246, 189, 97, 0.08); color: var(--warning); font-size: 12px; line-height: 1.6; }
.pm-warn p { margin: 0; }
.pm-warn p + p { margin-top: 4px; }

/* 渠道解析结果里的候选链：主选一行、后面兜底若干行。 */
.pm-candidate { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 3px 0; font-size: 12px; }
.pm-candidate + .pm-candidate { border-top: 1px dashed var(--border); }

.pm-effective-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; color: var(--faint); font-size: 12px; }

@media (max-width: 820px) {
  .pm-tabs { border-radius: 14px; }
  .pm-tab { padding: 7px 12px; font-size: 12px; }
  .pm-effective-meta { gap: 8px; }
}

/* 模版排行：一行就是一个可点击的模版，封面只做识别，不抢数字的注意力。 */
.factory-trial { display: grid; gap: 6px; margin-top: 8px; }
.factory-preview { width: 220px; max-height: 160px; background: #000; border-radius: 8px; }
.template-rank-list { display: grid; gap: 8px; }
.template-rank-row { display: grid; grid-template-columns: 28px 52px minmax(0, 1fr) auto; gap: 11px; align-items: center; padding: 8px; border: 1px solid transparent; border-radius: 11px; transition: background 0.15s, border-color 0.15s; }
.template-rank-row:hover { background: rgba(47, 83, 119, 0.12); border-color: var(--border); }
.rank-no { color: var(--faint); font-family: var(--mono); font-size: 12px; text-align: center; }
.template-rank-row:nth-child(-n+3) .rank-no { color: var(--accent); font-weight: 800; }
.rank-cover { width: 52px; height: 52px; border-radius: 9px; overflow: hidden; background: #07101c; display: grid; place-items: center; }
.rank-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rank-meta { display: grid; gap: 2px; min-width: 0; }
.rank-meta strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rank-name strong { min-width: 0; }
.rank-meta .faint { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-meta .badge { padding: 1px 6px; font-size: 10px; }
.rank-tags { overflow: hidden; }
.rank-tags .tag-list { flex-wrap: nowrap; overflow: hidden; }
.rank-count { display: grid; justify-items: end; gap: 1px; min-width: 92px; }
.rank-count b { color: var(--accent); font-family: var(--mono); font-size: 18px; line-height: 1.1; }
.rank-count span { color: var(--muted); font-size: 10px; white-space: nowrap; }
.rank-count .faint { color: var(--faint); }

.tag-list { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.tag { padding: 1px 6px; border: 1px solid var(--border); border-radius: 5px; color: var(--faint); font-size: 10px; }
.media-placeholder { display: grid; place-items: center; width: 100%; height: 100%; min-height: 52px; color: var(--faint); background: linear-gradient(145deg, rgba(47, 83, 119, 0.22), rgba(7, 13, 23, 0.6)); font-size: 10px; text-align: center; }

.template-detail-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 18px; align-items: start; }
.template-detail-cover { width: 180px; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: #07101c; }
.template-detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.template-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.template-section-note { display: flex; align-items: baseline; gap: 10px; margin-top: 15px; font-size: 11px; }
.template-section-note > .faint { flex: 0 0 64px; }

.template-work-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.template-work-card { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: rgba(9, 17, 29, 0.66); min-width: 0; }
.work-thumb { display: block; aspect-ratio: 3 / 4; background: #07101c; overflow: hidden; }
.work-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.work-body { padding: 9px 10px 10px; display: grid; gap: 6px; }
.work-body .head-actions { gap: 4px; }
.work-body .button.small { min-height: 28px; padding: 3px 7px; font-size: 10px; }

@media (max-width: 820px) {
  .template-rank-row { grid-template-columns: 24px 44px minmax(0, 1fr); }
  .rank-cover { width: 44px; height: 44px; }
  .rank-count { grid-column: 2 / -1; display: flex; align-items: baseline; justify-content: flex-end; gap: 7px; }
  .rank-count b { font-size: 15px; }
  .template-detail-layout { grid-template-columns: 1fr; }
  .template-detail-cover { width: min(220px, 100%); }
  .template-detail-grid { grid-template-columns: 1fr; }
}

/* 客诉工单：聊天式时间线。用户消息靠左、运营回复靠右，长文本保留换行。 */
.table-foot { padding: 14px 4px 2px; display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.support-thread { display: grid; gap: 12px; }
.support-message { max-width: 86%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: rgba(143, 164, 186, 0.06); }
.support-message.admin { margin-left: auto; border-color: rgba(112, 184, 255, 0.28); background: rgba(112, 184, 255, 0.07); }
.support-message-head { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; margin-bottom: 7px; }
.support-message-head strong { font-size: 12px; }
.support-message-head .faint { font-size: 10px; }
.support-message-body { white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.7; color: var(--text); }
.support-message-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.support-message-attachment { display: inline-flex; max-width: 240px; }
.support-message-attachment img { display: block; max-width: 240px; max-height: 220px; border: 1px solid var(--border); border-radius: 10px; }
.support-message-attachment--video { max-width: 280px; border: 1px solid var(--border); border-radius: 10px; }
.support-message-attachment--file { padding: 7px 9px; border: 1px solid var(--border); border-radius: 10px; color: var(--accent-2); font-size: 12px; }
.support-attachments-field { display: grid; gap: 8px; margin-top: 12px; }
.support-attachments-field__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.support-file-input { display: none; }
.support-attachment-list { display: flex; flex-wrap: wrap; gap: 8px; }
.support-attachment-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 6px 4px 4px; border: 1px solid var(--border); border-radius: 999px; background: rgba(143, 164, 186, 0.08); font-size: 11px; }
.support-attachment-chip img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.support-attachment-chip__icon { font-size: 14px; }
.support-attachment-chip__name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.support-attachment-chip button { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; }
.support-canned { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.support-canned label { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.support-canned select { min-width: 260px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-soft); color: var(--text); font-size: 12px; }
.support-canned .hint { color: var(--faint); font-size: 11px; }
.support-suggest-note { margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-soft); color: var(--text); font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.support-suggest-note strong { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.support-reply-box { display: grid; gap: 6px; margin-bottom: 14px; }
.support-reply-box span { color: var(--muted); font-size: 11px; font-weight: 700; }
.support-reply-box textarea { width: 100%; resize: vertical; min-height: 110px; }

/* 用户备注：客诉详情页和用户详情页共用同一条，两边的样式也共用。 */
.user-note-box { display: grid; gap: 6px; margin-bottom: 14px; }
.user-note-box span { color: var(--muted); font-size: 11px; font-weight: 700; }
.user-note-box textarea { width: 100%; resize: vertical; min-height: 88px; }
.user-note-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.user-note-text.is-empty { color: var(--faint); }

@media (max-width: 760px) {
  .support-message { max-width: 100%; }
  .table-foot { justify-content: flex-start; }
}

/* 保留期规则的编辑弹窗。表单挂在列表下面时，规则一多就要滚到底才能改一条；列表页
   其它地方（功能开关、成本录入）是内嵌表单，这里是唯一需要弹窗的场景，所以样式是本页
   专用，不去动那些既有类。 */
.modal-backdrop { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center;
  justify-content: center; padding: 24px; background: rgba(3, 8, 16, 0.68); }
.modal { width: min(760px, 100%); max-height: 86vh; overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 18px 4px; }
.modal-head h2 { margin: 0; font-size: 15px; }
.modal-hint { padding: 0 18px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.modal .platform-form { padding: 14px 18px 18px; }
/* 操作原因弹窗：只有一个输入框，别占满屏。 */
.reason-modal { width: min(560px, 100%); }

/* 功能开关弹窗里的定向规则编辑器。规则是固定的「人群 → 放量」五列，所以用网格排一行，
   比一行一个 JSON 好核对；表达不了的条件切到 JSON 模式（同一个弹窗里）。 */
.ff-modal { width: min(980px, 100%); }
.ff-rule-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ff-rule-head, .ff-rule-row {
  display: grid; gap: 8px; align-items: center;
  grid-template-columns: 84px minmax(150px, 1.5fr) 96px 138px minmax(130px, 1fr) 66px;
}
.ff-rule-head { padding: 0 2px 6px; color: var(--faint); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.09em; font-weight: 800; }
.ff-rule-row { margin-bottom: 8px; }
.ff-rule-row input { width: 100%; }
#ff-rule-editor textarea { width: 100%; }
@media (max-width: 760px) {
  .ff-rule-head { display: none; }
  .ff-rule-row { grid-template-columns: 1fr 1fr; }
}

/* 系统公告：发送对象三选一 + 国家多选 + 结果回显。三选一的胶囊复用全局 .inline-check
   （见上面 .inline-check 的定义：radio/checkbox 的尺寸对齐已经处理好），这里只加
   选中态和「按国家」的复选网格。 */
.notif-field-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }
.notif-audience { display: flex; flex-wrap: wrap; gap: 8px; }
.notif-audience .inline-check {
  padding: 8px 14px; border: 1px solid var(--border); border-radius: 999px;
  background: rgba(7, 13, 23, 0.6); font-size: 13px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.notif-audience .inline-check:hover { color: var(--text); background: rgba(24, 43, 68, 0.6); }
.notif-audience .inline-check.on { color: #04120e; background: linear-gradient(135deg, var(--accent), #8ff5dc); border-color: transparent; }
.notif-country-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px;
  max-height: 240px; overflow: auto; padding: 12px;
  border: 1px solid var(--border); border-radius: 12px; background: rgba(5, 11, 20, 0.5);
}
.notif-country-list .inline-check { font-weight: 500; }
.notif-unmatched { margin-top: 10px; color: #ff9aaa; font-size: 12px; line-height: 1.7; word-break: break-all; }
.notif-unmatched b { color: #ffd0d8; }
