/* ============================================================
   DDNT 主控面板 · 宝塔式布局 × ddnt.com 主题色（聚能推品牌）
   布局骨架保留宝塔式（侧栏/顶栏/卡片/表格/弹窗），配色对齐平台：
   品牌蓝 #4E7FFF / 深蓝 #3D63E6 / 品牌渐变 #4E7FFF→#9D6BFF
   浅色侧栏（平台 .sidebar 同款：白底 + active 浅蓝底加粗）
   状态语义色：ok #16a34a / warn #d97706 / err #dc2626
   作用域 .bt-scope / .bt-app / .bt-mask：面板固定浅色，不随平台暗色主题
   ============================================================ */

.bt-scope,
.bt-app,
.bt-mask {
  --bt-brand: #4E7FFF;
  --bt-brand-d: #3D63E6;
  --bt-brand-soft: #EEF2FF;
  --bt-grad: linear-gradient(135deg, #4E7FFF 0%, #9D6BFF 100%);
  --bt-purple: #9D6BFF;
  --bt-purple-bg: #f3efff;
  --bt-orange: #d97706;
  --bt-orange-bg: #fdf6ec;
  --bt-red: #dc2626;
  --bt-red-d: #dc2626;
  --bt-red-bg: #fef0f0;
  --bt-blue: #4E7FFF;
  --bt-blue-bg: #EEF2FF;
  --bt-success: #16a34a;
  --bt-success-bg: #e7f6ec;
  --bt-side: #ffffff;
  --bt-side-active: #EEF2FF;
  --bt-page: #f7f7f8;
  --bt-card: #ffffff;
  --bt-border: #ececee;
  --bt-border-light: #f0f0f0;
  --bt-text: #1f2329;
  --bt-text-2: #565b64;
  --bt-text-3: #8a8f99;
  --bt-th-bg: #f7f8fa;
  --bt-input-border: #dcdfe6;
  font-family: "PingFang SC", "HarmonyOS_Medium", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: var(--bt-text);
}
.bt-scope * { box-sizing: border-box; }

/* ---------------- 全屏面板骨架 ---------------- */
.bt-app {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; background: var(--bt-page);
  font-family: "PingFang SC", "HarmonyOS_Medium", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 14px; color: var(--bt-text);
}
.bt-app.hidden { display: none; }

/* 左侧浅色侧栏（平台 .sidebar 同款风格） */
.bt-side { width: 180px; flex: none; background: var(--bt-side); border-right: 1px solid var(--bt-border); display: flex; flex-direction: column; }
.bt-side-logo { height: 54px; display: flex; align-items: center; gap: 9px; padding: 0 14px; border-bottom: 1px solid var(--bt-border-light); }
.bt-side-logo .lg { width: 26px; height: 26px; border-radius: 7px; background: var(--bt-grad); color: #fff; font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.bt-side-logo .tt { color: #23272f; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt-side-srv { padding: 10px 14px; border-bottom: 1px solid var(--bt-border-light); font-size: 12.5px; color: var(--bt-text-3); }
.bt-side-srv .nm { font-size: 13px; font-weight: 600; color: var(--bt-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt-side-srv .st { display: flex; align-items: center; gap: 5px; margin-top: 4px; color: var(--bt-text-3); }
.bt-side-srv .st i { width: 7px; height: 7px; border-radius: 50%; background: #c0c4cc; flex: none; }
.bt-side-srv .st.on i { background: var(--bt-success); box-shadow: 0 0 6px rgba(22, 163, 74, .55); }
.bt-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.bt-nav::-webkit-scrollbar { width: 4px; }
.bt-nav::-webkit-scrollbar-thumb { background: #e3e5ec; border-radius: 2px; }
.bt-nav-item { height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 14px 0 15px; color: var(--bt-text-2); font-size: 14px; cursor: pointer; border-left: 3px solid transparent; user-select: none; white-space: nowrap; transition: background .12s, color .12s; }
.bt-nav-item svg { width: 16px; height: 16px; flex: none; color: #7a8194; }
.bt-nav-item:hover { background: #f3f3f5; color: var(--bt-text); }
.bt-nav-item:hover svg { color: var(--bt-text-2); }
.bt-nav-item.active { background: var(--bt-side-active); border-left-color: var(--bt-brand); color: var(--bt-text); font-weight: 600; }
.bt-nav-item.active svg { color: var(--bt-brand); }
.bt-side-foot { padding: 10px 16px; font-size: 11.5px; color: #b5b8bf; border-top: 1px solid var(--bt-border-light); }

/* 右侧主区 */
.bt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bt-head { height: 54px; flex: none; background: #fff; border-bottom: 1px solid var(--bt-border); display: flex; align-items: center; gap: 12px; padding: 0 20px; }
.bt-crumb { font-size: 15px; font-weight: 600; color: var(--bt-text); white-space: nowrap; }
.bt-crumb .sep { color: #c0c4cc; font-weight: 400; margin: 0 8px; }
.bt-crumb .sub { font-size: 12.5px; font-weight: 400; color: var(--bt-text-3); }
.bt-head .grow, .bt-toolbar .grow { flex: 1; }
.bt-head-btn { width: 32px; height: 32px; border: 1px solid var(--bt-input-border); border-radius: 4px; background: #fff; color: var(--bt-text-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.bt-head-btn:hover { color: var(--bt-brand); border-color: var(--bt-brand); }
.bt-head-btn svg { width: 15px; height: 15px; }
.bt-head-srv { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--bt-text-2); }
.bt-body { flex: 1; overflow: auto; padding: 16px 20px 26px; }
.bt-page.hidden { display: none; }

/* ---------------- 卡片 / 统计卡 ---------------- */
.bt-card { background: var(--bt-card); border: 1px solid #ececee; border-radius: 4px; padding: 16px 20px; margin-bottom: 16px; }
.bt-card-title { font-size: 15px; font-weight: 600; color: var(--bt-text); margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.bt-card-title .bar { width: 3px; height: 14px; background: var(--bt-grad); border-radius: 2px; flex: none; }
.bt-card-title .more { margin-left: auto; font-size: 12.5px; font-weight: 400; color: var(--bt-text-3); }
.bt-flush { border-top-left-radius: 0; border-top-right-radius: 0; margin-top: -1px; }
.bt-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.bt-stat { background: #fff; border: 1px solid #ececee; border-radius: 4px; padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.bt-stat .ic { width: 44px; height: 44px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex: none; }
.bt-stat .ic svg { width: 20px; height: 20px; }
.bt-stat .num { font-size: 25px; font-weight: 700; color: var(--bt-text); line-height: 1.15; }
.bt-stat .num small { font-size: 13px; font-weight: 400; color: var(--bt-text-3); margin-left: 2px; }
.bt-stat .lbl { font-size: 13px; color: var(--bt-text-3); margin-top: 2px; }

/* 环形图卡（首页/监控） */
.bt-rings { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.bt-ring-card { background: #fff; border: 1px solid #ececee; border-radius: 4px; padding: 18px 12px 14px; text-align: center; }
.bt-ring-card .cap { font-size: 13px; color: var(--bt-text-2); margin-top: 8px; }
.bt-ring-card .sub { font-size: 12px; color: var(--bt-text-3); margin-top: 2px; }

/* ---------------- 顶部 Tab ---------------- */
.bt-tabs { background: #fff; border: 1px solid #ececee; border-radius: 4px 4px 0 0; display: flex; align-items: center; padding: 0 10px; overflow-x: auto; }
.bt-tab { padding: 13px 18px; font-size: 14px; color: var(--bt-text-2); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; user-select: none; }
.bt-tab:hover { color: var(--bt-brand); }
.bt-tab.active { color: var(--bt-brand); border-bottom-color: var(--bt-brand); font-weight: 500; }
.bt-tabs .right { margin-left: auto; display: flex; align-items: center; gap: 8px; padding-right: 4px; }

/* ---------------- 工具条 ---------------- */
.bt-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bt-note-inline { font-size: 12.5px; color: var(--bt-text-3); }

/* ---------------- 按钮体系 ---------------- */
.bt-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 15px; border-radius: 4px; border: 1px solid var(--bt-input-border); background: #fff; color: var(--bt-text-2); font-size: 13px; cursor: pointer; white-space: nowrap; transition: all .15s; font-family: inherit; }
.bt-btn:hover { color: var(--bt-brand); border-color: rgba(78, 127, 255, .45); background: rgba(78, 127, 255, .04); }
.bt-btn svg { width: 14px; height: 14px; }
.bt-btn.primary { background: var(--bt-brand); border-color: var(--bt-brand); color: #fff; }
.bt-btn.primary:hover { background: var(--bt-brand-d); border-color: var(--bt-brand-d); color: #fff; }
.bt-btn.plain-green { background: var(--bt-brand-soft); border-color: rgba(78, 127, 255, .35); color: var(--bt-brand); }
.bt-btn.danger-plain { color: var(--bt-red); border-color: rgba(220, 38, 38, .45); }
.bt-btn.danger-plain:hover { background: var(--bt-red); border-color: var(--bt-red); color: #fff; }
.bt-btn.small { height: 26px; padding: 0 10px; font-size: 12px; }
.bt-btn:disabled { opacity: .5; cursor: not-allowed; }
.bt-link { color: var(--bt-brand); cursor: pointer; font-size: 13px; text-decoration: none; }
.bt-link:hover { text-decoration: underline; }
.bt-link.red { color: var(--bt-red); }
.bt-link.gray { color: var(--bt-text-3); }
.bt-link-sep { color: #dcdfe6; margin: 0 7px; font-size: 12px; }

/* ---------------- 表格 ---------------- */
.bt-table-box { overflow-x: auto; }
.bt-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.bt-table th { background: var(--bt-th-bg); color: var(--bt-text); font-weight: 600; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--bt-border); white-space: nowrap; }
.bt-table td { padding: 11px 12px; border-bottom: 1px solid var(--bt-border-light); color: var(--bt-text-2); vertical-align: middle; word-break: break-all; }
.bt-table tbody tr:hover { background: #f6f8ff; }
.bt-table .name { color: var(--bt-text); font-weight: 500; }
.bt-table .num-strong { font-weight: 600; }

/* 状态点 */
.bt-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.bt-dot i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.bt-dot.on i { background: var(--bt-success); }
.bt-dot.off i { background: #c0c4cc; }
.bt-dot.run i { background: var(--bt-success); }
.bt-dot.warn i { background: var(--bt-orange); }
.bt-dot.bad i { background: var(--bt-red); }
.bt-tag { display: inline-block; padding: 2px 9px; border-radius: 3px; font-size: 12px; line-height: 18px; }
.bt-tag.green { background: var(--bt-success-bg); color: var(--bt-success); }
.bt-tag.orange { background: var(--bt-orange-bg); color: var(--bt-orange); }
.bt-tag.red { background: var(--bt-red-bg); color: var(--bt-red); }
.bt-tag.gray { background: #f4f4f5; color: var(--bt-text-3); }
.bt-tag.blue { background: var(--bt-blue-bg); color: var(--bt-blue); }

/* ---------------- 提示条 ---------------- */
.bt-alert { display: flex; align-items: flex-start; gap: 9px; padding: 10px 14px; border-radius: 4px; font-size: 13px; line-height: 1.6; margin-bottom: 14px; }
.bt-alert.info { background: #f4f4f5; color: var(--bt-text-2); }
.bt-alert.warn { background: var(--bt-orange-bg); color: var(--bt-orange); }
.bt-alert.danger { background: var(--bt-red-bg); color: var(--bt-red); }
.bt-alert.success { background: var(--bt-success-bg); color: var(--bt-success); }
.bt-alert svg { width: 15px; height: 15px; flex: none; margin-top: 3px; }
.bt-alert a { color: inherit; font-weight: 600; }

/* ---------------- 表单控件 ---------------- */
.bt-input, .bt-select { height: 32px; border: 1px solid var(--bt-input-border); border-radius: 4px; padding: 0 10px; font-size: 13px; color: var(--bt-text); background: #fff; outline: none; font-family: inherit; }
.bt-input:focus, .bt-select:focus, .bt-textarea:focus { border-color: var(--bt-brand); box-shadow: 0 0 0 2px rgba(78, 127, 255, .14); }
.bt-input::placeholder, .bt-textarea::placeholder { color: #c0c4cc; }
.bt-textarea { width: 100%; border: 1px solid var(--bt-input-border); border-radius: 4px; padding: 8px 10px; font-size: 13px; color: var(--bt-text); outline: none; font-family: inherit; line-height: 1.6; }
.bt-search { display: inline-flex; align-items: center; border: 1px solid var(--bt-input-border); border-radius: 4px; overflow: hidden; background: #fff; }
.bt-search .bt-input { border: none; height: 30px; }
.bt-search .go { width: 32px; height: 30px; display: flex; align-items: center; justify-content: center; color: var(--bt-text-3); cursor: pointer; border-left: 1px solid var(--bt-input-border); background: #fff; }
.bt-search .go:hover { color: var(--bt-brand); }
.bt-search svg { width: 14px; height: 14px; }

/* 开关 */
.bt-switch { display: inline-block; width: 40px; height: 20px; border-radius: 10px; background: #dcdfe6; position: relative; cursor: pointer; transition: background .2s; vertical-align: middle; flex: none; }
.bt-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .2s; }
.bt-switch.on { background: var(--bt-brand); }
.bt-switch.on::after { left: 22px; }

/* 分类按钮组（软件商店） */
.bt-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.bt-pill { height: 30px; padding: 0 16px; border-radius: 4px; background: #f5f7f9; color: var(--bt-text-2); font-size: 13px; display: inline-flex; align-items: center; cursor: pointer; user-select: none; white-space: nowrap; }
.bt-pill:hover { color: var(--bt-brand); }
.bt-pill.active { background: var(--bt-brand); color: #fff; }
.bt-pill .cnt { margin-left: 5px; font-size: 11px; opacity: .85; }

/* ---------------- 分页 ---------------- */
.bt-pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 14px; font-size: 13px; color: var(--bt-text-2); flex-wrap: wrap; }
.bt-pager .pg { min-width: 28px; height: 28px; padding: 0 6px; border: 1px solid var(--bt-input-border); border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; background: #fff; color: var(--bt-text-2); }
.bt-pager .pg:hover { color: var(--bt-brand); border-color: var(--bt-brand); }
.bt-pager .pg.active { background: var(--bt-brand); border-color: var(--bt-brand); color: #fff; cursor: default; }
.bt-pager .pg.dis { color: #c0c4cc; cursor: not-allowed; }
.bt-pager select { height: 28px; border: 1px solid var(--bt-input-border); border-radius: 3px; font-size: 12.5px; color: var(--bt-text-2); }

/* ---------------- 弹窗 ---------------- */
.bt-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.bt-modal { background: #fff; border-radius: 6px; width: 560px; max-width: 96vw; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 12px 40px rgba(0, 0, 0, .22); overflow: hidden; }
.bt-modal-h { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--bt-border-light); font-size: 15px; font-weight: 600; color: var(--bt-text); flex: none; }
.bt-modal-x { margin-left: auto; cursor: pointer; color: var(--bt-text-3); font-size: 20px; line-height: 1; font-weight: 300; padding: 0 2px; }
.bt-modal-x:hover { color: var(--bt-red); }
.bt-modal-b { padding: 18px; overflow: auto; }
.bt-modal-f { padding: 12px 18px; border-top: 1px solid var(--bt-border-light); display: flex; justify-content: flex-end; gap: 10px; flex: none; }
.bt-form-row { display: flex; align-items: flex-start; margin-bottom: 14px; }
.bt-form-row > label { width: 96px; flex: none; text-align: right; padding-right: 12px; padding-top: 7px; color: var(--bt-text-2); font-size: 13.5px; }
.bt-form-row > label .req { color: var(--bt-red); margin-right: 2px; }
.bt-form-row .ctl { flex: 1; min-width: 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bt-form-row .ctl .bt-input, .bt-form-row .ctl .bt-select { flex: 1; min-width: 0; }
.bt-form-row .tip { width: 100%; font-size: 12px; color: var(--bt-text-3); margin-top: 4px; line-height: 1.6; }
.bt-cmd-box { width: 100%; font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace; font-size: 12px; line-height: 1.7; padding: 10px 12px; border: 1px solid var(--bt-input-border); border-radius: 4px; background: #f8f9fb; color: #3d4a8c; word-break: break-all; resize: vertical; }

/* 弹窗内小 Tab（添加服务器） */
.bt-modal-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--bt-border-light); margin-bottom: 16px; }
.bt-modal-tab { padding: 9px 16px; font-size: 13.5px; color: var(--bt-text-2); cursor: pointer; border-bottom: 2px solid transparent; user-select: none; }
.bt-modal-tab.active { color: var(--bt-brand); border-bottom-color: var(--bt-brand); font-weight: 500; }

/* ---------------- 空状态 ---------------- */
.bt-empty { text-align: center; padding: 46px 0 40px; color: var(--bt-text-3); font-size: 13px; }
.bt-empty .box { width: 56px; height: 44px; margin: 0 auto 12px; border: 2px solid #dcdfe6; border-radius: 6px; position: relative; opacity: .7; }
.bt-empty .box::before { content: ""; position: absolute; top: -8px; left: 50%; transform: translateX(-50%); width: 26px; height: 8px; border: 2px solid #dcdfe6; border-bottom: none; border-radius: 4px 4px 0 0; background: #fff; }

/* ---------------- 终端 ---------------- */
.bt-term-bar { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #ececee; border-bottom: none; border-radius: 4px 4px 0 0; padding: 7px 12px; }
.bt-term-chip { display: inline-flex; align-items: center; gap: 8px; background: #1f2329; color: #e8e8e8; font-size: 12.5px; border-radius: 4px 4px 0 0; padding: 6px 12px; }
.bt-term-chip .x { cursor: pointer; color: #f56c6c; font-size: 13px; }
.bt-term-box { height: 500px; background: #0c0c0c; border-radius: 0 0 4px 4px; padding: 6px 8px; }
.bt-term-box .xterm .xterm-viewport { background: #0c0c0c !important; }

/* ---------------- 文件管理 ---------------- */
.bt-pathbar { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13.5px; color: var(--bt-text-2); }
.bt-pathbar a { color: var(--bt-brand); text-decoration: none; cursor: pointer; }
.bt-pathbar a:hover { text-decoration: underline; }
.bt-pathbar .p-sep { color: #c0c4cc; margin: 0 2px; }
.bt-pathbar .cur { color: var(--bt-text); font-weight: 500; }
.bt-fico { display: inline-flex; align-items: center; gap: 7px; }
.bt-fico svg { width: 15px; height: 15px; }
.bt-fico.dir svg { color: #d97706; }
.bt-fico.file svg { color: #8a8f99; }

/* ---------------- 日志查看 ---------------- */
.bt-log-pre { background: #1e1e1e; color: #d2d2d2; font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace; font-size: 12px; line-height: 1.65; padding: 12px 14px; border-radius: 4px; max-height: 420px; overflow: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }

/* ---------------- 图表容器 ---------------- */
.bt-chart-card { background: #fff; border: 1px solid #ececee; border-radius: 4px; padding: 14px 18px 10px; }
.bt-chart-card .tt { font-size: 14px; font-weight: 600; color: var(--bt-text); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.bt-chart-card .tt .bar { width: 3px; height: 13px; background: var(--bt-grad); border-radius: 2px; }

/* 键值信息瓦片（设置页） */
.bt-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.bt-kv .it { background: #f8f9fb; border: 1px solid #f0f2f5; border-radius: 4px; padding: 10px 14px; }
.bt-kv .k { font-size: 12px; color: var(--bt-text-3); }
.bt-kv .v { font-size: 13.5px; color: var(--bt-text); font-weight: 500; margin-top: 3px; word-break: break-all; }

/* 列表视图（嵌入页内）专用微调 */
.bt-scope .bt-list-wrap { margin-top: 14px; }
.bt-scope .bt-card { margin-bottom: 16px; }

/* 响应式：窄屏收窄侧栏 */
@media (max-width: 1100px) {
  .bt-side { width: 56px; }
  .bt-side .tt, .bt-side-srv .nm, .bt-side-srv .st span, .bt-side-foot { display: none; }
  .bt-nav-item { justify-content: center; padding: 0; gap: 0; }
  .bt-nav-item span { display: none; }
}
