:root {
  color-scheme: dark;
  --bg: #070b14;
  --bg-2: #0b1220;
  --panel: #101a2d;
  --panel-2: #152139;
  --line: rgba(148, 163, 184, 0.16);
  --line-strong: rgba(148, 163, 184, 0.28);
  --text: #e8eefc;
  --muted: #8fa2c4;
  --accent: #22c55e;
  --accent-rgb: 34, 197, 94;
  --accent-strong: #16a34a;
  --accent-soft: rgba(var(--accent-rgb), 0.12);
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --topbar-bg: rgba(11, 18, 32, 0.9);
  --font: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Mono", "Consolas", "SF Mono", monospace;
}

/* 商务蓝浅色主题 */
body.theme-light {
  color-scheme: light;
  --bg: #f3f7fd;
  --bg-2: #eaf1fb;
  --panel: #ffffff;
  --panel-2: #e8f0ff;
  --line: rgba(37, 99, 235, 0.16);
  --line-strong: rgba(37, 99, 235, 0.28);
  --text: #1e293b;
  --muted: #475569;
  --accent: #2563eb;
  --accent-rgb: 37, 99, 235;
  --accent-strong: #1d4ed8;
  --accent-soft: rgba(var(--accent-rgb), 0.10);
  --danger: #dc2626;
  --warning: #d97706;
  --shadow: 0 24px 60px rgba(30, 64, 175, 0.16);
  --topbar-bg: rgba(255, 255, 255, 0.92);
}
body.theme-light .login-wrap {
  background:
    radial-gradient(circle at 22% 18%, rgba(37, 99, 235, 0.14), transparent 42%),
    radial-gradient(circle at 82% 88%, rgba(96, 165, 250, 0.12), transparent 46%),
    var(--bg);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, label { margin: 0; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); letter-spacing: 0.3px; }
