/* WoolHub · Terminal 线框风 · 彩色细线 · 亮/暗双主题 */
:root {
  /* --- 圆角：三档，不再散落 2/3/4/999 --- */
  --r: 4px;        /* 卡片 / 按钮 / 面板 */
  --r-sm: 3px;     /* 行内小件：输入框、徽标 */
  --r-pill: 999px; /* 胶囊：标签 / chip */
  /* --- 阴影：三档 --- */
  --sh-1: 0 8px 28px rgba(0, 0, 0, .28);
  --sh-2: 0 10px 30px rgba(0, 0, 0, .4);
  --sh-3: 0 20px 60px rgba(0, 0, 0, .5);
  --scrim: rgba(0, 0, 0, .55);
  /* 语义色的 RGB 分量：要半透明背景时用 rgba(var(--green-rgb), .1)，亮/暗各自跟随 */
  --green-rgb: 74, 222, 128;
  --cyan-rgb: 56, 189, 248;
  /* --- 层叠：一处定义，杜绝「谁在上」靠猜 --- */
  --z-sticky: 20; --z-menu: 60; --z-toast: 70; --z-scrim: 88; --z-drawer: 90; --z-pop: 95; --z-modal: 120; --z-lock: 130;
  /* --- 字号：按钮/数据两档，改一处全站跟着走 --- */
  --fs-btn: 11px;
  --fs-tag: 10.5px;
  --fs: 13px;
  --mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

html[data-theme="dark"] {
  --bg: #0b0d10;
  --bg2: #0f1216;
  --surface: #0d1015;
  --surface2: #11151b;
  --line: #1d242d;
  --line2: #28313d;
  --text: #e8edf2;
  --muted: #697483;
  --green: #4ade80;
  --cyan: #38bdf8;
  --yellow: #facc15;
  --pink: #f472b6;
  --violet: #a78bfa;
  --red: #f87171;
  --orange: #fb923c;
  --accent: var(--green);
  --accent-soft: rgba(var(--green-rgb), .08);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #fafbfc;
  --bg2: #ffffff;
  --surface: #ffffff;
  --surface2: #f4f6f8;
  --line: #e2e6ea;
  --line2: #d0d6dc;
  --text: #14181d;
  --muted: #7b8792;
  --green: #16a34a;
  --cyan: #0284c7;
  --yellow: #ca8a04;
  --pink: #db2777;
  --violet: #7c3aed;
  --red: #dc2626;
  --orange: #ea580c;
  --accent: var(--green);
  --accent-soft: rgba(var(--green-rgb), .07);
  --scrim: rgba(20, 25, 30, .34);
  --green-rgb: 22, 163, 74;
  --cyan-rgb: 2, 132, 199;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: var(--fs)/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ---------- 原生控件统一主题（修复下拉白字白底 / 日历图标不可见）---------- */
select, input, textarea { background-color: var(--bg2); color: var(--text); }
select { appearance: none; -webkit-appearance: none; cursor: pointer; }
select option, select optgroup { background-color: var(--bg2); color: var(--text); }
select:disabled { opacity: .6; }
::placeholder { color: var(--muted); opacity: 1; }
html[data-theme="dark"] ::-webkit-calendar-picker-indicator { filter: invert(.75); cursor: pointer; }
html[data-theme="dark"] input[type="date"]::-webkit-datetime-edit { color: var(--text); }
/* Firefox 下拉面板 */
@supports (-moz-appearance: none) {
  select option { background-color: var(--bg2); color: var(--text); }
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.tiny { font-size: 11px; }
.small { font-size: 12px; }

/* ---------- 锁屏：终端窗口 ---------- */
.lock { position: fixed; inset: 0; z-index: var(--z-lock); display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 16px; }
.lock-box {
  width: 380px; max-width: 100%;
  border: 1px solid var(--line2); border-radius: var(--r);
  background: var(--surface); overflow: hidden;
}
.lock-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 12px; border-bottom: 1px solid var(--line);
  background: var(--surface2);
}
.lock-bar i { width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--line2); }
.lock-bar i:nth-child(1) { background: var(--red); }
.lock-bar i:nth-child(2) { background: var(--yellow); }
.lock-bar i:nth-child(3) { background: var(--green); }
.lock-bar .t { margin-left: auto; font: 11px var(--mono); color: var(--muted); }
.lock-body { padding: 22px 20px 18px; font-family: var(--mono); }
.lock-logo { font-size: 15px; margin-bottom: 4px; }
.lock-logo .prompt { color: var(--green); }
.lock-logo .path { color: var(--cyan); }
.lock-sub { color: var(--muted); font-size: 11.5px; margin-bottom: 16px; }
.lock-row { display: flex; align-items: center; gap: 8px; }
.lock-row .sign { color: var(--green); font-weight: 700; }
.lock-row input {
  flex: 1; background: transparent; border: none; border-bottom: 1px solid var(--line2);
  outline: none; padding: 6px 2px; font-family: var(--mono); font-size: 15px; letter-spacing: 1px;
}
.lock-row input:focus { border-bottom-color: var(--green); }
.lock-hint { color: var(--muted); font-size: 11px; margin-top: 14px; line-height: 1.6; }
.lock-hint code { color: var(--yellow); background: transparent; padding: 0; }
.lock-err { color: var(--red); font-size: 12px; margin-top: 10px; min-height: 16px; font-family: var(--mono); }
.lock-box .btn { margin-top: 14px; width: 100%; }

/* ---------- 布局 ---------- */
.app { min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 9px 14px;
  background: var(--bg2);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-weight: 600; font-size: 14px; }
.brand .p { color: var(--green); }
.brand .p2 { color: var(--cyan); }
/* 提示符后的光标块：终端感，纯装饰，不抢注意力 */
.caret {
  width: 7px; height: 14px; margin-left: -2px; border-radius: 1px;
  background: var(--green); opacity: .85;
  animation: caret-blink 1.15s steps(1, end) infinite;
}
@keyframes caret-blink { 0%, 49% { opacity: .85; } 50%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .caret { animation: none; } }
.brand-tag { font-size: 10.5px; color: var(--muted); font-weight: 400; border: 1px solid var(--line); border-radius: var(--r-pill); padding: 1px 8px; }
/* 同步状态：写入中 = 绿闪，有失败 = 红边（点击可重试并清除） */
#syncWrap { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: color .12s ease, border-color .12s ease; }
#syncWrap:hover { border-color: var(--line2); color: var(--text); }
#syncWrap.is-pending { color: var(--green); border-color: var(--green); }
#syncWrap.is-bad { color: var(--red); border-color: var(--red); }
#syncWrap.is-bad .live-dot { background: var(--red); animation: none; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  padding: 5px 12px; border-radius: var(--r); cursor: pointer; white-space: nowrap;
  font-family: var(--mono); font-size: 12px;
}
.tab:hover { color: var(--text); border-color: var(--line2); }
.tab.active { color: var(--green); border-color: var(--green); background: var(--accent-soft); }
.actions { display: flex; align-items: center; gap: 8px; }
.search {
  background: transparent; border: 1px solid var(--line); border-radius: var(--r);
  padding: 5px 10px; width: 210px; outline: none; font-family: var(--mono); font-size: 12px;
}
.search:focus { border-color: var(--cyan); }
.icon-btn {
  width: 30px; height: 30px; border-radius: var(--r); cursor: pointer;
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-btn:hover { border-color: var(--yellow); color: var(--yellow); }
/* 内联 SVG 图标：不依赖系统字体字形，全平台渲染一致 */
.ic { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; margin: auto; }
.ic-fill { fill: currentColor; stroke: none; }
.drag-handle svg { width: 11px; height: 15px; display: block; }
.tag a .ic, a .ic { display: inline-block; vertical-align: -2px; width: 11px; height: 11px; margin: 0 1px; }

.main { padding: 14px; max-width: 1440px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; }

/* ---------- KPI：彩色左边线 ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-bottom: 12px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-left: 2px solid var(--kc, var(--line2));
  border-radius: var(--r); padding: 11px 13px;
}
.kpi .k-label { font: 10.5px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.kpi .k-value { font: 600 25px/1.2 var(--mono); margin-top: 5px; color: var(--kc, var(--text)); }
.kpi .k-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ---------- 面板 ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.grid-2 > * { min-width: 0; }
.panel { min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 13px; margin-bottom: 10px; }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.ph-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.panel-h h3 { font: 600 12px var(--mono); letter-spacing: .4px; color: var(--text); }
.panel-h h3::before { content: "// "; color: var(--muted); }
.panel-h .muted { font-size: 11px; }

.chain { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; font-family: var(--mono); }
.chain .node { border: 1px solid var(--line2); border-radius: var(--r); padding: 5px 10px; background: var(--surface2); word-break: break-all; max-width: 100%; }
.chain .node:nth-child(1) { border-color: var(--cyan); color: var(--cyan); }
.chain .node:nth-child(3) { border-color: var(--green); color: var(--green); }
.chain .node:nth-child(5) { border-color: var(--yellow); color: var(--yellow); }
.chain .node:nth-child(7) { border-color: var(--pink); color: var(--pink); }
.chain .node:nth-child(9) { border-color: var(--orange); color: var(--orange); }
.chain .node:nth-child(11) { border-color: var(--violet); color: var(--violet); }
.chain .arrow { color: var(--muted); }

.list { display: flex; flex-direction: column; gap: 6px; }
.list .item {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  border: 1px solid var(--line); border-left: 2px solid var(--green);
  border-radius: var(--r); padding: 7px 10px; font-size: 12px; background: var(--surface2);
}
.list .item.warn { border-left-color: var(--yellow); }
.list .item.danger { border-left-color: var(--red); }
.list .item .t { color: var(--muted); font-family: var(--mono); font-size: 11px; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0; }
.list .item > span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 3px 10px; font: var(--fs-btn) var(--mono); cursor: pointer; background: transparent;
}
.chip:hover { border-color: var(--green); color: var(--green); }
.chip .p { font-size: 10px; color: var(--muted); }

/* ---------- 工具栏 / 筛选 ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters select {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r);
  padding: 5px 8px; font-size: 12px; cursor: pointer; font-family: var(--mono); color: var(--text);
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 12px) 52%, calc(100% - 7px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 22px;
}
.filters select:focus { border-color: var(--cyan); color: var(--text); outline: none; }
.filters select:hover { border-color: var(--line2); }
.tool-right { display: flex; align-items: center; gap: 10px; }
.btn {
  background: transparent; border: 1px solid var(--line2); border-radius: var(--r-pill);
  padding: 5px 12px; cursor: pointer; font-family: var(--mono); font-size: 12px; color: var(--text);
  white-space: nowrap; transition: color .12s ease, border-color .12s ease, background .12s ease;
}
.btn:hover { border-color: var(--green); color: var(--green); }
.btn.primary { border-color: var(--green); color: var(--green); font-weight: 600; background: var(--accent-soft); }
.btn.primary:hover { background: var(--green); color: var(--bg); }
.btn.danger:hover { border-color: var(--red); color: var(--red); }
/* 次要按钮：低一档存在感——灰字灰边，hover 才亮 */
.btn.ghost { border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { border-color: var(--line2); color: var(--text); }

/* ---------- 表格 ---------- */
/* ---------- 滚动条：平时隐形，悬停才显形（内容装得下时浏览器本来就不出） ---------- */
* { scrollbar-width: thin; scrollbar-color: transparent transparent; }
/* 可滚动容器：悬停 / 聚焦时滑块淡入 */
.table-wrap, .matrix-wrap, .board, .modal-b, .pop-body, .dr-body, .code, .bk-list, .qhelp {
  scrollbar-width: thin;
}
.table-wrap:hover, .matrix-wrap:hover, .board:hover, .modal-b:hover, .pop-body:hover,
.dr-body:hover, .code:hover, .bk-list:hover, .qhelp:hover,
.table-wrap:focus-within, .dr-body:focus-within {
  scrollbar-color: var(--line2) transparent;
}
::-webkit-scrollbar { width: 11px; height: 11px; background: transparent; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: transparent; border-radius: var(--r-pill);
  border: 4px solid transparent; background-clip: padding-box;
  transition: background-color .15s;
}
/* 悬停容器时滑块才出现；窄条（视觉 3px），不挤内容 */
.table-wrap:hover::-webkit-scrollbar-thumb, .matrix-wrap:hover::-webkit-scrollbar-thumb,
.board:hover::-webkit-scrollbar-thumb, .modal-b:hover::-webkit-scrollbar-thumb,
.pop-body:hover::-webkit-scrollbar-thumb, .dr-body:hover::-webkit-scrollbar-thumb,
.code:hover::-webkit-scrollbar-thumb, .bk-list:hover::-webkit-scrollbar-thumb,
.table-wrap:focus-within::-webkit-scrollbar-thumb, .dr-body:focus-within::-webkit-scrollbar-thumb {
  background: var(--line2); background-clip: padding-box;
}
.table-wrap:hover::-webkit-scrollbar-thumb:hover, .matrix-wrap:hover::-webkit-scrollbar-thumb:hover,
.dr-body:hover::-webkit-scrollbar-thumb:hover, .modal-b:hover::-webkit-scrollbar-thumb:hover {
  background: var(--muted); background-clip: padding-box;
}
::-webkit-scrollbar-thumb:active { background: var(--green); background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }
/* 触屏设备：滚动条彻底隐形（手指滑动即可），避免占视觉 */
@media (pointer: coarse) {
  * { scrollbar-width: none; }
  ::-webkit-scrollbar { display: none; }
}
.tabs::-webkit-scrollbar { display: none; }
.tabs { scrollbar-width: none; }
/* 页面级滚动条同样 hover 才显形 */
html { scrollbar-width: thin; scrollbar-color: transparent transparent; }
html:hover { scrollbar-color: var(--line2) transparent; }
html:hover::-webkit-scrollbar-thumb { background: var(--line2); background-clip: padding-box; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); max-height: 74vh; overscroll-behavior: contain; }
/* 矩阵横向滚动时，行头（哪个号）固定不动 */
.matrix-wrap { overflow-x: auto; overscroll-behavior-x: contain; }
table.matrix thead th.rh, table.matrix tbody td.rh {
  position: sticky; left: 0; z-index: 3;
  background: var(--surface2); box-shadow: 1px 0 0 var(--line);
}
table.matrix tbody td.rh { background: var(--surface); }
table.matrix tbody tr:hover td.rh { background: var(--bg2); }
table.matrix thead th.rh { z-index: 4; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
table.grid th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface2); text-align: left; font: 600 10.5px var(--mono);
  color: var(--muted); text-transform: uppercase; letter-spacing: .5px;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; cursor: pointer; user-select: none;
}
table.grid th:hover { color: var(--green); }
table.grid th .sortmark { color: var(--green); font-size: 10px; }
table.grid td {
  padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle;
  max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
table.grid tr:hover td { background: var(--bg2); }
table.grid tr.drag-over td { border-top: 1px solid var(--green); }
table.grid td.num { font-family: var(--mono); color: var(--yellow); }
table.grid td.mono { font-family: var(--mono); }
tr[draggable="true"] { cursor: grab; }
.drag-handle { color: var(--muted); cursor: grab; padding-right: 2px; user-select: none; font-family: var(--mono); }
.row-del { color: var(--muted); cursor: pointer; padding-left: 6px; font-family: var(--mono); }
.row-del:hover { color: var(--red); }

.tag {
  display: inline-block; padding: 1px 8px; border-radius: var(--r-pill); font-size: var(--fs-tag);
  border: 1px solid var(--line2); background: transparent; font-family: var(--mono);
}
.tag.available { color: var(--green); border-color: var(--green); }
.tag.active { color: var(--cyan); border-color: var(--cyan); }
.tag.registered { color: var(--violet); border-color: var(--violet); }
.tag.used { color: var(--muted); }
.tag.cooling { color: var(--yellow); border-color: var(--yellow); }
.tag.retired { color: var(--red); border-color: var(--red); }
.tag.failed { color: var(--red); }
.tag.unusable { color: var(--muted); opacity: .7; }
/* 冷却到期：从「黄=等一等」翻成「绿=可以再来了」 */
.tag.ok { color: var(--green); border-color: var(--green); }

.cell-input, .cell-select {
  width: 100%; background: var(--bg2); color: var(--text); border: 1px solid var(--green); border-radius: var(--r-sm);
  padding: 4px 6px; outline: none; font-family: var(--mono);
}
.cell-select { appearance: none; -webkit-appearance: none; padding-right: 18px;
  background-image: linear-gradient(45deg, transparent 50%, var(--green) 50%), linear-gradient(135deg, var(--green) 50%, transparent 50%);
  background-position: calc(100% - 11px) 52%, calc(100% - 6px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}

/* ---------- 移动端卡片 ---------- */
.cards-mobile { display: none; flex-direction: column; gap: 8px; }
.mcard { border: 1px solid var(--line); border-left: 2px solid var(--lc, var(--line2)); border-radius: var(--r); background: var(--surface); padding: 10px 12px; }
.mcard .m-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.mcard .m-title { font: 600 13px var(--mono); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcard .m-head-r { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.mcard .m-upd { font: 10px var(--mono); color: var(--muted); }
.mcard .m-rows { display: flex; flex-direction: column; gap: 4px; }
.mcard .m-row { display: flex; gap: 8px; font-size: 12px; align-items: baseline; }
.mcard .m-row .k { color: var(--muted); font: 11px var(--mono); min-width: 66px; flex-shrink: 0; }
.mcard .m-row .v { flex: 1; word-break: break-all; }
.mcard .m-actions { margin-top: 8px; display: flex; gap: 8px; justify-content: flex-end; }
.mcard .m-actions .btn { padding: 5px 12px; }

/* ---------- 看板 ---------- */
.board { display: grid; grid-template-columns: repeat(6, minmax(210px, 1fr)); gap: 10px; align-items: start; overflow-x: auto; }
.col { background: var(--surface); border: 1px solid var(--line); border-top: 2px solid var(--bc, var(--line2)); border-radius: var(--r); min-height: 200px; }
.col-h { display: flex; align-items: center; justify-content: space-between; padding: 8px 11px; border-bottom: 1px solid var(--line); font: 600 11.5px var(--mono); }
.col-h .count { color: var(--muted); font-size: 11px; }
.col-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.col.drop-hint { border-color: var(--green); background: var(--accent-soft); }
.col-empty { text-align: center; padding: 16px 0; color: var(--muted); opacity: .55; font: 11px var(--mono); }
.card { background: var(--surface2); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; cursor: grab; font-size: 12px; }
.card:hover { border-color: var(--line2); }
.card .c-plat { font-weight: 600; font-family: var(--mono); }
.card .c-res { font-family: var(--mono); color: var(--cyan); font-size: 11.5px; margin-top: 2px; }
.card .c-meta { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
.card .c-credits { font-family: var(--mono); color: var(--yellow); font-size: 11px; }
.card .c-note { color: var(--muted); font-size: 11px; margin-top: 5px; }

/* ---------- 设置 ---------- */
.kv { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.kv span { font: 12px var(--mono); color: var(--muted); }
.kv code { background: var(--surface2); padding: 3px 8px; border-radius: var(--r); border: 1px solid var(--line); font-size: 11.5px; word-break: break-all; color: var(--yellow); }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.row input { background: transparent; border: 1px solid var(--line); border-radius: var(--r); padding: 6px 10px; outline: none; font-family: var(--mono); }
.row input:focus { border-color: var(--green); }
.code { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; margin-top: 12px; font-size: 11.5px; color: var(--muted); font-family: var(--mono); max-width: 100%; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }

.qcount {
  font-size: 11px; color: var(--cyan); border: 1px solid var(--cyan); border-radius: var(--r-pill);
  padding: 1px 9px; opacity: 0; transition: opacity .18s; white-space: nowrap;
}
.qcount.show { opacity: 1; }
table.grid td.empty-row { text-align: center; padding: 26px 10px; color: var(--muted); white-space: normal; }
.empty-row .btn { margin-left: 8px; }
.empty-card { text-align: center; padding: 18px; border-left-color: var(--line2); }
.empty-card .m-actions { justify-content: center; }
mark { background: var(--accent-soft); color: var(--accent); border-radius: var(--r-sm); padding: 0 1px; }
.rcode { color: var(--cyan); font: 400 11px var(--mono); white-space: nowrap; }

/* ---------- 搜索语法帮助浮层 ---------- */
.qhelp {
  position: absolute; top: calc(100% + 6px); right: 8px; z-index: var(--z-menu);
  width: min(420px, calc(100vw - 24px));
  background: var(--bg); border: 1px solid var(--line2); border-radius: var(--r);
  padding: 10px 12px; box-shadow: var(--sh-1);
  opacity: 0; visibility: hidden; transform: translateY(-4px);
  transition: opacity .14s, transform .14s, visibility .14s;
}
.qhelp.show { opacity: 1; visibility: visible; transform: translateY(0); }
.qh-t { font-size: 11.5px; color: var(--text); margin-bottom: 8px; display: flex; gap: 8px; align-items: baseline; }
.qh-row { display: flex; gap: 10px; align-items: baseline; padding: 3px 0; min-width: 0; }
.qh-row code {
  flex: 0 0 auto; max-width: 46%; font-family: var(--mono); font-size: 11px;
  color: var(--cyan); background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 1px 6px; overflow-wrap: anywhere;
}
.qh-row .muted { font-size: 11px; min-width: 0; }
.qh-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
/* 搜索语法提示里的 chip 与全站 chip 同规格，只改可点/颜色 */
.qh-chips .chip { cursor: pointer; color: var(--muted); }
.qh-chips .chip:hover { color: var(--green); border-color: var(--green); }
.qh-tip { font-size: 11px; margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 7px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--bg2); border: 1px solid var(--green); color: var(--text);
  padding: 7px 16px; border-radius: var(--r-pill); font: 12px var(--mono);
  opacity: 0; pointer-events: none; transition: .2s; z-index: var(--z-toast);
}
/* 批量条浮出时把 toast 顶上去，两条不打架 */
#bulkBar:not(.hidden) ~ .toast { bottom: 72px; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .board { grid-template-columns: repeat(6, minmax(180px, 1fr)); }
}
@media (max-width: 640px) {
  .topbar { padding: 8px 10px; gap: 8px; }
  .search { flex: 1; min-width: 120px; width: auto; }
  /* flex-basis:100% 强制换行到独立一行；否则 flex:1(basis:0) 会让 tab 栏挤在第一行只剩几像素 */
  .tabs { order: 3; width: 100%; flex: 1 1 100%; }
  .tab { padding: 8px 13px; font-size: 12.5px; }
  .main { padding: 10px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .brand-tag { font-size: 10px; padding: 1px 6px; } /* 实时时钟移动端保留 */
  .table-wrap { display: none; }
  .cards-mobile { display: flex; }
  .board { grid-template-columns: 1fr; }
  .col { min-height: auto; }
  .btn { min-height: 34px; }
  .cell-input, .cell-select { font-size: 16px; }
  .toolbar { align-items: stretch; }
  .tool-right { width: 100%; justify-content: space-between; }
  .tool-right .hint { display: none; }
  .qcount { order: 2; }
  .mcard .m-actions { margin-top: 8px; display: flex; gap: 8px; }
  .mcard .m-actions .btn { padding: 5px 12px; font-size: 11.5px; }
}
/* ---------- 洞察视图：分布 / 矩阵 / 反查 ---------- */
.seg { display: inline-flex; gap: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button {
  background: transparent; border: 0; border-left: 1px solid var(--line); cursor: pointer;
  color: var(--muted); font: 400 11px var(--mono); padding: 3px 10px; white-space: nowrap;
}
.seg button:first-child { border-left: 0; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent-soft); color: var(--green); }

.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row {
  display: grid; grid-template-columns: 116px 1fr 62px; align-items: center; gap: 10px;
  cursor: pointer; padding: 2px 4px; border-radius: var(--r-sm); min-width: 0;
}
.bar-row:hover { background: var(--bg2); }
.bar-k { font: 400 11.5px var(--mono); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 9px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; min-width: 0; }
.bar-fill { display: block; height: 100%; border-radius: 1px; }
.bar-v { font: 400 11px var(--mono); color: var(--muted); text-align: right; white-space: nowrap; }
.bar-v b { color: var(--text); font-weight: 600; }

.mat-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 9px; }
.mat-tools select, .mat-tools input {
  background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r);
  color: var(--text); font: 400 11.5px var(--mono); padding: 4px 7px; outline: none; max-width: 100%;
  appearance: none; -webkit-appearance: none; padding-right: 20px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 11px) 52%, calc(100% - 6px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.mat-tools input { appearance: auto; -webkit-appearance: none; padding-right: 7px; background-image: none; }
.matrix-wrap { overflow-x: auto; }
table.matrix { border-collapse: separate; border-spacing: 2px; font-size: 11px; min-width: 100%; }
table.matrix th, table.matrix td { border: 0; padding: 0; background: transparent; }
table.matrix thead { background: transparent; }
table.matrix th { cursor: default; }
table.matrix th:hover { color: var(--muted); }
table.matrix thead th {
  vertical-align: bottom; height: 86px; padding-bottom: 4px; white-space: nowrap;
  font: 400 10px var(--mono); color: var(--muted);
}
/* 列头竖排：不再用 writing-mode+rotate 组合（字符会倒），改成整块文本旋转。
 * head-left（默认）：整体逆时针 90°，文字头在左、脚在右，从下往上；
 * head-right：顺时针 90°（传统竖排方向）；head-upright：中文正立从上往下。
 * DOM 文本一律保持原名（.ph 不做字符反转），复制/搜索/测试都拿原名。 */
table.matrix thead th .ph-wrap {
  display: block; height: 84px; overflow: hidden;
  display: flex; align-items: center; justify-content: flex-start;
}
table.matrix thead th .ph {
  display: inline-block; white-space: nowrap;
  max-width: 84px; overflow: hidden; text-overflow: ellipsis;
  font: 10px var(--mono); color: var(--muted); line-height: 1.1;
}
table.matrix.head-left thead th .ph { transform: rotate(-90deg); }
table.matrix.head-right thead th .ph { transform: rotate(90deg); }
table.matrix.head-upright thead th .ph-wrap { height: 96px; align-items: flex-start; }
table.matrix.head-upright thead th .ph {
  transform: none; writing-mode: vertical-rl; text-orientation: mixed;
  max-width: none; max-height: 96px;
}
/* 行头（资源名）保持 sticky，见下 */
table.matrix th.rh, table.matrix td.rh {
  text-align: left; padding: 0 8px 0 2px; white-space: nowrap; font: 400 11px var(--mono);
}
table.matrix td.rh .code { color: var(--cyan); margin-right: 6px; }
table.matrix td.rh .carrier { color: var(--muted); font-size: 10px; margin-left: 6px; }
.mcell {
  width: 30px; height: 26px; border: 1px solid var(--line); border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  font: 400 9.5px var(--mono); color: var(--bg); background: var(--surface2); position: relative;
}
.mcell:hover { border-color: var(--text); }
.mcell.empty { background: transparent; border-style: dashed; border-color: var(--line2); color: var(--muted); }
.mcell.empty:hover { border-color: var(--green); color: var(--green); }
html[data-theme="light"] .mcell { color: var(--text); }
.mat-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 9px; font-size: 10.5px; color: var(--muted); }
.mat-legend span { display: inline-flex; align-items: center; gap: 5px; }
.mat-legend i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }

.plist { display: flex; flex-direction: column; }
.pitem { border-top: 1px solid var(--line); padding: 7px 0; min-width: 0; }
.pitem:first-child { border-top: 0; }
.pitem-h { display: flex; align-items: baseline; gap: 8px; cursor: pointer; flex-wrap: wrap; }
.pitem-h .code { color: var(--cyan); font: 400 11px var(--mono); }
.pitem-h .nm { font: 500 12px var(--sans); color: var(--text); }
.pitem-h .ratio { font: 400 11px var(--mono); color: var(--muted); margin-left: auto; white-space: nowrap; }
.pitem-b { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.pitem-b .nchip {
  font: 400 var(--fs-tag) var(--mono); border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 1px 8px; color: var(--muted); white-space: nowrap;
}
.pitem-b .nchip.free { border-style: dashed; cursor: pointer; }
.pitem-b .nchip.free:hover { color: var(--green); border-color: var(--green); }
.pitem-b .nchip.used { cursor: pointer; }
.pitem-b .lbl { font-size: 10.5px; color: var(--muted); width: 100%; }

.mat-card { border-left-width: 2px; }
.mat-card .mc-plats { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }

@media (max-width: 640px) {
  .bar-row { grid-template-columns: 92px 1fr 54px; }
  .matrix-wrap { display: none; }
  #matCards { display: flex; }
  .seg { width: 100%; overflow-x: auto; }
}
@media (min-width: 641px) {
  #matCards { display: none; }
}

@media (min-width: 641px) {
  .cards-mobile { display: none !important; }
}

/* ============================================================
   金融级视觉：实时时钟 / 到期倒计时 / 数字滚动 / 等宽对齐
   ============================================================ */

/* 顶栏实时同步时钟（秒级自动走） */
.brand-tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: .3px;
}
.sync-lbl { color: var(--muted); font-size: 10px; }
.live-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex: 0 0 6px;
  box-shadow: 0 0 0 0 var(--green); animation: livePulse 2s ease-out infinite;
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(var(--green-rgb), .55); opacity: 1; }
  70%  { box-shadow: 0 0 0 6px rgba(var(--green-rgb), 0); opacity: .75; }
  100% { box-shadow: 0 0 0 0 rgba(var(--green-rgb), 0); opacity: 1; }
}
html[data-theme="light"] .live-dot { background: var(--green); }

