:root {
  --blue: #2563eb;
  --blue-dark: #1e40af;
  --blue-light: #eff6ff;
  --blue-border: #bfdbfe;
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --green: #16a34a;
  --red: #dc2626;
  --gray: #94a3b8;
  --border: #e2e8f0;
  --radius: 8px;
  --shadow: 0 4px 16px rgba(30, 64, 175, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.hidden { display: none !important; }

/* 登录 —— 粒子星空 + 毛玻璃卡片 */
.login-overlay {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 20% 20%, #101b3f 0%, #050a1f 55%, #02040f 100%);
  overflow: hidden;
}
#starfield { position: absolute; inset: 0; width: 100%; height: 100%; }
.login-card {
  position: relative; z-index: 2;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  padding: 44px 38px; border-radius: 18px;
  width: min(380px, 90vw);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55), 0 0 40px rgba(59, 130, 246, 0.18) inset;
}
.login-logo { font-size: 23px; font-weight: 800; text-align: center; }
.grad-text {
  background: linear-gradient(90deg, #7dd3fc, #a78bfa, #60a5fa);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.login-sub { color: rgba(200, 215, 255, 0.75); text-align: center; margin: 8px 0 28px; font-size: 13px; }
.login-card input {
  width: 100%; padding: 13px 14px; margin-bottom: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 10px; font-size: 14px;
  background: rgba(255, 255, 255, 0.08); color: #eef2ff;
  transition: border-color .25s, box-shadow .25s, background .25s;
}
.login-card input::placeholder { color: rgba(180, 195, 235, 0.55); }
.login-card input:focus {
  outline: none;
  border-color: #60a5fa;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.25), 0 0 22px rgba(96, 165, 250, 0.45);
}
.login-btn-grad {
  background: linear-gradient(90deg, #3b82f6, #8b5cf6) !important;
  border: none !important;
  border-radius: 10px;
  font-size: 15px; font-weight: 700; letter-spacing: 4px;
  transition: filter .25s, transform .15s, box-shadow .25s;
  box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
}
.login-btn-grad:hover { filter: brightness(1.15); box-shadow: 0 8px 30px rgba(99, 102, 241, 0.65); }
.login-btn-grad:active { transform: scale(0.98); }
.login-error { color: #fca5a5; margin-top: 12px; text-align: center; min-height: 18px; font-size: 13px; }

/* 移动端自适应：小屏下卡片占满宽度 */
@media (max-width: 480px) {
  .login-card { padding: 34px 24px; }
}

/* 顶栏 */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; height: 56px; background: #fff; border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 17px; font-weight: 700; color: var(--blue-dark); }
.topbar-meta { display: flex; gap: 8px; }
.stat-pill {
  background: var(--blue-light); color: var(--blue-dark); padding: 3px 10px;
  border-radius: 999px; font-size: 12px;
}
.stat-pill b { font-size: 14px; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }
.topbar-search { display: flex; gap: 6px; margin-left: 20px; flex: 1; max-width: 460px; }
.topbar-search input {
  flex: 1; padding: 7px 12px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px; min-width: 0;
}
.topbar-search input:focus { outline: none; border-color: var(--blue); }
.topbar-filters { display: flex; gap: 6px; }
.topbar-filters select {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; background: #fff; cursor: pointer;
}
.topbar-filters select:focus { outline: none; border-color: var(--blue); }

/* 内容 */
.content { padding: 20px; }
.table-wrap { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: hidden; }
.device-table { width: 100%; border-collapse: collapse; min-width: 0; table-layout: fixed; }
.device-table th, .device-table td {
  padding: 8px 8px; text-align: left; border-bottom: 1px solid var(--border);
  font-size: 13px; vertical-align: top; overflow-wrap: break-word;
}
.device-table th { background: #f8fafc; color: var(--muted); font-weight: 600; white-space: nowrap; }
/* 单元格宽度分配（table-layout fixed 按首行决定） */
.device-table th:nth-child(1), .device-table td:nth-child(1) { width: 13%; }
.device-table th:nth-child(2), .device-table td:nth-child(2) { width: 12%; }
.device-table th:nth-child(3), .device-table td:nth-child(3) { width: 7%; }
.device-table th:nth-child(4), .device-table td:nth-child(4) { width: 7%; }
.device-table th:nth-child(5), .device-table td:nth-child(5) { width: 10%; }
.device-table th:nth-child(6), .device-table td:nth-child(6) { width: 10%; }
.device-table th:nth-child(7), .device-table td:nth-child(7) { width: 12%; }
.device-table th:nth-child(8), .device-table td:nth-child(8) { width: 11%; }
.device-table th:nth-child(9), .device-table td:nth-child(9) { width: 11%; }
.device-table th:nth-child(10), .device-table td:nth-child(10) { width: 17%; }
/* 操作列：上下排列 3 行 × 3 列网格，不产生横向滚动条 */
.device-table td.ops { white-space: normal; }
.device-table td.ops .ops-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
}
.device-table td.ops .btn { width: 100%; padding: 5px 2px; font-size: 12px; }
.device-table tr:hover td { background: #fafcff; }
.device-table tr.offline td { color: var(--gray); background: #fbfbfb; }
.device-table tr.offline .status-dot { background: var(--gray); }

.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.status-dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.status-dot.off { background: var(--gray); }
.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 11px; }
.tag.online { background: #dcfce7; color: #15803d; }
.tag.offline { background: #f1f5f9; color: #64748b; }
.tag.rdp-on { background: #dbeafe; color: #1d4ed8; }
.tag.rdp-off { background: #f1f5f9; color: #94a3b8; }
.tag.replaced { background: #f3e8ff; color: #7e22ce; }

/* 按钮 */
.btn {
  padding: 7px 13px; border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; color: var(--text); cursor: pointer; font-size: 13px; transition: .15s;
}
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); color: #fff; }
.btn-danger { color: var(--red); }
.btn-danger:hover { border-color: var(--red); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--blue-light); }
.btn-block { width: 100%; }
.btn-sm { padding: 4px 9px; font-size: 12px; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: #fff; border-radius: 10px; width: min(920px, 94vw); max-height: 88vh;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal.modal-wide { width: min(1180px, 96vw); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.modal-close { font-size: 15px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.tab { padding: 7px 14px; border: none; background: none; cursor: pointer; color: var(--muted); font-size: 13px; }
.tab.active { color: var(--blue); border-bottom: 2px solid var(--blue); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* 表单 */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue); }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

/* 复选标签：仅文本+复选框本身可点击，缩小误点区域 */
.check {
  display: inline-flex; align-items: center; gap: 6px;
  width: fit-content; cursor: pointer; user-select: none;
  font-size: 13px; color: var(--text); padding: 2px 4px;
}
.check input { width: auto; margin: 0; cursor: pointer; }
.field label.check { display: inline-flex; width: fit-content; margin-bottom: 0; color: var(--text); }

/* 列表/日志 */
.log-box {
  background: #0f172a; color: #cbd5e1; font-family: Consolas, monospace; font-size: 12px;
  padding: 12px; border-radius: 6px; max-height: 320px; overflow-y: auto; white-space: pre-wrap; word-break: break-all;
}
.list { display: flex; flex-direction: column; gap: 6px; }
.list-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 6px;
}
.list-item .grow { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 部署日志分栏 */
.deploy-logs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.deploy-logs .log-col { background: #f8fafc; border: 1px solid var(--border); border-radius: 6px; padding: 8px; }
.deploy-logs .log-title { font-weight: 600; font-size: 12px; color: var(--blue-dark); margin-bottom: 6px; }
.log-box-mini {
  height: 150px; overflow-y: auto; font-size: 11px; line-height: 1.6;
  font-family: Consolas, monospace; white-space: pre-wrap; word-break: break-all;
  color: #334155;
}
/* 磁盘弹窗：目录名完整一行显示（不截断不换行），列表内部可横向滚动 */
#disk-list { overflow-x: auto; }
#disk-list .list-item { min-width: max-content; }
.disk-item-name { white-space: nowrap !important; overflow: visible !important; }
.empty { color: var(--muted); text-align: center; padding: 20px; }
.muted { color: var(--muted); font-size: 12px; }

/* toast */
.toast {
  position: fixed; top: 20px; right: 20px; z-index: 100;
  background: #111827; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}

/* 磁盘弹窗：左侧映射盘分栏 + 主浏览区 */
.disk-wrap { display: flex; gap: 14px; min-height: 420px; }
.disk-side {
  flex: 0 0 220px; border-right: 1px solid var(--border);
  padding-right: 12px; overflow-y: auto;
}
.side-title { font-size: 12px; color: var(--muted); margin: 6px 0; font-weight: 600; }
.side-btn {
  display: block; width: 100%; text-align: left; padding: 7px 10px; margin-bottom: 6px;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
  cursor: pointer; font-size: 13px; word-break: break-all;
}
.side-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-light); }
.disk-main { flex: 1; min-width: 0; }
