/* =====================================================================
 * OpenClash 管理后台 —— 机场调度台 / 深夜航班信息屏
 * 概念: 订阅源=航班, 节点=航线, 到期=登机时间, 更新时间=航班状态
 * 语言: 深空蓝黑 + 信号绿/航线青, 等宽数据, 信号灯状态, 网格纹理
 * 全部功能钩子(class/id)保持不变, 仅替换视觉层
 * ===================================================================== */

/* =====================================================================
 * 阿里妈妈方圆体（Alimama） —— 全站统一字体
 * 字体文件位于 static/fonts/Alimama.woff2（本地加载，不依赖外部 CDN）
 * ===================================================================== */
@font-face {
  font-family: "Alimama";
  src: url("fonts/Alimama.woff2") format("woff2");
  font-display: swap;
}

/* 中文标点优化：引号、破折号等交给系统中文字体渲染，排版更接近原生中文文档 */
@font-face {
  font-family: "Punctuation SC";
  font-weight: 400;
  src: local("PingFang SC Regular"), local("Noto Sans CJK SC"), local("Microsoft YaHei");
  unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026, U+00B7, U+007E, U+002F;
}
@font-face {
  font-family: "Punctuation SC";
  font-weight: 500;
  src: local("PingFang SC Medium"), local("Noto Sans CJK SC"), local("Microsoft YaHei");
  unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026, U+00B7, U+007E, U+002F;
}
@font-face {
  font-family: "Punctuation SC";
  font-weight: 600;
  src: local("PingFang SC Semibold"), local("Noto Sans CJK SC Bold"), local("Microsoft YaHei Bold");
  unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026, U+00B7, U+007E, U+002F;
}
@font-face {
  font-family: "Punctuation SC";
  font-weight: 700;
  src: local("PingFang SC Semibold"), local("Noto Sans CJK SC Bold"), local("Microsoft YaHei Bold");
  unicode-range: U+201C, U+201D, U+2018, U+2019, U+2E3A, U+2014, U+2013, U+2026, U+00B7, U+007E, U+002F;
}

/* ========== 设计 Token ========== */
:root {
  /* 主操作色 —— 航线青 */
  --accent:        #2DD4BF;
  --accent-strong: #14B8A6;
  --accent-ink:    #04251F;

  /* 状态色 */
  --signal:   #34D399;
  --signal-ink: #D1FAE5;
  --amber:    #FBBF24;
  --amber-ink: #FEF3C7;
  --red:      #F87171;
  --red-ink:  #FEE2E2;
  --info:     #60A5FA;
  --info-ink: #DBEAFE;
  --purple:   #A78BFA;
  --purple-ink: #EDE9FE;

  /* 中性 & 表面(默认深夜调度台; html.theme-light 覆盖为日间) */
  --bg:       #0A0E1A;
  --panel:    #0D1322;
  --card:     #111A2E;
  --card-2:   #0F1626;
  --line:     rgba(148, 163, 184, .15);
  --line-strong: rgba(148, 163, 184, .32);
  --text:     #E6EDF7;
  --text-2:   #93A4BE;
  --text-3:   #5B6B84;

  /* 调度台面板(control-deck) */
  --deck-1:    #0A0F1F;
  --deck-2:    #0C1428;
  --grid-line: rgba(148, 163, 184, .07);

  /* 字体 —— 全站统一使用阿里妈妈方圆体，等宽字体仅作为缺字兜底 */
  --font-sans: "Alimama", "Punctuation SC", "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "微软雅黑", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "Alimama", "Cascadia Mono", "JetBrains Mono", Consolas,
               "SFMono-Regular", "Courier New", monospace;

  /* 圆角 / 阴影 / 动效 */
  --r-sm: 5px;
  --r-md: 9px;
  --r-lg: 13px;
  --r-xl: 18px;
  --shadow-card:  0 1px 2px rgba(15, 23, 42, .05), 0 4px 14px rgba(15, 23, 42, .05);
  --shadow-lift:  0 6px 18px -6px rgba(20, 184, 166, .18);
  --shadow-modal: 0 24px 60px -16px rgba(2, 6, 23, .4);
  --ease: cubic-bezier(.4, 0, .2, 1);
  --t-fast: .12s var(--ease);
  --t-norm: .2s var(--ease);
  --t-slow: .32s var(--ease);

  /* 布局 */
  --sidebar-w: 240px;
  --topbar-h: 54px;
}

/* ========== 日间调度台(用户切到亮色模式, 由 head 内联脚本在渲染前设置) ========== */
html.theme-light {
  --bg:       #EFF3F9;
  --panel:    #E7EDF6;
  --card:     #FFFFFF;
  --card-2:   #F4F7FB;
  --line:     rgba(100, 116, 139, .18);
  --line-strong: rgba(100, 116, 139, .34);
  --text:     #0F172A;
  --text-2:   #475569;
  --text-3:   #8B99AD;

  /* 调度台面板(control-deck)亮色 */
  --deck-1:    #F1F7F6;
  --deck-2:    #E9EFF7;
  --grid-line: rgba(15, 23, 42, .06);

  --shadow-card:  0 1px 2px rgba(15, 23, 42, .05), 0 4px 14px rgba(15, 23, 42, .05);
  --shadow-lift:  0 6px 18px -6px rgba(20, 184, 166, .18);
  --shadow-modal: 0 24px 60px -16px rgba(2, 6, 23, .4);
}

/* ========== 基础重置 ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background var(--t-norm), color var(--t-norm);
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; }
img, svg { vertical-align: middle; }
ul, ol { list-style: none; }
code {
  font-family: var(--font-mono);
  font-size: .92em;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 1px 6px;
  color: var(--accent);
}
input, select, textarea { font-family: inherit; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }

/* ========== 应用外壳 ========== */
.app { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--t-slow) var(--ease);
}