/* 锁屏终端窗口右上角时钟 */
.lock-clock {
  margin-left: 12px; font: 11px var(--mono); color: var(--muted);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* 到期 / 冷却倒计时徽标 */
.due {
  display: inline-block; margin-left: 5px; padding: 0 5px;
  border: 1px solid currentColor; border-radius: var(--r-pill);
  font: 400 10px/15px var(--mono); vertical-align: 1px; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.due.warn { color: var(--yellow); background: rgba(250, 204, 21, .08); }
.due.bad  { color: var(--red);    background: rgba(248, 113, 113, .10); }
html[data-theme="light"] .due.warn { background: rgba(202, 138, 4, .09); }
html[data-theme="light"] .due.bad  { background: rgba(220, 38, 38, .08); }

/* 数字滚动 / 千分位：等宽对齐，跳动时不抖 */
.num-anim, .kpi .k-value, table.grid td.num, .bar-v, .k-sub {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.kpi .k-value { letter-spacing: -.5px; }
.num-anim.up   { color: var(--green); }
.num-anim.down { color: var(--red); }

/* 额度数字：正=青，零=灰 */
.c-credits { font-family: var(--mono); color: var(--cyan); font-variant-numeric: tabular-nums; }
table.grid td.num.zero { color: var(--muted); }

@media (max-width: 640px) {
  .sync-lbl { display: none; }
  .brand-tag { padding: 1px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
}

/* ============================================================
   批量编辑 / 排查工作台 / 抽屉 / 备份
   ============================================================ */

/* ---------- 多选列 ---------- */
.sel-col { width: 30px; text-align: center; padding-left: 4px !important; padding-right: 4px !important; }
.sel-col input { width: 13px; height: 13px; accent-color: var(--green); cursor: pointer; vertical-align: middle; }
table.grid th.sel-col { cursor: default; }

/* ---------- 排序表头（未排序也显示占位箭头）---------- */
th.sortable { cursor: pointer; user-select: none; }
th.sortable .sortmark { color: var(--line2); font-size: 9px; margin-left: 3px; }
th.sortable:hover .sortmark { color: var(--muted); }
th.sortable.on { color: var(--green); }
th.sortable.on .sortmark { color: var(--green); }

/* ---------- 批量操作条 ---------- */
.bulk-bar {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: var(--z-menu);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; border: 1px solid var(--green); border-radius: var(--r);
  background: var(--surface); box-shadow: 0 8px 28px rgba(0, 0, 0, .35);
  max-width: calc(100vw - 24px);
}
.bulk-bar .b-n { font: 11.5px var(--mono); color: var(--text); white-space: nowrap; }
.bulk-bar .b-n b { color: var(--green); font-size: 13px; }
.bulk-bar .b-sep { width: 1px; height: 18px; background: var(--line2); }
.bulk-bar select, .bulk-bar .bulk-val, .bulk-bar input {
  background: var(--bg2); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--r); font: 11.5px var(--mono); padding: 5px 7px; outline: none; max-width: 190px;
}
.bulk-bar select { appearance: none; -webkit-appearance: none; padding-right: 20px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 11px) 52%, calc(100% - 6px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.bulk-bar .btn { padding: 5px 11px; }

/* ---------- 模板列 ---------- */
.tpl-chip {
  display: inline-block; font: var(--fs-tag) var(--mono); cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-pill); padding: 1px 8px; color: var(--muted); white-space: nowrap;
}
.tpl-chip:hover { color: var(--cyan); border-color: var(--cyan); }

/* ---------- 浮层：气泡 / 小面板（统一由 openPop 生成，结构一致） ---------- */
.pop {
  position: fixed; z-index: var(--z-pop); width: 280px; max-width: calc(100vw - 16px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line2); border-radius: var(--r);
  box-shadow: var(--sh-2); animation: popIn .12s ease-out;
}
.pop-h {
  flex: none; padding: 7px 10px; font: 600 11px var(--mono); color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.pop-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 4px 0; }
.pop-foot {
  flex: none; display: flex; justify-content: flex-end; align-items: center; gap: 6px;
  padding: 7px 10px; border-top: 1px solid var(--line); background: var(--bg2);
}
.pop-foot .btn { padding: 3px 10px; font-size: 11px; }
.pop-foot .muted { font-size: 10px; line-height: 1.4; text-align: left; }
.pop-foot .bulk-val { flex: 1; min-width: 0; }
@keyframes popIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
.pop-i {
  display: block; width: 100%; text-align: left; background: transparent; border: 0;
  border-bottom: 1px solid var(--line); padding: 7px 10px; cursor: pointer; color: var(--text);
}
.pop-i b { display: block; font: 11.5px var(--sans); }
.pop-i span { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
.pop-i:hover { background: var(--bg2); }
.pop-i.on { background: var(--accent-soft); }
.pop-i.on b { color: var(--green); }
/* ---------- 关联账号：可勾选面板 ---------- */
.pop-g { padding: 2px 0; }
.pop-gh {
  padding: 5px 10px 3px; font: 600 10px var(--mono); color: var(--muted);
  letter-spacing: .3px; border-top: 1px solid var(--line);
}
.pop-g:first-child .pop-gh { border-top: 0; }
.pop-item {
  display: flex; align-items: center; gap: 7px; padding: 4px 10px; cursor: pointer;
  font-size: 11.5px; color: var(--text);
}
.pop-item:hover { background: var(--bg2); }
.pop-item .code { font: 10px var(--mono); color: var(--muted); min-width: 26px; }
.pop-item .pop-v { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-item input { accent-color: var(--green); user-select: text; cursor: pointer; }

/* ---------- 平台「开通条件」编辑器 ---------- */
.req-pop { max-width: 340px; display: flex; flex-direction: column; }
.req-pop .pop-mode {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px;
  border-bottom: 1px solid var(--line); font-size: 11px; color: var(--muted);
}
.req-pop .pop-mode label { display: flex; align-items: center; gap: 3px; color: var(--text); cursor: pointer; }
.req-pop .pop-mode input { accent-color: var(--green); }
.req-pop .pop-item { align-items: flex-start; padding: 5px 10px; }
.req-pop .pop-item em {
  display: block; font-style: normal; font-size: 10px; color: var(--muted); margin-top: 1px;
}

/* 开通条件标签：入口（蓝）/ 材料（灰）/ 实名·KYC（黄） */
.tag.req-identity { color: var(--cyan); border-color: var(--cyan); }
.tag.req-material { color: var(--muted); border-color: var(--line2); }
.tag.req-extra { color: var(--yellow); border-color: var(--yellow); }
.req-mode {
  font: 600 9.5px var(--mono); padding: 0 4px; border-radius: var(--r-sm);
  border: 1px solid var(--line2); color: var(--muted); vertical-align: 1px;
}
.req-mode.any { color: var(--violet); border-color: var(--violet); }
.req-mode.all { color: var(--cyan); border-color: var(--cyan); }
.req-cell { cursor: pointer; }

/* 资源类型：材料类别打个小徽标，避免当成登录入口 */
.kind-badge {
  font: 600 9px var(--mono); padding: 0 3px; border-radius: var(--r-sm);
  border: 1px solid var(--line2); color: var(--muted); vertical-align: 1px;
}
.kind-badge.material { color: var(--muted); }

/* KPI 卡片的来源说明角标 */
.k-tip {
  display: inline-block; margin-left: 3px; width: 12px; height: 12px; line-height: 12px;
  text-align: center; border-radius: 50%; border: 1px solid var(--line2);
  font: 600 9px var(--mono); color: var(--muted); opacity: .55; cursor: help;
}
.kpi:hover .k-tip { opacity: 1; color: var(--green); border-color: var(--green); }

/* ---------- 帮助浮层 ---------- */
.modal {
  position: fixed; inset: 0; z-index: var(--z-modal); background: var(--scrim);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--surface); border: 1px solid var(--line2); border-radius: var(--r);
  width: min(680px, 100%); max-height: 84vh; display: flex; flex-direction: column;
  box-shadow: var(--sh-3);
}
.modal-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--line); font: 600 12px var(--mono);
}
.modal-b { padding: 4px 14px 14px; overflow: auto; }
.hp-sec { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.hp-sec:last-child { border-bottom: 0; }
.hp-h { font: 600 11.5px var(--mono); color: var(--green); margin-bottom: 6px; letter-spacing: .3px; }
.hp-row { font-size: 12px; line-height: 1.75; color: var(--text); }
.hp-row b { color: var(--text); font-weight: 600; }
.hp-row code {
  font: 11px var(--mono); background: var(--bg2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 0 4px; color: var(--cyan);
}
.hp-tip {
  margin-top: 6px; padding: 6px 8px; font-size: 11.5px; line-height: 1.7;
  background: var(--accent-soft); border-left: 2px solid var(--green); border-radius: var(--r-sm);
}
/* 关闭按钮：弹窗 / 抽屉 / 行内 一律同一枚 */
.row-x {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0; cursor: pointer;
  background: transparent; border: 1px solid var(--line); border-radius: var(--r);
  color: var(--muted); font: 12px/1 var(--mono);
}
.row-x:hover { color: var(--red); border-color: var(--red); background: var(--bg2); }

/* 编辑中的单元格：明确告诉你「还没提交」 */
td.is-editing { position: relative; outline: 1px solid var(--green); outline-offset: -1px; background: var(--accent-soft); }
td.is-editing::after {
  content: '未提交'; position: absolute; margin: -2px 0 0 4px;
  font: 9px var(--mono); color: var(--yellow); pointer-events: none;
}

/* ---------- 关联视觉：表格 / 抽屉 / 面板 全站同一枚「关联胶囊」 ---------- */
.rel-tag {
  display: inline-flex; align-items: center; gap: 3px; vertical-align: 1px;
  font: 10.5px/1.6 var(--mono); white-space: nowrap; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-pill); padding: 1px 8px;
  color: var(--muted); background: transparent;
  transition: color .12s ease, border-color .12s ease, background .12s ease;
}
/* 已关联：实心胶囊，青色 = 这条关系是「通」的 */
.rel-tag.is-linked { color: var(--cyan); border-color: var(--cyan); background: rgba(var(--cyan-rgb), .10); }
.rel-tag.is-linked:hover { background: rgba(var(--cyan-rgb), .20); }
/* 手填未转正：虚线灰，hover 转绿提示「点我转正」 */
.rel-tag.is-loose { border-style: dashed; opacity: .9; }
.rel-tag.is-loose:hover { color: var(--green); border-color: var(--green); border-style: solid; opacity: 1; }
/* 计数徽标 / 折叠个数 / 空态 */
.rel-tag.is-count { color: var(--cyan); border-color: var(--line2); background: transparent; }
.rel-tag.is-count:hover { border-color: var(--cyan); }
.rel-tag.is-more { border-style: dashed; cursor: default; }
.rel-tag.is-add { border-style: dashed; opacity: .8; }
.rel-tag.is-add:hover { color: var(--green); border-color: var(--green); opacity: 1; }

/* 关联列本体 */
td.binds-col { cursor: pointer; }
td.binds-col:hover .rel-tag.is-add, td.binds-col:hover .rel-tag.is-count { color: var(--green); border-color: var(--green); }

/* ---------- 资源详情抽屉（与弹窗同一套：遮罩 + Esc + 同款关闭按钮） ---------- */
.scrim {
  position: fixed; inset: 0; z-index: var(--z-scrim); background: var(--scrim);
  animation: fadeIn .14s ease-out;
}
.scrim.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 420px; max-width: 92vw; z-index: var(--z-drawer);
  background: var(--surface); border-left: 1px solid var(--line2);
  display: flex; flex-direction: column; box-shadow: -12px 0 32px rgba(0, 0, 0, .35);
  animation: drawerIn .16s ease-out;
}
@keyframes drawerIn { from { transform: translateX(16px); opacity: .4; } to { transform: none; opacity: 1; } }
.dr-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.dr-title { font: 600 12px var(--mono); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dr-body { flex: 1; overflow: auto; padding: 12px 14px 24px; }
.dr-sec { margin-bottom: 18px; }
.dr-h { font: 600 11px var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 7px; }
.dr-kv { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 12px; }
.dr-kv span { color: var(--muted); flex-shrink: 0; }
.dr-kv b { text-align: right; word-break: break-all; }
.dr-binds { display: flex; flex-wrap: wrap; gap: 5px; }
.dr-plat { border: 1px solid var(--line); border-radius: var(--r); padding: 8px 10px; margin-bottom: 8px; }
.dr-ph { font: 11.5px var(--mono); margin-bottom: 5px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- 排查工作台 ---------- */
.probe-panel { border-color: var(--green); }
.probe-sum { margin-top: 10px; padding: 9px 11px; border: 1px solid var(--line); border-left: 2px solid var(--green); border-radius: var(--r); background: var(--accent-soft); }
.ps-line { font-size: 12.5px; }
.ps-line b { color: var(--green); font-family: var(--mono); }
.ps-hi b { font-size: 14px; }
.ps-sub { margin-top: 3px; }
.probe-sum .nchip { margin-left: 3px; }

.pp-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 7px; }
.pp-lbl { font: 10px var(--mono); color: var(--muted); }
.chip.pp-preset.on { border-color: var(--green); color: var(--green); background: var(--accent-soft); }
.pp-search { max-width: 240px; }
.pp-list { display: flex; flex-wrap: wrap; gap: 5px; max-height: 132px; overflow: auto; padding: 2px; }
.pp-item {
  background: transparent; border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 3px 10px; font: var(--fs-btn) var(--mono); color: var(--muted); cursor: pointer; white-space: nowrap;
}
.pp-item:hover { border-color: var(--green); color: var(--green); }
.pp-item.on { background: var(--accent-soft); border-color: var(--green); color: var(--green); }
.pp-item .rcode { color: var(--cyan); font: 10px var(--mono); margin-right: 3px; }

.sum-c { text-align: right; font: 11px var(--mono); white-space: nowrap; }
.sum-c b { color: var(--green); font-size: 12.5px; }
.sum-h { text-align: right; }
tr.virgin td.rh { border-left: 2px solid var(--green); }

/* ---------- 备份面板 ---------- */
.bk-cfg { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.bk-cfg .kv { display: flex; align-items: center; gap: 6px; }
.bk-cfg .kv > span { font: 11px var(--mono); color: var(--muted); }
.bk-cfg select, .bk-cfg input { background: var(--bg2); color: var(--text); border: 1px solid var(--line); border-radius: var(--r); padding: 5px 7px; font: 11.5px var(--mono); outline: none; }
.bk-list { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; max-height: 300px; overflow: auto; }
.bk-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 5px 8px; border: 1px solid var(--line); border-radius: var(--r); }
.bk-item.is-prev { border-color: var(--yellow); }
.bk-n { font-size: 11px; word-break: break-all; flex: 1; min-width: 160px; }
.bk-t { white-space: nowrap; }
.bk-a { display: flex; gap: 4px; margin-left: auto; }
.bk-a .btn { padding: 3px 8px; font-size: 11px; }

@media (max-width: 640px) {
  .bulk-bar { bottom: 8px; gap: 6px; padding: 7px 9px; }
  .bulk-bar select, .bulk-bar .bulk-val, .bulk-bar input { max-width: 130px; }
  .drawer { width: 100%; }
  .pp-list { max-height: 108px; }
}

/* 抽屉内自定义字段：可点击编辑 */
.dr-edf { cursor: pointer; border-bottom: 1px dashed transparent; }
.dr-edf:hover { color: var(--green); border-bottom-color: var(--green); }

/* 额度单位：小字跟在数字后，不喧宾夺主 */
.unit { font: 10px var(--mono); color: var(--muted); margin-left: 2px; }

/* 手填转正标签：可点击，鼠标悬停提示可交互（已并入 .rel-tag.is-loose） */
.rel-tag.is-loose { cursor: pointer; }

/* 编辑中的行：临时关掉拖拽，光标也别再显示成「可抓」 */
tr.no-drag { cursor: default; }
