/* 远程辅助管理 —— 原型样式
   深色终端风格，贴合设备管控场景 */

:root {
  --bg: #0d1117;
  --bg-2: #161b22;
  --bg-3: #21262d;
  --border: #30363d;
  --border-2: #3d444d;
  --fg: #e6edf3;
  --fg-2: #9198a1;
  --fg-3: #6e7681;
  --accent: #2f81f7;
  --accent-2: #1f6feb;
  --ok: #3fb950;
  --warn: #d29922;
  --danger: #f85149;
  --radius: 6px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app { height: 100%; }

.boot {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--fg-3);
}

/* ---------- 通用组件 ---------- */

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border-2);
  background: var(--bg-3);
  color: var(--fg);
  padding: 6px 14px;
  border-radius: var(--radius);
  transition: background .15s, border-color .15s;
}
button:hover:not(:disabled) { background: #2d333b; border-color: #4b545d; }
button:disabled { opacity: .45; cursor: not-allowed; }

button.primary {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}
button.primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }

button.danger {
  background: transparent;
  border-color: #5c2b2b;
  color: var(--danger);
}
button.danger:hover:not(:disabled) { background: #3a1d1d; }

input, select {
  font: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 7px 11px;
  border-radius: var(--radius);
  outline: none;
  width: 100%;
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--fg-3); }

.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.mono { font-family: var(--mono); }

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 12px;
  line-height: 18px;
  border: 1px solid transparent;
}
.pill.on  { background: #12341c; color: var(--ok); border-color: #1f5c2e; }
.pill.off { background: #2b2b2b; color: var(--fg-3); border-color: #3a3a3a; }
.pill.warn { background: #3a2d10; color: var(--warn); border-color: #5c4a1a; }

/* ---------- 登录页 ---------- */

.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: radial-gradient(ellipse at top, #16202e 0%, var(--bg) 60%);
}

.login-box {
  width: 360px;
  padding: 34px 30px;
}

.login-box h1 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 600;
}

.login-box .sub {
  color: var(--fg-2);
  font-size: 13px;
  margin-bottom: 24px;
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--fg-2);
  margin-bottom: 5px;
}

.login-box button { width: 100%; margin-top: 8px; padding: 9px; }

.form-error {
  color: var(--danger);
  font-size: 13px;
  margin: 10px 0 0;
  min-height: 18px;
}

/* ---------- 主框架 ---------- */

.shell { display: flex; flex-direction: column; height: 100%; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 18px;
  height: 48px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.topbar .brand {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .3px;
}

.topbar .spacer { flex: 1; }

.topbar .who {
  color: var(--fg-2);
  font-size: 13px;
}

.topbar .ws-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--fg-3);
  margin-right: 6px;
  vertical-align: middle;
}
.topbar .ws-dot.on { background: var(--ok); box-shadow: 0 0 6px var(--ok); }

.content {
  flex: 1;
  overflow: auto;
  padding: 18px;
}

/* ---------- 设备列表 ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  padding: 14px 16px;
}
.stat .k { font-size: 12px; color: var(--fg-2); }
.stat .v { font-size: 24px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat .v.ok { color: var(--ok); }
.stat .v.muted { color: var(--fg-3); }

.filters {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-wrap: wrap;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.filters .f { min-width: 130px; }
/* 设备列表 5 个筛选（搜索/在线/无障碍/防删/电池白名单）+ 按钮组要在同一行排下。
   用固定基准 118px 且不主动撑满（0 1 118px）：5×118 + 按钮组 172 + 间隙 ≈ 842px，
   能放进内容区；容器更窄时再按比例收缩。 */
.filters .f { flex: 0 1 118px; min-width: 96px; }
.filters .actions { flex: 0 0 auto; }
.filters .f label { display: block; font-size: 12px; color: var(--fg-2); margin-bottom: 4px; }
.filters .f.grow { flex: 1; min-width: 200px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 500;
  color: var(--fg-2);
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid #21262d;
  vertical-align: middle;
}
tbody tr:hover { background: #1a2029; }
tbody tr:last-child td { border-bottom: none; }

table .num { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; }
table .dim { color: var(--fg-2); }

.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--fg-2);
  font-size: 13px;
}

.empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--fg-3);
}

/* ---------- 终端页 ---------- */

.terminal {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 14px;
  height: 100%;
  min-height: 0;
}

.term-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.screen-panel {
  flex: 1;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: crosshair;
  background:
    repeating-conic-gradient(#12171f 0% 25%, #0f141a 0% 50%) 50% / 20px 20px;
}

.screen-panel img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.screen-placeholder {
  text-align: center;
  color: var(--fg-3);
  padding: 30px;
}
.screen-placeholder .big { font-size: 15px; margin-bottom: 6px; color: var(--fg-2); }
.screen-placeholder .hint { font-size: 12px; line-height: 1.7; }

.click-marker {
  position: absolute;
  width: 26px; height: 26px;
  margin: -13px 0 0 -13px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  pointer-events: none;
  animation: markerFade .7s ease-out forwards;
}
@keyframes markerFade {
  from { transform: scale(.4); opacity: 1; }
  to   { transform: scale(1.6); opacity: 0; }
}

.term-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  flex-shrink: 0;
}
.panel-title .spacer { flex: 1; }
.panel-title .tag { font-size: 11px; color: var(--fg-3); font-weight: 400; }

.panel-body {
  padding: 12px 14px;
  overflow: auto;
  min-height: 0;
}

.kv {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 6px 10px;
  font-size: 13px;
}
.kv .k { color: var(--fg-2); font-size: 12px; }
.kv .v { font-family: var(--mono); font-size: 12px; word-break: break-all; }
/* 权限状态分隔行：跨满两列 */
.kv .k.perm-sep {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line, rgba(255,255,255,0.08));
  color: var(--fg-3);
  font-weight: 600;
}
.kv .v.perm-sep { display: none; }

