*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  background: #070b14;
  color: #e6edf9;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: #4f8cff; text-decoration: none; }
h1, h2, h3 { margin: 0 0 8px; font-weight: 600; }

/* ============ 登录页 ============ */
.login-page {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(900px 600px at 20% 10%, rgba(56, 96, 255, 0.18), transparent 60%),
    radial-gradient(800px 500px at 85% 85%, rgba(0, 210, 255, 0.12), transparent 60%),
    #070b14;
}
.login-page .orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}
.login-page .orb-1 { width: 520px; height: 520px; background: #1b3bff; top: -180px; left: -140px; }
.login-page .orb-2 { width: 460px; height: 460px; background: #00d2ff; bottom: -180px; right: -120px; }
.login-page .orb-3 { width: 380px; height: 380px; background: #7a2bff; top: 40%; left: 55%; opacity: 0.35; }
.login-page .grid-overlay {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 170, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 170, 255, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 45%, #000 35%, transparent 78%);
}
#particles-canvas, .login-page canvas {
  position: absolute; inset: 0; width: 100% !important; height: 100% !important;
  z-index: 1; pointer-events: none; opacity: 0.55;
}
.login-wrap {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 400px;
  padding: 24px;
  text-align: center;
}
.login-header { margin-bottom: 18px; }
.login-header img, .login-logo-img {
  display: inline-block;
  filter: drop-shadow(0 8px 24px rgba(30, 90, 255, 0.45));
}
.login-header h1 {
  font-size: 22px;
  letter-spacing: 1px;
  margin: 6px 0 2px;
  background: linear-gradient(90deg, #7fb6ff, #c9e3ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.login-header p { margin: 0; font-size: 12px; color: #7d8fb3; letter-spacing: 2px; text-transform: uppercase; }

.login-card {
  position: relative;
  padding: 26px 24px 22px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(19, 27, 46, 0.94), rgba(11, 16, 29, 0.96));
  border: 1px solid rgba(88, 132, 255, 0.22);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(10px);
  text-align: left;
}
.login-card .corner {
  position: absolute; width: 14px; height: 14px; border: 2px solid rgba(90, 150, 255, 0.65);
}
.login-card .corner.tl { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; }
.login-card .corner.tr { top: -1px; right: -1px; border-left: 0; border-bottom: 0; border-radius: 0 6px 0 0; }
.login-card .corner.bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; border-radius: 0 0 0 6px; }
.login-card .corner.br { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-radius: 0 0 6px 0; }
.login-card .welcome {
  font-size: 12px; color: #8fa6c8; letter-spacing: 1px; margin-bottom: 16px; text-align: center;
}
.login-card .welcome b { color: #4f8cff; }
.login-card label {
  display: block; margin-bottom: 14px; font-size: 12px; color: #90a4c4; letter-spacing: 0.5px;
}
.login-card input {
  width: 100%; margin-top: 6px; padding: 11px 13px;
  background: rgba(9, 14, 25, 0.9);
  border: 1px solid rgba(90, 130, 200, 0.3);
  border-radius: 10px;
  color: #e6edf9; font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-card input::placeholder { color: #55688c; }
.login-card input:focus {
  border-color: #4f8cff;
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.16);
}
.login-card button, .login-card button[type="submit"] {
  width: 100%; margin-top: 6px; padding: 12px 16px;
  border: 0; border-radius: 10px; cursor: pointer;
  font-size: 15px; font-weight: 600; letter-spacing: 1px; color: #fff;
  background: linear-gradient(90deg, #2f6bff, #4f8cff 55%, #22c3ff);
  box-shadow: 0 10px 24px rgba(46, 108, 255, 0.35);
  transition: transform .12s, box-shadow .15s, filter .15s;
}
.login-card button:hover { filter: brightness(1.06); box-shadow: 0 14px 28px rgba(46, 108, 255, 0.45); }
.login-card button:active { transform: translateY(1px); }

/* ============ 通用控件 ============ */
input, select, textarea {
  font-family: inherit; color: #e6edf9;
  background: rgba(10, 16, 28, 0.9);
  border: 1px solid rgba(90, 130, 200, 0.28);
  border-radius: 8px; padding: 8px 10px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #4f8cff; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; border-bottom: 1px solid rgba(90, 130, 200, 0.16); text-align: left; }
th { color: #8fa6c8; font-weight: 500; font-size: 12px; letter-spacing: .5px; }
tr:hover td { background: rgba(79, 140, 255, 0.06); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(120, 160, 230, 0.28); border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 后台骨架 ============ */
.dashboard-root { height: 100vh; display: flex; flex-direction: column; overflow: hidden; background: #070b14; }
.dashboard-topbar {
  height: 44px; flex: 0 0 44px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; background: #080d18; border-bottom: 1px solid rgba(90, 130, 200, 0.16);
  font-size: 12px; color: #8fa6c8;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.topbar-brand-dot { width: 8px; height: 8px; border-radius: 50%; background: #2ee6a8; box-shadow: 0 0 10px rgba(46, 230, 168, 0.8); }
.topbar-user { color: #e6edf9; font-weight: 600; }
.topbar-sep { width: 1px; height: 14px; background: rgba(120, 160, 230, 0.2); }
.topbar-muted { color: #61708d; }
.topbar-clock { color: #cfe0ff; font-variant-numeric: tabular-nums; }
.topbar-tz { background: #0d1424; border: 1px solid rgba(90, 130, 200, 0.28); color: #cfe0ff; padding: 3px 8px; border-radius: 7px; font-size: 12px; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; }
.status-dot.online { background: #2ee6a8; }
.theme-toggle { display: inline-flex; align-items: center; cursor: pointer; }
.theme-track { width: 38px; height: 20px; border-radius: 10px; background: rgba(90, 130, 200, 0.25); position: relative; display: inline-block; }
.theme-thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #cfe0ff; transition: left .18s; }
.theme-toggle.on .theme-thumb { left: 20px; background: #ffd166; }

.rc-shell { flex: 1; display: flex; min-height: 0; }
.rc-sidebar {
  width: 208px; flex: 0 0 208px; background: #080d18; border-right: 1px solid rgba(90, 130, 200, 0.16);
  display: flex; flex-direction: column; gap: 4px; padding: 12px 10px 18px; overflow-y: auto;
}
.rc-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; border-bottom: 1px solid rgba(90, 130, 200, 0.14); margin-bottom: 8px; }
.rc-logo {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2f6bff, #22c3ff); color: #fff; font-weight: 700; font-size: 13px;
  box-shadow: 0 6px 16px rgba(46, 108, 255, 0.35);
}
.rc-sub { font-size: 11px; color: #6f84a8; letter-spacing: .5px; }
.rc-sidebar button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 9px;
  background: transparent; border: 1px solid transparent; color: #9fb2d0; font-size: 13px; cursor: pointer;
  text-align: left; white-space: nowrap; transition: background .15s, color .15s;
}
.rc-sidebar button:hover { background: rgba(79, 140, 255, 0.08); color: #dbe8ff; }
.rc-sidebar button.on {
  background: linear-gradient(90deg, rgba(47, 107, 255, 0.24), rgba(34, 195, 255, 0.08));
  border-color: rgba(90, 150, 255, 0.35); color: #fff;
}
.nav-svg { width: 16px; height: 16px; flex: 0 0 16px; border-radius: 5px; background: currentColor; opacity: .5; }
.nav-svg-blue { background: #4f8cff; } .nav-svg-violet { background: #9a7bff; } .nav-svg-slate { background: #7f93b3; }
.nav-svg-rose { background: #ff6b9d; } .nav-svg-cyan { background: #22c3ff; } .nav-svg-amber { background: #ffb020; }
.nav-svg-green { background: #2ee6a8; } .nav-svg-indigo { background: #6b7bff; } .nav-svg-red { background: #ff5d5d; }
.rc-sidebar button.on .nav-svg { opacity: 1; }

.rc-main { flex: 1; min-width: 0; overflow-y: auto; padding: 16px 18px 26px; }

/* 统计卡 */
.rc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 12px; margin-bottom: 16px; }
.s-card {
  padding: 12px 14px; border-radius: 12px;
  background: linear-gradient(180deg, #0e1626, #0b1220);
  border: 1px solid rgba(90, 130, 200, 0.18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.s-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.s-title { font-size: 12px; color: #8fa6c8; }
.s-val { font-size: 24px; font-weight: 700; color: #e6edf9; line-height: 1.2; }
.s-ico { width: 18px; height: 18px; border-radius: 6px; display: inline-block; background: rgba(79, 140, 255, 0.18); }
.status-mark.red { background: rgba(255, 93, 93, 0.22); }
.status-mark.green { background: rgba(46, 230, 168, 0.22); }
.status-mark.gray { background: rgba(127, 147, 179, 0.22); }
.status-mark.indigo { background: rgba(107, 123, 255, 0.22); }
.status-mark.orange { background: rgba(255, 176, 32, 0.22); }
.status-mark.violet { background: rgba(154, 123, 255, 0.22); }

/* 工具条 */
.rc-topbar.rc-device-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px;
}
.rc-top-left, .rc-top-right { display: flex; align-items: center; gap: 10px; }
.rc-search input { width: 300px; }
.view-toggle { display: flex; gap: 4px; }
.v-btn {
  padding: 6px 10px; border-radius: 8px; border: 1px solid rgba(90, 130, 200, 0.25);
  background: transparent; color: #9fb2d0; cursor: pointer; font-size: 12px;
}
.v-btn.on { background: rgba(79, 140, 255, 0.16); border-color: rgba(90, 150, 255, 0.42); color: #fff; }
.rc-btn {
  padding: 7px 13px; border-radius: 8px; cursor: pointer; font-size: 12px;
  border: 1px solid rgba(90, 130, 200, 0.3); background: rgba(79, 140, 255, 0.12); color: #cfe0ff;
}
.rc-btn:hover { background: rgba(79, 140, 255, 0.2); }

/* 设备卡 */
.device-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.device-card {
  border-radius: 12px; padding: 12px 14px; background: linear-gradient(180deg, #0d1524, #0a111d);
  border: 1px solid rgba(90, 130, 200, 0.18);
}
.device-card.online { border-color: rgba(46, 230, 168, 0.35); }
.device-card.offline { opacity: .78; }
.dc-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.dc-header-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dc-actions-wrap { display: flex; gap: 6px; }
.dc-body-with-phone { display: flex; gap: 12px; }
.dc-phone-col { flex: 0 0 58px; }
.dc-phone-col img, .dc-phone-col canvas { width: 58px; border-radius: 8px; background: #0a1020; }
.dc-body { flex: 1; min-width: 0; font-size: 12px; color: #9fb2d0; }
.data-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 16px; }

/* 通用卡片/弹层兜底 */
.panel, .card, .modal-card {
  background: linear-gradient(180deg, #0e1626, #0b1220);
  border: 1px solid rgba(90, 130, 200, 0.18); border-radius: 12px; padding: 16px;
}
.modal-mask, .modal-overlay {
  position: fixed; inset: 0; background: rgba(3, 6, 12, 0.72); display: flex;
  align-items: center; justify-content: center; z-index: 50;
}
.badge, .tag, .chip {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px;
  background: rgba(79, 140, 255, 0.16); color: #a8c6ff;
}

/* ============ 设备卡细节 ============ */
.pill {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
}
.pill.offline { background: rgba(255, 93, 93, 0.16); color: #ff8b8b; }
.pill.online { background: rgba(46, 230, 168, 0.16); color: #5ef0c0; }
.pill.sleep { background: rgba(255, 176, 32, 0.16); color: #ffc45c; }
.dc-id { font-family: Consolas, Menlo, monospace; font-size: 12px; color: #cfe0ff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-btns { display: flex; gap: 6px; }
.act-btn {
  padding: 3px 10px; border-radius: 6px; border: 1px solid rgba(90, 130, 200, 0.22);
  background: rgba(79, 140, 255, 0.12); color: #a8c6ff; font-size: 12px; cursor: pointer;
}
.act-btn:hover { filter: brightness(1.15); }
.act-btn.blue { background: rgba(79, 140, 255, 0.16); color: #a8c6ff; }
.act-btn.purple { background: rgba(154, 123, 255, 0.16); color: #c9b6ff; }
.act-btn.red { background: rgba(255, 93, 93, 0.14); color: #ff8b8b; }

.dc-phone-col { flex: 0 0 72px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dc-phone-icon { line-height: 0; }
.dc-phone-icon svg { display: block; }
.dc-status-pills { display: flex; flex-direction: column; gap: 3px; width: 100%; }
.dc-spill {
  display: flex; align-items: center; justify-content: space-between; gap: 4px;
  padding: 1px 5px; border-radius: 5px; font-size: 10px; line-height: 1.6;
  background: rgba(127, 147, 179, 0.14); color: #9fb2d0;
}
.dc-spill em { font-style: normal; color: #8fa6c8; }
.dc-spill b { font-weight: 700; }
.dc-spill.off { background: rgba(255, 93, 93, 0.12); color: #ff9a9a; }
.dc-spill.on { background: rgba(46, 230, 168, 0.12); color: #6df2c5; }

.dc-body { flex: 1; min-width: 0; }
.dc-row { display: flex; gap: 8px; font-size: 12px; line-height: 1.75; color: #cddcf5; }
.dc-label { flex: 0 0 62px; color: #7789a8; }
.dc-row > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owner-text { color: #a8c6ff; }
.remark-empty { color: #5f7395; cursor: pointer; }
.remark-cell { cursor: pointer; }

.battery-indicator { display: inline-flex; align-items: center; gap: 6px; }
.battery-icon {
  position: relative; width: 26px; height: 12px; border: 1px solid rgba(150, 180, 220, 0.5);
  border-radius: 3px; display: inline-block; padding: 1px;
}
.battery-icon::after {
  content: ""; position: absolute; right: -3px; top: 3px; width: 2px; height: 4px;
  background: rgba(150, 180, 220, 0.5); border-radius: 0 1px 1px 0;
}
.battery-fill { display: block; height: 100%; width: 0; background: #2ee6a8; border-radius: 1px; }
.battery-low .battery-fill { background: #ff5d5d; }
.battery-mid .battery-fill { background: #ffb020; }
.battery-text { font-size: 12px; color: #cddcf5; }

/* 微调：状态胶囊不换行 */
.dc-status-pills { flex: 0 0 auto; }
.dc-spill { white-space: nowrap; font-size: 9.5px; padding: 1px 4px; }
.dc-phone-col { flex: 0 0 82px; }
