/* ============ DGBot 管理后台 · 设计系统 ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f0f2f5;
  --card: #ffffff;
  --line: #eef0f3;
  --line2: #e2e6ee;
  --txt: #1f2329;
  --sub: #5b6476;
  --dim: #8a8f9c;
  --primary: #4e7cff;
  --primary-d: #3a63e0;
  --primary-soft: #eaf1ff;
  --purple: #8a5cf6;
  --ok: #22b07d;
  --ok-soft: #e6f7f0;
  --warn: #f5a623;
  --warn-soft: #fef3e0;
  --err: #e23333;
  --err-soft: #fde8e8;
  --cyan: #22c3b5;
  --sb1: #171b27;
  --sb2: #1e2331;
  --sb3: #1a1f2c;
  --r: 12px;
  --r-sm: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, .05);
  --shadow-md: 0 6px 20px rgba(15, 23, 42, .09);
  --shadow-lg: 0 20px 60px rgba(15, 23, 42, .22);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--txt);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d5d9e3; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #c2c8d6; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 布局 ============ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px; flex: 0 0 220px;
  background: linear-gradient(180deg, var(--sb1), var(--sb2) 55%, var(--sb3));
  color: #9aa3b2; display: flex; flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, .04);
  position: sticky; top: 0; height: 100vh; z-index: 30;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px 20px; border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.brand-logo {
  width: 38px; height: 38px; border-radius: 11px; flex: 0 0 38px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: #fff; font-size: 18px; font-weight: 800;
  box-shadow: 0 4px 14px rgba(78, 124, 255, .4);
}
.sidebar .brand h1 { font-size: 16px; color: #fff; line-height: 1.2; font-weight: 700; }
.sidebar .brand h1 span { color: var(--primary); }
.sidebar .brand small { display: block; font-size: 11px; color: #626b7d; margin-top: 2px; }

.sidebar nav { flex: 1; padding: 12px 12px 8px; display: flex; flex-direction: column; gap: 3px; overflow-y: auto; }
.sidebar nav::-webkit-scrollbar { width: 4px; }
.sidebar nav .nav-label {
  font-size: 11px; color: #5b6476; letter-spacing: .08em;
  padding: 14px 10px 6px; font-weight: 600;
}
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 10px; position: relative;
  color: #9aa3b2; font-size: 13.5px; font-weight: 500;
  transition: background .18s, color .18s, transform .05s;
  cursor: pointer; user-select: none;
}
.sidebar nav a svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: .9; }
.sidebar nav a:hover { color: #eef1f7; background: rgba(255, 255, 255, .055); }
.sidebar nav a:active { transform: scale(.985); }
.sidebar nav a.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(78, 124, 255, .25), rgba(138, 92, 246, .15));
  box-shadow: inset 0 0 0 1px rgba(78, 124, 255, .18);
}
.sidebar nav a.active::before {
  content: ""; position: absolute; left: -12px; top: 22%; bottom: 22%; width: 3px;
  border-radius: 3px; background: linear-gradient(180deg, var(--primary), var(--purple));
}
.sidebar nav a.active svg { color: #7ea0ff; opacity: 1; }
.sidebar nav a .tag-new {
  margin-left: auto; font-size: 10px; padding: 1px 6px; border-radius: 6px;
  background: rgba(78, 124, 255, .22); color: #9fbaff; font-weight: 600;
}

.sidebar .sb-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .06); }
.sidebar .sb-user { display: flex; align-items: center; gap: 10px; padding: 2px 6px 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: 0 0 34px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--purple));
  color: #fff; font-size: 14px; font-weight: 700;
  box-shadow: 0 3px 10px rgba(78, 124, 255, .35);
}
.sb-user .uname { font-size: 13px; color: #d6dbe6; font-weight: 600; }
.sb-user .usub { font-size: 11px; color: #626b7d; display: flex; align-items: center; gap: 5px; }
.sb-user .usub .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ok); }
.sb-foot .logout {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(255, 77, 79, .09); border: 1px solid rgba(255, 77, 79, .22);
  color: #ff7875; padding: 8px; border-radius: 10px; cursor: pointer; font-size: 13px;
  transition: background .18s, color .18s;
}
.sb-foot .logout:hover { background: rgba(255, 77, 79, .18); color: #ff9492; }
.sb-foot .logout svg { width: 15px; height: 15px; }

/* ============ 主区 ============ */
.main { flex: 1; padding: 20px 26px 40px; overflow-x: auto; min-width: 0; }
.main-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.main-head h2 { font-size: 20px; font-weight: 700; letter-spacing: .2px; }
.main-head .crumb { font-size: 12.5px; color: var(--dim); }
.main-head .spacer { flex: 1; }
.role-switch {
  display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line2);
  border-radius: 999px; padding: 3px; box-shadow: var(--shadow);
}
.role-switch button {
  border: 0; background: transparent; font-size: 12.5px; padding: 5px 12px; border-radius: 999px;
  cursor: pointer; color: var(--sub); font-weight: 500; transition: all .18s;
}
.role-switch button.on { background: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(78, 124, 255, .35); }