.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page {
  flex: 1;
  width: 100%;
  max-width: 1720px;
  margin: 0 auto;
  padding: 30px 30px 60px;
  min-width: 0;
}

/* ========== 侧边栏(控制台侧栏) ========== */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 20px 18px;
}
.brand-mark {
  width: 36px; height: 36px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #0EA5A5);
  color: var(--accent-ink);
  box-shadow: 0 0 0 1px rgba(45, 212, 191, .4), 0 6px 18px -6px rgba(45, 212, 191, .55);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text { font-size: 15px; font-weight: 700; letter-spacing: .2px; color: var(--text); }
.brand-sub { font-size: 10.5px; font-weight: 500; color: var(--text-3); letter-spacing: .6px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 6px 12px 14px; }
.nav-group-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--r-md);
  border: none;            /* 去掉 button 默认边框, 与 a 导航项风格一致 */
  background: none;
  cursor: pointer;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  position: relative;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; }
.nav-item .nav-emoji { width: 18px; font-size: 15px; text-align: center; flex-shrink: 0; line-height: 1; }
.nav-item:hover { background: var(--card-2); color: var(--text); }
.nav-item.is-active {
  background: linear-gradient(90deg, rgba(45, 212, 191, .14), rgba(45, 212, 191, .04));
  color: var(--accent);
  font-weight: 600;
}
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(45, 212, 191, .7);
}
/* 导航信号点: 当前页点亮, 其余灰 */
.nav-item .sig {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
  flex-shrink: 0;
  transition: background var(--t-fast), box-shadow var(--t-fast);
}
.nav-item.is-active .sig { background: var(--signal); box-shadow: 0 0 8px rgba(52, 211, 153, .8); }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); }

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, .55);
  opacity: 0;
  visibility: hidden;
  z-index: 99;
  transition: opacity var(--t-norm), visibility var(--t-norm);
  backdrop-filter: blur(2px);
}
.sidebar-overlay.open { opacity: 1; visibility: visible; }

/* ========== 顶栏(移动端) ========== */
.topbar {
  display: none;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 90;
}
.topbar-brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--text); }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }

/* ========== 通用小图标按钮 ========== */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:hover { background: var(--card-2); color: var(--text); border-color: var(--line); }

/* ========== 复制成功动效(按钮内一笔画出对勾) ========== */
/*
  结构由 app.js 的 FlashBtn() 动态挂载:
    <button class="icon-btn copy-flash">
      <svg>(原图标)</svg>
      <svg class="copy-check"><polyline/></svg>
    </button>
*/
/* 文字按钮(如节点详情页的"复制")的原文字是文本节点，无法被子选择器选中，
   改用透明色隐藏；!important 是为了盖过 .btn / .icon-btn 各自的 color 定义 */
.copy-flash { position: relative; color: transparent !important; }
/* 原图标隐藏但保留占位，按钮尺寸不跳动 */
.copy-flash > *:not(.copy-check) { opacity: 0; }
/* 对勾绝对居中，靠 stroke-dashoffset 从无到有画出，末尾再淡出 */
.copy-check {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 15px;
  height: 15px;
  fill: none;
  stroke: var(--signal);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 24;   /* 覆盖 polyline 实长(约 22.6)，留点余量 */
  stroke-dashoffset: 24;
  animation: copy-check-draw .36s var(--ease) forwards,
             copy-check-fade .25s var(--ease) 1.15s forwards;
}
@keyframes copy-check-draw { to { stroke-dashoffset: 0; } }
@keyframes copy-check-fade { to { opacity: 0; } }

/* ========== 页面头 ========== */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-header-info { min-width: 0; }
.page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .2px;
  color: var(--text);
  font-family: var(--font-mono);
}
.page-title svg { width: 21px; height: 21px; color: var(--accent); }
.page-desc { margin-top: 4px; color: var(--text-3); font-size: 12.5px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  transition: opacity var(--t-fast);
}
.link-btn svg { width: 14px; height: 14px; }
.link-btn:hover { opacity: .8; }

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:hover { border-color: var(--text-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-color: transparent;
  color: var(--accent-ink);
  box-shadow: 0 4px 14px -6px rgba(45, 212, 191, .55);
}
.btn-primary:hover { filter: brightness(1.06); border-color: transparent; }
.btn-success { background: var(--signal); border-color: transparent; color: var(--accent-ink); }
.btn-success:hover { filter: brightness(1.05); border-color: transparent; }
.btn-warning { background: var(--amber); border-color: transparent; color: #3b2600; }
.btn-warning:hover { filter: brightness(1.05); border-color: transparent; }
.btn-danger { background: var(--red); border-color: transparent; color: #3f0a0a; }
.btn-danger:hover { filter: brightness(1.05); border-color: transparent; }
.btn-ghost { background: transparent; border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--card-2); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: var(--r-sm); }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn.is-loading { opacity: .75; pointer-events: none; }

/* ========== 表单 ========== */
.form-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid .form-group-submit .btn { width: 100%; }
.form-hint { font-size: 12px; color: var(--text-3); line-height: 1.5; }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.required { color: var(--red); margin-left: 2px; }

input[type="text"], input[type="url"], input[type="password"], input[type="number"],
input[type="search"], input[type="datetime-local"], select, textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: 13.5px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, .16);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:disabled, select:disabled, textarea:disabled { background: var(--panel); color: var(--text-3); cursor: not-allowed; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(.4); }
body.dark input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(.85); }
select { cursor: pointer; }
.select-compact { width: auto; padding: 5px 10px; font-size: 12.5px; }

/* ========== 下拉框(select)：自定义触发器 + 弹出面板 ==========
 * 原生 select 的弹出层由浏览器/系统绘制，CSS 完全管不到，所以这里自己画一层：
 *   - 原生 select 仍然留在 DOM 里（取值、校验、表单提交、onchange 全部照旧），只是透明隐藏
 *   - 触发器/面板由 app.js 的 Select 模块渲染，配色与全站输入框保持一致
 */
