:root {
  /* 配色对齐 NewsBreak Ad Manager：白色内容区 + 深色左侧导航 + 珊瑚红主色 */
  --bg: #f4f6f9;
  --bg-soft: #eef1f5;
  --card: #ffffff;
  --card-solid: #ffffff;
  --line: #d7dde5;
  --line-soft: #e8ecf1;
  --text: #12232f;
  --text-dim: #55677a;
  --text-faint: #8b9aab;
  --brand: #ff4d5b;
  --brand-soft: #ffe9eb;
  --teal: #12a8a0;
  --warn: #b7791f;
  --danger: #e0344a;
  --ok: #178a55;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 4px 16px #12232f1a;
  --sidebar-w: 208px;
  --rail: #0e2033;
  --rail-dim: #93a7bd;
}

* { box-sizing: border-box; }

/* 关键：本文件中多处设置了 display，会覆盖浏览器对 [hidden] 的默认处理，
   导致「隐藏」的容器仍然挡住页面。这条规则必须保留。 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body { background-image: none; }

a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: .2px; }
.muted { color: var(--text-dim); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.error-text { color: var(--danger); font-size: 13px; margin: 0; }

/* ── 登录 ─────────────────────────────────────────── */
.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  /* 科技感背景：深空蓝底 + 网格 + 两团柔光（纯 CSS，不加载图片） */
  background:
    radial-gradient(900px 520px at 18% 12%, #1a4f7a55, transparent 62%),
    radial-gradient(760px 460px at 82% 88%, #f4485f22, transparent 60%),
    linear-gradient(160deg, #071522 0%, #0A1B2E 42%, #0E2A45 100%);
  position: relative;
  overflow: hidden;
}
/* 细网格 + 一层缓慢移动的高光，让它"活"一点 */
.login-wrap::before,
.login-wrap::after {
  content: "";
  position: absolute;
  inset: -10%;
  pointer-events: none;
}
.login-wrap::before {
  background-image:
    linear-gradient(to right, #4cc9f01a 1px, transparent 1px),
    linear-gradient(to bottom, #4cc9f01a 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
}
.login-wrap::after {
  background: conic-gradient(from 210deg at 50% 50%, transparent 0deg, #4cc9f014 60deg, transparent 130deg);
  animation: login-sweep 18s linear infinite;
}
@keyframes login-sweep {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .login-wrap::after { animation: none; }
}
.login-card { position: relative; z-index: 1; }

/* 登录卡片：深色玻璃卡，和内部深色主题统一 */
.login-card {
  background: linear-gradient(180deg, #10243aE6, #0b1b2cF2);
  border: 1px solid #4cc9f033;
  box-shadow: 0 24px 60px #03080f66, 0 0 0 1px #ffffff0a inset, 0 0 40px #4cc9f014;
  backdrop-filter: blur(6px);
}
.login-card h1 { color: #eef6ff; }
.login-card .muted { color: #9fb6cc; }
.login-card .field > span { color: #9fb6cc; }
.login-card input {
  background: #0a1a2b;
  border-color: #2a4a68;
  color: #eef6ff;
}
.login-card input:focus { border-color: #4cc9f0; box-shadow: 0 0 0 3px #4cc9f022; }
.login-card .error-text { color: #ff9aa8; }
.login-card .btn-primary {
  background: linear-gradient(135deg, #f4485f, #ff6b7d);
  border-color: transparent;
  box-shadow: 0 10px 24px #f4485f44;
}
.login-credit {
  margin: 2px 0 0;
  text-align: center;
  font-size: 11.5px;
  letter-spacing: .4px;
  color: #7d93aa;
}
/* 验证码：题目是一个可点的按钮，点一下换题 */
.captcha-row { display: grid; grid-template-columns: 118px 1fr; gap: 10px; }
.captcha-question {
  background: #0a1a2b;
  border: 1px dashed #2a4a68;
  border-radius: var(--radius-sm);
  color: #9be8ff;
  font: inherit;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 9px 4px;
  cursor: pointer;
  user-select: none;
}
.captcha-question:hover { border-color: #4cc9f0; color: #cdf3ff; }
/* 尺寸与排版；外观（深色玻璃卡）由上面那段登录页专用规则给 */
.login-card {
  width: min(400px, 100%);
  border-radius: 18px;
  padding: 28px;
  display: grid;
  gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-lg { margin-bottom: 6px; }
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: #0A1B2E;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px; color: #fff;
  flex: none;
  overflow: hidden;
  box-shadow: 0 4px 14px #4cc9f029;
}
/* logo 用矢量图，缩放不糊 */
.brand-mark img { width: 100%; height: 100%; display: block; }
.brand h1 { font-size: 18px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 12.5px; color: var(--text-dim); }

input, select, textarea {
  width: 100%;
  background: #0e1526;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
select.input { width: auto; min-width: 128px; }

.btn {
  border: 1px solid var(--line);
  background: #1b2438;
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-danger { background: #f4485f22; border-color: #f4485f55; color: #ff8b9c; }
/* 执行模式：试算中（琥珀色，看得见但不刺眼） */
.btn-warn { background: #f5a52422; border-color: #f5a52466; color: #f7c46c; }
.btn-warn:hover { border-color: #f5a524; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

/* ── 布局 ─────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100dvh; }

.sidebar {
  border-right: 1px solid var(--line-soft);
  padding: 18px 14px;
  display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100dvh;
  background: #0d1424cc;
  backdrop-filter: blur(8px);
}
.nav { display: grid; gap: 3px; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: 13.5px;
}
.nav a:hover { background: #ffffff08; color: var(--text); }
.nav a.active { background: var(--brand-soft); color: #cddcff; font-weight: 600; }
.nav .badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; }
.sync-state { line-height: 1.5; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; z-index: 20;
  background: #0b1220e6; backdrop-filter: blur(10px);
  flex-wrap: wrap;
}
.topbar-left h2 { font-size: 17px; }
.topbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.view { padding: 20px 22px 90px; display: grid; gap: 18px; align-content: start; min-width: 0; }

.mobile-nav { display: none; }

/* ── 卡片 ─────────────────────────────────────────── */
.card {
  background: var(--card-solid);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.card-head h3 { font-size: 14.5px; }
.card-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; gap: 14px; }
.grid-kpi { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* ── KPI ──────────────────────────────────────────── */
.kpi { display: grid; gap: 6px; }
.kpi .label { font-size: 12.5px; color: var(--text-dim); display: flex; gap: 5px; align-items: center; }
.kpi .value {
  font-size: clamp(16px, 4.6vw, 22px);
  font-weight: 650;
  letter-spacing: .3px;
  overflow-wrap: anywhere;
}
.kpi .sub { font-size: 12px; color: var(--text-faint); }
.delta { font-size: 12px; font-weight: 600; }
.delta.up { color: var(--ok); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--text-faint); }

/* ── 表格 ─────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
/* 所有单元格文字统一左对齐（之前数字列靠右、名称列也靠右，读起来不整齐）；
   数字列用等宽数字（tabular-nums）保证上下位数能对齐。 */
th, td { padding: 9px 10px; text-align: left; white-space: nowrap; }
th {
  color: var(--text-dim); font-weight: 500; font-size: 12px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: var(--card-solid);
}
td { border-bottom: 1px solid var(--line-soft); }
th:first-child, td:first-child { text-align: left; }
tbody tr:hover { background: #ffffff06; }
td.num { font-variant-numeric: tabular-nums; }
.sub-name { display: block; font-size: 11.5px; color: var(--text-faint); }

/* ── 标签 ─────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: #ffffff12; color: var(--text-dim);
}
.badge.ok { background: #2fbf7122; color: #6ee7a5; }
.badge.info { background: #2f6df622; color: #9dbcff; }
.badge.warn { background: #f5a52422; color: #f7c46c; }
.badge.danger { background: #f4485f22; color: #ff92a3; }
.badge.shadow { background: #ffffff10; color: var(--text-dim); }
.badge.gray { background: #ffffff0d; color: var(--text-faint); }

.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line-soft); }
.tabs button {
  background: none; border: none; color: var(--text-dim);
  padding: 8px 12px; cursor: pointer; font: inherit;
  border-bottom: 2px solid transparent;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--brand); font-weight: 600; }

/* ── 提示条 ───────────────────────────────────────── */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  background: #2f6df610;
  border-radius: var(--radius-sm);
  padding: 11px 13px; font-size: 12.8px; color: #c6d3ea; line-height: 1.6;
}
.notice.warn { border-left-color: var(--warn); background: #f5a52410; }
.notice.danger { border-left-color: var(--danger); background: #f4485f10; }
.notice.ok { border-left-color: var(--ok); background: #2fbf7110; }

/* ── 图表 ─────────────────────────────────────────── */
.chart { width: 100%; height: 240px; display: block; overflow: visible; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-dim); }
.chart-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.chart-tip {
  position: absolute; pointer-events: none;
  background: #0e1526f2; border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 9px; font-size: 12px;
  box-shadow: var(--shadow); z-index: 40; white-space: nowrap;
}
.chart-host { position: relative; }

/* ── 弹窗 / 提示 ──────────────────────────────────── */
.modal-host {
  position: fixed; inset: 0; z-index: 80;
  background: #060a14cc; backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: 20px;
}
.modal {
  width: min(760px, 100%); max-height: 88dvh; overflow-y: auto;
  background: var(--card-solid); border: 1px solid var(--line);
  border-radius: 16px; padding: 20px; box-shadow: var(--shadow);
  display: grid; gap: 14px;
}
.modal.wide { width: min(1000px, 100%); }

.toast-host {
  position: fixed; right: 18px; bottom: 18px; z-index: 90;
  display: grid; gap: 8px; max-width: min(380px, 90vw);
}
.toast {
  background: #16203af2; border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 10px; padding: 11px 13px; font-size: 13px;
  box-shadow: var(--shadow); animation: slide-in .18s ease-out;
}
.toast.ok { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--danger); }
@keyframes slide-in { from { transform: translateY(8px); opacity: 0; } }

/* ── 表单 / 向导 ──────────────────────────────────── */
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stepper { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.stepper .step {
  font-size: 12px; color: var(--text-faint);
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line-soft);
}
.stepper .step.active { color: #cddcff; border-color: var(--brand); background: var(--brand-soft); }
.stepper .step.done { color: #6ee7a5; border-color: #2fbf7155; }

.drop {
  border: 1.5px dashed var(--line); border-radius: var(--radius);
  padding: 28px; text-align: center; color: var(--text-dim);
  cursor: pointer; transition: .15s;
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }

.map-grid { display: grid; gap: 8px; }
.map-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--line-soft);
}
.map-row .sys-field { font-size: 12.8px; }
.map-row .sys-field .req { color: var(--danger); margin-left: 4px; }

.kv { display: grid; grid-template-columns: 128px 1fr; gap: 6px 12px; font-size: 12.8px; }
.kv dt { color: var(--text-faint); }
.kv dd { margin: 0; word-break: break-all; }

.diff { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.diff .was { color: #ff92a3; }
.diff .now { color: #6ee7a5; }

.empty { text-align: center; color: var(--text-faint); padding: 34px 12px; font-size: 13px; }
.skeleton { background: linear-gradient(90deg, #ffffff08, #ffffff14, #ffffff08); border-radius: 8px; height: 14px; }

/* ── 响应式 ───────────────────────────────────────── */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .view { padding: 14px 14px 96px; }
  .topbar { padding: 12px 14px; }
  .topbar-right { width: 100%; }
  .topbar-right .input { flex: 1; min-width: 0; }
  .grid { gap: 11px; }
  .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 13px; }
  .card-head h3 { font-size: 14px; }
  .kpi .value { font-size: 19px; }
  .kpi .sub { line-height: 1.45; }
  .notice { font-size: 12.4px; padding: 10px 11px; }
  .topbar-left h2 { font-size: 16px; }
  .toast-host { left: 14px; right: 14px; bottom: 84px; max-width: none; }
  .mobile-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    background: #0d1424f2; backdrop-filter: blur(12px);
    border-top: 1px solid var(--line-soft);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .mobile-nav a {
    display: grid; gap: 3px; place-items: center;
    font-size: 10.5px; color: var(--text-faint); padding: 5px 0; position: relative;
  }
  .mobile-nav a.active { color: #cddcff; }
  .mobile-nav a .dot {
    position: absolute; top: 2px; right: 22%;
    background: var(--danger); color: #fff;
    border-radius: 999px; font-size: 9.5px; padding: 0 5px; font-weight: 700;
  }
  .map-row { grid-template-columns: 1fr; }
  .kpi .value { font-size: 20px; }
  th, td { padding: 8px; }
}

/* ══════════════════════════════════════════════════════════
   NewsBreak Ad Manager 风格覆盖层
   （放在最后，靠层叠优先级覆盖上面的深色主题）
   ══════════════════════════════════════════════════════════ */

body { background-image: none; }
/* 只设底色：用 background 简写会把登录页的渐变和网格清掉 */
.login-wrap { background-color: var(--rail); }

/* 左侧深色导航 */
.sidebar {
  background: var(--rail);
  border-right: none;
  color: #fff;
}
.sidebar .brand strong { color: #fff; }
/* 侧栏品牌：中文名一行放下，副标题换行显示（208px 的宽度里别挤成两行） */
.sidebar .brand > div { display: grid; line-height: 1.3; min-width: 0; }
.sidebar .brand strong { white-space: nowrap; font-size: 13.5px; letter-spacing: .2px; }
.sidebar .brand .muted { font-size: 10.5px; letter-spacing: .6px; text-transform: uppercase; }
.sidebar .muted, .sidebar .sync-state { color: var(--rail-dim); }
.sidebar .btn-ghost { color: #cfe0f0; border-color: #ffffff2e; background: transparent; }
.sidebar .btn-ghost:hover { border-color: var(--brand); }
.nav a { color: var(--rail-dim); }
.nav a:hover { background: #ffffff12; color: #fff; }
.nav a.active { background: var(--brand); color: #fff; font-weight: 600; }
.nav a.active .badge { background: #ffffff2e; color: #fff; }

/* 顶部工具条 */
.topbar { background: #fff; box-shadow: 0 1px 0 var(--line-soft); }

input, select, textarea { background: #fff; }

.btn { background: #fff; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: #ef3d4c; border-color: #ef3d4c; }
.btn-danger { background: #fdeaed; border-color: #e0344a55; color: var(--danger); }
.btn-danger:hover { background: #fbd9de; }
/* 试算模式按钮（浅色主题） */
.btn-warn { background: #fdf3e0; border-color: #e0a33a66; color: #9a6413; }
.btn-warn:hover { background: #fbe9cd; border-color: #e0a33a; }

th { background: #fafbfd; }
tbody tr:hover { background: var(--brand-soft); }

.badge { background: #eef1f5; color: var(--text-dim); }
.badge.ok { background: #178a5518; color: #0f6b42; }
.badge.info { background: #e6efff; color: #2a58b8; }
.badge.warn { background: #fdf3e0; color: #9a6413; }
.badge.danger { background: #fdeaed; color: #b3243a; }
.badge.shadow, .badge.gray { background: #eef1f5; color: var(--text-faint); }

.notice { background: #eef4ff; color: #33475b; }
.notice.warn { background: #fdf7eb; border-left-color: #e0a33a; }
.notice.danger { background: #fdf0f2; }
.notice.ok { background: #eef8f2; }

.chart-tip { background: #fff; }
.modal-host { background: #12232f66; }
.modal { box-shadow: 0 18px 50px #12232f33; }
.toast { background: #fff; }
.drop { background: #fff; }

/* NewsBreak 表格里的开关样式 */
.switch {
  position: relative; display: inline-block; width: 34px; height: 20px;
  flex: none;
}
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px; background: #c9d2dc; transition: .18s;
}
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: .18s; box-shadow: 0 1px 3px #12232f33;
}
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch input:disabled + span { opacity: .45; }

/* 顶部页签，模仿 NewsBreak 的 Campaigns / Ad sets / Ads */
.tabs { border-bottom: 1px solid var(--line-soft); }
.tabs button { color: var(--text-dim); font-weight: 500; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* 表格页脚（Total N items） */
.table-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 9px 10px; margin-top: 4px;
  border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-dim);
}

/* 规则条件行 */
.cond-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) minmax(110px, .9fr) minmax(90px, .8fr) minmax(120px, 1fr) minmax(90px, .8fr) 32px;
  gap: 8px; align-items: end;
  padding: 10px 0; border-bottom: 1px dashed var(--line-soft);
}
.cond-row .field > span { font-size: 11.5px; }
@media (max-width: 1100px) {
  .cond-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 运行计划的时间网格 */
.slot-grid { display: grid; gap: 3px; font-size: 11px; }
.slot-grid .slot-head { display: grid; grid-template-columns: 54px repeat(24, 1fr); gap: 3px; color: var(--text-faint); }
.slot-grid .slot-row { display: grid; grid-template-columns: 54px repeat(24, 1fr); gap: 3px; align-items: center; }
.slot-grid .slot-cell {
  height: 16px; border-radius: 3px; background: #eef1f5; cursor: pointer;
  border: 1px solid transparent;
}
.slot-grid .slot-cell.on { background: var(--brand); }
.slot-grid .slot-label { color: var(--text-dim); }

/* ── 日期范围选择器（对齐 NewsBreak 后台）── */
.daterange { position: relative; display: inline-block; }
.daterange-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 7px 10px; font-size: 12.5px; color: var(--text); cursor: pointer;
}
.daterange-btn:hover { border-color: var(--brand); }
.daterange-label { font-variant-numeric: tabular-nums; }
.daterange-icon { opacity: .6; }
.daterange-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 70;
  display: flex; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 16px 40px #12232f2e; overflow: hidden;
}
.daterange-presets {
  display: grid; align-content: start; gap: 2px; padding: 10px 8px;
  border-right: 1px solid var(--line-soft); min-width: 156px;
  max-height: 360px; overflow-y: auto;
}
.daterange-group {
  padding: 8px 10px 3px; font-size: 10.5px; letter-spacing: .4px;
  text-transform: uppercase; color: var(--text-faint);
}
.daterange-preset { display: block; width: 100%; }
.daterange-preset {
  text-align: left; background: none; border: none; cursor: pointer;
  padding: 7px 10px; border-radius: 6px; font: inherit; font-size: 12.5px;
  color: var(--text-dim); white-space: nowrap;
}
.daterange-preset:hover { background: var(--bg-soft); color: var(--text); }
.daterange-preset.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.daterange-cal { padding: 12px; }
.daterange-nav {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft);
}
.daterange-nav-title {
  min-width: 168px; text-align: center; font-size: 12.5px;
  font-weight: 600; color: var(--text);
}
.daterange-nav-btn {
  width: 26px; height: 26px; border: 1px solid var(--line); background: #fff;
  border-radius: 6px; cursor: pointer; font: inherit; font-size: 13px;
  color: var(--text-dim); line-height: 1; display: grid; place-items: center;
}
.daterange-nav-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* ── 广告管理：ID 文本、页签筛选链、状态漏斗、排序表头 ── */
.cell-id {
  display: block; font-size: 11px; color: var(--text-faint);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.tabs .tab-chip {
  display: inline-flex; align-items: center; gap: 5px; margin-left: 7px;
  background: #6b7a8d; color: #fff; border-radius: 999px;
  padding: 2px 7px; font-size: 11px; font-weight: 500;
}
.tabs button.active .tab-chip { background: var(--brand); }
.tab-chip-x { opacity: .85; font-size: 10px; }
.tabs .tab-hint { margin-left: 7px; font-size: 11.5px; color: var(--text-faint); }

.colfilter { position: relative; display: inline-block; }
.colfilter-btn {
  border: none; background: none; cursor: pointer; color: var(--text-faint);
  font-size: 10px; padding: 0 2px;
}
.colfilter-btn.active { color: var(--brand); }
.colfilter-pop {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 60;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 12px 30px #12232f26; padding: 10px; min-width: 150px;
}
.colfilter-row {
  display: flex; align-items: center; gap: 7px; padding: 4px 2px;
  font-size: 12.5px; color: var(--text); cursor: pointer; white-space: nowrap;
}
.colfilter-row input { width: auto; margin: 0; }
.colfilter-sep { height: 1px; background: var(--line-soft); margin: 6px 0; }

th .sortable { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; }
th .sortable:hover { color: var(--brand); }
th .sortable.active { color: var(--text); font-weight: 600; }
.sort-icon { font-size: 10px; opacity: .55; }
th .sortable.active .sort-icon { opacity: 1; color: var(--brand); }

/* 顶栏的时区选择 */
.tz-input { width: auto; min-width: 210px; font-size: 12.5px; }
input:disabled, select:disabled {
  background: var(--bg-soft); color: var(--text-dim); cursor: not-allowed;
}

/* ── 时区选择器：带搜索的下拉，美国时区排最前 ── */
.tz-picker { position: relative; display: inline-block; }
.tz-btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 200px; justify-content: space-between;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 7px 10px; font-size: 12.5px; color: var(--text); cursor: pointer;
}
.tz-btn:hover { border-color: var(--brand); }
.tz-caret { font-size: 9px; color: var(--text-faint); }
.tz-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 80;
  width: 320px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 16px 40px #12232f2e; padding: 8px;
}
.tz-search { margin-bottom: 6px; }
.tz-list { max-height: 300px; overflow-y: auto; }
.tz-group {
  padding: 8px 8px 4px; font-size: 10.5px; letter-spacing: .4px;
  text-transform: uppercase; color: var(--text-faint);
}
.tz-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  padding: 7px 8px; border-radius: 6px; font: inherit; font-size: 12.5px;
  color: var(--text); font-variant-numeric: tabular-nums;
}
.tz-item:hover { background: var(--bg-soft); }
.tz-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.tz-offset { color: var(--text-faint); font-size: 11.5px; }

/* ── 表格：表内横向滚动条 + 自定义列弹窗 ── */
.table-wrap {
  /* 限定高度，让横向滚动条固定在表格底部（可视范围内），
     不用把页面拉到最底才能左右滑动 */
  max-height: calc(100vh - 300px);
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}
.table-wrap table { width: max-content; min-width: 100%; }
.table-wrap th { background: #fafbfd; z-index: 2; }

/* ── 列宽拖拽 ──
   拖过一次之后表变 fixed 布局，列宽完全按你拖的值走；
   长内容用省略号收住，鼠标停上去（title）能看到完整值。 */
.table-wrap table.resized { table-layout: fixed; }
.table-wrap table.resized th,
.table-wrap table.resized td {
  overflow: hidden;
  text-overflow: ellipsis;
}
th .col-grip {
  position: absolute; top: 0; right: -2px; bottom: 0;
  width: 8px; cursor: col-resize; z-index: 5;
}
th .col-grip:hover { background: linear-gradient(90deg, transparent, #f4485f55); }
body.col-resizing, body.col-resizing * { cursor: col-resize !important; user-select: none; }

.colpick {
  display: grid; grid-template-columns: 200px 1fr 300px;
  gap: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  background: #fff; min-height: 320px;
}
.colgroups { border-right: 1px solid var(--line-soft); padding: 8px; display: grid; align-content: start; gap: 2px; }
.colgroup {
  display: flex; align-items: center; justify-content: space-between;
  background: none; border: none; cursor: pointer; font: inherit; font-size: 13px;
  padding: 9px 10px; border-radius: 7px; color: var(--text); text-align: left;
}
.colgroup:hover { background: var(--bg-soft); }
.colgroup.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.collist { padding: 8px; overflow-y: auto; max-height: 360px; border-right: 1px solid var(--line-soft); }
.colrow {
  display: flex; align-items: center; gap: 9px; padding: 7px 9px;
  border-radius: 7px; font-size: 13px; cursor: pointer;
}
.colrow:hover { background: var(--bg-soft); }
.colrow.all { font-weight: 600; background: var(--bg-soft); }
.colrow input { width: auto; margin: 0; }
.colpick-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--line-soft); font-size: 13px;
}
.colpicked { max-height: 310px; overflow-y: auto; padding: 8px; }
.picked-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center;
  gap: 8px; border: 1px solid var(--line-soft); border-radius: 7px;
  padding: 7px 6px 7px 10px; margin-bottom: 6px; font-size: 12.5px;
  background: #fff; cursor: grab;
}
.picked-row:active { cursor: grabbing; }
.picked-row.dragging { opacity: .45; }
.picked-row.drop-target {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: 0 -2px 0 var(--brand) inset;
}
.drag-handle {
  color: var(--text-faint); font-size: 13px; line-height: 1;
  user-select: none; letter-spacing: -2px;
}
.picked-x { opacity: .55; }
.picked-x:hover { opacity: 1; }
.picked-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 素材类型标签（Ad 列） */
.creative-tag {
  display: inline-block; padding: 2px 7px; border-radius: 999px;
  background: var(--bg-soft); color: var(--text-dim); font-size: 11px;
  border: 1px solid var(--line-soft);
}

/* 排行榜：标题与列头，避免只看到一堆数字不知道是什么 */
.rank-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 8px; font-size: 13px; margin-bottom: 6px; flex-wrap: wrap;
}
.rank-subhead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 0 0 6px; margin-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11.5px; color: var(--text-faint);
}

/* 名称旁的规则入口：常驻，不受自定义列影响 */
.name-line { display: inline-flex; align-items: center; gap: 6px; }
.rule-btn {
  border: 1px solid var(--line); background: #fff; border-radius: 6px;
  width: 22px; height: 22px; display: inline-grid; place-items: center;
  cursor: pointer; font-size: 12px; color: var(--text-dim); padding: 0;
  flex: none;
}
.rule-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
/* 「规则自动化」列：设置按钮在上，ON / OFF 在下（和投放状态的排版一致） */
.rule-cell {
  display: grid;
  justify-items: center;
  gap: 2px;
}
.rule-state {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .4px;
  line-height: 1.2;
}
.rule-state.on { color: #178a55; }
.rule-state.off { color: #98a2b3; }
.rule-cell .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
/* 规则列表里的「执行方式」下拉：直接改，不用进编辑页 */
.rule-mode-select {
  min-width: 168px;
  font-size: 12.5px;
}
/* 「编辑广告组设置」的小铅笔：和规则齿轮区分开，别让人点错 */
.edit-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-dim);
  border-radius: 6px;
  padding: 0 6px;
  line-height: 18px;
  font-size: 12px;
  cursor: pointer;
}
.edit-btn:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }

/* 当前筛选条件：常驻显示，避免“筛完了却看不到筛了什么” */
.filterbar { display: none; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.filterbar.on {
  display: flex; background: #fff8f8; border: 1px solid #ffd9dd;
  border-radius: 8px; padding: 7px 10px;
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand-soft); color: var(--brand);
  border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 600;
}
.filter-chip-x { cursor: pointer; opacity: .75; }
.filter-chip-x:hover { opacity: 1; }

/* 合计行 */
tfoot td {
  border-top: 1px solid var(--line); border-bottom: none;
  background: #fafbfd; font-weight: 600; color: var(--text);
  position: sticky; bottom: 0;
}
tfoot td:first-child { text-align: left; }

/* 固定在最左的三列：勾选框 / 开关 / 规则自动化，横向滚动时不跑掉
   （只对"没有启用新版固定列"的表格生效；广告管理中心用的是 js-frozen 那套，
     固定哪几列、每列多宽由 JS 按实际列决定） */
.table-wrap table:not(.js-frozen):not(.plain) th:nth-child(1), .table-wrap table:not(.js-frozen):not(.plain) td:nth-child(1),
.table-wrap table:not(.js-frozen):not(.plain) th:nth-child(2), .table-wrap table:not(.js-frozen):not(.plain) td:nth-child(2),
.table-wrap table:not(.js-frozen):not(.plain) th:nth-child(3), .table-wrap table:not(.js-frozen):not(.plain) td:nth-child(3) {
  position: sticky; z-index: 3; background: #fff;
}
/* 宽度必须卡死：否则表格撑满容器后，多余空间会被分给这几列 */
.table-wrap table:not(.js-frozen):not(.plain) th:nth-child(1), .table-wrap table:not(.js-frozen):not(.plain) td:nth-child(1) {
  left: 0; width: 44px; min-width: 44px; max-width: 44px; padding: 9px 6px;
}
.table-wrap table:not(.js-frozen):not(.plain) th:nth-child(2), .table-wrap table:not(.js-frozen):not(.plain) td:nth-child(2) {
  left: 44px; width: 78px; min-width: 78px; max-width: 78px; padding: 9px 8px;
}
.table-wrap table:not(.js-frozen):not(.plain) th:nth-child(3), .table-wrap table:not(.js-frozen):not(.plain) td:nth-child(3) {
  left: 122px; min-width: 140px; white-space: nowrap;
}
.table-wrap table:not(.js-frozen):not(.plain) th:nth-child(4), .table-wrap table:not(.js-frozen):not(.plain) td:nth-child(4) { width: 100%; }
.table-wrap table:not(.js-frozen):not(.plain) thead th:nth-child(-n+3) { z-index: 4; background: #fafbfd; }

/* ── 新版：左侧固定块 + 右侧可拖可滚的指标列 ──
   固定哪几列、每列多宽都由 JS 算（见 ui.js 的 frozen 选项），
   这样"名称/状态"也能一起固定住，而且固定块不会被撑宽。 */
/* 列宽用"每个单元格上加 min/max 宽度"来控制（比 col + table-layout:fixed 可靠：
   fixed 布局下浏览器会把多余宽度摊给所有列，左侧固定块就被撑宽了）。 */
.table-wrap table.js-frozen td { overflow: hidden; text-overflow: ellipsis; }
.table-wrap table.js-frozen th.freeze-col,
.table-wrap table.js-frozen td.freeze-col {
  position: sticky; z-index: 3; background: #fff;
}
.table-wrap table.js-frozen thead th.freeze-col { z-index: 6; background: #fafbfd; }
.table-wrap table.js-frozen tfoot td.freeze-col { z-index: 5; background: #fafbfd; }
/* 固定块与滚动区之间给一条分隔线 + 淡淡的投影，一眼看出哪边能滚 */
.table-wrap table.js-frozen th.freeze-edge,
.table-wrap table.js-frozen td.freeze-edge {
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 10px -8px rgba(18, 35, 47, .35);
}
.table-wrap table.js-frozen tbody tr:hover td.freeze-col { background: var(--brand-soft); }

/* 手写规则区域（广告层） */
.quickrule { border: 1px solid var(--brand) !important; background: #fffafa !important; }
.quickrule-row {
  display: grid;
  grid-template-columns: 1.3fr 1.5fr 1fr 1fr 1.2fr auto;
  gap: 8px; align-items: end;
}
.quickrule-row .field > span { font-size: 11.5px; }
@media (max-width: 1100px) {
  .quickrule-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .colpick { grid-template-columns: 1fr; }
  .colgroups { border-right: none; border-bottom: 1px solid var(--line-soft); grid-auto-flow: column; }
}
.daterange-months { display: flex; gap: 18px; }
.daterange-month { text-align: center; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.daterange-week, .daterange-days {
  display: grid; grid-template-columns: repeat(7, 28px); gap: 2px;
}
.daterange-week span { text-align: center; font-size: 11px; color: var(--text-faint); }
.daterange-day {
  height: 26px; border: none; background: none; cursor: pointer; font: inherit;
  font-size: 12px; color: var(--text); border-radius: 6px;
}
.daterange-day:hover { background: var(--bg-soft); }
.daterange-day.blank { cursor: default; }
/* 日期时区选择（"今天"按哪个时区算） */
.daterange-tz-row {
  display: grid;
  gap: 4px;
  padding: 6px 6px 4px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 6px;
}
.daterange-tz-label { font-size: 11px; color: var(--text-faint); }
.daterange-tz { width: 100%; }
.daterange-tz-hint { font-size: 10.5px; color: var(--text-faint); padding: 0 6px 6px; line-height: 1.4; }
.daterange-day.in-range { background: var(--brand-soft); color: var(--brand); }
.daterange-day.edge { background: var(--brand); color: #fff; font-weight: 600; }
.daterange-day.today { box-shadow: inset 0 0 0 1px var(--line); }
@media (max-width: 900px) {
  .daterange-pop { flex-direction: column; right: auto; left: 0; }
  .daterange-presets { border-right: none; border-bottom: 1px solid var(--line-soft); grid-auto-flow: column; }
  .daterange-months { flex-direction: column; }
}

/* 手写规则：多条件行 + 且/或连接 */
.quickrule-rows { display: grid; gap: 6px; }
.quickrule-row-multi {
  display: grid;
  grid-template-columns: 124px 1.2fr 1.2fr .8fr 34px 34px;
  gap: 8px; align-items: center;
}
/* 门禁行：连接器 + 指标 + 累计窗口 + 比较 + 数值 + 单位 */
.quickrule-row-multi.gate { grid-template-columns: 124px 1.1fr 1fr 1.2fr .8fr 34px 34px; }
.quickrule-unit { text-align: center; }
.quickrule-conn { font-size: 12px; padding: 6px 8px; font-weight: 600; color: var(--brand); }
/* 表单分区：1 门禁 → 2 超标条件 → 3 倒计时 → 4 复检提醒 */
.quickrule-block { margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line-soft); }
.quickrule-block:first-of-type { border-top: none; margin-top: 6px; padding-top: 0; }
.quickrule-block-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.quickrule-step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 700;
}
.quickrule-row-inline { display: flex; gap: 14px; flex-wrap: wrap; }
.quickrule-check {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text); cursor: pointer;
}
.quickrule-check input { width: auto; }
.quickrule .quickrule-block .btn-sm { margin-top: 6px; }
/* 规则库区块：套用模式下把下面的表单锁住（避免改了参数却套用的是库里那条） */
.quickrule-library { background: var(--bg-soft); border-radius: 10px; padding: 8px 10px; margin-top: 8px; }
.quickrule-library .quickrule-row-inline { align-items: center; }
.quickrule-block.is-locked { opacity: .55; pointer-events: none; }
.quickrule-block.is-hidden { display: none; }
.rule-lib-select { width: 330px; min-width: 220px; flex: 0 1 330px; }
.toolbar-sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
/* 额度与消耗卡片：账户名列占宽，其余列保持窄（别被上面广告表格的列宽规则带跑） */
.budget-status .table-wrap { max-height: 300px; overflow: auto; }
.budget-status .table-wrap th:nth-child(-n+3),
.budget-status .table-wrap td:nth-child(-n+3) {
  position: static; left: auto; width: auto; min-width: 0; max-width: none;
}
.budget-status .table-wrap th,
.budget-status .table-wrap td { white-space: nowrap; }
.budget-status .table-wrap th:nth-child(1),
.budget-status .table-wrap td:nth-child(1) { width: 100%; }
.budget-status .table-wrap th:nth-child(4),
.budget-status .table-wrap td:nth-child(4) { width: auto; }
/* API 接入与开发页：同样解除广告表格的固定列宽，账户名要完整显示 */
.api-access-page .table-wrap th:nth-child(-n+3),
.api-access-page .table-wrap td:nth-child(-n+3) {
  position: static; left: auto; width: auto; min-width: 0; max-width: none;
}
.api-access-page .table-wrap th,
.api-access-page .table-wrap td { white-space: nowrap; }
.api-access-page .table-wrap td:nth-child(1) { width: 100%; }
.quickrule .field > span { font-size: 11.5px; }
@media (max-width: 1200px) {
  .quickrule-row-multi { grid-template-columns: 1fr 1fr; }
}
