/* node-dist 管理面板样式 — 石墨极简风（v0.21.0 主人定版：近黑石墨底、单色为主、语义色克制）。
   硬规矩：共享表单控件的三份选择器名单（基础 / :focus / 粗指针 16px）
   必须逐项完全一致，且含 input[readonly] 与全部用到的 input type，
   否则只读订阅链接框在 iOS 触屏聚焦时会被自动放大。 */

:root {
  color-scheme: dark;
  --bg: #101012;
  --card: #17171a;
  --card-solid: #17171a;
  --line: #26262b;
  --text: #ececf1;
  --muted: #9c9ca5;
  --accent: #a3b8dc;
  --accent-2: #7fc98f;
  --warning: #d9a05b;
  --danger: #e08a8a;
  --shadow: 0 16px 44px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

/* hidden 必须赢过一切 display 规则（如 .login-wrap 的 display:grid 会盖掉 UA 的
   display:none，登录成功后登录框关不掉、整屏压在面板上方）——全局兜底，勿删 */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background-color: var(--bg);
}

/* 背景固定在视口层，不随页面高度变化（同姊妹项目的教训） */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(180deg, #0c0c0e 0%, #101012 100%);
}

code, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

h1, h2, h3, p { margin-top: 0; }
h2 { font-size: 1.25rem; margin-bottom: 0; }
h3 { font-size: 1.05rem; }

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.9rem; line-height: 1.6; }
.error-text { color: var(--danger); font-size: 0.92rem; line-height: 1.5; }
.ok-text { color: var(--accent-2); }

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 48px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent-2);
  font-size: 0.78rem;
  margin-bottom: 8px;
}

.badge {
  display: inline-block;
  vertical-align: middle;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid rgba(127, 201, 143, 0.4);
  color: var(--accent-2);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.login-card {
  width: min(440px, 100%);
  padding: 30px;
}
.login-card h1 { margin-bottom: 10px; font-size: 1.9rem; }
.lead { color: var(--muted); line-height: 1.7; margin-bottom: 20px; }

/* ---------- 顶栏与页签 ---------- */
.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  margin-bottom: 18px;
}
.topbar h1 { font-size: 1.55rem; margin-bottom: 0; }
.topbar-title { min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.tabs {
  display: flex;
  gap: 8px;
  padding: 10px;
  margin-bottom: 18px;
  overflow-x: auto;
}
.tab {
  flex: 1 1 0;
  min-width: 84px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 11px 10px;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: #ececf1;
  border-color: #ececf1;
  color: #101012;
}

.section-card { padding: 22px 24px; margin-bottom: 20px; }
.section-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.foot { text-align: center; font-size: 0.85rem; padding: 8px 0 4px; }

/* ---------- 列表工具条（搜索/筛选，v0.13.0） ---------- */
/* 控件复用共享表单名单里的 input[type="search"] 与 select，不新增 type */
.list-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 2px 0 14px;
}
.list-toolbar input[type="search"] { flex: 1 1 200px; width: auto; }
.list-toolbar select { flex: 0 1 170px; width: auto; }
.list-count { font-size: 0.88rem; white-space: nowrap; }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid #33333a;
  background: #1d1d21;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.4;
}
.btn:hover { border-color: #4a4a52; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn.primary {
  background: #ececf1;
  border-color: #ececf1;
  color: #101012;
}
.btn.primary:hover { background: #ffffff; }
.btn.danger {
  background: rgba(224, 138, 138, 0.12);
  border-color: rgba(224, 138, 138, 0.4);
  color: var(--danger);
}
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 13px; font-size: 0.88rem; border-radius: 7px; }
.btn.block { width: 100%; margin-top: 14px; }
.btn.tiny { padding: 4px 9px; font-size: 0.82rem; border-radius: 6px; }

/* ---------- 表单控件（三份名单必须一致） ---------- */
label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 0.94rem;
}

textarea,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
select,
input[readonly] {
  width: 100%;
  border-radius: 9px;
  border: 1px solid #2c2c32;
  background: #131316;
  color: var(--text);
  padding: 12px 14px;
  font-size: 0.96rem;
  line-height: 1.55;
  outline: none;
  font-family: inherit;
}

textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
select:focus,
input[readonly]:focus {
  border-color: rgba(163, 184, 220, 0.75);
  box-shadow: 0 0 0 4px rgba(163, 184, 220, 0.12);
}

textarea { resize: vertical; min-height: 84px; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.88rem; }
input[readonly] { background: #17171a; color: #c9c9d1; }

.field { margin-bottom: 16px; min-width: 0; }
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 14px;
}
.check-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 500;
}
.check-wrap input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  flex: 0 0 auto;
}
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr));
  gap: 4px 14px;
}
.check-grid .check-wrap { min-height: 36px; font-size: 0.92rem; min-width: 0; }
/* 绑定来源选择器：名字可长可短，列宽下限放到 300px（窄了就整行一列），
   名字单行省略、把空间挤没时先截名字而不是逐字折行（0.24.1 修截图里
   「my- / 美国 / 31」竖排碎裂） */