.oc-select { position: relative; display: inline-flex; width: 100%; }
/* 对应 .select-compact：表格工具条里的窄版下拉 */
.oc-select-compact { width: auto; }
/* 筛选栏里的「协议 / 订阅源」：固定宽度，不随当前选中项的文字长短来回跳 */
.filter-bar .oc-select { width: 150px; }
/* 筛选栏一行里的控件统一高度（原生 input 是 33.8px，按钮是 30.8px），否则高低不齐 */
.filter-bar .oc-select-trigger,
.filter-bar .btn,
.filter-bar input[type="text"],
.filter-bar input[type="search"] { height: 34px; }

/* 原生控件退到触发器底下：仍在表单里，但看不见也点不到 */
.oc-select-native {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

.oc-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 1;
  min-width: 0;
  padding: 8px 10px 8px 12px;
  font-family: inherit;
  font-size: 13.5px;
  line-height: normal;   /* 跟随原生 input 的行高，高度才能和输入框对齐 */
  color: var(--text);
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.oc-select-compact .oc-select-trigger { padding: 5px 8px 5px 10px; font-size: 12.5px; min-width: 62px; }
.oc-select-trigger:hover { border-color: var(--text-3); }
/* 展开态与聚焦态用同一套强调色，和 input:focus 保持一致 */
.oc-select.is-open .oc-select-trigger,
.oc-select-trigger:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, .16);
}
.oc-select-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-select-arrow {
  flex: none;
  width: 13px; height: 13px;
  color: var(--text-3);
  transition: transform var(--t-fast), color var(--t-fast);
}
.oc-select.is-open .oc-select-arrow { transform: rotate(180deg); color: var(--accent); }

/* 面板挂在 body 上(fixed 定位)，避免被表格滚动容器或弹窗裁掉 */
.oc-select-menu {
  position: fixed;
  z-index: 500;
  width: max-content;
  max-width: 360px;
  max-height: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 5px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-modal);
  animation: ocMenuIn .14s var(--ease);
}
/* 收起时直接从渲染树移除，下次展开动画会重新播放 */
.oc-select-menu[hidden] { display: none; }
@keyframes ocMenuIn {
  from { opacity: 0; transform: translateY(-4px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.oc-select-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 9px 6px 7px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.oc-select-item-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oc-select-item-tick { flex: none; width: 13px; height: 13px; color: var(--accent); opacity: 0; }
/* 悬停与键盘高亮同款：左缘亮一条信号条，和表格行的强调方式统一 */
.oc-select-item:hover,
.oc-select-item.is-active {
  background: rgba(45, 212, 191, .1);
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--accent);
}
.oc-select-item.is-selected { color: var(--accent); font-weight: 600; }
.oc-select-item.is-selected .oc-select-item-tick { opacity: 1; }
.oc-select-item.is-disabled { opacity: .4; cursor: not-allowed; }
.oc-select-item.is-disabled:hover { background: none; color: var(--text-2); box-shadow: none; }

/* ========== 卡片 ========== */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}
.card-title { font-size: 14px; font-weight: 700; margin-bottom: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; }
/* 卡片头部：左标题 + 右操作按钮 */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.card-title svg { width: 16px; height: 16px; color: var(--accent); }
.table-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mt-16 { margin-top: 16px; }
.mt-8 { margin-top: 8px; }

/* ========== 全局组合组配置区块（节点分类页弹窗） ========== */
.global-group-block {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: 12px;
}
.global-group-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

/* ========== 分类弹窗里的「引用已有组」多选列表 ========== */
.ref-check-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  max-height: 280px; /* 分组较多时可显示更多，弹窗本身 88vh 内滚动 */
  overflow-y: auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card-2);
}
.ref-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}
/* 勾选列表里的分段标题：策略组在上、手动节点在下（flex-basis 撑满整行强制换行） */
.ref-check-divider {
  flex-basis: 100%;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  color: var(--text-3);
}

/* ========== 表格 ========== */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--panel);
  color: var(--text-3);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .9px;
  text-transform: uppercase;
  text-align: left;
  padding: 11px 16px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
tbody td {
  padding: 11px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--t-fast); }
tbody tr:hover { background: var(--card-2); }
tbody tr.is-clickable { cursor: pointer; }

/* 表头排序 */
.sortable a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.sortable a:hover { color: var(--accent); }
.sortable svg { width: 11px; height: 11px; }

/* 操作列 */
.actions { white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.actions form { display: inline; }

/* 操作列 —— 纯图标按钮(无文字)：透明底 + 描边图标，悬停按语义着色 */
.actions .icon-btn { width: 28px; height: 28px; }
.actions .icon-btn svg { width: 15px; height: 15px; }
/* 语义色：复制/编辑=航线青，刷新=信号绿，清空=琥珀，删除=告警红 */
.actions .icon-btn.act-copy:hover,
.actions .icon-btn.act-edit:hover    { color: var(--accent); background: rgba(45, 212, 191, .12);  border-color: rgba(45, 212, 191, .35); }
.actions .icon-btn.act-refresh:hover { color: var(--signal); background: rgba(52, 211, 153, .12);  border-color: rgba(52, 211, 153, .35); }
.actions .icon-btn.act-clear:hover   { color: var(--amber);  background: rgba(251, 191, 36, .12);  border-color: rgba(251, 191, 36, .35); }
.actions .icon-btn.act-delete:hover  { color: var(--red);    background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .35); }

/* 等宽数据(时间/端口/流量等) */
.mono, td code { font-family: var(--font-mono); font-size: .92em; color: var(--text); }