.node-tree {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
}
.node {
  padding: 2px 0 2px 0;
  border-left: 2px solid transparent;
  padding-left: 8px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.node:hover { background: #1f2630; border-left-color: var(--accent); }
.node .cls { color: #79c0ff; }
.node .txt { color: var(--fg); }
.node .rid { color: var(--fg-3); font-size: 11px; }
.node .cls-border { color: #d2a8ff; }

.control-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 14px;
}
.control-row button { flex: 1; min-width: 84px; padding: 8px 10px; font-size: 13px; }

.log-list {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--fg-2);
}
.log-list .ln { padding: 1px 0; word-break: break-all; }
.log-list .t { color: var(--fg-3); margin-right: 6px; }
.log-list .tx-ok { color: var(--ok); }
.log-list .tx-err { color: var(--danger); }
.log-list .tx-in { color: #79c0ff; }
.log-list .tx-out { color: var(--warn); }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--fg-2);
}
.breadcrumb a { color: var(--accent); text-decoration: none; cursor: pointer; }
.breadcrumb a:hover { text-decoration: underline; }

.toast-host {
  position: fixed;
  top: 60px;
  right: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}
.toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  font-size: 13px;
  max-width: 380px;
  animation: toastIn .2s ease-out;
}
.toast.err { border-color: #5c2b2b; color: #ffa198; }
.toast.ok  { border-color: #1f5c2e; color: #7ee787; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

@media (max-width: 1100px) {
  .terminal { grid-template-columns: 1fr; }
  .term-side { max-height: 400px; }
}
/* ============================================================
   终端页 v2 —— 上下分栏 + 13 个面板
   布局对齐原实现：上半屏画面/信息/节点树，下半屏 tab 区
   ============================================================ */

.term-page {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  gap: 10px;
}

.term-top {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 14px;
  flex: 0 0 auto;
  height: 52%;
  min-height: 300px;
}

.term-bottom {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 220px;
  border: 1px solid var(--line, #26262c);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-1, #17171b);
}

.term-tabs {
  display: flex;
  gap: 2px;
  padding: 6px 8px 0;
  overflow-x: auto;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line, #26262c);
  scrollbar-width: thin;
}

.term-tab {
  flex: 0 0 auto;
  padding: 7px 13px;
  font-size: 12.5px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 7px 7px 0 0;
  background: transparent;
  color: var(--fg-3, #8a8a95);
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, background .15s;
}

.term-tab:hover {
  color: var(--fg-1, #e6e6ea);
  background: rgba(255, 255, 255, .04);
}

.term-tab.active {
  color: var(--fg-0, #fff);
  background: var(--bg-2, #212127);
  border-color: var(--line, #26262c);
}

.term-tabview {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

/* ---------- 面板通用骨架 ---------- */

.fp {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
}

.fp-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line, #26262c);
  flex-wrap: wrap;
}

.fp-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-0, #fff);
}

.fp-sub {
  font-size: 11.5px;
  color: var(--fg-3, #8a8a95);
}

.fp-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  flex: 0 0 auto;
  flex-wrap: wrap;
}

.fp-toggle {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--fg-2, #aaa); cursor: pointer;
  user-select: none;
}
.fp-toggle input[type="checkbox"] { cursor: pointer; accent-color: var(--accent, #5b6af5); }

.fp-section {
  display: block;
  padding: 10px 10px 4px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--fg-3, #8a8a95);
}

.fp-section-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
}

.fp-section-row .fp-section { padding: 0; }

.fp-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.fp-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 8px 10px;
}

.fp-empty {
  padding: 28px 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--fg-3, #8a8a95);
}

.fp-empty.err { color: var(--err, #e5484d); }

.fp-pager {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  flex: 0 0 auto;
  border-top: 1px solid var(--line, #26262c);
}

.fp-count {
  font-size: 11.5px;
  color: var(--fg-3, #8a8a95);
  font-variant-numeric: tabular-nums;
}

.fp-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-2, #b4b4bd);
  cursor: pointer;
}

.fp-select {
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid var(--line, #26262c);
  background: var(--bg-2, #212127);
  color: var(--fg-1, #e6e6ea);
}

.btn-sm {
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--line, #26262c);
  background: var(--bg-2, #212127);
  color: var(--fg-1, #e6e6ea);
  cursor: pointer;
  white-space: nowrap;
}

.btn-sm:hover:not(:disabled) { background: var(--bg-3, #2b2b33); }
.btn-sm:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm.danger { color: var(--err, #e5484d); border-color: rgba(229, 72, 77, .35); }

.btn-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------- 日志 tab ---------- */

.fp-log-wrap { padding: 0; }
.fp-log { padding: 8px 10px; overflow: auto; flex: 1 1 auto; min-height: 0; }
.fp-log .ln { font-size: 11.5px; line-height: 1.65; display: flex; gap: 6px; }
.fp-log .t { color: var(--fg-3, #8a8a95); font-variant-numeric: tabular-nums; flex: 0 0 auto; }

/* ---------- 短信 ---------- */

.sms-card {
  border: 1px solid var(--line, #26262c);
  border-radius: 8px;
  padding: 9px 11px;
  margin-bottom: 8px;
  background: var(--bg-2, #212127);
}

.sms-head { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; flex-wrap: wrap; }
.sms-addr { font-weight: 600; font-size: 12.5px; color: var(--fg-0, #fff); }
.sms-body { font-size: 12.5px; line-height: 1.65; color: var(--fg-1, #e6e6ea); white-space: pre-wrap; word-break: break-word; }

/* ---------- 应用 ---------- */

.app-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; padding: 4px; width: 100%; box-sizing: border-box; }
.app-card {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 4px 8px; border-radius: 10px;
  background: transparent; cursor: pointer;
}
.app-card:hover { background: var(--bg-3, #2a2a32); }
.app-icon { width: 70px; height: 70px; border-radius: 15px; object-fit: cover; background: transparent; cursor: pointer; display: block; }
.app-name { font-size: 11px; color: var(--fg-2, #aaa); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; text-align: center; max-width: 90px; }
.app-actions { display: flex; gap: 4px; justify-content: center; width: 100%; margin-top: 2px; }
.app-actions .btn-sm { font-size: 11px; padding: 2px 8px; border-radius: 20px; }

/* ---------- 系统 ---------- */

.sys-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-bottom: 1px solid rgba(255,255,255,.045);
}
.sys-label { font-size: 12.5px; color: var(--fg-1, #e6e6ea); }
.sys-label .fp-sub { margin-top: 2px; font-family: ui-monospace, monospace; }

.switch {
  min-width: 44px; padding: 4px 10px; font-size: 11.5px; border-radius: 999px;
  border: 1px solid var(--line, #26262c); background: var(--bg-3, #2b2b33);
  color: var(--fg-3, #8a8a95); cursor: pointer;
}
.switch.on { background: rgba(48, 164, 108, .22); color: #3ddc84; border-color: rgba(61, 220, 132, .4); }

/* ---------- 权限 ---------- */

.perm-row {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,.045);
}
.perm-name { font-size: 12.5px; color: var(--fg-1, #e6e6ea); min-width: 96px; }
.perm-key { font-size: 11px; color: var(--fg-3, #8a8a95); font-family: ui-monospace, monospace; }

/* ---------- 相册 ---------- */

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; align-content: start; }
.gallery-cell {
  border-radius: 8px; overflow: hidden; border: 1px solid var(--line, #26262c);
  background: var(--bg-2, #212127); cursor: pointer;
}
.gallery-cell img { width: 100%; height: 150px; object-fit: cover; display: block; }
.gallery-name { font-size: 11px; padding: 4px 6px; color: var(--fg-3, #8a8a95); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.preview-layer {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0, 0, 0, .88);
  display: flex; flex-direction: column;
}
.preview-toolbar {
  display: flex; gap: 6px; padding: 9px 12px; flex-wrap: wrap;
  align-items: center; background: rgba(0, 0, 0, .5);
}
.preview-stage { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 16px; }
.preview-img { max-width: 100%; max-height: 100%; transition: transform .12s; }

/* ---------- 通讯录 ---------- */

.contact-card {
  border: 1px solid var(--line, #26262c); border-radius: 8px;
  padding: 9px 11px; margin-bottom: 8px; background: var(--bg-2, #212127);
}
.contact-name { font-weight: 600; font-size: 12.5px; margin-bottom: 4px; color: var(--fg-0, #fff); }
.contact-line { display: flex; gap: 7px; font-size: 12px; line-height: 1.9; color: var(--fg-1, #e6e6ea); }

/* ---------- 剪切板 ---------- */

.cb-warn {
  font-size: 11.5px; line-height: 1.65; padding: 8px 10px; border-radius: 8px;
  background: rgba(245, 165, 36, .12); color: #f5a524; margin-bottom: 10px;
}
.cb-read { padding: 10px; border: 1px solid var(--line, #26262c); border-radius: 8px; background: var(--bg-2, #212127); margin-bottom: 14px; }
.cb-text { margin: 0 0 6px; font-size: 12.5px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, monospace; color: var(--fg-0, #fff); max-height: 220px; overflow: auto; }
.cb-input {
  width: 100%; min-height: 84px; padding: 9px 10px; font-size: 12.5px; line-height: 1.6;
  border-radius: 8px; border: 1px solid var(--line, #26262c);
  background: var(--bg-2, #212127); color: var(--fg-0, #fff); resize: vertical;
  font-family: inherit;
}

/* ---------- 文件管理 ---------- */

.fm-crumb { display: flex; align-items: center; gap: 3px; font-size: 11.5px; flex-wrap: wrap; }
.fm-crumb a { color: #6ea8fe; cursor: pointer; text-decoration: none; }
.fm-crumb a:hover { text-decoration: underline; }
.fm-crumb .sep { color: var(--fg-3, #8a8a95); }

.fm-filter {
  font-size: 11.5px; padding: 4px 8px; border-radius: 6px; width: 150px;
  border: 1px solid var(--line, #26262c); background: var(--bg-2, #212127); color: var(--fg-1, #e6e6ea);
}

.fm-status { display: flex; gap: 12px; padding: 5px 10px; font-size: 11.5px; color: var(--fg-3, #8a8a95); flex: 0 0 auto; }
.fm-status .busy { color: #f5a524; }

.fm-list { padding: 0; }
.fm-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-bottom: 1px solid rgba(255,255,255,.045);
  font-size: 12px;
}
.fm-row:hover { background: rgba(255,255,255,.03); }
.fm-icon { flex: 0 0 auto; }
.fm-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg-0, #fff); }
.fm-meta { flex: 0 0 70px; text-align: right; color: var(--fg-3, #8a8a95); font-size: 11px; }
.fm-time { flex: 0 0 132px; text-align: right; color: var(--fg-3, #8a8a95); font-size: 11px; }
.fm-actions { flex: 0 0 auto; display: flex; gap: 4px; }
.fm-actions .btn-sm { font-size: 11px; padding: 3px 6px; }

/* ---------- 通知 ---------- */

.notif-status { display: flex; align-items: center; gap: 8px; padding: 6px 10px; flex: 0 0 auto; }
.notif-card {
  border: 1px solid var(--line, #26262c); border-radius: 8px;
  padding: 9px 11px; margin-bottom: 8px; background: var(--bg-2, #212127);
}
.notif-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; flex-wrap: wrap; }
.notif-app { font-size: 11.5px; font-weight: 600; color: #6ea8fe; }
.notif-title { font-size: 12.5px; font-weight: 600; color: var(--fg-0, #fff); margin-bottom: 3px; }
.notif-text { font-size: 12px; line-height: 1.6; color: var(--fg-1, #e6e6ea); white-space: pre-wrap; word-break: break-word; }
.notif-meta { display: flex; gap: 8px; margin-top: 5px; font-size: 10.5px; color: var(--fg-3, #8a8a95); flex-wrap: wrap; }
.notif-meta code { font-family: ui-monospace, monospace; background: rgba(255,255,255,.05); padding: 1px 5px; border-radius: 4px; }
.notif-group { margin-top: 7px; border-top: 1px solid rgba(255,255,255,.06); padding-top: 6px; }
.notif-group summary { font-size: 11.5px; cursor: pointer; color: var(--fg-3, #8a8a95); }
.notif-children { list-style: none; margin: 6px 0 0; padding: 0; }
.notif-children li { display: flex; gap: 8px; font-size: 11.5px; padding: 4px 0; color: var(--fg-2, #b4b4bd); }

/* ---------- 调试日志 / 分析日志 ---------- */

.logfile-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-bottom: 1px solid rgba(255,255,255,.045);
  font-size: 12px;
}
.logfile-row .fm-name { flex: 1 1 auto; }

/* ---------- 诊断 ---------- */

.diag-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-bottom: 1px solid rgba(255,255,255,.045);
  font-size: 11.5px;
}
.diag-time { font-family: ui-monospace, monospace; color: var(--fg-2, #b4b4bd); font-variant-numeric: tabular-nums; }
.diag-echo { color: var(--fg-1, #e6e6ea); font-family: ui-monospace, monospace; }

/* ---------- 弹层 ---------- */

.modal-layer {
  position: fixed; inset: 0; z-index: 320;
  background: rgba(0, 0, 0, .72);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}

.modal-box {
  display: flex; flex-direction: column;
  background: #ffffff;
  border: 1px solid #e4e4e7;
  border-radius: 16px;
  width: min(560px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .18);
}

.modal-box.wide { width: min(920px, calc(100vw - 40px)); }

.modal-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; flex: 0 0 auto;
  border-bottom: 1px solid #e4e4e7;
  font-size: 13px; font-weight: 600; color: #a1a1aa;
}

.modal-body { padding: 12px; overflow: auto; min-height: 0; flex: 1 1 auto; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding-top: 10px; flex-wrap: wrap; }

.modal-input {
  width: 100%; padding: 7px 9px; font-size: 12.5px; border-radius: 7px;
  border: 1px solid var(--line, #26262c); background: var(--bg-2, #212127);
  color: var(--fg-0, #fff); font-family: inherit;
}

.modal-edit {
  width: 100%; min-height: 220px; padding: 9px 10px; font-size: 12px; line-height: 1.6;
  border-radius: 7px; border: 1px solid var(--line, #26262c);
  background: var(--bg-2, #212127); color: var(--fg-0, #fff); resize: vertical;
  font-family: ui-monospace, monospace;
}

.modal-pre {
  margin: 0; padding: 10px; font-size: 11.5px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-all;
  background: var(--bg-0, #0f0f12); border-radius: 8px;
  border: 1px solid var(--line, #26262c);
  max-height: 60vh; overflow: auto;
  font-family: ui-monospace, monospace;
  color: var(--fg-1, #e6e6ea);
}

.modal-img { max-width: 100%; max-height: 60vh; display: block; margin: 0 auto; border-radius: 8px; }
.modal-video { max-width: 100%; max-height: 60vh; display: block; margin: 0 auto; border-radius: 8px; }

.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.form-row label { font-size: 11.5px; color: var(--fg-3, #8a8a95); }

/* ---------- 窄屏 ---------- */

@media (max-width: 900px) {
  .term-top { grid-template-columns: 1fr; height: auto; max-height: 60vh; }
  .term-side { max-height: 240px; }
  .fm-time { display: none; }
}
/* ============================================================
   终端页 v3：音量控制 / 终端设置 / 卸载自身
   ============================================================ */

/* ---------- 音量控制弹窗 ---------- */
.vol-modal { max-width: 640px; }
.vol-body { display: flex; flex-direction: column; gap: 10px; }
.vol-unavailable { padding: 28px 12px; text-align: center; color: #6e7681; font-size: 13px; }
.vol-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.vol-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid #21262d; border-radius: 10px;
  background: #161b22;
}
.vol-icon { font-size: 18px; width: 26px; text-align: center; flex: 0 0 auto; }
.vol-meta { min-width: 96px; flex: 0 0 auto; }
.vol-name { font-size: 13px; font-weight: 600; color: #e6edf3; }
.vol-range { font-size: 11px; color: #6e7681; margin-top: 2px; font-variant-numeric: tabular-nums; }
.vol-controls { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; }
.vol-step {
  width: 30px; height: 26px; padding: 0; line-height: 1;
  font-size: 15px; flex: 0 0 auto;
}
.vol-slider { flex: 1; min-width: 0; accent-color: #2f81f7; height: 4px; }
.vol-value {
  flex: 0 0 auto; min-width: 24px; text-align: right;
  font-size: 12px; color: #9198a1; font-variant-numeric: tabular-nums;
}
.vol-foot {
  display: flex; align-items: flex-end; gap: 12px;
  padding: 12px 16px; border-top: 1px solid #21262d;
  flex-wrap: wrap;
}
.vol-hint { flex: 1; min-width: 0; font-size: 11px; line-height: 1.6; color: #6e7681; }
.vol-hint p { margin: 0; }
.vol-hint .vol-backup { color: #9198a1; }

/* ---------- 终端设置弹窗 ---------- */
.set-body { display: flex; flex-direction: column; gap: 4px; }
.set-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid #1b2029;
}
.set-label { font-size: 13px; color: #e6edf3; }
.set-input {
  width: 96px; padding: 5px 8px; font-size: 13px;
  background: #0d1117; border: 1px solid #30363d; border-radius: 6px;
  color: #e6edf3; font-variant-numeric: tabular-nums;
}
.set-input:focus { outline: none; border-color: #2f81f7; }
.set-select {
  padding: 5px 8px; font-size: 13px;
  background: #0d1117; border: 1px solid #30363d; border-radius: 6px; color: #e6edf3;
}
.set-range { width: 180px; accent-color: #2f81f7; }

/* ---------- 卸载自身状态条 ---------- */
.uninstall-status {
  margin: 8px 0 0; padding: 8px 12px; border-radius: 8px;
  font-size: 12px; line-height: 1.6;
  border: 1px solid #30363d; background: #161b22; color: #e6edf3;
}
.uninstall-status.confirm { border-color: #9e6a03; background: #271d03; color: #d29922; }
.uninstall-status.pending { border-color: #1f6feb; background: #0c1e35; color: #6bb0ff; }
.uninstall-status.dispatched { border-color: #238636; background: #0d2818; color: #3fb950; }
.uninstall-status.timeout,
.uninstall-status.offline,
.uninstall-status.disabled,
.uninstall-status.unavailable { border-color: #6e2a2a; background: #2a1010; color: #f85149; }

/* ============================================================
   后台页面：侧边栏 / 表格 / 分页 / 表单 / 弹窗
   ============================================================ */

/* ---------- 外壳与侧边栏 ---------- */
.shell-body { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: 176px; flex: 0 0 auto;
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 8px; border-right: 1px solid #21262d; background: #0d1117;
}
.nav-item {
  display: block; padding: 8px 10px; border-radius: 7px;
  font-size: 13px; color: #9198a1; text-decoration: none;
}
.nav-item:hover { background: #161b22; color: #e6edf3; }
.nav-item.on { background: #1f6feb22; color: #6bb0ff; font-weight: 600; }
.page-host { padding: 14px 16px; overflow: auto; flex: 1; min-width: 0; }
/* 宽表页面：允许被压缩的列在窄屏下省略，优先保证操作列可见 */
.data-table th, .data-table td { padding: 8px 8px; }
@media (max-width: 1400px) {
  .sidebar { width: 148px; }
  .page-host { padding: 12px 10px; }
  .data-table { font-size: 11.5px; }
}
.page-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }

/* ---------- 筛选区 ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 10px 12px; }
.filters .f { display: flex; flex-direction: column; gap: 4px; min-width: 120px; }
.filters .f.grow { flex: 1; }
.filters .actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.filters label { font-size: 11px; color: #6e7681; }
.filters input, .filters select {
  padding: 5px 8px; font-size: 12px; background: #0d1117;
  border: 1px solid #30363d; border-radius: 6px; color: #e6edf3; min-width: 0;
}
.filters input:focus, .filters select:focus { outline: none; border-color: #2f81f7; }

/* ---------- 表格 ---------- */
.table-card { padding: 0; overflow: visible; }
.table-card .panel-title { padding: 10px 12px; }
.table-wrap { overflow: auto; }
/* fixed 布局：列宽按 colgroup 严格分配，不再按内容最小宽度压缩操作列 */
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; table-layout: fixed; }
.data-table th {
  text-align: left; font-weight: 600; color: #9198a1; white-space: nowrap;
  padding: 8px 10px; background: #fafafa; border-bottom: 1px solid #e4e4e7;
  position: sticky; top: 0; z-index: 1;
}
.data-table td {
  padding: 8px 10px; border-bottom: 1px solid #e4e4e7; color: #1e2329;
  vertical-align: middle; overflow: visible; text-overflow: ellipsis; white-space: nowrap;
}
.data-table tbody tr:hover { background: #161b2288; }
.table-empty { padding: 34px 12px; text-align: center; color: #6e7681; font-size: 13px; }
.ellipsis { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.muted { color: #6e7681; }

/* ---------- Chip ---------- */
.chip {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; line-height: 1.7; border: 1px solid transparent;
}
.chip-default { background: #21262d; color: #9198a1; }
.chip-ok { background: #23863622; color: #3fb950; border-color: #238636; }
.chip-warn { background: #9e6a0322; color: #d29922; border-color: #9e6a03; }
.chip-danger { background: #6e2a2a22; color: #f85149; border-color: #6e2a2a; }
.chip-primary { background: #1f6feb22; color: #6bb0ff; border-color: #1f6feb; }
.chip-purple { background: #8957e522; color: #bc8cff; border-color: #8957e5; }

/* 标签名称列：名称 + 色标并排，名称过长截断 */
.tag-name-cell { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.tag-name-cell .tag-name-text {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 500; color: #e6edf3;
}
.tag-name-cell .chip { flex: 0 0 auto; }

/* 次要文字（如「ID 3」「未知」） */
.mono-muted { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: #9198a1; }

/* ---------- 日志分析 /log_analysis ---------- */

/* 两行单元格（设备信息、接收时间） */
.two-line { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.two-line .l1 { color: #e6edf3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.two-line .l2 { color: #9198a1; font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ellipsis { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.mono.dur-main { color: #e6edf3; }
.danger { color: #f85149; }
.ok { color: #3fb950; }
.warn { color: #d29922; }
.muted { color: #9198a1; }
.pad-sm { padding: 6px 2px; font-size: 12px; }

/* 时间段筛选（两个日期 + 快捷按钮） */
.range-date { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.range-date .form-input { width: 132px; }
.range-sep { color: #6e7681; font-size: 12px; }
.range-quick { display: flex; gap: 4px; flex-wrap: wrap; margin-left: 4px; }

/* 同步进度条 */
.sync-progress { display: none; align-items: center; gap: 10px; font-size: 12px; color: #9198a1; }
.sync-progress:has(.sync-bar) { display: flex; padding: 4px 2px 8px; }
.sync-progress .sync-bar {
  height: 4px; background: #1f6feb; border-radius: 2px; width: 0;
  transition: width .2s; min-width: 0; flex: 0 0 auto;
}
.sync-progress > span { flex: 0 0 auto; }

/* 详情弹窗 */
.log-detail { display: flex; flex-direction: column; gap: 8px; }
.detail-sec-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; color: #e6edf3;
  padding: 8px 0 4px; border-bottom: 1px solid #21262d; margin-top: 4px;
}
.detail-sec-title .spacer { flex: 1; }
.detail-status {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: #9198a1;
}
.detail-status .form-select { width: 120px; }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 16px; }
.kv-grid .kv { display: flex; gap: 8px; font-size: 12px; min-width: 0; padding: 3px 0; }
.kv-grid .kv .k { flex: 0 0 auto; color: #9198a1; min-width: 78px; }
.kv-grid .kv .v { flex: 1; min-width: 0; color: #e6edf3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.perm-list { display: flex; flex-direction: column; gap: 4px; }
.perm-row { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 3px 0; }
.perm-row .perm-name { flex: 0 0 120px; color: #e6edf3; }
.perm-row .perm-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.event-list { display: flex; flex-direction: column; gap: 3px; max-height: 240px; overflow: auto; }
.event-row { display: flex; align-items: center; gap: 10px; font-size: 12px; padding: 3px 0; border-bottom: 1px solid #161b22; }
.event-row:last-child { border-bottom: none; }
.event-row .event-type { flex: 0 0 130px; color: #6bb0ff; }
.event-row .event-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #e6edf3; }
.event-row .event-status { flex: 0 0 70px; text-align: right; }

.log-json {
  max-height: 320px; overflow: auto; margin: 0;
  background: #0d1117; border: 1px solid #21262d; border-radius: 6px;
  padding: 10px; font-size: 11.5px; line-height: 1.5; color: #9198a1;
  white-space: pre-wrap; word-break: break-all;
}

/* 概览 / 锁屏分析弹窗 */
.ov-body { display: flex; flex-direction: column; gap: 6px; }
.ov-body .stat-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ov-body .stat { background: #0d1117; border: 1px solid #21262d; border-radius: 6px; padding: 8px 12px; min-width: 96px; }
.ov-body .stat .k { font-size: 11px; color: #9198a1; }
.ov-body .stat .v { font-size: 16px; font-weight: 600; color: #e6edf3; }
.ov-body .stat .v.ok { color: #3fb950; }
.ov-body .stat .v.danger { color: #f85149; }
.ov-body .stat .v.warn { color: #d29922; }
.ov-body .stat .v.muted { color: #6e7681; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.mini-table th {
  text-align: left; font-weight: 500; color: #9198a1; padding: 6px 8px;
  background: #161b22; border-bottom: 1px solid #21262d; white-space: nowrap;
}
.mini-table td { padding: 6px 8px; border-bottom: 1px solid #161b22; color: #e6edf3; }
.mini-table tbody tr:hover { background: #161b2288; }
.mini-table td.ok { color: #3fb950; }
.mini-table td.danger { color: #f85149; }
.mini-table td.warn { color: #d29922; }
.mini-table td.muted { color: #9198a1; }

.modal-tools { display: inline-flex; gap: 6px; margin-left: 10px; }

/* ---------- 行内按钮 ---------- */
.row-actions { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.btn-xs {
  padding: 2px 7px; font-size: 11px; line-height: 1.6; cursor: pointer;
  background: #21262d; border: 1px solid #30363d; border-radius: 5px;
  color: #e6edf3; text-decoration: none; white-space: nowrap;
}
.btn-xs:hover { background: #30363d; }
.btn-xs.danger { color: #f85149; border-color: #6e2a2a; }
.btn-xs.ghost { background: transparent; border-color: transparent; color: #6e7681; }
.btn-xs.ghost:hover { background: #21262d; color: #e6edf3; }
.btn-sm.primary { background: #1f6feb; border-color: #1f6feb; color: #fff; }
.btn-sm.primary:hover { background: #388bfd; }
.btn-sm.danger { background: #da3633; border-color: #da3633; color: #fff; }
.btn-sm:disabled, .btn-xs:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- 分页 ---------- */
.pager {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 4px; font-size: 12px; color: #9198a1;
}
.pager-info { color: #6e7681; }
.pager-cur { font-variant-numeric: tabular-nums; }
.pager-jump { width: 56px; padding: 3px 6px; font-size: 12px; background: #0d1117;
  border: 1px solid #30363d; border-radius: 5px; color: #e6edf3; }
.pager-jump-wrap { display: flex; align-items: center; gap: 4px; }

/* ---------- 统计卡 ---------- */
.stat-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.stat.card { flex: 1; min-width: 120px; padding: 10px 12px; }
.stat .k { font-size: 11px; color: #6e7681; }
.stat .v { font-size: 20px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat .v.ok { color: #3fb950; }
.stat .v.warn { color: #d29922; }
.stat .v.err { color: #f85149; }

/* ---------- 表单 ---------- */
.form-card { padding: 12px 14px; }
.form-body { display: flex; flex-direction: column; gap: 2px; }
.form-row {
  display: grid; grid-template-columns: 168px minmax(0, 1fr);
  gap: 12px; padding: 9px 0; border-bottom: 1px solid #1b2029; align-items: start;
}
.form-label { font-size: 12px; color: #9198a1; padding-top: 6px; word-break: break-word; }
.form-control { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 6px 9px; font-size: 13px; font-family: inherit;
  background: #ffffff; border: 1px solid #d4d4d8; border-radius: 6px; color: #1e2329;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: #006fee;
}
.form-input:disabled { opacity: .55; cursor: not-allowed; }
.form-textarea { resize: vertical; min-height: 60px; background: #ffffff; color: #1e2329; }
.form-hint { font-size: 11px; line-height: 1.6; color: #71717a; }
.form-error { font-size: 11px; color: #e33b54; }
.switch-wrap { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #1e2329; cursor: pointer; white-space: nowrap; }
.switch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px 12px; }
.btn-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.upload-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- 弹窗内 ---------- */
.modal-title { font-size: 14px; font-weight: 600; color: #e6edf3; }
.modal-foot { padding: 10px 16px; border-top: 1px solid #21262d; }
.confirm-body { font-size: 13px; color: #c9d1d9; line-height: 1.7; }

/* ---------- 详情面板 ---------- */
.detail-body { display: flex; flex-direction: column; gap: 4px; }
.detail-head { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; flex-wrap: wrap; }
.detail-error {
  padding: 8px 12px; margin-bottom: 8px; border-radius: 6px;
  background: #2a1010; border: 1px solid #6e2a2a; color: #f85149; font-size: 12px;
}
.detail-section { margin-bottom: 10px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 4px 18px; }
/* 只作用于 .kv-grid 内部的 .kv。
   原先写成全局 .kv 会覆盖 terminal 面板里 .kv 的 grid 布局
   （后定义者优先），导致 84px/1fr 双列塌成 flex，
   值列被挤到 7px、文字竖排单字符。 */
.kv-grid .kv { display: flex; gap: 8px; font-size: 12px; padding: 3px 0; }
.kv-grid .kv .k { color: #6e7681; flex: 0 0 122px; }
.kv-grid .kv .v { color: #e6edf3; word-break: break-all; min-width: 0; }
.art-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.art-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; }
.progress-line { display: flex; gap: 6px; flex-wrap: wrap; }
.progress-line .step {
  padding: 3px 10px; font-size: 11px; border-radius: 999px;
  background: #161b22; border: 1px solid #21262d; color: #6e7681;
}
.progress-line .step.on { background: #1f6feb22; border-color: #1f6feb; color: #6bb0ff; }
.progress-line .step.err { background: #2a1010; border-color: #6e2a2a; color: #f85149; }
.order-icon { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; background: #21262d; }
.status-cell { display: inline-flex; align-items: center; gap: 6px; }
.node-card {
  padding: 8px 10px; margin-bottom: 6px; border-radius: 8px;
  background: #161b22; border: 1px solid #21262d;
}
.node-head { font-size: 11px; color: #6bb0ff; margin-bottom: 4px; font-weight: 600; }

/* ---------- 应用图标页 ---------- */
.icon-page-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; }
@media (max-width: 980px) { .icon-page-grid { grid-template-columns: 1fr; } }
.drop-zone {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 26px 16px; border: 1px dashed #30363d; border-radius: 10px;
  background: #0d1117; cursor: pointer; text-align: center;
}
.drop-zone:hover, .drop-zone.dragging { border-color: #2f81f7; background: #0c1e35; }
.drop-icon { font-size: 26px; opacity: .7; }
.drop-hint { font-size: 12px; color: #9198a1; }
.file-info { font-size: 11px; }
.upload-status { color: #3fb950; }
.preview-card { padding: 0 0 12px; border: 1px solid #21262d; border-radius: 10px; background: #0d1117; }
.preview-box {
  display: flex; align-items: center; justify-content: center;
  min-height: 190px; margin: 0 12px; border-radius: 10px;
  background: #161b22; border: 1px solid #21262d;
}
.preview-img { max-width: 132px; max-height: 132px; border-radius: 18px; }
.preview-empty { font-size: 12px; color: #6e7681; }
.preview-meta { padding: 10px 12px 0; display: flex; flex-direction: column; gap: 2px; }
.ip-cell { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.ip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }

/* ---------- 表格内状态开关 ---------- */
.sw { display: inline-flex; align-items: center; cursor: pointer; }
.sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw .sw-track {
  position: relative; width: 36px; height: 20px; border-radius: 999px;
  background: #d4d4d8; transition: background .16s; flex-shrink: 0;
  display: inline-block; vertical-align: middle;
}
.sw .sw-track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px; border-radius: 50%; background: #ffffff;
  transition: transform .16s; box-shadow: 0 1px 2px rgba(0,0,0,0.3);
  z-index: 2;
}
.sw input:checked + .sw-track { background: #17c964; }
.sw input:checked + .sw-track::after { transform: translateX(16px); }
.sw input:focus-visible + .sw-track { outline: 2px solid #006fee; outline-offset: 2px; }
.sw input:disabled + .sw-track { opacity: .5; cursor: not-allowed; }
/* 确保 switch 所在 td 不裁切伪元素 */
.data-table td:has(.sw) { overflow: visible !important; }

/* 操作列在窄列时折行，优先保证整表不超出容器 */
.data-table td .row-actions { white-space: normal; flex-wrap: wrap; }
/* IP 单元格里的小按钮与文字同排 */
.ip-cell .btn-xs { flex: 0 0 auto; }

/* 操作列：fixed 布局下不再被内容挤压，按钮保持单行 */
.data-table td .btn-row { flex-wrap: nowrap; }
.data-table td .btn-row .btn-sm { flex: 0 0 auto; white-space: nowrap; }

/* 操作列固定在右侧（对齐原实现 column fixed:"right"），横滚时始终可见 */
.data-table th.col-fixed-right,
.data-table td.col-fixed-right {
  position: sticky; right: 0; z-index: 2;
  background: #ffffff;
  box-shadow: -8px 0 8px -8px rgba(0, 0, 0, 0.08);
}
.data-table th.col-fixed-right { z-index: 3; background: #fafafa; }
.data-table tbody tr:hover td.col-fixed-right { background: #f5f7fa; }

/* 无筛选字段时筛选栏收成一条窄工具条 */
.filters-bare { padding: 8px 12px; }
.filters-bare .actions { margin-left: auto; }

/* ---------- 窄屏宽表：优先保证操作列可见 ---------- */
@media (max-width: 1280px) {
  /* 订单表「主页」列在窄屏隐藏（宽屏自动恢复） */
  .data-table .col-optional { display: none; }
  .data-table { font-size: 11px; }
  .data-table th, .data-table td { padding: 7px 6px; }
}

/* ---------- 系统设置：开关与多选 ---------- */
.switch-row { gap: 8px; }
.switch-row .sw-text { font-size: 12px; color: #9198a1; }
.check-grid { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 3px 0; }
.check-item {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  color: #e6edf3; cursor: pointer; white-space: nowrap;
}
.check-item input[type="checkbox"] {
  width: 15px; height: 15px; margin: 0; accent-color: #2f81f7; cursor: pointer;
}
.form-select { appearance: auto; }
/* 设置项描述行用小字号，避免撑高行距 */
.form-card .form-row { padding: 8px 0; }

/* ============================================================
   设备列表页：双行单元格 / 可编辑 / 标签 / 勾叉标记
   ============================================================ */
.cell-stack { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cell-stack > * { min-width: 0; }
.cell-stack .sub { font-size: 11px; color: #6e7681; overflow: hidden; text-overflow: ellipsis; }
.link { color: #6bb0ff; text-decoration: none; }
.link:hover { text-decoration: underline; }
.link-sub {
  font-size: 11px; color: #6e7681; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-sub:hover { color: #6bb0ff; text-decoration: underline; }

/* 备注列：文字 + 铅笔，悬停才显铅笔 */
.editable-cell { display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; }
.editable-cell .btn-xs.ghost { opacity: 0; transition: opacity .12s; }
.editable-cell:hover .btn-xs.ghost { opacity: 1; }

/* 锁屏/支付密码两个勾叉 */
.keyguard-cell { display: inline-flex; gap: 10px; align-items: center; }
.keyguard-cell .mark { font-size: 14px; font-weight: 700; line-height: 1; }
.keyguard-cell .mark.ok { color: #3fb950; }
.keyguard-cell .mark.off { color: #f85149; }

/* 标签徽标 */
.tag-cell { display: inline-flex; align-items: center; gap: 4px; min-width: 0; flex-wrap: wrap; }
.tag-badge {
  display: inline-block; max-width: 68px; padding: 0 6px; border-radius: 4px;
  font-size: 10.5px; line-height: 1.7; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.tag-cell .btn-xs.ghost { opacity: 0; transition: opacity .12s; }
.tag-cell:hover .btn-xs.ghost { opacity: 1; }

/* 标签选择弹窗 */
.tag-pick-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow: auto; }
.tag-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; display: inline-block; }

/* 标签管理行 */
.tag-manage-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 2px; border-bottom: 1px solid #1b2029; font-size: 12.5px;
}
.tag-manage-row:last-child { border-bottom: none; }
.tag-manage-row .tag-name { color: #e6edf3; }
.tag-manage-row .spacer { flex: 1; }

/* ==================== 域名配置 / 消息模板 / 伪页管理 ==================== */

/* 网址列：超长靠 CSS 截断（原实现 line-clamp-3，这里单行省略更省高度） */
.url-cell {
  display: block; max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; color: #b9c2cd;
}
.url-cell-empty { color: #5a626d; font-family: ui-monospace, Menlo, monospace; font-size: 11.5px; }

/* 行内可编辑单元格（伪页排序的 edit_text） */
.editable-cell {
  cursor: pointer; border-bottom: 1px dashed #3a424e; padding-bottom: 1px;
  color: #b9c2cd; font-variant-numeric: tabular-nums;
}
.editable-cell:hover { color: #58a6ff; border-bottom-color: #58a6ff; }

/* ==================== 伪页代码管理（/html/editor） ==================== */

.editor-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.editor-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px; align-items: start;
}
@media (max-width: 1100px) {
  .editor-layout { grid-template-columns: minmax(0, 1fr); }
}

.editor-wrap, .preview-wrap {
  display: flex; flex-direction: column;
  background: #0d1117; border: 1px solid #21262d; border-radius: 10px;
  overflow: hidden;
}
.editor-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid #21262d;
  font-size: 12px; color: #9198a1; background: #12171e;
}
.editor-bar .spacer { flex: 1; }

.code-editor {
  width: 100%; min-height: 560px; height: 560px; resize: vertical;
  border: 0; outline: none; padding: 12px 14px; margin: 0;
  background: #0d1117; color: #c9d1d9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.6; tab-size: 2;
}

/* 手机比例预览框 */
.phone-frame {
  padding: 10px; background: #12171e;
}
.html-preview-frame {
  width: 100%; height: 620px; border: 0; border-radius: 8px;
  background: #fff; display: block;
}
.phone-frame .html-preview-frame { height: 560px; }

/* ==================== 节点信息（节点树调试）==================== */

/* 状态 Chip：已处理 / 待处理 */
.chip {
  display: inline-flex; align-items: center; height: 20px;
  padding: 0 8px; border-radius: 10px;
  font-size: 11px; line-height: 1; white-space: nowrap;
}
.chip-ok { background: rgba(63, 185, 80, 0.16); color: #3fb950; }
.chip-warn { background: rgba(210, 153, 34, 0.16); color: #d29922; }
.chip-off { background: rgba(139, 148, 158, 0.16); color: #8b949e; }

/* 详情弹窗 */
.node-detail { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.node-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  font-size: 11.5px; color: #9198a1; flex: 0 0 auto;
}
.node-remark { font-size: 12px; color: #c9d1d9; flex: 0 0 auto; }

/* 原始 JSON：最大 60vh 内滚动 */
.json-view {
  margin: 0; min-height: 0; max-height: 60vh; overflow: auto;
  padding: 12px; border-radius: 8px;
  background: #161b22; border: 1px solid #21262d;
  color: #c9d1d9; font-size: 11.5px; line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap; word-break: break-all;
}

/* 表单里承载下拉/失败态的容器 */
.form-input-host { width: 100%; }
.load-fail { display: flex; flex-direction: column; gap: 8px; }
.load-fail p { margin: 0; font-size: 12px; color: #d29922; }

/* ===== 文本编辑 /text_editor ===== */
.te-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}
@media (max-width: 900px) {
  .te-grid { grid-template-columns: 1fr; }
}

.te-side { display: flex; flex-direction: column; gap: 8px; }
.te-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; max-height: 62vh; }

.te-item {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
}
.te-item:hover { background: #161b22; }
.te-item.active { background: #1f2937; border-color: #30363d; }
.te-item-title { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.te-item-sub { font-size: 11px; font-family: ui-monospace, Menlo, Consolas, monospace; }

.te-edit { display: flex; flex-direction: column; gap: 8px; }
.te-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.te-head { display: flex; flex-direction: column; gap: 4px; }
.te-key {
  font-size: 11px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  color: #8b949e;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 4px;
  padding: 1px 6px;
}
.te-meta { font-size: 11.5px; }

.te-textarea {
  width: 100%;
  min-height: 52vh;
  resize: vertical;
  padding: 12px;
  border-radius: 8px;
  background: #0d1117;
  border: 1px solid #21262d;
  color: #c9d1d9;
  font-size: 12.5px;
  line-height: 1.6;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  tab-size: 2;
}
.te-textarea:focus { outline: none; border-color: #388bfd; }

.te-foot { display: flex; align-items: center; }
.te-status { font-size: 11.5px; color: #8b949e; }
.te-status.ok { color: #3fb950; }
.te-status.err { color: #f85149; }

.te-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }

/* ===== 终端画面错误态（12 类） ===== */
.screen-err-title { font-size: 13px; color: #c9d1d9; margin-bottom: 4px; }
.screen-err-detail { font-size: 11.5px; color: #8b949e; margin-bottom: 6px; }
.screen-err-code { font-size: 10.5px; margin-bottom: 10px; letter-spacing: .3px; }
.screen-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