.check-grid.src-pick { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.check-wrap .check-name {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.check-wrap .pill { flex: 0 0 auto; }

/* ---------- 统计卡 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
  min-width: 0;
}
.stat-card .stat-label { color: var(--muted); font-size: 0.85rem; margin-bottom: 6px; }
.stat-card .stat-value { font-size: 1.65rem; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.stat-card .stat-sub { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }

/* ---------- 表格与列表 ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  min-width: 0;
}
table.data th, table.data td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid #222228;
  vertical-align: top;
  overflow-wrap: anywhere;
}
table.data th { color: var(--muted); font-weight: 600; white-space: nowrap; }
table.data tr:last-child td { border-bottom: none; }

.item-list { display: grid; gap: 12px; }
.item-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #17171a;
  padding: 16px 18px;
  min-width: 0;
}
.item-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.item-title { font-weight: 700; font-size: 1.02rem; min-width: 0; overflow-wrap: anywhere; }
.item-meta { color: var(--muted); font-size: 0.88rem; line-height: 1.65; overflow-wrap: anywhere; }
.item-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.pill {
  display: inline-block;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.pill.ok { color: var(--accent-2); border-color: rgba(127, 201, 143, 0.4); }
.pill.err { color: var(--danger); border-color: rgba(224, 138, 138, 0.4); }
.pill.warn { color: var(--warning); border-color: rgba(217, 160, 91, 0.4); }
.pill.info { color: var(--accent); border-color: rgba(163, 184, 220, 0.4); }

.empty-box {
  border: 1px dashed #33333a;
  border-radius: 10px;
  padding: 26px 18px;
  text-align: center;
  color: var(--muted);
}

/* ---------- 弹窗 / 抽屉 ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: start center;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 12px;
  z-index: 60;
}
/* 横向滚偏物理堵死（v0.17.1）：iOS Safari 聚焦缩放的平移残留会落到内层滚动器上，
   overflow-x: hidden/clip 让正文没有任何横向滚动余地，被滚偏也无从发生；
   弹窗打开时根节点同样兜底。 */
.modal-body { overflow-x: hidden; }
.drawer-body { overflow-x: hidden; }
body:has(.modal-overlay), body:has(.drawer-panel) { overflow-x: hidden; }
.modal-panel {
  width: min(680px, 100%);
  max-height: none;
  padding: 24px;
  margin: auto 0;
}
.modal-panel.wide { width: min(880px, 100%); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.modal-head h2 { font-size: 1.2rem; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
.qr-box { text-align: center; margin: 10px 0 14px; }
.qr-box svg { width: 232px; height: 232px; max-width: 100%; background: #fff; }
.qr-link { word-break: break-all; line-height: 1.6; text-align: center; }

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 55;
}
.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(880px, 100vw);
  background: var(--card-solid);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  z-index: 56;
  overflow-y: auto;
  padding: 22px;
}

pre.code-view {
  background: #0c0c0e;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  font-size: 0.82rem;
  line-height: 1.55;
  max-height: 340px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0 0 14px;
}

.link-box { display: flex; gap: 10px; align-items: stretch; }
.link-box input[readonly] { flex: 1 1 auto; min-width: 0; }
.link-box .btn { flex: 0 0 auto; }

.once-warn {
  border: 1px solid rgba(217, 160, 91, 0.45);
  background: rgba(217, 160, 91, 0.09);
  border-radius: 10px;
  padding: 12px 14px;
  line-height: 1.6;
  margin-bottom: 14px;
}

/* ---------- 规则链编辑器 ---------- */
.rule-list { display: grid; gap: 12px; }
.rule-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #131316;
  padding: 14px;
  min-width: 0;
}
.rule-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}
.rule-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rule-fields { display: grid; gap: 0; min-width: 0; }

/* 来源勾选（聚合编辑器）：列可能被长来源名撑开，故 minmax(0,1fr) */
.pick-list { display: grid; gap: 8px; }
.pick-row {
  display: grid;
  /* 两列：名字弹性列 + 按钮组 auto。旧模板 auto/1fr/auto 只有两个子元素，
     第三列是死列，窄宽下按钮组先被挤折行、行高暴涨（v0.17.1 改） */
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  min-width: 0;
}
/* 名字过长走省略号截断，不许挤压按钮组、不许折行 */
.pick-row .pick-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-row .rule-tools { flex-wrap: nowrap; }
.pick-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---------- 动效（A 版·克制：只有淡入淡出，180ms，无位移/缩放） ---------- */
@keyframes nd-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
/* 页签面板靠 [hidden] 切换 display，动画会在每次显示时自然重启，无需 JS 介入 */
.tab-panel { animation: nd-fade-in 180ms ease; }
.modal-overlay, .modal-panel, .drawer-overlay, .drawer-panel { animation: nd-fade-in 180ms ease; }
.toast { animation: nd-fade-in 180ms ease; }
.btn, .tab, .item-card, .stat-card {
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

/* ---------- 吐司 ---------- */
.toast-root {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
}
.toast {
  background: rgba(23, 23, 26, 0.97);
  border: 1px solid #3a3a41;
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  line-height: 1.55;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}
.toast.err { border-color: rgba(224, 138, 138, 0.55); }
.toast.ok { border-color: rgba(127, 201, 143, 0.55); }

/* ---------- 触屏友好 ---------- */
/* text-size-adjust: 100%：关掉 iOS Safari 的文字自动放大——它不受控时会把
   布局撑偏，且是聚焦缩放/平移残留的触发源之一（v0.17.1） */
html { -webkit-tap-highlight-color: rgba(236, 236, 241, 0.08); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
button, a, input, select, textarea, label { touch-action: manipulation; }

@media (max-width: 640px) {
  .container { width: calc(100% - 20px); margin-top: 16px; }
  .section-card { padding: 18px 14px; }
  .topbar { padding: 16px; }
  /* .modal-panel / .drawer-panel 的竖屏内边距已由下方 720 块统一接管，此处不再重复 */
}

@media (pointer: coarse) {
  .btn, .tab { min-height: 48px; }
  /* 分类开关是傻瓜层的主操作，触控目标不能小于 40px */
  .rt-seg button { min-height: 40px; padding: 6px 15px; }
  .btn.small { min-height: 44px; }
  .btn.tiny { min-height: 40px; }
  .check-wrap { min-height: 52px; }
  .check-wrap input[type="checkbox"], .pick-row input[type="checkbox"] { width: 24px; height: 24px; }

  /* 16px 表单字号防 iOS Safari 聚焦自动放大（三份名单第三份，与上两份逐项一致） */
  textarea,
  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="url"],
  input[type="search"],
  input[type="date"],
  input[type="datetime-local"],
  select,
  input[readonly] {
    font-size: 16px;
  }
}

/* ---------- 竖屏适配（≤720px；桌面端 >720px 一概不受影响） ---------- */
@media (max-width: 720px) {
  /* 页签栏：单行不换行、横向可滑、页签不收缩、滚动条隐藏 */
  .tabs {
    flex-wrap: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; }

  /* 概览统计卡：单列 */
  .stat-grid { grid-template-columns: 1fr; }

  /* 数据表：保留横滑，表头/单元格不折行，两侧渐隐提示可滑 */
  .table-wrap {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
    mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent);
  }
  table.data th, table.data td { white-space: nowrap; }

  /* 概览来源健康表：转卡片行（标签来自单元格 data-label），只动这一张表 */
  #overviewSources .table-wrap {
    overflow-x: visible;
    margin: 0;
    padding: 0;
    -webkit-mask-image: none;
    mask-image: none;
  }
  table.data.health-table,
  table.data.health-table tbody,
  table.data.health-table tr,
  table.data.health-table td { display: block; width: 100%; }
  table.data.health-table thead { display: none; }
  table.data.health-table tr {
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #17171a;
    padding: 10px 12px;
    margin-bottom: 10px;
  }
  table.data.health-table td {
    border-bottom: none;
    padding: 3px 0;
    white-space: normal;
  }
  table.data.health-table td::before {
    content: attr(data-label) "：";
    color: var(--muted);
    font-weight: 600;
  }
  table.data.health-table td:first-child { font-weight: 700; font-size: 1rem; padding-bottom: 5px; }
  table.data.health-table td:first-child::before { content: none; }

  /* 来源/客户/模板/回收站卡：操作按钮 grid 平铺整行（每行 2 个） */
  .item-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .item-actions .btn { width: 100%; }

  /* 链接框：纵向堆叠——链接占满一行，按钮下一行平分 */
  .link-box { flex-wrap: wrap; }
  .link-box input[readonly] { flex: 1 1 100%; }
  .link-box .btn { flex: 1 1 0; }

  /* 弹窗：全屏，标题钉顶、内容滚动、操作区钉底 */
  .modal-overlay { padding: 0; }
  .modal-panel, .modal-panel.wide {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding: 18px 14px;
    border: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .modal-head { flex: 0 0 auto; }
  /* 单滚动器结构：只有正文滚动；操作栏已由 openModal 移出正文、
     是 panel flex 列的第三段，sticky 退役，不再压住正文（v0.17.1） */
  .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; }
  .modal-actions {
    flex: 0 0 auto;
    margin-top: 0;
    background: var(--card-solid);
    border-top: 1px solid var(--line);
    padding: 10px 0 2px;
  }

  /* 编辑抽屉：全屏，标题钉顶、内容滚动 */
  .drawer-panel {
    width: 100%;
    padding: 0;
    border-left: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .drawer-panel .modal-head { flex: 0 0 auto; padding: 16px 12px 10px; margin-bottom: 0; }
  .drawer-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 6px 12px 18px; }

  /* 表单：双列网格全改单列，规则编辑器字段堆叠 */
  .field-row { grid-template-columns: 1fr; }
  .check-grid { grid-template-columns: 1fr; }
  .rule-head { grid-template-columns: 1fr; }

  /* 列表工具条：堆叠——搜索框占满一行、筛选下一行 */
  .list-toolbar { flex-direction: column; align-items: stretch; }
  .list-toolbar input[type="search"], .list-toolbar select { flex: 1 1 auto; width: 100%; }
}