/* URL 单元格截断 */
.url-cell { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline-flex { display: inline-flex; align-items: center; gap: 8px; }

/* 订阅地址列表(自适应/内联/外联竖排三行) */
.sub-links { display: flex; flex-direction: column; gap: 6px; }
.sub-link-row { display: flex; align-items: center; gap: 6px; }
/* 标签固定宽度，让三行的地址左边缘对齐 */
.sub-link-row .badge { flex: none; width: 48px; text-align: center; }
/* 地址过长时省略，避免把表格撑宽 */
.sub-link-row code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub-link-row .icon-btn { flex: none; width: 26px; height: 26px; }
.sub-link-row .icon-btn svg { width: 14px; height: 14px; }

/* 表格工具条 */
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0 10px;
}
.table-toolbar-left { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.table-toolbar-left strong { color: var(--accent); font-family: var(--font-mono); }
.table-toolbar-right { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 12.5px; }

/* 详情表(节点详情弹窗) */
.detail-table { font-size: 12.5px; }
.detail-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.detail-table td:first-child { color: var(--text-3); width: 110px; font-size: 12px; white-space: nowrap; }
.detail-table tr:last-child td { border-bottom: none; }
.rename-row { display: flex; gap: 8px; }
.rename-row input { flex: 1; }

/* 流量使用条 */
.traffic { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.traffic-text { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-2); white-space: nowrap; }
.progress {
  height: 5px;
  background: var(--panel);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--signal));
  transition: width var(--t-slow);
}
.progress-fill.is-high { background: linear-gradient(90deg, #FBBF24, #F59E0B); }
.progress-fill.is-full { background: linear-gradient(90deg, #F87171, #EF4444); }
.traffic-pct { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }

/* ========== 订阅表格自适应(次要列按屏宽隐藏) ========== */
@media (max-width: 2200px) {
  .sub-table th.col-ua, .sub-table td.col-ua,
  .sub-table th.col-website, .sub-table td.col-website { display: none; }
}
@media (max-width: 1700px) {
  .sub-table th.col-filter, .sub-table td.col-filter,
  .sub-table th.col-updated, .sub-table td.col-updated { display: none; }
}
.sub-table td.col-name { max-width: 200px; }
.sub-table td.col-name strong {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
/* 名称跳转官网链接：保持原有字号颜色，悬停变色提示可点击 */
.sub-table td.col-name .name-link {
  color: inherit;
  text-decoration: none;
  display: inline-block;
  max-width: 100%;
}
.sub-table td.col-name .name-link:hover strong { color: var(--accent); }
.sub-table td.col-filter .badge {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  vertical-align: middle;
}
.sub-table .actions { gap: 4px; }
.sub-table .actions .btn-sm { padding: 5px 8px; }
.sub-table .traffic { min-width: 110px; }
@media (max-width: 1400px) {
  .sub-table .actions { gap: 3px; }
  .sub-table .actions .btn-sm { padding: 5px 6px; }
  .sub-table .traffic { min-width: 90px; }
}

/* ========== 徽章 ========== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-brand  { background: rgba(45, 212, 191, .15);  color: var(--accent); border-color: rgba(45, 212, 191, .35); }
.badge-ok     { background: rgba(52, 211, 153, .15);  color: var(--signal); border-color: rgba(52, 211, 153, .35); }
.badge-bad    { background: rgba(248, 113, 113, .15); color: var(--red); border-color: rgba(248, 113, 113, .35); }
.badge-warn   { background: rgba(251, 191, 36, .15);  color: var(--amber); border-color: rgba(251, 191, 36, .35); }
.badge-info   { background: rgba(96, 165, 250, .15);  color: var(--info); border-color: rgba(96, 165, 250, .35); }
.badge-purple { background: rgba(167, 139, 250, .15); color: var(--purple); border-color: rgba(167, 139, 250, .35); }
.badge-neutral{ background: var(--card-2); color: var(--text-2); border-color: var(--line-strong); }
.badge-outline { background: transparent; border: 1px solid var(--line-strong); color: var(--text-2); }
.badge-sub { opacity: .75; font-weight: 500; }
.badge-neutral .badge-sub, .badge-brand .badge-sub { opacity: .75; }

/* ========== Switch 开关 ========== */
.switch { position: relative; display: inline-flex; width: 38px; height: 22px; vertical-align: middle; flex: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; inset: 0; cursor: pointer;
  background: var(--line-strong); border-radius: 999px;
  transition: background var(--t-fast);
}
.switch .slider::before {
  content: ""; position: absolute; left: 3px; top: 3px;
  width: 16px; height: 16px; background: #fff; border-radius: 50%;
  box-shadow: 0 1px 2px rgba(2, 6, 23, .35);
  transition: transform var(--t-fast);
}
.switch input:checked + .slider { background: var(--signal); }
.switch input:checked + .slider::before { transform: translateX(16px); }
.switch input:disabled + .slider { opacity: .45; cursor: not-allowed; }
.status-cell { white-space: nowrap; }
.status-cell .badge { margin-left: 8px; }

/* ========== 排序号内联编辑（双击数字即可修改） ========== */
.sort-cell { cursor: pointer; white-space: nowrap; }
.sort-cell .sort-value { user-select: none; }
.sort-cell:hover .sort-value { box-shadow: 0 0 0 2px rgba(96, 165, 250, .22); }
/* 覆盖 input[type="number"] 的全局满宽样式，压缩成表格里的迷你输入框 */
.sort-cell input.sort-input {
  width: 66px;
  padding: 2px 6px;
  font-size: 12px;
  text-align: center;
  border-radius: var(--r-sm);
}

/* ========== 表格行拖拽排序（按住行首手柄上下拖动） ========== */
.drag-col { width: 30px; }
.drag-cell { width: 30px; padding: 11px 0 11px 12px; }
.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--text-3);
  opacity: .45;
  cursor: grab;
  border-radius: var(--r-sm);
  transition: opacity var(--t-fast), color var(--t-fast);
}
.drag-handle svg { width: 14px; height: 14px; }
tbody tr:hover .drag-handle { opacity: 1; }
.drag-handle:hover { color: var(--accent); }
.drag-handle:active { cursor: grabbing; }
/* 拖动中的行淡出；落点用行上/下边缘的一条高亮线提示插到哪一侧 */
tr.is-dragging td { opacity: .4; }
tr.drop-before td { box-shadow: inset 0 2px 0 var(--accent); }
tr.drop-after td { box-shadow: inset 0 -2px 0 var(--accent); }

/* ========== 弹窗 ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, .6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-box {
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-xl);
  width: 92%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-modal);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 15px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.modal-head h3::before {
  content: "";
  width: 4px; height: 16px;
  border-radius: 3px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(45, 212, 191, .6);
}
.modal-body { padding: 0 20px 20px; }
.modal-body-text { color: var(--text-2); margin-bottom: 20px; line-height: 1.6; font-size: 13.5px; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
.modal-close-btn { margin-left: auto; }
/* ========== 规则页：新建时的远程 URL 与预览 ========== */
.url-row { display: flex; gap: 8px; }
.url-row input { flex: 1; min-width: 0; }
.url-row .btn { flex: none; }

.fetch-preview {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card-2);
  padding: 10px 12px;
  font-size: 13px;
}
.fetch-preview-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  color: var(--text-2);
}
.fetch-preview-body {
  max-height: 160px;
  overflow-y: auto;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--panel);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.9;
  color: var(--text-2);
}
.fetch-preview-line { white-space: nowrap; }