.error { min-height: 20px; color: #fca5a5; font-size: 12px; }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(400px, 1fr);
  background: #fff;
  color: #0f172a;
  color-scheme: light;
  overflow: hidden;
}
.login-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  padding: clamp(36px, 5.5vw, 78px) clamp(36px, 6vw, 88px);
  color: #fff;
  background:
    radial-gradient(900px 620px at 18% 18%, rgba(59, 130, 246, 0.34), transparent 58%),
    linear-gradient(140deg, #1e3a8a 0%, #172554 58%, #0f172a 100%);
}
.lb-orb { position: absolute; border-radius: 50%; pointer-events: none; }
.lb-orb-a {
  width: 520px; height: 520px; left: -240px; bottom: -260px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 26px rgba(255, 255, 255, 0.02);
}
.lb-orb-b {
  width: 760px; height: 760px; left: -380px; bottom: -500px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.lb-orb-c {
  width: 300px; height: 300px; right: -120px; top: -120px; border: 0;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.16), transparent 68%);
}
.lb-content {
  position: relative; z-index: 1;
  width: 100%; max-width: 600px; min-height: 100%;
  display: flex; flex-direction: column;
}
.lb-head { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
.lb-logo {
  width: 58px; height: 58px; flex: none;
  display: grid; place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(96, 165, 250, 0.45), rgba(37, 99, 235, 0.10));
  border: 1px solid rgba(147, 197, 253, 0.40);
  box-shadow: 0 0 36px rgba(59, 130, 246, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.20);
}
.lb-logo svg { width: 32px; height: 32px; }
.lb-head h1 {
  color: #fff;
  font-size: clamp(26px, 2.4vw, 34px);
  line-height: 1.25;
  letter-spacing: 0.5px;
  font-weight: 800;
}
.lb-head p {
  margin-top: 6px;
  color: rgba(191, 219, 254, 0.66);
  font-size: 11px; letter-spacing: 1.1px; text-transform: uppercase;
}
.lb-release {
  display: inline-block;
  margin-top: 10px;
  padding: 3px 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(219, 234, 254, 0.72);
  font-size: 11px; letter-spacing: 0.2px;
}
.lb-features {
  display: flex; flex-direction: column; gap: 12px;
  max-width: 430px;
  margin-top: 58px;
}
.lb-feature {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 14px 15px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(8px);
}
.lb-icon {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 9px;
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
}
.lb-icon svg { width: 18px; height: 18px; }
.lb-feature strong { display: block; color: #f8fafc; font-size: 13px; font-weight: 600; }
.lb-feature span:not(.lb-icon) {
  display: block; margin-top: 3px;
  color: rgba(191, 219, 254, 0.58);
  font-size: 11px; line-height: 1.55;
}
.lb-footer { margin-top: auto; color: rgba(191, 219, 254, 0.34); font-size: 11px; letter-spacing: 0.2px; }

.login-panel {
  display: flex; align-items: center; justify-content: center;
  padding: 56px clamp(28px, 4vw, 64px);
  background: #fff;
}
.login-form { width: 100%; max-width: 360px; }
.login-welcome {
  display: inline-flex; align-items: center; height: 24px; padding: 0 11px;
  border-radius: 999px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 11px; font-weight: 600; letter-spacing: 0.3px;
}
.login-form h2 {
  margin-top: 14px;
  color: #0f172a;
  font-size: 28px; line-height: 1.25;
  letter-spacing: -0.4px; font-weight: 800;
}
.login-lead { margin-top: 8px; color: #64748b; font-size: 13px; line-height: 1.6; }
.login-field { display: block; margin-top: 20px; color: #475569; font-size: 12px; font-weight: 600; }
.login-input {
  display: flex; align-items: center;
  margin-top: 7px; min-height: 44px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.login-input:focus-within {
  background: #fff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.login-input .li-icon { width: 17px; height: 17px; flex: none; margin-left: 13px; color: #94a3b8; }
.login-input input {
  flex: 1 1 auto; width: 0; min-width: 0;
  box-sizing: border-box;
  padding: 12px 11px;
  border: 0; outline: 0; background: transparent;
  color: #0f172a; font-size: 14px;
}
.login-input input::placeholder { color: #94a3b8; }
.pwd-toggle {
  width: 38px; height: 42px; flex: none;
  border: 0; border-radius: 0 9px 9px 0;
  background: transparent; color: #94a3b8;
  display: grid; place-items: center;
}
.pwd-toggle:hover, .pwd-toggle.on { color: #2563eb; }
.pwd-toggle svg { width: 17px; height: 17px; }
.login-remember {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 14px; color: #64748b; font-size: 12px;
}
.login-remember input {
  appearance: none;
  width: 14px; height: 14px; flex: none;
  border: 1px solid #cbd5e1; border-radius: 3px;
  background: #fff; position: relative;
}
.login-remember input:checked { background: #2563eb; border-color: #2563eb; }
.login-remember input:checked::after {
  content: "";
  position: absolute; left: 4px; top: 1px;
  width: 4px; height: 8px;
  border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.login-submit {
  width: 100%; height: 46px; margin-top: 20px;
  border: 0; border-radius: 10px;
  color: #fff; font-size: 14px; font-weight: 700; letter-spacing: 3px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.26);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.login-submit:hover {
  filter: brightness(1.05);
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.32);
  transform: translateY(-1px);
}
.login-submit:active { transform: translateY(0); }
.login-submit:disabled { opacity: 0.7; cursor: default; transform: none; }
.login-panel .error { margin-top: 8px; color: #dc2626; font-size: 12px; }
.login-qr-card {
  display: flex; align-items: center; gap: 14px;
  margin-top: 22px; padding: 13px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  text-decoration: none;
  transition: border-color 0.18s, background 0.18s;
}
.login-qr-card:hover { border-color: #bfdbfe; background: #f0f7ff; }
.login-qr-card img {
  width: 82px; height: 82px; flex: none;
  padding: 5px; border: 1px solid #eef2f7;
  border-radius: 8px; background: #fff;
}
.login-qr-text { display: block; min-width: 0; }
.login-qr-text strong { display: block; color: #0f172a; font-size: 13px; }
.login-qr-text span { display: block; margin-top: 3px; color: #64748b; font-size: 11px; line-height: 1.5; }
.login-qr-text small { display: block; margin-top: 4px; color: #94a3b8; font-size: 10px; }
.login-foot { margin-top: 18px; color: #94a3b8; font-size: 11px; line-height: 1.7; }
.login-foot a { color: #2563eb; text-decoration: none; }
.login-foot a:hover { text-decoration: underline; }

@media (max-width: 980px) {
  .login-page { grid-template-columns: 1fr; }
  .login-brand { min-height: 168px; padding: 26px 24px; align-items: flex-start; }
  .lb-content { min-height: auto; }
  .lb-head { flex-direction: row; align-items: center; gap: 14px; }
  .lb-features, .lb-footer, .lb-orb-b, .lb-orb-c { display: none; }
  .lb-orb-a { width: 300px; height: 300px; left: -160px; bottom: -220px; }
  .lb-head h1 { font-size: 23px; }
  .lb-head p { font-size: 10px; letter-spacing: 0.6px; }
  .lb-logo { width: 46px; height: 46px; border-radius: 11px; }
  .lb-logo svg { width: 26px; height: 26px; }
  .login-panel { padding: 34px 24px 44px; align-items: flex-start; }
  .login-form { max-width: 420px; margin: 0 auto; }
  .login-qr-card { display: none; }
}
@media (max-width: 560px) {
  .login-brand { min-height: 142px; padding: 22px 18px; }
  .lb-head h1 { font-size: 20px; }
  .lb-head p { font-size: 9px; }
  .lb-release { margin-top: 8px; }
  .login-panel { padding: 28px 18px 36px; }
  .login-form h2 { font-size: 24px; }
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: #04210f;
  font-weight: 800;
  font-size: 22px;
  box-shadow: 0 0 24px rgba(var(--accent-rgb), 0.28);
}
.brand h1 { font-size: 18px; letter-spacing: 0.5px; }
.brand .release {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  vertical-align: 2px;
  white-space: nowrap;
}
.brand p { color: var(--muted); font-size: 12px; margin-top: 2px; }
.brand.small .logo { width: 34px; height: 34px; font-size: 17px; border-radius: 9px; }
.brand.small h1 { font-size: 15px; }
.brand.small .release { font-size: 10px; padding: 1px 6px; vertical-align: 1px; }
.brand.small p { font-size: 11px; }

/* ---------- 表单 ---------- */
.field { display: block; color: var(--muted); font-size: 12px; }
.field input, .field textarea {
  width: 100%;
  margin-top: 7px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 76px; }
.field input:focus, .field textarea:focus {
  border-color: rgba(var(--accent-rgb), 0.6);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
}
.field input::placeholder, .field textarea::placeholder { color: #5f7194; }
.check { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; user-select: none; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }
.check.small { font-size: 12px; }

/* ---------- 按钮 ---------- */
.primary, .ghost, .danger {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  color: var(--text);
  transition: background .15s, border-color .15s, opacity .15s;
}
.primary { background: var(--accent); color: #04210f; font-weight: 700; }
.primary:hover { background: #2ddb6c; }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.ghost { background: var(--panel-2); border-color: var(--line); color: var(--text); }
.ghost:hover { border-color: var(--line-strong); background: #1b2946; }
.danger { background: rgba(239, 68, 68, 0.14); border-color: rgba(239, 68, 68, 0.4); color: #fecaca; }
.danger:hover { background: rgba(239, 68, 68, 0.22); }
.wide { width: 100%; padding: 11px 16px; }

/* ---------- 主框架 ---------- */
#appView { display: flex; flex-direction: column; height: 100vh; }
.topbar {
  height: 64px;
  flex: 0 0 64px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(12px);
}
.top-actions { display: flex; align-items: center; gap: 10px; }
.top-actions a { display: inline-flex; align-items: center; text-decoration: none; font-size: 13px; }
.layout { display: flex; flex: 1; min-height: 0; }

/* ---------- 快速连接 ---------- */
.quickbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 11px 22px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, var(--accent-soft), transparent 58%),
    var(--bg-2);
}
.quick-title { font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: 1px; }
body.theme-light .primary { color: #fff; }
body.theme-light .brand .logo { color: #fff; }
.quickbar input {
  height: 34px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 0 10px;
  outline: none;
  font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
.quickbar input::placeholder { color: #5f7194; }
.quickbar input:focus { border-color: rgba(var(--accent-rgb), 0.55); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1); }
#quickId { width: 190px; font-family: var(--mono); letter-spacing: 0.5px; }
#quickPwd { width: 170px; }
.quickbar .primary { padding: 8px 20px; }
.quick-hint { font-size: 12px; min-width: 0; }
.quick-hint.bad { color: #fca5a5; }

.sidebar {
  width: 330px;
  flex: 0 0 330px;
  border-right: 1px solid var(--line);
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  transition: width .18s ease, flex-basis .18s ease;
}
.layout.collapsed .sidebar { width: 0; flex-basis: 0; border-right: 0; }
.sidebar-toggle { margin-left: auto; }
.workspace { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.search { padding: 16px 16px 10px; }
.search input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 12px;
  outline: none;
}
.search input:focus { border-color: rgba(var(--accent-rgb), 0.5); }
.stats {
  display: flex;
  gap: 16px;
  padding: 0 18px 12px;
  color: var(--muted);
  font-size: 12px;
}
.stats span { display: inline-flex; align-items: center; gap: 6px; }
.stats span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .8; }
.stats span:last-child::before { background: var(--muted); }

.device-list { flex: 1; overflow-y: auto; padding: 4px 10px 14px; }
.device-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 3px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.device-row:hover { background: rgba(148, 163, 184, 0.06); }
.device-row.selected {
  background: var(--accent-soft);
  border-color: rgba(var(--accent-rgb), 0.28);
}
.device-row .device-main { flex: 1; min-width: 0; }
.device-row .device-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-row .device-sub { font-family: var(--mono); color: var(--muted); font-size: 11px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-row .device-time { color: var(--muted); font-size: 11px; white-space: nowrap; }
.device-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.device-del {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  opacity: .55;
}
.device-del:hover {
  color: var(--danger);
  border-color: rgba(239, 68, 68, .35);
  background: rgba(239, 68, 68, .10);
  opacity: 1;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.status-dot.on { background: var(--accent); box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.6); }
.status-dot.off { background: #64748b; }
.status-dot.wait { background: var(--warning); box-shadow: 0 0 10px rgba(245, 158, 11, 0.5); }

.main { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; padding: 26px 30px 40px; position: relative; }
.empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; }
.empty-icon { font-size: 42px; color: var(--accent); opacity: .55; }
.empty h2 { font-size: 18px; font-weight: 600; }
.empty p { max-width: 420px; color: var(--muted); font-size: 13px; line-height: 1.7; }

.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.panel-head h2 { font-size: 22px; letter-spacing: 0.3px; }
.panel-head p { margin-top: 4px; font-size: 12px; font-family: var(--mono); }
.panel-actions { display: flex; gap: 10px; flex: 0 0 auto; }
.panel-actions .primary { padding: 10px 20px; }

.info-grid {
  margin-top: 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.info-grid > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-height: 74px;
}
.info-grid label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 6px; }
.info-grid span { font-size: 14px; font-weight: 500; word-break: break-all; }
#dStatus.online { color: var(--accent); }
#dStatus.offline { color: #94a3b8; }

.password-box {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.password-box label { display: block; color: var(--muted); font-size: 11px; }
.password-line { display: flex; gap: 10px; margin-top: 8px; }
.password-line input {
  flex: 1;
  min-width: 0;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 12px;
  outline: none;
  font-size: 13px;
}
.password-line input:focus { border-color: rgba(var(--accent-rgb), 0.55); }
.password-line .primary { padding: 9px 16px; flex: 0 0 auto; }
.password-tip { margin-top: 8px; font-size: 11px; line-height: 1.6; }

.notes {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.notes label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 8px; }
.notes p { color: #c9d6ef; font-size: 13px; line-height: 1.7; white-space: pre-wrap; }

.sessions { margin-top: 26px; }
.section-title { font-size: 13px; color: var(--muted); margin-bottom: 10px; letter-spacing: 0.5px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.section-head .section-title { margin-bottom: 0; }
.range-filter { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.range-filter input[type="date"] {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  color-scheme: dark;
  padding: 6px 8px;
  outline: none;
  font-size: 12px;
}
.range-filter input[type="date"]:focus { border-color: rgba(var(--accent-rgb), 0.55); }
.range-filter button { padding: 6px 12px; font-size: 12px; }
table { width: 100%; border-collapse: collapse; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--line); }
thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--panel-2);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
tbody td { padding: 10px 12px; border-bottom: 1px solid rgba(148, 163, 184, 0.08); font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody td.mono { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 7, 14, 0.72);
  backdrop-filter: blur(6px);
  padding: 20px;
}
.modal-card {
  width: 420px;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.modal-card h3 { font-size: 17px; margin-bottom: 6px; }
.modal-card > p { font-size: 12px; margin-bottom: 16px; }
.modal-card .field { margin-bottom: 14px; }
.modal-card .check { margin: 4px 0 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

/* ---------- 多会话标签 ---------- */
.session-tabs {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 8px 14px 0;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.session-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 9px 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.session-tab:hover { color: var(--text); border-color: var(--line-strong); }
.session-tab.active { background: var(--panel-2); color: var(--text); border-color: var(--line-strong); }
.session-tab .tab-label { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.session-tab .tab-badge {
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  display: inline-grid;
  place-items: center;
}
.session-tab .tab-close {
  margin-left: 2px;
  padding: 1px 4px;
  border-radius: 5px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
}
.session-tab .tab-close:hover { background: rgba(239, 68, 68, 0.2); color: #fecaca; }

.resume-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 55;
  box-shadow: var(--shadow);
}

/* ---------- 客服账号管理 ---------- */
.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.user-row .u-name { flex: 1; }
.user-row .u-del { padding: 4px 10px; font-size: 12px; }
.users-add {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 8px;
  margin-top: 14px;
}
.users-add input {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 9px 11px;
  outline: none;
}
.users-add input:focus { border-color: rgba(var(--accent-rgb), 0.6); }

/* ---------- 聊天记录 ---------- */
.chat-log {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.chat-line b { color: var(--muted); font-weight: 600; }
.chat-line .chat-time { color: var(--muted); margin-right: 8px; }

/* ---------- 会话 ---------- */
.session {
  position: absolute;
  inset: 0;
  z-index: 6;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.session-bar {
  height: 58px;
  flex: 0 0 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.session-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.session-title span#sTitle { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-title span#sStatus { font-size: 12px; }
.session-tools { display: flex; align-items: center; gap: 14px; }
.canvas-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 14px;
}
canvas#screen {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
  border-radius: 6px;
  outline: none;
  cursor: default;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  pointer-events: none;
}
.session-main { flex: 1; min-height: 0; display: flex; }
.session.fullscreen-mode .session-side { display: none; }
.session.fullscreen-mode .canvas-wrap { padding: 0; }
.session.fullscreen-mode .session-foot { display: none; }
.session.fullscreen-mode canvas#screen { border-radius: 0; box-shadow: none; }
/* 全屏时完全隐藏控制台工具栏，只保留远程画面，避免悬浮层遮挡客户机窗口右上角按钮 */
.session.fullscreen-mode .session-bar { display: none; }
.session-side {
  width: 360px;
  flex: 0 0 360px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  border-left: 1px solid var(--line);
}
.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.side-head-title { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.side-head-title strong { font-size: 13px; }
.side-head-title span { color: var(--muted); font-size: 10px; }
.side-toggle { flex: 0 0 auto; padding: 6px 10px; font-size: 11px; }
.side-toggle.active {
  background: var(--accent-soft);
  border-color: var(--line-strong);
  color: var(--accent);
}
.side-pane { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.side-pane.drop-active { box-shadow: inset 0 0 0 2px rgba(var(--accent-rgb), 0.45); }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-msg {
  max-width: 88%;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-msg.me {
  align-self: flex-end;
  background: rgba(var(--accent-rgb), 0.14);
  border-color: rgba(var(--accent-rgb), 0.3);
}
.chat-msg.them { align-self: flex-start; }
.chat-msg.sys {
  align-self: center;
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-size: 11px;
  padding: 2px 8px;
}
.chat-msg.chat-msg-file { max-width: 94%; padding: 6px 8px; }
.chat-meta { display: block; margin-bottom: 3px; font-size: 10px; color: var(--muted); }
.chat-file-card {
  min-width: 200px;
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
}
.chat-msg.me .chat-file-card { background: rgba(var(--accent-rgb), 0.08); }
.chat-file-card.failed { border-color: rgba(239, 68, 68, 0.5); }
.cf-head { display: flex; align-items: center; gap: 8px; }
.cf-icon {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(var(--accent-rgb), 0.16);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}
.cf-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 600;
}
.cf-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
}
.cf-status { font-family: var(--mono); white-space: nowrap; }
.chat-file-card.failed .cf-status { color: var(--danger); }
.cf-path {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  opacity: 0.85;
  word-break: break-all;
}
.cf-bar {
  height: 3px;
  margin-top: 7px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
}
.cf-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.12s linear;
}
.chat-drop-hint {
  margin: 0 12px 8px;
  padding: 7px 10px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.chat-drop-hint.paste-ready,
.side-pane.drop-active .chat-drop-hint {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.chat-compose {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}
.chat-compose textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
  font: 12px/1.5 var(--font);
}
.chat-compose textarea:focus { border-color: rgba(var(--accent-rgb), 0.55); }
.chat-compose .primary { flex: 0 0 auto; padding: 8px 14px; }
.chat-attach {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}
.chat-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 8px;
}
.chat-tools button { flex: 0 0 auto; padding: 5px 10px; font-size: 11px; }
.chat-tools .transfer-status {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.remote-files {
  flex: 0 1 46%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.remote-files .file-list { flex: 1; max-height: 240px; }

.file-toolbar { display: flex; gap: 8px; padding: 10px 12px 0; }
.file-toolbar input {
  flex: 1;
  min-width: 0;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 7px 10px;
  outline: none;
  font-family: var(--mono);
  font-size: 12px;
}
.file-toolbar input:focus { border-color: rgba(var(--accent-rgb), 0.55); }
.file-toolbar button { padding: 7px 12px; font-size: 12px; }
.file-list { flex: 1; overflow-y: auto; margin-top: 10px; padding: 0 8px 8px; }
.file-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  text-align: left;
  font-size: 12px;
}
.file-row:hover { background: rgba(148, 163, 184, 0.07); }
.file-badge {
  flex: 0 0 auto;
  width: 26px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 10px;
  color: var(--muted);
}
.file-badge.dir { color: #fbbf24; border-color: rgba(245, 158, 11, 0.35); }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { flex: 0 0 auto; color: var(--muted); font-size: 10px; font-family: var(--mono); }
.file-dl { flex: 0 0 auto; padding: 4px 8px; font-size: 11px; }
.transfer-status { padding: 8px 12px; color: var(--muted); font-size: 11px; min-height: 28px; word-break: break-all; }
.progress { height: 4px; margin: 0 12px 10px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.progress #progressBar { height: 100%; width: 0; background: var(--accent); transition: width 0.12s linear; }

.session-foot {
  flex: 0 0 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid rgba(148, 163, 184, 0.08);
}

/* ---------- 提示 ---------- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow);
}
.toast.error { color: #fecaca; border-color: rgba(239, 68, 68, 0.5); }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .layout { flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; }
  .quickbar { padding: 10px 14px; }
  #quickId { flex: 1; width: auto; min-width: 130px; }
  #quickPwd { flex: 1; width: auto; min-width: 120px; }
  .quick-hint { flex: 1 0 100%; }
  .sidebar { width: 100%; flex: 0 0 auto; max-height: 38vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .main { padding: 20px 18px 40px; }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-head { flex-direction: column; }
  .panel-actions { width: 100%; }
  .panel-actions .primary, .panel-actions .ghost { flex: 1; }
  .session-tools { gap: 8px; }
  .session-tools .mono { display: none; }
  .session-main { flex-direction: column; }
  .session-side {
    width: 100%;
    flex: 0 0 46%;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
@media (max-width: 560px) {
  .info-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .brand.small p { display: none; }
  .device-time { display: none; }
  .top-actions { gap: 6px; }
  .top-actions .ghost { padding: 7px 10px; font-size: 12px; }
}

/* 滚动条 */
.device-list::-webkit-scrollbar, .main::-webkit-scrollbar { width: 8px; }
.device-list::-webkit-scrollbar-thumb, .main::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.2); border-radius: 999px; }

/* 原生设备网页只读预览 */
.native-preview {
  margin: 10px 0 14px;
  border: 1px solid var(--line, rgba(148, 163, 184, 0.16));
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}
.native-preview[hidden] { display: none; }
.native-preview img {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: #000;
  opacity: 0;
  transition: opacity .2s ease;
}
.native-preview-tip {
  margin: 0;
  padding: 6px 10px;
  font-size: 11px;
  color: var(--muted, #8fa2c4);
  background: var(--bg-2, #0b1220);
  border-top: 1px solid rgba(148, 163, 184, 0.10);
}