/* ---------- 减动效偏好：系统要求减少动态时全部关掉 ---------- */
/* 分流编辑器（v0.19.0）：三段结构化表单的行容器 */
.rt-sec-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 18px 0 8px; font-weight: 600;
}
.rt-row {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; margin-bottom: 10px; background: var(--card);
}
.rt-row-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 8px;
}
.rt-row-title { font-weight: 600; font-size: 0.92rem; }
.rt-row .field { margin-bottom: 10px; }
.rt-rule-row, .rt-provider-row {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.rt-rule-row select, .rt-rule-row input[type="text"],
.rt-provider-row select, .rt-provider-row input { flex: 1 1 130px; min-width: 0; }
.rt-rule-row .check-wrap { flex: 0 0 auto; }
#rtPreview { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; }

/* 分流编辑器傻瓜化（v0.19.1）：成员摘要 / 节点图形选择器。
   选择器列表不设内层滚动容器，纵向滚动沿用弹窗自身的单滚动器。 */
.rt-summary { margin: 0 0 8px; }
.rt-picker-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.rt-picker-tools input[type="search"] { flex: 1 1 200px; min-width: 0; }
.rt-picker-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.rt-picker-list { display: flex; flex-wrap: wrap; gap: 6px; }
.rt-picker-src { flex: 1 1 100%; font-weight: 600; padding: 8px 6px 2px; border-top: 1px solid var(--line); margin-top: 4px; }
.rt-picker-src:first-child { border-top: none; margin-top: 0; padding-top: 2px; }
.rt-legacy-box { margin-bottom: 8px; }
.rt-legacy-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.rt-legacy-chip { display: inline-flex; gap: 4px; align-items: center; }
.rt-legacy-del { background: none; border: none; color: inherit; cursor: pointer; padding: 0 2px; font-size: 12px; line-height: 1; }
.rt-node { display: flex; gap: 7px; align-items: center; min-width: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: #1d1d21; cursor: pointer; }
.rt-node:has(> input:checked) { background: #ececf1; border-color: #ececf1; color: #101012; }
.rt-node:has(> input:checked) .pill { background: rgba(16, 16, 18, 0.07); border-color: rgba(16, 16, 18, 0.25); color: #3c3c42; }
.rt-node-name { word-break: break-all; }

/* 分流分类开关（v0.21.0）：编辑器默认层——每类流量一行三档开关，
   高级设置（策略组/规则/规则集）默认折叠。 */
.rt-cat-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 9px 2px; border-bottom: 1px dashed var(--line);
}
.rt-cat-row:last-child { border-bottom: none; }
.rt-cat-name { font-weight: 600; font-size: 0.95rem; }
.rt-cat-desc { color: var(--muted); font-size: 0.82rem; margin-top: 2px; font-weight: 400; }
.rt-seg { display: flex; flex: 0 0 auto; border: 1px solid #33333a; border-radius: 8px; overflow: hidden; }
.rt-seg button {
  border: none; background: transparent; color: var(--muted);
  padding: 6px 13px; font-size: 0.85rem; font-weight: 600; cursor: pointer; line-height: 1.4;
}
.rt-seg button.on-proxy { background: #ececf1; color: #101012; }
.rt-seg button.on-direct { background: rgba(127, 201, 143, 0.22); color: #a7e8b8; }
.rt-seg button.on-reject { background: rgba(224, 138, 138, 0.2); color: #f0b4b4; }
.rt-adv-toggle { margin: 18px 0 2px; }
.rt-cat-ops { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; flex-wrap: wrap; }
.rt-cat-idx { color: var(--muted); font-weight: 400; }
.rt-sort { display: flex; gap: 4px; }
.rt-add-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