/* 多个远程地址，一行一个：备注 + 地址 + 删除按钮 */
.url-row-head,
.url-row-item {
  display: flex;
  gap: 8px;
}
.url-row-head {
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-3);
}
/* 表头和内容用同一套列宽，保证对得齐 */
.url-row-head span:nth-child(1),
.url-row-item .source-note {
  flex: none;
  width: 160px;
}
.url-row-head span:nth-child(2) {
  flex: 1;
}
.url-row-head span:nth-child(3) {
  flex: none;
  width: 34px;          /* 与删除按钮同宽 */
}
.url-row-item {
  margin-bottom: 8px;
}
.url-row-item .fetch-url {
  flex: 1;
  min-width: 0;
}
.url-row-item .btn {
  flex: none;
}

.fetch-mode {
  display: flex;
  gap: 20px;
  margin-top: 16px;
}

/* 规则表格容器：一次展示全部，超出高度滚动 */
.rule-table-wrap { max-height: 62vh; }

/* ========== 规则编辑页：规则表格 ========== */
.rule-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.rule-table-tools { display: flex; gap: 8px; }
.rule-table-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: flex-end;
}
.rule-table-search input {
  width: 260px;
  max-width: 100%;
}

.rule-table-wrap { max-height: 52vh; overflow-y: auto; }
.rule-table td { padding: 4px 8px; }
.rule-table input[type="text"] {
  width: 100%;
  padding: 5px 8px;
  font-size: 13px;
}
.rule-table .rule-type { font-family: var(--font-mono); }
/* 域名框保底宽度：窗口窄时不再被类型列挤扁（表格容器本身可横向滚动） */
.rule-table .rule-value { min-width: 280px; }
.rule-idx {
  color: var(--text-3);
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
/* 表头在长表格里滚动时保持可见 */
.rule-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* 规则编辑页的分页条（前端分页，只影响显示哪些行） */
.rule-pager { border-top: 1px solid var(--line); margin-top: 10px; }
.rule-pager .pagination { padding: 12px 0 6px; }
/* 页码用 <button> 实现，去掉按钮默认外观，和列表页 <a> 版分页长得一样。
   只针对 button，别碰当前页那个 <span class="page-current"> 的高亮底色 */
.rule-pager button.page-num {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}
.rule-pager-hint { text-align: center; color: var(--text-3); font-size: 12px; padding-bottom: 4px; }

.save-status { font-size: 13px; }

/* ========== 规则列表：被停用的行整体置灰 ========== */
.row-disabled td {
  opacity: .45;
  transition: opacity var(--t-norm);
}
/* 开关本身要保持可点、看得清，否则没法再启用回来 */
.row-disabled td.status-cell { opacity: 1; }

/* 失效记录卡片：用警示色边框和表头，跟正常文件区分开 */
.missing-card { border-color: rgba(251, 191, 36, .4); }
.missing-card .card-title { color: var(--amber); }
.missing-card thead th { color: var(--amber); }
.missing-card td { opacity: .8; }

/* ========== 跨文件查重页 ========== */
/* 每组重复的「保留哪一个」：一个文件一个选项，停用的淡化显示 */
.dup-choice { display: inline-flex; align-items: center; gap: 4px;
              margin: 0 14px 6px 0; cursor: pointer; white-space: nowrap; }
.dup-choice.is-off { opacity: .55; }

/* 规则文本可能很长，限宽后单行省略，全文在 title 里 */
.dup-rule { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dup-files { min-width: 320px; }
.dup-removable { color: var(--red); font-weight: 600; }

/* 「一键保留某个文件」的按钮组 */
.dup-bulk { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.dup-summary { padding: 12px 0 4px; color: var(--text-2); font-size: 13px; }

/* ========== 规则列表「策略」列：点击弹出选择菜单 ========== */
.policy-cell { cursor: pointer; user-select: none; }
.policy-cell .badge { transition: opacity var(--t-fast); }
.policy-cell:hover .badge { opacity: .75; }
.policy-cell.is-saving { opacity: .5; pointer-events: none; }
.policy-cell.is-saved .badge {
  background: rgba(52, 211, 153, .2);
  color: var(--signal);
  border-color: rgba(52, 211, 153, .5);
}

/* 菜单挂在 body 上，用 fixed 定位，避免被表格滚动容器裁掉 */
.policy-menu {
  position: fixed;
  z-index: 400;
  min-width: 130px;
  max-height: 260px;
  overflow-y: auto;
  padding: 5px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-modal);
}
.policy-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
}
.policy-item:hover { background: var(--line); color: var(--text); }
.policy-item.is-current { color: var(--accent); font-weight: 600; }
.policy-tick { color: var(--accent); }

/* ========== Toast 通知 ========== */
.toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--signal);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-modal);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity var(--t-norm), transform var(--t-norm);
}
.toast-in { opacity: 1; transform: translateY(0); }
.toast-out { opacity: 0; transform: translateY(-8px); }
.toast-icon { flex-shrink: 0; color: var(--signal); }
.toast-icon svg { width: 18px; height: 18px; }
.toast-error { border-left-color: var(--red); }
.toast-error .toast-icon { color: var(--red); }
.toast-warning { border-left-color: var(--amber); }
.toast-warning .toast-icon { color: var(--amber); }
.toast-info { border-left-color: var(--info); }
.toast-info .toast-icon { color: var(--info); }
.toast-msg { flex: 1; min-width: 0; word-break: break-word; color: var(--text); font-size: 13px; }
.toast-close { background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 16px; padding: 0 2px; }
.toast-close:hover { color: var(--text); }