.page { display: none; animation: fadeUp .28s ease both; }
.page.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ============ 卡片 / 面板 ============ */
.panel {
  background: var(--card); border-radius: var(--r); padding: 18px;
  box-shadow: var(--shadow); margin-bottom: 18px;
}
.panel-hd { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-hd h3 { font-size: 15px; font-weight: 600; }
.panel-hd .sub { font-size: 12px; color: var(--dim); }
.panel-hd .spacer { flex: 1; }

.sec-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: #2c3444; margin: 4px 0 12px;
}
.sec-title .dot { width: 9px; height: 9px; border-radius: 50%; }
.dot.blue { background: var(--primary); }
.dot.green { background: var(--ok); }
.dot.purple { background: var(--purple); }
.dot.orange { background: var(--warn); }
.dot.cyan { background: var(--cyan); }
.dot.red { background: var(--err); }
.sec-title .hint { font-size: 12px; color: var(--dim); font-weight: 400; }

/* 统计卡 */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; margin-bottom: 20px; }
#kpi-core, #m-stats, #xy-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat {
  background: var(--card); border-radius: var(--r); padding: 15px 16px;
  box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
  position: relative; overflow: hidden;
}
.stat::after {
  content: ""; position: absolute; right: -18px; top: -18px; width: 62px; height: 62px;
  border-radius: 50%; background: currentColor; opacity: .06;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat .num { font-size: 25px; font-weight: 700; line-height: 1.25; }
.stat .lbl { font-size: 12.5px; color: var(--dim); margin-top: 3px; }
.stat .trend { font-size: 11.5px; font-weight: 600; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.stat.blue { color: var(--primary); }
.stat.green { color: var(--ok); }
.stat.orange { color: var(--warn); }
.stat.red { color: var(--err); }
.stat.purple { color: var(--purple); }
.stat.gray { color: var(--dim); }
.stat.cyan { color: var(--cyan); }
.stat .num, .stat .lbl, .stat .trend { position: relative; z-index: 1; }
.stat .lbl { color: var(--dim); }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--r-sm); cursor: pointer;
  font-size: 13.5px; font-family: inherit; padding: 8px 14px;
  transition: background .16s, border-color .16s, color .16s, opacity .16s;
  background: var(--primary); color: #fff; white-space: nowrap;
}
.btn:hover { background: var(--primary-d); }
.btn:active { opacity: .85; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--txt); border-color: var(--line2); }
.btn.ghost:hover { border-color: #c8d0e0; background: #fafbfe; }
.btn.soft { background: var(--primary-soft); color: var(--primary); }
.btn.soft:hover { background: #dfe9ff; }
.btn.danger { background: #fff; color: var(--err); border-color: #f3b9b9; }
.btn.danger:hover { background: var(--err-soft); }
.btn.gray { background: #f2f4f8; color: var(--sub); }
.btn.gray:hover { background: #e9ecf3; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn.lg { padding: 10px 20px; font-size: 14px; }
.btn .ico { width: 15px; height: 15px; }

/* ============ 表单 ============ */
input, select, textarea { font-family: inherit; }
.toolbar { display: flex; gap: 9px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.field {
  padding: 8px 11px; border: 1px solid var(--line2); border-radius: var(--r-sm);
  font-size: 13.5px; outline: none; background: #fff; color: var(--txt);
  transition: border-color .16s, box-shadow .16s;
}
.field:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(78, 124, 255, .12); }
/* 表单网格里的控件一律撑满所在列, 否则 input 和 select 宽度各异, 右边参差不齐 */
.form-grid .field { width: 100%; box-sizing: border-box; }
.field.w-sm { width: 130px; }
.field.w-md { width: 190px; }
.field.w-lg { width: 280px; }
select.field { cursor: pointer; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label, .flabel {
  display: block; font-size: 12.5px; color: var(--sub); margin-bottom: 6px; font-weight: 500;
}
.form-grid .hint { font-size: 11.5px; color: var(--dim); margin-top: 4px; line-height: 1.6; }

/* ============ 表格 ============ */
.table-scroll { overflow-x: auto; border-radius: var(--r-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f2f4f8; vertical-align: middle; }
th { color: var(--dim); font-weight: 600; white-space: nowrap; background: #fafbfd; font-size: 12.5px; }
th:first-child { border-top-left-radius: 8px; }
th:last-child { border-top-right-radius: 8px; }
tbody tr:hover td { background: #fafbfe; }
tbody tr:last-child td { border-bottom: 0; }
td.mono, .mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12.5px; }
.cell-ellipsis { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-trunc { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }

/* 徽章 */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  white-space: nowrap;
}
.badge.ok, .badge.active { background: var(--ok-soft); color: var(--ok); }
.badge.ban, .badge.fail, .badge.banned { background: var(--err-soft); color: var(--err); }
.badge.exp, .badge.expired, .badge.warn, .badge.pending { background: var(--warn-soft); color: #c47c0a; }
.badge.blue, .badge.draft { background: var(--primary-soft); color: var(--primary); }
.badge.purple, .badge.exhausted { background: #f1ebff; color: var(--purple); }
.badge.gray, .badge.disabled, .badge.timeout { background: #eef0f3; color: var(--dim); }
.badge .d { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

.pager { display: flex; gap: 8px; align-items: center; margin-top: 14px; font-size: 13px; color: var(--dim); }
.pager .spacer { flex: 1; }
.pager button {
  padding: 5px 12px; background: #fff; border: 1px solid var(--line2); color: var(--sub);
  border-radius: 6px; cursor: pointer; font-size: 12.5px;
}
.pager button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.pager button:disabled { opacity: .45; cursor: not-allowed; }

.empty { text-align: center; color: var(--dim); font-size: 13px; padding: 44px 20px; }
.empty svg { width: 40px; height: 40px; opacity: .35; margin-bottom: 10px; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(2px); display: none; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
}
.modal-mask.on { display: flex; }
.modal {
  background: #fff; border-radius: 16px; width: 560px; max-width: 100%;
  max-height: calc(100vh - 60px); display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: popIn .22s cubic-bezier(.2, .9, .3, 1.2) both;
}
@keyframes popIn { from { opacity: 0; transform: scale(.96) translateY(8px); } to { opacity: 1; transform: none; } }
.modal.lg { width: 780px; }
.modal.xl { width: 980px; }
.modal-hd {
  padding: 18px 22px 14px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.modal-hd h3 { font-size: 16px; font-weight: 600; }
.modal-hd .sub { font-size: 12px; color: var(--dim); margin-top: 2px; }
.modal-hd .x {
  margin-left: auto; width: 30px; height: 30px; border-radius: 8px; border: 0;
  background: #f2f4f8; color: var(--dim); cursor: pointer; font-size: 17px; line-height: 1;
}
.modal-hd .x:hover { background: #e9ecf3; color: var(--txt); }
.modal-bd { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-ft { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

.toast {
  position: fixed; left: 50%; top: 24px; transform: translate(-50%, -20px);
  background: #1f2634; color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 13.5px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 999;
  max-width: 80vw; text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #c0392b; }
.toast.ok { background: #17876a; }

/* ============ 图表 ============ */
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chart-card { background: var(--card); border-radius: var(--r); padding: 16px 16px 8px; box-shadow: var(--shadow); }
.chart-card.wide { grid-column: 1 / -1; }
.chart-title { font-size: 13px; font-weight: 600; color: var(--sub); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.chart-title .spacer { flex: 1; }
.chart-box svg { width: 100%; height: 250px; display: block; }
.legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--dim); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 3px; }

/* 横向分布条 */
.dist-row { display: grid; grid-template-columns: 84px 1fr 108px; gap: 10px; align-items: center; margin-bottom: 10px; }
.dist-row .lb { font-size: 12.5px; color: var(--sub); display: flex; align-items: center; gap: 6px; }
.dist-row .lb i { width: 8px; height: 8px; border-radius: 3px; flex: 0 0 8px; }
.dist-row .track { height: 20px; background: #f3f5fa; border-radius: 6px; overflow: hidden; }
.dist-row .track i { display: block; height: 100%; border-radius: 6px; transition: width .6s ease; min-width: 2px; }
.dist-row .vl { font-size: 12px; color: var(--dim); text-align: right; white-space: nowrap; }
.dist-row .vl b { font-size: 13.5px; color: var(--txt); margin-right: 3px; }

/* ============ 技能管理专用 ============ */
/* 机型卡片 */
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 13px; }
.model-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 15px; transition: border-color .16s, box-shadow .16s, transform .16s;
  position: relative;
}
.model-card:hover { border-color: #cfd9f0; box-shadow: var(--shadow-md); transform: translateY(-1px); }
.model-card .mc-hd { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.model-card .mc-ico {
  width: 36px; height: 36px; border-radius: 10px; flex: 0 0 36px;
  background: linear-gradient(135deg, #eef3ff, #e8edff); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.model-card .mc-name { font-size: 14px; font-weight: 600; line-height: 1.3; }
.model-card .mc-code { font-size: 11.5px; color: var(--dim); font-family: Consolas, monospace; }
.model-card .mc-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip {
  font-size: 11px; padding: 2px 7px; border-radius: 6px; background: #f4f6fa; color: var(--sub);
  border: 1px solid var(--line);
}
.model-card .mc-foot { display: flex; align-items: center; gap: 6px; border-top: 1px dashed var(--line); padding-top: 10px; }
.model-card .mc-foot .n { font-size: 11.5px; color: var(--dim); }
.model-card .mc-foot .spacer { flex: 1; }

/* 坐标库：左右分栏 */
.coord-wrap { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.coord-list { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.coord-list .cl-hd { padding: 13px 14px; font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--line); display: flex; align-items: center; }
.coord-list .cl-hd .spacer { flex: 1; }
.coord-item { padding: 11px 14px; border-bottom: 1px solid #f6f7fb; cursor: pointer; transition: background .14s; }
.coord-item:hover { background: #f8faff; }
.coord-item.on { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.coord-item .ci-t { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.coord-item .ci-s { font-size: 11.5px; color: var(--dim); margin-top: 3px; display: flex; gap: 8px; }

.coord-main { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); min-height: 420px; }
.coord-main .cm-hd {
  padding: 15px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.coord-main .cm-hd .t { font-size: 15px; font-weight: 600; }
.coord-main .cm-hd .spacer { flex: 1; }
.coord-main .cm-bd { padding: 16px 18px 20px; }

/* 步骤编辑器 */
.step-row {
  display: grid; grid-template-columns: 34px 1fr 88px 88px 78px 30px;
  gap: 8px; align-items: center; margin-bottom: 8px;
}
.step-row .idx {
  width: 26px; height: 26px; border-radius: 8px; background: #eef3ff; color: var(--primary);
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.step-row input { padding: 7px 9px; font-size: 12.5px; border: 1px solid var(--line2); border-radius: 7px; outline: none; width: 100%; }
.step-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(78, 124, 255, .1); }
.step-row .del {
  width: 26px; height: 26px; border: 1px solid #f3b9b9; background: #fff; color: var(--err);
  border-radius: 7px; cursor: pointer; font-size: 14px; line-height: 1;
}
.step-row .del:hover { background: var(--err-soft); }
.steps-empty { padding: 30px; text-align: center; color: var(--dim); font-size: 13px; border: 1px dashed var(--line2); border-radius: 10px; }

/* 下发目标选择 */
.target-list { border: 1px solid var(--line2); border-radius: 10px; max-height: 300px; overflow-y: auto; }
.target-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 13px;
  border-bottom: 1px solid #f6f7fb; cursor: pointer; font-size: 13px;
}
.target-item:last-child { border-bottom: 0; }
.target-item:hover { background: #fafbff; }
.target-item input { accent-color: var(--primary); width: 15px; height: 15px; }
.target-item .ti-sub { font-size: 11.5px; color: var(--dim); }
.target-item .ti-spacer { flex: 1; }

.push-flow { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); flex-wrap: wrap; }
.push-flow .p {
  padding: 5px 11px; border-radius: 8px; background: #f4f6fa; border: 1px solid var(--line);
  color: var(--sub); font-weight: 500;
}
.push-flow .p.on { background: var(--primary-soft); border-color: #cddcff; color: var(--primary); }
.push-flow .ar { color: #c8d0e0; }

/* 代码块 */
.code-box {
  background: #0f1117; color: #a8b3c0; padding: 12px 14px; border-radius: 10px;
  font-family: Consolas, monospace; font-size: 12px; line-height: 1.65;
  white-space: pre-wrap; word-break: break-all; max-height: 220px; overflow-y: auto;
}

/* 空状态图标 */
.icon-empty { opacity: .3; }

/* 响应式 */
@media (max-width: 1180px) {
  .coord-wrap { grid-template-columns: 240px 1fr; }
}
@media (max-width: 980px) {
  .chart-grid { grid-template-columns: 1fr; }
  .coord-wrap { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .main { padding: 16px 16px 40px; }
}
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; flex: none; height: auto; position: relative;
    flex-direction: row; align-items: center; padding: 0 8px;
  }
  .sidebar .brand { padding: 12px 8px; border-bottom: 0; border-right: 1px solid rgba(255,255,255,.06); }
  .sidebar .brand small { display: none; }
  .sidebar nav {
    flex-direction: row; overflow-x: auto; padding: 8px; gap: 4px;
  }
  .sidebar nav .nav-label { display: none; }
  .sidebar nav a { white-space: nowrap; padding: 8px 12px; font-size: 12.5px; }
  .sidebar nav a.active::before { display: none; }
  .sidebar .sb-foot { border-top: 0; padding: 8px; }
  .sidebar .sb-user { display: none; }
  .step-row { grid-template-columns: 30px 1fr 70px 70px 30px; }
  .step-row .wait-inp { display: none; }
  .dist-row { grid-template-columns: 70px 1fr 92px; }
  #kpi-core, #m-stats, #xy-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .table-scroll table { min-width: 620px; }
  #p-stats { grid-template-columns: 1fr 1fr !important; }
}

/* ---------- 登录遮罩 ---------- */
.login-mask {
  position: fixed; inset: 0; z-index: 3000; display: none;
  align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 50% -10%, #e8efff, transparent), #f2f5fa;
}
.login-mask.on { display: flex; }
.login-box {
  width: 372px; max-width: calc(100vw - 32px);
  background: #fff; border-radius: 16px; padding: 30px 28px 24px;
  box-shadow: 0 18px 50px rgba(28, 42, 74, .14);
}
.login-box .lg-logo {
  width: 42px; height: 42px; border-radius: 12px; margin-bottom: 14px;
  background: linear-gradient(135deg, #4e7cff, #7a5cf6); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700;
}
.login-box h2 { font-size: 19px; margin-bottom: 6px; }
.login-box p { font-size: 12.5px; color: var(--dim); line-height: 1.75; margin-bottom: 20px; }
.login-box .field { width: 100%; margin-bottom: 12px; }
.login-box .btn { width: 100%; justify-content: center; }
.login-err { color: var(--err); font-size: 12.5px; min-height: 17px; margin-top: 9px; }

/* ============ 设备管理（会员账号 + 已绑定设备） ============ */
.dg-pick { display: flex; align-items: center; gap: 10px; }
.dg-pick label { font-size: 13px; color: var(--sub); white-space: nowrap; }
/* 原版的"新增账号"是独占一行、拉满宽度的蓝色主按钮, 这里照做 */
.btn.block { flex: 1 0 100%; width: 100%; padding: 10px; font-size: 14.5px; }
.dg-info {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px 18px; margin-top: 4px;
}
.dg-info .it {
  background: #f7f8fa; border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 14px; min-width: 0;
}
.dg-info .lb { font-size: 12px; color: var(--dim); margin-bottom: 4px; }
.dg-info .vl { font-size: 14px; font-weight: 600; color: var(--txt); word-break: break-all; }
.dg-remark {
  width: 100%; min-width: 108px; padding: 5px 8px;
  border: 1px solid var(--line2); border-radius: 6px;
  font-size: 12.5px; font-family: inherit; color: var(--txt); background: #fff;
}
.dg-remark:focus { border-color: var(--primary); outline: none; }
.dg-remark::placeholder { color: #b6bdcb; }

/* 已绑定设备表: 10 列, 窄屏时宁可横向滚动也不许文字断行 —— 否则
   "2026-11-04 10:29:33" 会被折成两行, 整张表看起来是歪的 */
#dg-dev-table table { min-width: 1020px; }
#dg-dev-table th, #dg-dev-table td { white-space: nowrap; }
#dg-dev-table td:first-child { white-space: normal; min-width: 132px; }
#dg-dev-table td:last-child { white-space: nowrap; }
#dg-dev-table .dg-remark { min-width: 124px; }
/* 机器人表同理: 11 列 + 四个操作按钮, 必须给足最小宽度 */
#b-list table { min-width: 1080px; }
#b-list th, #b-list td { white-space: nowrap; }