/* ========== 分页 ========== */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 18px 0; flex-wrap: wrap; }
.page-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px;
  padding: 0 8px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--t-fast);
}
.page-btn svg { width: 15px; height: 15px; }
.page-btn:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-num {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 32px;
  padding: 0 6px;
  border-radius: var(--r-md);
  color: var(--text-2);
  font-size: 13px;
  transition: all var(--t-fast);
}
.page-num:hover { color: var(--accent); background: var(--card-2); }
.page-current {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  box-shadow: 0 4px 12px -4px rgba(45, 212, 191, .6);
}
.page-dots { color: var(--text-3); padding: 0 4px; user-select: none; }

/* ========== 统计卡片(仪表盘) ========== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.stat-card::after {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 70px; height: 70px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, .14), transparent 70%);
  transform: translate(25%, -25%);
}
.stat-card-sm { min-height: 108px; }
.stat-icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(45, 212, 191, .14);
  color: var(--accent);
}
.stat-icon svg { width: 18px; height: 18px; }
.stat-number { font-family: var(--font-mono); font-size: 26px; font-weight: 700; color: var(--text); letter-spacing: -.5px; line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--text-3); letter-spacing: .3px; }

/* ========== 横幅(Banner) ========== */
.banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  margin-bottom: 20px;
}
.banner > svg { width: 20px; height: 20px; flex-shrink: 0; color: currentColor; }
.banner-body { flex: 1; min-width: 0; }
.banner-title { font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.banner-desc { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.banner-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.banner-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--card-2);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-2);
  transition: all var(--t-fast);
}
.banner-tag:hover { color: var(--accent); border-color: var(--accent); }
.banner-tag small { font-family: var(--font-mono); color: var(--text-3); }
.banner-action { flex-shrink: 0; }
.banner-warn { background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .4); color: var(--amber); }
.banner-info { background: rgba(96, 165, 250, .1); border-color: rgba(96, 165, 250, .4); color: var(--info); }

/* ========== 区块标题 ========== */
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 24px 0 12px;
}
.section-title svg { width: 16px; height: 16px; color: var(--accent); }

/* ========== 空状态 ========== */
.empty { text-align: center; padding: 40px 20px; }
.empty-icon {
  width: 52px; height: 52px;
  margin: 0 auto 14px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card-2);
  color: var(--text-3);
  border: 1px dashed var(--line-strong);
}
.empty-icon svg { width: 24px; height: 24px; }
.empty h3 { font-size: 15px; color: var(--text); margin-bottom: 6px; }
.empty p { color: var(--text-3); font-size: 13px; margin-bottom: 16px; }

/* ========== 错误页 ========== */
.error-page { max-width: 720px; margin: 8vh auto; text-align: center; padding: 0 20px; }
.error-code {
  font-family: var(--font-mono);
  font-size: 64px;
  font-weight: 700;
  color: var(--red);
  line-height: 1;
  margin-bottom: 12px;
  text-shadow: 0 0 30px rgba(248, 113, 113, .4);
}
.error-page h2 { font-size: 22px; margin-bottom: 8px; color: var(--text); }
.error-page p { color: var(--text-2); font-size: 14px; }
.error-box {
  margin-top: 24px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px;
  text-align: left;
  font-size: 12.5px;
  color: var(--text-2);
}
.error-box pre { margin-top: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--red); white-space: pre-wrap; word-break: break-all; }
.tips { margin-top: 20px; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 20px; }
.tips ul { padding-left: 18px; list-style: disc; }
.tips li { color: var(--text-2); font-size: 13px; margin: 4px 0; }
.error-actions { display: flex; gap: 10px; justify-content: center; margin-top: 28px; }

/* ========== 认证页 ========== */
body.auth-page .sidebar,
body.auth-page .topbar,
body.auth-page .sidebar-overlay { display: none; }
body.auth-page .app { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
body.auth-page .main { margin-left: 0; flex: 1; }
body.auth-page .page { max-width: none; padding: 24px; display: flex; justify-content: center; align-items: center; }
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 34px;
  box-shadow: var(--shadow-modal);
}
.auth-logo { text-align: center; margin-bottom: 26px; }
.auth-logo .brand-mark { margin: 0 auto 14px; }
.auth-logo h1 { font-size: 18px; color: var(--text); margin-bottom: 4px; }
.auth-logo p { font-size: 12px; color: var(--text-3); letter-spacing: .4px; }

/* ========== Alert(表单错误提示) ========== */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  font-size: 13px;
  margin-bottom: 16px;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }
.alert-error { background: rgba(248, 113, 113, .12); color: var(--red); border: 1px solid rgba(248, 113, 113, .4); }
.alert-success { background: rgba(52, 211, 153, .12); color: var(--signal); border: 1px solid rgba(52, 211, 153, .4); }

/* ========== 添加订阅源卡片 ========== */
/* ========== Loading 遮罩 ========== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, .7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
  backdrop-filter: blur(3px);
}
.loading-card { text-align: center; color: var(--text); }
.loading-spinner {
  width: 52px; height: 52px;
  margin: 0 auto 16px;
  animation: rotate 1s linear infinite;
}
.loading-spinner svg { width: 100%; height: 100%; }
.loading-spinner circle {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-dasharray: 90 160;
}
@keyframes rotate { to { transform: rotate(360deg); } }
.spin { animation: rotate 1s linear infinite; }
.loading-card h4 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.loading-card p { font-size: 12.5px; color: var(--text-3); line-height: 1.6; }

/* ========== 刷新结果卡片 ========== */
.result-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  margin-bottom: 20px;
  position: relative;
  box-shadow: var(--shadow-card);
}
.result-card[class*="warn"] { background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .4); }
.result-card[class*="ok"] { background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .4); }
.result-card[class*="err"] { background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .4); }
.result-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; color: var(--text); }
.result-desc { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.result-stats { display: flex; gap: 18px; margin-left: auto; }
.result-stat { display: flex; flex-direction: column; align-items: center; }
.result-stat-num { font-family: var(--font-mono); font-size: 18px; font-weight: 700; color: var(--signal); }
.result-stat-fail .result-stat-num { color: var(--red); }
.result-stat-label { font-size: 10.5px; color: var(--text-3); letter-spacing: .4px; }
.result-close {
  position: absolute;
  top: 10px; right: 10px;
  background: none; border: none;
  color: var(--text-3);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
}
.result-close:hover { color: var(--text); }

/* ========== 筛选栏(节点列表) ========== */
.filter-bar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}

/* ========== 操作区(rules 页) ========== */
.action-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.action-col h3 { font-size: 14px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.action-col h3 svg { width: 16px; height: 16px; color: var(--accent); }
.action-col-divider { border-left: 1px solid var(--line); padding-left: 18px; }

/* ========== 编辑器(rules_edit) ========== */
.editor-toolbar { display: flex; gap: 10px; margin-top: 14px; }
.save-status { font-size: 12.5px; color: var(--text-3); }
.CodeMirror {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-family: var(--font-mono);
  font-size: 13px;
  height: 62vh;
  background: var(--card);
  color: var(--text);
}

/* ========== 二维码区(节点详情) ========== */
.qr-area { padding-top: 14px; border-top: 1px solid var(--line); text-align: center; }
.qr-box {
  position: relative;
  width: 190px; height: 190px;
  margin: 0 auto;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: #fff;
  overflow: hidden;
}
.qr-box img { display: none; width: 100%; height: 100%; object-fit: contain; border: none; border-radius: 0; }
.qr-box p {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  margin: 0; font-size: 12px; color: #64748B;
}
.qr-hint { display: flex; align-items: center; gap: 8px; margin-top: 6px; height: 28px; }
.qr-hint p {
  flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 11.5px; color: var(--text-3); margin: 0; text-align: left;
}

/* ========== 通用辅助 ========== */
.text-muted { color: var(--text-3); font-size: 12.5px; }
.mono { font-family: var(--font-mono); }
.icon-link { color: var(--text-2); display: inline-flex; align-items: center; transition: color var(--t-fast), transform var(--t-fast); }
.icon-link:hover { color: var(--accent); transform: scale(1.12); }
.icon-link svg { width: 15px; height: 15px; }

/* =====================================================================
 * 签名元素: 全球节点网(仪表盘) + 调度信息
 * ===================================================================== */
.control-deck {
  position: relative;
  border-radius: var(--r-xl);
  border: 1px solid var(--line-strong);
  overflow: hidden;
  margin-bottom: 24px;
  background:
    radial-gradient(1100px 420px at 22% -18%, rgba(45, 212, 191, .14), transparent 60%),
    radial-gradient(900px 400px at 85% 130%, rgba(96, 165, 250, .12), transparent 60%),
    linear-gradient(180deg, var(--deck-1), var(--deck-2));
  box-shadow: var(--shadow-card);
}
.control-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 78%);
  pointer-events: none;
}
.control-inner { position: relative; padding: 22px 26px 20px; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.control-title { color: var(--text); font-size: 16px; font-weight: 700; font-family: var(--font-mono); letter-spacing: .4px; display: flex; align-items: center; gap: 10px; }
.control-title .pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, .6);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); }
  70% { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}
.control-sub { color: var(--text-3); font-size: 12px; margin-top: 4px; font-family: var(--font-mono); }
.control-metrics { display: flex; gap: 26px; flex-wrap: wrap; }
.control-metric { display: flex; flex-direction: column; }
.control-metric .n { font-family: var(--font-mono); font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.1; }
.control-metric .l { font-size: 10.5px; color: var(--text-3); letter-spacing: .8px; text-transform: uppercase; }
/* 节点光点(模拟全球分布) */
.node-map { position: relative; width: 100%; height: 120px; margin-top: 4px; }
.node-map-dot {
  position: absolute;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 10px rgba(52, 211, 153, .9), 0 0 3px rgba(52, 211, 153, 1);
  transform: translate(-50%, -50%);
  transition: background var(--t-norm), box-shadow var(--t-norm);
}
.node-map-dot.off { background: var(--text-3); box-shadow: 0 0 6px rgba(148, 163, 184, .6); }
.node-map-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(148, 163, 184, .25);
}
.node-map-dot:nth-child(1)  { top: 30%;  left: 12%; }
.node-map-dot:nth-child(2)  { top: 18%;  left: 30%; }
.node-map-dot:nth-child(3)  { top: 46%;  left: 24%; }
.node-map-dot:nth-child(4)  { top: 28%;  left: 48%; }
.node-map-dot:nth-child(5)  { top: 62%;  left: 40%; }
.node-map-dot:nth-child(6)  { top: 34%;  left: 64%; }
.node-map-dot:nth-child(7)  { top: 14%;  left: 78%; }
.node-map-dot:nth-child(8)  { top: 52%;  left: 84%; }
.node-map-dot:nth-child(9)  { top: 72%;  left: 66%; }
.node-map-dot:nth-child(10) { top: 40%;  left: 90%; }
/* 点之间用细线连接(装饰) */
.node-map-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .5;
}
.node-map-lines line { stroke: rgba(45, 212, 191, .22); stroke-width: 1; }

/* =====================================================================
 * 订阅源管理页 —— 弹窗式添加/导入
 * ===================================================================== */

/* 页头：底部分隔线，让标题区和内容区层次更清楚 */
.subs-page .page-header {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.subs-page .page-title svg {
  filter: drop-shadow(0 0 8px rgba(45, 212, 191, .45));
}
.subs-page .page-desc { color: var(--text-2); }

/* 概览统计条 */
.subs-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.subs-stat {
  position: relative;
  overflow: hidden;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.subs-stat:hover { border-color: var(--line-strong); transform: translateY(-1px); }
/* 左侧状态色条 */
.subs-stat::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
}
.subs-stat.is-ok::before { background: var(--signal); }
.subs-stat.is-off::before { background: var(--text-3); }
/* 右上角柔光 */
.subs-stat::after {
  content: "";
  position: absolute;
  right: -24px; top: -32px;
  width: 96px; height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, .14), transparent 70%);
  pointer-events: none;
}
.subs-stat.is-ok::after { background: radial-gradient(circle, rgba(52, 211, 153, .14), transparent 70%); }
.subs-stat.is-off::after { background: radial-gradient(circle, rgba(148, 163, 184, .12), transparent 70%); }
.subs-stat-num {
  position: relative;
  z-index: 1;
  display: block;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.5px;
  color: var(--text);
}
.subs-stat-label { position: relative; z-index: 1; display: block; margin-top: 4px; font-size: 12px; color: var(--text-3); }

/* 列表工具条：与上方统计条拉开一点距离 */
.subs-page .table-toolbar { margin: 4px 0 12px; }

/* 表格：行悬停高亮 + 首列信号条 */
.subs-page .table-card { box-shadow: 0 12px 34px -22px rgba(2, 6, 23, .85); }
.subs-page .sub-table tbody tr { transition: background var(--t-fast); }
.subs-page .sub-table tbody tr:hover { background: rgba(45, 212, 191, .045); }
.subs-page .sub-table tbody tr:hover td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.subs-page .sub-table tbody td:first-child { transition: box-shadow var(--t-fast); }

/* 弹窗 */
.subs-modal .modal-box {
  max-width: 680px;
  animation: subsModalIn .22s var(--ease);
}
@keyframes subsModalIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.subs-modal .modal-head {
  background: linear-gradient(135deg, rgba(45, 212, 191, .11), transparent 68%);
}
.subs-modal .modal-body { padding: 18px 22px 22px; }
.subs-modal .modal-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
/* 表单分组：基本信息 / 高级设置 */
.sub-form-section + .sub-form-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}
.sub-form-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--text-3);
  text-transform: uppercase;
}
.sub-form-section-title::before {
  content: "";
  width: 14px; height: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(45, 212, 191, .55);
}

/* 文件上传区（点击或拖拽） */
.file-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 26px 16px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--card-2);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.file-drop:hover,
.file-drop.is-drag {
  border-color: var(--accent);
  background: rgba(45, 212, 191, .06);
}
.file-drop svg { width: 28px; height: 28px; color: var(--accent); }
.file-drop-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.file-drop-sub { font-size: 12px; color: var(--text-3); }
.file-drop-name {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--accent);
  word-break: break-all;
}
/* 透明文件框铺满整块区域，点哪儿都能选文件 */
.file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* 空状态里的主按钮 */
.subs-page .empty .btn { margin-top: 4px; }

@media (max-width: 768px) {
  .subs-summary { grid-template-columns: 1fr; }
  .subs-modal .modal-box { max-width: none; }
  .subs-modal .modal-body { padding: 16px 16px 18px; }
  .subs-page .page-header { margin-bottom: 14px; }
}

/* ========== 响应式 ========== */
@media (max-width: 1023px) {
  .topbar { display: flex; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-modal); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .page { padding: 16px 16px 40px; }
}
@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; gap: 14px; }
  .modal-grid { grid-template-columns: 1fr; }
  #proto-fields { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .page-title { font-size: 18px; }
  .result-card { flex-direction: column; align-items: flex-start; gap: 10px; }
  .result-stats { width: 100%; justify-content: space-around; }
  .result-close { position: absolute; top: 12px; right: 12px; }
  .result-card { position: relative; }
  .action-grid { grid-template-columns: 1fr; gap: 18px; }
  .action-col-divider { padding-left: 0; padding-top: 18px; border-left: none; border-top: 1px solid var(--line); }
  .banner { flex-direction: column; align-items: flex-start; }
  .banner-action { align-self: flex-end; }
  .toast-container { right: 10px; left: 10px; max-width: none; }
  .card { padding: 16px; }
  /* 手机端隐藏首页顶部的调度台大横幅(仅桌面端展示) */
  .control-deck { display: none; }
}

/* 隐藏 flash 数据容器(由 JS 转 Toast) */
#flash-data { display: none !important; }

/* 编辑弹窗固定高度 */
#editor-wrap { min-height: 62vh; }
